UNPKG

761 kBJavaScriptView 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 = 184);
74/******/ })
75/************************************************************************/
76/******/ ([
77/* 0 */
78/***/ (function(module, __webpack_exports__, __webpack_require__) {
79
80"use strict";
81Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
82/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_default_js__ = __webpack_require__(204);
83/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__index_default_js__["a"]; });
84/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index_js__ = __webpack_require__(82);
85/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["VERSION"]; });
86/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["restArguments"]; });
87/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isObject"]; });
88/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNull"]; });
89/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isUndefined"]; });
90/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isBoolean"]; });
91/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isElement"]; });
92/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isString"]; });
93/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNumber"]; });
94/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDate"]; });
95/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isRegExp"]; });
96/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isError"]; });
97/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSymbol"]; });
98/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArrayBuffer"]; });
99/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDataView"]; });
100/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArray"]; });
101/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFunction"]; });
102/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArguments"]; });
103/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFinite"]; });
104/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNaN"]; });
105/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isTypedArray"]; });
106/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEmpty"]; });
107/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMatch"]; });
108/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEqual"]; });
109/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMap"]; });
110/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakMap"]; });
111/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSet"]; });
112/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakSet"]; });
113/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["keys"]; });
114/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["allKeys"]; });
115/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["values"]; });
116/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pairs"]; });
117/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invert"]; });
118/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["functions"]; });
119/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["methods"]; });
120/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extend"]; });
121/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extendOwn"]; });
122/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["assign"]; });
123/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defaults"]; });
124/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["create"]; });
125/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["clone"]; });
126/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tap"]; });
127/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["get"]; });
128/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["has"]; });
129/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mapObject"]; });
130/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["identity"]; });
131/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["constant"]; });
132/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["noop"]; });
133/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toPath"]; });
134/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["property"]; });
135/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["propertyOf"]; });
136/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matcher"]; });
137/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matches"]; });
138/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["times"]; });
139/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["random"]; });
140/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["now"]; });
141/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["escape"]; });
142/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unescape"]; });
143/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["templateSettings"]; });
144/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["template"]; });
145/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["result"]; });
146/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniqueId"]; });
147/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chain"]; });
148/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["iteratee"]; });
149/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partial"]; });
150/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bind"]; });
151/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bindAll"]; });
152/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["memoize"]; });
153/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["delay"]; });
154/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defer"]; });
155/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["throttle"]; });
156/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["debounce"]; });
157/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["wrap"]; });
158/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["negate"]; });
159/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compose"]; });
160/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["after"]; });
161/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["before"]; });
162/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["once"]; });
163/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findKey"]; });
164/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findIndex"]; });
165/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findLastIndex"]; });
166/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortedIndex"]; });
167/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexOf"]; });
168/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["lastIndexOf"]; });
169/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["find"]; });
170/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["detect"]; });
171/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findWhere"]; });
172/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["each"]; });
173/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["forEach"]; });
174/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["map"]; });
175/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["collect"]; });
176/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduce"]; });
177/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldl"]; });
178/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["inject"]; });
179/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduceRight"]; });
180/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldr"]; });
181/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["filter"]; });
182/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["select"]; });
183/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reject"]; });
184/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["every"]; });
185/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["all"]; });
186/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["some"]; });
187/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["any"]; });
188/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["contains"]; });
189/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["includes"]; });
190/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["include"]; });
191/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invoke"]; });
192/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pluck"]; });
193/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["where"]; });
194/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["max"]; });
195/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["min"]; });
196/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["shuffle"]; });
197/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sample"]; });
198/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortBy"]; });
199/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["groupBy"]; });
200/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexBy"]; });
201/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["countBy"]; });
202/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partition"]; });
203/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toArray"]; });
204/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["size"]; });
205/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pick"]; });
206/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["omit"]; });
207/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["first"]; });
208/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["head"]; });
209/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["take"]; });
210/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["initial"]; });
211/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["last"]; });
212/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["rest"]; });
213/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tail"]; });
214/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["drop"]; });
215/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compact"]; });
216/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["flatten"]; });
217/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["without"]; });
218/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniq"]; });
219/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unique"]; });
220/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["union"]; });
221/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["intersection"]; });
222/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["difference"]; });
223/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unzip"]; });
224/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["transpose"]; });
225/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["zip"]; });
226/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["object"]; });
227/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["range"]; });
228/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chunk"]; });
229/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mixin"]; });
230// ESM Exports
231// ===========
232// This module is the package entry point for ES module users. In other words,
233// it is the module they are interfacing with when they import from the whole
234// package instead of from a submodule, like this:
235//
236// ```js
237// import { map } from 'underscore';
238// ```
239//
240// The difference with `./index-default`, which is the package entry point for
241// CommonJS, AMD and UMD users, is purely technical. In ES modules, named and
242// default exports are considered to be siblings, so when you have a default
243// export, its properties are not automatically available as named exports. For
244// this reason, we re-export the named exports in addition to providing the same
245// default export as in `./index-default`.
246
247
248
249
250/***/ }),
251/* 1 */
252/***/ (function(module, __webpack_exports__, __webpack_require__) {
253
254"use strict";
255/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
256/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
257/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
258/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
259/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
260/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
261/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
262/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
263/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
264/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
265/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
266/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
267/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
268/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
269/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
270/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
271/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
272/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
273/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
274/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
275// Current version.
276var VERSION = '1.12.1';
277
278// Establish the root object, `window` (`self`) in the browser, `global`
279// on the server, or `this` in some virtual machines. We use `self`
280// instead of `window` for `WebWorker` support.
281var root = typeof self == 'object' && self.self === self && self ||
282 typeof global == 'object' && global.global === global && global ||
283 Function('return this')() ||
284 {};
285
286// Save bytes in the minified (but not gzipped) version:
287var ArrayProto = Array.prototype, ObjProto = Object.prototype;
288var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
289
290// Create quick reference variables for speed access to core prototypes.
291var push = ArrayProto.push,
292 slice = ArrayProto.slice,
293 toString = ObjProto.toString,
294 hasOwnProperty = ObjProto.hasOwnProperty;
295
296// Modern feature detection.
297var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
298 supportsDataView = typeof DataView !== 'undefined';
299
300// All **ECMAScript 5+** native function implementations that we hope to use
301// are declared here.
302var nativeIsArray = Array.isArray,
303 nativeKeys = Object.keys,
304 nativeCreate = Object.create,
305 nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
306
307// Create references to these builtin functions because we override them.
308var _isNaN = isNaN,
309 _isFinite = isFinite;
310
311// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
312var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
313var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
314 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
315
316// The largest integer that can be represented exactly.
317var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
318
319/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(116)))
320
321/***/ }),
322/* 2 */
323/***/ (function(module, exports) {
324
325var core = module.exports = { version: '2.6.9' };
326if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
327
328
329/***/ }),
330/* 3 */
331/***/ (function(module, exports, __webpack_require__) {
332
333module.exports = { "default": __webpack_require__(187), __esModule: true };
334
335/***/ }),
336/* 4 */
337/***/ (function(module, __webpack_exports__, __webpack_require__) {
338
339"use strict";
340/* harmony export (immutable) */ __webpack_exports__["a"] = keys;
341/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(28);
342/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
343/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(25);
344/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(127);
345
346
347
348
349
350// Retrieve the names of an object's own properties.
351// Delegates to **ECMAScript 5**'s native `Object.keys`.
352function keys(obj) {
353 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
354 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj);
355 var keys = [];
356 for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key);
357 // Ahem, IE < 9.
358 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys);
359 return keys;
360}
361
362
363/***/ }),
364/* 5 */
365/***/ (function(module, exports) {
366
367// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
368var global = module.exports = typeof window != 'undefined' && window.Math == Math
369 ? window : typeof self != 'undefined' && self.Math == Math ? self
370 // eslint-disable-next-line no-new-func
371 : Function('return this')();
372if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
373
374
375/***/ }),
376/* 6 */
377/***/ (function(module, __webpack_exports__, __webpack_require__) {
378
379"use strict";
380/* harmony export (immutable) */ __webpack_exports__["a"] = tagTester;
381/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
382
383
384// Internal function for creating a `toString`-based type tester.
385function tagTester(name) {
386 var tag = '[object ' + name + ']';
387 return function(obj) {
388 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag;
389 };
390}
391
392
393/***/ }),
394/* 7 */
395/***/ (function(module, exports, __webpack_require__) {
396
397var store = __webpack_require__(79)('wks');
398var uid = __webpack_require__(60);
399var Symbol = __webpack_require__(5).Symbol;
400var USE_SYMBOL = typeof Symbol == 'function';
401
402var $exports = module.exports = function (name) {
403 return store[name] || (store[name] =
404 USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
405};
406
407$exports.store = store;
408
409
410/***/ }),
411/* 8 */
412/***/ (function(module, exports, __webpack_require__) {
413
414var global = __webpack_require__(5);
415var core = __webpack_require__(2);
416var ctx = __webpack_require__(22);
417var hide = __webpack_require__(23);
418var has = __webpack_require__(24);
419var PROTOTYPE = 'prototype';
420
421var $export = function (type, name, source) {
422 var IS_FORCED = type & $export.F;
423 var IS_GLOBAL = type & $export.G;
424 var IS_STATIC = type & $export.S;
425 var IS_PROTO = type & $export.P;
426 var IS_BIND = type & $export.B;
427 var IS_WRAP = type & $export.W;
428 var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
429 var expProto = exports[PROTOTYPE];
430 var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
431 var key, own, out;
432 if (IS_GLOBAL) source = name;
433 for (key in source) {
434 // contains in native
435 own = !IS_FORCED && target && target[key] !== undefined;
436 if (own && has(exports, key)) continue;
437 // export native or passed
438 out = own ? target[key] : source[key];
439 // prevent global pollution for namespaces
440 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
441 // bind timers to global for call from export context
442 : IS_BIND && own ? ctx(out, global)
443 // wrap global constructors for prevent change them in library
444 : IS_WRAP && target[key] == out ? (function (C) {
445 var F = function (a, b, c) {
446 if (this instanceof C) {
447 switch (arguments.length) {
448 case 0: return new C();
449 case 1: return new C(a);
450 case 2: return new C(a, b);
451 } return new C(a, b, c);
452 } return C.apply(this, arguments);
453 };
454 F[PROTOTYPE] = C[PROTOTYPE];
455 return F;
456 // make static versions for prototype methods
457 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
458 // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
459 if (IS_PROTO) {
460 (exports.virtual || (exports.virtual = {}))[key] = out;
461 // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
462 if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
463 }
464 }
465};
466// type bitmap
467$export.F = 1; // forced
468$export.G = 2; // global
469$export.S = 4; // static
470$export.P = 8; // proto
471$export.B = 16; // bind
472$export.W = 32; // wrap
473$export.U = 64; // safe
474$export.R = 128; // real proto method for `library`
475module.exports = $export;
476
477
478/***/ }),
479/* 9 */
480/***/ (function(module, __webpack_exports__, __webpack_require__) {
481
482"use strict";
483/* harmony export (immutable) */ __webpack_exports__["a"] = cb;
484/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
485/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(137);
486/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(138);
487
488
489
490
491// The function we call internally to generate a callback. It invokes
492// `_.iteratee` if overridden, otherwise `baseIteratee`.
493function cb(value, context, argCount) {
494 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);
495 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount);
496}
497
498
499/***/ }),
500/* 10 */
501/***/ (function(module, exports) {
502
503module.exports = function (it) {
504 return typeof it === 'object' ? it !== null : typeof it === 'function';
505};
506
507
508/***/ }),
509/* 11 */
510/***/ (function(module, __webpack_exports__, __webpack_require__) {
511
512"use strict";
513/* harmony export (immutable) */ __webpack_exports__["a"] = restArguments;
514// Some functions take a variable number of arguments, or a few expected
515// arguments at the beginning and then a variable number of values to operate
516// on. This helper accumulates all remaining arguments past the function’s
517// argument length (or an explicit `startIndex`), into an array that becomes
518// the last argument. Similar to ES6’s "rest parameter".
519function restArguments(func, startIndex) {
520 startIndex = startIndex == null ? func.length - 1 : +startIndex;
521 return function() {
522 var length = Math.max(arguments.length - startIndex, 0),
523 rest = Array(length),
524 index = 0;
525 for (; index < length; index++) {
526 rest[index] = arguments[index + startIndex];
527 }
528 switch (startIndex) {
529 case 0: return func.call(this, rest);
530 case 1: return func.call(this, arguments[0], rest);
531 case 2: return func.call(this, arguments[0], arguments[1], rest);
532 }
533 var args = Array(startIndex + 1);
534 for (index = 0; index < startIndex; index++) {
535 args[index] = arguments[index];
536 }
537 args[startIndex] = rest;
538 return func.apply(this, args);
539 };
540}
541
542
543/***/ }),
544/* 12 */
545/***/ (function(module, __webpack_exports__, __webpack_require__) {
546
547"use strict";
548/* harmony export (immutable) */ __webpack_exports__["a"] = _;
549/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
550
551
552// If Underscore is called as a function, it returns a wrapped object that can
553// be used OO-style. This wrapper holds altered versions of all functions added
554// through `_.mixin`. Wrapped objects may be chained.
555function _(obj) {
556 if (obj instanceof _) return obj;
557 if (!(this instanceof _)) return new _(obj);
558 this._wrapped = obj;
559}
560
561_.VERSION = __WEBPACK_IMPORTED_MODULE_0__setup_js__["e" /* VERSION */];
562
563// Extracts the result from a wrapped and chained object.
564_.prototype.value = function() {
565 return this._wrapped;
566};
567
568// Provide unwrapping proxies for some methods used in engine operations
569// such as arithmetic and JSON stringification.
570_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
571
572_.prototype.toString = function() {
573 return String(this._wrapped);
574};
575
576
577/***/ }),
578/* 13 */
579/***/ (function(module, __webpack_exports__, __webpack_require__) {
580
581"use strict";
582/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(125);
583/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(16);
584
585
586
587// Internal helper for collection methods to determine whether a collection
588// should be iterated as an array or as an object.
589// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
590// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
591/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]));
592
593
594/***/ }),
595/* 14 */
596/***/ (function(module, exports, __webpack_require__) {
597
598"use strict";
599
600
601var _promise = __webpack_require__(3);
602
603var _promise2 = _interopRequireDefault(_promise);
604
605function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
606
607var _ = __webpack_require__(0);
608var md5 = __webpack_require__(317);
609
610var _require = __webpack_require__(0),
611 extend = _require.extend;
612
613var AV = __webpack_require__(39);
614
615var _require2 = __webpack_require__(17),
616 getSessionToken = _require2.getSessionToken;
617
618var ajax = __webpack_require__(68);
619
620// 计算 X-LC-Sign 的签名方法
621var sign = function sign(key, isMasterKey) {
622 var now = new Date().getTime();
623 var signature = md5(now + key);
624 if (isMasterKey) {
625 return signature + ',' + now + ',master';
626 }
627 return signature + ',' + now;
628};
629
630var setAppKey = function setAppKey(headers, signKey) {
631 if (signKey) {
632 headers['X-LC-Sign'] = sign(AV.applicationKey);
633 } else {
634 headers['X-LC-Key'] = AV.applicationKey;
635 }
636};
637
638var setHeaders = function setHeaders() {
639 var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
640 var signKey = arguments[1];
641
642 var headers = {
643 'X-LC-Id': AV.applicationId,
644 'Content-Type': 'application/json;charset=UTF-8'
645 };
646 var useMasterKey = false;
647 if (typeof authOptions.useMasterKey === 'boolean') {
648 useMasterKey = authOptions.useMasterKey;
649 } else if (typeof AV._config.useMasterKey === 'boolean') {
650 useMasterKey = AV._config.useMasterKey;
651 }
652 if (useMasterKey) {
653 if (AV.masterKey) {
654 if (signKey) {
655 headers['X-LC-Sign'] = sign(AV.masterKey, true);
656 } else {
657 headers['X-LC-Key'] = AV.masterKey + ',master';
658 }
659 } else {
660 console.warn('masterKey is not set, fall back to use appKey');
661 setAppKey(headers, signKey);
662 }
663 } else {
664 setAppKey(headers, signKey);
665 }
666 if (AV.hookKey) {
667 headers['X-LC-Hook-Key'] = AV.hookKey;
668 }
669 if (AV._config.production !== null) {
670 headers['X-LC-Prod'] = String(AV._config.production);
671 }
672 headers[ false ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
673
674 return _promise2.default.resolve().then(function () {
675 // Pass the session token
676 var sessionToken = getSessionToken(authOptions);
677 if (sessionToken) {
678 headers['X-LC-Session'] = sessionToken;
679 } else if (!AV._config.disableCurrentUser) {
680 return AV.User.currentAsync().then(function (currentUser) {
681 if (currentUser && currentUser._sessionToken) {
682 headers['X-LC-Session'] = currentUser._sessionToken;
683 }
684 return headers;
685 });
686 }
687 return headers;
688 });
689};
690
691var createApiUrl = function createApiUrl(_ref) {
692 var _ref$service = _ref.service,
693 service = _ref$service === undefined ? 'api' : _ref$service,
694 _ref$version = _ref.version,
695 version = _ref$version === undefined ? '1.1' : _ref$version,
696 path = _ref.path;
697
698 var apiURL = AV._config.serverURLs[service];
699
700 if (!apiURL) throw new Error('undefined server URL for ' + service);
701
702 if (apiURL.charAt(apiURL.length - 1) !== '/') {
703 apiURL += '/';
704 }
705 apiURL += version;
706 if (path) {
707 apiURL += path;
708 }
709
710 return apiURL;
711};
712
713/**
714 * Low level REST API client. Call REST endpoints with authorization headers.
715 * @function AV.request
716 * @since 3.0.0
717 * @param {Object} options
718 * @param {String} options.method HTTP method
719 * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
720 * @param {Object} [options.query] query string dict
721 * @param {Object} [options.data] HTTP body
722 * @param {AuthOptions} [options.authOptions]
723 * @param {String} [options.service = 'api']
724 * @param {String} [options.version = '1.1']
725 */
726var request = function request(_ref2) {
727 var service = _ref2.service,
728 version = _ref2.version,
729 method = _ref2.method,
730 path = _ref2.path,
731 query = _ref2.query,
732 data = _ref2.data,
733 authOptions = _ref2.authOptions,
734 _ref2$signKey = _ref2.signKey,
735 signKey = _ref2$signKey === undefined ? true : _ref2$signKey;
736
737 if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
738 throw new Error('Not initialized');
739 }
740 if (AV._appRouter) {
741 AV._appRouter.refresh();
742 }
743 var timeout = AV._config.requestTimeout;
744
745 var url = createApiUrl({ service: service, path: path, version: version });
746 return setHeaders(authOptions, signKey).then(function (headers) {
747 return ajax({ method: method, url: url, query: query, data: data, headers: headers, timeout: timeout }).catch(function (error) {
748 var errorJSON = {
749 code: error.code || -1,
750 error: error.message || error.responseText
751 };
752 if (error.response && error.response.code) {
753 errorJSON = error.response;
754 } else if (error.responseText) {
755 try {
756 errorJSON = JSON.parse(error.responseText);
757 } catch (e) {
758 // If we fail to parse the error text, that's okay.
759 }
760 }
761 errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
762 if (!AV._sharedConfig.keepErrorRawMessage) {
763 errorJSON.error += ' [' + (error.statusCode || 'N/A') + ' ' + method + ' ' + url + ']';
764 }
765 // Transform the error into an instance of AVError by trying to parse
766 // the error string as JSON.
767 var err = new Error(errorJSON.error);
768 delete errorJSON.error;
769 throw _.extend(err, errorJSON);
770 });
771 });
772};
773
774// lagecy request
775var _request = function _request(route, className, objectId, method, data, authOptions, query) {
776 var path = '';
777 if (route) path += '/' + route;
778 if (className) path += '/' + className;
779 if (objectId) path += '/' + objectId;
780 // for migeration
781 if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
782 if (data && data._where) throw new Error('_where should be in the query');
783 if (method && method.toLowerCase() === 'get') {
784 query = extend({}, query, data);
785 data = null;
786 }
787 return request({
788 method: method,
789 path: path,
790 query: query,
791 data: data,
792 authOptions: authOptions
793 });
794};
795
796AV.request = request;
797
798module.exports = {
799 _request: _request,
800 request: request
801};
802
803/***/ }),
804/* 15 */
805/***/ (function(module, __webpack_exports__, __webpack_require__) {
806
807"use strict";
808/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
809/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
810
811
812
813var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
814
815// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
816// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
817var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
818if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
819 isFunction = function(obj) {
820 return typeof obj == 'function' || false;
821 };
822}
823
824/* harmony default export */ __webpack_exports__["a"] = (isFunction);
825
826
827/***/ }),
828/* 16 */
829/***/ (function(module, __webpack_exports__, __webpack_require__) {
830
831"use strict";
832/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(126);
833
834
835// Internal helper to obtain the `length` property of an object.
836/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
837
838
839/***/ }),
840/* 17 */
841/***/ (function(module, exports, __webpack_require__) {
842
843"use strict";
844
845
846var _promise = __webpack_require__(3);
847
848var _promise2 = _interopRequireDefault(_promise);
849
850var _getPrototypeOf = __webpack_require__(99);
851
852var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
853
854function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
855
856var _ = __webpack_require__(0);
857
858// Helper function to check null or undefined.
859var isNullOrUndefined = function isNullOrUndefined(x) {
860 return _.isNull(x) || _.isUndefined(x);
861};
862
863var ensureArray = function ensureArray(target) {
864 if (_.isArray(target)) {
865 return target;
866 }
867 if (target === undefined || target === null) {
868 return [];
869 }
870 return [target];
871};
872
873var transformFetchOptions = function transformFetchOptions() {
874 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
875 keys = _ref.keys,
876 include = _ref.include,
877 includeACL = _ref.includeACL;
878
879 var fetchOptions = {};
880 if (keys) {
881 fetchOptions.keys = ensureArray(keys).join(',');
882 }
883 if (include) {
884 fetchOptions.include = ensureArray(include).join(',');
885 }
886 if (includeACL) {
887 fetchOptions.returnACL = includeACL;
888 }
889 return fetchOptions;
890};
891
892var getSessionToken = function getSessionToken(authOptions) {
893 if (authOptions.sessionToken) {
894 return authOptions.sessionToken;
895 }
896 if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
897 return authOptions.user.getSessionToken();
898 }
899};
900
901var tap = function tap(interceptor) {
902 return function (value) {
903 return interceptor(value), value;
904 };
905};
906
907// Shared empty constructor function to aid in prototype-chain creation.
908var EmptyConstructor = function EmptyConstructor() {};
909
910// Helper function to correctly set up the prototype chain, for subclasses.
911// Similar to `goog.inherits`, but uses a hash of prototype properties and
912// class properties to be extended.
913var inherits = function inherits(parent, protoProps, staticProps) {
914 var child;
915
916 // The constructor function for the new subclass is either defined by you
917 // (the "constructor" property in your `extend` definition), or defaulted
918 // by us to simply call the parent's constructor.
919 if (protoProps && protoProps.hasOwnProperty('constructor')) {
920 child = protoProps.constructor;
921 } else {
922 /** @ignore */
923 child = function child() {
924 parent.apply(this, arguments);
925 };
926 }
927
928 // Inherit class (static) properties from parent.
929 _.extend(child, parent);
930
931 // Set the prototype chain to inherit from `parent`, without calling
932 // `parent`'s constructor function.
933 EmptyConstructor.prototype = parent.prototype;
934 child.prototype = new EmptyConstructor();
935
936 // Add prototype properties (instance properties) to the subclass,
937 // if supplied.
938 if (protoProps) {
939 _.extend(child.prototype, protoProps);
940 }
941
942 // Add static properties to the constructor function, if supplied.
943 if (staticProps) {
944 _.extend(child, staticProps);
945 }
946
947 // Correctly set child's `prototype.constructor`.
948 child.prototype.constructor = child;
949
950 // Set a convenience property in case the parent's prototype is
951 // needed later.
952 child.__super__ = parent.prototype;
953
954 return child;
955};
956
957var parseDate = function parseDate(iso8601) {
958 return new Date(iso8601);
959};
960
961var setValue = function setValue(target, key, value) {
962 // '.' is not allowed in Class keys, escaping is not in concern now.
963 var segs = key.split('.');
964 var lastSeg = segs.pop();
965 var currentTarget = target;
966 segs.forEach(function (seg) {
967 if (currentTarget[seg] === undefined) currentTarget[seg] = {};
968 currentTarget = currentTarget[seg];
969 });
970 currentTarget[lastSeg] = value;
971 return target;
972};
973
974var findValue = function findValue(target, key) {
975 var segs = key.split('.');
976 var firstSeg = segs[0];
977 var lastSeg = segs.pop();
978 var currentTarget = target;
979 for (var i = 0; i < segs.length; i++) {
980 currentTarget = currentTarget[segs[i]];
981 if (currentTarget === undefined) {
982 return [undefined, undefined, lastSeg];
983 }
984 }
985 var value = currentTarget[lastSeg];
986 return [value, currentTarget, lastSeg, firstSeg];
987};
988
989var isPlainObject = function isPlainObject(obj) {
990 return _.isObject(obj) && (0, _getPrototypeOf2.default)(obj) === Object.prototype;
991};
992
993var continueWhile = function continueWhile(predicate, asyncFunction) {
994 if (predicate()) {
995 return asyncFunction().then(function () {
996 return continueWhile(predicate, asyncFunction);
997 });
998 }
999 return _promise2.default.resolve();
1000};
1001
1002module.exports = {
1003 isNullOrUndefined: isNullOrUndefined,
1004 ensureArray: ensureArray,
1005 transformFetchOptions: transformFetchOptions,
1006 getSessionToken: getSessionToken,
1007 tap: tap,
1008 inherits: inherits,
1009 parseDate: parseDate,
1010 setValue: setValue,
1011 findValue: findValue,
1012 isPlainObject: isPlainObject,
1013 continueWhile: continueWhile
1014};
1015
1016/***/ }),
1017/* 18 */
1018/***/ (function(module, exports, __webpack_require__) {
1019
1020var isObject = __webpack_require__(10);
1021module.exports = function (it) {
1022 if (!isObject(it)) throw TypeError(it + ' is not an object!');
1023 return it;
1024};
1025
1026
1027/***/ }),
1028/* 19 */
1029/***/ (function(module, exports, __webpack_require__) {
1030
1031// Thank's IE8 for his funny defineProperty
1032module.exports = !__webpack_require__(26)(function () {
1033 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
1034});
1035
1036
1037/***/ }),
1038/* 20 */
1039/***/ (function(module, exports, __webpack_require__) {
1040
1041var anObject = __webpack_require__(18);
1042var IE8_DOM_DEFINE = __webpack_require__(105);
1043var toPrimitive = __webpack_require__(74);
1044var dP = Object.defineProperty;
1045
1046exports.f = __webpack_require__(19) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
1047 anObject(O);
1048 P = toPrimitive(P, true);
1049 anObject(Attributes);
1050 if (IE8_DOM_DEFINE) try {
1051 return dP(O, P, Attributes);
1052 } catch (e) { /* empty */ }
1053 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
1054 if ('value' in Attributes) O[P] = Attributes.value;
1055 return O;
1056};
1057
1058
1059/***/ }),
1060/* 21 */
1061/***/ (function(module, exports, __webpack_require__) {
1062
1063module.exports = { "default": __webpack_require__(276), __esModule: true };
1064
1065/***/ }),
1066/* 22 */
1067/***/ (function(module, exports, __webpack_require__) {
1068
1069// optional / simple context binding
1070var aFunction = __webpack_require__(44);
1071module.exports = function (fn, that, length) {
1072 aFunction(fn);
1073 if (that === undefined) return fn;
1074 switch (length) {
1075 case 1: return function (a) {
1076 return fn.call(that, a);
1077 };
1078 case 2: return function (a, b) {
1079 return fn.call(that, a, b);
1080 };
1081 case 3: return function (a, b, c) {
1082 return fn.call(that, a, b, c);
1083 };
1084 }
1085 return function (/* ...args */) {
1086 return fn.apply(that, arguments);
1087 };
1088};
1089
1090
1091/***/ }),
1092/* 23 */
1093/***/ (function(module, exports, __webpack_require__) {
1094
1095var dP = __webpack_require__(20);
1096var createDesc = __webpack_require__(58);
1097module.exports = __webpack_require__(19) ? function (object, key, value) {
1098 return dP.f(object, key, createDesc(1, value));
1099} : function (object, key, value) {
1100 object[key] = value;
1101 return object;
1102};
1103
1104
1105/***/ }),
1106/* 24 */
1107/***/ (function(module, exports) {
1108
1109var hasOwnProperty = {}.hasOwnProperty;
1110module.exports = function (it, key) {
1111 return hasOwnProperty.call(it, key);
1112};
1113
1114
1115/***/ }),
1116/* 25 */
1117/***/ (function(module, __webpack_exports__, __webpack_require__) {
1118
1119"use strict";
1120/* harmony export (immutable) */ __webpack_exports__["a"] = has;
1121/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
1122
1123
1124// Internal function to check whether `key` is an own property name of `obj`.
1125function has(obj, key) {
1126 return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
1127}
1128
1129
1130/***/ }),
1131/* 26 */
1132/***/ (function(module, exports) {
1133
1134module.exports = function (exec) {
1135 try {
1136 return !!exec();
1137 } catch (e) {
1138 return true;
1139 }
1140};
1141
1142
1143/***/ }),
1144/* 27 */
1145/***/ (function(module, exports, __webpack_require__) {
1146
1147// to indexed object, toObject with fallback for non-array-like ES3 strings
1148var IObject = __webpack_require__(76);
1149var defined = __webpack_require__(71);
1150module.exports = function (it) {
1151 return IObject(defined(it));
1152};
1153
1154
1155/***/ }),
1156/* 28 */
1157/***/ (function(module, __webpack_exports__, __webpack_require__) {
1158
1159"use strict";
1160/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
1161// Is a given variable an object?
1162function isObject(obj) {
1163 var type = typeof obj;
1164 return type === 'function' || type === 'object' && !!obj;
1165}
1166
1167
1168/***/ }),
1169/* 29 */
1170/***/ (function(module, __webpack_exports__, __webpack_require__) {
1171
1172"use strict";
1173/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
1174/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(6);
1175
1176
1177
1178// Is a given value an array?
1179// Delegates to ECMA5's native `Array.isArray`.
1180/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
1181
1182
1183/***/ }),
1184/* 30 */
1185/***/ (function(module, __webpack_exports__, __webpack_require__) {
1186
1187"use strict";
1188/* harmony export (immutable) */ __webpack_exports__["a"] = each;
1189/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(51);
1190/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(13);
1191/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(4);
1192
1193
1194
1195
1196// The cornerstone for collection functions, an `each`
1197// implementation, aka `forEach`.
1198// Handles raw objects in addition to array-likes. Treats all
1199// sparse array-likes as if they were dense.
1200function each(obj, iteratee, context) {
1201 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
1202 var i, length;
1203 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
1204 for (i = 0, length = obj.length; i < length; i++) {
1205 iteratee(obj[i], i, obj);
1206 }
1207 } else {
1208 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
1209 for (i = 0, length = _keys.length; i < length; i++) {
1210 iteratee(obj[_keys[i]], _keys[i], obj);
1211 }
1212 }
1213 return obj;
1214}
1215
1216
1217/***/ }),
1218/* 31 */
1219/***/ (function(module, exports, __webpack_require__) {
1220
1221"use strict";
1222
1223
1224var _ = __webpack_require__(0);
1225
1226/**
1227 * @class AV.Error
1228 */
1229
1230function AVError(code, message) {
1231 var error = new Error(message);
1232 error.code = code;
1233 return error;
1234}
1235
1236_.extend(AVError,
1237/** @lends AV.Error */{
1238 /**
1239 * Error code indicating some error other than those enumerated here.
1240 * @constant
1241 */
1242 OTHER_CAUSE: -1,
1243
1244 /**
1245 * Error code indicating that something has gone wrong with the server.
1246 * If you get this error code, it is AV's fault. Contact us at
1247 * https://avoscloud.com/help
1248 * @constant
1249 */
1250 INTERNAL_SERVER_ERROR: 1,
1251
1252 /**
1253 * Error code indicating the connection to the AV servers failed.
1254 * @constant
1255 */
1256 CONNECTION_FAILED: 100,
1257
1258 /**
1259 * Error code indicating the specified object doesn't exist.
1260 * @constant
1261 */
1262 OBJECT_NOT_FOUND: 101,
1263
1264 /**
1265 * Error code indicating you tried to query with a datatype that doesn't
1266 * support it, like exact matching an array or object.
1267 * @constant
1268 */
1269 INVALID_QUERY: 102,
1270
1271 /**
1272 * Error code indicating a missing or invalid classname. Classnames are
1273 * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1274 * only valid characters.
1275 * @constant
1276 */
1277 INVALID_CLASS_NAME: 103,
1278
1279 /**
1280 * Error code indicating an unspecified object id.
1281 * @constant
1282 */
1283 MISSING_OBJECT_ID: 104,
1284
1285 /**
1286 * Error code indicating an invalid key name. Keys are case-sensitive. They
1287 * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1288 * @constant
1289 */
1290 INVALID_KEY_NAME: 105,
1291
1292 /**
1293 * Error code indicating a malformed pointer. You should not see this unless
1294 * you have been mucking about changing internal AV code.
1295 * @constant
1296 */
1297 INVALID_POINTER: 106,
1298
1299 /**
1300 * Error code indicating that badly formed JSON was received upstream. This
1301 * either indicates you have done something unusual with modifying how
1302 * things encode to JSON, or the network is failing badly.
1303 * @constant
1304 */
1305 INVALID_JSON: 107,
1306
1307 /**
1308 * Error code indicating that the feature you tried to access is only
1309 * available internally for testing purposes.
1310 * @constant
1311 */
1312 COMMAND_UNAVAILABLE: 108,
1313
1314 /**
1315 * You must call AV.initialize before using the AV library.
1316 * @constant
1317 */
1318 NOT_INITIALIZED: 109,
1319
1320 /**
1321 * Error code indicating that a field was set to an inconsistent type.
1322 * @constant
1323 */
1324 INCORRECT_TYPE: 111,
1325
1326 /**
1327 * Error code indicating an invalid channel name. A channel name is either
1328 * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1329 * characters.
1330 * @constant
1331 */
1332 INVALID_CHANNEL_NAME: 112,
1333
1334 /**
1335 * Error code indicating that push is misconfigured.
1336 * @constant
1337 */
1338 PUSH_MISCONFIGURED: 115,
1339
1340 /**
1341 * Error code indicating that the object is too large.
1342 * @constant
1343 */
1344 OBJECT_TOO_LARGE: 116,
1345
1346 /**
1347 * Error code indicating that the operation isn't allowed for clients.
1348 * @constant
1349 */
1350 OPERATION_FORBIDDEN: 119,
1351
1352 /**
1353 * Error code indicating the result was not found in the cache.
1354 * @constant
1355 */
1356 CACHE_MISS: 120,
1357
1358 /**
1359 * Error code indicating that an invalid key was used in a nested
1360 * JSONObject.
1361 * @constant
1362 */
1363 INVALID_NESTED_KEY: 121,
1364
1365 /**
1366 * Error code indicating that an invalid filename was used for AVFile.
1367 * A valid file name contains only a-zA-Z0-9_. characters and is between 1
1368 * and 128 characters.
1369 * @constant
1370 */
1371 INVALID_FILE_NAME: 122,
1372
1373 /**
1374 * Error code indicating an invalid ACL was provided.
1375 * @constant
1376 */
1377 INVALID_ACL: 123,
1378
1379 /**
1380 * Error code indicating that the request timed out on the server. Typically
1381 * this indicates that the request is too expensive to run.
1382 * @constant
1383 */
1384 TIMEOUT: 124,
1385
1386 /**
1387 * Error code indicating that the email address was invalid.
1388 * @constant
1389 */
1390 INVALID_EMAIL_ADDRESS: 125,
1391
1392 /**
1393 * Error code indicating a missing content type.
1394 * @constant
1395 */
1396 MISSING_CONTENT_TYPE: 126,
1397
1398 /**
1399 * Error code indicating a missing content length.
1400 * @constant
1401 */
1402 MISSING_CONTENT_LENGTH: 127,
1403
1404 /**
1405 * Error code indicating an invalid content length.
1406 * @constant
1407 */
1408 INVALID_CONTENT_LENGTH: 128,
1409
1410 /**
1411 * Error code indicating a file that was too large.
1412 * @constant
1413 */
1414 FILE_TOO_LARGE: 129,
1415
1416 /**
1417 * Error code indicating an error saving a file.
1418 * @constant
1419 */
1420 FILE_SAVE_ERROR: 130,
1421
1422 /**
1423 * Error code indicating an error deleting a file.
1424 * @constant
1425 */
1426 FILE_DELETE_ERROR: 153,
1427
1428 /**
1429 * Error code indicating that a unique field was given a value that is
1430 * already taken.
1431 * @constant
1432 */
1433 DUPLICATE_VALUE: 137,
1434
1435 /**
1436 * Error code indicating that a role's name is invalid.
1437 * @constant
1438 */
1439 INVALID_ROLE_NAME: 139,
1440
1441 /**
1442 * Error code indicating that an application quota was exceeded. Upgrade to
1443 * resolve.
1444 * @constant
1445 */
1446 EXCEEDED_QUOTA: 140,
1447
1448 /**
1449 * Error code indicating that a Cloud Code script failed.
1450 * @constant
1451 */
1452 SCRIPT_FAILED: 141,
1453
1454 /**
1455 * Error code indicating that a Cloud Code validation failed.
1456 * @constant
1457 */
1458 VALIDATION_ERROR: 142,
1459
1460 /**
1461 * Error code indicating that invalid image data was provided.
1462 * @constant
1463 */
1464 INVALID_IMAGE_DATA: 150,
1465
1466 /**
1467 * Error code indicating an unsaved file.
1468 * @constant
1469 */
1470 UNSAVED_FILE_ERROR: 151,
1471
1472 /**
1473 * Error code indicating an invalid push time.
1474 */
1475 INVALID_PUSH_TIME_ERROR: 152,
1476
1477 /**
1478 * Error code indicating that the username is missing or empty.
1479 * @constant
1480 */
1481 USERNAME_MISSING: 200,
1482
1483 /**
1484 * Error code indicating that the password is missing or empty.
1485 * @constant
1486 */
1487 PASSWORD_MISSING: 201,
1488
1489 /**
1490 * Error code indicating that the username has already been taken.
1491 * @constant
1492 */
1493 USERNAME_TAKEN: 202,
1494
1495 /**
1496 * Error code indicating that the email has already been taken.
1497 * @constant
1498 */
1499 EMAIL_TAKEN: 203,
1500
1501 /**
1502 * Error code indicating that the email is missing, but must be specified.
1503 * @constant
1504 */
1505 EMAIL_MISSING: 204,
1506
1507 /**
1508 * Error code indicating that a user with the specified email was not found.
1509 * @constant
1510 */
1511 EMAIL_NOT_FOUND: 205,
1512
1513 /**
1514 * Error code indicating that a user object without a valid session could
1515 * not be altered.
1516 * @constant
1517 */
1518 SESSION_MISSING: 206,
1519
1520 /**
1521 * Error code indicating that a user can only be created through signup.
1522 * @constant
1523 */
1524 MUST_CREATE_USER_THROUGH_SIGNUP: 207,
1525
1526 /**
1527 * Error code indicating that an an account being linked is already linked
1528 * to another user.
1529 * @constant
1530 */
1531 ACCOUNT_ALREADY_LINKED: 208,
1532
1533 /**
1534 * Error code indicating that a user cannot be linked to an account because
1535 * that account's id could not be found.
1536 * @constant
1537 */
1538 LINKED_ID_MISSING: 250,
1539
1540 /**
1541 * Error code indicating that a user with a linked (e.g. Facebook) account
1542 * has an invalid session.
1543 * @constant
1544 */
1545 INVALID_LINKED_SESSION: 251,
1546
1547 /**
1548 * Error code indicating that a service being linked (e.g. Facebook or
1549 * Twitter) is unsupported.
1550 * @constant
1551 */
1552 UNSUPPORTED_SERVICE: 252,
1553 /**
1554 * Error code indicating a real error code is unavailable because
1555 * we had to use an XDomainRequest object to allow CORS requests in
1556 * Internet Explorer, which strips the body from HTTP responses that have
1557 * a non-2XX status code.
1558 * @constant
1559 */
1560 X_DOMAIN_REQUEST: 602
1561});
1562
1563module.exports = AVError;
1564
1565/***/ }),
1566/* 32 */
1567/***/ (function(module, exports) {
1568
1569module.exports = {};
1570
1571
1572/***/ }),
1573/* 33 */
1574/***/ (function(module, exports, __webpack_require__) {
1575
1576// 7.1.13 ToObject(argument)
1577var defined = __webpack_require__(71);
1578module.exports = function (it) {
1579 return Object(defined(it));
1580};
1581
1582
1583/***/ }),
1584/* 34 */
1585/***/ (function(module, exports, __webpack_require__) {
1586
1587__webpack_require__(193);
1588var global = __webpack_require__(5);
1589var hide = __webpack_require__(23);
1590var Iterators = __webpack_require__(32);
1591var TO_STRING_TAG = __webpack_require__(7)('toStringTag');
1592
1593var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
1594 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
1595 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
1596 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
1597 'TextTrackList,TouchList').split(',');
1598
1599for (var i = 0; i < DOMIterables.length; i++) {
1600 var NAME = DOMIterables[i];
1601 var Collection = global[NAME];
1602 var proto = Collection && Collection.prototype;
1603 if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
1604 Iterators[NAME] = Iterators.Array;
1605}
1606
1607
1608/***/ }),
1609/* 35 */
1610/***/ (function(module, exports, __webpack_require__) {
1611
1612var ctx = __webpack_require__(22);
1613var call = __webpack_require__(196);
1614var isArrayIter = __webpack_require__(197);
1615var anObject = __webpack_require__(18);
1616var toLength = __webpack_require__(77);
1617var getIterFn = __webpack_require__(110);
1618var BREAK = {};
1619var RETURN = {};
1620var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
1621 var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
1622 var f = ctx(fn, that, entries ? 2 : 1);
1623 var index = 0;
1624 var length, step, iterator, result;
1625 if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
1626 // fast case for arrays with default iterator
1627 if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
1628 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
1629 if (result === BREAK || result === RETURN) return result;
1630 } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
1631 result = call(iterator, f, step.value, entries);
1632 if (result === BREAK || result === RETURN) return result;
1633 }
1634};
1635exports.BREAK = BREAK;
1636exports.RETURN = RETURN;
1637
1638
1639/***/ }),
1640/* 36 */
1641/***/ (function(module, __webpack_exports__, __webpack_require__) {
1642
1643"use strict";
1644/* harmony export (immutable) */ __webpack_exports__["a"] = values;
1645/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
1646
1647
1648// Retrieve the values of an object's properties.
1649function values(obj) {
1650 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
1651 var length = _keys.length;
1652 var values = Array(length);
1653 for (var i = 0; i < length; i++) {
1654 values[i] = obj[_keys[i]];
1655 }
1656 return values;
1657}
1658
1659
1660/***/ }),
1661/* 37 */
1662/***/ (function(module, __webpack_exports__, __webpack_require__) {
1663
1664"use strict";
1665/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
1666/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(16);
1667/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(13);
1668/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(29);
1669/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(85);
1670
1671
1672
1673
1674
1675// Internal implementation of a recursive `flatten` function.
1676function flatten(input, depth, strict, output) {
1677 output = output || [];
1678 if (!depth && depth !== 0) {
1679 depth = Infinity;
1680 } else if (depth <= 0) {
1681 return output.concat(input);
1682 }
1683 var idx = output.length;
1684 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
1685 var value = input[i];
1686 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))) {
1687 // Flatten current level of array or arguments object.
1688 if (depth > 1) {
1689 flatten(value, depth - 1, strict, output);
1690 idx = output.length;
1691 } else {
1692 var j = 0, len = value.length;
1693 while (j < len) output[idx++] = value[j++];
1694 }
1695 } else if (!strict) {
1696 output[idx++] = value;
1697 }
1698 }
1699 return output;
1700}
1701
1702
1703/***/ }),
1704/* 38 */
1705/***/ (function(module, __webpack_exports__, __webpack_require__) {
1706
1707"use strict";
1708/* harmony export (immutable) */ __webpack_exports__["a"] = map;
1709/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
1710/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(13);
1711/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(4);
1712
1713
1714
1715
1716// Return the results of applying the iteratee to each element.
1717function map(obj, iteratee, context) {
1718 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
1719 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
1720 length = (_keys || obj).length,
1721 results = Array(length);
1722 for (var index = 0; index < length; index++) {
1723 var currentKey = _keys ? _keys[index] : index;
1724 results[index] = iteratee(obj[currentKey], currentKey, obj);
1725 }
1726 return results;
1727}
1728
1729
1730/***/ }),
1731/* 39 */
1732/***/ (function(module, exports, __webpack_require__) {
1733
1734"use strict";
1735/* WEBPACK VAR INJECTION */(function(global) {
1736
1737var _stringify = __webpack_require__(21);
1738
1739var _stringify2 = _interopRequireDefault(_stringify);
1740
1741var _keys = __webpack_require__(97);
1742
1743var _keys2 = _interopRequireDefault(_keys);
1744
1745var _promise = __webpack_require__(3);
1746
1747var _promise2 = _interopRequireDefault(_promise);
1748
1749function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1750
1751var _ = __webpack_require__(0);
1752var uuid = __webpack_require__(165);
1753var debug = __webpack_require__(40);
1754
1755var _require = __webpack_require__(17),
1756 inherits = _require.inherits,
1757 parseDate = _require.parseDate;
1758
1759var version = __webpack_require__(166);
1760
1761var _require2 = __webpack_require__(41),
1762 setAdapters = _require2.setAdapters,
1763 adapterManager = _require2.adapterManager;
1764
1765var AV = global.AV || {};
1766
1767// All internal configuration items
1768AV._config = {
1769 serverURLs: {},
1770 useMasterKey: false,
1771 production: null,
1772 realtime: null,
1773 requestTimeout: null
1774};
1775
1776var initialUserAgent = 'LeanCloud-JS-SDK/' + version;
1777
1778// configs shared by all AV instances
1779AV._sharedConfig = {
1780 userAgent: initialUserAgent,
1781 liveQueryRealtime: null
1782};
1783
1784adapterManager.on('platformInfo', function (platformInfo) {
1785 var ua = initialUserAgent;
1786 if (platformInfo) {
1787 if (platformInfo.userAgent) {
1788 ua = platformInfo.userAgent;
1789 } else {
1790 var comments = platformInfo.name;
1791 if (platformInfo.version) {
1792 comments += '/' + platformInfo.version;
1793 }
1794 if (platformInfo.extra) {
1795 comments += '; ' + platformInfo.extra;
1796 }
1797 ua += ' (' + comments + ')';
1798 }
1799 }
1800 AV._sharedConfig.userAgent = ua;
1801});
1802
1803/**
1804 * Contains all AV API classes and functions.
1805 * @namespace AV
1806 */
1807
1808/**
1809 * Returns prefix for localStorage keys used by this instance of AV.
1810 * @param {String} path The relative suffix to append to it.
1811 * null or undefined is treated as the empty string.
1812 * @return {String} The full key name.
1813 * @private
1814 */
1815AV._getAVPath = function (path) {
1816 if (!AV.applicationId) {
1817 throw new Error('You need to call AV.initialize before using AV.');
1818 }
1819 if (!path) {
1820 path = '';
1821 }
1822 if (!_.isString(path)) {
1823 throw new Error("Tried to get a localStorage path that wasn't a String.");
1824 }
1825 if (path[0] === '/') {
1826 path = path.substring(1);
1827 }
1828 return 'AV/' + AV.applicationId + '/' + path;
1829};
1830
1831/**
1832 * Returns the unique string for this app on this machine.
1833 * Gets reset when localStorage is cleared.
1834 * @private
1835 */
1836AV._installationId = null;
1837AV._getInstallationId = function () {
1838 // See if it's cached in RAM.
1839 if (AV._installationId) {
1840 return _promise2.default.resolve(AV._installationId);
1841 }
1842
1843 // Try to get it from localStorage.
1844 var path = AV._getAVPath('installationId');
1845 return AV.localStorage.getItemAsync(path).then(function (_installationId) {
1846 AV._installationId = _installationId;
1847 if (!AV._installationId) {
1848 // It wasn't in localStorage, so create a new one.
1849 AV._installationId = _installationId = uuid();
1850 return AV.localStorage.setItemAsync(path, _installationId).then(function () {
1851 return _installationId;
1852 });
1853 }
1854 return _installationId;
1855 });
1856};
1857
1858AV._subscriptionId = null;
1859AV._refreshSubscriptionId = function () {
1860 var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
1861
1862 var subscriptionId = AV._subscriptionId = uuid();
1863 return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
1864 return subscriptionId;
1865 });
1866};
1867AV._getSubscriptionId = function () {
1868 // See if it's cached in RAM.
1869 if (AV._subscriptionId) {
1870 return _promise2.default.resolve(AV._subscriptionId);
1871 }
1872
1873 // Try to get it from localStorage.
1874 var path = AV._getAVPath('subscriptionId');
1875 return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
1876 AV._subscriptionId = _subscriptionId;
1877 if (!AV._subscriptionId) {
1878 // It wasn't in localStorage, so create a new one.
1879 _subscriptionId = AV._refreshSubscriptionId(path);
1880 }
1881 return _subscriptionId;
1882 });
1883};
1884
1885AV._parseDate = parseDate;
1886
1887// A self-propagating extend function.
1888AV._extend = function (protoProps, classProps) {
1889 var child = inherits(this, protoProps, classProps);
1890 child.extend = this.extend;
1891 return child;
1892};
1893
1894/**
1895 * Converts a value in a AV Object into the appropriate representation.
1896 * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
1897 * if seenObjects is falsey. Otherwise any AV.Objects not in
1898 * seenObjects will be fully embedded rather than encoded
1899 * as a pointer. This array will be used to prevent going into an infinite
1900 * loop because we have circular references. If <seenObjects>
1901 * is set, then none of the AV Objects that are serialized can be dirty.
1902 * @private
1903 */
1904AV._encode = function (value, seenObjects, disallowObjects) {
1905 var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1906
1907 if (value instanceof AV.Object) {
1908 if (disallowObjects) {
1909 throw new Error('AV.Objects not allowed here');
1910 }
1911 if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
1912 return value._toPointer();
1913 }
1914 return value._toFullJSON(seenObjects.concat(value), full);
1915 }
1916 if (value instanceof AV.ACL) {
1917 return value.toJSON();
1918 }
1919 if (_.isDate(value)) {
1920 return full ? { __type: 'Date', iso: value.toJSON() } : value.toJSON();
1921 }
1922 if (value instanceof AV.GeoPoint) {
1923 return value.toJSON();
1924 }
1925 if (_.isArray(value)) {
1926 return _.map(value, function (x) {
1927 return AV._encode(x, seenObjects, disallowObjects, full);
1928 });
1929 }
1930 if (_.isRegExp(value)) {
1931 return value.source;
1932 }
1933 if (value instanceof AV.Relation) {
1934 return value.toJSON();
1935 }
1936 if (value instanceof AV.Op) {
1937 return value.toJSON();
1938 }
1939 if (value instanceof AV.File) {
1940 if (!value.url() && !value.id) {
1941 throw new Error('Tried to save an object containing an unsaved file.');
1942 }
1943 return value._toFullJSON(seenObjects, full);
1944 }
1945 if (_.isObject(value)) {
1946 return _.mapObject(value, function (v, k) {
1947 return AV._encode(v, seenObjects, disallowObjects, full);
1948 });
1949 }
1950 return value;
1951};
1952
1953/**
1954 * The inverse function of AV._encode.
1955 * @private
1956 */
1957AV._decode = function (value, key) {
1958 if (!_.isObject(value) || _.isDate(value)) {
1959 return value;
1960 }
1961 if (_.isArray(value)) {
1962 return _.map(value, function (v) {
1963 return AV._decode(v);
1964 });
1965 }
1966 if (value instanceof AV.Object) {
1967 return value;
1968 }
1969 if (value instanceof AV.File) {
1970 return value;
1971 }
1972 if (value instanceof AV.Op) {
1973 return value;
1974 }
1975 if (value instanceof AV.GeoPoint) {
1976 return value;
1977 }
1978 if (value instanceof AV.ACL) {
1979 return value;
1980 }
1981 if (key === 'ACL') {
1982 return new AV.ACL(value);
1983 }
1984 if (value.__op) {
1985 return AV.Op._decode(value);
1986 }
1987 var className;
1988 if (value.__type === 'Pointer') {
1989 className = value.className;
1990 var pointer = AV.Object._create(className);
1991 if ((0, _keys2.default)(value).length > 3) {
1992 var v = _.clone(value);
1993 delete v.__type;
1994 delete v.className;
1995 pointer._finishFetch(v, true);
1996 } else {
1997 pointer._finishFetch({ objectId: value.objectId }, false);
1998 }
1999 return pointer;
2000 }
2001 if (value.__type === 'Object') {
2002 // It's an Object included in a query result.
2003 className = value.className;
2004 var _v = _.clone(value);
2005 delete _v.__type;
2006 delete _v.className;
2007 var object = AV.Object._create(className);
2008 object._finishFetch(_v, true);
2009 return object;
2010 }
2011 if (value.__type === 'Date') {
2012 return AV._parseDate(value.iso);
2013 }
2014 if (value.__type === 'GeoPoint') {
2015 return new AV.GeoPoint({
2016 latitude: value.latitude,
2017 longitude: value.longitude
2018 });
2019 }
2020 if (value.__type === 'Relation') {
2021 if (!key) throw new Error('key missing decoding a Relation');
2022 var relation = new AV.Relation(null, key);
2023 relation.targetClassName = value.className;
2024 return relation;
2025 }
2026 if (value.__type === 'File') {
2027 var file = new AV.File(value.name);
2028 var _v2 = _.clone(value);
2029 delete _v2.__type;
2030 file._finishFetch(_v2);
2031 return file;
2032 }
2033 return _.mapObject(value, AV._decode);
2034};
2035
2036/**
2037 * The inverse function of {@link AV.Object#toFullJSON}.
2038 * @since 3.0.0
2039 * @method
2040 * @param {Object}
2041 * return {AV.Object|AV.File|any}
2042 */
2043AV.parseJSON = AV._decode;
2044
2045/**
2046 * Similar to JSON.parse, except that AV internal types will be used if possible.
2047 * Inverse to {@link AV.stringify}
2048 * @since 3.14.0
2049 * @param {string} text the string to parse.
2050 * @return {AV.Object|AV.File|any}
2051 */
2052AV.parse = function (text) {
2053 return AV.parseJSON(JSON.parse(text));
2054};
2055/**
2056 * Serialize a target containing AV.Object, similar to JSON.stringify.
2057 * Inverse to {@link AV.parse}
2058 * @since 3.14.0
2059 * @return {string}
2060 */
2061AV.stringify = function (target) {
2062 return (0, _stringify2.default)(AV._encode(target, [], false, true));
2063};
2064
2065AV._encodeObjectOrArray = function (value) {
2066 var encodeAVObject = function encodeAVObject(object) {
2067 if (object && object._toFullJSON) {
2068 object = object._toFullJSON([]);
2069 }
2070
2071 return _.mapObject(object, function (value) {
2072 return AV._encode(value, []);
2073 });
2074 };
2075
2076 if (_.isArray(value)) {
2077 return value.map(function (object) {
2078 return encodeAVObject(object);
2079 });
2080 } else {
2081 return encodeAVObject(value);
2082 }
2083};
2084
2085AV._arrayEach = _.each;
2086
2087/**
2088 * Does a deep traversal of every item in object, calling func on every one.
2089 * @param {Object} object The object or array to traverse deeply.
2090 * @param {Function} func The function to call for every item. It will
2091 * be passed the item as an argument. If it returns a truthy value, that
2092 * value will replace the item in its parent container.
2093 * @returns {} the result of calling func on the top-level object itself.
2094 * @private
2095 */
2096AV._traverse = function (object, func, seen) {
2097 if (object instanceof AV.Object) {
2098 seen = seen || [];
2099 if (_.indexOf(seen, object) >= 0) {
2100 // We've already visited this object in this call.
2101 return;
2102 }
2103 seen.push(object);
2104 AV._traverse(object.attributes, func, seen);
2105 return func(object);
2106 }
2107 if (object instanceof AV.Relation || object instanceof AV.File) {
2108 // Nothing needs to be done, but we don't want to recurse into the
2109 // object's parent infinitely, so we catch this case.
2110 return func(object);
2111 }
2112 if (_.isArray(object)) {
2113 _.each(object, function (child, index) {
2114 var newChild = AV._traverse(child, func, seen);
2115 if (newChild) {
2116 object[index] = newChild;
2117 }
2118 });
2119 return func(object);
2120 }
2121 if (_.isObject(object)) {
2122 AV._each(object, function (child, key) {
2123 var newChild = AV._traverse(child, func, seen);
2124 if (newChild) {
2125 object[key] = newChild;
2126 }
2127 });
2128 return func(object);
2129 }
2130 return func(object);
2131};
2132
2133/**
2134 * This is like _.each, except:
2135 * * it doesn't work for so-called array-like objects,
2136 * * it does work for dictionaries with a "length" attribute.
2137 * @private
2138 */
2139AV._objectEach = AV._each = function (obj, callback) {
2140 if (_.isObject(obj)) {
2141 _.each(_.keys(obj), function (key) {
2142 callback(obj[key], key);
2143 });
2144 } else {
2145 _.each(obj, callback);
2146 }
2147};
2148
2149/**
2150 * @namespace
2151 * @since 3.14.0
2152 */
2153AV.debug = {
2154 /**
2155 * Enable debug
2156 */
2157 enable: function enable() {
2158 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
2159 return debug.enable(namespaces);
2160 },
2161 /**
2162 * Disable debug
2163 */
2164 disable: debug.disable
2165};
2166
2167/**
2168 * Specify Adapters
2169 * @since 4.4.0
2170 * @function
2171 * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
2172 */
2173AV.setAdapters = setAdapters;
2174
2175module.exports = AV;
2176/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(116)))
2177
2178/***/ }),
2179/* 40 */
2180/***/ (function(module, exports, __webpack_require__) {
2181
2182"use strict";
2183
2184
2185function _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); }
2186
2187/* eslint-env browser */
2188
2189/**
2190 * This is the web browser implementation of `debug()`.
2191 */
2192exports.log = log;
2193exports.formatArgs = formatArgs;
2194exports.save = save;
2195exports.load = load;
2196exports.useColors = useColors;
2197exports.storage = localstorage();
2198/**
2199 * Colors.
2200 */
2201
2202exports.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'];
2203/**
2204 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2205 * and the Firebug extension (any Firefox version) are known
2206 * to support "%c" CSS customizations.
2207 *
2208 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2209 */
2210// eslint-disable-next-line complexity
2211
2212function useColors() {
2213 // NB: In an Electron preload script, document will be defined but not fully
2214 // initialized. Since we know we're in Chrome, we'll just detect this case
2215 // explicitly
2216 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2217 return true;
2218 } // Internet Explorer and Edge do not support colors.
2219
2220
2221 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2222 return false;
2223 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2224 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2225
2226
2227 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2228 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2229 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2230 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
2231 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2232}
2233/**
2234 * Colorize log arguments if enabled.
2235 *
2236 * @api public
2237 */
2238
2239
2240function formatArgs(args) {
2241 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2242
2243 if (!this.useColors) {
2244 return;
2245 }
2246
2247 var c = 'color: ' + this.color;
2248 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2249 // arguments passed either before or after the %c, so we need to
2250 // figure out the correct index to insert the CSS into
2251
2252 var index = 0;
2253 var lastC = 0;
2254 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2255 if (match === '%%') {
2256 return;
2257 }
2258
2259 index++;
2260
2261 if (match === '%c') {
2262 // We only are interested in the *last* %c
2263 // (the user may have provided their own)
2264 lastC = index;
2265 }
2266 });
2267 args.splice(lastC, 0, c);
2268}
2269/**
2270 * Invokes `console.log()` when available.
2271 * No-op when `console.log` is not a "function".
2272 *
2273 * @api public
2274 */
2275
2276
2277function log() {
2278 var _console;
2279
2280 // This hackery is required for IE8/9, where
2281 // the `console.log` function doesn't have 'apply'
2282 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2283}
2284/**
2285 * Save `namespaces`.
2286 *
2287 * @param {String} namespaces
2288 * @api private
2289 */
2290
2291
2292function save(namespaces) {
2293 try {
2294 if (namespaces) {
2295 exports.storage.setItem('debug', namespaces);
2296 } else {
2297 exports.storage.removeItem('debug');
2298 }
2299 } catch (error) {// Swallow
2300 // XXX (@Qix-) should we be logging these?
2301 }
2302}
2303/**
2304 * Load `namespaces`.
2305 *
2306 * @return {String} returns the previously persisted debug modes
2307 * @api private
2308 */
2309
2310
2311function load() {
2312 var r;
2313
2314 try {
2315 r = exports.storage.getItem('debug');
2316 } catch (error) {} // Swallow
2317 // XXX (@Qix-) should we be logging these?
2318 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2319
2320
2321 if (!r && typeof process !== 'undefined' && 'env' in process) {
2322 r = process.env.DEBUG;
2323 }
2324
2325 return r;
2326}
2327/**
2328 * Localstorage attempts to return the localstorage.
2329 *
2330 * This is necessary because safari throws
2331 * when a user disables cookies/localstorage
2332 * and you attempt to access it.
2333 *
2334 * @return {LocalStorage}
2335 * @api private
2336 */
2337
2338
2339function localstorage() {
2340 try {
2341 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2342 // The Browser also has localStorage in the global context.
2343 return localStorage;
2344 } catch (error) {// Swallow
2345 // XXX (@Qix-) should we be logging these?
2346 }
2347}
2348
2349module.exports = __webpack_require__(281)(exports);
2350var formatters = module.exports.formatters;
2351/**
2352 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2353 */
2354
2355formatters.j = function (v) {
2356 try {
2357 return JSON.stringify(v);
2358 } catch (error) {
2359 return '[UnexpectedJSONParseError]: ' + error.message;
2360 }
2361};
2362
2363
2364
2365/***/ }),
2366/* 41 */
2367/***/ (function(module, exports, __webpack_require__) {
2368
2369"use strict";
2370
2371
2372var _ = __webpack_require__(0);
2373var EventEmitter = __webpack_require__(167);
2374
2375var _require = __webpack_require__(17),
2376 inherits = _require.inherits;
2377
2378var AdapterManager = inherits(EventEmitter, {
2379 constructor: function constructor() {
2380 EventEmitter.apply(this);
2381 this._adapters = {};
2382 },
2383 getAdapter: function getAdapter(name) {
2384 var adapter = this._adapters[name];
2385 if (adapter === undefined) {
2386 throw new Error(name + ' adapter is not configured');
2387 }
2388 return adapter;
2389 },
2390 setAdapters: function setAdapters(newAdapters) {
2391 var _this = this;
2392
2393 _.extend(this._adapters, newAdapters);
2394 _.keys(newAdapters).forEach(function (name) {
2395 return _this.emit(name, newAdapters[name]);
2396 });
2397 }
2398});
2399
2400var adapterManager = new AdapterManager();
2401
2402module.exports = {
2403 getAdapter: adapterManager.getAdapter.bind(adapterManager),
2404 setAdapters: adapterManager.setAdapters.bind(adapterManager),
2405 adapterManager: adapterManager
2406};
2407
2408/***/ }),
2409/* 42 */
2410/***/ (function(module, exports, __webpack_require__) {
2411
2412"use strict";
2413
2414var $at = __webpack_require__(188)(true);
2415
2416// 21.1.3.27 String.prototype[@@iterator]()
2417__webpack_require__(72)(String, 'String', function (iterated) {
2418 this._t = String(iterated); // target
2419 this._i = 0; // next index
2420// 21.1.5.2.1 %StringIteratorPrototype%.next()
2421}, function () {
2422 var O = this._t;
2423 var index = this._i;
2424 var point;
2425 if (index >= O.length) return { value: undefined, done: true };
2426 point = $at(O, index);
2427 this._i += point.length;
2428 return { value: point, done: false };
2429});
2430
2431
2432/***/ }),
2433/* 43 */
2434/***/ (function(module, exports) {
2435
2436module.exports = true;
2437
2438
2439/***/ }),
2440/* 44 */
2441/***/ (function(module, exports) {
2442
2443module.exports = function (it) {
2444 if (typeof it != 'function') throw TypeError(it + ' is not a function!');
2445 return it;
2446};
2447
2448
2449/***/ }),
2450/* 45 */
2451/***/ (function(module, exports, __webpack_require__) {
2452
2453// 19.1.2.14 / 15.2.3.14 Object.keys(O)
2454var $keys = __webpack_require__(106);
2455var enumBugKeys = __webpack_require__(80);
2456
2457module.exports = Object.keys || function keys(O) {
2458 return $keys(O, enumBugKeys);
2459};
2460
2461
2462/***/ }),
2463/* 46 */
2464/***/ (function(module, exports) {
2465
2466var toString = {}.toString;
2467
2468module.exports = function (it) {
2469 return toString.call(it).slice(8, -1);
2470};
2471
2472
2473/***/ }),
2474/* 47 */
2475/***/ (function(module, exports, __webpack_require__) {
2476
2477var def = __webpack_require__(20).f;
2478var has = __webpack_require__(24);
2479var TAG = __webpack_require__(7)('toStringTag');
2480
2481module.exports = function (it, tag, stat) {
2482 if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
2483};
2484
2485
2486/***/ }),
2487/* 48 */
2488/***/ (function(module, __webpack_exports__, __webpack_require__) {
2489
2490"use strict";
2491/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
2492/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
2493/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
2494/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(210);
2495
2496
2497
2498// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
2499// In IE 11, the most common among them, this problem also applies to
2500// `Map`, `WeakMap` and `Set`.
2501var hasStringTagBug = (
2502 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
2503 ),
2504 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
2505
2506
2507/***/ }),
2508/* 49 */
2509/***/ (function(module, __webpack_exports__, __webpack_require__) {
2510
2511"use strict";
2512/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
2513/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(28);
2514/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
2515/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(127);
2516
2517
2518
2519
2520// Retrieve all the enumerable property names of an object.
2521function allKeys(obj) {
2522 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
2523 var keys = [];
2524 for (var key in obj) keys.push(key);
2525 // Ahem, IE < 9.
2526 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
2527 return keys;
2528}
2529
2530
2531/***/ }),
2532/* 50 */
2533/***/ (function(module, __webpack_exports__, __webpack_require__) {
2534
2535"use strict";
2536/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
2537/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
2538/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(136);
2539
2540
2541
2542// Internal wrapper for `_.toPath` to enable minification.
2543// Similar to `cb` for `_.iteratee`.
2544function toPath(path) {
2545 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
2546}
2547
2548
2549/***/ }),
2550/* 51 */
2551/***/ (function(module, __webpack_exports__, __webpack_require__) {
2552
2553"use strict";
2554/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
2555// Internal function that returns an efficient (for current engines) version
2556// of the passed-in callback, to be repeatedly applied in other Underscore
2557// functions.
2558function optimizeCb(func, context, argCount) {
2559 if (context === void 0) return func;
2560 switch (argCount == null ? 3 : argCount) {
2561 case 1: return function(value) {
2562 return func.call(context, value);
2563 };
2564 // The 2-argument case is omitted because we’re not using it.
2565 case 3: return function(value, index, collection) {
2566 return func.call(context, value, index, collection);
2567 };
2568 case 4: return function(accumulator, value, index, collection) {
2569 return func.call(context, accumulator, value, index, collection);
2570 };
2571 }
2572 return function() {
2573 return func.apply(context, arguments);
2574 };
2575}
2576
2577
2578/***/ }),
2579/* 52 */
2580/***/ (function(module, __webpack_exports__, __webpack_require__) {
2581
2582"use strict";
2583/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
2584/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
2585/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(30);
2586
2587
2588
2589// Return all the elements that pass a truth test.
2590function filter(obj, predicate, context) {
2591 var results = [];
2592 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
2593 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
2594 if (predicate(value, index, list)) results.push(value);
2595 });
2596 return results;
2597}
2598
2599
2600/***/ }),
2601/* 53 */
2602/***/ (function(module, __webpack_exports__, __webpack_require__) {
2603
2604"use strict";
2605/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
2606/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(13);
2607/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(36);
2608/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(152);
2609
2610
2611
2612
2613// Determine if the array or object contains a given item (using `===`).
2614function contains(obj, item, fromIndex, guard) {
2615 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
2616 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
2617 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
2618}
2619
2620
2621/***/ }),
2622/* 54 */
2623/***/ (function(module, exports, __webpack_require__) {
2624
2625"use strict";
2626
2627
2628exports.__esModule = true;
2629
2630var _iterator = __webpack_require__(170);
2631
2632var _iterator2 = _interopRequireDefault(_iterator);
2633
2634var _symbol = __webpack_require__(171);
2635
2636var _symbol2 = _interopRequireDefault(_symbol);
2637
2638var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
2639
2640function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2641
2642exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
2643 return typeof obj === "undefined" ? "undefined" : _typeof(obj);
2644} : function (obj) {
2645 return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
2646};
2647
2648/***/ }),
2649/* 55 */
2650/***/ (function(module, exports, __webpack_require__) {
2651
2652var META = __webpack_require__(60)('meta');
2653var isObject = __webpack_require__(10);
2654var has = __webpack_require__(24);
2655var setDesc = __webpack_require__(20).f;
2656var id = 0;
2657var isExtensible = Object.isExtensible || function () {
2658 return true;
2659};
2660var FREEZE = !__webpack_require__(26)(function () {
2661 return isExtensible(Object.preventExtensions({}));
2662});
2663var setMeta = function (it) {
2664 setDesc(it, META, { value: {
2665 i: 'O' + ++id, // object ID
2666 w: {} // weak collections IDs
2667 } });
2668};
2669var fastKey = function (it, create) {
2670 // return primitive with prefix
2671 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
2672 if (!has(it, META)) {
2673 // can't set metadata to uncaught frozen object
2674 if (!isExtensible(it)) return 'F';
2675 // not necessary to add metadata
2676 if (!create) return 'E';
2677 // add missing metadata
2678 setMeta(it);
2679 // return object ID
2680 } return it[META].i;
2681};
2682var getWeak = function (it, create) {
2683 if (!has(it, META)) {
2684 // can't set metadata to uncaught frozen object
2685 if (!isExtensible(it)) return true;
2686 // not necessary to add metadata
2687 if (!create) return false;
2688 // add missing metadata
2689 setMeta(it);
2690 // return hash weak collections IDs
2691 } return it[META].w;
2692};
2693// add metadata on freeze-family methods calling
2694var onFreeze = function (it) {
2695 if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
2696 return it;
2697};
2698var meta = module.exports = {
2699 KEY: META,
2700 NEED: false,
2701 fastKey: fastKey,
2702 getWeak: getWeak,
2703 onFreeze: onFreeze
2704};
2705
2706
2707/***/ }),
2708/* 56 */
2709/***/ (function(module, exports, __webpack_require__) {
2710
2711var isObject = __webpack_require__(10);
2712module.exports = function (it, TYPE) {
2713 if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
2714 return it;
2715};
2716
2717
2718/***/ }),
2719/* 57 */
2720/***/ (function(module, exports) {
2721
2722
2723
2724/***/ }),
2725/* 58 */
2726/***/ (function(module, exports) {
2727
2728module.exports = function (bitmap, value) {
2729 return {
2730 enumerable: !(bitmap & 1),
2731 configurable: !(bitmap & 2),
2732 writable: !(bitmap & 4),
2733 value: value
2734 };
2735};
2736
2737
2738/***/ }),
2739/* 59 */
2740/***/ (function(module, exports, __webpack_require__) {
2741
2742// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
2743var anObject = __webpack_require__(18);
2744var dPs = __webpack_require__(190);
2745var enumBugKeys = __webpack_require__(80);
2746var IE_PROTO = __webpack_require__(78)('IE_PROTO');
2747var Empty = function () { /* empty */ };
2748var PROTOTYPE = 'prototype';
2749
2750// Create object with fake `null` prototype: use iframe Object with cleared prototype
2751var createDict = function () {
2752 // Thrash, waste and sodomy: IE GC bug
2753 var iframe = __webpack_require__(73)('iframe');
2754 var i = enumBugKeys.length;
2755 var lt = '<';
2756 var gt = '>';
2757 var iframeDocument;
2758 iframe.style.display = 'none';
2759 __webpack_require__(107).appendChild(iframe);
2760 iframe.src = 'javascript:'; // eslint-disable-line no-script-url
2761 // createDict = iframe.contentWindow.Object;
2762 // html.removeChild(iframe);
2763 iframeDocument = iframe.contentWindow.document;
2764 iframeDocument.open();
2765 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
2766 iframeDocument.close();
2767 createDict = iframeDocument.F;
2768 while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
2769 return createDict();
2770};
2771
2772module.exports = Object.create || function create(O, Properties) {
2773 var result;
2774 if (O !== null) {
2775 Empty[PROTOTYPE] = anObject(O);
2776 result = new Empty();
2777 Empty[PROTOTYPE] = null;
2778 // add "__proto__" for Object.getPrototypeOf polyfill
2779 result[IE_PROTO] = O;
2780 } else result = createDict();
2781 return Properties === undefined ? result : dPs(result, Properties);
2782};
2783
2784
2785/***/ }),
2786/* 60 */
2787/***/ (function(module, exports) {
2788
2789var id = 0;
2790var px = Math.random();
2791module.exports = function (key) {
2792 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
2793};
2794
2795
2796/***/ }),
2797/* 61 */
2798/***/ (function(module, exports, __webpack_require__) {
2799
2800// getting tag from 19.1.3.6 Object.prototype.toString()
2801var cof = __webpack_require__(46);
2802var TAG = __webpack_require__(7)('toStringTag');
2803// ES3 wrong here
2804var ARG = cof(function () { return arguments; }()) == 'Arguments';
2805
2806// fallback for IE11 Script Access Denied error
2807var tryGet = function (it, key) {
2808 try {
2809 return it[key];
2810 } catch (e) { /* empty */ }
2811};
2812
2813module.exports = function (it) {
2814 var O, T, B;
2815 return it === undefined ? 'Undefined' : it === null ? 'Null'
2816 // @@toStringTag case
2817 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
2818 // builtinTag case
2819 : ARG ? cof(O)
2820 // ES3 arguments fallback
2821 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
2822};
2823
2824
2825/***/ }),
2826/* 62 */
2827/***/ (function(module, exports) {
2828
2829module.exports = function (it, Constructor, name, forbiddenField) {
2830 if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
2831 throw TypeError(name + ': incorrect invocation!');
2832 } return it;
2833};
2834
2835
2836/***/ }),
2837/* 63 */
2838/***/ (function(module, exports, __webpack_require__) {
2839
2840var hide = __webpack_require__(23);
2841module.exports = function (target, src, safe) {
2842 for (var key in src) {
2843 if (safe && target[key]) target[key] = src[key];
2844 else hide(target, key, src[key]);
2845 } return target;
2846};
2847
2848
2849/***/ }),
2850/* 64 */
2851/***/ (function(module, __webpack_exports__, __webpack_require__) {
2852
2853"use strict";
2854/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
2855/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(89);
2856/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(128);
2857
2858
2859
2860// Returns a predicate for checking whether an object has a given set of
2861// `key:value` pairs.
2862function matcher(attrs) {
2863 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
2864 return function(obj) {
2865 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
2866 };
2867}
2868
2869
2870/***/ }),
2871/* 65 */
2872/***/ (function(module, __webpack_exports__, __webpack_require__) {
2873
2874"use strict";
2875/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
2876/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(144);
2877/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(12);
2878
2879
2880
2881
2882// Partially apply a function by creating a version that has had some of its
2883// arguments pre-filled, without changing its dynamic `this` context. `_` acts
2884// as a placeholder by default, allowing any combination of arguments to be
2885// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
2886var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
2887 var placeholder = partial.placeholder;
2888 var bound = function() {
2889 var position = 0, length = boundArgs.length;
2890 var args = Array(length);
2891 for (var i = 0; i < length; i++) {
2892 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
2893 }
2894 while (position < arguments.length) args.push(arguments[position++]);
2895 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
2896 };
2897 return bound;
2898});
2899
2900partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
2901/* harmony default export */ __webpack_exports__["a"] = (partial);
2902
2903
2904/***/ }),
2905/* 66 */
2906/***/ (function(module, __webpack_exports__, __webpack_require__) {
2907
2908"use strict";
2909/* harmony export (immutable) */ __webpack_exports__["a"] = group;
2910/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
2911/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(30);
2912
2913
2914
2915// An internal function used for aggregate "group by" operations.
2916function group(behavior, partition) {
2917 return function(obj, iteratee, context) {
2918 var result = partition ? [[], []] : {};
2919 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
2920 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
2921 var key = iteratee(value, index, obj);
2922 behavior(result, value, key);
2923 });
2924 return result;
2925 };
2926}
2927
2928
2929/***/ }),
2930/* 67 */
2931/***/ (function(module, exports, __webpack_require__) {
2932
2933module.exports = { "default": __webpack_require__(286), __esModule: true };
2934
2935/***/ }),
2936/* 68 */
2937/***/ (function(module, exports, __webpack_require__) {
2938
2939"use strict";
2940
2941
2942var _stringify = __webpack_require__(21);
2943
2944var _stringify2 = _interopRequireDefault(_stringify);
2945
2946var _typeof2 = __webpack_require__(54);
2947
2948var _typeof3 = _interopRequireDefault(_typeof2);
2949
2950var _keys = __webpack_require__(97);
2951
2952var _keys2 = _interopRequireDefault(_keys);
2953
2954function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2955
2956var _ = __webpack_require__(0);
2957
2958var _require = __webpack_require__(295),
2959 timeout = _require.timeout;
2960
2961var debug = __webpack_require__(40);
2962var debugRequest = debug('leancloud:request');
2963var debugRequestError = debug('leancloud:request:error');
2964
2965var _require2 = __webpack_require__(41),
2966 getAdapter = _require2.getAdapter;
2967
2968var requestsCount = 0;
2969
2970var ajax = function ajax(_ref) {
2971 var method = _ref.method,
2972 url = _ref.url,
2973 query = _ref.query,
2974 data = _ref.data,
2975 _ref$headers = _ref.headers,
2976 headers = _ref$headers === undefined ? {} : _ref$headers,
2977 time = _ref.timeout,
2978 onprogress = _ref.onprogress;
2979
2980 if (query) {
2981 var queryString = (0, _keys2.default)(query).map(function (key) {
2982 var value = query[key];
2983 if (value === undefined) return undefined;
2984 var v = (typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) === 'object' ? (0, _stringify2.default)(value) : value;
2985 return encodeURIComponent(key) + '=' + encodeURIComponent(v);
2986 }).filter(function (qs) {
2987 return qs;
2988 }).join('&');
2989 url = url + '?' + queryString;
2990 }
2991
2992 var count = requestsCount++;
2993 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
2994
2995 var request = getAdapter('request');
2996 var promise = request(url, { method: method, headers: headers, data: data, onprogress: onprogress }).then(function (response) {
2997 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
2998 if (response.ok === false) {
2999 var error = new Error();
3000 error.response = response;
3001 throw error;
3002 }
3003 return response.data;
3004 }).catch(function (error) {
3005 if (error.response) {
3006 if (!debug.enabled('leancloud:request')) {
3007 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
3008 }
3009 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
3010 error.statusCode = error.response.status;
3011 error.responseText = error.response.text;
3012 error.response = error.response.data;
3013 }
3014 throw error;
3015 });
3016 return time ? timeout(promise, time) : promise;
3017};
3018
3019module.exports = ajax;
3020
3021/***/ }),
3022/* 69 */
3023/***/ (function(module, exports) {
3024
3025exports.f = {}.propertyIsEnumerable;
3026
3027
3028/***/ }),
3029/* 70 */
3030/***/ (function(module, exports) {
3031
3032// 7.1.4 ToInteger
3033var ceil = Math.ceil;
3034var floor = Math.floor;
3035module.exports = function (it) {
3036 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
3037};
3038
3039
3040/***/ }),
3041/* 71 */
3042/***/ (function(module, exports) {
3043
3044// 7.2.1 RequireObjectCoercible(argument)
3045module.exports = function (it) {
3046 if (it == undefined) throw TypeError("Can't call method on " + it);
3047 return it;
3048};
3049
3050
3051/***/ }),
3052/* 72 */
3053/***/ (function(module, exports, __webpack_require__) {
3054
3055"use strict";
3056
3057var LIBRARY = __webpack_require__(43);
3058var $export = __webpack_require__(8);
3059var redefine = __webpack_require__(75);
3060var hide = __webpack_require__(23);
3061var Iterators = __webpack_require__(32);
3062var $iterCreate = __webpack_require__(189);
3063var setToStringTag = __webpack_require__(47);
3064var getPrototypeOf = __webpack_require__(108);
3065var ITERATOR = __webpack_require__(7)('iterator');
3066var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
3067var FF_ITERATOR = '@@iterator';
3068var KEYS = 'keys';
3069var VALUES = 'values';
3070
3071var returnThis = function () { return this; };
3072
3073module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
3074 $iterCreate(Constructor, NAME, next);
3075 var getMethod = function (kind) {
3076 if (!BUGGY && kind in proto) return proto[kind];
3077 switch (kind) {
3078 case KEYS: return function keys() { return new Constructor(this, kind); };
3079 case VALUES: return function values() { return new Constructor(this, kind); };
3080 } return function entries() { return new Constructor(this, kind); };
3081 };
3082 var TAG = NAME + ' Iterator';
3083 var DEF_VALUES = DEFAULT == VALUES;
3084 var VALUES_BUG = false;
3085 var proto = Base.prototype;
3086 var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
3087 var $default = $native || getMethod(DEFAULT);
3088 var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
3089 var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
3090 var methods, key, IteratorPrototype;
3091 // Fix native
3092 if ($anyNative) {
3093 IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
3094 if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
3095 // Set @@toStringTag to native iterators
3096 setToStringTag(IteratorPrototype, TAG, true);
3097 // fix for some old engines
3098 if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
3099 }
3100 }
3101 // fix Array#{values, @@iterator}.name in V8 / FF
3102 if (DEF_VALUES && $native && $native.name !== VALUES) {
3103 VALUES_BUG = true;
3104 $default = function values() { return $native.call(this); };
3105 }
3106 // Define iterator
3107 if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
3108 hide(proto, ITERATOR, $default);
3109 }
3110 // Plug for library
3111 Iterators[NAME] = $default;
3112 Iterators[TAG] = returnThis;
3113 if (DEFAULT) {
3114 methods = {
3115 values: DEF_VALUES ? $default : getMethod(VALUES),
3116 keys: IS_SET ? $default : getMethod(KEYS),
3117 entries: $entries
3118 };
3119 if (FORCED) for (key in methods) {
3120 if (!(key in proto)) redefine(proto, key, methods[key]);
3121 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
3122 }
3123 return methods;
3124};
3125
3126
3127/***/ }),
3128/* 73 */
3129/***/ (function(module, exports, __webpack_require__) {
3130
3131var isObject = __webpack_require__(10);
3132var document = __webpack_require__(5).document;
3133// typeof document.createElement is 'object' in old IE
3134var is = isObject(document) && isObject(document.createElement);
3135module.exports = function (it) {
3136 return is ? document.createElement(it) : {};
3137};
3138
3139
3140/***/ }),
3141/* 74 */
3142/***/ (function(module, exports, __webpack_require__) {
3143
3144// 7.1.1 ToPrimitive(input [, PreferredType])
3145var isObject = __webpack_require__(10);
3146// instead of the ES6 spec version, we didn't implement @@toPrimitive case
3147// and the second argument - flag - preferred type is a string
3148module.exports = function (it, S) {
3149 if (!isObject(it)) return it;
3150 var fn, val;
3151 if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
3152 if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
3153 if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
3154 throw TypeError("Can't convert object to primitive value");
3155};
3156
3157
3158/***/ }),
3159/* 75 */
3160/***/ (function(module, exports, __webpack_require__) {
3161
3162module.exports = __webpack_require__(23);
3163
3164
3165/***/ }),
3166/* 76 */
3167/***/ (function(module, exports, __webpack_require__) {
3168
3169// fallback for non-array-like ES3 and non-enumerable old V8 strings
3170var cof = __webpack_require__(46);
3171// eslint-disable-next-line no-prototype-builtins
3172module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
3173 return cof(it) == 'String' ? it.split('') : Object(it);
3174};
3175
3176
3177/***/ }),
3178/* 77 */
3179/***/ (function(module, exports, __webpack_require__) {
3180
3181// 7.1.15 ToLength
3182var toInteger = __webpack_require__(70);
3183var min = Math.min;
3184module.exports = function (it) {
3185 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
3186};
3187
3188
3189/***/ }),
3190/* 78 */
3191/***/ (function(module, exports, __webpack_require__) {
3192
3193var shared = __webpack_require__(79)('keys');
3194var uid = __webpack_require__(60);
3195module.exports = function (key) {
3196 return shared[key] || (shared[key] = uid(key));
3197};
3198
3199
3200/***/ }),
3201/* 79 */
3202/***/ (function(module, exports, __webpack_require__) {
3203
3204var core = __webpack_require__(2);
3205var global = __webpack_require__(5);
3206var SHARED = '__core-js_shared__';
3207var store = global[SHARED] || (global[SHARED] = {});
3208
3209(module.exports = function (key, value) {
3210 return store[key] || (store[key] = value !== undefined ? value : {});
3211})('versions', []).push({
3212 version: core.version,
3213 mode: __webpack_require__(43) ? 'pure' : 'global',
3214 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
3215});
3216
3217
3218/***/ }),
3219/* 80 */
3220/***/ (function(module, exports) {
3221
3222// IE 8- don't enum bug keys
3223module.exports = (
3224 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
3225).split(',');
3226
3227
3228/***/ }),
3229/* 81 */
3230/***/ (function(module, exports, __webpack_require__) {
3231
3232"use strict";
3233
3234// 25.4.1.5 NewPromiseCapability(C)
3235var aFunction = __webpack_require__(44);
3236
3237function PromiseCapability(C) {
3238 var resolve, reject;
3239 this.promise = new C(function ($$resolve, $$reject) {
3240 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
3241 resolve = $$resolve;
3242 reject = $$reject;
3243 });
3244 this.resolve = aFunction(resolve);
3245 this.reject = aFunction(reject);
3246}
3247
3248module.exports.f = function (C) {
3249 return new PromiseCapability(C);
3250};
3251
3252
3253/***/ }),
3254/* 82 */
3255/***/ (function(module, __webpack_exports__, __webpack_require__) {
3256
3257"use strict";
3258Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
3259/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
3260/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
3261/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(11);
3262/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
3263/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(28);
3264/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
3265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(205);
3266/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
3267/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(117);
3268/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
3269/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(118);
3270/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
3271/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(206);
3272/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
3273/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(83);
3274/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
3275/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(119);
3276/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
3277/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(207);
3278/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
3279/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(208);
3280/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
3281/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(209);
3282/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
3283/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(120);
3284/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
3285/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(121);
3286/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
3287/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(84);
3288/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
3289/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(29);
3290/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
3291/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(15);
3292/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
3293/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(85);
3294/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
3295/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(211);
3296/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
3297/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(122);
3298/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
3299/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(123);
3300/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
3301/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(213);
3302/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
3303/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(128);
3304/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
3305/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(214);
3306/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
3307/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(216);
3308/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
3309/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(217);
3310/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
3311/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(218);
3312/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
3313/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(219);
3314/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
3315/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(4);
3316/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
3317/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(49);
3318/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
3319/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(36);
3320/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
3321/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(220);
3322/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
3323/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(129);
3324/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
3325/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(130);
3326/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
3327/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
3328/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(131);
3329/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
3330/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(89);
3331/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
3332/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
3333/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(132);
3334/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
3335/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(221);
3336/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
3337/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(134);
3338/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
3339/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(222);
3340/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
3341/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(135);
3342/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
3343/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(223);
3344/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
3345/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(224);
3346/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
3347/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(91);
3348/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
3349/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(124);
3350/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
3351/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(139);
3352/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
3353/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(136);
3354/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
3355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(92);
3356/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
3357/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(225);
3358/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
3359/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(64);
3360/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
3361/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
3362/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(226);
3363/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
3364/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(140);
3365/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
3366/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(93);
3367/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
3368/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(227);
3369/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
3370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(228);
3371/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
3372/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(143);
3373/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
3374/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(230);
3375/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
3376/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(231);
3377/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
3378/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(232);
3379/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
3380/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(233);
3381/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
3382/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(138);
3383/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
3384/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(65);
3385/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
3386/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(145);
3387/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
3388/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(234);
3389/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
3390/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(235);
3391/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
3392/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(146);
3393/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
3394/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(236);
3395/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
3396/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(237);
3397/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
3398/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(238);
3399/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
3400/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(239);
3401/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
3402/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(94);
3403/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
3404/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(240);
3405/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
3406/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(241);
3407/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
3408/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(147);
3409/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
3410/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(242);
3411/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
3412/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(148);
3413/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
3414/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(95);
3415/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
3416/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(150);
3417/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
3418/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(151);
3419/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
3420/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(152);
3421/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
3422/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(243);
3423/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
3424/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(154);
3425/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
3426/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
3427/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(244);
3428/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
3429/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(30);
3430/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
3431/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
3432/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(38);
3433/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
3434/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
3435/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(245);
3436/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3437/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3438/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3439/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(246);
3440/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
3441/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
3442/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(52);
3443/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
3444/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
3445/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(247);
3446/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
3447/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(248);
3448/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
3449/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
3450/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(249);
3451/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
3452/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
3453/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(53);
3454/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3455/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3456/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3457/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(250);
3458/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
3459/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(96);
3460/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
3461/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(251);
3462/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
3463/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(156);
3464/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
3465/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(252);
3466/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
3467/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(253);
3468/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
3469/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(157);
3470/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
3471/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(254);
3472/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
3473/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(255);
3474/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
3475/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(256);
3476/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
3477/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(257);
3478/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
3479/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(258);
3480/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
3481/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(259);
3482/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
3483/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(260);
3484/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
3485/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(158);
3486/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
3487/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(262);
3488/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
3489/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(263);
3490/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3491/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3492/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3493/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(159);
3494/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
3495/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(264);
3496/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
3497/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(160);
3498/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3499/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3500/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3501/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(265);
3502/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
3503/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(266);
3504/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
3505/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(267);
3506/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
3507/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(162);
3508/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
3509/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
3510/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(268);
3511/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
3512/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(269);
3513/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
3514/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(161);
3515/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
3516/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(163);
3517/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
3518/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
3519/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(270);
3520/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
3521/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(271);
3522/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
3523/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(272);
3524/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
3525/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(273);
3526/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
3527/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(274);
3528/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
3529/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(275);
3530/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
3531// Named Exports
3532// =============
3533
3534// Underscore.js 1.12.1
3535// https://underscorejs.org
3536// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3537// Underscore may be freely distributed under the MIT license.
3538
3539// Baseline setup.
3540
3541
3542
3543// Object Functions
3544// ----------------
3545// Our most fundamental functions operate on any JavaScript object.
3546// Most functions in Underscore depend on at least one function in this section.
3547
3548// A group of functions that check the types of core JavaScript values.
3549// These are often informally referred to as the "isType" functions.
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577// Functions that treat an object as a dictionary of key-value pairs.
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594// Utility Functions
3595// -----------------
3596// A bit of a grab bag: Predicate-generating functions for use with filters and
3597// loops, string escaping and templating, create random numbers and unique ids,
3598// and functions that facilitate Underscore's chaining and iteration conventions.
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618// Function (ahem) Functions
3619// -------------------------
3620// These functions take a function as an argument and return a new function
3621// as the result. Also known as higher-order functions.
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637// Finders
3638// -------
3639// Functions that extract (the position of) a single element from an object
3640// or array based on some criterion.
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650// Collection Functions
3651// --------------------
3652// Functions that work on any collection of elements: either an array, or
3653// an object of key-value pairs.
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678// `_.pick` and `_.omit` are actually object functions, but we put
3679// them here in order to create a more natural reading order in the
3680// monolithic build as they depend on `_.contains`.
3681
3682
3683
3684// Array Functions
3685// ---------------
3686// Functions that operate on arrays (and array-likes) only, because they’re
3687// expressed in terms of operations on an ordered list of values.
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705// OOP
3706// ---
3707// These modules support the "object-oriented" calling style. See also
3708// `underscore.js` and `index-default.js`.
3709
3710
3711
3712
3713/***/ }),
3714/* 83 */
3715/***/ (function(module, __webpack_exports__, __webpack_require__) {
3716
3717"use strict";
3718/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
3719
3720
3721/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
3722
3723
3724/***/ }),
3725/* 84 */
3726/***/ (function(module, __webpack_exports__, __webpack_require__) {
3727
3728"use strict";
3729/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
3730/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(15);
3731/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(121);
3732/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(48);
3733
3734
3735
3736
3737
3738var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
3739
3740// In IE 10 - Edge 13, we need a different heuristic
3741// to determine whether an object is a `DataView`.
3742function ie10IsDataView(obj) {
3743 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);
3744}
3745
3746/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
3747
3748
3749/***/ }),
3750/* 85 */
3751/***/ (function(module, __webpack_exports__, __webpack_require__) {
3752
3753"use strict";
3754/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
3755/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(25);
3756
3757
3758
3759var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
3760
3761// Define a fallback version of the method in browsers (ahem, IE < 9), where
3762// there isn't any inspectable "Arguments" type.
3763(function() {
3764 if (!isArguments(arguments)) {
3765 isArguments = function(obj) {
3766 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
3767 };
3768 }
3769}());
3770
3771/* harmony default export */ __webpack_exports__["a"] = (isArguments);
3772
3773
3774/***/ }),
3775/* 86 */
3776/***/ (function(module, __webpack_exports__, __webpack_require__) {
3777
3778"use strict";
3779/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(126);
3780
3781
3782// Internal helper to obtain the `byteLength` property of an object.
3783/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
3784
3785
3786/***/ }),
3787/* 87 */
3788/***/ (function(module, __webpack_exports__, __webpack_require__) {
3789
3790"use strict";
3791/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
3792/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
3793/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
3794/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
3795/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(16);
3796/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(15);
3797/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(49);
3798
3799
3800
3801
3802// Since the regular `Object.prototype.toString` type tests don't work for
3803// some types in IE 11, we use a fingerprinting heuristic instead, based
3804// on the methods. It's not great, but it's the best we got.
3805// The fingerprint method lists are defined below.
3806function ie11fingerprint(methods) {
3807 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
3808 return function(obj) {
3809 if (obj == null) return false;
3810 // `Map`, `WeakMap` and `Set` have no enumerable keys.
3811 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
3812 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
3813 for (var i = 0; i < length; i++) {
3814 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
3815 }
3816 // If we are testing against `WeakMap`, we need to ensure that
3817 // `obj` doesn't have a `forEach` method in order to distinguish
3818 // it from a regular `Map`.
3819 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
3820 };
3821}
3822
3823// In the interest of compact minification, we write
3824// each string in the fingerprints only once.
3825var forEachName = 'forEach',
3826 hasName = 'has',
3827 commonInit = ['clear', 'delete'],
3828 mapTail = ['get', hasName, 'set'];
3829
3830// `Map`, `WeakMap` and `Set` each have slightly different
3831// combinations of the above sublists.
3832var mapMethods = commonInit.concat(forEachName, mapTail),
3833 weakMapMethods = commonInit.concat(mapTail),
3834 setMethods = ['add'].concat(commonInit, forEachName, hasName);
3835
3836
3837/***/ }),
3838/* 88 */
3839/***/ (function(module, __webpack_exports__, __webpack_require__) {
3840
3841"use strict";
3842/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
3843// An internal function for creating assigner functions.
3844function createAssigner(keysFunc, defaults) {
3845 return function(obj) {
3846 var length = arguments.length;
3847 if (defaults) obj = Object(obj);
3848 if (length < 2 || obj == null) return obj;
3849 for (var index = 1; index < length; index++) {
3850 var source = arguments[index],
3851 keys = keysFunc(source),
3852 l = keys.length;
3853 for (var i = 0; i < l; i++) {
3854 var key = keys[i];
3855 if (!defaults || obj[key] === void 0) obj[key] = source[key];
3856 }
3857 }
3858 return obj;
3859 };
3860}
3861
3862
3863/***/ }),
3864/* 89 */
3865/***/ (function(module, __webpack_exports__, __webpack_require__) {
3866
3867"use strict";
3868/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(88);
3869/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
3870
3871
3872
3873// Assigns a given object with all the own properties in the passed-in
3874// object(s).
3875// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
3876/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
3877
3878
3879/***/ }),
3880/* 90 */
3881/***/ (function(module, __webpack_exports__, __webpack_require__) {
3882
3883"use strict";
3884/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
3885// Internal function to obtain a nested property in `obj` along `path`.
3886function deepGet(obj, path) {
3887 var length = path.length;
3888 for (var i = 0; i < length; i++) {
3889 if (obj == null) return void 0;
3890 obj = obj[path[i]];
3891 }
3892 return length ? obj : void 0;
3893}
3894
3895
3896/***/ }),
3897/* 91 */
3898/***/ (function(module, __webpack_exports__, __webpack_require__) {
3899
3900"use strict";
3901/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
3902// Keep the identity function around for default iteratees.
3903function identity(value) {
3904 return value;
3905}
3906
3907
3908/***/ }),
3909/* 92 */
3910/***/ (function(module, __webpack_exports__, __webpack_require__) {
3911
3912"use strict";
3913/* harmony export (immutable) */ __webpack_exports__["a"] = property;
3914/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(90);
3915/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(50);
3916
3917
3918
3919// Creates a function that, when passed an object, will traverse that object’s
3920// properties down the given `path`, specified as an array of keys or indices.
3921function property(path) {
3922 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
3923 return function(obj) {
3924 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
3925 };
3926}
3927
3928
3929/***/ }),
3930/* 93 */
3931/***/ (function(module, __webpack_exports__, __webpack_require__) {
3932
3933"use strict";
3934// A (possibly faster) way to get the current timestamp as an integer.
3935/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
3936 return new Date().getTime();
3937});
3938
3939
3940/***/ }),
3941/* 94 */
3942/***/ (function(module, __webpack_exports__, __webpack_require__) {
3943
3944"use strict";
3945/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
3946// Returns a negated version of the passed-in predicate.
3947function negate(predicate) {
3948 return function() {
3949 return !predicate.apply(this, arguments);
3950 };
3951}
3952
3953
3954/***/ }),
3955/* 95 */
3956/***/ (function(module, __webpack_exports__, __webpack_require__) {
3957
3958"use strict";
3959/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(149);
3960
3961
3962// Returns the first index on an array-like that passes a truth test.
3963/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
3964
3965
3966/***/ }),
3967/* 96 */
3968/***/ (function(module, __webpack_exports__, __webpack_require__) {
3969
3970"use strict";
3971/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
3972/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(38);
3973/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(92);
3974
3975
3976
3977// Convenience version of a common use case of `_.map`: fetching a property.
3978function pluck(obj, key) {
3979 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
3980}
3981
3982
3983/***/ }),
3984/* 97 */
3985/***/ (function(module, exports, __webpack_require__) {
3986
3987module.exports = { "default": __webpack_require__(277), __esModule: true };
3988
3989/***/ }),
3990/* 98 */
3991/***/ (function(module, exports, __webpack_require__) {
3992
3993// most Object methods by ES6 should accept primitives
3994var $export = __webpack_require__(8);
3995var core = __webpack_require__(2);
3996var fails = __webpack_require__(26);
3997module.exports = function (KEY, exec) {
3998 var fn = (core.Object || {})[KEY] || Object[KEY];
3999 var exp = {};
4000 exp[KEY] = exec(fn);
4001 $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
4002};
4003
4004
4005/***/ }),
4006/* 99 */
4007/***/ (function(module, exports, __webpack_require__) {
4008
4009module.exports = { "default": __webpack_require__(283), __esModule: true };
4010
4011/***/ }),
4012/* 100 */
4013/***/ (function(module, exports, __webpack_require__) {
4014
4015exports.f = __webpack_require__(7);
4016
4017
4018/***/ }),
4019/* 101 */
4020/***/ (function(module, exports, __webpack_require__) {
4021
4022var global = __webpack_require__(5);
4023var core = __webpack_require__(2);
4024var LIBRARY = __webpack_require__(43);
4025var wksExt = __webpack_require__(100);
4026var defineProperty = __webpack_require__(20).f;
4027module.exports = function (name) {
4028 var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
4029 if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
4030};
4031
4032
4033/***/ }),
4034/* 102 */
4035/***/ (function(module, exports) {
4036
4037exports.f = Object.getOwnPropertySymbols;
4038
4039
4040/***/ }),
4041/* 103 */
4042/***/ (function(module, exports, __webpack_require__) {
4043
4044var pIE = __webpack_require__(69);
4045var createDesc = __webpack_require__(58);
4046var toIObject = __webpack_require__(27);
4047var toPrimitive = __webpack_require__(74);
4048var has = __webpack_require__(24);
4049var IE8_DOM_DEFINE = __webpack_require__(105);
4050var gOPD = Object.getOwnPropertyDescriptor;
4051
4052exports.f = __webpack_require__(19) ? gOPD : function getOwnPropertyDescriptor(O, P) {
4053 O = toIObject(O);
4054 P = toPrimitive(P, true);
4055 if (IE8_DOM_DEFINE) try {
4056 return gOPD(O, P);
4057 } catch (e) { /* empty */ }
4058 if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
4059};
4060
4061
4062/***/ }),
4063/* 104 */
4064/***/ (function(module, exports, __webpack_require__) {
4065
4066// 0 -> Array#forEach
4067// 1 -> Array#map
4068// 2 -> Array#filter
4069// 3 -> Array#some
4070// 4 -> Array#every
4071// 5 -> Array#find
4072// 6 -> Array#findIndex
4073var ctx = __webpack_require__(22);
4074var IObject = __webpack_require__(76);
4075var toObject = __webpack_require__(33);
4076var toLength = __webpack_require__(77);
4077var asc = __webpack_require__(348);
4078module.exports = function (TYPE, $create) {
4079 var IS_MAP = TYPE == 1;
4080 var IS_FILTER = TYPE == 2;
4081 var IS_SOME = TYPE == 3;
4082 var IS_EVERY = TYPE == 4;
4083 var IS_FIND_INDEX = TYPE == 6;
4084 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
4085 var create = $create || asc;
4086 return function ($this, callbackfn, that) {
4087 var O = toObject($this);
4088 var self = IObject(O);
4089 var f = ctx(callbackfn, that, 3);
4090 var length = toLength(self.length);
4091 var index = 0;
4092 var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
4093 var val, res;
4094 for (;length > index; index++) if (NO_HOLES || index in self) {
4095 val = self[index];
4096 res = f(val, index, O);
4097 if (TYPE) {
4098 if (IS_MAP) result[index] = res; // map
4099 else if (res) switch (TYPE) {
4100 case 3: return true; // some
4101 case 5: return val; // find
4102 case 6: return index; // findIndex
4103 case 2: result.push(val); // filter
4104 } else if (IS_EVERY) return false; // every
4105 }
4106 }
4107 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
4108 };
4109};
4110
4111
4112/***/ }),
4113/* 105 */
4114/***/ (function(module, exports, __webpack_require__) {
4115
4116module.exports = !__webpack_require__(19) && !__webpack_require__(26)(function () {
4117 return Object.defineProperty(__webpack_require__(73)('div'), 'a', { get: function () { return 7; } }).a != 7;
4118});
4119
4120
4121/***/ }),
4122/* 106 */
4123/***/ (function(module, exports, __webpack_require__) {
4124
4125var has = __webpack_require__(24);
4126var toIObject = __webpack_require__(27);
4127var arrayIndexOf = __webpack_require__(191)(false);
4128var IE_PROTO = __webpack_require__(78)('IE_PROTO');
4129
4130module.exports = function (object, names) {
4131 var O = toIObject(object);
4132 var i = 0;
4133 var result = [];
4134 var key;
4135 for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
4136 // Don't enum bug & hidden keys
4137 while (names.length > i) if (has(O, key = names[i++])) {
4138 ~arrayIndexOf(result, key) || result.push(key);
4139 }
4140 return result;
4141};
4142
4143
4144/***/ }),
4145/* 107 */
4146/***/ (function(module, exports, __webpack_require__) {
4147
4148var document = __webpack_require__(5).document;
4149module.exports = document && document.documentElement;
4150
4151
4152/***/ }),
4153/* 108 */
4154/***/ (function(module, exports, __webpack_require__) {
4155
4156// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
4157var has = __webpack_require__(24);
4158var toObject = __webpack_require__(33);
4159var IE_PROTO = __webpack_require__(78)('IE_PROTO');
4160var ObjectProto = Object.prototype;
4161
4162module.exports = Object.getPrototypeOf || function (O) {
4163 O = toObject(O);
4164 if (has(O, IE_PROTO)) return O[IE_PROTO];
4165 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
4166 return O.constructor.prototype;
4167 } return O instanceof Object ? ObjectProto : null;
4168};
4169
4170
4171/***/ }),
4172/* 109 */
4173/***/ (function(module, exports) {
4174
4175module.exports = function (done, value) {
4176 return { value: value, done: !!done };
4177};
4178
4179
4180/***/ }),
4181/* 110 */
4182/***/ (function(module, exports, __webpack_require__) {
4183
4184var classof = __webpack_require__(61);
4185var ITERATOR = __webpack_require__(7)('iterator');
4186var Iterators = __webpack_require__(32);
4187module.exports = __webpack_require__(2).getIteratorMethod = function (it) {
4188 if (it != undefined) return it[ITERATOR]
4189 || it['@@iterator']
4190 || Iterators[classof(it)];
4191};
4192
4193
4194/***/ }),
4195/* 111 */
4196/***/ (function(module, exports, __webpack_require__) {
4197
4198// 7.3.20 SpeciesConstructor(O, defaultConstructor)
4199var anObject = __webpack_require__(18);
4200var aFunction = __webpack_require__(44);
4201var SPECIES = __webpack_require__(7)('species');
4202module.exports = function (O, D) {
4203 var C = anObject(O).constructor;
4204 var S;
4205 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
4206};
4207
4208
4209/***/ }),
4210/* 112 */
4211/***/ (function(module, exports, __webpack_require__) {
4212
4213var ctx = __webpack_require__(22);
4214var invoke = __webpack_require__(198);
4215var html = __webpack_require__(107);
4216var cel = __webpack_require__(73);
4217var global = __webpack_require__(5);
4218var process = global.process;
4219var setTask = global.setImmediate;
4220var clearTask = global.clearImmediate;
4221var MessageChannel = global.MessageChannel;
4222var Dispatch = global.Dispatch;
4223var counter = 0;
4224var queue = {};
4225var ONREADYSTATECHANGE = 'onreadystatechange';
4226var defer, channel, port;
4227var run = function () {
4228 var id = +this;
4229 // eslint-disable-next-line no-prototype-builtins
4230 if (queue.hasOwnProperty(id)) {
4231 var fn = queue[id];
4232 delete queue[id];
4233 fn();
4234 }
4235};
4236var listener = function (event) {
4237 run.call(event.data);
4238};
4239// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
4240if (!setTask || !clearTask) {
4241 setTask = function setImmediate(fn) {
4242 var args = [];
4243 var i = 1;
4244 while (arguments.length > i) args.push(arguments[i++]);
4245 queue[++counter] = function () {
4246 // eslint-disable-next-line no-new-func
4247 invoke(typeof fn == 'function' ? fn : Function(fn), args);
4248 };
4249 defer(counter);
4250 return counter;
4251 };
4252 clearTask = function clearImmediate(id) {
4253 delete queue[id];
4254 };
4255 // Node.js 0.8-
4256 if (__webpack_require__(46)(process) == 'process') {
4257 defer = function (id) {
4258 process.nextTick(ctx(run, id, 1));
4259 };
4260 // Sphere (JS game engine) Dispatch API
4261 } else if (Dispatch && Dispatch.now) {
4262 defer = function (id) {
4263 Dispatch.now(ctx(run, id, 1));
4264 };
4265 // Browsers with MessageChannel, includes WebWorkers
4266 } else if (MessageChannel) {
4267 channel = new MessageChannel();
4268 port = channel.port2;
4269 channel.port1.onmessage = listener;
4270 defer = ctx(port.postMessage, port, 1);
4271 // Browsers with postMessage, skip WebWorkers
4272 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
4273 } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
4274 defer = function (id) {
4275 global.postMessage(id + '', '*');
4276 };
4277 global.addEventListener('message', listener, false);
4278 // IE8-
4279 } else if (ONREADYSTATECHANGE in cel('script')) {
4280 defer = function (id) {
4281 html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
4282 html.removeChild(this);
4283 run.call(id);
4284 };
4285 };
4286 // Rest old browsers
4287 } else {
4288 defer = function (id) {
4289 setTimeout(ctx(run, id, 1), 0);
4290 };
4291 }
4292}
4293module.exports = {
4294 set: setTask,
4295 clear: clearTask
4296};
4297
4298
4299/***/ }),
4300/* 113 */
4301/***/ (function(module, exports) {
4302
4303module.exports = function (exec) {
4304 try {
4305 return { e: false, v: exec() };
4306 } catch (e) {
4307 return { e: true, v: e };
4308 }
4309};
4310
4311
4312/***/ }),
4313/* 114 */
4314/***/ (function(module, exports, __webpack_require__) {
4315
4316var anObject = __webpack_require__(18);
4317var isObject = __webpack_require__(10);
4318var newPromiseCapability = __webpack_require__(81);
4319
4320module.exports = function (C, x) {
4321 anObject(C);
4322 if (isObject(x) && x.constructor === C) return x;
4323 var promiseCapability = newPromiseCapability.f(C);
4324 var resolve = promiseCapability.resolve;
4325 resolve(x);
4326 return promiseCapability.promise;
4327};
4328
4329
4330/***/ }),
4331/* 115 */
4332/***/ (function(module, exports, __webpack_require__) {
4333
4334"use strict";
4335
4336var global = __webpack_require__(5);
4337var core = __webpack_require__(2);
4338var dP = __webpack_require__(20);
4339var DESCRIPTORS = __webpack_require__(19);
4340var SPECIES = __webpack_require__(7)('species');
4341
4342module.exports = function (KEY) {
4343 var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
4344 if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
4345 configurable: true,
4346 get: function () { return this; }
4347 });
4348};
4349
4350
4351/***/ }),
4352/* 116 */
4353/***/ (function(module, exports) {
4354
4355var g;
4356
4357// This works in non-strict mode
4358g = (function() {
4359 return this;
4360})();
4361
4362try {
4363 // This works if eval is allowed (see CSP)
4364 g = g || Function("return this")() || (1,eval)("this");
4365} catch(e) {
4366 // This works if the window reference is available
4367 if(typeof window === "object")
4368 g = window;
4369}
4370
4371// g can still be undefined, but nothing to do about it...
4372// We return undefined, instead of nothing here, so it's
4373// easier to handle this case. if(!global) { ...}
4374
4375module.exports = g;
4376
4377
4378/***/ }),
4379/* 117 */
4380/***/ (function(module, __webpack_exports__, __webpack_require__) {
4381
4382"use strict";
4383/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
4384// Is a given variable undefined?
4385function isUndefined(obj) {
4386 return obj === void 0;
4387}
4388
4389
4390/***/ }),
4391/* 118 */
4392/***/ (function(module, __webpack_exports__, __webpack_require__) {
4393
4394"use strict";
4395/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
4396/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4397
4398
4399// Is a given value a boolean?
4400function isBoolean(obj) {
4401 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
4402}
4403
4404
4405/***/ }),
4406/* 119 */
4407/***/ (function(module, __webpack_exports__, __webpack_require__) {
4408
4409"use strict";
4410/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
4411
4412
4413/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
4414
4415
4416/***/ }),
4417/* 120 */
4418/***/ (function(module, __webpack_exports__, __webpack_require__) {
4419
4420"use strict";
4421/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
4422
4423
4424/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
4425
4426
4427/***/ }),
4428/* 121 */
4429/***/ (function(module, __webpack_exports__, __webpack_require__) {
4430
4431"use strict";
4432/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
4433
4434
4435/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
4436
4437
4438/***/ }),
4439/* 122 */
4440/***/ (function(module, __webpack_exports__, __webpack_require__) {
4441
4442"use strict";
4443/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
4444/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4445/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(119);
4446
4447
4448
4449// Is the given value `NaN`?
4450function isNaN(obj) {
4451 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
4452}
4453
4454
4455/***/ }),
4456/* 123 */
4457/***/ (function(module, __webpack_exports__, __webpack_require__) {
4458
4459"use strict";
4460/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4461/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(84);
4462/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(124);
4463/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(212);
4464
4465
4466
4467
4468
4469// Is a given value a typed array?
4470var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
4471function isTypedArray(obj) {
4472 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
4473 // Otherwise, fall back on the above regular expression.
4474 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)) :
4475 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
4476}
4477
4478/* 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));
4479
4480
4481/***/ }),
4482/* 124 */
4483/***/ (function(module, __webpack_exports__, __webpack_require__) {
4484
4485"use strict";
4486/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
4487// Predicate-generating function. Often useful outside of Underscore.
4488function constant(value) {
4489 return function() {
4490 return value;
4491 };
4492}
4493
4494
4495/***/ }),
4496/* 125 */
4497/***/ (function(module, __webpack_exports__, __webpack_require__) {
4498
4499"use strict";
4500/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
4501/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4502
4503
4504// Common internal logic for `isArrayLike` and `isBufferLike`.
4505function createSizePropertyCheck(getSizeProperty) {
4506 return function(collection) {
4507 var sizeProperty = getSizeProperty(collection);
4508 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
4509 }
4510}
4511
4512
4513/***/ }),
4514/* 126 */
4515/***/ (function(module, __webpack_exports__, __webpack_require__) {
4516
4517"use strict";
4518/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
4519// Internal helper to generate a function to obtain property `key` from `obj`.
4520function shallowProperty(key) {
4521 return function(obj) {
4522 return obj == null ? void 0 : obj[key];
4523 };
4524}
4525
4526
4527/***/ }),
4528/* 127 */
4529/***/ (function(module, __webpack_exports__, __webpack_require__) {
4530
4531"use strict";
4532/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
4533/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4534/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(15);
4535/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(25);
4536
4537
4538
4539
4540// Internal helper to create a simple lookup structure.
4541// `collectNonEnumProps` used to depend on `_.contains`, but this led to
4542// circular imports. `emulatedSet` is a one-off solution that only works for
4543// arrays of strings.
4544function emulatedSet(keys) {
4545 var hash = {};
4546 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
4547 return {
4548 contains: function(key) { return hash[key]; },
4549 push: function(key) {
4550 hash[key] = true;
4551 return keys.push(key);
4552 }
4553 };
4554}
4555
4556// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
4557// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
4558// needed.
4559function collectNonEnumProps(obj, keys) {
4560 keys = emulatedSet(keys);
4561 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
4562 var constructor = obj.constructor;
4563 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
4564
4565 // Constructor is a special case.
4566 var prop = 'constructor';
4567 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
4568
4569 while (nonEnumIdx--) {
4570 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
4571 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
4572 keys.push(prop);
4573 }
4574 }
4575}
4576
4577
4578/***/ }),
4579/* 128 */
4580/***/ (function(module, __webpack_exports__, __webpack_require__) {
4581
4582"use strict";
4583/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
4584/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
4585
4586
4587// Returns whether an object has a given set of `key:value` pairs.
4588function isMatch(object, attrs) {
4589 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
4590 if (object == null) return !length;
4591 var obj = Object(object);
4592 for (var i = 0; i < length; i++) {
4593 var key = _keys[i];
4594 if (attrs[key] !== obj[key] || !(key in obj)) return false;
4595 }
4596 return true;
4597}
4598
4599
4600/***/ }),
4601/* 129 */
4602/***/ (function(module, __webpack_exports__, __webpack_require__) {
4603
4604"use strict";
4605/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
4606/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
4607
4608
4609// Invert the keys and values of an object. The values must be serializable.
4610function invert(obj) {
4611 var result = {};
4612 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
4613 for (var i = 0, length = _keys.length; i < length; i++) {
4614 result[obj[_keys[i]]] = _keys[i];
4615 }
4616 return result;
4617}
4618
4619
4620/***/ }),
4621/* 130 */
4622/***/ (function(module, __webpack_exports__, __webpack_require__) {
4623
4624"use strict";
4625/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
4626/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(15);
4627
4628
4629// Return a sorted list of the function names available on the object.
4630function functions(obj) {
4631 var names = [];
4632 for (var key in obj) {
4633 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
4634 }
4635 return names.sort();
4636}
4637
4638
4639/***/ }),
4640/* 131 */
4641/***/ (function(module, __webpack_exports__, __webpack_require__) {
4642
4643"use strict";
4644/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(88);
4645/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(49);
4646
4647
4648
4649// Extend a given object with all the properties in passed-in object(s).
4650/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
4651
4652
4653/***/ }),
4654/* 132 */
4655/***/ (function(module, __webpack_exports__, __webpack_require__) {
4656
4657"use strict";
4658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(88);
4659/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(49);
4660
4661
4662
4663// Fill in a given object with default properties.
4664/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
4665
4666
4667/***/ }),
4668/* 133 */
4669/***/ (function(module, __webpack_exports__, __webpack_require__) {
4670
4671"use strict";
4672/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
4673/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(28);
4674/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
4675
4676
4677
4678// Create a naked function reference for surrogate-prototype-swapping.
4679function ctor() {
4680 return function(){};
4681}
4682
4683// An internal function for creating a new object that inherits from another.
4684function baseCreate(prototype) {
4685 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
4686 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
4687 var Ctor = ctor();
4688 Ctor.prototype = prototype;
4689 var result = new Ctor;
4690 Ctor.prototype = null;
4691 return result;
4692}
4693
4694
4695/***/ }),
4696/* 134 */
4697/***/ (function(module, __webpack_exports__, __webpack_require__) {
4698
4699"use strict";
4700/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
4701/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(28);
4702/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(29);
4703/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(131);
4704
4705
4706
4707
4708// Create a (shallow-cloned) duplicate of an object.
4709function clone(obj) {
4710 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
4711 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
4712}
4713
4714
4715/***/ }),
4716/* 135 */
4717/***/ (function(module, __webpack_exports__, __webpack_require__) {
4718
4719"use strict";
4720/* harmony export (immutable) */ __webpack_exports__["a"] = get;
4721/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(50);
4722/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(90);
4723/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(117);
4724
4725
4726
4727
4728// Get the value of the (deep) property on `path` from `object`.
4729// If any property in `path` does not exist or if the value is
4730// `undefined`, return `defaultValue` instead.
4731// The `path` is normalized through `_.toPath`.
4732function get(object, path, defaultValue) {
4733 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
4734 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
4735}
4736
4737
4738/***/ }),
4739/* 136 */
4740/***/ (function(module, __webpack_exports__, __webpack_require__) {
4741
4742"use strict";
4743/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
4744/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
4745/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(29);
4746
4747
4748
4749// Normalize a (deep) property `path` to array.
4750// Like `_.iteratee`, this function can be customized.
4751function toPath(path) {
4752 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
4753}
4754__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
4755
4756
4757/***/ }),
4758/* 137 */
4759/***/ (function(module, __webpack_exports__, __webpack_require__) {
4760
4761"use strict";
4762/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
4763/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(91);
4764/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(15);
4765/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(28);
4766/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(29);
4767/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(64);
4768/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(92);
4769/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(51);
4770
4771
4772
4773
4774
4775
4776
4777
4778// An internal function to generate callbacks that can be applied to each
4779// element in a collection, returning the desired result — either `_.identity`,
4780// an arbitrary callback, a property matcher, or a property accessor.
4781function baseIteratee(value, context, argCount) {
4782 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
4783 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
4784 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);
4785 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
4786}
4787
4788
4789/***/ }),
4790/* 138 */
4791/***/ (function(module, __webpack_exports__, __webpack_require__) {
4792
4793"use strict";
4794/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
4795/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
4796/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(137);
4797
4798
4799
4800// External wrapper for our callback generator. Users may customize
4801// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
4802// This abstraction hides the internal-only `argCount` argument.
4803function iteratee(value, context) {
4804 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
4805}
4806__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
4807
4808
4809/***/ }),
4810/* 139 */
4811/***/ (function(module, __webpack_exports__, __webpack_require__) {
4812
4813"use strict";
4814/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
4815// Predicate-generating function. Often useful outside of Underscore.
4816function noop(){}
4817
4818
4819/***/ }),
4820/* 140 */
4821/***/ (function(module, __webpack_exports__, __webpack_require__) {
4822
4823"use strict";
4824/* harmony export (immutable) */ __webpack_exports__["a"] = random;
4825// Return a random integer between `min` and `max` (inclusive).
4826function random(min, max) {
4827 if (max == null) {
4828 max = min;
4829 min = 0;
4830 }
4831 return min + Math.floor(Math.random() * (max - min + 1));
4832}
4833
4834
4835/***/ }),
4836/* 141 */
4837/***/ (function(module, __webpack_exports__, __webpack_require__) {
4838
4839"use strict";
4840/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
4841/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
4842
4843
4844// Internal helper to generate functions for escaping and unescaping strings
4845// to/from HTML interpolation.
4846function createEscaper(map) {
4847 var escaper = function(match) {
4848 return map[match];
4849 };
4850 // Regexes for identifying a key that needs to be escaped.
4851 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
4852 var testRegexp = RegExp(source);
4853 var replaceRegexp = RegExp(source, 'g');
4854 return function(string) {
4855 string = string == null ? '' : '' + string;
4856 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
4857 };
4858}
4859
4860
4861/***/ }),
4862/* 142 */
4863/***/ (function(module, __webpack_exports__, __webpack_require__) {
4864
4865"use strict";
4866// Internal list of HTML entities for escaping.
4867/* harmony default export */ __webpack_exports__["a"] = ({
4868 '&': '&amp;',
4869 '<': '&lt;',
4870 '>': '&gt;',
4871 '"': '&quot;',
4872 "'": '&#x27;',
4873 '`': '&#x60;'
4874});
4875
4876
4877/***/ }),
4878/* 143 */
4879/***/ (function(module, __webpack_exports__, __webpack_require__) {
4880
4881"use strict";
4882/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
4883
4884
4885// By default, Underscore uses ERB-style template delimiters. Change the
4886// following template settings to use alternative delimiters.
4887/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
4888 evaluate: /<%([\s\S]+?)%>/g,
4889 interpolate: /<%=([\s\S]+?)%>/g,
4890 escape: /<%-([\s\S]+?)%>/g
4891});
4892
4893
4894/***/ }),
4895/* 144 */
4896/***/ (function(module, __webpack_exports__, __webpack_require__) {
4897
4898"use strict";
4899/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
4900/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(133);
4901/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(28);
4902
4903
4904
4905// Internal function to execute `sourceFunc` bound to `context` with optional
4906// `args`. Determines whether to execute a function as a constructor or as a
4907// normal function.
4908function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
4909 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
4910 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
4911 var result = sourceFunc.apply(self, args);
4912 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
4913 return self;
4914}
4915
4916
4917/***/ }),
4918/* 145 */
4919/***/ (function(module, __webpack_exports__, __webpack_require__) {
4920
4921"use strict";
4922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
4923/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(15);
4924/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(144);
4925
4926
4927
4928
4929// Create a function bound to a given object (assigning `this`, and arguments,
4930// optionally).
4931/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
4932 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
4933 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
4934 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
4935 });
4936 return bound;
4937}));
4938
4939
4940/***/ }),
4941/* 146 */
4942/***/ (function(module, __webpack_exports__, __webpack_require__) {
4943
4944"use strict";
4945/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
4946
4947
4948// Delays a function for the given number of milliseconds, and then calls
4949// it with the arguments supplied.
4950/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
4951 return setTimeout(function() {
4952 return func.apply(null, args);
4953 }, wait);
4954}));
4955
4956
4957/***/ }),
4958/* 147 */
4959/***/ (function(module, __webpack_exports__, __webpack_require__) {
4960
4961"use strict";
4962/* harmony export (immutable) */ __webpack_exports__["a"] = before;
4963// Returns a function that will only be executed up to (but not including) the
4964// Nth call.
4965function before(times, func) {
4966 var memo;
4967 return function() {
4968 if (--times > 0) {
4969 memo = func.apply(this, arguments);
4970 }
4971 if (times <= 1) func = null;
4972 return memo;
4973 };
4974}
4975
4976
4977/***/ }),
4978/* 148 */
4979/***/ (function(module, __webpack_exports__, __webpack_require__) {
4980
4981"use strict";
4982/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
4983/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
4984/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
4985
4986
4987
4988// Returns the first key on an object that passes a truth test.
4989function findKey(obj, predicate, context) {
4990 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
4991 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
4992 for (var i = 0, length = _keys.length; i < length; i++) {
4993 key = _keys[i];
4994 if (predicate(obj[key], key, obj)) return key;
4995 }
4996}
4997
4998
4999/***/ }),
5000/* 149 */
5001/***/ (function(module, __webpack_exports__, __webpack_require__) {
5002
5003"use strict";
5004/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
5005/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
5006/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(16);
5007
5008
5009
5010// Internal function to generate `_.findIndex` and `_.findLastIndex`.
5011function createPredicateIndexFinder(dir) {
5012 return function(array, predicate, context) {
5013 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
5014 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
5015 var index = dir > 0 ? 0 : length - 1;
5016 for (; index >= 0 && index < length; index += dir) {
5017 if (predicate(array[index], index, array)) return index;
5018 }
5019 return -1;
5020 };
5021}
5022
5023
5024/***/ }),
5025/* 150 */
5026/***/ (function(module, __webpack_exports__, __webpack_require__) {
5027
5028"use strict";
5029/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(149);
5030
5031
5032// Returns the last index on an array-like that passes a truth test.
5033/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
5034
5035
5036/***/ }),
5037/* 151 */
5038/***/ (function(module, __webpack_exports__, __webpack_require__) {
5039
5040"use strict";
5041/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
5042/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
5043/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(16);
5044
5045
5046
5047// Use a comparator function to figure out the smallest index at which
5048// an object should be inserted so as to maintain order. Uses binary search.
5049function sortedIndex(array, obj, iteratee, context) {
5050 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
5051 var value = iteratee(obj);
5052 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
5053 while (low < high) {
5054 var mid = Math.floor((low + high) / 2);
5055 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
5056 }
5057 return low;
5058}
5059
5060
5061/***/ }),
5062/* 152 */
5063/***/ (function(module, __webpack_exports__, __webpack_require__) {
5064
5065"use strict";
5066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(151);
5067/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(95);
5068/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(153);
5069
5070
5071
5072
5073// Return the position of the first occurrence of an item in an array,
5074// or -1 if the item is not included in the array.
5075// If the array is large and already in sort order, pass `true`
5076// for **isSorted** to use binary search.
5077/* 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 */]));
5078
5079
5080/***/ }),
5081/* 153 */
5082/***/ (function(module, __webpack_exports__, __webpack_require__) {
5083
5084"use strict";
5085/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
5086/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(16);
5087/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
5088/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(122);
5089
5090
5091
5092
5093// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
5094function createIndexFinder(dir, predicateFind, sortedIndex) {
5095 return function(array, item, idx) {
5096 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
5097 if (typeof idx == 'number') {
5098 if (dir > 0) {
5099 i = idx >= 0 ? idx : Math.max(idx + length, i);
5100 } else {
5101 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
5102 }
5103 } else if (sortedIndex && idx && length) {
5104 idx = sortedIndex(array, item);
5105 return array[idx] === item ? idx : -1;
5106 }
5107 if (item !== item) {
5108 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
5109 return idx >= 0 ? idx + i : -1;
5110 }
5111 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
5112 if (array[idx] === item) return idx;
5113 }
5114 return -1;
5115 };
5116}
5117
5118
5119/***/ }),
5120/* 154 */
5121/***/ (function(module, __webpack_exports__, __webpack_require__) {
5122
5123"use strict";
5124/* harmony export (immutable) */ __webpack_exports__["a"] = find;
5125/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(13);
5126/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(95);
5127/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(148);
5128
5129
5130
5131
5132// Return the first value which passes a truth test.
5133function find(obj, predicate, context) {
5134 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 */];
5135 var key = keyFinder(obj, predicate, context);
5136 if (key !== void 0 && key !== -1) return obj[key];
5137}
5138
5139
5140/***/ }),
5141/* 155 */
5142/***/ (function(module, __webpack_exports__, __webpack_require__) {
5143
5144"use strict";
5145/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
5146/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(13);
5147/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
5148/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(51);
5149
5150
5151
5152
5153// Internal helper to create a reducing function, iterating left or right.
5154function createReduce(dir) {
5155 // Wrap code that reassigns argument variables in a separate function than
5156 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
5157 var reducer = function(obj, iteratee, memo, initial) {
5158 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
5159 length = (_keys || obj).length,
5160 index = dir > 0 ? 0 : length - 1;
5161 if (!initial) {
5162 memo = obj[_keys ? _keys[index] : index];
5163 index += dir;
5164 }
5165 for (; index >= 0 && index < length; index += dir) {
5166 var currentKey = _keys ? _keys[index] : index;
5167 memo = iteratee(memo, obj[currentKey], currentKey, obj);
5168 }
5169 return memo;
5170 };
5171
5172 return function(obj, iteratee, memo, context) {
5173 var initial = arguments.length >= 3;
5174 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
5175 };
5176}
5177
5178
5179/***/ }),
5180/* 156 */
5181/***/ (function(module, __webpack_exports__, __webpack_require__) {
5182
5183"use strict";
5184/* harmony export (immutable) */ __webpack_exports__["a"] = max;
5185/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(13);
5186/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(36);
5187/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(9);
5188/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(30);
5189
5190
5191
5192
5193
5194// Return the maximum element (or element-based computation).
5195function max(obj, iteratee, context) {
5196 var result = -Infinity, lastComputed = -Infinity,
5197 value, computed;
5198 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
5199 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
5200 for (var i = 0, length = obj.length; i < length; i++) {
5201 value = obj[i];
5202 if (value != null && value > result) {
5203 result = value;
5204 }
5205 }
5206 } else {
5207 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
5208 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
5209 computed = iteratee(v, index, list);
5210 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
5211 result = v;
5212 lastComputed = computed;
5213 }
5214 });
5215 }
5216 return result;
5217}
5218
5219
5220/***/ }),
5221/* 157 */
5222/***/ (function(module, __webpack_exports__, __webpack_require__) {
5223
5224"use strict";
5225/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
5226/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(13);
5227/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(134);
5228/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(36);
5229/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(16);
5230/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(140);
5231
5232
5233
5234
5235
5236
5237// Sample **n** random values from a collection using the modern version of the
5238// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
5239// If **n** is not specified, returns a single random element.
5240// The internal `guard` argument allows it to work with `_.map`.
5241function sample(obj, n, guard) {
5242 if (n == null || guard) {
5243 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
5244 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
5245 }
5246 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);
5247 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
5248 n = Math.max(Math.min(n, length), 0);
5249 var last = length - 1;
5250 for (var index = 0; index < n; index++) {
5251 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
5252 var temp = sample[index];
5253 sample[index] = sample[rand];
5254 sample[rand] = temp;
5255 }
5256 return sample.slice(0, n);
5257}
5258
5259
5260/***/ }),
5261/* 158 */
5262/***/ (function(module, __webpack_exports__, __webpack_require__) {
5263
5264"use strict";
5265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
5266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(15);
5267/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(51);
5268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(49);
5269/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(261);
5270/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(37);
5271
5272
5273
5274
5275
5276
5277
5278// Return a copy of the object only containing the allowed properties.
5279/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
5280 var result = {}, iteratee = keys[0];
5281 if (obj == null) return result;
5282 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
5283 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
5284 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
5285 } else {
5286 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
5287 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
5288 obj = Object(obj);
5289 }
5290 for (var i = 0, length = keys.length; i < length; i++) {
5291 var key = keys[i];
5292 var value = obj[key];
5293 if (iteratee(value, key, obj)) result[key] = value;
5294 }
5295 return result;
5296}));
5297
5298
5299/***/ }),
5300/* 159 */
5301/***/ (function(module, __webpack_exports__, __webpack_require__) {
5302
5303"use strict";
5304/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
5305/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
5306
5307
5308// Returns everything but the last entry of the array. Especially useful on
5309// the arguments object. Passing **n** will return all the values in
5310// the array, excluding the last N.
5311function initial(array, n, guard) {
5312 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
5313}
5314
5315
5316/***/ }),
5317/* 160 */
5318/***/ (function(module, __webpack_exports__, __webpack_require__) {
5319
5320"use strict";
5321/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
5322/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
5323
5324
5325// Returns everything but the first entry of the `array`. Especially useful on
5326// the `arguments` object. Passing an **n** will return the rest N values in the
5327// `array`.
5328function rest(array, n, guard) {
5329 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
5330}
5331
5332
5333/***/ }),
5334/* 161 */
5335/***/ (function(module, __webpack_exports__, __webpack_require__) {
5336
5337"use strict";
5338/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
5339/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(37);
5340/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(52);
5341/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(53);
5342
5343
5344
5345
5346
5347// Take the difference between one array and a number of other arrays.
5348// Only the elements present in just the first array will remain.
5349/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
5350 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
5351 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
5352 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
5353 });
5354}));
5355
5356
5357/***/ }),
5358/* 162 */
5359/***/ (function(module, __webpack_exports__, __webpack_require__) {
5360
5361"use strict";
5362/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
5363/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(118);
5364/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(9);
5365/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(16);
5366/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(53);
5367
5368
5369
5370
5371
5372// Produce a duplicate-free version of the array. If the array has already
5373// been sorted, you have the option of using a faster algorithm.
5374// The faster algorithm will not work with an iteratee if the iteratee
5375// is not a one-to-one function, so providing an iteratee will disable
5376// the faster algorithm.
5377function uniq(array, isSorted, iteratee, context) {
5378 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
5379 context = iteratee;
5380 iteratee = isSorted;
5381 isSorted = false;
5382 }
5383 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
5384 var result = [];
5385 var seen = [];
5386 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
5387 var value = array[i],
5388 computed = iteratee ? iteratee(value, i, array) : value;
5389 if (isSorted && !iteratee) {
5390 if (!i || seen !== computed) result.push(value);
5391 seen = computed;
5392 } else if (iteratee) {
5393 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
5394 seen.push(computed);
5395 result.push(value);
5396 }
5397 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
5398 result.push(value);
5399 }
5400 }
5401 return result;
5402}
5403
5404
5405/***/ }),
5406/* 163 */
5407/***/ (function(module, __webpack_exports__, __webpack_require__) {
5408
5409"use strict";
5410/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
5411/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(156);
5412/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(16);
5413/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(96);
5414
5415
5416
5417
5418// Complement of zip. Unzip accepts an array of arrays and groups
5419// each array's elements on shared indices.
5420function unzip(array) {
5421 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
5422 var result = Array(length);
5423
5424 for (var index = 0; index < length; index++) {
5425 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
5426 }
5427 return result;
5428}
5429
5430
5431/***/ }),
5432/* 164 */
5433/***/ (function(module, __webpack_exports__, __webpack_require__) {
5434
5435"use strict";
5436/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
5437/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
5438
5439
5440// Helper function to continue chaining intermediate results.
5441function chainResult(instance, obj) {
5442 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
5443}
5444
5445
5446/***/ }),
5447/* 165 */
5448/***/ (function(module, exports, __webpack_require__) {
5449
5450var rng = __webpack_require__(279);
5451var bytesToUuid = __webpack_require__(280);
5452
5453function v4(options, buf, offset) {
5454 var i = buf && offset || 0;
5455
5456 if (typeof(options) == 'string') {
5457 buf = options === 'binary' ? new Array(16) : null;
5458 options = null;
5459 }
5460 options = options || {};
5461
5462 var rnds = options.random || (options.rng || rng)();
5463
5464 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
5465 rnds[6] = (rnds[6] & 0x0f) | 0x40;
5466 rnds[8] = (rnds[8] & 0x3f) | 0x80;
5467
5468 // Copy bytes to buffer, if provided
5469 if (buf) {
5470 for (var ii = 0; ii < 16; ++ii) {
5471 buf[i + ii] = rnds[ii];
5472 }
5473 }
5474
5475 return buf || bytesToUuid(rnds);
5476}
5477
5478module.exports = v4;
5479
5480
5481/***/ }),
5482/* 166 */
5483/***/ (function(module, exports, __webpack_require__) {
5484
5485"use strict";
5486
5487
5488module.exports = '4.12.2';
5489
5490/***/ }),
5491/* 167 */
5492/***/ (function(module, exports, __webpack_require__) {
5493
5494"use strict";
5495
5496
5497var has = Object.prototype.hasOwnProperty
5498 , prefix = '~';
5499
5500/**
5501 * Constructor to create a storage for our `EE` objects.
5502 * An `Events` instance is a plain object whose properties are event names.
5503 *
5504 * @constructor
5505 * @api private
5506 */
5507function Events() {}
5508
5509//
5510// We try to not inherit from `Object.prototype`. In some engines creating an
5511// instance in this way is faster than calling `Object.create(null)` directly.
5512// If `Object.create(null)` is not supported we prefix the event names with a
5513// character to make sure that the built-in object properties are not
5514// overridden or used as an attack vector.
5515//
5516if (Object.create) {
5517 Events.prototype = Object.create(null);
5518
5519 //
5520 // This hack is needed because the `__proto__` property is still inherited in
5521 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
5522 //
5523 if (!new Events().__proto__) prefix = false;
5524}
5525
5526/**
5527 * Representation of a single event listener.
5528 *
5529 * @param {Function} fn The listener function.
5530 * @param {Mixed} context The context to invoke the listener with.
5531 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
5532 * @constructor
5533 * @api private
5534 */
5535function EE(fn, context, once) {
5536 this.fn = fn;
5537 this.context = context;
5538 this.once = once || false;
5539}
5540
5541/**
5542 * Minimal `EventEmitter` interface that is molded against the Node.js
5543 * `EventEmitter` interface.
5544 *
5545 * @constructor
5546 * @api public
5547 */
5548function EventEmitter() {
5549 this._events = new Events();
5550 this._eventsCount = 0;
5551}
5552
5553/**
5554 * Return an array listing the events for which the emitter has registered
5555 * listeners.
5556 *
5557 * @returns {Array}
5558 * @api public
5559 */
5560EventEmitter.prototype.eventNames = function eventNames() {
5561 var names = []
5562 , events
5563 , name;
5564
5565 if (this._eventsCount === 0) return names;
5566
5567 for (name in (events = this._events)) {
5568 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
5569 }
5570
5571 if (Object.getOwnPropertySymbols) {
5572 return names.concat(Object.getOwnPropertySymbols(events));
5573 }
5574
5575 return names;
5576};
5577
5578/**
5579 * Return the listeners registered for a given event.
5580 *
5581 * @param {String|Symbol} event The event name.
5582 * @param {Boolean} exists Only check if there are listeners.
5583 * @returns {Array|Boolean}
5584 * @api public
5585 */
5586EventEmitter.prototype.listeners = function listeners(event, exists) {
5587 var evt = prefix ? prefix + event : event
5588 , available = this._events[evt];
5589
5590 if (exists) return !!available;
5591 if (!available) return [];
5592 if (available.fn) return [available.fn];
5593
5594 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
5595 ee[i] = available[i].fn;
5596 }
5597
5598 return ee;
5599};
5600
5601/**
5602 * Calls each of the listeners registered for a given event.
5603 *
5604 * @param {String|Symbol} event The event name.
5605 * @returns {Boolean} `true` if the event had listeners, else `false`.
5606 * @api public
5607 */
5608EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
5609 var evt = prefix ? prefix + event : event;
5610
5611 if (!this._events[evt]) return false;
5612
5613 var listeners = this._events[evt]
5614 , len = arguments.length
5615 , args
5616 , i;
5617
5618 if (listeners.fn) {
5619 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
5620
5621 switch (len) {
5622 case 1: return listeners.fn.call(listeners.context), true;
5623 case 2: return listeners.fn.call(listeners.context, a1), true;
5624 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
5625 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
5626 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
5627 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
5628 }
5629
5630 for (i = 1, args = new Array(len -1); i < len; i++) {
5631 args[i - 1] = arguments[i];
5632 }
5633
5634 listeners.fn.apply(listeners.context, args);
5635 } else {
5636 var length = listeners.length
5637 , j;
5638
5639 for (i = 0; i < length; i++) {
5640 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
5641
5642 switch (len) {
5643 case 1: listeners[i].fn.call(listeners[i].context); break;
5644 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
5645 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
5646 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
5647 default:
5648 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
5649 args[j - 1] = arguments[j];
5650 }
5651
5652 listeners[i].fn.apply(listeners[i].context, args);
5653 }
5654 }
5655 }
5656
5657 return true;
5658};
5659
5660/**
5661 * Add a listener for a given event.
5662 *
5663 * @param {String|Symbol} event The event name.
5664 * @param {Function} fn The listener function.
5665 * @param {Mixed} [context=this] The context to invoke the listener with.
5666 * @returns {EventEmitter} `this`.
5667 * @api public
5668 */
5669EventEmitter.prototype.on = function on(event, fn, context) {
5670 var listener = new EE(fn, context || this)
5671 , evt = prefix ? prefix + event : event;
5672
5673 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
5674 else if (!this._events[evt].fn) this._events[evt].push(listener);
5675 else this._events[evt] = [this._events[evt], listener];
5676
5677 return this;
5678};
5679
5680/**
5681 * Add a one-time listener for a given event.
5682 *
5683 * @param {String|Symbol} event The event name.
5684 * @param {Function} fn The listener function.
5685 * @param {Mixed} [context=this] The context to invoke the listener with.
5686 * @returns {EventEmitter} `this`.
5687 * @api public
5688 */
5689EventEmitter.prototype.once = function once(event, fn, context) {
5690 var listener = new EE(fn, context || this, true)
5691 , evt = prefix ? prefix + event : event;
5692
5693 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
5694 else if (!this._events[evt].fn) this._events[evt].push(listener);
5695 else this._events[evt] = [this._events[evt], listener];
5696
5697 return this;
5698};
5699
5700/**
5701 * Remove the listeners of a given event.
5702 *
5703 * @param {String|Symbol} event The event name.
5704 * @param {Function} fn Only remove the listeners that match this function.
5705 * @param {Mixed} context Only remove the listeners that have this context.
5706 * @param {Boolean} once Only remove one-time listeners.
5707 * @returns {EventEmitter} `this`.
5708 * @api public
5709 */
5710EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
5711 var evt = prefix ? prefix + event : event;
5712
5713 if (!this._events[evt]) return this;
5714 if (!fn) {
5715 if (--this._eventsCount === 0) this._events = new Events();
5716 else delete this._events[evt];
5717 return this;
5718 }
5719
5720 var listeners = this._events[evt];
5721
5722 if (listeners.fn) {
5723 if (
5724 listeners.fn === fn
5725 && (!once || listeners.once)
5726 && (!context || listeners.context === context)
5727 ) {
5728 if (--this._eventsCount === 0) this._events = new Events();
5729 else delete this._events[evt];
5730 }
5731 } else {
5732 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
5733 if (
5734 listeners[i].fn !== fn
5735 || (once && !listeners[i].once)
5736 || (context && listeners[i].context !== context)
5737 ) {
5738 events.push(listeners[i]);
5739 }
5740 }
5741
5742 //
5743 // Reset the array, or remove it completely if we have no more listeners.
5744 //
5745 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
5746 else if (--this._eventsCount === 0) this._events = new Events();
5747 else delete this._events[evt];
5748 }
5749
5750 return this;
5751};
5752
5753/**
5754 * Remove all listeners, or those of the specified event.
5755 *
5756 * @param {String|Symbol} [event] The event name.
5757 * @returns {EventEmitter} `this`.
5758 * @api public
5759 */
5760EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
5761 var evt;
5762
5763 if (event) {
5764 evt = prefix ? prefix + event : event;
5765 if (this._events[evt]) {
5766 if (--this._eventsCount === 0) this._events = new Events();
5767 else delete this._events[evt];
5768 }
5769 } else {
5770 this._events = new Events();
5771 this._eventsCount = 0;
5772 }
5773
5774 return this;
5775};
5776
5777//
5778// Alias methods names because people roll like that.
5779//
5780EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
5781EventEmitter.prototype.addListener = EventEmitter.prototype.on;
5782
5783//
5784// This function doesn't apply anymore.
5785//
5786EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
5787 return this;
5788};
5789
5790//
5791// Expose the prefix.
5792//
5793EventEmitter.prefixed = prefix;
5794
5795//
5796// Allow `EventEmitter` to be imported as module namespace.
5797//
5798EventEmitter.EventEmitter = EventEmitter;
5799
5800//
5801// Expose the module.
5802//
5803if (true) {
5804 module.exports = EventEmitter;
5805}
5806
5807
5808/***/ }),
5809/* 168 */
5810/***/ (function(module, exports, __webpack_require__) {
5811
5812"use strict";
5813
5814
5815var _promise = __webpack_require__(3);
5816
5817var _promise2 = _interopRequireDefault(_promise);
5818
5819function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5820
5821var _require = __webpack_require__(41),
5822 getAdapter = _require.getAdapter;
5823
5824var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
5825
5826var localStorage = {
5827 get async() {
5828 return getAdapter('storage').async;
5829 }
5830};
5831
5832// wrap sync apis with async ones.
5833syncApiNames.forEach(function (apiName) {
5834 localStorage[apiName + 'Async'] = function () {
5835 var storage = getAdapter('storage');
5836 return _promise2.default.resolve(storage[apiName].apply(storage, arguments));
5837 };
5838
5839 localStorage[apiName] = function () {
5840 var storage = getAdapter('storage');
5841 if (!storage.async) {
5842 return storage[apiName].apply(storage, arguments);
5843 }
5844 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
5845 error.code = 'SYNC_API_NOT_AVAILABLE';
5846 throw error;
5847 };
5848});
5849
5850module.exports = localStorage;
5851
5852/***/ }),
5853/* 169 */
5854/***/ (function(module, exports, __webpack_require__) {
5855
5856"use strict";
5857
5858
5859var _stringify = __webpack_require__(21);
5860
5861var _stringify2 = _interopRequireDefault(_stringify);
5862
5863function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5864
5865var storage = __webpack_require__(168);
5866var AV = __webpack_require__(39);
5867
5868var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
5869
5870var getCacheData = function getCacheData(cacheData, key) {
5871 try {
5872 cacheData = JSON.parse(cacheData);
5873 } catch (e) {
5874 return null;
5875 }
5876 if (cacheData) {
5877 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
5878 if (!expired) {
5879 return cacheData.value;
5880 }
5881 return removeAsync(key).then(function () {
5882 return null;
5883 });
5884 }
5885 return null;
5886};
5887
5888exports.getAsync = function (key) {
5889 key = 'AV/' + AV.applicationId + '/' + key;
5890 return storage.getItemAsync(key).then(function (cache) {
5891 return getCacheData(cache, key);
5892 });
5893};
5894
5895exports.setAsync = function (key, value, ttl) {
5896 var cache = { value: value };
5897 if (typeof ttl === 'number') {
5898 cache.expiredAt = Date.now() + ttl;
5899 }
5900 return storage.setItemAsync('AV/' + AV.applicationId + '/' + key, (0, _stringify2.default)(cache));
5901};
5902
5903/***/ }),
5904/* 170 */
5905/***/ (function(module, exports, __webpack_require__) {
5906
5907module.exports = { "default": __webpack_require__(289), __esModule: true };
5908
5909/***/ }),
5910/* 171 */
5911/***/ (function(module, exports, __webpack_require__) {
5912
5913module.exports = { "default": __webpack_require__(290), __esModule: true };
5914
5915/***/ }),
5916/* 172 */
5917/***/ (function(module, exports, __webpack_require__) {
5918
5919"use strict";
5920
5921// ECMAScript 6 symbols shim
5922var global = __webpack_require__(5);
5923var has = __webpack_require__(24);
5924var DESCRIPTORS = __webpack_require__(19);
5925var $export = __webpack_require__(8);
5926var redefine = __webpack_require__(75);
5927var META = __webpack_require__(55).KEY;
5928var $fails = __webpack_require__(26);
5929var shared = __webpack_require__(79);
5930var setToStringTag = __webpack_require__(47);
5931var uid = __webpack_require__(60);
5932var wks = __webpack_require__(7);
5933var wksExt = __webpack_require__(100);
5934var wksDefine = __webpack_require__(101);
5935var enumKeys = __webpack_require__(291);
5936var isArray = __webpack_require__(173);
5937var anObject = __webpack_require__(18);
5938var isObject = __webpack_require__(10);
5939var toObject = __webpack_require__(33);
5940var toIObject = __webpack_require__(27);
5941var toPrimitive = __webpack_require__(74);
5942var createDesc = __webpack_require__(58);
5943var _create = __webpack_require__(59);
5944var gOPNExt = __webpack_require__(292);
5945var $GOPD = __webpack_require__(103);
5946var $GOPS = __webpack_require__(102);
5947var $DP = __webpack_require__(20);
5948var $keys = __webpack_require__(45);
5949var gOPD = $GOPD.f;
5950var dP = $DP.f;
5951var gOPN = gOPNExt.f;
5952var $Symbol = global.Symbol;
5953var $JSON = global.JSON;
5954var _stringify = $JSON && $JSON.stringify;
5955var PROTOTYPE = 'prototype';
5956var HIDDEN = wks('_hidden');
5957var TO_PRIMITIVE = wks('toPrimitive');
5958var isEnum = {}.propertyIsEnumerable;
5959var SymbolRegistry = shared('symbol-registry');
5960var AllSymbols = shared('symbols');
5961var OPSymbols = shared('op-symbols');
5962var ObjectProto = Object[PROTOTYPE];
5963var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f;
5964var QObject = global.QObject;
5965// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
5966var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
5967
5968// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
5969var setSymbolDesc = DESCRIPTORS && $fails(function () {
5970 return _create(dP({}, 'a', {
5971 get: function () { return dP(this, 'a', { value: 7 }).a; }
5972 })).a != 7;
5973}) ? function (it, key, D) {
5974 var protoDesc = gOPD(ObjectProto, key);
5975 if (protoDesc) delete ObjectProto[key];
5976 dP(it, key, D);
5977 if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
5978} : dP;
5979
5980var wrap = function (tag) {
5981 var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
5982 sym._k = tag;
5983 return sym;
5984};
5985
5986var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
5987 return typeof it == 'symbol';
5988} : function (it) {
5989 return it instanceof $Symbol;
5990};
5991
5992var $defineProperty = function defineProperty(it, key, D) {
5993 if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
5994 anObject(it);
5995 key = toPrimitive(key, true);
5996 anObject(D);
5997 if (has(AllSymbols, key)) {
5998 if (!D.enumerable) {
5999 if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
6000 it[HIDDEN][key] = true;
6001 } else {
6002 if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
6003 D = _create(D, { enumerable: createDesc(0, false) });
6004 } return setSymbolDesc(it, key, D);
6005 } return dP(it, key, D);
6006};
6007var $defineProperties = function defineProperties(it, P) {
6008 anObject(it);
6009 var keys = enumKeys(P = toIObject(P));
6010 var i = 0;
6011 var l = keys.length;
6012 var key;
6013 while (l > i) $defineProperty(it, key = keys[i++], P[key]);
6014 return it;
6015};
6016var $create = function create(it, P) {
6017 return P === undefined ? _create(it) : $defineProperties(_create(it), P);
6018};
6019var $propertyIsEnumerable = function propertyIsEnumerable(key) {
6020 var E = isEnum.call(this, key = toPrimitive(key, true));
6021 if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
6022 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
6023};
6024var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
6025 it = toIObject(it);
6026 key = toPrimitive(key, true);
6027 if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
6028 var D = gOPD(it, key);
6029 if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
6030 return D;
6031};
6032var $getOwnPropertyNames = function getOwnPropertyNames(it) {
6033 var names = gOPN(toIObject(it));
6034 var result = [];
6035 var i = 0;
6036 var key;
6037 while (names.length > i) {
6038 if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
6039 } return result;
6040};
6041var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
6042 var IS_OP = it === ObjectProto;
6043 var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
6044 var result = [];
6045 var i = 0;
6046 var key;
6047 while (names.length > i) {
6048 if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
6049 } return result;
6050};
6051
6052// 19.4.1.1 Symbol([description])
6053if (!USE_NATIVE) {
6054 $Symbol = function Symbol() {
6055 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
6056 var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
6057 var $set = function (value) {
6058 if (this === ObjectProto) $set.call(OPSymbols, value);
6059 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
6060 setSymbolDesc(this, tag, createDesc(1, value));
6061 };
6062 if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
6063 return wrap(tag);
6064 };
6065 redefine($Symbol[PROTOTYPE], 'toString', function toString() {
6066 return this._k;
6067 });
6068
6069 $GOPD.f = $getOwnPropertyDescriptor;
6070 $DP.f = $defineProperty;
6071 __webpack_require__(174).f = gOPNExt.f = $getOwnPropertyNames;
6072 __webpack_require__(69).f = $propertyIsEnumerable;
6073 $GOPS.f = $getOwnPropertySymbols;
6074
6075 if (DESCRIPTORS && !__webpack_require__(43)) {
6076 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
6077 }
6078
6079 wksExt.f = function (name) {
6080 return wrap(wks(name));
6081 };
6082}
6083
6084$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
6085
6086for (var es6Symbols = (
6087 // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
6088 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
6089).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
6090
6091for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
6092
6093$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
6094 // 19.4.2.1 Symbol.for(key)
6095 'for': function (key) {
6096 return has(SymbolRegistry, key += '')
6097 ? SymbolRegistry[key]
6098 : SymbolRegistry[key] = $Symbol(key);
6099 },
6100 // 19.4.2.5 Symbol.keyFor(sym)
6101 keyFor: function keyFor(sym) {
6102 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
6103 for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
6104 },
6105 useSetter: function () { setter = true; },
6106 useSimple: function () { setter = false; }
6107});
6108
6109$export($export.S + $export.F * !USE_NATIVE, 'Object', {
6110 // 19.1.2.2 Object.create(O [, Properties])
6111 create: $create,
6112 // 19.1.2.4 Object.defineProperty(O, P, Attributes)
6113 defineProperty: $defineProperty,
6114 // 19.1.2.3 Object.defineProperties(O, Properties)
6115 defineProperties: $defineProperties,
6116 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
6117 getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
6118 // 19.1.2.7 Object.getOwnPropertyNames(O)
6119 getOwnPropertyNames: $getOwnPropertyNames,
6120 // 19.1.2.8 Object.getOwnPropertySymbols(O)
6121 getOwnPropertySymbols: $getOwnPropertySymbols
6122});
6123
6124// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
6125// https://bugs.chromium.org/p/v8/issues/detail?id=3443
6126var FAILS_ON_PRIMITIVES = $fails(function () { $GOPS.f(1); });
6127
6128$export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', {
6129 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
6130 return $GOPS.f(toObject(it));
6131 }
6132});
6133
6134// 24.3.2 JSON.stringify(value [, replacer [, space]])
6135$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
6136 var S = $Symbol();
6137 // MS Edge converts symbol values to JSON as {}
6138 // WebKit converts symbol values to JSON as null
6139 // V8 throws on boxed symbols
6140 return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
6141})), 'JSON', {
6142 stringify: function stringify(it) {
6143 var args = [it];
6144 var i = 1;
6145 var replacer, $replacer;
6146 while (arguments.length > i) args.push(arguments[i++]);
6147 $replacer = replacer = args[1];
6148 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
6149 if (!isArray(replacer)) replacer = function (key, value) {
6150 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
6151 if (!isSymbol(value)) return value;
6152 };
6153 args[1] = replacer;
6154 return _stringify.apply($JSON, args);
6155 }
6156});
6157
6158// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
6159$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(23)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
6160// 19.4.3.5 Symbol.prototype[@@toStringTag]
6161setToStringTag($Symbol, 'Symbol');
6162// 20.2.1.9 Math[@@toStringTag]
6163setToStringTag(Math, 'Math', true);
6164// 24.3.3 JSON[@@toStringTag]
6165setToStringTag(global.JSON, 'JSON', true);
6166
6167
6168/***/ }),
6169/* 173 */
6170/***/ (function(module, exports, __webpack_require__) {
6171
6172// 7.2.2 IsArray(argument)
6173var cof = __webpack_require__(46);
6174module.exports = Array.isArray || function isArray(arg) {
6175 return cof(arg) == 'Array';
6176};
6177
6178
6179/***/ }),
6180/* 174 */
6181/***/ (function(module, exports, __webpack_require__) {
6182
6183// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
6184var $keys = __webpack_require__(106);
6185var hiddenKeys = __webpack_require__(80).concat('length', 'prototype');
6186
6187exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
6188 return $keys(O, hiddenKeys);
6189};
6190
6191
6192/***/ }),
6193/* 175 */
6194/***/ (function(module, exports, __webpack_require__) {
6195
6196module.exports = { "default": __webpack_require__(306), __esModule: true };
6197
6198/***/ }),
6199/* 176 */
6200/***/ (function(module, exports, __webpack_require__) {
6201
6202module.exports = { "default": __webpack_require__(309), __esModule: true };
6203
6204/***/ }),
6205/* 177 */
6206/***/ (function(module, exports, __webpack_require__) {
6207
6208module.exports = { "default": __webpack_require__(313), __esModule: true };
6209
6210/***/ }),
6211/* 178 */
6212/***/ (function(module, exports) {
6213
6214var charenc = {
6215 // UTF-8 encoding
6216 utf8: {
6217 // Convert a string to a byte array
6218 stringToBytes: function(str) {
6219 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
6220 },
6221
6222 // Convert a byte array to a string
6223 bytesToString: function(bytes) {
6224 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
6225 }
6226 },
6227
6228 // Binary encoding
6229 bin: {
6230 // Convert a string to a byte array
6231 stringToBytes: function(str) {
6232 for (var bytes = [], i = 0; i < str.length; i++)
6233 bytes.push(str.charCodeAt(i) & 0xFF);
6234 return bytes;
6235 },
6236
6237 // Convert a byte array to a string
6238 bytesToString: function(bytes) {
6239 for (var str = [], i = 0; i < bytes.length; i++)
6240 str.push(String.fromCharCode(bytes[i]));
6241 return str.join('');
6242 }
6243 }
6244};
6245
6246module.exports = charenc;
6247
6248
6249/***/ }),
6250/* 179 */
6251/***/ (function(module, exports, __webpack_require__) {
6252
6253module.exports = { "default": __webpack_require__(322), __esModule: true };
6254
6255/***/ }),
6256/* 180 */
6257/***/ (function(module, exports, __webpack_require__) {
6258
6259"use strict";
6260
6261var global = __webpack_require__(5);
6262var $export = __webpack_require__(8);
6263var meta = __webpack_require__(55);
6264var fails = __webpack_require__(26);
6265var hide = __webpack_require__(23);
6266var redefineAll = __webpack_require__(63);
6267var forOf = __webpack_require__(35);
6268var anInstance = __webpack_require__(62);
6269var isObject = __webpack_require__(10);
6270var setToStringTag = __webpack_require__(47);
6271var dP = __webpack_require__(20).f;
6272var each = __webpack_require__(104)(0);
6273var DESCRIPTORS = __webpack_require__(19);
6274
6275module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
6276 var Base = global[NAME];
6277 var C = Base;
6278 var ADDER = IS_MAP ? 'set' : 'add';
6279 var proto = C && C.prototype;
6280 var O = {};
6281 if (!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
6282 new C().entries().next();
6283 }))) {
6284 // create collection constructor
6285 C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
6286 redefineAll(C.prototype, methods);
6287 meta.NEED = true;
6288 } else {
6289 C = wrapper(function (target, iterable) {
6290 anInstance(target, C, NAME, '_c');
6291 target._c = new Base();
6292 if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target);
6293 });
6294 each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
6295 var IS_ADDER = KEY == 'add' || KEY == 'set';
6296 if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function (a, b) {
6297 anInstance(this, C, KEY);
6298 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
6299 var result = this._c[KEY](a === 0 ? 0 : a, b);
6300 return IS_ADDER ? this : result;
6301 });
6302 });
6303 IS_WEAK || dP(C.prototype, 'size', {
6304 get: function () {
6305 return this._c.size;
6306 }
6307 });
6308 }
6309
6310 setToStringTag(C, NAME);
6311
6312 O[NAME] = C;
6313 $export($export.G + $export.W + $export.F, O);
6314
6315 if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
6316
6317 return C;
6318};
6319
6320
6321/***/ }),
6322/* 181 */
6323/***/ (function(module, exports, __webpack_require__) {
6324
6325"use strict";
6326
6327// https://tc39.github.io/proposal-setmap-offrom/
6328var $export = __webpack_require__(8);
6329
6330module.exports = function (COLLECTION) {
6331 $export($export.S, COLLECTION, { of: function of() {
6332 var length = arguments.length;
6333 var A = new Array(length);
6334 while (length--) A[length] = arguments[length];
6335 return new this(A);
6336 } });
6337};
6338
6339
6340/***/ }),
6341/* 182 */
6342/***/ (function(module, exports, __webpack_require__) {
6343
6344"use strict";
6345
6346// https://tc39.github.io/proposal-setmap-offrom/
6347var $export = __webpack_require__(8);
6348var aFunction = __webpack_require__(44);
6349var ctx = __webpack_require__(22);
6350var forOf = __webpack_require__(35);
6351
6352module.exports = function (COLLECTION) {
6353 $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
6354 var mapFn = arguments[1];
6355 var mapping, A, n, cb;
6356 aFunction(this);
6357 mapping = mapFn !== undefined;
6358 if (mapping) aFunction(mapFn);
6359 if (source == undefined) return new this();
6360 A = [];
6361 if (mapping) {
6362 n = 0;
6363 cb = ctx(mapFn, arguments[2], 2);
6364 forOf(source, false, function (nextItem) {
6365 A.push(cb(nextItem, n++));
6366 });
6367 } else {
6368 forOf(source, false, A.push, A);
6369 }
6370 return new this(A);
6371 } });
6372};
6373
6374
6375/***/ }),
6376/* 183 */
6377/***/ (function(module, exports, __webpack_require__) {
6378
6379"use strict";
6380
6381// 19.1.2.1 Object.assign(target, source, ...)
6382var DESCRIPTORS = __webpack_require__(19);
6383var getKeys = __webpack_require__(45);
6384var gOPS = __webpack_require__(102);
6385var pIE = __webpack_require__(69);
6386var toObject = __webpack_require__(33);
6387var IObject = __webpack_require__(76);
6388var $assign = Object.assign;
6389
6390// should work with symbols and should have deterministic property order (V8 bug)
6391module.exports = !$assign || __webpack_require__(26)(function () {
6392 var A = {};
6393 var B = {};
6394 // eslint-disable-next-line no-undef
6395 var S = Symbol();
6396 var K = 'abcdefghijklmnopqrst';
6397 A[S] = 7;
6398 K.split('').forEach(function (k) { B[k] = k; });
6399 return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
6400}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
6401 var T = toObject(target);
6402 var aLen = arguments.length;
6403 var index = 1;
6404 var getSymbols = gOPS.f;
6405 var isEnum = pIE.f;
6406 while (aLen > index) {
6407 var S = IObject(arguments[index++]);
6408 var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
6409 var length = keys.length;
6410 var j = 0;
6411 var key;
6412 while (length > j) {
6413 key = keys[j++];
6414 if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key];
6415 }
6416 } return T;
6417} : $assign;
6418
6419
6420/***/ }),
6421/* 184 */
6422/***/ (function(module, exports, __webpack_require__) {
6423
6424"use strict";
6425
6426
6427var AV = __webpack_require__(185);
6428var useAdatpers = __webpack_require__(342);
6429
6430module.exports = useAdatpers(AV);
6431
6432/***/ }),
6433/* 185 */
6434/***/ (function(module, exports, __webpack_require__) {
6435
6436"use strict";
6437
6438
6439module.exports = __webpack_require__(186);
6440
6441/***/ }),
6442/* 186 */
6443/***/ (function(module, exports, __webpack_require__) {
6444
6445"use strict";
6446
6447
6448var _promise = __webpack_require__(3);
6449
6450var _promise2 = _interopRequireDefault(_promise);
6451
6452function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6453
6454/*!
6455 * LeanCloud JavaScript SDK
6456 * https://leancloud.cn
6457 *
6458 * Copyright 2016 LeanCloud.cn, Inc.
6459 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
6460 */
6461var _ = __webpack_require__(0);
6462
6463var AV = __webpack_require__(39);
6464
6465AV._ = _;
6466AV.version = __webpack_require__(166);
6467AV.Promise = _promise2.default;
6468AV.localStorage = __webpack_require__(168);
6469AV.Cache = __webpack_require__(169);
6470AV.Error = __webpack_require__(31);
6471
6472__webpack_require__(285);
6473__webpack_require__(296)(AV);
6474__webpack_require__(297)(AV);
6475__webpack_require__(298)(AV);
6476__webpack_require__(299)(AV);
6477__webpack_require__(300)(AV);
6478__webpack_require__(301)(AV);
6479__webpack_require__(321)(AV);
6480__webpack_require__(328)(AV);
6481__webpack_require__(329)(AV);
6482__webpack_require__(331)(AV);
6483__webpack_require__(332)(AV);
6484__webpack_require__(333)(AV);
6485__webpack_require__(334)(AV);
6486__webpack_require__(335)(AV);
6487__webpack_require__(336)(AV);
6488__webpack_require__(337)(AV);
6489__webpack_require__(338)(AV);
6490__webpack_require__(339)(AV);
6491
6492AV.Conversation = __webpack_require__(340);
6493__webpack_require__(341);
6494module.exports = AV;
6495
6496/**
6497 * Options to controll the authentication for an operation
6498 * @typedef {Object} AuthOptions
6499 * @property {String} [sessionToken] Specify a user to excute the operation as.
6500 * @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.
6501 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
6502 */
6503
6504/**
6505 * Options to controll the authentication for an SMS operation
6506 * @typedef {Object} SMSAuthOptions
6507 * @property {String} [sessionToken] Specify a user to excute the operation as.
6508 * @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.
6509 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
6510 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
6511 */
6512
6513/***/ }),
6514/* 187 */
6515/***/ (function(module, exports, __webpack_require__) {
6516
6517__webpack_require__(57);
6518__webpack_require__(42);
6519__webpack_require__(34);
6520__webpack_require__(195);
6521__webpack_require__(202);
6522__webpack_require__(203);
6523module.exports = __webpack_require__(2).Promise;
6524
6525
6526/***/ }),
6527/* 188 */
6528/***/ (function(module, exports, __webpack_require__) {
6529
6530var toInteger = __webpack_require__(70);
6531var defined = __webpack_require__(71);
6532// true -> String#at
6533// false -> String#codePointAt
6534module.exports = function (TO_STRING) {
6535 return function (that, pos) {
6536 var s = String(defined(that));
6537 var i = toInteger(pos);
6538 var l = s.length;
6539 var a, b;
6540 if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
6541 a = s.charCodeAt(i);
6542 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
6543 ? TO_STRING ? s.charAt(i) : a
6544 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
6545 };
6546};
6547
6548
6549/***/ }),
6550/* 189 */
6551/***/ (function(module, exports, __webpack_require__) {
6552
6553"use strict";
6554
6555var create = __webpack_require__(59);
6556var descriptor = __webpack_require__(58);
6557var setToStringTag = __webpack_require__(47);
6558var IteratorPrototype = {};
6559
6560// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
6561__webpack_require__(23)(IteratorPrototype, __webpack_require__(7)('iterator'), function () { return this; });
6562
6563module.exports = function (Constructor, NAME, next) {
6564 Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
6565 setToStringTag(Constructor, NAME + ' Iterator');
6566};
6567
6568
6569/***/ }),
6570/* 190 */
6571/***/ (function(module, exports, __webpack_require__) {
6572
6573var dP = __webpack_require__(20);
6574var anObject = __webpack_require__(18);
6575var getKeys = __webpack_require__(45);
6576
6577module.exports = __webpack_require__(19) ? Object.defineProperties : function defineProperties(O, Properties) {
6578 anObject(O);
6579 var keys = getKeys(Properties);
6580 var length = keys.length;
6581 var i = 0;
6582 var P;
6583 while (length > i) dP.f(O, P = keys[i++], Properties[P]);
6584 return O;
6585};
6586
6587
6588/***/ }),
6589/* 191 */
6590/***/ (function(module, exports, __webpack_require__) {
6591
6592// false -> Array#indexOf
6593// true -> Array#includes
6594var toIObject = __webpack_require__(27);
6595var toLength = __webpack_require__(77);
6596var toAbsoluteIndex = __webpack_require__(192);
6597module.exports = function (IS_INCLUDES) {
6598 return function ($this, el, fromIndex) {
6599 var O = toIObject($this);
6600 var length = toLength(O.length);
6601 var index = toAbsoluteIndex(fromIndex, length);
6602 var value;
6603 // Array#includes uses SameValueZero equality algorithm
6604 // eslint-disable-next-line no-self-compare
6605 if (IS_INCLUDES && el != el) while (length > index) {
6606 value = O[index++];
6607 // eslint-disable-next-line no-self-compare
6608 if (value != value) return true;
6609 // Array#indexOf ignores holes, Array#includes - not
6610 } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
6611 if (O[index] === el) return IS_INCLUDES || index || 0;
6612 } return !IS_INCLUDES && -1;
6613 };
6614};
6615
6616
6617/***/ }),
6618/* 192 */
6619/***/ (function(module, exports, __webpack_require__) {
6620
6621var toInteger = __webpack_require__(70);
6622var max = Math.max;
6623var min = Math.min;
6624module.exports = function (index, length) {
6625 index = toInteger(index);
6626 return index < 0 ? max(index + length, 0) : min(index, length);
6627};
6628
6629
6630/***/ }),
6631/* 193 */
6632/***/ (function(module, exports, __webpack_require__) {
6633
6634"use strict";
6635
6636var addToUnscopables = __webpack_require__(194);
6637var step = __webpack_require__(109);
6638var Iterators = __webpack_require__(32);
6639var toIObject = __webpack_require__(27);
6640
6641// 22.1.3.4 Array.prototype.entries()
6642// 22.1.3.13 Array.prototype.keys()
6643// 22.1.3.29 Array.prototype.values()
6644// 22.1.3.30 Array.prototype[@@iterator]()
6645module.exports = __webpack_require__(72)(Array, 'Array', function (iterated, kind) {
6646 this._t = toIObject(iterated); // target
6647 this._i = 0; // next index
6648 this._k = kind; // kind
6649// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
6650}, function () {
6651 var O = this._t;
6652 var kind = this._k;
6653 var index = this._i++;
6654 if (!O || index >= O.length) {
6655 this._t = undefined;
6656 return step(1);
6657 }
6658 if (kind == 'keys') return step(0, index);
6659 if (kind == 'values') return step(0, O[index]);
6660 return step(0, [index, O[index]]);
6661}, 'values');
6662
6663// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
6664Iterators.Arguments = Iterators.Array;
6665
6666addToUnscopables('keys');
6667addToUnscopables('values');
6668addToUnscopables('entries');
6669
6670
6671/***/ }),
6672/* 194 */
6673/***/ (function(module, exports) {
6674
6675module.exports = function () { /* empty */ };
6676
6677
6678/***/ }),
6679/* 195 */
6680/***/ (function(module, exports, __webpack_require__) {
6681
6682"use strict";
6683
6684var LIBRARY = __webpack_require__(43);
6685var global = __webpack_require__(5);
6686var ctx = __webpack_require__(22);
6687var classof = __webpack_require__(61);
6688var $export = __webpack_require__(8);
6689var isObject = __webpack_require__(10);
6690var aFunction = __webpack_require__(44);
6691var anInstance = __webpack_require__(62);
6692var forOf = __webpack_require__(35);
6693var speciesConstructor = __webpack_require__(111);
6694var task = __webpack_require__(112).set;
6695var microtask = __webpack_require__(199)();
6696var newPromiseCapabilityModule = __webpack_require__(81);
6697var perform = __webpack_require__(113);
6698var userAgent = __webpack_require__(200);
6699var promiseResolve = __webpack_require__(114);
6700var PROMISE = 'Promise';
6701var TypeError = global.TypeError;
6702var process = global.process;
6703var versions = process && process.versions;
6704var v8 = versions && versions.v8 || '';
6705var $Promise = global[PROMISE];
6706var isNode = classof(process) == 'process';
6707var empty = function () { /* empty */ };
6708var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
6709var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
6710
6711var USE_NATIVE = !!function () {
6712 try {
6713 // correct subclassing with @@species support
6714 var promise = $Promise.resolve(1);
6715 var FakePromise = (promise.constructor = {})[__webpack_require__(7)('species')] = function (exec) {
6716 exec(empty, empty);
6717 };
6718 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
6719 return (isNode || typeof PromiseRejectionEvent == 'function')
6720 && promise.then(empty) instanceof FakePromise
6721 // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
6722 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
6723 // we can't detect it synchronously, so just check versions
6724 && v8.indexOf('6.6') !== 0
6725 && userAgent.indexOf('Chrome/66') === -1;
6726 } catch (e) { /* empty */ }
6727}();
6728
6729// helpers
6730var isThenable = function (it) {
6731 var then;
6732 return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
6733};
6734var notify = function (promise, isReject) {
6735 if (promise._n) return;
6736 promise._n = true;
6737 var chain = promise._c;
6738 microtask(function () {
6739 var value = promise._v;
6740 var ok = promise._s == 1;
6741 var i = 0;
6742 var run = function (reaction) {
6743 var handler = ok ? reaction.ok : reaction.fail;
6744 var resolve = reaction.resolve;
6745 var reject = reaction.reject;
6746 var domain = reaction.domain;
6747 var result, then, exited;
6748 try {
6749 if (handler) {
6750 if (!ok) {
6751 if (promise._h == 2) onHandleUnhandled(promise);
6752 promise._h = 1;
6753 }
6754 if (handler === true) result = value;
6755 else {
6756 if (domain) domain.enter();
6757 result = handler(value); // may throw
6758 if (domain) {
6759 domain.exit();
6760 exited = true;
6761 }
6762 }
6763 if (result === reaction.promise) {
6764 reject(TypeError('Promise-chain cycle'));
6765 } else if (then = isThenable(result)) {
6766 then.call(result, resolve, reject);
6767 } else resolve(result);
6768 } else reject(value);
6769 } catch (e) {
6770 if (domain && !exited) domain.exit();
6771 reject(e);
6772 }
6773 };
6774 while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
6775 promise._c = [];
6776 promise._n = false;
6777 if (isReject && !promise._h) onUnhandled(promise);
6778 });
6779};
6780var onUnhandled = function (promise) {
6781 task.call(global, function () {
6782 var value = promise._v;
6783 var unhandled = isUnhandled(promise);
6784 var result, handler, console;
6785 if (unhandled) {
6786 result = perform(function () {
6787 if (isNode) {
6788 process.emit('unhandledRejection', value, promise);
6789 } else if (handler = global.onunhandledrejection) {
6790 handler({ promise: promise, reason: value });
6791 } else if ((console = global.console) && console.error) {
6792 console.error('Unhandled promise rejection', value);
6793 }
6794 });
6795 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
6796 promise._h = isNode || isUnhandled(promise) ? 2 : 1;
6797 } promise._a = undefined;
6798 if (unhandled && result.e) throw result.v;
6799 });
6800};
6801var isUnhandled = function (promise) {
6802 return promise._h !== 1 && (promise._a || promise._c).length === 0;
6803};
6804var onHandleUnhandled = function (promise) {
6805 task.call(global, function () {
6806 var handler;
6807 if (isNode) {
6808 process.emit('rejectionHandled', promise);
6809 } else if (handler = global.onrejectionhandled) {
6810 handler({ promise: promise, reason: promise._v });
6811 }
6812 });
6813};
6814var $reject = function (value) {
6815 var promise = this;
6816 if (promise._d) return;
6817 promise._d = true;
6818 promise = promise._w || promise; // unwrap
6819 promise._v = value;
6820 promise._s = 2;
6821 if (!promise._a) promise._a = promise._c.slice();
6822 notify(promise, true);
6823};
6824var $resolve = function (value) {
6825 var promise = this;
6826 var then;
6827 if (promise._d) return;
6828 promise._d = true;
6829 promise = promise._w || promise; // unwrap
6830 try {
6831 if (promise === value) throw TypeError("Promise can't be resolved itself");
6832 if (then = isThenable(value)) {
6833 microtask(function () {
6834 var wrapper = { _w: promise, _d: false }; // wrap
6835 try {
6836 then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
6837 } catch (e) {
6838 $reject.call(wrapper, e);
6839 }
6840 });
6841 } else {
6842 promise._v = value;
6843 promise._s = 1;
6844 notify(promise, false);
6845 }
6846 } catch (e) {
6847 $reject.call({ _w: promise, _d: false }, e); // wrap
6848 }
6849};
6850
6851// constructor polyfill
6852if (!USE_NATIVE) {
6853 // 25.4.3.1 Promise(executor)
6854 $Promise = function Promise(executor) {
6855 anInstance(this, $Promise, PROMISE, '_h');
6856 aFunction(executor);
6857 Internal.call(this);
6858 try {
6859 executor(ctx($resolve, this, 1), ctx($reject, this, 1));
6860 } catch (err) {
6861 $reject.call(this, err);
6862 }
6863 };
6864 // eslint-disable-next-line no-unused-vars
6865 Internal = function Promise(executor) {
6866 this._c = []; // <- awaiting reactions
6867 this._a = undefined; // <- checked in isUnhandled reactions
6868 this._s = 0; // <- state
6869 this._d = false; // <- done
6870 this._v = undefined; // <- value
6871 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
6872 this._n = false; // <- notify
6873 };
6874 Internal.prototype = __webpack_require__(63)($Promise.prototype, {
6875 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
6876 then: function then(onFulfilled, onRejected) {
6877 var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
6878 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
6879 reaction.fail = typeof onRejected == 'function' && onRejected;
6880 reaction.domain = isNode ? process.domain : undefined;
6881 this._c.push(reaction);
6882 if (this._a) this._a.push(reaction);
6883 if (this._s) notify(this, false);
6884 return reaction.promise;
6885 },
6886 // 25.4.5.1 Promise.prototype.catch(onRejected)
6887 'catch': function (onRejected) {
6888 return this.then(undefined, onRejected);
6889 }
6890 });
6891 OwnPromiseCapability = function () {
6892 var promise = new Internal();
6893 this.promise = promise;
6894 this.resolve = ctx($resolve, promise, 1);
6895 this.reject = ctx($reject, promise, 1);
6896 };
6897 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
6898 return C === $Promise || C === Wrapper
6899 ? new OwnPromiseCapability(C)
6900 : newGenericPromiseCapability(C);
6901 };
6902}
6903
6904$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
6905__webpack_require__(47)($Promise, PROMISE);
6906__webpack_require__(115)(PROMISE);
6907Wrapper = __webpack_require__(2)[PROMISE];
6908
6909// statics
6910$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
6911 // 25.4.4.5 Promise.reject(r)
6912 reject: function reject(r) {
6913 var capability = newPromiseCapability(this);
6914 var $$reject = capability.reject;
6915 $$reject(r);
6916 return capability.promise;
6917 }
6918});
6919$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
6920 // 25.4.4.6 Promise.resolve(x)
6921 resolve: function resolve(x) {
6922 return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
6923 }
6924});
6925$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(201)(function (iter) {
6926 $Promise.all(iter)['catch'](empty);
6927})), PROMISE, {
6928 // 25.4.4.1 Promise.all(iterable)
6929 all: function all(iterable) {
6930 var C = this;
6931 var capability = newPromiseCapability(C);
6932 var resolve = capability.resolve;
6933 var reject = capability.reject;
6934 var result = perform(function () {
6935 var values = [];
6936 var index = 0;
6937 var remaining = 1;
6938 forOf(iterable, false, function (promise) {
6939 var $index = index++;
6940 var alreadyCalled = false;
6941 values.push(undefined);
6942 remaining++;
6943 C.resolve(promise).then(function (value) {
6944 if (alreadyCalled) return;
6945 alreadyCalled = true;
6946 values[$index] = value;
6947 --remaining || resolve(values);
6948 }, reject);
6949 });
6950 --remaining || resolve(values);
6951 });
6952 if (result.e) reject(result.v);
6953 return capability.promise;
6954 },
6955 // 25.4.4.4 Promise.race(iterable)
6956 race: function race(iterable) {
6957 var C = this;
6958 var capability = newPromiseCapability(C);
6959 var reject = capability.reject;
6960 var result = perform(function () {
6961 forOf(iterable, false, function (promise) {
6962 C.resolve(promise).then(capability.resolve, reject);
6963 });
6964 });
6965 if (result.e) reject(result.v);
6966 return capability.promise;
6967 }
6968});
6969
6970
6971/***/ }),
6972/* 196 */
6973/***/ (function(module, exports, __webpack_require__) {
6974
6975// call something on iterator step with safe closing on error
6976var anObject = __webpack_require__(18);
6977module.exports = function (iterator, fn, value, entries) {
6978 try {
6979 return entries ? fn(anObject(value)[0], value[1]) : fn(value);
6980 // 7.4.6 IteratorClose(iterator, completion)
6981 } catch (e) {
6982 var ret = iterator['return'];
6983 if (ret !== undefined) anObject(ret.call(iterator));
6984 throw e;
6985 }
6986};
6987
6988
6989/***/ }),
6990/* 197 */
6991/***/ (function(module, exports, __webpack_require__) {
6992
6993// check on default Array iterator
6994var Iterators = __webpack_require__(32);
6995var ITERATOR = __webpack_require__(7)('iterator');
6996var ArrayProto = Array.prototype;
6997
6998module.exports = function (it) {
6999 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
7000};
7001
7002
7003/***/ }),
7004/* 198 */
7005/***/ (function(module, exports) {
7006
7007// fast apply, http://jsperf.lnkit.com/fast-apply/5
7008module.exports = function (fn, args, that) {
7009 var un = that === undefined;
7010 switch (args.length) {
7011 case 0: return un ? fn()
7012 : fn.call(that);
7013 case 1: return un ? fn(args[0])
7014 : fn.call(that, args[0]);
7015 case 2: return un ? fn(args[0], args[1])
7016 : fn.call(that, args[0], args[1]);
7017 case 3: return un ? fn(args[0], args[1], args[2])
7018 : fn.call(that, args[0], args[1], args[2]);
7019 case 4: return un ? fn(args[0], args[1], args[2], args[3])
7020 : fn.call(that, args[0], args[1], args[2], args[3]);
7021 } return fn.apply(that, args);
7022};
7023
7024
7025/***/ }),
7026/* 199 */
7027/***/ (function(module, exports, __webpack_require__) {
7028
7029var global = __webpack_require__(5);
7030var macrotask = __webpack_require__(112).set;
7031var Observer = global.MutationObserver || global.WebKitMutationObserver;
7032var process = global.process;
7033var Promise = global.Promise;
7034var isNode = __webpack_require__(46)(process) == 'process';
7035
7036module.exports = function () {
7037 var head, last, notify;
7038
7039 var flush = function () {
7040 var parent, fn;
7041 if (isNode && (parent = process.domain)) parent.exit();
7042 while (head) {
7043 fn = head.fn;
7044 head = head.next;
7045 try {
7046 fn();
7047 } catch (e) {
7048 if (head) notify();
7049 else last = undefined;
7050 throw e;
7051 }
7052 } last = undefined;
7053 if (parent) parent.enter();
7054 };
7055
7056 // Node.js
7057 if (isNode) {
7058 notify = function () {
7059 process.nextTick(flush);
7060 };
7061 // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
7062 } else if (Observer && !(global.navigator && global.navigator.standalone)) {
7063 var toggle = true;
7064 var node = document.createTextNode('');
7065 new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
7066 notify = function () {
7067 node.data = toggle = !toggle;
7068 };
7069 // environments with maybe non-completely correct, but existent Promise
7070 } else if (Promise && Promise.resolve) {
7071 // Promise.resolve without an argument throws an error in LG WebOS 2
7072 var promise = Promise.resolve(undefined);
7073 notify = function () {
7074 promise.then(flush);
7075 };
7076 // for other environments - macrotask based on:
7077 // - setImmediate
7078 // - MessageChannel
7079 // - window.postMessag
7080 // - onreadystatechange
7081 // - setTimeout
7082 } else {
7083 notify = function () {
7084 // strange IE + webpack dev server bug - use .call(global)
7085 macrotask.call(global, flush);
7086 };
7087 }
7088
7089 return function (fn) {
7090 var task = { fn: fn, next: undefined };
7091 if (last) last.next = task;
7092 if (!head) {
7093 head = task;
7094 notify();
7095 } last = task;
7096 };
7097};
7098
7099
7100/***/ }),
7101/* 200 */
7102/***/ (function(module, exports, __webpack_require__) {
7103
7104var global = __webpack_require__(5);
7105var navigator = global.navigator;
7106
7107module.exports = navigator && navigator.userAgent || '';
7108
7109
7110/***/ }),
7111/* 201 */
7112/***/ (function(module, exports, __webpack_require__) {
7113
7114var ITERATOR = __webpack_require__(7)('iterator');
7115var SAFE_CLOSING = false;
7116
7117try {
7118 var riter = [7][ITERATOR]();
7119 riter['return'] = function () { SAFE_CLOSING = true; };
7120 // eslint-disable-next-line no-throw-literal
7121 Array.from(riter, function () { throw 2; });
7122} catch (e) { /* empty */ }
7123
7124module.exports = function (exec, skipClosing) {
7125 if (!skipClosing && !SAFE_CLOSING) return false;
7126 var safe = false;
7127 try {
7128 var arr = [7];
7129 var iter = arr[ITERATOR]();
7130 iter.next = function () { return { done: safe = true }; };
7131 arr[ITERATOR] = function () { return iter; };
7132 exec(arr);
7133 } catch (e) { /* empty */ }
7134 return safe;
7135};
7136
7137
7138/***/ }),
7139/* 202 */
7140/***/ (function(module, exports, __webpack_require__) {
7141
7142"use strict";
7143// https://github.com/tc39/proposal-promise-finally
7144
7145var $export = __webpack_require__(8);
7146var core = __webpack_require__(2);
7147var global = __webpack_require__(5);
7148var speciesConstructor = __webpack_require__(111);
7149var promiseResolve = __webpack_require__(114);
7150
7151$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
7152 var C = speciesConstructor(this, core.Promise || global.Promise);
7153 var isFunction = typeof onFinally == 'function';
7154 return this.then(
7155 isFunction ? function (x) {
7156 return promiseResolve(C, onFinally()).then(function () { return x; });
7157 } : onFinally,
7158 isFunction ? function (e) {
7159 return promiseResolve(C, onFinally()).then(function () { throw e; });
7160 } : onFinally
7161 );
7162} });
7163
7164
7165/***/ }),
7166/* 203 */
7167/***/ (function(module, exports, __webpack_require__) {
7168
7169"use strict";
7170
7171// https://github.com/tc39/proposal-promise-try
7172var $export = __webpack_require__(8);
7173var newPromiseCapability = __webpack_require__(81);
7174var perform = __webpack_require__(113);
7175
7176$export($export.S, 'Promise', { 'try': function (callbackfn) {
7177 var promiseCapability = newPromiseCapability.f(this);
7178 var result = perform(callbackfn);
7179 (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
7180 return promiseCapability.promise;
7181} });
7182
7183
7184/***/ }),
7185/* 204 */
7186/***/ (function(module, __webpack_exports__, __webpack_require__) {
7187
7188"use strict";
7189/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(82);
7190// Default Export
7191// ==============
7192// In this module, we mix our bundled exports into the `_` object and export
7193// the result. This is analogous to setting `module.exports = _` in CommonJS.
7194// Hence, this module is also the entry point of our UMD bundle and the package
7195// entry point for CommonJS and AMD users. In other words, this is (the source
7196// of) the module you are interfacing with when you do any of the following:
7197//
7198// ```js
7199// // CommonJS
7200// var _ = require('underscore');
7201//
7202// // AMD
7203// define(['underscore'], function(_) {...});
7204//
7205// // UMD in the browser
7206// // _ is available as a global variable
7207// ```
7208
7209
7210
7211// Add all of the Underscore functions to the wrapper object.
7212var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
7213// Legacy Node.js API.
7214_._ = _;
7215// Export the Underscore API.
7216/* harmony default export */ __webpack_exports__["a"] = (_);
7217
7218
7219/***/ }),
7220/* 205 */
7221/***/ (function(module, __webpack_exports__, __webpack_require__) {
7222
7223"use strict";
7224/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
7225// Is a given value equal to null?
7226function isNull(obj) {
7227 return obj === null;
7228}
7229
7230
7231/***/ }),
7232/* 206 */
7233/***/ (function(module, __webpack_exports__, __webpack_require__) {
7234
7235"use strict";
7236/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
7237// Is a given value a DOM element?
7238function isElement(obj) {
7239 return !!(obj && obj.nodeType === 1);
7240}
7241
7242
7243/***/ }),
7244/* 207 */
7245/***/ (function(module, __webpack_exports__, __webpack_require__) {
7246
7247"use strict";
7248/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
7249
7250
7251/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
7252
7253
7254/***/ }),
7255/* 208 */
7256/***/ (function(module, __webpack_exports__, __webpack_require__) {
7257
7258"use strict";
7259/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
7260
7261
7262/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
7263
7264
7265/***/ }),
7266/* 209 */
7267/***/ (function(module, __webpack_exports__, __webpack_require__) {
7268
7269"use strict";
7270/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
7271
7272
7273/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
7274
7275
7276/***/ }),
7277/* 210 */
7278/***/ (function(module, __webpack_exports__, __webpack_require__) {
7279
7280"use strict";
7281/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
7282
7283
7284/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
7285
7286
7287/***/ }),
7288/* 211 */
7289/***/ (function(module, __webpack_exports__, __webpack_require__) {
7290
7291"use strict";
7292/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
7293/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
7294/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(120);
7295
7296
7297
7298// Is a given object a finite number?
7299function isFinite(obj) {
7300 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
7301}
7302
7303
7304/***/ }),
7305/* 212 */
7306/***/ (function(module, __webpack_exports__, __webpack_require__) {
7307
7308"use strict";
7309/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(125);
7310/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(86);
7311
7312
7313
7314// Internal helper to determine whether we should spend extensive checks against
7315// `ArrayBuffer` et al.
7316/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
7317
7318
7319/***/ }),
7320/* 213 */
7321/***/ (function(module, __webpack_exports__, __webpack_require__) {
7322
7323"use strict";
7324/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
7325/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(16);
7326/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(29);
7327/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(83);
7328/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(85);
7329/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(4);
7330
7331
7332
7333
7334
7335
7336// Is a given array, string, or object empty?
7337// An "empty" object has no enumerable own-properties.
7338function isEmpty(obj) {
7339 if (obj == null) return true;
7340 // Skip the more expensive `toString`-based type checks if `obj` has no
7341 // `.length`.
7342 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
7343 if (typeof length == 'number' && (
7344 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)
7345 )) return length === 0;
7346 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
7347}
7348
7349
7350/***/ }),
7351/* 214 */
7352/***/ (function(module, __webpack_exports__, __webpack_require__) {
7353
7354"use strict";
7355/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
7356/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
7357/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
7358/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(86);
7359/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(123);
7360/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(15);
7361/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(48);
7362/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(84);
7363/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(4);
7364/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(25);
7365/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(215);
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377// We use this string twice, so give it a name for minification.
7378var tagDataView = '[object DataView]';
7379
7380// Internal recursive comparison function for `_.isEqual`.
7381function eq(a, b, aStack, bStack) {
7382 // Identical objects are equal. `0 === -0`, but they aren't identical.
7383 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
7384 if (a === b) return a !== 0 || 1 / a === 1 / b;
7385 // `null` or `undefined` only equal to itself (strict comparison).
7386 if (a == null || b == null) return false;
7387 // `NaN`s are equivalent, but non-reflexive.
7388 if (a !== a) return b !== b;
7389 // Exhaust primitive checks
7390 var type = typeof a;
7391 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
7392 return deepEq(a, b, aStack, bStack);
7393}
7394
7395// Internal recursive comparison function for `_.isEqual`.
7396function deepEq(a, b, aStack, bStack) {
7397 // Unwrap any wrapped objects.
7398 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
7399 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
7400 // Compare `[[Class]]` names.
7401 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
7402 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
7403 // Work around a bug in IE 10 - Edge 13.
7404 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
7405 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
7406 className = tagDataView;
7407 }
7408 switch (className) {
7409 // These types are compared by value.
7410 case '[object RegExp]':
7411 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
7412 case '[object String]':
7413 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
7414 // equivalent to `new String("5")`.
7415 return '' + a === '' + b;
7416 case '[object Number]':
7417 // `NaN`s are equivalent, but non-reflexive.
7418 // Object(NaN) is equivalent to NaN.
7419 if (+a !== +a) return +b !== +b;
7420 // An `egal` comparison is performed for other numeric values.
7421 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
7422 case '[object Date]':
7423 case '[object Boolean]':
7424 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
7425 // millisecond representations. Note that invalid dates with millisecond representations
7426 // of `NaN` are not equivalent.
7427 return +a === +b;
7428 case '[object Symbol]':
7429 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
7430 case '[object ArrayBuffer]':
7431 case tagDataView:
7432 // Coerce to typed array so we can fall through.
7433 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
7434 }
7435
7436 var areArrays = className === '[object Array]';
7437 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
7438 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
7439 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
7440 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
7441 areArrays = true;
7442 }
7443 if (!areArrays) {
7444 if (typeof a != 'object' || typeof b != 'object') return false;
7445
7446 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
7447 // from different frames are.
7448 var aCtor = a.constructor, bCtor = b.constructor;
7449 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
7450 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
7451 && ('constructor' in a && 'constructor' in b)) {
7452 return false;
7453 }
7454 }
7455 // Assume equality for cyclic structures. The algorithm for detecting cyclic
7456 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
7457
7458 // Initializing stack of traversed objects.
7459 // It's done here since we only need them for objects and arrays comparison.
7460 aStack = aStack || [];
7461 bStack = bStack || [];
7462 var length = aStack.length;
7463 while (length--) {
7464 // Linear search. Performance is inversely proportional to the number of
7465 // unique nested structures.
7466 if (aStack[length] === a) return bStack[length] === b;
7467 }
7468
7469 // Add the first object to the stack of traversed objects.
7470 aStack.push(a);
7471 bStack.push(b);
7472
7473 // Recursively compare objects and arrays.
7474 if (areArrays) {
7475 // Compare array lengths to determine if a deep comparison is necessary.
7476 length = a.length;
7477 if (length !== b.length) return false;
7478 // Deep compare the contents, ignoring non-numeric properties.
7479 while (length--) {
7480 if (!eq(a[length], b[length], aStack, bStack)) return false;
7481 }
7482 } else {
7483 // Deep compare objects.
7484 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
7485 length = _keys.length;
7486 // Ensure that both objects contain the same number of properties before comparing deep equality.
7487 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
7488 while (length--) {
7489 // Deep compare each member
7490 key = _keys[length];
7491 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
7492 }
7493 }
7494 // Remove the first object from the stack of traversed objects.
7495 aStack.pop();
7496 bStack.pop();
7497 return true;
7498}
7499
7500// Perform a deep comparison to check if two objects are equal.
7501function isEqual(a, b) {
7502 return eq(a, b);
7503}
7504
7505
7506/***/ }),
7507/* 215 */
7508/***/ (function(module, __webpack_exports__, __webpack_require__) {
7509
7510"use strict";
7511/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
7512/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(86);
7513
7514
7515// Internal function to wrap or shallow-copy an ArrayBuffer,
7516// typed array or DataView to a new view, reusing the buffer.
7517function toBufferView(bufferSource) {
7518 return new Uint8Array(
7519 bufferSource.buffer || bufferSource,
7520 bufferSource.byteOffset || 0,
7521 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
7522 );
7523}
7524
7525
7526/***/ }),
7527/* 216 */
7528/***/ (function(module, __webpack_exports__, __webpack_require__) {
7529
7530"use strict";
7531/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
7532/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(48);
7533/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(87);
7534
7535
7536
7537
7538/* 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'));
7539
7540
7541/***/ }),
7542/* 217 */
7543/***/ (function(module, __webpack_exports__, __webpack_require__) {
7544
7545"use strict";
7546/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
7547/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(48);
7548/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(87);
7549
7550
7551
7552
7553/* 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'));
7554
7555
7556/***/ }),
7557/* 218 */
7558/***/ (function(module, __webpack_exports__, __webpack_require__) {
7559
7560"use strict";
7561/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
7562/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(48);
7563/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(87);
7564
7565
7566
7567
7568/* 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'));
7569
7570
7571/***/ }),
7572/* 219 */
7573/***/ (function(module, __webpack_exports__, __webpack_require__) {
7574
7575"use strict";
7576/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(6);
7577
7578
7579/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
7580
7581
7582/***/ }),
7583/* 220 */
7584/***/ (function(module, __webpack_exports__, __webpack_require__) {
7585
7586"use strict";
7587/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
7588/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
7589
7590
7591// Convert an object into a list of `[key, value]` pairs.
7592// The opposite of `_.object` with one argument.
7593function pairs(obj) {
7594 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
7595 var length = _keys.length;
7596 var pairs = Array(length);
7597 for (var i = 0; i < length; i++) {
7598 pairs[i] = [_keys[i], obj[_keys[i]]];
7599 }
7600 return pairs;
7601}
7602
7603
7604/***/ }),
7605/* 221 */
7606/***/ (function(module, __webpack_exports__, __webpack_require__) {
7607
7608"use strict";
7609/* harmony export (immutable) */ __webpack_exports__["a"] = create;
7610/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(133);
7611/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(89);
7612
7613
7614
7615// Creates an object that inherits from the given prototype object.
7616// If additional properties are provided then they will be added to the
7617// created object.
7618function create(prototype, props) {
7619 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
7620 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
7621 return result;
7622}
7623
7624
7625/***/ }),
7626/* 222 */
7627/***/ (function(module, __webpack_exports__, __webpack_require__) {
7628
7629"use strict";
7630/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
7631// Invokes `interceptor` with the `obj` and then returns `obj`.
7632// The primary purpose of this method is to "tap into" a method chain, in
7633// order to perform operations on intermediate results within the chain.
7634function tap(obj, interceptor) {
7635 interceptor(obj);
7636 return obj;
7637}
7638
7639
7640/***/ }),
7641/* 223 */
7642/***/ (function(module, __webpack_exports__, __webpack_require__) {
7643
7644"use strict";
7645/* harmony export (immutable) */ __webpack_exports__["a"] = has;
7646/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(25);
7647/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(50);
7648
7649
7650
7651// Shortcut function for checking if an object has a given property directly on
7652// itself (in other words, not on a prototype). Unlike the internal `has`
7653// function, this public version can also traverse nested properties.
7654function has(obj, path) {
7655 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
7656 var length = path.length;
7657 for (var i = 0; i < length; i++) {
7658 var key = path[i];
7659 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
7660 obj = obj[key];
7661 }
7662 return !!length;
7663}
7664
7665
7666/***/ }),
7667/* 224 */
7668/***/ (function(module, __webpack_exports__, __webpack_require__) {
7669
7670"use strict";
7671/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
7672/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
7673/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
7674
7675
7676
7677// Returns the results of applying the `iteratee` to each element of `obj`.
7678// In contrast to `_.map` it returns an object.
7679function mapObject(obj, iteratee, context) {
7680 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
7681 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
7682 length = _keys.length,
7683 results = {};
7684 for (var index = 0; index < length; index++) {
7685 var currentKey = _keys[index];
7686 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
7687 }
7688 return results;
7689}
7690
7691
7692/***/ }),
7693/* 225 */
7694/***/ (function(module, __webpack_exports__, __webpack_require__) {
7695
7696"use strict";
7697/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
7698/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(139);
7699/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(135);
7700
7701
7702
7703// Generates a function for a given object that returns a given property.
7704function propertyOf(obj) {
7705 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
7706 return function(path) {
7707 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
7708 };
7709}
7710
7711
7712/***/ }),
7713/* 226 */
7714/***/ (function(module, __webpack_exports__, __webpack_require__) {
7715
7716"use strict";
7717/* harmony export (immutable) */ __webpack_exports__["a"] = times;
7718/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(51);
7719
7720
7721// Run a function **n** times.
7722function times(n, iteratee, context) {
7723 var accum = Array(Math.max(0, n));
7724 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
7725 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
7726 return accum;
7727}
7728
7729
7730/***/ }),
7731/* 227 */
7732/***/ (function(module, __webpack_exports__, __webpack_require__) {
7733
7734"use strict";
7735/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(141);
7736/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(142);
7737
7738
7739
7740// Function for escaping strings to HTML interpolation.
7741/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
7742
7743
7744/***/ }),
7745/* 228 */
7746/***/ (function(module, __webpack_exports__, __webpack_require__) {
7747
7748"use strict";
7749/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(141);
7750/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(229);
7751
7752
7753
7754// Function for unescaping strings from HTML interpolation.
7755/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
7756
7757
7758/***/ }),
7759/* 229 */
7760/***/ (function(module, __webpack_exports__, __webpack_require__) {
7761
7762"use strict";
7763/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(129);
7764/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(142);
7765
7766
7767
7768// Internal list of HTML entities for unescaping.
7769/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
7770
7771
7772/***/ }),
7773/* 230 */
7774/***/ (function(module, __webpack_exports__, __webpack_require__) {
7775
7776"use strict";
7777/* harmony export (immutable) */ __webpack_exports__["a"] = template;
7778/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(132);
7779/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(12);
7780/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(143);
7781
7782
7783
7784
7785// When customizing `_.templateSettings`, if you don't want to define an
7786// interpolation, evaluation or escaping regex, we need one that is
7787// guaranteed not to match.
7788var noMatch = /(.)^/;
7789
7790// Certain characters need to be escaped so that they can be put into a
7791// string literal.
7792var escapes = {
7793 "'": "'",
7794 '\\': '\\',
7795 '\r': 'r',
7796 '\n': 'n',
7797 '\u2028': 'u2028',
7798 '\u2029': 'u2029'
7799};
7800
7801var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
7802
7803function escapeChar(match) {
7804 return '\\' + escapes[match];
7805}
7806
7807var bareIdentifier = /^\s*(\w|\$)+\s*$/;
7808
7809// JavaScript micro-templating, similar to John Resig's implementation.
7810// Underscore templating handles arbitrary delimiters, preserves whitespace,
7811// and correctly escapes quotes within interpolated code.
7812// NB: `oldSettings` only exists for backwards compatibility.
7813function template(text, settings, oldSettings) {
7814 if (!settings && oldSettings) settings = oldSettings;
7815 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
7816
7817 // Combine delimiters into one regular expression via alternation.
7818 var matcher = RegExp([
7819 (settings.escape || noMatch).source,
7820 (settings.interpolate || noMatch).source,
7821 (settings.evaluate || noMatch).source
7822 ].join('|') + '|$', 'g');
7823
7824 // Compile the template source, escaping string literals appropriately.
7825 var index = 0;
7826 var source = "__p+='";
7827 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
7828 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
7829 index = offset + match.length;
7830
7831 if (escape) {
7832 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
7833 } else if (interpolate) {
7834 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
7835 } else if (evaluate) {
7836 source += "';\n" + evaluate + "\n__p+='";
7837 }
7838
7839 // Adobe VMs need the match returned to produce the correct offset.
7840 return match;
7841 });
7842 source += "';\n";
7843
7844 var argument = settings.variable;
7845 if (argument) {
7846 if (!bareIdentifier.test(argument)) throw new Error(argument);
7847 } else {
7848 // If a variable is not specified, place data values in local scope.
7849 source = 'with(obj||{}){\n' + source + '}\n';
7850 argument = 'obj';
7851 }
7852
7853 source = "var __t,__p='',__j=Array.prototype.join," +
7854 "print=function(){__p+=__j.call(arguments,'');};\n" +
7855 source + 'return __p;\n';
7856
7857 var render;
7858 try {
7859 render = new Function(argument, '_', source);
7860 } catch (e) {
7861 e.source = source;
7862 throw e;
7863 }
7864
7865 var template = function(data) {
7866 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
7867 };
7868
7869 // Provide the compiled source as a convenience for precompilation.
7870 template.source = 'function(' + argument + '){\n' + source + '}';
7871
7872 return template;
7873}
7874
7875
7876/***/ }),
7877/* 231 */
7878/***/ (function(module, __webpack_exports__, __webpack_require__) {
7879
7880"use strict";
7881/* harmony export (immutable) */ __webpack_exports__["a"] = result;
7882/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(15);
7883/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(50);
7884
7885
7886
7887// Traverses the children of `obj` along `path`. If a child is a function, it
7888// is invoked with its parent as context. Returns the value of the final
7889// child, or `fallback` if any child is undefined.
7890function result(obj, path, fallback) {
7891 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
7892 var length = path.length;
7893 if (!length) {
7894 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
7895 }
7896 for (var i = 0; i < length; i++) {
7897 var prop = obj == null ? void 0 : obj[path[i]];
7898 if (prop === void 0) {
7899 prop = fallback;
7900 i = length; // Ensure we don't continue iterating.
7901 }
7902 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
7903 }
7904 return obj;
7905}
7906
7907
7908/***/ }),
7909/* 232 */
7910/***/ (function(module, __webpack_exports__, __webpack_require__) {
7911
7912"use strict";
7913/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
7914// Generate a unique integer id (unique within the entire client session).
7915// Useful for temporary DOM ids.
7916var idCounter = 0;
7917function uniqueId(prefix) {
7918 var id = ++idCounter + '';
7919 return prefix ? prefix + id : id;
7920}
7921
7922
7923/***/ }),
7924/* 233 */
7925/***/ (function(module, __webpack_exports__, __webpack_require__) {
7926
7927"use strict";
7928/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
7929/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
7930
7931
7932// Start chaining a wrapped Underscore object.
7933function chain(obj) {
7934 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
7935 instance._chain = true;
7936 return instance;
7937}
7938
7939
7940/***/ }),
7941/* 234 */
7942/***/ (function(module, __webpack_exports__, __webpack_require__) {
7943
7944"use strict";
7945/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
7946/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(37);
7947/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(145);
7948
7949
7950
7951
7952// Bind a number of an object's methods to that object. Remaining arguments
7953// are the method names to be bound. Useful for ensuring that all callbacks
7954// defined on an object belong to it.
7955/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7956 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
7957 var index = keys.length;
7958 if (index < 1) throw new Error('bindAll must be passed function names');
7959 while (index--) {
7960 var key = keys[index];
7961 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
7962 }
7963 return obj;
7964}));
7965
7966
7967/***/ }),
7968/* 235 */
7969/***/ (function(module, __webpack_exports__, __webpack_require__) {
7970
7971"use strict";
7972/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
7973/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(25);
7974
7975
7976// Memoize an expensive function by storing its results.
7977function memoize(func, hasher) {
7978 var memoize = function(key) {
7979 var cache = memoize.cache;
7980 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
7981 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
7982 return cache[address];
7983 };
7984 memoize.cache = {};
7985 return memoize;
7986}
7987
7988
7989/***/ }),
7990/* 236 */
7991/***/ (function(module, __webpack_exports__, __webpack_require__) {
7992
7993"use strict";
7994/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(65);
7995/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(146);
7996/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(12);
7997
7998
7999
8000
8001// Defers a function, scheduling it to run after the current call stack has
8002// cleared.
8003/* 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));
8004
8005
8006/***/ }),
8007/* 237 */
8008/***/ (function(module, __webpack_exports__, __webpack_require__) {
8009
8010"use strict";
8011/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
8012/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(93);
8013
8014
8015// Returns a function, that, when invoked, will only be triggered at most once
8016// during a given window of time. Normally, the throttled function will run
8017// as much as it can, without ever going more than once per `wait` duration;
8018// but if you'd like to disable the execution on the leading edge, pass
8019// `{leading: false}`. To disable execution on the trailing edge, ditto.
8020function throttle(func, wait, options) {
8021 var timeout, context, args, result;
8022 var previous = 0;
8023 if (!options) options = {};
8024
8025 var later = function() {
8026 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
8027 timeout = null;
8028 result = func.apply(context, args);
8029 if (!timeout) context = args = null;
8030 };
8031
8032 var throttled = function() {
8033 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
8034 if (!previous && options.leading === false) previous = _now;
8035 var remaining = wait - (_now - previous);
8036 context = this;
8037 args = arguments;
8038 if (remaining <= 0 || remaining > wait) {
8039 if (timeout) {
8040 clearTimeout(timeout);
8041 timeout = null;
8042 }
8043 previous = _now;
8044 result = func.apply(context, args);
8045 if (!timeout) context = args = null;
8046 } else if (!timeout && options.trailing !== false) {
8047 timeout = setTimeout(later, remaining);
8048 }
8049 return result;
8050 };
8051
8052 throttled.cancel = function() {
8053 clearTimeout(timeout);
8054 previous = 0;
8055 timeout = context = args = null;
8056 };
8057
8058 return throttled;
8059}
8060
8061
8062/***/ }),
8063/* 238 */
8064/***/ (function(module, __webpack_exports__, __webpack_require__) {
8065
8066"use strict";
8067/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
8068/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
8069/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(93);
8070
8071
8072
8073// When a sequence of calls of the returned function ends, the argument
8074// function is triggered. The end of a sequence is defined by the `wait`
8075// parameter. If `immediate` is passed, the argument function will be
8076// triggered at the beginning of the sequence instead of at the end.
8077function debounce(func, wait, immediate) {
8078 var timeout, previous, args, result, context;
8079
8080 var later = function() {
8081 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
8082 if (wait > passed) {
8083 timeout = setTimeout(later, wait - passed);
8084 } else {
8085 timeout = null;
8086 if (!immediate) result = func.apply(context, args);
8087 // This check is needed because `func` can recursively invoke `debounced`.
8088 if (!timeout) args = context = null;
8089 }
8090 };
8091
8092 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
8093 context = this;
8094 args = _args;
8095 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
8096 if (!timeout) {
8097 timeout = setTimeout(later, wait);
8098 if (immediate) result = func.apply(context, args);
8099 }
8100 return result;
8101 });
8102
8103 debounced.cancel = function() {
8104 clearTimeout(timeout);
8105 timeout = args = context = null;
8106 };
8107
8108 return debounced;
8109}
8110
8111
8112/***/ }),
8113/* 239 */
8114/***/ (function(module, __webpack_exports__, __webpack_require__) {
8115
8116"use strict";
8117/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
8118/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(65);
8119
8120
8121// Returns the first function passed as an argument to the second,
8122// allowing you to adjust arguments, run code before and after, and
8123// conditionally execute the original function.
8124function wrap(func, wrapper) {
8125 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
8126}
8127
8128
8129/***/ }),
8130/* 240 */
8131/***/ (function(module, __webpack_exports__, __webpack_require__) {
8132
8133"use strict";
8134/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
8135// Returns a function that is the composition of a list of functions, each
8136// consuming the return value of the function that follows.
8137function compose() {
8138 var args = arguments;
8139 var start = args.length - 1;
8140 return function() {
8141 var i = start;
8142 var result = args[start].apply(this, arguments);
8143 while (i--) result = args[i].call(this, result);
8144 return result;
8145 };
8146}
8147
8148
8149/***/ }),
8150/* 241 */
8151/***/ (function(module, __webpack_exports__, __webpack_require__) {
8152
8153"use strict";
8154/* harmony export (immutable) */ __webpack_exports__["a"] = after;
8155// Returns a function that will only be executed on and after the Nth call.
8156function after(times, func) {
8157 return function() {
8158 if (--times < 1) {
8159 return func.apply(this, arguments);
8160 }
8161 };
8162}
8163
8164
8165/***/ }),
8166/* 242 */
8167/***/ (function(module, __webpack_exports__, __webpack_require__) {
8168
8169"use strict";
8170/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(65);
8171/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(147);
8172
8173
8174
8175// Returns a function that will be executed at most one time, no matter how
8176// often you call it. Useful for lazy initialization.
8177/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
8178
8179
8180/***/ }),
8181/* 243 */
8182/***/ (function(module, __webpack_exports__, __webpack_require__) {
8183
8184"use strict";
8185/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(150);
8186/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(153);
8187
8188
8189
8190// Return the position of the last occurrence of an item in an array,
8191// or -1 if the item is not included in the array.
8192/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
8193
8194
8195/***/ }),
8196/* 244 */
8197/***/ (function(module, __webpack_exports__, __webpack_require__) {
8198
8199"use strict";
8200/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
8201/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(154);
8202/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(64);
8203
8204
8205
8206// Convenience version of a common use case of `_.find`: getting the first
8207// object containing specific `key:value` pairs.
8208function findWhere(obj, attrs) {
8209 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
8210}
8211
8212
8213/***/ }),
8214/* 245 */
8215/***/ (function(module, __webpack_exports__, __webpack_require__) {
8216
8217"use strict";
8218/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(155);
8219
8220
8221// **Reduce** builds up a single result from a list of values, aka `inject`,
8222// or `foldl`.
8223/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
8224
8225
8226/***/ }),
8227/* 246 */
8228/***/ (function(module, __webpack_exports__, __webpack_require__) {
8229
8230"use strict";
8231/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(155);
8232
8233
8234// The right-associative version of reduce, also known as `foldr`.
8235/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
8236
8237
8238/***/ }),
8239/* 247 */
8240/***/ (function(module, __webpack_exports__, __webpack_require__) {
8241
8242"use strict";
8243/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
8244/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(52);
8245/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(94);
8246/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(9);
8247
8248
8249
8250
8251// Return all the elements for which a truth test fails.
8252function reject(obj, predicate, context) {
8253 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);
8254}
8255
8256
8257/***/ }),
8258/* 248 */
8259/***/ (function(module, __webpack_exports__, __webpack_require__) {
8260
8261"use strict";
8262/* harmony export (immutable) */ __webpack_exports__["a"] = every;
8263/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
8264/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(13);
8265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(4);
8266
8267
8268
8269
8270// Determine whether all of the elements pass a truth test.
8271function every(obj, predicate, context) {
8272 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
8273 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
8274 length = (_keys || obj).length;
8275 for (var index = 0; index < length; index++) {
8276 var currentKey = _keys ? _keys[index] : index;
8277 if (!predicate(obj[currentKey], currentKey, obj)) return false;
8278 }
8279 return true;
8280}
8281
8282
8283/***/ }),
8284/* 249 */
8285/***/ (function(module, __webpack_exports__, __webpack_require__) {
8286
8287"use strict";
8288/* harmony export (immutable) */ __webpack_exports__["a"] = some;
8289/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
8290/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(13);
8291/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(4);
8292
8293
8294
8295
8296// Determine if at least one element in the object passes a truth test.
8297function some(obj, predicate, context) {
8298 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
8299 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
8300 length = (_keys || obj).length;
8301 for (var index = 0; index < length; index++) {
8302 var currentKey = _keys ? _keys[index] : index;
8303 if (predicate(obj[currentKey], currentKey, obj)) return true;
8304 }
8305 return false;
8306}
8307
8308
8309/***/ }),
8310/* 250 */
8311/***/ (function(module, __webpack_exports__, __webpack_require__) {
8312
8313"use strict";
8314/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
8315/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(15);
8316/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(38);
8317/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(90);
8318/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(50);
8319
8320
8321
8322
8323
8324
8325// Invoke a method (with arguments) on every item in a collection.
8326/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
8327 var contextPath, func;
8328 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
8329 func = path;
8330 } else {
8331 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
8332 contextPath = path.slice(0, -1);
8333 path = path[path.length - 1];
8334 }
8335 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
8336 var method = func;
8337 if (!method) {
8338 if (contextPath && contextPath.length) {
8339 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
8340 }
8341 if (context == null) return void 0;
8342 method = context[path];
8343 }
8344 return method == null ? method : method.apply(context, args);
8345 });
8346}));
8347
8348
8349/***/ }),
8350/* 251 */
8351/***/ (function(module, __webpack_exports__, __webpack_require__) {
8352
8353"use strict";
8354/* harmony export (immutable) */ __webpack_exports__["a"] = where;
8355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(52);
8356/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(64);
8357
8358
8359
8360// Convenience version of a common use case of `_.filter`: selecting only
8361// objects containing specific `key:value` pairs.
8362function where(obj, attrs) {
8363 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
8364}
8365
8366
8367/***/ }),
8368/* 252 */
8369/***/ (function(module, __webpack_exports__, __webpack_require__) {
8370
8371"use strict";
8372/* harmony export (immutable) */ __webpack_exports__["a"] = min;
8373/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(13);
8374/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(36);
8375/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(9);
8376/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(30);
8377
8378
8379
8380
8381
8382// Return the minimum element (or element-based computation).
8383function min(obj, iteratee, context) {
8384 var result = Infinity, lastComputed = Infinity,
8385 value, computed;
8386 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
8387 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
8388 for (var i = 0, length = obj.length; i < length; i++) {
8389 value = obj[i];
8390 if (value != null && value < result) {
8391 result = value;
8392 }
8393 }
8394 } else {
8395 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
8396 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
8397 computed = iteratee(v, index, list);
8398 if (computed < lastComputed || computed === Infinity && result === Infinity) {
8399 result = v;
8400 lastComputed = computed;
8401 }
8402 });
8403 }
8404 return result;
8405}
8406
8407
8408/***/ }),
8409/* 253 */
8410/***/ (function(module, __webpack_exports__, __webpack_require__) {
8411
8412"use strict";
8413/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
8414/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(157);
8415
8416
8417// Shuffle a collection.
8418function shuffle(obj) {
8419 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
8420}
8421
8422
8423/***/ }),
8424/* 254 */
8425/***/ (function(module, __webpack_exports__, __webpack_require__) {
8426
8427"use strict";
8428/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
8429/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(9);
8430/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(96);
8431/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(38);
8432
8433
8434
8435
8436// Sort the object's values by a criterion produced by an iteratee.
8437function sortBy(obj, iteratee, context) {
8438 var index = 0;
8439 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
8440 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
8441 return {
8442 value: value,
8443 index: index++,
8444 criteria: iteratee(value, key, list)
8445 };
8446 }).sort(function(left, right) {
8447 var a = left.criteria;
8448 var b = right.criteria;
8449 if (a !== b) {
8450 if (a > b || a === void 0) return 1;
8451 if (a < b || b === void 0) return -1;
8452 }
8453 return left.index - right.index;
8454 }), 'value');
8455}
8456
8457
8458/***/ }),
8459/* 255 */
8460/***/ (function(module, __webpack_exports__, __webpack_require__) {
8461
8462"use strict";
8463/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(66);
8464/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(25);
8465
8466
8467
8468// Groups the object's values by a criterion. Pass either a string attribute
8469// to group by, or a function that returns the criterion.
8470/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
8471 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
8472}));
8473
8474
8475/***/ }),
8476/* 256 */
8477/***/ (function(module, __webpack_exports__, __webpack_require__) {
8478
8479"use strict";
8480/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(66);
8481
8482
8483// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
8484// when you know that your index values will be unique.
8485/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
8486 result[key] = value;
8487}));
8488
8489
8490/***/ }),
8491/* 257 */
8492/***/ (function(module, __webpack_exports__, __webpack_require__) {
8493
8494"use strict";
8495/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(66);
8496/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(25);
8497
8498
8499
8500// Counts instances of an object that group by a certain criterion. Pass
8501// either a string attribute to count by, or a function that returns the
8502// criterion.
8503/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
8504 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
8505}));
8506
8507
8508/***/ }),
8509/* 258 */
8510/***/ (function(module, __webpack_exports__, __webpack_require__) {
8511
8512"use strict";
8513/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(66);
8514
8515
8516// Split a collection into two arrays: one whose elements all pass the given
8517// truth test, and one whose elements all do not pass the truth test.
8518/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
8519 result[pass ? 0 : 1].push(value);
8520}, true));
8521
8522
8523/***/ }),
8524/* 259 */
8525/***/ (function(module, __webpack_exports__, __webpack_require__) {
8526
8527"use strict";
8528/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
8529/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(29);
8530/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
8531/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(83);
8532/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(13);
8533/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(38);
8534/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(91);
8535/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(36);
8536
8537
8538
8539
8540
8541
8542
8543
8544// Safely create a real, live array from anything iterable.
8545var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
8546function toArray(obj) {
8547 if (!obj) return [];
8548 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
8549 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
8550 // Keep surrogate pair characters together.
8551 return obj.match(reStrSymbol);
8552 }
8553 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 */]);
8554 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
8555}
8556
8557
8558/***/ }),
8559/* 260 */
8560/***/ (function(module, __webpack_exports__, __webpack_require__) {
8561
8562"use strict";
8563/* harmony export (immutable) */ __webpack_exports__["a"] = size;
8564/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(13);
8565/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
8566
8567
8568
8569// Return the number of elements in a collection.
8570function size(obj) {
8571 if (obj == null) return 0;
8572 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
8573}
8574
8575
8576/***/ }),
8577/* 261 */
8578/***/ (function(module, __webpack_exports__, __webpack_require__) {
8579
8580"use strict";
8581/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
8582// Internal `_.pick` helper function to determine whether `key` is an enumerable
8583// property name of `obj`.
8584function keyInObj(value, key, obj) {
8585 return key in obj;
8586}
8587
8588
8589/***/ }),
8590/* 262 */
8591/***/ (function(module, __webpack_exports__, __webpack_require__) {
8592
8593"use strict";
8594/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
8595/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(15);
8596/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(94);
8597/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(38);
8598/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(37);
8599/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(53);
8600/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(158);
8601
8602
8603
8604
8605
8606
8607
8608
8609// Return a copy of the object without the disallowed properties.
8610/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
8611 var iteratee = keys[0], context;
8612 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
8613 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
8614 if (keys.length > 1) context = keys[1];
8615 } else {
8616 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
8617 iteratee = function(value, key) {
8618 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
8619 };
8620 }
8621 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
8622}));
8623
8624
8625/***/ }),
8626/* 263 */
8627/***/ (function(module, __webpack_exports__, __webpack_require__) {
8628
8629"use strict";
8630/* harmony export (immutable) */ __webpack_exports__["a"] = first;
8631/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(159);
8632
8633
8634// Get the first element of an array. Passing **n** will return the first N
8635// values in the array. The **guard** check allows it to work with `_.map`.
8636function first(array, n, guard) {
8637 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
8638 if (n == null || guard) return array[0];
8639 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
8640}
8641
8642
8643/***/ }),
8644/* 264 */
8645/***/ (function(module, __webpack_exports__, __webpack_require__) {
8646
8647"use strict";
8648/* harmony export (immutable) */ __webpack_exports__["a"] = last;
8649/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(160);
8650
8651
8652// Get the last element of an array. Passing **n** will return the last N
8653// values in the array.
8654function last(array, n, guard) {
8655 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
8656 if (n == null || guard) return array[array.length - 1];
8657 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
8658}
8659
8660
8661/***/ }),
8662/* 265 */
8663/***/ (function(module, __webpack_exports__, __webpack_require__) {
8664
8665"use strict";
8666/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
8667/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(52);
8668
8669
8670// Trim out all falsy values from an array.
8671function compact(array) {
8672 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
8673}
8674
8675
8676/***/ }),
8677/* 266 */
8678/***/ (function(module, __webpack_exports__, __webpack_require__) {
8679
8680"use strict";
8681/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
8682/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(37);
8683
8684
8685// Flatten out an array, either recursively (by default), or up to `depth`.
8686// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
8687function flatten(array, depth) {
8688 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
8689}
8690
8691
8692/***/ }),
8693/* 267 */
8694/***/ (function(module, __webpack_exports__, __webpack_require__) {
8695
8696"use strict";
8697/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
8698/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(161);
8699
8700
8701
8702// Return a version of the array that does not contain the specified value(s).
8703/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
8704 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
8705}));
8706
8707
8708/***/ }),
8709/* 268 */
8710/***/ (function(module, __webpack_exports__, __webpack_require__) {
8711
8712"use strict";
8713/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
8714/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(162);
8715/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(37);
8716
8717
8718
8719
8720// Produce an array that contains the union: each distinct element from all of
8721// the passed-in arrays.
8722/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
8723 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
8724}));
8725
8726
8727/***/ }),
8728/* 269 */
8729/***/ (function(module, __webpack_exports__, __webpack_require__) {
8730
8731"use strict";
8732/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
8733/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(16);
8734/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(53);
8735
8736
8737
8738// Produce an array that contains every item shared between all the
8739// passed-in arrays.
8740function intersection(array) {
8741 var result = [];
8742 var argsLength = arguments.length;
8743 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
8744 var item = array[i];
8745 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
8746 var j;
8747 for (j = 1; j < argsLength; j++) {
8748 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
8749 }
8750 if (j === argsLength) result.push(item);
8751 }
8752 return result;
8753}
8754
8755
8756/***/ }),
8757/* 270 */
8758/***/ (function(module, __webpack_exports__, __webpack_require__) {
8759
8760"use strict";
8761/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(11);
8762/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(163);
8763
8764
8765
8766// Zip together multiple lists into a single array -- elements that share
8767// an index go together.
8768/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
8769
8770
8771/***/ }),
8772/* 271 */
8773/***/ (function(module, __webpack_exports__, __webpack_require__) {
8774
8775"use strict";
8776/* harmony export (immutable) */ __webpack_exports__["a"] = object;
8777/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(16);
8778
8779
8780// Converts lists into objects. Pass either a single array of `[key, value]`
8781// pairs, or two parallel arrays of the same length -- one of keys, and one of
8782// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
8783function object(list, values) {
8784 var result = {};
8785 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
8786 if (values) {
8787 result[list[i]] = values[i];
8788 } else {
8789 result[list[i][0]] = list[i][1];
8790 }
8791 }
8792 return result;
8793}
8794
8795
8796/***/ }),
8797/* 272 */
8798/***/ (function(module, __webpack_exports__, __webpack_require__) {
8799
8800"use strict";
8801/* harmony export (immutable) */ __webpack_exports__["a"] = range;
8802// Generate an integer Array containing an arithmetic progression. A port of
8803// the native Python `range()` function. See
8804// [the Python documentation](https://docs.python.org/library/functions.html#range).
8805function range(start, stop, step) {
8806 if (stop == null) {
8807 stop = start || 0;
8808 start = 0;
8809 }
8810 if (!step) {
8811 step = stop < start ? -1 : 1;
8812 }
8813
8814 var length = Math.max(Math.ceil((stop - start) / step), 0);
8815 var range = Array(length);
8816
8817 for (var idx = 0; idx < length; idx++, start += step) {
8818 range[idx] = start;
8819 }
8820
8821 return range;
8822}
8823
8824
8825/***/ }),
8826/* 273 */
8827/***/ (function(module, __webpack_exports__, __webpack_require__) {
8828
8829"use strict";
8830/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
8831/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
8832
8833
8834// Chunk a single array into multiple arrays, each containing `count` or fewer
8835// items.
8836function chunk(array, count) {
8837 if (count == null || count < 1) return [];
8838 var result = [];
8839 var i = 0, length = array.length;
8840 while (i < length) {
8841 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
8842 }
8843 return result;
8844}
8845
8846
8847/***/ }),
8848/* 274 */
8849/***/ (function(module, __webpack_exports__, __webpack_require__) {
8850
8851"use strict";
8852/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
8853/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
8854/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(30);
8855/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(130);
8856/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(1);
8857/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(164);
8858
8859
8860
8861
8862
8863
8864// Add your own custom functions to the Underscore object.
8865function mixin(obj) {
8866 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
8867 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
8868 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8869 var args = [this._wrapped];
8870 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
8871 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
8872 };
8873 });
8874 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
8875}
8876
8877
8878/***/ }),
8879/* 275 */
8880/***/ (function(module, __webpack_exports__, __webpack_require__) {
8881
8882"use strict";
8883/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(12);
8884/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(30);
8885/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(1);
8886/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(164);
8887
8888
8889
8890
8891
8892// Add all mutator `Array` functions to the wrapper.
8893Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
8894 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
8895 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8896 var obj = this._wrapped;
8897 if (obj != null) {
8898 method.apply(obj, arguments);
8899 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
8900 delete obj[0];
8901 }
8902 }
8903 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
8904 };
8905});
8906
8907// Add all accessor `Array` functions to the wrapper.
8908Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
8909 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
8910 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8911 var obj = this._wrapped;
8912 if (obj != null) obj = method.apply(obj, arguments);
8913 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
8914 };
8915});
8916
8917/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
8918
8919
8920/***/ }),
8921/* 276 */
8922/***/ (function(module, exports, __webpack_require__) {
8923
8924var core = __webpack_require__(2);
8925var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
8926module.exports = function stringify(it) { // eslint-disable-line no-unused-vars
8927 return $JSON.stringify.apply($JSON, arguments);
8928};
8929
8930
8931/***/ }),
8932/* 277 */
8933/***/ (function(module, exports, __webpack_require__) {
8934
8935__webpack_require__(278);
8936module.exports = __webpack_require__(2).Object.keys;
8937
8938
8939/***/ }),
8940/* 278 */
8941/***/ (function(module, exports, __webpack_require__) {
8942
8943// 19.1.2.14 Object.keys(O)
8944var toObject = __webpack_require__(33);
8945var $keys = __webpack_require__(45);
8946
8947__webpack_require__(98)('keys', function () {
8948 return function keys(it) {
8949 return $keys(toObject(it));
8950 };
8951});
8952
8953
8954/***/ }),
8955/* 279 */
8956/***/ (function(module, exports) {
8957
8958// Unique ID creation requires a high quality random # generator. In the
8959// browser this is a little complicated due to unknown quality of Math.random()
8960// and inconsistent support for the `crypto` API. We do the best we can via
8961// feature-detection
8962
8963// getRandomValues needs to be invoked in a context where "this" is a Crypto
8964// implementation. Also, find the complete implementation of crypto on IE11.
8965var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
8966 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
8967
8968if (getRandomValues) {
8969 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
8970 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
8971
8972 module.exports = function whatwgRNG() {
8973 getRandomValues(rnds8);
8974 return rnds8;
8975 };
8976} else {
8977 // Math.random()-based (RNG)
8978 //
8979 // If all else fails, use Math.random(). It's fast, but is of unspecified
8980 // quality.
8981 var rnds = new Array(16);
8982
8983 module.exports = function mathRNG() {
8984 for (var i = 0, r; i < 16; i++) {
8985 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
8986 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
8987 }
8988
8989 return rnds;
8990 };
8991}
8992
8993
8994/***/ }),
8995/* 280 */
8996/***/ (function(module, exports) {
8997
8998/**
8999 * Convert array of 16 byte values to UUID string format of the form:
9000 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
9001 */
9002var byteToHex = [];
9003for (var i = 0; i < 256; ++i) {
9004 byteToHex[i] = (i + 0x100).toString(16).substr(1);
9005}
9006
9007function bytesToUuid(buf, offset) {
9008 var i = offset || 0;
9009 var bth = byteToHex;
9010 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
9011 return ([bth[buf[i++]], bth[buf[i++]],
9012 bth[buf[i++]], bth[buf[i++]], '-',
9013 bth[buf[i++]], bth[buf[i++]], '-',
9014 bth[buf[i++]], bth[buf[i++]], '-',
9015 bth[buf[i++]], bth[buf[i++]], '-',
9016 bth[buf[i++]], bth[buf[i++]],
9017 bth[buf[i++]], bth[buf[i++]],
9018 bth[buf[i++]], bth[buf[i++]]]).join('');
9019}
9020
9021module.exports = bytesToUuid;
9022
9023
9024/***/ }),
9025/* 281 */
9026/***/ (function(module, exports, __webpack_require__) {
9027
9028"use strict";
9029
9030
9031/**
9032 * This is the common logic for both the Node.js and web browser
9033 * implementations of `debug()`.
9034 */
9035function setup(env) {
9036 createDebug.debug = createDebug;
9037 createDebug.default = createDebug;
9038 createDebug.coerce = coerce;
9039 createDebug.disable = disable;
9040 createDebug.enable = enable;
9041 createDebug.enabled = enabled;
9042 createDebug.humanize = __webpack_require__(282);
9043 Object.keys(env).forEach(function (key) {
9044 createDebug[key] = env[key];
9045 });
9046 /**
9047 * Active `debug` instances.
9048 */
9049
9050 createDebug.instances = [];
9051 /**
9052 * The currently active debug mode names, and names to skip.
9053 */
9054
9055 createDebug.names = [];
9056 createDebug.skips = [];
9057 /**
9058 * Map of special "%n" handling functions, for the debug "format" argument.
9059 *
9060 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
9061 */
9062
9063 createDebug.formatters = {};
9064 /**
9065 * Selects a color for a debug namespace
9066 * @param {String} namespace The namespace string for the for the debug instance to be colored
9067 * @return {Number|String} An ANSI color code for the given namespace
9068 * @api private
9069 */
9070
9071 function selectColor(namespace) {
9072 var hash = 0;
9073
9074 for (var i = 0; i < namespace.length; i++) {
9075 hash = (hash << 5) - hash + namespace.charCodeAt(i);
9076 hash |= 0; // Convert to 32bit integer
9077 }
9078
9079 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
9080 }
9081
9082 createDebug.selectColor = selectColor;
9083 /**
9084 * Create a debugger with the given `namespace`.
9085 *
9086 * @param {String} namespace
9087 * @return {Function}
9088 * @api public
9089 */
9090
9091 function createDebug(namespace) {
9092 var prevTime;
9093
9094 function debug() {
9095 // Disabled?
9096 if (!debug.enabled) {
9097 return;
9098 }
9099
9100 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9101 args[_key] = arguments[_key];
9102 }
9103
9104 var self = debug; // Set `diff` timestamp
9105
9106 var curr = Number(new Date());
9107 var ms = curr - (prevTime || curr);
9108 self.diff = ms;
9109 self.prev = prevTime;
9110 self.curr = curr;
9111 prevTime = curr;
9112 args[0] = createDebug.coerce(args[0]);
9113
9114 if (typeof args[0] !== 'string') {
9115 // Anything else let's inspect with %O
9116 args.unshift('%O');
9117 } // Apply any `formatters` transformations
9118
9119
9120 var index = 0;
9121 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
9122 // If we encounter an escaped % then don't increase the array index
9123 if (match === '%%') {
9124 return match;
9125 }
9126
9127 index++;
9128 var formatter = createDebug.formatters[format];
9129
9130 if (typeof formatter === 'function') {
9131 var val = args[index];
9132 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
9133
9134 args.splice(index, 1);
9135 index--;
9136 }
9137
9138 return match;
9139 }); // Apply env-specific formatting (colors, etc.)
9140
9141 createDebug.formatArgs.call(self, args);
9142 var logFn = self.log || createDebug.log;
9143 logFn.apply(self, args);
9144 }
9145
9146 debug.namespace = namespace;
9147 debug.enabled = createDebug.enabled(namespace);
9148 debug.useColors = createDebug.useColors();
9149 debug.color = selectColor(namespace);
9150 debug.destroy = destroy;
9151 debug.extend = extend; // Debug.formatArgs = formatArgs;
9152 // debug.rawLog = rawLog;
9153 // env-specific initialization logic for debug instances
9154
9155 if (typeof createDebug.init === 'function') {
9156 createDebug.init(debug);
9157 }
9158
9159 createDebug.instances.push(debug);
9160 return debug;
9161 }
9162
9163 function destroy() {
9164 var index = createDebug.instances.indexOf(this);
9165
9166 if (index !== -1) {
9167 createDebug.instances.splice(index, 1);
9168 return true;
9169 }
9170
9171 return false;
9172 }
9173
9174 function extend(namespace, delimiter) {
9175 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
9176 }
9177 /**
9178 * Enables a debug mode by namespaces. This can include modes
9179 * separated by a colon and wildcards.
9180 *
9181 * @param {String} namespaces
9182 * @api public
9183 */
9184
9185
9186 function enable(namespaces) {
9187 createDebug.save(namespaces);
9188 createDebug.names = [];
9189 createDebug.skips = [];
9190 var i;
9191 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
9192 var len = split.length;
9193
9194 for (i = 0; i < len; i++) {
9195 if (!split[i]) {
9196 // ignore empty strings
9197 continue;
9198 }
9199
9200 namespaces = split[i].replace(/\*/g, '.*?');
9201
9202 if (namespaces[0] === '-') {
9203 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
9204 } else {
9205 createDebug.names.push(new RegExp('^' + namespaces + '$'));
9206 }
9207 }
9208
9209 for (i = 0; i < createDebug.instances.length; i++) {
9210 var instance = createDebug.instances[i];
9211 instance.enabled = createDebug.enabled(instance.namespace);
9212 }
9213 }
9214 /**
9215 * Disable debug output.
9216 *
9217 * @api public
9218 */
9219
9220
9221 function disable() {
9222 createDebug.enable('');
9223 }
9224 /**
9225 * Returns true if the given mode name is enabled, false otherwise.
9226 *
9227 * @param {String} name
9228 * @return {Boolean}
9229 * @api public
9230 */
9231
9232
9233 function enabled(name) {
9234 if (name[name.length - 1] === '*') {
9235 return true;
9236 }
9237
9238 var i;
9239 var len;
9240
9241 for (i = 0, len = createDebug.skips.length; i < len; i++) {
9242 if (createDebug.skips[i].test(name)) {
9243 return false;
9244 }
9245 }
9246
9247 for (i = 0, len = createDebug.names.length; i < len; i++) {
9248 if (createDebug.names[i].test(name)) {
9249 return true;
9250 }
9251 }
9252
9253 return false;
9254 }
9255 /**
9256 * Coerce `val`.
9257 *
9258 * @param {Mixed} val
9259 * @return {Mixed}
9260 * @api private
9261 */
9262
9263
9264 function coerce(val) {
9265 if (val instanceof Error) {
9266 return val.stack || val.message;
9267 }
9268
9269 return val;
9270 }
9271
9272 createDebug.enable(createDebug.load());
9273 return createDebug;
9274}
9275
9276module.exports = setup;
9277
9278
9279
9280/***/ }),
9281/* 282 */
9282/***/ (function(module, exports) {
9283
9284/**
9285 * Helpers.
9286 */
9287
9288var s = 1000;
9289var m = s * 60;
9290var h = m * 60;
9291var d = h * 24;
9292var w = d * 7;
9293var y = d * 365.25;
9294
9295/**
9296 * Parse or format the given `val`.
9297 *
9298 * Options:
9299 *
9300 * - `long` verbose formatting [false]
9301 *
9302 * @param {String|Number} val
9303 * @param {Object} [options]
9304 * @throws {Error} throw an error if val is not a non-empty string or a number
9305 * @return {String|Number}
9306 * @api public
9307 */
9308
9309module.exports = function(val, options) {
9310 options = options || {};
9311 var type = typeof val;
9312 if (type === 'string' && val.length > 0) {
9313 return parse(val);
9314 } else if (type === 'number' && isFinite(val)) {
9315 return options.long ? fmtLong(val) : fmtShort(val);
9316 }
9317 throw new Error(
9318 'val is not a non-empty string or a valid number. val=' +
9319 JSON.stringify(val)
9320 );
9321};
9322
9323/**
9324 * Parse the given `str` and return milliseconds.
9325 *
9326 * @param {String} str
9327 * @return {Number}
9328 * @api private
9329 */
9330
9331function parse(str) {
9332 str = String(str);
9333 if (str.length > 100) {
9334 return;
9335 }
9336 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(
9337 str
9338 );
9339 if (!match) {
9340 return;
9341 }
9342 var n = parseFloat(match[1]);
9343 var type = (match[2] || 'ms').toLowerCase();
9344 switch (type) {
9345 case 'years':
9346 case 'year':
9347 case 'yrs':
9348 case 'yr':
9349 case 'y':
9350 return n * y;
9351 case 'weeks':
9352 case 'week':
9353 case 'w':
9354 return n * w;
9355 case 'days':
9356 case 'day':
9357 case 'd':
9358 return n * d;
9359 case 'hours':
9360 case 'hour':
9361 case 'hrs':
9362 case 'hr':
9363 case 'h':
9364 return n * h;
9365 case 'minutes':
9366 case 'minute':
9367 case 'mins':
9368 case 'min':
9369 case 'm':
9370 return n * m;
9371 case 'seconds':
9372 case 'second':
9373 case 'secs':
9374 case 'sec':
9375 case 's':
9376 return n * s;
9377 case 'milliseconds':
9378 case 'millisecond':
9379 case 'msecs':
9380 case 'msec':
9381 case 'ms':
9382 return n;
9383 default:
9384 return undefined;
9385 }
9386}
9387
9388/**
9389 * Short format for `ms`.
9390 *
9391 * @param {Number} ms
9392 * @return {String}
9393 * @api private
9394 */
9395
9396function fmtShort(ms) {
9397 var msAbs = Math.abs(ms);
9398 if (msAbs >= d) {
9399 return Math.round(ms / d) + 'd';
9400 }
9401 if (msAbs >= h) {
9402 return Math.round(ms / h) + 'h';
9403 }
9404 if (msAbs >= m) {
9405 return Math.round(ms / m) + 'm';
9406 }
9407 if (msAbs >= s) {
9408 return Math.round(ms / s) + 's';
9409 }
9410 return ms + 'ms';
9411}
9412
9413/**
9414 * Long format for `ms`.
9415 *
9416 * @param {Number} ms
9417 * @return {String}
9418 * @api private
9419 */
9420
9421function fmtLong(ms) {
9422 var msAbs = Math.abs(ms);
9423 if (msAbs >= d) {
9424 return plural(ms, msAbs, d, 'day');
9425 }
9426 if (msAbs >= h) {
9427 return plural(ms, msAbs, h, 'hour');
9428 }
9429 if (msAbs >= m) {
9430 return plural(ms, msAbs, m, 'minute');
9431 }
9432 if (msAbs >= s) {
9433 return plural(ms, msAbs, s, 'second');
9434 }
9435 return ms + ' ms';
9436}
9437
9438/**
9439 * Pluralization helper.
9440 */
9441
9442function plural(ms, msAbs, n, name) {
9443 var isPlural = msAbs >= n * 1.5;
9444 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
9445}
9446
9447
9448/***/ }),
9449/* 283 */
9450/***/ (function(module, exports, __webpack_require__) {
9451
9452__webpack_require__(284);
9453module.exports = __webpack_require__(2).Object.getPrototypeOf;
9454
9455
9456/***/ }),
9457/* 284 */
9458/***/ (function(module, exports, __webpack_require__) {
9459
9460// 19.1.2.9 Object.getPrototypeOf(O)
9461var toObject = __webpack_require__(33);
9462var $getPrototypeOf = __webpack_require__(108);
9463
9464__webpack_require__(98)('getPrototypeOf', function () {
9465 return function getPrototypeOf(it) {
9466 return $getPrototypeOf(toObject(it));
9467 };
9468});
9469
9470
9471/***/ }),
9472/* 285 */
9473/***/ (function(module, exports, __webpack_require__) {
9474
9475"use strict";
9476
9477
9478var _defineProperty = __webpack_require__(67);
9479
9480var _defineProperty2 = _interopRequireDefault(_defineProperty);
9481
9482function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9483
9484var AV = __webpack_require__(39);
9485var AppRouter = __webpack_require__(288);
9486
9487var _require = __webpack_require__(17),
9488 isNullOrUndefined = _require.isNullOrUndefined;
9489
9490var _require2 = __webpack_require__(0),
9491 extend = _require2.extend,
9492 isObject = _require2.isObject,
9493 isEmpty = _require2.isEmpty;
9494
9495var isCNApp = function isCNApp(appId) {
9496 return appId.slice(-9) !== '-MdYXbMMI';
9497};
9498
9499var fillServerURLs = function fillServerURLs(url) {
9500 return {
9501 push: url,
9502 stats: url,
9503 engine: url,
9504 api: url,
9505 rtm: url
9506 };
9507};
9508
9509function getDefaultServerURLs(appId) {
9510 if (isCNApp(appId)) {
9511 return {};
9512 }
9513 var id = appId.slice(0, 8).toLowerCase();
9514 var domain = 'lncldglobal.com';
9515 return {
9516 push: 'https://' + id + '.push.' + domain,
9517 stats: 'https://' + id + '.stats.' + domain,
9518 engine: 'https://' + id + '.engine.' + domain,
9519 api: 'https://' + id + '.api.' + domain,
9520 rtm: 'https://' + id + '.rtm.' + domain
9521 };
9522}
9523
9524var _disableAppRouter = false;
9525var _initialized = false;
9526
9527/**
9528 * URLs for services
9529 * @typedef {Object} ServerURLs
9530 * @property {String} [api] serverURL for API service
9531 * @property {String} [engine] serverURL for engine service
9532 * @property {String} [stats] serverURL for stats service
9533 * @property {String} [push] serverURL for push service
9534 * @property {String} [rtm] serverURL for LiveQuery service
9535 */
9536
9537/**
9538 * Call this method first to set up your authentication tokens for AV.
9539 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
9540 * @function AV.init
9541 * @param {Object} options
9542 * @param {String} options.appId application id
9543 * @param {String} options.appKey application key
9544 * @param {String} [options.masterKey] application master key
9545 * @param {Boolean} [options.production]
9546 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
9547 * @param {Boolean} [options.disableCurrentUser]
9548 */
9549AV.init = function init(options) {
9550 if (!isObject(options)) {
9551 return AV.init({
9552 appId: options,
9553 appKey: arguments.length <= 1 ? undefined : arguments[1],
9554 masterKey: arguments.length <= 2 ? undefined : arguments[2]
9555 });
9556 }
9557 var appId = options.appId,
9558 appKey = options.appKey,
9559 masterKey = options.masterKey,
9560 hookKey = options.hookKey,
9561 serverURL = options.serverURL,
9562 _options$serverURLs = options.serverURLs,
9563 serverURLs = _options$serverURLs === undefined ? serverURL : _options$serverURLs,
9564 disableCurrentUser = options.disableCurrentUser,
9565 production = options.production,
9566 realtime = options.realtime;
9567
9568 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.');
9569 if (!appId) throw new TypeError('appId must be a string');
9570 if (!appKey) throw new TypeError('appKey must be a string');
9571 if ('Weapp' !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
9572 if (isCNApp(appId)) {
9573 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
9574 throw new TypeError('serverURL option is required for apps from CN region');
9575 }
9576 }
9577 if (appId !== AV._config.applicationId) {
9578 // overwrite all keys when reinitializing as a new app
9579 AV._config.masterKey = masterKey;
9580 AV._config.hookKey = hookKey;
9581 } else {
9582 if (masterKey) AV._config.masterKey = masterKey;
9583 if (hookKey) AV._config.hookKey = hookKey;
9584 }
9585 AV._config.applicationId = appId;
9586 AV._config.applicationKey = appKey;
9587 if (!isNullOrUndefined(production)) {
9588 AV.setProduction(production);
9589 }
9590 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
9591 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
9592 if (!disableAppRouter) {
9593 AV._appRouter = new AppRouter(AV);
9594 }
9595 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
9596 if (realtime) {
9597 AV._config.realtime = realtime;
9598 } else if (AV._sharedConfig.liveQueryRealtime) {
9599 var _AV$_config$serverURL = AV._config.serverURLs,
9600 api = _AV$_config$serverURL.api,
9601 rtm = _AV$_config$serverURL.rtm;
9602
9603 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
9604 appId: appId,
9605 appKey: appKey,
9606 server: {
9607 api: api,
9608 RTMRouter: rtm
9609 }
9610 });
9611 }
9612 _initialized = true;
9613};
9614
9615// If we're running in node.js, allow using the master key.
9616if (false) {
9617 AV.Cloud = AV.Cloud || {};
9618 /**
9619 * Switches the LeanCloud SDK to using the Master key. The Master key grants
9620 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
9621 * other restrictions that are applied to the client SDKs.
9622 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
9623 * </p>
9624 */
9625 AV.Cloud.useMasterKey = function () {
9626 AV._config.useMasterKey = true;
9627 };
9628}
9629
9630/**
9631 * Call this method to set production environment variable.
9632 * @function AV.setProduction
9633 * @param {Boolean} production True is production environment,and
9634 * it's true by default.
9635 */
9636AV.setProduction = function (production) {
9637 if (!isNullOrUndefined(production)) {
9638 AV._config.production = production ? 1 : 0;
9639 } else {
9640 // change to default value
9641 AV._config.production = null;
9642 }
9643};
9644
9645AV._setServerURLs = function (urls) {
9646 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
9647
9648 if (typeof urls !== 'string') {
9649 extend(AV._config.serverURLs, urls);
9650 } else {
9651 AV._config.serverURLs = fillServerURLs(urls);
9652 }
9653 if (disableAppRouter) {
9654 if (AV._appRouter) {
9655 AV._appRouter.disable();
9656 } else {
9657 _disableAppRouter = true;
9658 }
9659 }
9660};
9661/**
9662 * Set server URLs for services.
9663 * @function AV.setServerURL
9664 * @since 4.3.0
9665 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
9666 * You can also set them when initializing SDK with `options.serverURL`
9667 */
9668AV.setServerURL = function (urls) {
9669 return AV._setServerURLs(urls);
9670};
9671AV.setServerURLs = AV.setServerURL;
9672
9673AV.keepErrorRawMessage = function (value) {
9674 AV._sharedConfig.keepErrorRawMessage = value;
9675};
9676
9677/**
9678 * Set a deadline for requests to complete.
9679 * Note that file upload requests are not affected.
9680 * @function AV.setRequestTimeout
9681 * @since 3.6.0
9682 * @param {number} ms
9683 */
9684AV.setRequestTimeout = function (ms) {
9685 AV._config.requestTimeout = ms;
9686};
9687
9688// backword compatible
9689AV.initialize = AV.init;
9690
9691var defineConfig = function defineConfig(property) {
9692 return (0, _defineProperty2.default)(AV, property, {
9693 get: function get() {
9694 return AV._config[property];
9695 },
9696 set: function set(value) {
9697 AV._config[property] = value;
9698 }
9699 });
9700};
9701
9702['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
9703
9704/***/ }),
9705/* 286 */
9706/***/ (function(module, exports, __webpack_require__) {
9707
9708__webpack_require__(287);
9709var $Object = __webpack_require__(2).Object;
9710module.exports = function defineProperty(it, key, desc) {
9711 return $Object.defineProperty(it, key, desc);
9712};
9713
9714
9715/***/ }),
9716/* 287 */
9717/***/ (function(module, exports, __webpack_require__) {
9718
9719var $export = __webpack_require__(8);
9720// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
9721$export($export.S + $export.F * !__webpack_require__(19), 'Object', { defineProperty: __webpack_require__(20).f });
9722
9723
9724/***/ }),
9725/* 288 */
9726/***/ (function(module, exports, __webpack_require__) {
9727
9728"use strict";
9729
9730
9731var ajax = __webpack_require__(68);
9732var Cache = __webpack_require__(169);
9733
9734function AppRouter(AV) {
9735 var _this = this;
9736
9737 this.AV = AV;
9738 this.lockedUntil = 0;
9739 Cache.getAsync('serverURLs').then(function (data) {
9740 if (_this.disabled) return;
9741 if (!data) return _this.lock(0);
9742 var serverURLs = data.serverURLs,
9743 lockedUntil = data.lockedUntil;
9744
9745 _this.AV._setServerURLs(serverURLs, false);
9746 _this.lockedUntil = lockedUntil;
9747 }).catch(function () {
9748 return _this.lock(0);
9749 });
9750}
9751
9752AppRouter.prototype.disable = function disable() {
9753 this.disabled = true;
9754};
9755AppRouter.prototype.lock = function lock(ttl) {
9756 this.lockedUntil = Date.now() + ttl;
9757};
9758AppRouter.prototype.refresh = function refresh() {
9759 var _this2 = this;
9760
9761 if (this.disabled) return;
9762 if (Date.now() < this.lockedUntil) return;
9763 this.lock(10);
9764 var url = 'https://app-router.com/2/route';
9765 return ajax({
9766 method: 'get',
9767 url: url,
9768 query: {
9769 appId: this.AV.applicationId
9770 }
9771 }).then(function (servers) {
9772 if (_this2.disabled) return;
9773 var ttl = servers.ttl;
9774 if (!ttl) throw new Error('missing ttl');
9775 ttl = ttl * 1000;
9776 var protocal = 'https://';
9777 var serverURLs = {
9778 push: protocal + servers.push_server,
9779 stats: protocal + servers.stats_server,
9780 engine: protocal + servers.engine_server,
9781 api: protocal + servers.api_server
9782 };
9783 _this2.AV._setServerURLs(serverURLs, false);
9784 _this2.lock(ttl);
9785 return Cache.setAsync('serverURLs', {
9786 serverURLs: serverURLs,
9787 lockedUntil: _this2.lockedUntil
9788 }, ttl);
9789 }).catch(function (error) {
9790 // bypass all errors
9791 console.warn('refresh server URLs failed: ' + error.message);
9792 _this2.lock(600);
9793 });
9794};
9795
9796module.exports = AppRouter;
9797
9798/***/ }),
9799/* 289 */
9800/***/ (function(module, exports, __webpack_require__) {
9801
9802__webpack_require__(42);
9803__webpack_require__(34);
9804module.exports = __webpack_require__(100).f('iterator');
9805
9806
9807/***/ }),
9808/* 290 */
9809/***/ (function(module, exports, __webpack_require__) {
9810
9811__webpack_require__(172);
9812__webpack_require__(57);
9813__webpack_require__(293);
9814__webpack_require__(294);
9815module.exports = __webpack_require__(2).Symbol;
9816
9817
9818/***/ }),
9819/* 291 */
9820/***/ (function(module, exports, __webpack_require__) {
9821
9822// all enumerable object keys, includes symbols
9823var getKeys = __webpack_require__(45);
9824var gOPS = __webpack_require__(102);
9825var pIE = __webpack_require__(69);
9826module.exports = function (it) {
9827 var result = getKeys(it);
9828 var getSymbols = gOPS.f;
9829 if (getSymbols) {
9830 var symbols = getSymbols(it);
9831 var isEnum = pIE.f;
9832 var i = 0;
9833 var key;
9834 while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
9835 } return result;
9836};
9837
9838
9839/***/ }),
9840/* 292 */
9841/***/ (function(module, exports, __webpack_require__) {
9842
9843// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
9844var toIObject = __webpack_require__(27);
9845var gOPN = __webpack_require__(174).f;
9846var toString = {}.toString;
9847
9848var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
9849 ? Object.getOwnPropertyNames(window) : [];
9850
9851var getWindowNames = function (it) {
9852 try {
9853 return gOPN(it);
9854 } catch (e) {
9855 return windowNames.slice();
9856 }
9857};
9858
9859module.exports.f = function getOwnPropertyNames(it) {
9860 return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
9861};
9862
9863
9864/***/ }),
9865/* 293 */
9866/***/ (function(module, exports, __webpack_require__) {
9867
9868__webpack_require__(101)('asyncIterator');
9869
9870
9871/***/ }),
9872/* 294 */
9873/***/ (function(module, exports, __webpack_require__) {
9874
9875__webpack_require__(101)('observable');
9876
9877
9878/***/ }),
9879/* 295 */
9880/***/ (function(module, exports, __webpack_require__) {
9881
9882"use strict";
9883// Copyright (c) 2015-2017 David M. Lee, II
9884
9885
9886/**
9887 * Local reference to TimeoutError
9888 * @private
9889 */
9890var TimeoutError;
9891
9892/**
9893 * Rejects a promise with a {@link TimeoutError} if it does not settle within
9894 * the specified timeout.
9895 *
9896 * @param {Promise} promise The promise.
9897 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
9898 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
9899 * `TimeoutError`, whichever settles first.
9900 */
9901var timeout = module.exports.timeout = function(promise, timeoutMillis) {
9902 var error = new TimeoutError(),
9903 timeout;
9904
9905 return Promise.race([
9906 promise,
9907 new Promise(function(resolve, reject) {
9908 timeout = setTimeout(function() {
9909 reject(error);
9910 }, timeoutMillis);
9911 }),
9912 ]).then(function(v) {
9913 clearTimeout(timeout);
9914 return v;
9915 }, function(err) {
9916 clearTimeout(timeout);
9917 throw err;
9918 });
9919};
9920
9921/**
9922 * Exception indicating that the timeout expired.
9923 */
9924TimeoutError = module.exports.TimeoutError = function() {
9925 Error.call(this)
9926 this.stack = Error().stack
9927 this.message = 'Timeout';
9928};
9929
9930TimeoutError.prototype = Object.create(Error.prototype);
9931TimeoutError.prototype.name = "TimeoutError";
9932
9933
9934/***/ }),
9935/* 296 */
9936/***/ (function(module, exports, __webpack_require__) {
9937
9938"use strict";
9939
9940
9941var _ = __webpack_require__(0);
9942
9943module.exports = function (AV) {
9944 var eventSplitter = /\s+/;
9945 var slice = Array.prototype.slice;
9946
9947 /**
9948 * @class
9949 *
9950 * <p>AV.Events is a fork of Backbone's Events module, provided for your
9951 * convenience.</p>
9952 *
9953 * <p>A module that can be mixed in to any object in order to provide
9954 * it with custom events. You may bind callback functions to an event
9955 * with `on`, or remove these functions with `off`.
9956 * Triggering an event fires all callbacks in the order that `on` was
9957 * called.
9958 *
9959 * @private
9960 * @example
9961 * var object = {};
9962 * _.extend(object, AV.Events);
9963 * object.on('expand', function(){ alert('expanded'); });
9964 * object.trigger('expand');</pre></p>
9965 *
9966 */
9967 AV.Events = {
9968 /**
9969 * Bind one or more space separated events, `events`, to a `callback`
9970 * function. Passing `"all"` will bind the callback to all events fired.
9971 */
9972 on: function on(events, callback, context) {
9973 var calls, event, node, tail, list;
9974 if (!callback) {
9975 return this;
9976 }
9977 events = events.split(eventSplitter);
9978 calls = this._callbacks || (this._callbacks = {});
9979
9980 // Create an immutable callback list, allowing traversal during
9981 // modification. The tail is an empty object that will always be used
9982 // as the next node.
9983 event = events.shift();
9984 while (event) {
9985 list = calls[event];
9986 node = list ? list.tail : {};
9987 node.next = tail = {};
9988 node.context = context;
9989 node.callback = callback;
9990 calls[event] = { tail: tail, next: list ? list.next : node };
9991 event = events.shift();
9992 }
9993
9994 return this;
9995 },
9996
9997 /**
9998 * Remove one or many callbacks. If `context` is null, removes all callbacks
9999 * with that function. If `callback` is null, removes all callbacks for the
10000 * event. If `events` is null, removes all bound callbacks for all events.
10001 */
10002 off: function off(events, callback, context) {
10003 var event, calls, node, tail, cb, ctx;
10004
10005 // No events, or removing *all* events.
10006 if (!(calls = this._callbacks)) {
10007 return;
10008 }
10009 if (!(events || callback || context)) {
10010 delete this._callbacks;
10011 return this;
10012 }
10013
10014 // Loop through the listed events and contexts, splicing them out of the
10015 // linked list of callbacks if appropriate.
10016 events = events ? events.split(eventSplitter) : _.keys(calls);
10017 event = events.shift();
10018 while (event) {
10019 node = calls[event];
10020 delete calls[event];
10021 if (!node || !(callback || context)) {
10022 continue;
10023 }
10024 // Create a new list, omitting the indicated callbacks.
10025 tail = node.tail;
10026 node = node.next;
10027 while (node !== tail) {
10028 cb = node.callback;
10029 ctx = node.context;
10030 if (callback && cb !== callback || context && ctx !== context) {
10031 this.on(event, cb, ctx);
10032 }
10033 node = node.next;
10034 }
10035 event = events.shift();
10036 }
10037
10038 return this;
10039 },
10040
10041 /**
10042 * Trigger one or many events, firing all bound callbacks. Callbacks are
10043 * passed the same arguments as `trigger` is, apart from the event name
10044 * (unless you're listening on `"all"`, which will cause your callback to
10045 * receive the true name of the event as the first argument).
10046 */
10047 trigger: function trigger(events) {
10048 var event, node, calls, tail, args, all, rest;
10049 if (!(calls = this._callbacks)) {
10050 return this;
10051 }
10052 all = calls.all;
10053 events = events.split(eventSplitter);
10054 rest = slice.call(arguments, 1);
10055
10056 // For each event, walk through the linked list of callbacks twice,
10057 // first to trigger the event, then to trigger any `"all"` callbacks.
10058 event = events.shift();
10059 while (event) {
10060 node = calls[event];
10061 if (node) {
10062 tail = node.tail;
10063 while ((node = node.next) !== tail) {
10064 node.callback.apply(node.context || this, rest);
10065 }
10066 }
10067 node = all;
10068 if (node) {
10069 tail = node.tail;
10070 args = [event].concat(rest);
10071 while ((node = node.next) !== tail) {
10072 node.callback.apply(node.context || this, args);
10073 }
10074 }
10075 event = events.shift();
10076 }
10077
10078 return this;
10079 }
10080 };
10081
10082 /**
10083 * @function
10084 */
10085 AV.Events.bind = AV.Events.on;
10086
10087 /**
10088 * @function
10089 */
10090 AV.Events.unbind = AV.Events.off;
10091};
10092
10093/***/ }),
10094/* 297 */
10095/***/ (function(module, exports, __webpack_require__) {
10096
10097"use strict";
10098
10099
10100var _promise = __webpack_require__(3);
10101
10102var _promise2 = _interopRequireDefault(_promise);
10103
10104function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10105
10106var _ = __webpack_require__(0);
10107
10108/*global navigator: false */
10109module.exports = function (AV) {
10110 /**
10111 * Creates a new GeoPoint with any of the following forms:<br>
10112 * @example
10113 * new GeoPoint(otherGeoPoint)
10114 * new GeoPoint(30, 30)
10115 * new GeoPoint([30, 30])
10116 * new GeoPoint({latitude: 30, longitude: 30})
10117 * new GeoPoint() // defaults to (0, 0)
10118 * @class
10119 *
10120 * <p>Represents a latitude / longitude point that may be associated
10121 * with a key in a AVObject or used as a reference point for geo queries.
10122 * This allows proximity-based queries on the key.</p>
10123 *
10124 * <p>Only one key in a class may contain a GeoPoint.</p>
10125 *
10126 * <p>Example:<pre>
10127 * var point = new AV.GeoPoint(30.0, -20.0);
10128 * var object = new AV.Object("PlaceObject");
10129 * object.set("location", point);
10130 * object.save();</pre></p>
10131 */
10132 AV.GeoPoint = function (arg1, arg2) {
10133 if (_.isArray(arg1)) {
10134 AV.GeoPoint._validate(arg1[0], arg1[1]);
10135 this.latitude = arg1[0];
10136 this.longitude = arg1[1];
10137 } else if (_.isObject(arg1)) {
10138 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
10139 this.latitude = arg1.latitude;
10140 this.longitude = arg1.longitude;
10141 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
10142 AV.GeoPoint._validate(arg1, arg2);
10143 this.latitude = arg1;
10144 this.longitude = arg2;
10145 } else {
10146 this.latitude = 0;
10147 this.longitude = 0;
10148 }
10149
10150 // Add properties so that anyone using Webkit or Mozilla will get an error
10151 // if they try to set values that are out of bounds.
10152 var self = this;
10153 if (this.__defineGetter__ && this.__defineSetter__) {
10154 // Use _latitude and _longitude to actually store the values, and add
10155 // getters and setters for latitude and longitude.
10156 this._latitude = this.latitude;
10157 this._longitude = this.longitude;
10158 this.__defineGetter__('latitude', function () {
10159 return self._latitude;
10160 });
10161 this.__defineGetter__('longitude', function () {
10162 return self._longitude;
10163 });
10164 this.__defineSetter__('latitude', function (val) {
10165 AV.GeoPoint._validate(val, self.longitude);
10166 self._latitude = val;
10167 });
10168 this.__defineSetter__('longitude', function (val) {
10169 AV.GeoPoint._validate(self.latitude, val);
10170 self._longitude = val;
10171 });
10172 }
10173 };
10174
10175 /**
10176 * @lends AV.GeoPoint.prototype
10177 * @property {float} latitude North-south portion of the coordinate, in range
10178 * [-90, 90]. Throws an exception if set out of range in a modern browser.
10179 * @property {float} longitude East-west portion of the coordinate, in range
10180 * [-180, 180]. Throws if set out of range in a modern browser.
10181 */
10182
10183 /**
10184 * Throws an exception if the given lat-long is out of bounds.
10185 * @private
10186 */
10187 AV.GeoPoint._validate = function (latitude, longitude) {
10188 if (latitude < -90.0) {
10189 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
10190 }
10191 if (latitude > 90.0) {
10192 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
10193 }
10194 if (longitude < -180.0) {
10195 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
10196 }
10197 if (longitude > 180.0) {
10198 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
10199 }
10200 };
10201
10202 /**
10203 * Creates a GeoPoint with the user's current location, if available.
10204 * @return {Promise.<AV.GeoPoint>}
10205 */
10206 AV.GeoPoint.current = function () {
10207 return new _promise2.default(function (resolve, reject) {
10208 navigator.geolocation.getCurrentPosition(function (location) {
10209 resolve(new AV.GeoPoint({
10210 latitude: location.coords.latitude,
10211 longitude: location.coords.longitude
10212 }));
10213 }, reject);
10214 });
10215 };
10216
10217 _.extend(AV.GeoPoint.prototype,
10218 /** @lends AV.GeoPoint.prototype */{
10219 /**
10220 * Returns a JSON representation of the GeoPoint, suitable for AV.
10221 * @return {Object}
10222 */
10223 toJSON: function toJSON() {
10224 AV.GeoPoint._validate(this.latitude, this.longitude);
10225 return {
10226 __type: 'GeoPoint',
10227 latitude: this.latitude,
10228 longitude: this.longitude
10229 };
10230 },
10231
10232 /**
10233 * Returns the distance from this GeoPoint to another in radians.
10234 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10235 * @return {Number}
10236 */
10237 radiansTo: function radiansTo(point) {
10238 var d2r = Math.PI / 180.0;
10239 var lat1rad = this.latitude * d2r;
10240 var long1rad = this.longitude * d2r;
10241 var lat2rad = point.latitude * d2r;
10242 var long2rad = point.longitude * d2r;
10243 var deltaLat = lat1rad - lat2rad;
10244 var deltaLong = long1rad - long2rad;
10245 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
10246 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2);
10247 // Square of half the straight line chord distance between both points.
10248 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
10249 a = Math.min(1.0, a);
10250 return 2 * Math.asin(Math.sqrt(a));
10251 },
10252
10253 /**
10254 * Returns the distance from this GeoPoint to another in kilometers.
10255 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10256 * @return {Number}
10257 */
10258 kilometersTo: function kilometersTo(point) {
10259 return this.radiansTo(point) * 6371.0;
10260 },
10261
10262 /**
10263 * Returns the distance from this GeoPoint to another in miles.
10264 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10265 * @return {Number}
10266 */
10267 milesTo: function milesTo(point) {
10268 return this.radiansTo(point) * 3958.8;
10269 }
10270 });
10271};
10272
10273/***/ }),
10274/* 298 */
10275/***/ (function(module, exports, __webpack_require__) {
10276
10277"use strict";
10278
10279
10280var _ = __webpack_require__(0);
10281
10282module.exports = function (AV) {
10283 var PUBLIC_KEY = '*';
10284
10285 /**
10286 * Creates a new ACL.
10287 * If no argument is given, the ACL has no permissions for anyone.
10288 * If the argument is a AV.User, the ACL will have read and write
10289 * permission for only that user.
10290 * If the argument is any other JSON object, that object will be interpretted
10291 * as a serialized ACL created with toJSON().
10292 * @see AV.Object#setACL
10293 * @class
10294 *
10295 * <p>An ACL, or Access Control List can be added to any
10296 * <code>AV.Object</code> to restrict access to only a subset of users
10297 * of your application.</p>
10298 */
10299 AV.ACL = function (arg1) {
10300 var self = this;
10301 self.permissionsById = {};
10302 if (_.isObject(arg1)) {
10303 if (arg1 instanceof AV.User) {
10304 self.setReadAccess(arg1, true);
10305 self.setWriteAccess(arg1, true);
10306 } else {
10307 if (_.isFunction(arg1)) {
10308 throw new Error('AV.ACL() called with a function. Did you forget ()?');
10309 }
10310 AV._objectEach(arg1, function (accessList, userId) {
10311 if (!_.isString(userId)) {
10312 throw new Error('Tried to create an ACL with an invalid userId.');
10313 }
10314 self.permissionsById[userId] = {};
10315 AV._objectEach(accessList, function (allowed, permission) {
10316 if (permission !== 'read' && permission !== 'write') {
10317 throw new Error('Tried to create an ACL with an invalid permission type.');
10318 }
10319 if (!_.isBoolean(allowed)) {
10320 throw new Error('Tried to create an ACL with an invalid permission value.');
10321 }
10322 self.permissionsById[userId][permission] = allowed;
10323 });
10324 });
10325 }
10326 }
10327 };
10328
10329 /**
10330 * Returns a JSON-encoded version of the ACL.
10331 * @return {Object}
10332 */
10333 AV.ACL.prototype.toJSON = function () {
10334 return _.clone(this.permissionsById);
10335 };
10336
10337 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
10338 if (userId instanceof AV.User) {
10339 userId = userId.id;
10340 } else if (userId instanceof AV.Role) {
10341 userId = 'role:' + userId.getName();
10342 }
10343 if (!_.isString(userId)) {
10344 throw new Error('userId must be a string.');
10345 }
10346 if (!_.isBoolean(allowed)) {
10347 throw new Error('allowed must be either true or false.');
10348 }
10349 var permissions = this.permissionsById[userId];
10350 if (!permissions) {
10351 if (!allowed) {
10352 // The user already doesn't have this permission, so no action needed.
10353 return;
10354 } else {
10355 permissions = {};
10356 this.permissionsById[userId] = permissions;
10357 }
10358 }
10359
10360 if (allowed) {
10361 this.permissionsById[userId][accessType] = true;
10362 } else {
10363 delete permissions[accessType];
10364 if (_.isEmpty(permissions)) {
10365 delete this.permissionsById[userId];
10366 }
10367 }
10368 };
10369
10370 AV.ACL.prototype._getAccess = function (accessType, userId) {
10371 if (userId instanceof AV.User) {
10372 userId = userId.id;
10373 } else if (userId instanceof AV.Role) {
10374 userId = 'role:' + userId.getName();
10375 }
10376 var permissions = this.permissionsById[userId];
10377 if (!permissions) {
10378 return false;
10379 }
10380 return permissions[accessType] ? true : false;
10381 };
10382
10383 /**
10384 * Set whether the given user is allowed to read this object.
10385 * @param userId An instance of AV.User or its objectId.
10386 * @param {Boolean} allowed Whether that user should have read access.
10387 */
10388 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
10389 this._setAccess('read', userId, allowed);
10390 };
10391
10392 /**
10393 * Get whether the given user id is *explicitly* allowed to read this object.
10394 * Even if this returns false, the user may still be able to access it if
10395 * getPublicReadAccess returns true or a role that the user belongs to has
10396 * write access.
10397 * @param userId An instance of AV.User or its objectId, or a AV.Role.
10398 * @return {Boolean}
10399 */
10400 AV.ACL.prototype.getReadAccess = function (userId) {
10401 return this._getAccess('read', userId);
10402 };
10403
10404 /**
10405 * Set whether the given user id is allowed to write this object.
10406 * @param userId An instance of AV.User or its objectId, or a AV.Role..
10407 * @param {Boolean} allowed Whether that user should have write access.
10408 */
10409 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
10410 this._setAccess('write', userId, allowed);
10411 };
10412
10413 /**
10414 * Get whether the given user id is *explicitly* allowed to write this object.
10415 * Even if this returns false, the user may still be able to write it if
10416 * getPublicWriteAccess returns true or a role that the user belongs to has
10417 * write access.
10418 * @param userId An instance of AV.User or its objectId, or a AV.Role.
10419 * @return {Boolean}
10420 */
10421 AV.ACL.prototype.getWriteAccess = function (userId) {
10422 return this._getAccess('write', userId);
10423 };
10424
10425 /**
10426 * Set whether the public is allowed to read this object.
10427 * @param {Boolean} allowed
10428 */
10429 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
10430 this.setReadAccess(PUBLIC_KEY, allowed);
10431 };
10432
10433 /**
10434 * Get whether the public is allowed to read this object.
10435 * @return {Boolean}
10436 */
10437 AV.ACL.prototype.getPublicReadAccess = function () {
10438 return this.getReadAccess(PUBLIC_KEY);
10439 };
10440
10441 /**
10442 * Set whether the public is allowed to write this object.
10443 * @param {Boolean} allowed
10444 */
10445 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
10446 this.setWriteAccess(PUBLIC_KEY, allowed);
10447 };
10448
10449 /**
10450 * Get whether the public is allowed to write this object.
10451 * @return {Boolean}
10452 */
10453 AV.ACL.prototype.getPublicWriteAccess = function () {
10454 return this.getWriteAccess(PUBLIC_KEY);
10455 };
10456
10457 /**
10458 * Get whether users belonging to the given role are allowed
10459 * to read this object. Even if this returns false, the role may
10460 * still be able to write it if a parent role has read access.
10461 *
10462 * @param role The name of the role, or a AV.Role object.
10463 * @return {Boolean} true if the role has read access. false otherwise.
10464 * @throws {String} If role is neither a AV.Role nor a String.
10465 */
10466 AV.ACL.prototype.getRoleReadAccess = function (role) {
10467 if (role instanceof AV.Role) {
10468 // Normalize to the String name
10469 role = role.getName();
10470 }
10471 if (_.isString(role)) {
10472 return this.getReadAccess('role:' + role);
10473 }
10474 throw new Error('role must be a AV.Role or a String');
10475 };
10476
10477 /**
10478 * Get whether users belonging to the given role are allowed
10479 * to write this object. Even if this returns false, the role may
10480 * still be able to write it if a parent role has write access.
10481 *
10482 * @param role The name of the role, or a AV.Role object.
10483 * @return {Boolean} true if the role has write access. false otherwise.
10484 * @throws {String} If role is neither a AV.Role nor a String.
10485 */
10486 AV.ACL.prototype.getRoleWriteAccess = function (role) {
10487 if (role instanceof AV.Role) {
10488 // Normalize to the String name
10489 role = role.getName();
10490 }
10491 if (_.isString(role)) {
10492 return this.getWriteAccess('role:' + role);
10493 }
10494 throw new Error('role must be a AV.Role or a String');
10495 };
10496
10497 /**
10498 * Set whether users belonging to the given role are allowed
10499 * to read this object.
10500 *
10501 * @param role The name of the role, or a AV.Role object.
10502 * @param {Boolean} allowed Whether the given role can read this object.
10503 * @throws {String} If role is neither a AV.Role nor a String.
10504 */
10505 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
10506 if (role instanceof AV.Role) {
10507 // Normalize to the String name
10508 role = role.getName();
10509 }
10510 if (_.isString(role)) {
10511 this.setReadAccess('role:' + role, allowed);
10512 return;
10513 }
10514 throw new Error('role must be a AV.Role or a String');
10515 };
10516
10517 /**
10518 * Set whether users belonging to the given role are allowed
10519 * to write this object.
10520 *
10521 * @param role The name of the role, or a AV.Role object.
10522 * @param {Boolean} allowed Whether the given role can write this object.
10523 * @throws {String} If role is neither a AV.Role nor a String.
10524 */
10525 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
10526 if (role instanceof AV.Role) {
10527 // Normalize to the String name
10528 role = role.getName();
10529 }
10530 if (_.isString(role)) {
10531 this.setWriteAccess('role:' + role, allowed);
10532 return;
10533 }
10534 throw new Error('role must be a AV.Role or a String');
10535 };
10536};
10537
10538/***/ }),
10539/* 299 */
10540/***/ (function(module, exports, __webpack_require__) {
10541
10542"use strict";
10543
10544
10545var _ = __webpack_require__(0);
10546
10547module.exports = function (AV) {
10548 /**
10549 * @private
10550 * @class
10551 * A AV.Op is an atomic operation that can be applied to a field in a
10552 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
10553 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
10554 * is a AV.Op.Unset. These operations are stored in a AV.Object and
10555 * sent to the server as part of <code>object.save()</code> operations.
10556 * Instances of AV.Op should be immutable.
10557 *
10558 * You should not create subclasses of AV.Op or instantiate AV.Op
10559 * directly.
10560 */
10561 AV.Op = function () {
10562 this._initialize.apply(this, arguments);
10563 };
10564
10565 _.extend(AV.Op.prototype,
10566 /** @lends AV.Op.prototype */{
10567 _initialize: function _initialize() {}
10568 });
10569
10570 _.extend(AV.Op, {
10571 /**
10572 * To create a new Op, call AV.Op._extend();
10573 * @private
10574 */
10575 _extend: AV._extend,
10576
10577 // A map of __op string to decoder function.
10578 _opDecoderMap: {},
10579
10580 /**
10581 * Registers a function to convert a json object with an __op field into an
10582 * instance of a subclass of AV.Op.
10583 * @private
10584 */
10585 _registerDecoder: function _registerDecoder(opName, decoder) {
10586 AV.Op._opDecoderMap[opName] = decoder;
10587 },
10588
10589 /**
10590 * Converts a json object into an instance of a subclass of AV.Op.
10591 * @private
10592 */
10593 _decode: function _decode(json) {
10594 var decoder = AV.Op._opDecoderMap[json.__op];
10595 if (decoder) {
10596 return decoder(json);
10597 } else {
10598 return undefined;
10599 }
10600 }
10601 });
10602
10603 /*
10604 * Add a handler for Batch ops.
10605 */
10606 AV.Op._registerDecoder('Batch', function (json) {
10607 var op = null;
10608 AV._arrayEach(json.ops, function (nextOp) {
10609 nextOp = AV.Op._decode(nextOp);
10610 op = nextOp._mergeWithPrevious(op);
10611 });
10612 return op;
10613 });
10614
10615 /**
10616 * @private
10617 * @class
10618 * A Set operation indicates that either the field was changed using
10619 * AV.Object.set, or it is a mutable container that was detected as being
10620 * changed.
10621 */
10622 AV.Op.Set = AV.Op._extend(
10623 /** @lends AV.Op.Set.prototype */{
10624 _initialize: function _initialize(value) {
10625 this._value = value;
10626 },
10627
10628 /**
10629 * Returns the new value of this field after the set.
10630 */
10631 value: function value() {
10632 return this._value;
10633 },
10634
10635 /**
10636 * Returns a JSON version of the operation suitable for sending to AV.
10637 * @return {Object}
10638 */
10639 toJSON: function toJSON() {
10640 return AV._encode(this.value());
10641 },
10642
10643 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10644 return this;
10645 },
10646
10647 _estimate: function _estimate(oldValue) {
10648 return this.value();
10649 }
10650 });
10651
10652 /**
10653 * A sentinel value that is returned by AV.Op.Unset._estimate to
10654 * indicate the field should be deleted. Basically, if you find _UNSET as a
10655 * value in your object, you should remove that key.
10656 */
10657 AV.Op._UNSET = {};
10658
10659 /**
10660 * @private
10661 * @class
10662 * An Unset operation indicates that this field has been deleted from the
10663 * object.
10664 */
10665 AV.Op.Unset = AV.Op._extend(
10666 /** @lends AV.Op.Unset.prototype */{
10667 /**
10668 * Returns a JSON version of the operation suitable for sending to AV.
10669 * @return {Object}
10670 */
10671 toJSON: function toJSON() {
10672 return { __op: 'Delete' };
10673 },
10674
10675 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10676 return this;
10677 },
10678
10679 _estimate: function _estimate(oldValue) {
10680 return AV.Op._UNSET;
10681 }
10682 });
10683
10684 AV.Op._registerDecoder('Delete', function (json) {
10685 return new AV.Op.Unset();
10686 });
10687
10688 /**
10689 * @private
10690 * @class
10691 * An Increment is an atomic operation where the numeric value for the field
10692 * will be increased by a given amount.
10693 */
10694 AV.Op.Increment = AV.Op._extend(
10695 /** @lends AV.Op.Increment.prototype */{
10696 _initialize: function _initialize(amount) {
10697 this._amount = amount;
10698 },
10699
10700 /**
10701 * Returns the amount to increment by.
10702 * @return {Number} the amount to increment by.
10703 */
10704 amount: function amount() {
10705 return this._amount;
10706 },
10707
10708 /**
10709 * Returns a JSON version of the operation suitable for sending to AV.
10710 * @return {Object}
10711 */
10712 toJSON: function toJSON() {
10713 return { __op: 'Increment', amount: this._amount };
10714 },
10715
10716 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10717 if (!previous) {
10718 return this;
10719 } else if (previous instanceof AV.Op.Unset) {
10720 return new AV.Op.Set(this.amount());
10721 } else if (previous instanceof AV.Op.Set) {
10722 return new AV.Op.Set(previous.value() + this.amount());
10723 } else if (previous instanceof AV.Op.Increment) {
10724 return new AV.Op.Increment(this.amount() + previous.amount());
10725 } else {
10726 throw new Error('Op is invalid after previous op.');
10727 }
10728 },
10729
10730 _estimate: function _estimate(oldValue) {
10731 if (!oldValue) {
10732 return this.amount();
10733 }
10734 return oldValue + this.amount();
10735 }
10736 });
10737
10738 AV.Op._registerDecoder('Increment', function (json) {
10739 return new AV.Op.Increment(json.amount);
10740 });
10741
10742 /**
10743 * @private
10744 * @class
10745 * BitAnd is an atomic operation where the given value will be bit and to the
10746 * value than is stored in this field.
10747 */
10748 AV.Op.BitAnd = AV.Op._extend(
10749 /** @lends AV.Op.BitAnd.prototype */{
10750 _initialize: function _initialize(value) {
10751 this._value = value;
10752 },
10753 value: function value() {
10754 return this._value;
10755 },
10756
10757
10758 /**
10759 * Returns a JSON version of the operation suitable for sending to AV.
10760 * @return {Object}
10761 */
10762 toJSON: function toJSON() {
10763 return { __op: 'BitAnd', value: this.value() };
10764 },
10765 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10766 if (!previous) {
10767 return this;
10768 } else if (previous instanceof AV.Op.Unset) {
10769 return new AV.Op.Set(0);
10770 } else if (previous instanceof AV.Op.Set) {
10771 return new AV.Op.Set(previous.value() & this.value());
10772 } else {
10773 throw new Error('Op is invalid after previous op.');
10774 }
10775 },
10776 _estimate: function _estimate(oldValue) {
10777 return oldValue & this.value();
10778 }
10779 });
10780
10781 AV.Op._registerDecoder('BitAnd', function (json) {
10782 return new AV.Op.BitAnd(json.value);
10783 });
10784
10785 /**
10786 * @private
10787 * @class
10788 * BitOr is an atomic operation where the given value will be bit and to the
10789 * value than is stored in this field.
10790 */
10791 AV.Op.BitOr = AV.Op._extend(
10792 /** @lends AV.Op.BitOr.prototype */{
10793 _initialize: function _initialize(value) {
10794 this._value = value;
10795 },
10796 value: function value() {
10797 return this._value;
10798 },
10799
10800
10801 /**
10802 * Returns a JSON version of the operation suitable for sending to AV.
10803 * @return {Object}
10804 */
10805 toJSON: function toJSON() {
10806 return { __op: 'BitOr', value: this.value() };
10807 },
10808 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10809 if (!previous) {
10810 return this;
10811 } else if (previous instanceof AV.Op.Unset) {
10812 return new AV.Op.Set(this.value());
10813 } else if (previous instanceof AV.Op.Set) {
10814 return new AV.Op.Set(previous.value() | this.value());
10815 } else {
10816 throw new Error('Op is invalid after previous op.');
10817 }
10818 },
10819 _estimate: function _estimate(oldValue) {
10820 return oldValue | this.value();
10821 }
10822 });
10823
10824 AV.Op._registerDecoder('BitOr', function (json) {
10825 return new AV.Op.BitOr(json.value);
10826 });
10827
10828 /**
10829 * @private
10830 * @class
10831 * BitXor is an atomic operation where the given value will be bit and to the
10832 * value than is stored in this field.
10833 */
10834 AV.Op.BitXor = AV.Op._extend(
10835 /** @lends AV.Op.BitXor.prototype */{
10836 _initialize: function _initialize(value) {
10837 this._value = value;
10838 },
10839 value: function value() {
10840 return this._value;
10841 },
10842
10843
10844 /**
10845 * Returns a JSON version of the operation suitable for sending to AV.
10846 * @return {Object}
10847 */
10848 toJSON: function toJSON() {
10849 return { __op: 'BitXor', value: this.value() };
10850 },
10851 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10852 if (!previous) {
10853 return this;
10854 } else if (previous instanceof AV.Op.Unset) {
10855 return new AV.Op.Set(this.value());
10856 } else if (previous instanceof AV.Op.Set) {
10857 return new AV.Op.Set(previous.value() ^ this.value());
10858 } else {
10859 throw new Error('Op is invalid after previous op.');
10860 }
10861 },
10862 _estimate: function _estimate(oldValue) {
10863 return oldValue ^ this.value();
10864 }
10865 });
10866
10867 AV.Op._registerDecoder('BitXor', function (json) {
10868 return new AV.Op.BitXor(json.value);
10869 });
10870
10871 /**
10872 * @private
10873 * @class
10874 * Add is an atomic operation where the given objects will be appended to the
10875 * array that is stored in this field.
10876 */
10877 AV.Op.Add = AV.Op._extend(
10878 /** @lends AV.Op.Add.prototype */{
10879 _initialize: function _initialize(objects) {
10880 this._objects = objects;
10881 },
10882
10883 /**
10884 * Returns the objects to be added to the array.
10885 * @return {Array} The objects to be added to the array.
10886 */
10887 objects: function objects() {
10888 return this._objects;
10889 },
10890
10891 /**
10892 * Returns a JSON version of the operation suitable for sending to AV.
10893 * @return {Object}
10894 */
10895 toJSON: function toJSON() {
10896 return { __op: 'Add', objects: AV._encode(this.objects()) };
10897 },
10898
10899 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10900 if (!previous) {
10901 return this;
10902 } else if (previous instanceof AV.Op.Unset) {
10903 return new AV.Op.Set(this.objects());
10904 } else if (previous instanceof AV.Op.Set) {
10905 return new AV.Op.Set(this._estimate(previous.value()));
10906 } else if (previous instanceof AV.Op.Add) {
10907 return new AV.Op.Add(previous.objects().concat(this.objects()));
10908 } else {
10909 throw new Error('Op is invalid after previous op.');
10910 }
10911 },
10912
10913 _estimate: function _estimate(oldValue) {
10914 if (!oldValue) {
10915 return _.clone(this.objects());
10916 } else {
10917 return oldValue.concat(this.objects());
10918 }
10919 }
10920 });
10921
10922 AV.Op._registerDecoder('Add', function (json) {
10923 return new AV.Op.Add(AV._decode(json.objects));
10924 });
10925
10926 /**
10927 * @private
10928 * @class
10929 * AddUnique is an atomic operation where the given items will be appended to
10930 * the array that is stored in this field only if they were not already
10931 * present in the array.
10932 */
10933 AV.Op.AddUnique = AV.Op._extend(
10934 /** @lends AV.Op.AddUnique.prototype */{
10935 _initialize: function _initialize(objects) {
10936 this._objects = _.uniq(objects);
10937 },
10938
10939 /**
10940 * Returns the objects to be added to the array.
10941 * @return {Array} The objects to be added to the array.
10942 */
10943 objects: function objects() {
10944 return this._objects;
10945 },
10946
10947 /**
10948 * Returns a JSON version of the operation suitable for sending to AV.
10949 * @return {Object}
10950 */
10951 toJSON: function toJSON() {
10952 return { __op: 'AddUnique', objects: AV._encode(this.objects()) };
10953 },
10954
10955 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10956 if (!previous) {
10957 return this;
10958 } else if (previous instanceof AV.Op.Unset) {
10959 return new AV.Op.Set(this.objects());
10960 } else if (previous instanceof AV.Op.Set) {
10961 return new AV.Op.Set(this._estimate(previous.value()));
10962 } else if (previous instanceof AV.Op.AddUnique) {
10963 return new AV.Op.AddUnique(this._estimate(previous.objects()));
10964 } else {
10965 throw new Error('Op is invalid after previous op.');
10966 }
10967 },
10968
10969 _estimate: function _estimate(oldValue) {
10970 if (!oldValue) {
10971 return _.clone(this.objects());
10972 } else {
10973 // We can't just take the _.uniq(_.union(...)) of oldValue and
10974 // this.objects, because the uniqueness may not apply to oldValue
10975 // (especially if the oldValue was set via .set())
10976 var newValue = _.clone(oldValue);
10977 AV._arrayEach(this.objects(), function (obj) {
10978 if (obj instanceof AV.Object && obj.id) {
10979 var matchingObj = _.find(newValue, function (anObj) {
10980 return anObj instanceof AV.Object && anObj.id === obj.id;
10981 });
10982 if (!matchingObj) {
10983 newValue.push(obj);
10984 } else {
10985 var index = _.indexOf(newValue, matchingObj);
10986 newValue[index] = obj;
10987 }
10988 } else if (!_.contains(newValue, obj)) {
10989 newValue.push(obj);
10990 }
10991 });
10992 return newValue;
10993 }
10994 }
10995 });
10996
10997 AV.Op._registerDecoder('AddUnique', function (json) {
10998 return new AV.Op.AddUnique(AV._decode(json.objects));
10999 });
11000
11001 /**
11002 * @private
11003 * @class
11004 * Remove is an atomic operation where the given objects will be removed from
11005 * the array that is stored in this field.
11006 */
11007 AV.Op.Remove = AV.Op._extend(
11008 /** @lends AV.Op.Remove.prototype */{
11009 _initialize: function _initialize(objects) {
11010 this._objects = _.uniq(objects);
11011 },
11012
11013 /**
11014 * Returns the objects to be removed from the array.
11015 * @return {Array} The objects to be removed from the array.
11016 */
11017 objects: function objects() {
11018 return this._objects;
11019 },
11020
11021 /**
11022 * Returns a JSON version of the operation suitable for sending to AV.
11023 * @return {Object}
11024 */
11025 toJSON: function toJSON() {
11026 return { __op: 'Remove', objects: AV._encode(this.objects()) };
11027 },
11028
11029 _mergeWithPrevious: function _mergeWithPrevious(previous) {
11030 if (!previous) {
11031 return this;
11032 } else if (previous instanceof AV.Op.Unset) {
11033 return previous;
11034 } else if (previous instanceof AV.Op.Set) {
11035 return new AV.Op.Set(this._estimate(previous.value()));
11036 } else if (previous instanceof AV.Op.Remove) {
11037 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
11038 } else {
11039 throw new Error('Op is invalid after previous op.');
11040 }
11041 },
11042
11043 _estimate: function _estimate(oldValue) {
11044 if (!oldValue) {
11045 return [];
11046 } else {
11047 var newValue = _.difference(oldValue, this.objects());
11048 // If there are saved AV Objects being removed, also remove them.
11049 AV._arrayEach(this.objects(), function (obj) {
11050 if (obj instanceof AV.Object && obj.id) {
11051 newValue = _.reject(newValue, function (other) {
11052 return other instanceof AV.Object && other.id === obj.id;
11053 });
11054 }
11055 });
11056 return newValue;
11057 }
11058 }
11059 });
11060
11061 AV.Op._registerDecoder('Remove', function (json) {
11062 return new AV.Op.Remove(AV._decode(json.objects));
11063 });
11064
11065 /**
11066 * @private
11067 * @class
11068 * A Relation operation indicates that the field is an instance of
11069 * AV.Relation, and objects are being added to, or removed from, that
11070 * relation.
11071 */
11072 AV.Op.Relation = AV.Op._extend(
11073 /** @lends AV.Op.Relation.prototype */{
11074 _initialize: function _initialize(adds, removes) {
11075 this._targetClassName = null;
11076
11077 var self = this;
11078
11079 var pointerToId = function pointerToId(object) {
11080 if (object instanceof AV.Object) {
11081 if (!object.id) {
11082 throw new Error("You can't add an unsaved AV.Object to a relation.");
11083 }
11084 if (!self._targetClassName) {
11085 self._targetClassName = object.className;
11086 }
11087 if (self._targetClassName !== object.className) {
11088 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
11089 }
11090 return object.id;
11091 }
11092 return object;
11093 };
11094
11095 this.relationsToAdd = _.uniq(_.map(adds, pointerToId));
11096 this.relationsToRemove = _.uniq(_.map(removes, pointerToId));
11097 },
11098
11099 /**
11100 * Returns an array of unfetched AV.Object that are being added to the
11101 * relation.
11102 * @return {Array}
11103 */
11104 added: function added() {
11105 var self = this;
11106 return _.map(this.relationsToAdd, function (objectId) {
11107 var object = AV.Object._create(self._targetClassName);
11108 object.id = objectId;
11109 return object;
11110 });
11111 },
11112
11113 /**
11114 * Returns an array of unfetched AV.Object that are being removed from
11115 * the relation.
11116 * @return {Array}
11117 */
11118 removed: function removed() {
11119 var self = this;
11120 return _.map(this.relationsToRemove, function (objectId) {
11121 var object = AV.Object._create(self._targetClassName);
11122 object.id = objectId;
11123 return object;
11124 });
11125 },
11126
11127 /**
11128 * Returns a JSON version of the operation suitable for sending to AV.
11129 * @return {Object}
11130 */
11131 toJSON: function toJSON() {
11132 var adds = null;
11133 var removes = null;
11134 var self = this;
11135 var idToPointer = function idToPointer(id) {
11136 return {
11137 __type: 'Pointer',
11138 className: self._targetClassName,
11139 objectId: id
11140 };
11141 };
11142 var pointers = null;
11143 if (this.relationsToAdd.length > 0) {
11144 pointers = _.map(this.relationsToAdd, idToPointer);
11145 adds = { __op: 'AddRelation', objects: pointers };
11146 }
11147
11148 if (this.relationsToRemove.length > 0) {
11149 pointers = _.map(this.relationsToRemove, idToPointer);
11150 removes = { __op: 'RemoveRelation', objects: pointers };
11151 }
11152
11153 if (adds && removes) {
11154 return { __op: 'Batch', ops: [adds, removes] };
11155 }
11156
11157 return adds || removes || {};
11158 },
11159
11160 _mergeWithPrevious: function _mergeWithPrevious(previous) {
11161 if (!previous) {
11162 return this;
11163 } else if (previous instanceof AV.Op.Unset) {
11164 throw new Error("You can't modify a relation after deleting it.");
11165 } else if (previous instanceof AV.Op.Relation) {
11166 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
11167 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
11168 }
11169 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
11170 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
11171
11172 var newRelation = new AV.Op.Relation(newAdd, newRemove);
11173 newRelation._targetClassName = this._targetClassName;
11174 return newRelation;
11175 } else {
11176 throw new Error('Op is invalid after previous op.');
11177 }
11178 },
11179
11180 _estimate: function _estimate(oldValue, object, key) {
11181 if (!oldValue) {
11182 var relation = new AV.Relation(object, key);
11183 relation.targetClassName = this._targetClassName;
11184 } else if (oldValue instanceof AV.Relation) {
11185 if (this._targetClassName) {
11186 if (oldValue.targetClassName) {
11187 if (oldValue.targetClassName !== this._targetClassName) {
11188 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
11189 }
11190 } else {
11191 oldValue.targetClassName = this._targetClassName;
11192 }
11193 }
11194 return oldValue;
11195 } else {
11196 throw new Error('Op is invalid after previous op.');
11197 }
11198 }
11199 });
11200
11201 AV.Op._registerDecoder('AddRelation', function (json) {
11202 return new AV.Op.Relation(AV._decode(json.objects), []);
11203 });
11204 AV.Op._registerDecoder('RemoveRelation', function (json) {
11205 return new AV.Op.Relation([], AV._decode(json.objects));
11206 });
11207};
11208
11209/***/ }),
11210/* 300 */
11211/***/ (function(module, exports, __webpack_require__) {
11212
11213"use strict";
11214
11215
11216var _ = __webpack_require__(0);
11217
11218module.exports = function (AV) {
11219 /**
11220 * Creates a new Relation for the given parent object and key. This
11221 * constructor should rarely be used directly, but rather created by
11222 * {@link AV.Object#relation}.
11223 * @param {AV.Object} parent The parent of this relation.
11224 * @param {String} key The key for this relation on the parent.
11225 * @see AV.Object#relation
11226 * @class
11227 *
11228 * <p>
11229 * A class that is used to access all of the children of a many-to-many
11230 * relationship. Each instance of AV.Relation is associated with a
11231 * particular parent object and key.
11232 * </p>
11233 */
11234 AV.Relation = function (parent, key) {
11235 if (!_.isString(key)) {
11236 throw new TypeError('key must be a string');
11237 }
11238 this.parent = parent;
11239 this.key = key;
11240 this.targetClassName = null;
11241 };
11242
11243 /**
11244 * Creates a query that can be used to query the parent objects in this relation.
11245 * @param {String} parentClass The parent class or name.
11246 * @param {String} relationKey The relation field key in parent.
11247 * @param {AV.Object} child The child object.
11248 * @return {AV.Query}
11249 */
11250 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
11251 var query = new AV.Query(parentClass);
11252 query.equalTo(relationKey, child._toPointer());
11253 return query;
11254 };
11255
11256 _.extend(AV.Relation.prototype,
11257 /** @lends AV.Relation.prototype */{
11258 /**
11259 * Makes sure that this relation has the right parent and key.
11260 * @private
11261 */
11262 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
11263 this.parent = this.parent || parent;
11264 this.key = this.key || key;
11265 if (this.parent !== parent) {
11266 throw new Error('Internal Error. Relation retrieved from two different Objects.');
11267 }
11268 if (this.key !== key) {
11269 throw new Error('Internal Error. Relation retrieved from two different keys.');
11270 }
11271 },
11272
11273 /**
11274 * Adds a AV.Object or an array of AV.Objects to the relation.
11275 * @param {AV.Object|AV.Object[]} objects The item or items to add.
11276 */
11277 add: function add(objects) {
11278 if (!_.isArray(objects)) {
11279 objects = [objects];
11280 }
11281
11282 var change = new AV.Op.Relation(objects, []);
11283 this.parent.set(this.key, change);
11284 this.targetClassName = change._targetClassName;
11285 },
11286
11287 /**
11288 * Removes a AV.Object or an array of AV.Objects from this relation.
11289 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
11290 */
11291 remove: function remove(objects) {
11292 if (!_.isArray(objects)) {
11293 objects = [objects];
11294 }
11295
11296 var change = new AV.Op.Relation([], objects);
11297 this.parent.set(this.key, change);
11298 this.targetClassName = change._targetClassName;
11299 },
11300
11301 /**
11302 * Returns a JSON version of the object suitable for saving to disk.
11303 * @return {Object}
11304 */
11305 toJSON: function toJSON() {
11306 return { __type: 'Relation', className: this.targetClassName };
11307 },
11308
11309 /**
11310 * Returns a AV.Query that is limited to objects in this
11311 * relation.
11312 * @return {AV.Query}
11313 */
11314 query: function query() {
11315 var targetClass;
11316 var query;
11317 if (!this.targetClassName) {
11318 targetClass = AV.Object._getSubclass(this.parent.className);
11319 query = new AV.Query(targetClass);
11320 query._defaultParams.redirectClassNameForKey = this.key;
11321 } else {
11322 targetClass = AV.Object._getSubclass(this.targetClassName);
11323 query = new AV.Query(targetClass);
11324 }
11325 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
11326 query._addCondition('$relatedTo', 'key', this.key);
11327
11328 return query;
11329 }
11330 });
11331};
11332
11333/***/ }),
11334/* 301 */
11335/***/ (function(module, exports, __webpack_require__) {
11336
11337"use strict";
11338
11339
11340var _promise = __webpack_require__(3);
11341
11342var _promise2 = _interopRequireDefault(_promise);
11343
11344function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11345
11346var _ = __webpack_require__(0);
11347var cos = __webpack_require__(302);
11348var qiniu = __webpack_require__(303);
11349var s3 = __webpack_require__(316);
11350var AVError = __webpack_require__(31);
11351var AVRequest = __webpack_require__(14)._request;
11352
11353var _require = __webpack_require__(17),
11354 tap = _require.tap,
11355 transformFetchOptions = _require.transformFetchOptions;
11356
11357var debug = __webpack_require__(40)('leancloud:file');
11358var parseBase64 = __webpack_require__(320);
11359
11360module.exports = function (AV) {
11361 // port from browserify path module
11362 // since react-native packager won't shim node modules.
11363 var extname = function extname(path) {
11364 if (!_.isString(path)) return '';
11365 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
11366 };
11367
11368 var b64Digit = function b64Digit(number) {
11369 if (number < 26) {
11370 return String.fromCharCode(65 + number);
11371 }
11372 if (number < 52) {
11373 return String.fromCharCode(97 + (number - 26));
11374 }
11375 if (number < 62) {
11376 return String.fromCharCode(48 + (number - 52));
11377 }
11378 if (number === 62) {
11379 return '+';
11380 }
11381 if (number === 63) {
11382 return '/';
11383 }
11384 throw new Error('Tried to encode large digit ' + number + ' in base64.');
11385 };
11386
11387 var encodeBase64 = function encodeBase64(array) {
11388 var chunks = [];
11389 chunks.length = Math.ceil(array.length / 3);
11390 _.times(chunks.length, function (i) {
11391 var b1 = array[i * 3];
11392 var b2 = array[i * 3 + 1] || 0;
11393 var b3 = array[i * 3 + 2] || 0;
11394
11395 var has2 = i * 3 + 1 < array.length;
11396 var has3 = i * 3 + 2 < array.length;
11397
11398 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('');
11399 });
11400 return chunks.join('');
11401 };
11402
11403 /**
11404 * An AV.File is a local representation of a file that is saved to the AV
11405 * cloud.
11406 * @param name {String} The file's name. This will change to a unique value
11407 * once the file has finished saving.
11408 * @param data {Array} The data for the file, as either:
11409 * 1. an Array of byte value Numbers, or
11410 * 2. an Object like { base64: "..." } with a base64-encoded String.
11411 * 3. a Blob(File) selected with a file upload control in a browser.
11412 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
11413 * in some non-browser environments such as React Native.
11414 * 5. a Buffer in Node.js runtime.
11415 * 6. a Stream in Node.js runtime.
11416 *
11417 * For example:<pre>
11418 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
11419 * if (fileUploadControl.files.length > 0) {
11420 * var file = fileUploadControl.files[0];
11421 * var name = "photo.jpg";
11422 * var file = new AV.File(name, file);
11423 * file.save().then(function() {
11424 * // The file has been saved to AV.
11425 * }, function(error) {
11426 * // The file either could not be read, or could not be saved to AV.
11427 * });
11428 * }</pre>
11429 *
11430 * @class
11431 * @param [mimeType] {String} Content-Type header to use for the file. If
11432 * this is omitted, the content type will be inferred from the name's
11433 * extension.
11434 */
11435 AV.File = function (name, data, mimeType) {
11436 this.attributes = {
11437 name: name,
11438 url: '',
11439 metaData: {},
11440 // 用来存储转换后要上传的 base64 String
11441 base64: ''
11442 };
11443
11444 if (_.isString(data)) {
11445 throw new TypeError('Creating an AV.File from a String is not yet supported.');
11446 }
11447 if (_.isArray(data)) {
11448 this.attributes.metaData.size = data.length;
11449 data = { base64: encodeBase64(data) };
11450 }
11451
11452 this._extName = '';
11453 this._data = data;
11454 this._uploadHeaders = {};
11455
11456 if (data && data.blob && typeof data.blob.uri === 'string') {
11457 this._extName = extname(data.blob.uri);
11458 }
11459
11460 if (typeof Blob !== 'undefined' && data instanceof Blob) {
11461 if (data.size) {
11462 this.attributes.metaData.size = data.size;
11463 }
11464 if (data.name) {
11465 this._extName = extname(data.name);
11466 }
11467 }
11468
11469 var owner = void 0;
11470 if (data && data.owner) {
11471 owner = data.owner;
11472 } else if (!AV._config.disableCurrentUser) {
11473 try {
11474 owner = AV.User.current();
11475 } catch (error) {
11476 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
11477 throw error;
11478 }
11479 }
11480 }
11481
11482 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
11483
11484 this.set('mime_type', mimeType);
11485 };
11486
11487 /**
11488 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
11489 * @param {String} name the file name
11490 * @param {String} url the file url.
11491 * @param {Object} [metaData] the file metadata object.
11492 * @param {String} [type] Content-Type header to use for the file. If
11493 * this is omitted, the content type will be inferred from the name's
11494 * extension.
11495 * @return {AV.File} the file object
11496 */
11497 AV.File.withURL = function (name, url, metaData, type) {
11498 if (!name || !url) {
11499 throw new Error('Please provide file name and url');
11500 }
11501 var file = new AV.File(name, null, type);
11502 //copy metaData properties to file.
11503 if (metaData) {
11504 for (var prop in metaData) {
11505 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
11506 }
11507 }
11508 file.attributes.url = url;
11509 //Mark the file is from external source.
11510 file.attributes.metaData.__source = 'external';
11511 file.attributes.metaData.size = 0;
11512 return file;
11513 };
11514
11515 /**
11516 * Creates a file object with exists objectId.
11517 * @param {String} objectId The objectId string
11518 * @return {AV.File} the file object
11519 */
11520 AV.File.createWithoutData = function (objectId) {
11521 if (!objectId) {
11522 throw new TypeError('The objectId must be provided');
11523 }
11524 var file = new AV.File();
11525 file.id = objectId;
11526 return file;
11527 };
11528
11529 _.extend(AV.File.prototype,
11530 /** @lends AV.File.prototype */{
11531 className: '_File',
11532
11533 _toFullJSON: function _toFullJSON(seenObjects) {
11534 var _this = this;
11535
11536 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
11537
11538 var json = _.clone(this.attributes);
11539 AV._objectEach(json, function (val, key) {
11540 json[key] = AV._encode(val, seenObjects, undefined, full);
11541 });
11542 AV._objectEach(this._operations, function (val, key) {
11543 json[key] = val;
11544 });
11545
11546 if (_.has(this, 'id')) {
11547 json.objectId = this.id;
11548 }
11549 ['createdAt', 'updatedAt'].forEach(function (key) {
11550 if (_.has(_this, key)) {
11551 var val = _this[key];
11552 json[key] = _.isDate(val) ? val.toJSON() : val;
11553 }
11554 });
11555 if (full) {
11556 json.__type = 'File';
11557 }
11558 return json;
11559 },
11560
11561
11562 /**
11563 * Returns a JSON version of the file with meta data.
11564 * Inverse to {@link AV.parseJSON}
11565 * @since 3.0.0
11566 * @return {Object}
11567 */
11568 toFullJSON: function toFullJSON() {
11569 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11570
11571 return this._toFullJSON(seenObjects);
11572 },
11573
11574
11575 /**
11576 * Returns a JSON version of the object.
11577 * @return {Object}
11578 */
11579 toJSON: function toJSON(key, holder) {
11580 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
11581
11582 return this._toFullJSON(seenObjects, false);
11583 },
11584
11585
11586 /**
11587 * Gets a Pointer referencing this file.
11588 * @private
11589 */
11590 _toPointer: function _toPointer() {
11591 return {
11592 __type: 'Pointer',
11593 className: this.className,
11594 objectId: this.id
11595 };
11596 },
11597
11598
11599 /**
11600 * Returns the ACL for this file.
11601 * @returns {AV.ACL} An instance of AV.ACL.
11602 */
11603 getACL: function getACL() {
11604 return this._acl;
11605 },
11606
11607
11608 /**
11609 * Sets the ACL to be used for this file.
11610 * @param {AV.ACL} acl An instance of AV.ACL.
11611 */
11612 setACL: function setACL(acl) {
11613 if (!(acl instanceof AV.ACL)) {
11614 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
11615 }
11616 this._acl = acl;
11617 return this;
11618 },
11619
11620
11621 /**
11622 * Gets the name of the file. Before save is called, this is the filename
11623 * given by the user. After save is called, that name gets prefixed with a
11624 * unique identifier.
11625 */
11626 name: function name() {
11627 return this.get('name');
11628 },
11629
11630
11631 /**
11632 * Gets the url of the file. It is only available after you save the file or
11633 * after you get the file from a AV.Object.
11634 * @return {String}
11635 */
11636 url: function url() {
11637 return this.get('url');
11638 },
11639
11640
11641 /**
11642 * Gets the attributs of the file object.
11643 * @param {String} The attribute name which want to get.
11644 * @returns {Any}
11645 */
11646 get: function get(attrName) {
11647 switch (attrName) {
11648 case 'objectId':
11649 return this.id;
11650 case 'url':
11651 case 'name':
11652 case 'mime_type':
11653 case 'metaData':
11654 case 'createdAt':
11655 case 'updatedAt':
11656 return this.attributes[attrName];
11657 default:
11658 return this.attributes.metaData[attrName];
11659 }
11660 },
11661
11662
11663 /**
11664 * Set the metaData of the file object.
11665 * @param {Object} Object is an key value Object for setting metaData.
11666 * @param {String} attr is an optional metadata key.
11667 * @param {Object} value is an optional metadata value.
11668 * @returns {String|Number|Array|Object}
11669 */
11670 set: function set() {
11671 var _this2 = this;
11672
11673 var set = function set(attrName, value) {
11674 switch (attrName) {
11675 case 'name':
11676 case 'url':
11677 case 'mime_type':
11678 case 'base64':
11679 case 'metaData':
11680 _this2.attributes[attrName] = value;
11681 break;
11682 default:
11683 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
11684 _this2.attributes.metaData[attrName] = value;
11685 break;
11686 }
11687 };
11688
11689 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
11690 args[_key] = arguments[_key];
11691 }
11692
11693 switch (args.length) {
11694 case 1:
11695 // 传入一个 Object
11696 for (var k in args[0]) {
11697 set(k, args[0][k]);
11698 }
11699 break;
11700 case 2:
11701 set(args[0], args[1]);
11702 break;
11703 }
11704 return this;
11705 },
11706
11707
11708 /**
11709 * Set a header for the upload request.
11710 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
11711 *
11712 * @param {String} key header key
11713 * @param {String} value header value
11714 * @return {AV.File} this
11715 */
11716 setUploadHeader: function setUploadHeader(key, value) {
11717 this._uploadHeaders[key] = value;
11718 return this;
11719 },
11720
11721
11722 /**
11723 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
11724 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
11725 * <p><pre>
11726 * var metadata = file.metaData(); //Get metadata JSON object.
11727 * var size = file.metaData('size'); // Get the size metadata value.
11728 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
11729 *</pre></p>
11730 * @return {Object} The file's metadata JSON object.
11731 * @param {String} attr an optional metadata key.
11732 * @param {Object} value an optional metadata value.
11733 **/
11734 metaData: function metaData(attr, value) {
11735 if (attr && value) {
11736 this.attributes.metaData[attr] = value;
11737 return this;
11738 } else if (attr && !value) {
11739 return this.attributes.metaData[attr];
11740 } else {
11741 return this.attributes.metaData;
11742 }
11743 },
11744
11745
11746 /**
11747 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
11748 * @return {String} 缩略图URL
11749 * @param {Number} width 宽度,单位:像素
11750 * @param {Number} heigth 高度,单位:像素
11751 * @param {Number} quality 质量,1-100的数字,默认100
11752 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
11753 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
11754 */
11755
11756 thumbnailURL: function thumbnailURL(width, height) {
11757 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
11758 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
11759 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
11760
11761 var url = this.attributes.url;
11762 if (!url) {
11763 throw new Error('Invalid url.');
11764 }
11765 if (!width || !height || width <= 0 || height <= 0) {
11766 throw new Error('Invalid width or height value.');
11767 }
11768 if (quality <= 0 || quality > 100) {
11769 throw new Error('Invalid quality value.');
11770 }
11771 var mode = scaleToFit ? 2 : 1;
11772 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
11773 },
11774
11775
11776 /**
11777 * Returns the file's size.
11778 * @return {Number} The file's size in bytes.
11779 **/
11780 size: function size() {
11781 return this.metaData().size;
11782 },
11783
11784
11785 /**
11786 * Returns the file's owner.
11787 * @return {String} The file's owner id.
11788 */
11789 ownerId: function ownerId() {
11790 return this.metaData().owner;
11791 },
11792
11793
11794 /**
11795 * Destroy the file.
11796 * @param {AuthOptions} options
11797 * @return {Promise} A promise that is fulfilled when the destroy
11798 * completes.
11799 */
11800 destroy: function destroy(options) {
11801 if (!this.id) {
11802 return _promise2.default.reject(new Error('The file id does not eixst.'));
11803 }
11804 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
11805 return request;
11806 },
11807
11808
11809 /**
11810 * Request Qiniu upload token
11811 * @param {string} type
11812 * @return {Promise} Resolved with the response
11813 * @private
11814 */
11815 _fileToken: function _fileToken(type, authOptions) {
11816 var name = this.attributes.name;
11817
11818 var extName = extname(name);
11819 if (!extName && this._extName) {
11820 name += this._extName;
11821 extName = this._extName;
11822 }
11823 var data = {
11824 name: name,
11825 keep_file_name: authOptions.keepFileName,
11826 key: authOptions.key,
11827 ACL: this._acl,
11828 mime_type: type,
11829 metaData: this.attributes.metaData
11830 };
11831 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
11832 },
11833
11834
11835 /**
11836 * @callback UploadProgressCallback
11837 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
11838 */
11839 /**
11840 * Saves the file to the AV cloud.
11841 * @param {AuthOptions} [options] AuthOptions plus:
11842 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
11843 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
11844 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
11845 * @return {Promise} Promise that is resolved when the save finishes.
11846 */
11847 save: function save() {
11848 var _this3 = this;
11849
11850 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11851
11852 if (this.id) {
11853 throw new Error('File is already saved.');
11854 }
11855 if (!this._previousSave) {
11856 if (this._data) {
11857 var mimeType = this.get('mime_type');
11858 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
11859 if (uploadInfo.mime_type) {
11860 mimeType = uploadInfo.mime_type;
11861 _this3.set('mime_type', mimeType);
11862 }
11863 _this3._token = uploadInfo.token;
11864 return _promise2.default.resolve().then(function () {
11865 var data = _this3._data;
11866 if (data && data.base64) {
11867 return parseBase64(data.base64, mimeType);
11868 }
11869 if (data && data.blob) {
11870 if (!data.blob.type && mimeType) {
11871 data.blob.type = mimeType;
11872 }
11873 if (!data.blob.name) {
11874 data.blob.name = _this3.get('name');
11875 }
11876 return data.blob;
11877 }
11878 if (typeof Blob !== 'undefined' && data instanceof Blob) {
11879 return data;
11880 }
11881 throw new TypeError('malformed file data');
11882 }).then(function (data) {
11883 var _options = _.extend({}, options);
11884 // filter out download progress events
11885 if (options.onprogress) {
11886 _options.onprogress = function (event) {
11887 if (event.direction === 'download') return;
11888 return options.onprogress(event);
11889 };
11890 }
11891 switch (uploadInfo.provider) {
11892 case 's3':
11893 return s3(uploadInfo, data, _this3, _options);
11894 case 'qcloud':
11895 return cos(uploadInfo, data, _this3, _options);
11896 case 'qiniu':
11897 default:
11898 return qiniu(uploadInfo, data, _this3, _options);
11899 }
11900 }).then(tap(function () {
11901 return _this3._callback(true);
11902 }), function (error) {
11903 _this3._callback(false);
11904 throw error;
11905 });
11906 });
11907 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
11908 // external link file.
11909 var data = {
11910 name: this.attributes.name,
11911 ACL: this._acl,
11912 metaData: this.attributes.metaData,
11913 mime_type: this.mimeType,
11914 url: this.attributes.url
11915 };
11916 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
11917 _this3.id = response.objectId;
11918 return _this3;
11919 });
11920 }
11921 }
11922 return this._previousSave;
11923 },
11924 _callback: function _callback(success) {
11925 AVRequest('fileCallback', null, null, 'post', {
11926 token: this._token,
11927 result: success
11928 }).catch(debug);
11929 delete this._token;
11930 delete this._data;
11931 },
11932
11933
11934 /**
11935 * fetch the file from server. If the server's representation of the
11936 * model differs from its current attributes, they will be overriden,
11937 * @param {Object} fetchOptions Optional options to set 'keys',
11938 * 'include' and 'includeACL' option.
11939 * @param {AuthOptions} options
11940 * @return {Promise} A promise that is fulfilled when the fetch
11941 * completes.
11942 */
11943 fetch: function fetch(fetchOptions, options) {
11944 if (!this.id) {
11945 throw new Error('Cannot fetch unsaved file');
11946 }
11947 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
11948 return request.then(this._finishFetch.bind(this));
11949 },
11950 _finishFetch: function _finishFetch(response) {
11951 var value = AV.Object.prototype.parse(response);
11952 value.attributes = {
11953 name: value.name,
11954 url: value.url,
11955 mime_type: value.mime_type,
11956 bucket: value.bucket
11957 };
11958 value.attributes.metaData = value.metaData || {};
11959 value.id = value.objectId;
11960 // clean
11961 delete value.objectId;
11962 delete value.metaData;
11963 delete value.url;
11964 delete value.name;
11965 delete value.mime_type;
11966 delete value.bucket;
11967 _.extend(this, value);
11968 return this;
11969 }
11970 });
11971};
11972
11973/***/ }),
11974/* 302 */
11975/***/ (function(module, exports, __webpack_require__) {
11976
11977"use strict";
11978
11979
11980var _require = __webpack_require__(41),
11981 getAdapter = _require.getAdapter;
11982
11983var debug = __webpack_require__(40)('cos');
11984
11985module.exports = function (uploadInfo, data, file) {
11986 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
11987
11988 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
11989 var fileFormData = {
11990 field: 'fileContent',
11991 data: data,
11992 name: file.attributes.name
11993 };
11994 var options = {
11995 headers: file._uploadHeaders,
11996 data: {
11997 op: 'upload'
11998 },
11999 onprogress: saveOptions.onprogress
12000 };
12001 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
12002 var upload = getAdapter('upload');
12003 return upload(url, fileFormData, options).then(function (response) {
12004 debug(response.status, response.data);
12005 if (response.ok === false) {
12006 var error = new Error(response.status);
12007 error.response = response;
12008 throw error;
12009 }
12010 file.attributes.url = uploadInfo.url;
12011 file._bucket = uploadInfo.bucket;
12012 file.id = uploadInfo.objectId;
12013 return file;
12014 }, function (error) {
12015 var response = error.response;
12016
12017 if (response) {
12018 debug(response.status, response.data);
12019 error.statusCode = response.status;
12020 error.response = response.data;
12021 }
12022 throw error;
12023 });
12024};
12025
12026/***/ }),
12027/* 303 */
12028/***/ (function(module, exports, __webpack_require__) {
12029
12030"use strict";
12031
12032
12033var _getPrototypeOf = __webpack_require__(99);
12034
12035var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
12036
12037var _possibleConstructorReturn2 = __webpack_require__(304);
12038
12039var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
12040
12041var _inherits2 = __webpack_require__(305);
12042
12043var _inherits3 = _interopRequireDefault(_inherits2);
12044
12045var _promise = __webpack_require__(3);
12046
12047var _promise2 = _interopRequireDefault(_promise);
12048
12049var _classCallCheck2 = __webpack_require__(311);
12050
12051var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
12052
12053var _createClass2 = __webpack_require__(312);
12054
12055var _createClass3 = _interopRequireDefault(_createClass2);
12056
12057var _getIterator2 = __webpack_require__(177);
12058
12059var _getIterator3 = _interopRequireDefault(_getIterator2);
12060
12061var _stringify = __webpack_require__(21);
12062
12063var _stringify2 = _interopRequireDefault(_stringify);
12064
12065function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12066
12067var _require = __webpack_require__(41),
12068 getAdapter = _require.getAdapter;
12069
12070var debug = __webpack_require__(40)('leancloud:qiniu');
12071var ajax = __webpack_require__(68);
12072var btoa = __webpack_require__(315);
12073
12074var SHARD_THRESHOLD = 1024 * 1024 * 64;
12075
12076var CHUNK_SIZE = 1024 * 1024 * 16;
12077
12078function upload(uploadInfo, data, file) {
12079 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12080
12081 // Get the uptoken to upload files to qiniu.
12082 var uptoken = uploadInfo.token;
12083 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
12084 var fileFormData = {
12085 field: 'file',
12086 data: data,
12087 name: file.attributes.name
12088 };
12089 var options = {
12090 headers: file._uploadHeaders,
12091 data: {
12092 name: file.attributes.name,
12093 key: uploadInfo.key,
12094 token: uptoken
12095 },
12096 onprogress: saveOptions.onprogress
12097 };
12098 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
12099 var upload = getAdapter('upload');
12100 return upload(url, fileFormData, options).then(function (response) {
12101 debug(response.status, response.data);
12102 if (response.ok === false) {
12103 var message = response.status;
12104 if (response.data) {
12105 if (response.data.error) {
12106 message = response.data.error;
12107 } else {
12108 message = (0, _stringify2.default)(response.data);
12109 }
12110 }
12111 var error = new Error(message);
12112 error.response = response;
12113 throw error;
12114 }
12115 file.attributes.url = uploadInfo.url;
12116 file._bucket = uploadInfo.bucket;
12117 file.id = uploadInfo.objectId;
12118 return file;
12119 }, function (error) {
12120 var response = error.response;
12121
12122 if (response) {
12123 debug(response.status, response.data);
12124 error.statusCode = response.status;
12125 error.response = response.data;
12126 }
12127 throw error;
12128 });
12129}
12130
12131function urlSafeBase64(string) {
12132 var base64 = btoa(unescape(encodeURIComponent(string)));
12133 var result = '';
12134 var _iteratorNormalCompletion = true;
12135 var _didIteratorError = false;
12136 var _iteratorError = undefined;
12137
12138 try {
12139 for (var _iterator = (0, _getIterator3.default)(base64), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
12140 var ch = _step.value;
12141
12142 switch (ch) {
12143 case '+':
12144 result += '-';
12145 break;
12146 case '/':
12147 result += '_';
12148 break;
12149 default:
12150 result += ch;
12151 }
12152 }
12153 } catch (err) {
12154 _didIteratorError = true;
12155 _iteratorError = err;
12156 } finally {
12157 try {
12158 if (!_iteratorNormalCompletion && _iterator.return) {
12159 _iterator.return();
12160 }
12161 } finally {
12162 if (_didIteratorError) {
12163 throw _iteratorError;
12164 }
12165 }
12166 }
12167
12168 return result;
12169}
12170
12171var ShardUploader = function () {
12172 function ShardUploader(uploadInfo, data, file, saveOptions) {
12173 var _this = this;
12174
12175 (0, _classCallCheck3.default)(this, ShardUploader);
12176
12177 this.uploadInfo = uploadInfo;
12178 this.data = data;
12179 this.file = file;
12180 this.size = undefined;
12181 this.offset = 0;
12182 this.uploadedChunks = 0;
12183
12184 var key = urlSafeBase64(uploadInfo.key);
12185 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
12186 this.baseURL = uploadURL + '/buckets/' + uploadInfo.bucket + '/objects/' + key + '/uploads';
12187 this.upToken = 'UpToken ' + uploadInfo.token;
12188
12189 this.uploaded = 0;
12190 if (saveOptions && saveOptions.onprogress) {
12191 this.onProgress = function (_ref) {
12192 var loaded = _ref.loaded;
12193
12194 loaded += _this.uploadedChunks * CHUNK_SIZE;
12195 if (loaded <= _this.uploaded) {
12196 return;
12197 }
12198 if (_this.size) {
12199 saveOptions.onprogress({
12200 loaded: loaded,
12201 total: _this.size,
12202 percent: loaded / _this.size * 100
12203 });
12204 } else {
12205 saveOptions.onprogress({ loaded: loaded });
12206 }
12207 _this.uploaded = loaded;
12208 };
12209 }
12210 }
12211
12212 /**
12213 * @returns {Promise<string>}
12214 */
12215
12216
12217 (0, _createClass3.default)(ShardUploader, [{
12218 key: 'getUploadId',
12219 value: function getUploadId() {
12220 return ajax({
12221 method: 'POST',
12222 url: this.baseURL,
12223 headers: {
12224 Authorization: this.upToken
12225 }
12226 }).then(function (res) {
12227 return res.uploadId;
12228 });
12229 }
12230 }, {
12231 key: 'getChunk',
12232 value: function getChunk() {
12233 throw new Error('Not implemented');
12234 }
12235
12236 /**
12237 * @param {string} uploadId
12238 * @param {number} partNumber
12239 * @param {any} data
12240 * @returns {Promise<{ partNumber: number, etag: string }>}
12241 */
12242
12243 }, {
12244 key: 'uploadPart',
12245 value: function uploadPart(uploadId, partNumber, data) {
12246 return ajax({
12247 method: 'PUT',
12248 url: this.baseURL + '/' + uploadId + '/' + partNumber,
12249 headers: {
12250 Authorization: this.upToken
12251 },
12252 data: data,
12253 onprogress: this.onProgress
12254 }).then(function (_ref2) {
12255 var etag = _ref2.etag;
12256 return { partNumber: partNumber, etag: etag };
12257 });
12258 }
12259 }, {
12260 key: 'stopUpload',
12261 value: function stopUpload(uploadId) {
12262 return ajax({
12263 method: 'DELETE',
12264 url: this.baseURL + '/' + uploadId,
12265 headers: {
12266 Authorization: this.upToken
12267 }
12268 });
12269 }
12270 }, {
12271 key: 'upload',
12272 value: function upload() {
12273 var _this2 = this;
12274
12275 var parts = [];
12276 return this.getUploadId().then(function (uploadId) {
12277 var uploadPart = function uploadPart() {
12278 return _promise2.default.resolve(_this2.getChunk()).then(function (chunk) {
12279 if (!chunk) {
12280 return;
12281 }
12282 var partNumber = parts.length + 1;
12283 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
12284 parts.push(part);
12285 _this2.uploadedChunks++;
12286 return uploadPart();
12287 });
12288 }).catch(function (error) {
12289 return _this2.stopUpload(uploadId).then(function () {
12290 return _promise2.default.reject(error);
12291 });
12292 });
12293 };
12294
12295 return uploadPart().then(function () {
12296 return ajax({
12297 method: 'POST',
12298 url: _this2.baseURL + '/' + uploadId,
12299 headers: {
12300 Authorization: _this2.upToken
12301 },
12302 data: {
12303 parts: parts,
12304 fname: _this2.file.attributes.name,
12305 mimeType: _this2.file.attributes.mime_type
12306 }
12307 });
12308 });
12309 }).then(function () {
12310 _this2.file.attributes.url = _this2.uploadInfo.url;
12311 _this2.file._bucket = _this2.uploadInfo.bucket;
12312 _this2.file.id = _this2.uploadInfo.objectId;
12313 return _this2.file;
12314 });
12315 }
12316 }]);
12317 return ShardUploader;
12318}();
12319
12320var BlobUploader = function (_ShardUploader) {
12321 (0, _inherits3.default)(BlobUploader, _ShardUploader);
12322
12323 function BlobUploader(uploadInfo, data, file, saveOptions) {
12324 (0, _classCallCheck3.default)(this, BlobUploader);
12325
12326 var _this3 = (0, _possibleConstructorReturn3.default)(this, (BlobUploader.__proto__ || (0, _getPrototypeOf2.default)(BlobUploader)).call(this, uploadInfo, data, file, saveOptions));
12327
12328 _this3.size = data.size;
12329 return _this3;
12330 }
12331
12332 /**
12333 * @returns {Blob | null}
12334 */
12335
12336
12337 (0, _createClass3.default)(BlobUploader, [{
12338 key: 'getChunk',
12339 value: function getChunk() {
12340 if (this.offset >= this.size) {
12341 return null;
12342 }
12343 var chunk = this.data.slice(this.offset, this.offset + CHUNK_SIZE);
12344 this.offset += chunk.size;
12345 return chunk;
12346 }
12347 }]);
12348 return BlobUploader;
12349}(ShardUploader);
12350
12351function isBlob(data) {
12352 return typeof Blob !== 'undefined' && data instanceof Blob;
12353}
12354
12355module.exports = function (uploadInfo, data, file) {
12356 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12357
12358 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
12359 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
12360 }
12361 return upload(uploadInfo, data, file, saveOptions);
12362};
12363
12364/***/ }),
12365/* 304 */
12366/***/ (function(module, exports, __webpack_require__) {
12367
12368"use strict";
12369
12370
12371exports.__esModule = true;
12372
12373var _typeof2 = __webpack_require__(54);
12374
12375var _typeof3 = _interopRequireDefault(_typeof2);
12376
12377function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12378
12379exports.default = function (self, call) {
12380 if (!self) {
12381 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12382 }
12383
12384 return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
12385};
12386
12387/***/ }),
12388/* 305 */
12389/***/ (function(module, exports, __webpack_require__) {
12390
12391"use strict";
12392
12393
12394exports.__esModule = true;
12395
12396var _setPrototypeOf = __webpack_require__(175);
12397
12398var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
12399
12400var _create = __webpack_require__(176);
12401
12402var _create2 = _interopRequireDefault(_create);
12403
12404var _typeof2 = __webpack_require__(54);
12405
12406var _typeof3 = _interopRequireDefault(_typeof2);
12407
12408function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12409
12410exports.default = function (subClass, superClass) {
12411 if (typeof superClass !== "function" && superClass !== null) {
12412 throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
12413 }
12414
12415 subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
12416 constructor: {
12417 value: subClass,
12418 enumerable: false,
12419 writable: true,
12420 configurable: true
12421 }
12422 });
12423 if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
12424};
12425
12426/***/ }),
12427/* 306 */
12428/***/ (function(module, exports, __webpack_require__) {
12429
12430__webpack_require__(307);
12431module.exports = __webpack_require__(2).Object.setPrototypeOf;
12432
12433
12434/***/ }),
12435/* 307 */
12436/***/ (function(module, exports, __webpack_require__) {
12437
12438// 19.1.3.19 Object.setPrototypeOf(O, proto)
12439var $export = __webpack_require__(8);
12440$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(308).set });
12441
12442
12443/***/ }),
12444/* 308 */
12445/***/ (function(module, exports, __webpack_require__) {
12446
12447// Works with __proto__ only. Old v8 can't work with null proto objects.
12448/* eslint-disable no-proto */
12449var isObject = __webpack_require__(10);
12450var anObject = __webpack_require__(18);
12451var check = function (O, proto) {
12452 anObject(O);
12453 if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
12454};
12455module.exports = {
12456 set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
12457 function (test, buggy, set) {
12458 try {
12459 set = __webpack_require__(22)(Function.call, __webpack_require__(103).f(Object.prototype, '__proto__').set, 2);
12460 set(test, []);
12461 buggy = !(test instanceof Array);
12462 } catch (e) { buggy = true; }
12463 return function setPrototypeOf(O, proto) {
12464 check(O, proto);
12465 if (buggy) O.__proto__ = proto;
12466 else set(O, proto);
12467 return O;
12468 };
12469 }({}, false) : undefined),
12470 check: check
12471};
12472
12473
12474/***/ }),
12475/* 309 */
12476/***/ (function(module, exports, __webpack_require__) {
12477
12478__webpack_require__(310);
12479var $Object = __webpack_require__(2).Object;
12480module.exports = function create(P, D) {
12481 return $Object.create(P, D);
12482};
12483
12484
12485/***/ }),
12486/* 310 */
12487/***/ (function(module, exports, __webpack_require__) {
12488
12489var $export = __webpack_require__(8);
12490// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
12491$export($export.S, 'Object', { create: __webpack_require__(59) });
12492
12493
12494/***/ }),
12495/* 311 */
12496/***/ (function(module, exports, __webpack_require__) {
12497
12498"use strict";
12499
12500
12501exports.__esModule = true;
12502
12503exports.default = function (instance, Constructor) {
12504 if (!(instance instanceof Constructor)) {
12505 throw new TypeError("Cannot call a class as a function");
12506 }
12507};
12508
12509/***/ }),
12510/* 312 */
12511/***/ (function(module, exports, __webpack_require__) {
12512
12513"use strict";
12514
12515
12516exports.__esModule = true;
12517
12518var _defineProperty = __webpack_require__(67);
12519
12520var _defineProperty2 = _interopRequireDefault(_defineProperty);
12521
12522function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12523
12524exports.default = function () {
12525 function defineProperties(target, props) {
12526 for (var i = 0; i < props.length; i++) {
12527 var descriptor = props[i];
12528 descriptor.enumerable = descriptor.enumerable || false;
12529 descriptor.configurable = true;
12530 if ("value" in descriptor) descriptor.writable = true;
12531 (0, _defineProperty2.default)(target, descriptor.key, descriptor);
12532 }
12533 }
12534
12535 return function (Constructor, protoProps, staticProps) {
12536 if (protoProps) defineProperties(Constructor.prototype, protoProps);
12537 if (staticProps) defineProperties(Constructor, staticProps);
12538 return Constructor;
12539 };
12540}();
12541
12542/***/ }),
12543/* 313 */
12544/***/ (function(module, exports, __webpack_require__) {
12545
12546__webpack_require__(34);
12547__webpack_require__(42);
12548module.exports = __webpack_require__(314);
12549
12550
12551/***/ }),
12552/* 314 */
12553/***/ (function(module, exports, __webpack_require__) {
12554
12555var anObject = __webpack_require__(18);
12556var get = __webpack_require__(110);
12557module.exports = __webpack_require__(2).getIterator = function (it) {
12558 var iterFn = get(it);
12559 if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
12560 return anObject(iterFn.call(it));
12561};
12562
12563
12564/***/ }),
12565/* 315 */
12566/***/ (function(module, exports, __webpack_require__) {
12567
12568"use strict";
12569
12570
12571// base64 character set, plus padding character (=)
12572var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
12573
12574module.exports = function (string) {
12575 var result = '';
12576
12577 for (var i = 0; i < string.length;) {
12578 var a = string.charCodeAt(i++);
12579 var b = string.charCodeAt(i++);
12580 var c = string.charCodeAt(i++);
12581 if (a > 255 || b > 255 || c > 255) {
12582 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
12583 }
12584
12585 var bitmap = a << 16 | b << 8 | c;
12586 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
12587 }
12588
12589 // To determine the final padding
12590 var rest = string.length % 3;
12591 // If there's need of padding, replace the last 'A's with equal signs
12592 return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
12593};
12594
12595/***/ }),
12596/* 316 */
12597/***/ (function(module, exports, __webpack_require__) {
12598
12599"use strict";
12600
12601
12602var _ = __webpack_require__(0);
12603var ajax = __webpack_require__(68);
12604
12605module.exports = function upload(uploadInfo, data, file) {
12606 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12607
12608
12609 return ajax({
12610 url: uploadInfo.upload_url,
12611 method: 'PUT',
12612 data: data,
12613 headers: _.extend({
12614 'Content-Type': file.get('mime_type'),
12615 'Cache-Control': 'public, max-age=31536000'
12616 }, file._uploadHeaders),
12617 onprogress: saveOptions.onprogress
12618 }).then(function () {
12619 file.attributes.url = uploadInfo.url;
12620 file._bucket = uploadInfo.bucket;
12621 file.id = uploadInfo.objectId;
12622 return file;
12623 });
12624};
12625
12626/***/ }),
12627/* 317 */
12628/***/ (function(module, exports, __webpack_require__) {
12629
12630(function(){
12631 var crypt = __webpack_require__(318),
12632 utf8 = __webpack_require__(178).utf8,
12633 isBuffer = __webpack_require__(319),
12634 bin = __webpack_require__(178).bin,
12635
12636 // The core
12637 md5 = function (message, options) {
12638 // Convert to byte array
12639 if (message.constructor == String)
12640 if (options && options.encoding === 'binary')
12641 message = bin.stringToBytes(message);
12642 else
12643 message = utf8.stringToBytes(message);
12644 else if (isBuffer(message))
12645 message = Array.prototype.slice.call(message, 0);
12646 else if (!Array.isArray(message))
12647 message = message.toString();
12648 // else, assume byte array already
12649
12650 var m = crypt.bytesToWords(message),
12651 l = message.length * 8,
12652 a = 1732584193,
12653 b = -271733879,
12654 c = -1732584194,
12655 d = 271733878;
12656
12657 // Swap endian
12658 for (var i = 0; i < m.length; i++) {
12659 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
12660 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
12661 }
12662
12663 // Padding
12664 m[l >>> 5] |= 0x80 << (l % 32);
12665 m[(((l + 64) >>> 9) << 4) + 14] = l;
12666
12667 // Method shortcuts
12668 var FF = md5._ff,
12669 GG = md5._gg,
12670 HH = md5._hh,
12671 II = md5._ii;
12672
12673 for (var i = 0; i < m.length; i += 16) {
12674
12675 var aa = a,
12676 bb = b,
12677 cc = c,
12678 dd = d;
12679
12680 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
12681 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
12682 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
12683 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
12684 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
12685 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
12686 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
12687 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
12688 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
12689 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
12690 c = FF(c, d, a, b, m[i+10], 17, -42063);
12691 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
12692 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
12693 d = FF(d, a, b, c, m[i+13], 12, -40341101);
12694 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
12695 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
12696
12697 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
12698 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
12699 c = GG(c, d, a, b, m[i+11], 14, 643717713);
12700 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
12701 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
12702 d = GG(d, a, b, c, m[i+10], 9, 38016083);
12703 c = GG(c, d, a, b, m[i+15], 14, -660478335);
12704 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
12705 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
12706 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
12707 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
12708 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
12709 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
12710 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
12711 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
12712 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
12713
12714 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
12715 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
12716 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
12717 b = HH(b, c, d, a, m[i+14], 23, -35309556);
12718 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
12719 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
12720 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
12721 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
12722 a = HH(a, b, c, d, m[i+13], 4, 681279174);
12723 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
12724 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
12725 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
12726 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
12727 d = HH(d, a, b, c, m[i+12], 11, -421815835);
12728 c = HH(c, d, a, b, m[i+15], 16, 530742520);
12729 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
12730
12731 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
12732 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
12733 c = II(c, d, a, b, m[i+14], 15, -1416354905);
12734 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
12735 a = II(a, b, c, d, m[i+12], 6, 1700485571);
12736 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
12737 c = II(c, d, a, b, m[i+10], 15, -1051523);
12738 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
12739 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
12740 d = II(d, a, b, c, m[i+15], 10, -30611744);
12741 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
12742 b = II(b, c, d, a, m[i+13], 21, 1309151649);
12743 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
12744 d = II(d, a, b, c, m[i+11], 10, -1120210379);
12745 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
12746 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
12747
12748 a = (a + aa) >>> 0;
12749 b = (b + bb) >>> 0;
12750 c = (c + cc) >>> 0;
12751 d = (d + dd) >>> 0;
12752 }
12753
12754 return crypt.endian([a, b, c, d]);
12755 };
12756
12757 // Auxiliary functions
12758 md5._ff = function (a, b, c, d, x, s, t) {
12759 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
12760 return ((n << s) | (n >>> (32 - s))) + b;
12761 };
12762 md5._gg = function (a, b, c, d, x, s, t) {
12763 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
12764 return ((n << s) | (n >>> (32 - s))) + b;
12765 };
12766 md5._hh = function (a, b, c, d, x, s, t) {
12767 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
12768 return ((n << s) | (n >>> (32 - s))) + b;
12769 };
12770 md5._ii = function (a, b, c, d, x, s, t) {
12771 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
12772 return ((n << s) | (n >>> (32 - s))) + b;
12773 };
12774
12775 // Package private blocksize
12776 md5._blocksize = 16;
12777 md5._digestsize = 16;
12778
12779 module.exports = function (message, options) {
12780 if (message === undefined || message === null)
12781 throw new Error('Illegal argument ' + message);
12782
12783 var digestbytes = crypt.wordsToBytes(md5(message, options));
12784 return options && options.asBytes ? digestbytes :
12785 options && options.asString ? bin.bytesToString(digestbytes) :
12786 crypt.bytesToHex(digestbytes);
12787 };
12788
12789})();
12790
12791
12792/***/ }),
12793/* 318 */
12794/***/ (function(module, exports) {
12795
12796(function() {
12797 var base64map
12798 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
12799
12800 crypt = {
12801 // Bit-wise rotation left
12802 rotl: function(n, b) {
12803 return (n << b) | (n >>> (32 - b));
12804 },
12805
12806 // Bit-wise rotation right
12807 rotr: function(n, b) {
12808 return (n << (32 - b)) | (n >>> b);
12809 },
12810
12811 // Swap big-endian to little-endian and vice versa
12812 endian: function(n) {
12813 // If number given, swap endian
12814 if (n.constructor == Number) {
12815 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
12816 }
12817
12818 // Else, assume array and swap all items
12819 for (var i = 0; i < n.length; i++)
12820 n[i] = crypt.endian(n[i]);
12821 return n;
12822 },
12823
12824 // Generate an array of any length of random bytes
12825 randomBytes: function(n) {
12826 for (var bytes = []; n > 0; n--)
12827 bytes.push(Math.floor(Math.random() * 256));
12828 return bytes;
12829 },
12830
12831 // Convert a byte array to big-endian 32-bit words
12832 bytesToWords: function(bytes) {
12833 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
12834 words[b >>> 5] |= bytes[i] << (24 - b % 32);
12835 return words;
12836 },
12837
12838 // Convert big-endian 32-bit words to a byte array
12839 wordsToBytes: function(words) {
12840 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
12841 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
12842 return bytes;
12843 },
12844
12845 // Convert a byte array to a hex string
12846 bytesToHex: function(bytes) {
12847 for (var hex = [], i = 0; i < bytes.length; i++) {
12848 hex.push((bytes[i] >>> 4).toString(16));
12849 hex.push((bytes[i] & 0xF).toString(16));
12850 }
12851 return hex.join('');
12852 },
12853
12854 // Convert a hex string to a byte array
12855 hexToBytes: function(hex) {
12856 for (var bytes = [], c = 0; c < hex.length; c += 2)
12857 bytes.push(parseInt(hex.substr(c, 2), 16));
12858 return bytes;
12859 },
12860
12861 // Convert a byte array to a base-64 string
12862 bytesToBase64: function(bytes) {
12863 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
12864 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
12865 for (var j = 0; j < 4; j++)
12866 if (i * 8 + j * 6 <= bytes.length * 8)
12867 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
12868 else
12869 base64.push('=');
12870 }
12871 return base64.join('');
12872 },
12873
12874 // Convert a base-64 string to a byte array
12875 base64ToBytes: function(base64) {
12876 // Remove non-base-64 characters
12877 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
12878
12879 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
12880 imod4 = ++i % 4) {
12881 if (imod4 == 0) continue;
12882 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
12883 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
12884 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
12885 }
12886 return bytes;
12887 }
12888 };
12889
12890 module.exports = crypt;
12891})();
12892
12893
12894/***/ }),
12895/* 319 */
12896/***/ (function(module, exports) {
12897
12898/*!
12899 * Determine if an object is a Buffer
12900 *
12901 * @author Feross Aboukhadijeh <https://feross.org>
12902 * @license MIT
12903 */
12904
12905// The _isBuffer check is for Safari 5-7 support, because it's missing
12906// Object.prototype.constructor. Remove this eventually
12907module.exports = function (obj) {
12908 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
12909}
12910
12911function isBuffer (obj) {
12912 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
12913}
12914
12915// For Node v0.10 support. Remove this eventually.
12916function isSlowBuffer (obj) {
12917 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
12918}
12919
12920
12921/***/ }),
12922/* 320 */
12923/***/ (function(module, exports, __webpack_require__) {
12924
12925"use strict";
12926
12927
12928var dataURItoBlob = function dataURItoBlob(dataURI, type) {
12929 var byteString;
12930
12931 // 传入的 base64,不是 dataURL
12932 if (dataURI.indexOf('base64') < 0) {
12933 byteString = atob(dataURI);
12934 } else if (dataURI.split(',')[0].indexOf('base64') >= 0) {
12935 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
12936 byteString = atob(dataURI.split(',')[1]);
12937 } else {
12938 byteString = unescape(dataURI.split(',')[1]);
12939 }
12940 var ia = new Uint8Array(byteString.length);
12941 for (var i = 0; i < byteString.length; i++) {
12942 ia[i] = byteString.charCodeAt(i);
12943 }
12944 return new Blob([ia], { type: type });
12945};
12946
12947module.exports = dataURItoBlob;
12948
12949/***/ }),
12950/* 321 */
12951/***/ (function(module, exports, __webpack_require__) {
12952
12953"use strict";
12954
12955
12956var _getOwnPropertyDescriptor = __webpack_require__(179);
12957
12958var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
12959
12960var _stringify = __webpack_require__(21);
12961
12962var _stringify2 = _interopRequireDefault(_stringify);
12963
12964var _slicedToArray2 = __webpack_require__(324);
12965
12966var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
12967
12968var _promise = __webpack_require__(3);
12969
12970var _promise2 = _interopRequireDefault(_promise);
12971
12972function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12973
12974var _ = __webpack_require__(0);
12975var AVError = __webpack_require__(31);
12976
12977var _require = __webpack_require__(14),
12978 _request = _require._request;
12979
12980var _require2 = __webpack_require__(17),
12981 isNullOrUndefined = _require2.isNullOrUndefined,
12982 ensureArray = _require2.ensureArray,
12983 transformFetchOptions = _require2.transformFetchOptions,
12984 setValue = _require2.setValue,
12985 findValue = _require2.findValue,
12986 isPlainObject = _require2.isPlainObject,
12987 continueWhile = _require2.continueWhile;
12988
12989var recursiveToPointer = function recursiveToPointer(value) {
12990 if (_.isArray(value)) return value.map(recursiveToPointer);
12991 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
12992 if (_.isObject(value) && value._toPointer) return value._toPointer();
12993 return value;
12994};
12995
12996var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
12997var checkReservedKey = function checkReservedKey(key) {
12998 if (RESERVED_KEYS.indexOf(key) !== -1) {
12999 throw new Error('key[' + key + '] is reserved');
13000 }
13001};
13002
13003var handleBatchResults = function handleBatchResults(results) {
13004 var firstError = _.find(results, function (result) {
13005 return result instanceof Error;
13006 });
13007 if (!firstError) {
13008 return results;
13009 }
13010 var error = new AVError(firstError.code, firstError.message);
13011 error.results = results;
13012 throw error;
13013};
13014
13015// Helper function to get a value from a Backbone object as a property
13016// or as a function.
13017function getValue(object, prop) {
13018 if (!(object && object[prop])) {
13019 return null;
13020 }
13021 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
13022}
13023
13024// AV.Object is analogous to the Java AVObject.
13025// It also implements the same interface as a Backbone model.
13026
13027module.exports = function (AV) {
13028 /**
13029 * Creates a new model with defined attributes. A client id (cid) is
13030 * automatically generated and assigned for you.
13031 *
13032 * <p>You won't normally call this method directly. It is recommended that
13033 * you use a subclass of <code>AV.Object</code> instead, created by calling
13034 * <code>extend</code>.</p>
13035 *
13036 * <p>However, if you don't want to use a subclass, or aren't sure which
13037 * subclass is appropriate, you can use this form:<pre>
13038 * var object = new AV.Object("ClassName");
13039 * </pre>
13040 * That is basically equivalent to:<pre>
13041 * var MyClass = AV.Object.extend("ClassName");
13042 * var object = new MyClass();
13043 * </pre></p>
13044 *
13045 * @param {Object} attributes The initial set of data to store in the object.
13046 * @param {Object} options A set of Backbone-like options for creating the
13047 * object. The only option currently supported is "collection".
13048 * @see AV.Object.extend
13049 *
13050 * @class
13051 *
13052 * <p>The fundamental unit of AV data, which implements the Backbone Model
13053 * interface.</p>
13054 */
13055 AV.Object = function (attributes, options) {
13056 // Allow new AV.Object("ClassName") as a shortcut to _create.
13057 if (_.isString(attributes)) {
13058 return AV.Object._create.apply(this, arguments);
13059 }
13060
13061 attributes = attributes || {};
13062 if (options && options.parse) {
13063 attributes = this.parse(attributes);
13064 attributes = this._mergeMagicFields(attributes);
13065 }
13066 var defaults = getValue(this, 'defaults');
13067 if (defaults) {
13068 attributes = _.extend({}, defaults, attributes);
13069 }
13070 if (options && options.collection) {
13071 this.collection = options.collection;
13072 }
13073
13074 this._serverData = {}; // The last known data for this object from cloud.
13075 this._opSetQueue = [{}]; // List of sets of changes to the data.
13076 this._flags = {};
13077 this.attributes = {}; // The best estimate of this's current data.
13078
13079 this._hashedJSON = {}; // Hash of values of containers at last save.
13080 this._escapedAttributes = {};
13081 this.cid = _.uniqueId('c');
13082 this.changed = {};
13083 this._silent = {};
13084 this._pending = {};
13085 this.set(attributes, { silent: true });
13086 this.changed = {};
13087 this._silent = {};
13088 this._pending = {};
13089 this._hasData = true;
13090 this._previousAttributes = _.clone(this.attributes);
13091 this.initialize.apply(this, arguments);
13092 };
13093
13094 /**
13095 * @lends AV.Object.prototype
13096 * @property {String} id The objectId of the AV Object.
13097 */
13098
13099 /**
13100 * Saves the given list of AV.Object.
13101 * If any error is encountered, stops and calls the error handler.
13102 *
13103 * @example
13104 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
13105 * // All the objects were saved.
13106 * }, function(error) {
13107 * // An error occurred while saving one of the objects.
13108 * });
13109 *
13110 * @param {Array} list A list of <code>AV.Object</code>.
13111 */
13112 AV.Object.saveAll = function (list, options) {
13113 return AV.Object._deepSaveAsync(list, null, options);
13114 };
13115
13116 /**
13117 * Fetch the given list of AV.Object.
13118 *
13119 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
13120 * @param {AuthOptions} options
13121 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
13122 */
13123
13124 AV.Object.fetchAll = function (objects, options) {
13125 return _promise2.default.resolve().then(function () {
13126 return _request('batch', null, null, 'POST', {
13127 requests: _.map(objects, function (object) {
13128 if (!object.className) throw new Error('object must have className to fetch');
13129 if (!object.id) throw new Error('object must have id to fetch');
13130 if (object.dirty()) throw new Error('object is modified but not saved');
13131 return {
13132 method: 'GET',
13133 path: '/1.1/classes/' + object.className + '/' + object.id
13134 };
13135 })
13136 }, options);
13137 }).then(function (response) {
13138 var results = _.map(objects, function (object, i) {
13139 if (response[i].success) {
13140 var fetchedAttrs = object.parse(response[i].success);
13141 object._cleanupUnsetKeys(fetchedAttrs);
13142 object._finishFetch(fetchedAttrs);
13143 return object;
13144 }
13145 if (response[i].success === null) {
13146 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
13147 }
13148 return new AVError(response[i].error.code, response[i].error.error);
13149 });
13150 return handleBatchResults(results);
13151 });
13152 };
13153
13154 // Attach all inheritable methods to the AV.Object prototype.
13155 _.extend(AV.Object.prototype, AV.Events,
13156 /** @lends AV.Object.prototype */{
13157 _fetchWhenSave: false,
13158
13159 /**
13160 * Initialize is an empty function by default. Override it with your own
13161 * initialization logic.
13162 */
13163 initialize: function initialize() {},
13164
13165 /**
13166 * Set whether to enable fetchWhenSave option when updating object.
13167 * When set true, SDK would fetch the latest object after saving.
13168 * Default is false.
13169 *
13170 * @deprecated use AV.Object#save with options.fetchWhenSave instead
13171 * @param {boolean} enable true to enable fetchWhenSave option.
13172 */
13173 fetchWhenSave: function fetchWhenSave(enable) {
13174 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
13175 if (!_.isBoolean(enable)) {
13176 throw new Error('Expect boolean value for fetchWhenSave');
13177 }
13178 this._fetchWhenSave = enable;
13179 },
13180
13181 /**
13182 * Returns the object's objectId.
13183 * @return {String} the objectId.
13184 */
13185 getObjectId: function getObjectId() {
13186 return this.id;
13187 },
13188
13189 /**
13190 * Returns the object's createdAt attribute.
13191 * @return {Date}
13192 */
13193 getCreatedAt: function getCreatedAt() {
13194 return this.createdAt;
13195 },
13196
13197 /**
13198 * Returns the object's updatedAt attribute.
13199 * @return {Date}
13200 */
13201 getUpdatedAt: function getUpdatedAt() {
13202 return this.updatedAt;
13203 },
13204
13205 /**
13206 * Returns a JSON version of the object.
13207 * @return {Object}
13208 */
13209 toJSON: function toJSON(key, holder) {
13210 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
13211
13212 return this._toFullJSON(seenObjects, false);
13213 },
13214
13215 /**
13216 * Returns a JSON version of the object with meta data.
13217 * Inverse to {@link AV.parseJSON}
13218 * @since 3.0.0
13219 * @return {Object}
13220 */
13221 toFullJSON: function toFullJSON() {
13222 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
13223
13224 return this._toFullJSON(seenObjects);
13225 },
13226
13227
13228 _toFullJSON: function _toFullJSON(seenObjects) {
13229 var _this = this;
13230
13231 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
13232
13233 var json = _.clone(this.attributes);
13234 if (_.isArray(seenObjects)) {
13235 var newSeenObjects = seenObjects.concat(this);
13236 }
13237 AV._objectEach(json, function (val, key) {
13238 json[key] = AV._encode(val, newSeenObjects, undefined, full);
13239 });
13240 AV._objectEach(this._operations, function (val, key) {
13241 json[key] = val;
13242 });
13243
13244 if (_.has(this, 'id')) {
13245 json.objectId = this.id;
13246 }
13247 ['createdAt', 'updatedAt'].forEach(function (key) {
13248 if (_.has(_this, key)) {
13249 var val = _this[key];
13250 json[key] = _.isDate(val) ? val.toJSON() : val;
13251 }
13252 });
13253 if (full) {
13254 json.__type = 'Object';
13255 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
13256 json.className = this.className;
13257 }
13258 return json;
13259 },
13260
13261 /**
13262 * Updates _hashedJSON to reflect the current state of this object.
13263 * Adds any changed hash values to the set of pending changes.
13264 * @private
13265 */
13266 _refreshCache: function _refreshCache() {
13267 var self = this;
13268 if (self._refreshingCache) {
13269 return;
13270 }
13271 self._refreshingCache = true;
13272 AV._objectEach(this.attributes, function (value, key) {
13273 if (value instanceof AV.Object) {
13274 value._refreshCache();
13275 } else if (_.isObject(value)) {
13276 if (self._resetCacheForKey(key)) {
13277 self.set(key, new AV.Op.Set(value), { silent: true });
13278 }
13279 }
13280 });
13281 delete self._refreshingCache;
13282 },
13283
13284 /**
13285 * Returns true if this object has been modified since its last
13286 * save/refresh. If an attribute is specified, it returns true only if that
13287 * particular attribute has been modified since the last save/refresh.
13288 * @param {String} attr An attribute name (optional).
13289 * @return {Boolean}
13290 */
13291 dirty: function dirty(attr) {
13292 this._refreshCache();
13293
13294 var currentChanges = _.last(this._opSetQueue);
13295
13296 if (attr) {
13297 return currentChanges[attr] ? true : false;
13298 }
13299 if (!this.id) {
13300 return true;
13301 }
13302 if (_.keys(currentChanges).length > 0) {
13303 return true;
13304 }
13305 return false;
13306 },
13307
13308 /**
13309 * Returns the keys of the modified attribute since its last save/refresh.
13310 * @return {String[]}
13311 */
13312 dirtyKeys: function dirtyKeys() {
13313 this._refreshCache();
13314 var currentChanges = _.last(this._opSetQueue);
13315 return _.keys(currentChanges);
13316 },
13317
13318 /**
13319 * Gets a Pointer referencing this Object.
13320 * @private
13321 */
13322 _toPointer: function _toPointer() {
13323 // if (!this.id) {
13324 // throw new Error("Can't serialize an unsaved AV.Object");
13325 // }
13326 return {
13327 __type: 'Pointer',
13328 className: this.className,
13329 objectId: this.id
13330 };
13331 },
13332
13333 /**
13334 * Gets the value of an attribute.
13335 * @param {String} attr The string name of an attribute.
13336 */
13337 get: function get(attr) {
13338 switch (attr) {
13339 case 'objectId':
13340 return this.id;
13341 case 'createdAt':
13342 case 'updatedAt':
13343 return this[attr];
13344 default:
13345 return this.attributes[attr];
13346 }
13347 },
13348
13349 /**
13350 * Gets a relation on the given class for the attribute.
13351 * @param {String} attr The attribute to get the relation for.
13352 * @return {AV.Relation}
13353 */
13354 relation: function relation(attr) {
13355 var value = this.get(attr);
13356 if (value) {
13357 if (!(value instanceof AV.Relation)) {
13358 throw new Error('Called relation() on non-relation field ' + attr);
13359 }
13360 value._ensureParentAndKey(this, attr);
13361 return value;
13362 } else {
13363 return new AV.Relation(this, attr);
13364 }
13365 },
13366
13367 /**
13368 * Gets the HTML-escaped value of an attribute.
13369 */
13370 escape: function escape(attr) {
13371 var html = this._escapedAttributes[attr];
13372 if (html) {
13373 return html;
13374 }
13375 var val = this.attributes[attr];
13376 var escaped;
13377 if (isNullOrUndefined(val)) {
13378 escaped = '';
13379 } else {
13380 escaped = _.escape(val.toString());
13381 }
13382 this._escapedAttributes[attr] = escaped;
13383 return escaped;
13384 },
13385
13386 /**
13387 * Returns <code>true</code> if the attribute contains a value that is not
13388 * null or undefined.
13389 * @param {String} attr The string name of the attribute.
13390 * @return {Boolean}
13391 */
13392 has: function has(attr) {
13393 return !isNullOrUndefined(this.attributes[attr]);
13394 },
13395
13396 /**
13397 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
13398 * and puts them on "this" directly. Removes them from attrs.
13399 * @param attrs - A dictionary with the data for this AV.Object.
13400 * @private
13401 */
13402 _mergeMagicFields: function _mergeMagicFields(attrs) {
13403 // Check for changes of magic fields.
13404 var model = this;
13405 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
13406 AV._arrayEach(specialFields, function (attr) {
13407 if (attrs[attr]) {
13408 if (attr === 'objectId') {
13409 model.id = attrs[attr];
13410 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
13411 model[attr] = AV._parseDate(attrs[attr]);
13412 } else {
13413 model[attr] = attrs[attr];
13414 }
13415 delete attrs[attr];
13416 }
13417 });
13418 return attrs;
13419 },
13420
13421 /**
13422 * Returns the json to be sent to the server.
13423 * @private
13424 */
13425 _startSave: function _startSave() {
13426 this._opSetQueue.push({});
13427 },
13428
13429 /**
13430 * Called when a save fails because of an error. Any changes that were part
13431 * of the save need to be merged with changes made after the save. This
13432 * might throw an exception is you do conflicting operations. For example,
13433 * if you do:
13434 * object.set("foo", "bar");
13435 * object.set("invalid field name", "baz");
13436 * object.save();
13437 * object.increment("foo");
13438 * then this will throw when the save fails and the client tries to merge
13439 * "bar" with the +1.
13440 * @private
13441 */
13442 _cancelSave: function _cancelSave() {
13443 var failedChanges = _.first(this._opSetQueue);
13444 this._opSetQueue = _.rest(this._opSetQueue);
13445 var nextChanges = _.first(this._opSetQueue);
13446 AV._objectEach(failedChanges, function (op, key) {
13447 var op1 = failedChanges[key];
13448 var op2 = nextChanges[key];
13449 if (op1 && op2) {
13450 nextChanges[key] = op2._mergeWithPrevious(op1);
13451 } else if (op1) {
13452 nextChanges[key] = op1;
13453 }
13454 });
13455 this._saving = this._saving - 1;
13456 },
13457
13458 /**
13459 * Called when a save completes successfully. This merges the changes that
13460 * were saved into the known server data, and overrides it with any data
13461 * sent directly from the server.
13462 * @private
13463 */
13464 _finishSave: function _finishSave(serverData) {
13465 // Grab a copy of any object referenced by this object. These instances
13466 // may have already been fetched, and we don't want to lose their data.
13467 // Note that doing it like this means we will unify separate copies of the
13468 // same object, but that's a risk we have to take.
13469 var fetchedObjects = {};
13470 AV._traverse(this.attributes, function (object) {
13471 if (object instanceof AV.Object && object.id && object._hasData) {
13472 fetchedObjects[object.id] = object;
13473 }
13474 });
13475
13476 var savedChanges = _.first(this._opSetQueue);
13477 this._opSetQueue = _.rest(this._opSetQueue);
13478 this._applyOpSet(savedChanges, this._serverData);
13479 this._mergeMagicFields(serverData);
13480 var self = this;
13481 AV._objectEach(serverData, function (value, key) {
13482 self._serverData[key] = AV._decode(value, key);
13483
13484 // Look for any objects that might have become unfetched and fix them
13485 // by replacing their values with the previously observed values.
13486 var fetched = AV._traverse(self._serverData[key], function (object) {
13487 if (object instanceof AV.Object && fetchedObjects[object.id]) {
13488 return fetchedObjects[object.id];
13489 }
13490 });
13491 if (fetched) {
13492 self._serverData[key] = fetched;
13493 }
13494 });
13495 this._rebuildAllEstimatedData();
13496 var opSetQueue = this._opSetQueue.map(_.clone);
13497 this._refreshCache();
13498 this._opSetQueue = opSetQueue;
13499 this._saving = this._saving - 1;
13500 },
13501
13502 /**
13503 * Called when a fetch or login is complete to set the known server data to
13504 * the given object.
13505 * @private
13506 */
13507 _finishFetch: function _finishFetch(serverData, hasData) {
13508 // Clear out any changes the user might have made previously.
13509 this._opSetQueue = [{}];
13510
13511 // Bring in all the new server data.
13512 this._mergeMagicFields(serverData);
13513 var self = this;
13514 AV._objectEach(serverData, function (value, key) {
13515 self._serverData[key] = AV._decode(value, key);
13516 });
13517
13518 // Refresh the attributes.
13519 this._rebuildAllEstimatedData();
13520
13521 // Clear out the cache of mutable containers.
13522 this._refreshCache();
13523 this._opSetQueue = [{}];
13524
13525 this._hasData = hasData;
13526 },
13527
13528 /**
13529 * Applies the set of AV.Op in opSet to the object target.
13530 * @private
13531 */
13532 _applyOpSet: function _applyOpSet(opSet, target) {
13533 var self = this;
13534 AV._objectEach(opSet, function (change, key) {
13535 var _findValue = findValue(target, key),
13536 _findValue2 = (0, _slicedToArray3.default)(_findValue, 3),
13537 value = _findValue2[0],
13538 actualTarget = _findValue2[1],
13539 actualKey = _findValue2[2];
13540
13541 setValue(target, key, change._estimate(value, self, key));
13542 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
13543 delete actualTarget[actualKey];
13544 }
13545 });
13546 },
13547
13548 /**
13549 * Replaces the cached value for key with the current value.
13550 * Returns true if the new value is different than the old value.
13551 * @private
13552 */
13553 _resetCacheForKey: function _resetCacheForKey(key) {
13554 var value = this.attributes[key];
13555 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
13556 var json = (0, _stringify2.default)(recursiveToPointer(value));
13557 if (this._hashedJSON[key] !== json) {
13558 var wasSet = !!this._hashedJSON[key];
13559 this._hashedJSON[key] = json;
13560 return wasSet;
13561 }
13562 }
13563 return false;
13564 },
13565
13566 /**
13567 * Populates attributes[key] by starting with the last known data from the
13568 * server, and applying all of the local changes that have been made to that
13569 * key since then.
13570 * @private
13571 */
13572 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
13573 var self = this;
13574 delete this.attributes[key];
13575 if (this._serverData[key]) {
13576 this.attributes[key] = this._serverData[key];
13577 }
13578 AV._arrayEach(this._opSetQueue, function (opSet) {
13579 var op = opSet[key];
13580 if (op) {
13581 var _findValue3 = findValue(self.attributes, key),
13582 _findValue4 = (0, _slicedToArray3.default)(_findValue3, 4),
13583 value = _findValue4[0],
13584 actualTarget = _findValue4[1],
13585 actualKey = _findValue4[2],
13586 firstKey = _findValue4[3];
13587
13588 setValue(self.attributes, key, op._estimate(value, self, key));
13589 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
13590 delete actualTarget[actualKey];
13591 }
13592 self._resetCacheForKey(firstKey);
13593 }
13594 });
13595 },
13596
13597 /**
13598 * Populates attributes by starting with the last known data from the
13599 * server, and applying all of the local changes that have been made since
13600 * then.
13601 * @private
13602 */
13603 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
13604 var self = this;
13605
13606 var previousAttributes = _.clone(this.attributes);
13607
13608 this.attributes = _.clone(this._serverData);
13609 AV._arrayEach(this._opSetQueue, function (opSet) {
13610 self._applyOpSet(opSet, self.attributes);
13611 AV._objectEach(opSet, function (op, key) {
13612 self._resetCacheForKey(key);
13613 });
13614 });
13615
13616 // Trigger change events for anything that changed because of the fetch.
13617 AV._objectEach(previousAttributes, function (oldValue, key) {
13618 if (self.attributes[key] !== oldValue) {
13619 self.trigger('change:' + key, self, self.attributes[key], {});
13620 }
13621 });
13622 AV._objectEach(this.attributes, function (newValue, key) {
13623 if (!_.has(previousAttributes, key)) {
13624 self.trigger('change:' + key, self, newValue, {});
13625 }
13626 });
13627 },
13628
13629 /**
13630 * Sets a hash of model attributes on the object, firing
13631 * <code>"change"</code> unless you choose to silence it.
13632 *
13633 * <p>You can call it with an object containing keys and values, or with one
13634 * key and value. For example:</p>
13635 *
13636 * @example
13637 * gameTurn.set({
13638 * player: player1,
13639 * diceRoll: 2
13640 * });
13641 *
13642 * game.set("currentPlayer", player2);
13643 *
13644 * game.set("finished", true);
13645 *
13646 * @param {String} key The key to set.
13647 * @param {Any} value The value to give it.
13648 * @param {Object} [options]
13649 * @param {Boolean} [options.silent]
13650 * @return {AV.Object} self if succeeded, throws if the value is not valid.
13651 * @see AV.Object#validate
13652 */
13653 set: function set(key, value, options) {
13654 var attrs;
13655 if (_.isObject(key) || isNullOrUndefined(key)) {
13656 attrs = _.mapObject(key, function (v, k) {
13657 checkReservedKey(k);
13658 return AV._decode(v, k);
13659 });
13660 options = value;
13661 } else {
13662 attrs = {};
13663 checkReservedKey(key);
13664 attrs[key] = AV._decode(value, key);
13665 }
13666
13667 // Extract attributes and options.
13668 options = options || {};
13669 if (!attrs) {
13670 return this;
13671 }
13672 if (attrs instanceof AV.Object) {
13673 attrs = attrs.attributes;
13674 }
13675
13676 // If the unset option is used, every attribute should be a Unset.
13677 if (options.unset) {
13678 AV._objectEach(attrs, function (unused_value, key) {
13679 attrs[key] = new AV.Op.Unset();
13680 });
13681 }
13682
13683 // Apply all the attributes to get the estimated values.
13684 var dataToValidate = _.clone(attrs);
13685 var self = this;
13686 AV._objectEach(dataToValidate, function (value, key) {
13687 if (value instanceof AV.Op) {
13688 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
13689 if (dataToValidate[key] === AV.Op._UNSET) {
13690 delete dataToValidate[key];
13691 }
13692 }
13693 });
13694
13695 // Run validation.
13696 this._validate(attrs, options);
13697
13698 options.changes = {};
13699 var escaped = this._escapedAttributes;
13700
13701 // Update attributes.
13702 AV._arrayEach(_.keys(attrs), function (attr) {
13703 var val = attrs[attr];
13704
13705 // If this is a relation object we need to set the parent correctly,
13706 // since the location where it was parsed does not have access to
13707 // this object.
13708 if (val instanceof AV.Relation) {
13709 val.parent = self;
13710 }
13711
13712 if (!(val instanceof AV.Op)) {
13713 val = new AV.Op.Set(val);
13714 }
13715
13716 // See if this change will actually have any effect.
13717 var isRealChange = true;
13718 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
13719 isRealChange = false;
13720 }
13721
13722 if (isRealChange) {
13723 delete escaped[attr];
13724 if (options.silent) {
13725 self._silent[attr] = true;
13726 } else {
13727 options.changes[attr] = true;
13728 }
13729 }
13730
13731 var currentChanges = _.last(self._opSetQueue);
13732 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
13733 self._rebuildEstimatedDataForKey(attr);
13734
13735 if (isRealChange) {
13736 self.changed[attr] = self.attributes[attr];
13737 if (!options.silent) {
13738 self._pending[attr] = true;
13739 }
13740 } else {
13741 delete self.changed[attr];
13742 delete self._pending[attr];
13743 }
13744 });
13745
13746 if (!options.silent) {
13747 this.change(options);
13748 }
13749 return this;
13750 },
13751
13752 /**
13753 * Remove an attribute from the model, firing <code>"change"</code> unless
13754 * you choose to silence it. This is a noop if the attribute doesn't
13755 * exist.
13756 * @param key {String} The key.
13757 */
13758 unset: function unset(attr, options) {
13759 options = options || {};
13760 options.unset = true;
13761 return this.set(attr, null, options);
13762 },
13763
13764 /**
13765 * Atomically increments the value of the given attribute the next time the
13766 * object is saved. If no amount is specified, 1 is used by default.
13767 *
13768 * @param key {String} The key.
13769 * @param amount {Number} The amount to increment by.
13770 */
13771 increment: function increment(attr, amount) {
13772 if (_.isUndefined(amount) || _.isNull(amount)) {
13773 amount = 1;
13774 }
13775 return this.set(attr, new AV.Op.Increment(amount));
13776 },
13777
13778 /**
13779 * Atomically add an object to the end of the array associated with a given
13780 * key.
13781 * @param key {String} The key.
13782 * @param item {} The item to add.
13783 */
13784 add: function add(attr, item) {
13785 return this.set(attr, new AV.Op.Add(ensureArray(item)));
13786 },
13787
13788 /**
13789 * Atomically add an object to the array associated with a given key, only
13790 * if it is not already present in the array. The position of the insert is
13791 * not guaranteed.
13792 *
13793 * @param key {String} The key.
13794 * @param item {} The object to add.
13795 */
13796 addUnique: function addUnique(attr, item) {
13797 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
13798 },
13799
13800 /**
13801 * Atomically remove all instances of an object from the array associated
13802 * with a given key.
13803 *
13804 * @param key {String} The key.
13805 * @param item {} The object to remove.
13806 */
13807 remove: function remove(attr, item) {
13808 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
13809 },
13810
13811 /**
13812 * Atomically apply a "bit and" operation on the value associated with a
13813 * given key.
13814 *
13815 * @param key {String} The key.
13816 * @param value {Number} The value to apply.
13817 */
13818 bitAnd: function bitAnd(attr, value) {
13819 return this.set(attr, new AV.Op.BitAnd(value));
13820 },
13821
13822
13823 /**
13824 * Atomically apply a "bit or" operation on the value associated with a
13825 * given key.
13826 *
13827 * @param key {String} The key.
13828 * @param value {Number} The value to apply.
13829 */
13830 bitOr: function bitOr(attr, value) {
13831 return this.set(attr, new AV.Op.BitOr(value));
13832 },
13833
13834
13835 /**
13836 * Atomically apply a "bit xor" operation on the value associated with a
13837 * given key.
13838 *
13839 * @param key {String} The key.
13840 * @param value {Number} The value to apply.
13841 */
13842 bitXor: function bitXor(attr, value) {
13843 return this.set(attr, new AV.Op.BitXor(value));
13844 },
13845
13846
13847 /**
13848 * Returns an instance of a subclass of AV.Op describing what kind of
13849 * modification has been performed on this field since the last time it was
13850 * saved. For example, after calling object.increment("x"), calling
13851 * object.op("x") would return an instance of AV.Op.Increment.
13852 *
13853 * @param key {String} The key.
13854 * @returns {AV.Op} The operation, or undefined if none.
13855 */
13856 op: function op(attr) {
13857 return _.last(this._opSetQueue)[attr];
13858 },
13859
13860 /**
13861 * Clear all attributes on the model, firing <code>"change"</code> unless
13862 * you choose to silence it.
13863 */
13864 clear: function clear(options) {
13865 options = options || {};
13866 options.unset = true;
13867 var keysToClear = _.extend(this.attributes, this._operations);
13868 return this.set(keysToClear, options);
13869 },
13870
13871 /**
13872 * Clears any (or specific) changes to the model made since the last save.
13873 * @param {string|string[]} [keys] specify keys to revert.
13874 */
13875 revert: function revert(keys) {
13876 var lastOp = _.last(this._opSetQueue);
13877 var _keys = ensureArray(keys || _.keys(lastOp));
13878 _keys.forEach(function (key) {
13879 delete lastOp[key];
13880 });
13881 this._rebuildAllEstimatedData();
13882 return this;
13883 },
13884
13885
13886 /**
13887 * Returns a JSON-encoded set of operations to be sent with the next save
13888 * request.
13889 * @private
13890 */
13891 _getSaveJSON: function _getSaveJSON() {
13892 var json = _.clone(_.first(this._opSetQueue));
13893 AV._objectEach(json, function (op, key) {
13894 json[key] = op.toJSON();
13895 });
13896 return json;
13897 },
13898
13899 /**
13900 * Returns true if this object can be serialized for saving.
13901 * @private
13902 */
13903 _canBeSerialized: function _canBeSerialized() {
13904 return AV.Object._canBeSerializedAsValue(this.attributes);
13905 },
13906
13907 /**
13908 * Fetch the model from the server. If the server's representation of the
13909 * model differs from its current attributes, they will be overriden,
13910 * triggering a <code>"change"</code> event.
13911 * @param {Object} fetchOptions Optional options to set 'keys',
13912 * 'include' and 'includeACL' option.
13913 * @param {AuthOptions} options
13914 * @return {Promise} A promise that is fulfilled when the fetch
13915 * completes.
13916 */
13917 fetch: function fetch() {
13918 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13919 var options = arguments[1];
13920
13921 if (!this.id) {
13922 throw new Error('Cannot fetch unsaved object');
13923 }
13924 var self = this;
13925 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
13926 return request.then(function (response) {
13927 var fetchedAttrs = self.parse(response);
13928 self._cleanupUnsetKeys(fetchedAttrs, fetchOptions.keys ? ensureArray(fetchOptions.keys).join(',').split(',') : undefined);
13929 self._finishFetch(fetchedAttrs, true);
13930 return self;
13931 });
13932 },
13933
13934 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
13935 var _this2 = this;
13936
13937 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _.keys(this._serverData);
13938
13939 _.forEach(fetchedKeys, function (key) {
13940 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
13941 });
13942 },
13943
13944
13945 /**
13946 * Set a hash of model attributes, and save the model to the server.
13947 * updatedAt will be updated when the request returns.
13948 * You can either call it as:<pre>
13949 * object.save();</pre>
13950 * or<pre>
13951 * object.save(null, options);</pre>
13952 * or<pre>
13953 * object.save(attrs, options);</pre>
13954 * or<pre>
13955 * object.save(key, value, options);</pre>
13956 *
13957 * @example
13958 * gameTurn.save({
13959 * player: "Jake Cutter",
13960 * diceRoll: 2
13961 * }).then(function(gameTurnAgain) {
13962 * // The save was successful.
13963 * }, function(error) {
13964 * // The save failed. Error is an instance of AVError.
13965 * });
13966 *
13967 * @param {AuthOptions} options AuthOptions plus:
13968 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
13969 * @param {AV.Query} options.query Save object only when it matches the query
13970 * @return {Promise} A promise that is fulfilled when the save
13971 * completes.
13972 * @see AVError
13973 */
13974 save: function save(arg1, arg2, arg3) {
13975 var attrs, current, options;
13976 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
13977 attrs = arg1;
13978 options = arg2;
13979 } else {
13980 attrs = {};
13981 attrs[arg1] = arg2;
13982 options = arg3;
13983 }
13984
13985 options = _.clone(options) || {};
13986 if (options.wait) {
13987 current = _.clone(this.attributes);
13988 }
13989
13990 var setOptions = _.clone(options) || {};
13991 if (setOptions.wait) {
13992 setOptions.silent = true;
13993 }
13994 if (attrs) {
13995 this.set(attrs, setOptions);
13996 }
13997
13998 var model = this;
13999
14000 var unsavedChildren = [];
14001 var unsavedFiles = [];
14002 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
14003 if (unsavedChildren.length + unsavedFiles.length > 1) {
14004 return AV.Object._deepSaveAsync(this, model, options);
14005 }
14006
14007 this._startSave();
14008 this._saving = (this._saving || 0) + 1;
14009
14010 this._allPreviousSaves = this._allPreviousSaves || _promise2.default.resolve();
14011 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
14012 var method = model.id ? 'PUT' : 'POST';
14013
14014 var json = model._getSaveJSON();
14015 var query = {};
14016
14017 if (model._fetchWhenSave || options.fetchWhenSave) {
14018 query['new'] = 'true';
14019 }
14020 // user login option
14021 if (options._failOnNotExist) {
14022 query.failOnNotExist = 'true';
14023 }
14024
14025 if (options.query) {
14026 var queryParams;
14027 if (typeof options.query._getParams === 'function') {
14028 queryParams = options.query._getParams();
14029 if (queryParams) {
14030 query.where = queryParams.where;
14031 }
14032 }
14033 if (!query.where) {
14034 var error = new Error('options.query is not an AV.Query');
14035 throw error;
14036 }
14037 }
14038
14039 _.extend(json, model._flags);
14040
14041 var route = 'classes';
14042 var className = model.className;
14043 if (model.className === '_User' && !model.id) {
14044 // Special-case user sign-up.
14045 route = 'users';
14046 className = null;
14047 }
14048 //hook makeRequest in options.
14049 var makeRequest = options._makeRequest || _request;
14050 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
14051
14052 requestPromise = requestPromise.then(function (resp) {
14053 var serverAttrs = model.parse(resp);
14054 if (options.wait) {
14055 serverAttrs = _.extend(attrs || {}, serverAttrs);
14056 }
14057 model._finishSave(serverAttrs);
14058 if (options.wait) {
14059 model.set(current, setOptions);
14060 }
14061 return model;
14062 }, function (error) {
14063 model._cancelSave();
14064 throw error;
14065 });
14066
14067 return requestPromise;
14068 });
14069 return this._allPreviousSaves;
14070 },
14071
14072 /**
14073 * Destroy this model on the server if it was already persisted.
14074 * Optimistically removes the model from its collection, if it has one.
14075 * @param {AuthOptions} options AuthOptions plus:
14076 * @param {Boolean} [options.wait] wait for the server to respond
14077 * before removal.
14078 *
14079 * @return {Promise} A promise that is fulfilled when the destroy
14080 * completes.
14081 */
14082 destroy: function destroy(options) {
14083 options = options || {};
14084 var model = this;
14085
14086 var triggerDestroy = function triggerDestroy() {
14087 model.trigger('destroy', model, model.collection, options);
14088 };
14089
14090 if (!this.id) {
14091 return triggerDestroy();
14092 }
14093
14094 if (!options.wait) {
14095 triggerDestroy();
14096 }
14097
14098 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
14099 return request.then(function () {
14100 if (options.wait) {
14101 triggerDestroy();
14102 }
14103 return model;
14104 });
14105 },
14106
14107 /**
14108 * Converts a response into the hash of attributes to be set on the model.
14109 * @ignore
14110 */
14111 parse: function parse(resp) {
14112 var output = _.clone(resp);
14113 ['createdAt', 'updatedAt'].forEach(function (key) {
14114 if (output[key]) {
14115 output[key] = AV._parseDate(output[key]);
14116 }
14117 });
14118 if (output.createdAt && !output.updatedAt) {
14119 output.updatedAt = output.createdAt;
14120 }
14121 return output;
14122 },
14123
14124 /**
14125 * Creates a new model with identical attributes to this one.
14126 * @return {AV.Object}
14127 */
14128 clone: function clone() {
14129 return new this.constructor(this.attributes);
14130 },
14131
14132 /**
14133 * Returns true if this object has never been saved to AV.
14134 * @return {Boolean}
14135 */
14136 isNew: function isNew() {
14137 return !this.id;
14138 },
14139
14140 /**
14141 * Call this method to manually fire a `"change"` event for this model and
14142 * a `"change:attribute"` event for each changed attribute.
14143 * Calling this will cause all objects observing the model to update.
14144 */
14145 change: function change(options) {
14146 options = options || {};
14147 var changing = this._changing;
14148 this._changing = true;
14149
14150 // Silent changes become pending changes.
14151 var self = this;
14152 AV._objectEach(this._silent, function (attr) {
14153 self._pending[attr] = true;
14154 });
14155
14156 // Silent changes are triggered.
14157 var changes = _.extend({}, options.changes, this._silent);
14158 this._silent = {};
14159 AV._objectEach(changes, function (unused_value, attr) {
14160 self.trigger('change:' + attr, self, self.get(attr), options);
14161 });
14162 if (changing) {
14163 return this;
14164 }
14165
14166 // This is to get around lint not letting us make a function in a loop.
14167 var deleteChanged = function deleteChanged(value, attr) {
14168 if (!self._pending[attr] && !self._silent[attr]) {
14169 delete self.changed[attr];
14170 }
14171 };
14172
14173 // Continue firing `"change"` events while there are pending changes.
14174 while (!_.isEmpty(this._pending)) {
14175 this._pending = {};
14176 this.trigger('change', this, options);
14177 // Pending and silent changes still remain.
14178 AV._objectEach(this.changed, deleteChanged);
14179 self._previousAttributes = _.clone(this.attributes);
14180 }
14181
14182 this._changing = false;
14183 return this;
14184 },
14185
14186 /**
14187 * Gets the previous value of an attribute, recorded at the time the last
14188 * <code>"change"</code> event was fired.
14189 * @param {String} attr Name of the attribute to get.
14190 */
14191 previous: function previous(attr) {
14192 if (!arguments.length || !this._previousAttributes) {
14193 return null;
14194 }
14195 return this._previousAttributes[attr];
14196 },
14197
14198 /**
14199 * Gets all of the attributes of the model at the time of the previous
14200 * <code>"change"</code> event.
14201 * @return {Object}
14202 */
14203 previousAttributes: function previousAttributes() {
14204 return _.clone(this._previousAttributes);
14205 },
14206
14207 /**
14208 * Checks if the model is currently in a valid state. It's only possible to
14209 * get into an *invalid* state if you're using silent changes.
14210 * @return {Boolean}
14211 */
14212 isValid: function isValid() {
14213 try {
14214 this.validate(this.attributes);
14215 } catch (error) {
14216 return false;
14217 }
14218 return true;
14219 },
14220
14221 /**
14222 * You should not call this function directly unless you subclass
14223 * <code>AV.Object</code>, in which case you can override this method
14224 * to provide additional validation on <code>set</code> and
14225 * <code>save</code>. Your implementation should throw an Error if
14226 * the attrs is invalid
14227 *
14228 * @param {Object} attrs The current data to validate.
14229 * @see AV.Object#set
14230 */
14231 validate: function validate(attrs) {
14232 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
14233 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
14234 }
14235 },
14236
14237 /**
14238 * Run validation against a set of incoming attributes, returning `true`
14239 * if all is well. If a specific `error` callback has been passed,
14240 * call that instead of firing the general `"error"` event.
14241 * @private
14242 */
14243 _validate: function _validate(attrs, options) {
14244 if (options.silent || !this.validate) {
14245 return;
14246 }
14247 attrs = _.extend({}, this.attributes, attrs);
14248 this.validate(attrs);
14249 },
14250
14251 /**
14252 * Returns the ACL for this object.
14253 * @returns {AV.ACL} An instance of AV.ACL.
14254 * @see AV.Object#get
14255 */
14256 getACL: function getACL() {
14257 return this.get('ACL');
14258 },
14259
14260 /**
14261 * Sets the ACL to be used for this object.
14262 * @param {AV.ACL} acl An instance of AV.ACL.
14263 * @param {Object} options Optional Backbone-like options object to be
14264 * passed in to set.
14265 * @return {AV.Object} self
14266 * @see AV.Object#set
14267 */
14268 setACL: function setACL(acl, options) {
14269 return this.set('ACL', acl, options);
14270 },
14271
14272 disableBeforeHook: function disableBeforeHook() {
14273 this.ignoreHook('beforeSave');
14274 this.ignoreHook('beforeUpdate');
14275 this.ignoreHook('beforeDelete');
14276 },
14277
14278 disableAfterHook: function disableAfterHook() {
14279 this.ignoreHook('afterSave');
14280 this.ignoreHook('afterUpdate');
14281 this.ignoreHook('afterDelete');
14282 },
14283
14284 ignoreHook: function ignoreHook(hookName) {
14285 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
14286 throw new Error('Unsupported hookName: ' + hookName);
14287 }
14288
14289 if (!AV.hookKey) {
14290 throw new Error('ignoreHook required hookKey');
14291 }
14292
14293 if (!this._flags.__ignore_hooks) {
14294 this._flags.__ignore_hooks = [];
14295 }
14296
14297 this._flags.__ignore_hooks.push(hookName);
14298 }
14299 });
14300
14301 /**
14302 * Creates an instance of a subclass of AV.Object for the give classname
14303 * and id.
14304 * @param {String|Function} class the className or a subclass of AV.Object.
14305 * @param {String} id The object id of this model.
14306 * @return {AV.Object} A new subclass instance of AV.Object.
14307 */
14308 AV.Object.createWithoutData = function (klass, id, hasData) {
14309 var _klass = void 0;
14310 if (_.isString(klass)) {
14311 _klass = AV.Object._getSubclass(klass);
14312 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
14313 _klass = klass;
14314 } else {
14315 throw new Error('class must be a string or a subclass of AV.Object.');
14316 }
14317 if (!id) {
14318 throw new TypeError('The objectId must be provided');
14319 }
14320 var object = new _klass();
14321 object.id = id;
14322 object._hasData = hasData;
14323 return object;
14324 };
14325 /**
14326 * Delete objects in batch.
14327 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
14328 * @param {AuthOptions} options
14329 * @return {Promise} A promise that is fulfilled when the save
14330 * completes.
14331 */
14332 AV.Object.destroyAll = function (objects) {
14333 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14334
14335 if (!objects || objects.length === 0) {
14336 return _promise2.default.resolve();
14337 }
14338 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
14339 return (0, _stringify2.default)({
14340 className: object.className,
14341 flags: object._flags
14342 });
14343 });
14344 var body = {
14345 requests: _.map(objectsByClassNameAndFlags, function (objects) {
14346 var ids = _.map(objects, 'id').join(',');
14347 return {
14348 method: 'DELETE',
14349 path: '/1.1/classes/' + objects[0].className + '/' + ids,
14350 body: objects[0]._flags
14351 };
14352 })
14353 };
14354 return _request('batch', null, null, 'POST', body, options).then(function (response) {
14355 var firstError = _.find(response, function (result) {
14356 return !result.success;
14357 });
14358 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
14359 return undefined;
14360 });
14361 };
14362
14363 /**
14364 * Returns the appropriate subclass for making new instances of the given
14365 * className string.
14366 * @private
14367 */
14368 AV.Object._getSubclass = function (className) {
14369 if (!_.isString(className)) {
14370 throw new Error('AV.Object._getSubclass requires a string argument.');
14371 }
14372 var ObjectClass = AV.Object._classMap[className];
14373 if (!ObjectClass) {
14374 ObjectClass = AV.Object.extend(className);
14375 AV.Object._classMap[className] = ObjectClass;
14376 }
14377 return ObjectClass;
14378 };
14379
14380 /**
14381 * Creates an instance of a subclass of AV.Object for the given classname.
14382 * @private
14383 */
14384 AV.Object._create = function (className, attributes, options) {
14385 var ObjectClass = AV.Object._getSubclass(className);
14386 return new ObjectClass(attributes, options);
14387 };
14388
14389 // Set up a map of className to class so that we can create new instances of
14390 // AV Objects from JSON automatically.
14391 AV.Object._classMap = {};
14392
14393 AV.Object._extend = AV._extend;
14394
14395 /**
14396 * Creates a new model with defined attributes,
14397 * It's the same with
14398 * <pre>
14399 * new AV.Object(attributes, options);
14400 * </pre>
14401 * @param {Object} attributes The initial set of data to store in the object.
14402 * @param {Object} options A set of Backbone-like options for creating the
14403 * object. The only option currently supported is "collection".
14404 * @return {AV.Object}
14405 * @since v0.4.4
14406 * @see AV.Object
14407 * @see AV.Object.extend
14408 */
14409 AV.Object['new'] = function (attributes, options) {
14410 return new AV.Object(attributes, options);
14411 };
14412
14413 /**
14414 * Creates a new subclass of AV.Object for the given AV class name.
14415 *
14416 * <p>Every extension of a AV class will inherit from the most recent
14417 * previous extension of that class. When a AV.Object is automatically
14418 * created by parsing JSON, it will use the most recent extension of that
14419 * class.</p>
14420 *
14421 * @example
14422 * var MyClass = AV.Object.extend("MyClass", {
14423 * // Instance properties
14424 * }, {
14425 * // Class properties
14426 * });
14427 *
14428 * @param {String} className The name of the AV class backing this model.
14429 * @param {Object} protoProps Instance properties to add to instances of the
14430 * class returned from this method.
14431 * @param {Object} classProps Class properties to add the class returned from
14432 * this method.
14433 * @return {Class} A new subclass of AV.Object.
14434 */
14435 AV.Object.extend = function (className, protoProps, classProps) {
14436 // Handle the case with only two args.
14437 if (!_.isString(className)) {
14438 if (className && _.has(className, 'className')) {
14439 return AV.Object.extend(className.className, className, protoProps);
14440 } else {
14441 throw new Error("AV.Object.extend's first argument should be the className.");
14442 }
14443 }
14444
14445 // If someone tries to subclass "User", coerce it to the right type.
14446 if (className === 'User') {
14447 className = '_User';
14448 }
14449
14450 var NewClassObject = null;
14451 if (_.has(AV.Object._classMap, className)) {
14452 var OldClassObject = AV.Object._classMap[className];
14453 // This new subclass has been told to extend both from "this" and from
14454 // OldClassObject. This is multiple inheritance, which isn't supported.
14455 // For now, let's just pick one.
14456 if (protoProps || classProps) {
14457 NewClassObject = OldClassObject._extend(protoProps, classProps);
14458 } else {
14459 return OldClassObject;
14460 }
14461 } else {
14462 protoProps = protoProps || {};
14463 protoProps._className = className;
14464 NewClassObject = this._extend(protoProps, classProps);
14465 }
14466 // Extending a subclass should reuse the classname automatically.
14467 NewClassObject.extend = function (arg0) {
14468 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
14469 return AV.Object.extend.apply(NewClassObject, arguments);
14470 }
14471 var newArguments = [className].concat(_.toArray(arguments));
14472 return AV.Object.extend.apply(NewClassObject, newArguments);
14473 };
14474 // Add the query property descriptor.
14475 Object.defineProperty(NewClassObject, 'query', (0, _getOwnPropertyDescriptor2.default)(AV.Object, 'query'));
14476 NewClassObject['new'] = function (attributes, options) {
14477 return new NewClassObject(attributes, options);
14478 };
14479 AV.Object._classMap[className] = NewClassObject;
14480 return NewClassObject;
14481 };
14482
14483 // ES6 class syntax support
14484 Object.defineProperty(AV.Object.prototype, 'className', {
14485 get: function get() {
14486 var className = this._className || this.constructor._LCClassName || this.constructor.name;
14487 // If someone tries to subclass "User", coerce it to the right type.
14488 if (className === 'User') {
14489 return '_User';
14490 }
14491 return className;
14492 }
14493 });
14494
14495 /**
14496 * Register a class.
14497 * If a subclass of <code>AV.Object</code> is defined with your own implement
14498 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
14499 * @param {Function} klass A subclass of <code>AV.Object</code>
14500 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
14501 * @example
14502 * class Person extend AV.Object {}
14503 * AV.Object.register(Person);
14504 */
14505 AV.Object.register = function (klass, name) {
14506 if (!(klass.prototype instanceof AV.Object)) {
14507 throw new Error('registered class is not a subclass of AV.Object');
14508 }
14509 var className = name || klass.name;
14510 if (!className.length) {
14511 throw new Error('registered class must be named');
14512 }
14513 if (name) {
14514 klass._LCClassName = name;
14515 }
14516 AV.Object._classMap[className] = klass;
14517 };
14518
14519 /**
14520 * Get a new Query of the current class
14521 * @name query
14522 * @memberof AV.Object
14523 * @type AV.Query
14524 * @readonly
14525 * @since v3.1.0
14526 * @example
14527 * const Post = AV.Object.extend('Post');
14528 * Post.query.equalTo('author', 'leancloud').find().then();
14529 */
14530 Object.defineProperty(AV.Object, 'query', {
14531 get: function get() {
14532 return new AV.Query(this.prototype.className);
14533 }
14534 });
14535
14536 AV.Object._findUnsavedChildren = function (objects, children, files) {
14537 AV._traverse(objects, function (object) {
14538 if (object instanceof AV.Object) {
14539 if (object.dirty()) {
14540 children.push(object);
14541 }
14542 return;
14543 }
14544
14545 if (object instanceof AV.File) {
14546 if (!object.id) {
14547 files.push(object);
14548 }
14549 return;
14550 }
14551 });
14552 };
14553
14554 AV.Object._canBeSerializedAsValue = function (object) {
14555 var canBeSerializedAsValue = true;
14556
14557 if (object instanceof AV.Object || object instanceof AV.File) {
14558 canBeSerializedAsValue = !!object.id;
14559 } else if (_.isArray(object)) {
14560 AV._arrayEach(object, function (child) {
14561 if (!AV.Object._canBeSerializedAsValue(child)) {
14562 canBeSerializedAsValue = false;
14563 }
14564 });
14565 } else if (_.isObject(object)) {
14566 AV._objectEach(object, function (child) {
14567 if (!AV.Object._canBeSerializedAsValue(child)) {
14568 canBeSerializedAsValue = false;
14569 }
14570 });
14571 }
14572
14573 return canBeSerializedAsValue;
14574 };
14575
14576 AV.Object._deepSaveAsync = function (object, model, options) {
14577 var unsavedChildren = [];
14578 var unsavedFiles = [];
14579 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
14580
14581 unsavedFiles = _.uniq(unsavedFiles);
14582
14583 var promise = _promise2.default.resolve();
14584 _.each(unsavedFiles, function (file) {
14585 promise = promise.then(function () {
14586 return file.save();
14587 });
14588 });
14589
14590 var objects = _.uniq(unsavedChildren);
14591 var remaining = _.uniq(objects);
14592
14593 return promise.then(function () {
14594 return continueWhile(function () {
14595 return remaining.length > 0;
14596 }, function () {
14597 // Gather up all the objects that can be saved in this batch.
14598 var batch = [];
14599 var newRemaining = [];
14600 AV._arrayEach(remaining, function (object) {
14601 if (object._canBeSerialized()) {
14602 batch.push(object);
14603 } else {
14604 newRemaining.push(object);
14605 }
14606 });
14607 remaining = newRemaining;
14608
14609 // If we can't save any objects, there must be a circular reference.
14610 if (batch.length === 0) {
14611 return _promise2.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
14612 }
14613
14614 // Reserve a spot in every object's save queue.
14615 var readyToStart = _promise2.default.resolve(_.map(batch, function (object) {
14616 return object._allPreviousSaves || _promise2.default.resolve();
14617 }));
14618
14619 // Save a single batch, whether previous saves succeeded or failed.
14620 var bathSavePromise = readyToStart.then(function () {
14621 return _request('batch', null, null, 'POST', {
14622 requests: _.map(batch, function (object) {
14623 var method = object.id ? 'PUT' : 'POST';
14624
14625 var json = object._getSaveJSON();
14626
14627 _.extend(json, object._flags);
14628
14629 var route = 'classes';
14630 var className = object.className;
14631 var path = '/' + route + '/' + className;
14632 if (object.className === '_User' && !object.id) {
14633 // Special-case user sign-up.
14634 path = '/users';
14635 }
14636
14637 var path = '/1.1' + path;
14638 if (object.id) {
14639 path = path + '/' + object.id;
14640 }
14641
14642 object._startSave();
14643
14644 return {
14645 method: method,
14646 path: path,
14647 body: json,
14648 params: options && options.fetchWhenSave ? { fetchWhenSave: true } : undefined
14649 };
14650 })
14651 }, options).then(function (response) {
14652 var results = _.map(batch, function (object, i) {
14653 if (response[i].success) {
14654 object._finishSave(object.parse(response[i].success));
14655 return object;
14656 }
14657 object._cancelSave();
14658 return new AVError(response[i].error.code, response[i].error.error);
14659 });
14660 return handleBatchResults(results);
14661 });
14662 });
14663 AV._arrayEach(batch, function (object) {
14664 object._allPreviousSaves = bathSavePromise;
14665 });
14666 return bathSavePromise;
14667 });
14668 }).then(function () {
14669 return object;
14670 });
14671 };
14672};
14673
14674/***/ }),
14675/* 322 */
14676/***/ (function(module, exports, __webpack_require__) {
14677
14678__webpack_require__(323);
14679var $Object = __webpack_require__(2).Object;
14680module.exports = function getOwnPropertyDescriptor(it, key) {
14681 return $Object.getOwnPropertyDescriptor(it, key);
14682};
14683
14684
14685/***/ }),
14686/* 323 */
14687/***/ (function(module, exports, __webpack_require__) {
14688
14689// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
14690var toIObject = __webpack_require__(27);
14691var $getOwnPropertyDescriptor = __webpack_require__(103).f;
14692
14693__webpack_require__(98)('getOwnPropertyDescriptor', function () {
14694 return function getOwnPropertyDescriptor(it, key) {
14695 return $getOwnPropertyDescriptor(toIObject(it), key);
14696 };
14697});
14698
14699
14700/***/ }),
14701/* 324 */
14702/***/ (function(module, exports, __webpack_require__) {
14703
14704"use strict";
14705
14706
14707exports.__esModule = true;
14708
14709var _isIterable2 = __webpack_require__(325);
14710
14711var _isIterable3 = _interopRequireDefault(_isIterable2);
14712
14713var _getIterator2 = __webpack_require__(177);
14714
14715var _getIterator3 = _interopRequireDefault(_getIterator2);
14716
14717function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14718
14719exports.default = function () {
14720 function sliceIterator(arr, i) {
14721 var _arr = [];
14722 var _n = true;
14723 var _d = false;
14724 var _e = undefined;
14725
14726 try {
14727 for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
14728 _arr.push(_s.value);
14729
14730 if (i && _arr.length === i) break;
14731 }
14732 } catch (err) {
14733 _d = true;
14734 _e = err;
14735 } finally {
14736 try {
14737 if (!_n && _i["return"]) _i["return"]();
14738 } finally {
14739 if (_d) throw _e;
14740 }
14741 }
14742
14743 return _arr;
14744 }
14745
14746 return function (arr, i) {
14747 if (Array.isArray(arr)) {
14748 return arr;
14749 } else if ((0, _isIterable3.default)(Object(arr))) {
14750 return sliceIterator(arr, i);
14751 } else {
14752 throw new TypeError("Invalid attempt to destructure non-iterable instance");
14753 }
14754 };
14755}();
14756
14757/***/ }),
14758/* 325 */
14759/***/ (function(module, exports, __webpack_require__) {
14760
14761module.exports = { "default": __webpack_require__(326), __esModule: true };
14762
14763/***/ }),
14764/* 326 */
14765/***/ (function(module, exports, __webpack_require__) {
14766
14767__webpack_require__(34);
14768__webpack_require__(42);
14769module.exports = __webpack_require__(327);
14770
14771
14772/***/ }),
14773/* 327 */
14774/***/ (function(module, exports, __webpack_require__) {
14775
14776var classof = __webpack_require__(61);
14777var ITERATOR = __webpack_require__(7)('iterator');
14778var Iterators = __webpack_require__(32);
14779module.exports = __webpack_require__(2).isIterable = function (it) {
14780 var O = Object(it);
14781 return O[ITERATOR] !== undefined
14782 || '@@iterator' in O
14783 // eslint-disable-next-line no-prototype-builtins
14784 || Iterators.hasOwnProperty(classof(O));
14785};
14786
14787
14788/***/ }),
14789/* 328 */
14790/***/ (function(module, exports, __webpack_require__) {
14791
14792"use strict";
14793
14794
14795var _ = __webpack_require__(0);
14796var AVError = __webpack_require__(31);
14797
14798module.exports = function (AV) {
14799 AV.Role = AV.Object.extend('_Role',
14800 /** @lends AV.Role.prototype */{
14801 // Instance Methods
14802
14803 /**
14804 * Represents a Role on the AV server. Roles represent groupings of
14805 * Users for the purposes of granting permissions (e.g. specifying an ACL
14806 * for an Object). Roles are specified by their sets of child users and
14807 * child roles, all of which are granted any permissions that the parent
14808 * role has.
14809 *
14810 * <p>Roles must have a name (which cannot be changed after creation of the
14811 * role), and must specify an ACL.</p>
14812 * An AV.Role is a local representation of a role persisted to the AV
14813 * cloud.
14814 * @class AV.Role
14815 * @param {String} name The name of the Role to create.
14816 * @param {AV.ACL} acl The ACL for this role.
14817 */
14818 constructor: function constructor(name, acl) {
14819 if (_.isString(name)) {
14820 AV.Object.prototype.constructor.call(this, null, null);
14821 this.setName(name);
14822 } else {
14823 AV.Object.prototype.constructor.call(this, name, acl);
14824 }
14825 if (acl) {
14826 if (!(acl instanceof AV.ACL)) {
14827 throw new TypeError('acl must be an instance of AV.ACL');
14828 } else {
14829 this.setACL(acl);
14830 }
14831 }
14832 },
14833
14834 /**
14835 * Gets the name of the role. You can alternatively call role.get("name")
14836 *
14837 * @return {String} the name of the role.
14838 */
14839 getName: function getName() {
14840 return this.get('name');
14841 },
14842
14843 /**
14844 * Sets the name for a role. This value must be set before the role has
14845 * been saved to the server, and cannot be set once the role has been
14846 * saved.
14847 *
14848 * <p>
14849 * A role's name can only contain alphanumeric characters, _, -, and
14850 * spaces.
14851 * </p>
14852 *
14853 * <p>This is equivalent to calling role.set("name", name)</p>
14854 *
14855 * @param {String} name The name of the role.
14856 */
14857 setName: function setName(name, options) {
14858 return this.set('name', name, options);
14859 },
14860
14861 /**
14862 * Gets the AV.Relation for the AV.Users that are direct
14863 * children of this role. These users are granted any privileges that this
14864 * role has been granted (e.g. read or write access through ACLs). You can
14865 * add or remove users from the role through this relation.
14866 *
14867 * <p>This is equivalent to calling role.relation("users")</p>
14868 *
14869 * @return {AV.Relation} the relation for the users belonging to this
14870 * role.
14871 */
14872 getUsers: function getUsers() {
14873 return this.relation('users');
14874 },
14875
14876 /**
14877 * Gets the AV.Relation for the AV.Roles that are direct
14878 * children of this role. These roles' users are granted any privileges that
14879 * this role has been granted (e.g. read or write access through ACLs). You
14880 * can add or remove child roles from this role through this relation.
14881 *
14882 * <p>This is equivalent to calling role.relation("roles")</p>
14883 *
14884 * @return {AV.Relation} the relation for the roles belonging to this
14885 * role.
14886 */
14887 getRoles: function getRoles() {
14888 return this.relation('roles');
14889 },
14890
14891 /**
14892 * @ignore
14893 */
14894 validate: function validate(attrs, options) {
14895 if ('name' in attrs && attrs.name !== this.getName()) {
14896 var newName = attrs.name;
14897 if (this.id && this.id !== attrs.objectId) {
14898 // Check to see if the objectId being set matches this.id.
14899 // This happens during a fetch -- the id is set before calling fetch.
14900 // Let the name be set in this case.
14901 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
14902 }
14903 if (!_.isString(newName)) {
14904 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
14905 }
14906 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
14907 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
14908 }
14909 }
14910 if (AV.Object.prototype.validate) {
14911 return AV.Object.prototype.validate.call(this, attrs, options);
14912 }
14913 return false;
14914 }
14915 });
14916};
14917
14918/***/ }),
14919/* 329 */
14920/***/ (function(module, exports, __webpack_require__) {
14921
14922"use strict";
14923
14924
14925var _stringify = __webpack_require__(21);
14926
14927var _stringify2 = _interopRequireDefault(_stringify);
14928
14929var _defineProperty2 = __webpack_require__(330);
14930
14931var _defineProperty3 = _interopRequireDefault(_defineProperty2);
14932
14933var _promise = __webpack_require__(3);
14934
14935var _promise2 = _interopRequireDefault(_promise);
14936
14937function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14938
14939var _ = __webpack_require__(0);
14940var uuid = __webpack_require__(165);
14941var AVError = __webpack_require__(31);
14942
14943var _require = __webpack_require__(14),
14944 AVRequest = _require._request,
14945 request = _require.request;
14946
14947var _require2 = __webpack_require__(41),
14948 getAdapter = _require2.getAdapter;
14949
14950var PLATFORM_ANONYMOUS = 'anonymous';
14951var PLATFORM_QQAPP = 'lc_qqapp';
14952
14953var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
14954 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
14955 return function (authData, unionId) {
14956 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
14957 _ref$unionIdPlatform = _ref.unionIdPlatform,
14958 unionIdPlatform = _ref$unionIdPlatform === undefined ? defaultUnionIdPlatform : _ref$unionIdPlatform,
14959 _ref$asMainAccount = _ref.asMainAccount,
14960 asMainAccount = _ref$asMainAccount === undefined ? false : _ref$asMainAccount;
14961
14962 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
14963 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
14964
14965 return _.extend({}, authData, {
14966 platform: unionIdPlatform,
14967 unionid: unionId,
14968 main_account: Boolean(asMainAccount)
14969 });
14970 };
14971};
14972
14973module.exports = function (AV) {
14974 /**
14975 * @class
14976 *
14977 * <p>An AV.User object is a local representation of a user persisted to the
14978 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
14979 * same functionality of an AV.Object, but also extends it with various
14980 * user specific methods, like authentication, signing up, and validation of
14981 * uniqueness.</p>
14982 */
14983 AV.User = AV.Object.extend('_User',
14984 /** @lends AV.User.prototype */{
14985 // Instance Variables
14986 _isCurrentUser: false,
14987
14988 // Instance Methods
14989
14990 /**
14991 * Internal method to handle special fields in a _User response.
14992 * @private
14993 */
14994 _mergeMagicFields: function _mergeMagicFields(attrs) {
14995 if (attrs.sessionToken) {
14996 this._sessionToken = attrs.sessionToken;
14997 delete attrs.sessionToken;
14998 }
14999 return AV.User.__super__._mergeMagicFields.call(this, attrs);
15000 },
15001
15002 /**
15003 * Removes null values from authData (which exist temporarily for
15004 * unlinking)
15005 * @private
15006 */
15007 _cleanupAuthData: function _cleanupAuthData() {
15008 if (!this.isCurrent()) {
15009 return;
15010 }
15011 var authData = this.get('authData');
15012 if (!authData) {
15013 return;
15014 }
15015 AV._objectEach(this.get('authData'), function (value, key) {
15016 if (!authData[key]) {
15017 delete authData[key];
15018 }
15019 });
15020 },
15021
15022 /**
15023 * Synchronizes authData for all providers.
15024 * @private
15025 */
15026 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
15027 var authData = this.get('authData');
15028 if (!authData) {
15029 return;
15030 }
15031
15032 var self = this;
15033 AV._objectEach(this.get('authData'), function (value, key) {
15034 self._synchronizeAuthData(key);
15035 });
15036 },
15037
15038 /**
15039 * Synchronizes auth data for a provider (e.g. puts the access token in the
15040 * right place to be used by the Facebook SDK).
15041 * @private
15042 */
15043 _synchronizeAuthData: function _synchronizeAuthData(provider) {
15044 if (!this.isCurrent()) {
15045 return;
15046 }
15047 var authType;
15048 if (_.isString(provider)) {
15049 authType = provider;
15050 provider = AV.User._authProviders[authType];
15051 } else {
15052 authType = provider.getAuthType();
15053 }
15054 var authData = this.get('authData');
15055 if (!authData || !provider) {
15056 return;
15057 }
15058 var success = provider.restoreAuthentication(authData[authType]);
15059 if (!success) {
15060 this.dissociateAuthData(provider);
15061 }
15062 },
15063
15064 _handleSaveResult: function _handleSaveResult(makeCurrent) {
15065 // Clean up and synchronize the authData object, removing any unset values
15066 if (makeCurrent && !AV._config.disableCurrentUser) {
15067 this._isCurrentUser = true;
15068 }
15069 this._cleanupAuthData();
15070 this._synchronizeAllAuthData();
15071 // Don't keep the password around.
15072 delete this._serverData.password;
15073 this._rebuildEstimatedDataForKey('password');
15074 this._refreshCache();
15075 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
15076 // Some old version of leanengine-node-sdk will overwrite
15077 // AV.User._saveCurrentUser which returns no Promise.
15078 // So we need a Promise wrapper.
15079 return _promise2.default.resolve(AV.User._saveCurrentUser(this));
15080 } else {
15081 return _promise2.default.resolve();
15082 }
15083 },
15084
15085 /**
15086 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
15087 * call linkWith on the user (even if it doesn't exist yet on the server).
15088 * @private
15089 */
15090 _linkWith: function _linkWith(provider, data) {
15091 var _this = this;
15092
15093 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
15094 _ref2$failOnNotExist = _ref2.failOnNotExist,
15095 failOnNotExist = _ref2$failOnNotExist === undefined ? false : _ref2$failOnNotExist;
15096
15097 var authType;
15098 if (_.isString(provider)) {
15099 authType = provider;
15100 provider = AV.User._authProviders[provider];
15101 } else {
15102 authType = provider.getAuthType();
15103 }
15104 if (data) {
15105 return this.save({ authData: (0, _defineProperty3.default)({}, authType, data) }, {
15106 fetchWhenSave: !!this.get('authData'),
15107 _failOnNotExist: failOnNotExist
15108 }).then(function (model) {
15109 return model._handleSaveResult(true).then(function () {
15110 return model;
15111 });
15112 });
15113 } else {
15114 return provider.authenticate().then(function (result) {
15115 return _this._linkWith(provider, result);
15116 });
15117 }
15118 },
15119
15120 /**
15121 * Associate the user with a third party authData.
15122 * @since 3.3.0
15123 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
15124 * @param {string} platform Available platform for sign up.
15125 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
15126 * @example user.associateWithAuthData({
15127 * openid: 'abc123',
15128 * access_token: '123abc',
15129 * expires_in: 1382686496
15130 * }, 'weixin').then(function(user) {
15131 * //Access user here
15132 * }).catch(function(error) {
15133 * //console.error("error: ", error);
15134 * });
15135 */
15136 associateWithAuthData: function associateWithAuthData(authData, platform) {
15137 return this._linkWith(platform, authData);
15138 },
15139
15140
15141 /**
15142 * Associate the user with a third party authData and unionId.
15143 * @since 3.5.0
15144 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
15145 * @param {string} platform Available platform for sign up.
15146 * @param {string} unionId
15147 * @param {Object} [unionLoginOptions]
15148 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
15149 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15150 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
15151 * @example user.associateWithAuthDataAndUnionId({
15152 * openid: 'abc123',
15153 * access_token: '123abc',
15154 * expires_in: 1382686496
15155 * }, 'weixin', 'union123', {
15156 * unionIdPlatform: 'weixin',
15157 * asMainAccount: true,
15158 * }).then(function(user) {
15159 * //Access user here
15160 * }).catch(function(error) {
15161 * //console.error("error: ", error);
15162 * });
15163 */
15164 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
15165 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
15166 },
15167
15168
15169 /**
15170 * Associate the user with the identity of the current mini-app.
15171 * @since 4.6.0
15172 * @param {Object} [authInfo]
15173 * @param {Object} [option]
15174 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
15175 * @return {Promise<AV.User>}
15176 */
15177 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
15178 var _this2 = this;
15179
15180 if (authInfo === undefined) {
15181 var getAuthInfo = getAdapter('getAuthInfo');
15182 return getAuthInfo().then(function (authInfo) {
15183 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
15184 });
15185 }
15186 return this._linkWith(authInfo.provider, authInfo.authData, option);
15187 },
15188
15189
15190 /**
15191 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
15192 * 仅在 QQ 小程序中可用。
15193 *
15194 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15195 * @since 4.2.0
15196 * @param {Object} [options]
15197 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
15198 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
15199 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15200 * @return {Promise<AV.User>}
15201 */
15202 associateWithQQApp: function associateWithQQApp() {
15203 var _this3 = this;
15204
15205 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15206 _ref3$preferUnionId = _ref3.preferUnionId,
15207 preferUnionId = _ref3$preferUnionId === undefined ? false : _ref3$preferUnionId,
15208 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
15209 unionIdPlatform = _ref3$unionIdPlatform === undefined ? 'qq' : _ref3$unionIdPlatform,
15210 _ref3$asMainAccount = _ref3.asMainAccount,
15211 asMainAccount = _ref3$asMainAccount === undefined ? true : _ref3$asMainAccount;
15212
15213 var getAuthInfo = getAdapter('getAuthInfo');
15214 return getAuthInfo({
15215 preferUnionId: preferUnionId,
15216 asMainAccount: asMainAccount,
15217 platform: unionIdPlatform
15218 }).then(function (authInfo) {
15219 authInfo.provider = PLATFORM_QQAPP;
15220 return _this3.associateWithMiniApp(authInfo);
15221 });
15222 },
15223
15224
15225 /**
15226 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
15227 * 仅在微信小程序中可用。
15228 *
15229 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15230 * @since 3.13.0
15231 * @param {Object} [options]
15232 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
15233 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
15234 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15235 * @return {Promise<AV.User>}
15236 */
15237 associateWithWeapp: function associateWithWeapp() {
15238 var _this4 = this;
15239
15240 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15241 _ref4$preferUnionId = _ref4.preferUnionId,
15242 preferUnionId = _ref4$preferUnionId === undefined ? false : _ref4$preferUnionId,
15243 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
15244 unionIdPlatform = _ref4$unionIdPlatform === undefined ? 'weixin' : _ref4$unionIdPlatform,
15245 _ref4$asMainAccount = _ref4.asMainAccount,
15246 asMainAccount = _ref4$asMainAccount === undefined ? true : _ref4$asMainAccount;
15247
15248 var getAuthInfo = getAdapter('getAuthInfo');
15249 return getAuthInfo({
15250 preferUnionId: preferUnionId,
15251 asMainAccount: asMainAccount,
15252 platform: unionIdPlatform
15253 }).then(function (authInfo) {
15254 return _this4.associateWithMiniApp(authInfo);
15255 });
15256 },
15257
15258
15259 /**
15260 * @deprecated renamed to {@link AV.User#associateWithWeapp}
15261 * @return {Promise<AV.User>}
15262 */
15263 linkWithWeapp: function linkWithWeapp(options) {
15264 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
15265 return this.associateWithWeapp(options);
15266 },
15267
15268
15269 /**
15270 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
15271 * 仅在 QQ 小程序中可用。
15272 *
15273 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15274 * @since 4.2.0
15275 * @param {string} unionId
15276 * @param {Object} [unionOptions]
15277 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
15278 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15279 * @return {Promise<AV.User>}
15280 */
15281 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
15282 var _this5 = this;
15283
15284 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15285 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
15286 unionIdPlatform = _ref5$unionIdPlatform === undefined ? 'qq' : _ref5$unionIdPlatform,
15287 _ref5$asMainAccount = _ref5.asMainAccount,
15288 asMainAccount = _ref5$asMainAccount === undefined ? false : _ref5$asMainAccount;
15289
15290 var getAuthInfo = getAdapter('getAuthInfo');
15291 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15292 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15293 authInfo.provider = PLATFORM_QQAPP;
15294 return _this5.associateWithMiniApp(authInfo);
15295 });
15296 },
15297
15298
15299 /**
15300 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
15301 * 仅在微信小程序中可用。
15302 *
15303 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15304 * @since 3.13.0
15305 * @param {string} unionId
15306 * @param {Object} [unionOptions]
15307 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
15308 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15309 * @return {Promise<AV.User>}
15310 */
15311 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
15312 var _this6 = this;
15313
15314 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15315 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
15316 unionIdPlatform = _ref6$unionIdPlatform === undefined ? 'weixin' : _ref6$unionIdPlatform,
15317 _ref6$asMainAccount = _ref6.asMainAccount,
15318 asMainAccount = _ref6$asMainAccount === undefined ? false : _ref6$asMainAccount;
15319
15320 var getAuthInfo = getAdapter('getAuthInfo');
15321 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15322 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15323 return _this6.associateWithMiniApp(authInfo);
15324 });
15325 },
15326
15327
15328 /**
15329 * Unlinks a user from a service.
15330 * @param {string} platform
15331 * @return {Promise<AV.User>}
15332 * @since 3.3.0
15333 */
15334 dissociateAuthData: function dissociateAuthData(provider) {
15335 this.unset('authData.' + provider);
15336 return this.save().then(function (model) {
15337 return model._handleSaveResult(true).then(function () {
15338 return model;
15339 });
15340 });
15341 },
15342
15343
15344 /**
15345 * @private
15346 * @deprecated
15347 */
15348 _unlinkFrom: function _unlinkFrom(provider) {
15349 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
15350 return this.dissociateAuthData(provider);
15351 },
15352
15353
15354 /**
15355 * Checks whether a user is linked to a service.
15356 * @private
15357 */
15358 _isLinked: function _isLinked(provider) {
15359 var authType;
15360 if (_.isString(provider)) {
15361 authType = provider;
15362 } else {
15363 authType = provider.getAuthType();
15364 }
15365 var authData = this.get('authData') || {};
15366 return !!authData[authType];
15367 },
15368
15369 /**
15370 * Checks whether a user is anonymous.
15371 * @since 3.9.0
15372 * @return {boolean}
15373 */
15374 isAnonymous: function isAnonymous() {
15375 return this._isLinked(PLATFORM_ANONYMOUS);
15376 },
15377
15378
15379 logOut: function logOut() {
15380 this._logOutWithAll();
15381 this._isCurrentUser = false;
15382 },
15383
15384 /**
15385 * Deauthenticates all providers.
15386 * @private
15387 */
15388 _logOutWithAll: function _logOutWithAll() {
15389 var authData = this.get('authData');
15390 if (!authData) {
15391 return;
15392 }
15393 var self = this;
15394 AV._objectEach(this.get('authData'), function (value, key) {
15395 self._logOutWith(key);
15396 });
15397 },
15398
15399 /**
15400 * Deauthenticates a single provider (e.g. removing access tokens from the
15401 * Facebook SDK).
15402 * @private
15403 */
15404 _logOutWith: function _logOutWith(provider) {
15405 if (!this.isCurrent()) {
15406 return;
15407 }
15408 if (_.isString(provider)) {
15409 provider = AV.User._authProviders[provider];
15410 }
15411 if (provider && provider.deauthenticate) {
15412 provider.deauthenticate();
15413 }
15414 },
15415
15416 /**
15417 * Signs up a new user. You should call this instead of save for
15418 * new AV.Users. This will create a new AV.User on the server, and
15419 * also persist the session on disk so that you can access the user using
15420 * <code>current</code>.
15421 *
15422 * <p>A username and password must be set before calling signUp.</p>
15423 *
15424 * @param {Object} attrs Extra fields to set on the new user, or null.
15425 * @param {AuthOptions} options
15426 * @return {Promise} A promise that is fulfilled when the signup
15427 * finishes.
15428 * @see AV.User.signUp
15429 */
15430 signUp: function signUp(attrs, options) {
15431 var error;
15432
15433 var username = attrs && attrs.username || this.get('username');
15434 if (!username || username === '') {
15435 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
15436 throw error;
15437 }
15438
15439 var password = attrs && attrs.password || this.get('password');
15440 if (!password || password === '') {
15441 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
15442 throw error;
15443 }
15444
15445 return this.save(attrs, options).then(function (model) {
15446 if (model.isAnonymous()) {
15447 model.unset('authData.' + PLATFORM_ANONYMOUS);
15448 model._opSetQueue = [{}];
15449 }
15450 return model._handleSaveResult(true).then(function () {
15451 return model;
15452 });
15453 });
15454 },
15455
15456 /**
15457 * Signs up a new user with mobile phone and sms code.
15458 * You should call this instead of save for
15459 * new AV.Users. This will create a new AV.User on the server, and
15460 * also persist the session on disk so that you can access the user using
15461 * <code>current</code>.
15462 *
15463 * <p>A username and password must be set before calling signUp.</p>
15464 *
15465 * @param {Object} attrs Extra fields to set on the new user, or null.
15466 * @param {AuthOptions} options
15467 * @return {Promise} A promise that is fulfilled when the signup
15468 * finishes.
15469 * @see AV.User.signUpOrlogInWithMobilePhone
15470 * @see AV.Cloud.requestSmsCode
15471 */
15472 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
15473 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15474
15475 var error;
15476
15477 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
15478 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
15479 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
15480 throw error;
15481 }
15482
15483 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
15484 if (!smsCode || smsCode === '') {
15485 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
15486 throw error;
15487 }
15488
15489 options._makeRequest = function (route, className, id, method, json) {
15490 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
15491 };
15492 return this.save(attrs, options).then(function (model) {
15493 delete model.attributes.smsCode;
15494 delete model._serverData.smsCode;
15495 return model._handleSaveResult(true).then(function () {
15496 return model;
15497 });
15498 });
15499 },
15500
15501 /**
15502 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
15503 * @since 3.7.0
15504 */
15505 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
15506 return this._linkWith(platform, authData, options);
15507 },
15508
15509
15510 /**
15511 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
15512 * @since 3.7.0
15513 */
15514 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
15515 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
15516 },
15517
15518
15519 /**
15520 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
15521 * @deprecated please use {@link AV.User#loginWithMiniApp}
15522 * @since 3.7.0
15523 * @param {Object} [options]
15524 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15525 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
15526 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
15527 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15528 * @return {Promise<AV.User>}
15529 */
15530 loginWithWeapp: function loginWithWeapp() {
15531 var _this7 = this;
15532
15533 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15534 _ref7$preferUnionId = _ref7.preferUnionId,
15535 preferUnionId = _ref7$preferUnionId === undefined ? false : _ref7$preferUnionId,
15536 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
15537 unionIdPlatform = _ref7$unionIdPlatform === undefined ? 'weixin' : _ref7$unionIdPlatform,
15538 _ref7$asMainAccount = _ref7.asMainAccount,
15539 asMainAccount = _ref7$asMainAccount === undefined ? true : _ref7$asMainAccount,
15540 _ref7$failOnNotExist = _ref7.failOnNotExist,
15541 failOnNotExist = _ref7$failOnNotExist === undefined ? false : _ref7$failOnNotExist;
15542
15543 var getAuthInfo = getAdapter('getAuthInfo');
15544 return getAuthInfo({
15545 preferUnionId: preferUnionId,
15546 asMainAccount: asMainAccount,
15547 platform: unionIdPlatform
15548 }).then(function (authInfo) {
15549 return _this7.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15550 });
15551 },
15552
15553
15554 /**
15555 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
15556 * @deprecated please use {@link AV.User#loginWithMiniApp}
15557 * @since 3.13.0
15558 */
15559 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
15560 var _this8 = this;
15561
15562 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15563 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
15564 unionIdPlatform = _ref8$unionIdPlatform === undefined ? 'weixin' : _ref8$unionIdPlatform,
15565 _ref8$asMainAccount = _ref8.asMainAccount,
15566 asMainAccount = _ref8$asMainAccount === undefined ? false : _ref8$asMainAccount,
15567 _ref8$failOnNotExist = _ref8.failOnNotExist,
15568 failOnNotExist = _ref8$failOnNotExist === undefined ? false : _ref8$failOnNotExist;
15569
15570 var getAuthInfo = getAdapter('getAuthInfo');
15571 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15572 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15573 return _this8.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15574 });
15575 },
15576
15577
15578 /**
15579 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
15580 * @deprecated please use {@link AV.User#loginWithMiniApp}
15581 * @since 4.2.0
15582 * @param {Object} [options]
15583 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15584 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
15585 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
15586 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15587 */
15588 loginWithQQApp: function loginWithQQApp() {
15589 var _this9 = this;
15590
15591 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15592 _ref9$preferUnionId = _ref9.preferUnionId,
15593 preferUnionId = _ref9$preferUnionId === undefined ? false : _ref9$preferUnionId,
15594 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
15595 unionIdPlatform = _ref9$unionIdPlatform === undefined ? 'qq' : _ref9$unionIdPlatform,
15596 _ref9$asMainAccount = _ref9.asMainAccount,
15597 asMainAccount = _ref9$asMainAccount === undefined ? true : _ref9$asMainAccount,
15598 _ref9$failOnNotExist = _ref9.failOnNotExist,
15599 failOnNotExist = _ref9$failOnNotExist === undefined ? false : _ref9$failOnNotExist;
15600
15601 var getAuthInfo = getAdapter('getAuthInfo');
15602 return getAuthInfo({
15603 preferUnionId: preferUnionId,
15604 asMainAccount: asMainAccount,
15605 platform: unionIdPlatform
15606 }).then(function (authInfo) {
15607 authInfo.provider = PLATFORM_QQAPP;
15608 return _this9.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15609 });
15610 },
15611
15612
15613 /**
15614 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
15615 * @deprecated please use {@link AV.User#loginWithMiniApp}
15616 * @since 4.2.0
15617 */
15618 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
15619 var _this10 = this;
15620
15621 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15622 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
15623 unionIdPlatform = _ref10$unionIdPlatfor === undefined ? 'qq' : _ref10$unionIdPlatfor,
15624 _ref10$asMainAccount = _ref10.asMainAccount,
15625 asMainAccount = _ref10$asMainAccount === undefined ? false : _ref10$asMainAccount,
15626 _ref10$failOnNotExist = _ref10.failOnNotExist,
15627 failOnNotExist = _ref10$failOnNotExist === undefined ? false : _ref10$failOnNotExist;
15628
15629 var getAuthInfo = getAdapter('getAuthInfo');
15630 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15631 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15632 authInfo.provider = PLATFORM_QQAPP;
15633 return _this10.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15634 });
15635 },
15636
15637
15638 /**
15639 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
15640 * @since 4.6.0
15641 */
15642 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
15643 var _this11 = this;
15644
15645 if (authInfo === undefined) {
15646 var getAuthInfo = getAdapter('getAuthInfo');
15647 return getAuthInfo().then(function (authInfo) {
15648 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
15649 });
15650 }
15651 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
15652 },
15653
15654
15655 /**
15656 * Logs in a AV.User. On success, this saves the session to localStorage,
15657 * so you can retrieve the currently logged in user using
15658 * <code>current</code>.
15659 *
15660 * <p>A username and password must be set before calling logIn.</p>
15661 *
15662 * @see AV.User.logIn
15663 * @return {Promise} A promise that is fulfilled with the user when
15664 * the login is complete.
15665 */
15666 logIn: function logIn() {
15667 var model = this;
15668 var request = AVRequest('login', null, null, 'POST', this.toJSON());
15669 return request.then(function (resp) {
15670 var serverAttrs = model.parse(resp);
15671 model._finishFetch(serverAttrs);
15672 return model._handleSaveResult(true).then(function () {
15673 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
15674 return model;
15675 });
15676 });
15677 },
15678 /**
15679 * @see AV.Object#save
15680 */
15681 save: function save(arg1, arg2, arg3) {
15682 var attrs, options;
15683 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
15684 attrs = arg1;
15685 options = arg2;
15686 } else {
15687 attrs = {};
15688 attrs[arg1] = arg2;
15689 options = arg3;
15690 }
15691 options = options || {};
15692
15693 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
15694 return model._handleSaveResult(false).then(function () {
15695 return model;
15696 });
15697 });
15698 },
15699
15700 /**
15701 * Follow a user
15702 * @since 0.3.0
15703 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
15704 * @param {AV.User | String} options.user The target user or user's objectId to follow.
15705 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
15706 * conditions of followerQuery/followeeQuery.
15707 * @param {AuthOptions} [authOptions]
15708 */
15709 follow: function follow(options, authOptions) {
15710 if (!this.id) {
15711 throw new Error('Please signin.');
15712 }
15713 var user = void 0;
15714 var attributes = void 0;
15715 if (options.user) {
15716 user = options.user;
15717 attributes = options.attributes;
15718 } else {
15719 user = options;
15720 }
15721 var userObjectId = _.isString(user) ? user : user.id;
15722 if (!userObjectId) {
15723 throw new Error('Invalid target user.');
15724 }
15725 var route = 'users/' + this.id + '/friendship/' + userObjectId;
15726 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
15727 return request;
15728 },
15729
15730 /**
15731 * Unfollow a user.
15732 * @since 0.3.0
15733 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
15734 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
15735 * @param {AuthOptions} [authOptions]
15736 */
15737 unfollow: function unfollow(options, authOptions) {
15738 if (!this.id) {
15739 throw new Error('Please signin.');
15740 }
15741 var user = void 0;
15742 if (options.user) {
15743 user = options.user;
15744 } else {
15745 user = options;
15746 }
15747 var userObjectId = _.isString(user) ? user : user.id;
15748 if (!userObjectId) {
15749 throw new Error('Invalid target user.');
15750 }
15751 var route = 'users/' + this.id + '/friendship/' + userObjectId;
15752 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
15753 return request;
15754 },
15755
15756 /**
15757 * Get the user's followers and followees.
15758 * @since 4.8.0
15759 * @param {Object} [options]
15760 * @param {Number} [options.skip]
15761 * @param {Number} [options.limit]
15762 * @param {AuthOptions} [authOptions]
15763 */
15764 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
15765 if (!this.id) {
15766 throw new Error('Please signin.');
15767 }
15768 return request({
15769 method: 'GET',
15770 path: '/users/' + this.id + '/followersAndFollowees',
15771 query: {
15772 skip: options && options.skip,
15773 limit: options && options.limit,
15774 include: 'follower,followee',
15775 keys: 'follower,followee'
15776 },
15777 authOptions: authOptions
15778 }).then(function (_ref11) {
15779 var followers = _ref11.followers,
15780 followees = _ref11.followees;
15781 return {
15782 followers: followers.map(function (_ref12) {
15783 var follower = _ref12.follower;
15784 return AV._decode(follower);
15785 }),
15786 followees: followees.map(function (_ref13) {
15787 var followee = _ref13.followee;
15788 return AV._decode(followee);
15789 })
15790 };
15791 });
15792 },
15793
15794 /**
15795 *Create a follower query to query the user's followers.
15796 * @since 0.3.0
15797 * @see AV.User#followerQuery
15798 */
15799 followerQuery: function followerQuery() {
15800 return AV.User.followerQuery(this.id);
15801 },
15802
15803 /**
15804 *Create a followee query to query the user's followees.
15805 * @since 0.3.0
15806 * @see AV.User#followeeQuery
15807 */
15808 followeeQuery: function followeeQuery() {
15809 return AV.User.followeeQuery(this.id);
15810 },
15811
15812 /**
15813 * @see AV.Object#fetch
15814 */
15815 fetch: function fetch(fetchOptions, options) {
15816 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
15817 return model._handleSaveResult(false).then(function () {
15818 return model;
15819 });
15820 });
15821 },
15822
15823 /**
15824 * Update user's new password safely based on old password.
15825 * @param {String} oldPassword the old password.
15826 * @param {String} newPassword the new password.
15827 * @param {AuthOptions} options
15828 */
15829 updatePassword: function updatePassword(oldPassword, newPassword, options) {
15830 var _this12 = this;
15831
15832 var route = 'users/' + this.id + '/updatePassword';
15833 var params = {
15834 old_password: oldPassword,
15835 new_password: newPassword
15836 };
15837 var request = AVRequest(route, null, null, 'PUT', params, options);
15838 return request.then(function (resp) {
15839 _this12._finishFetch(_this12.parse(resp));
15840 return _this12._handleSaveResult(true).then(function () {
15841 return resp;
15842 });
15843 });
15844 },
15845
15846 /**
15847 * Returns true if <code>current</code> would return this user.
15848 * @see AV.User#current
15849 */
15850 isCurrent: function isCurrent() {
15851 return this._isCurrentUser;
15852 },
15853
15854 /**
15855 * Returns get("username").
15856 * @return {String}
15857 * @see AV.Object#get
15858 */
15859 getUsername: function getUsername() {
15860 return this.get('username');
15861 },
15862
15863 /**
15864 * Returns get("mobilePhoneNumber").
15865 * @return {String}
15866 * @see AV.Object#get
15867 */
15868 getMobilePhoneNumber: function getMobilePhoneNumber() {
15869 return this.get('mobilePhoneNumber');
15870 },
15871
15872 /**
15873 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
15874 * @param {String} mobilePhoneNumber
15875 * @return {Boolean}
15876 * @see AV.Object#set
15877 */
15878 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
15879 return this.set('mobilePhoneNumber', phone, options);
15880 },
15881
15882 /**
15883 * Calls set("username", username, options) and returns the result.
15884 * @param {String} username
15885 * @return {Boolean}
15886 * @see AV.Object#set
15887 */
15888 setUsername: function setUsername(username, options) {
15889 return this.set('username', username, options);
15890 },
15891
15892 /**
15893 * Calls set("password", password, options) and returns the result.
15894 * @param {String} password
15895 * @return {Boolean}
15896 * @see AV.Object#set
15897 */
15898 setPassword: function setPassword(password, options) {
15899 return this.set('password', password, options);
15900 },
15901
15902 /**
15903 * Returns get("email").
15904 * @return {String}
15905 * @see AV.Object#get
15906 */
15907 getEmail: function getEmail() {
15908 return this.get('email');
15909 },
15910
15911 /**
15912 * Calls set("email", email, options) and returns the result.
15913 * @param {String} email
15914 * @param {AuthOptions} options
15915 * @return {Boolean}
15916 * @see AV.Object#set
15917 */
15918 setEmail: function setEmail(email, options) {
15919 return this.set('email', email, options);
15920 },
15921
15922 /**
15923 * Checks whether this user is the current user and has been authenticated.
15924 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
15925 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
15926 * @return (Boolean) whether this user is the current user and is logged in.
15927 */
15928 authenticated: function authenticated() {
15929 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
15930 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
15931 },
15932
15933 /**
15934 * Detects if current sessionToken is valid.
15935 *
15936 * @since 2.0.0
15937 * @return Promise.<Boolean>
15938 */
15939 isAuthenticated: function isAuthenticated() {
15940 var _this13 = this;
15941
15942 return _promise2.default.resolve().then(function () {
15943 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
15944 return true;
15945 }, function (error) {
15946 if (error.code === 211) {
15947 return false;
15948 }
15949 throw error;
15950 });
15951 });
15952 },
15953
15954
15955 /**
15956 * Get sessionToken of current user.
15957 * @return {String} sessionToken
15958 */
15959 getSessionToken: function getSessionToken() {
15960 return this._sessionToken;
15961 },
15962
15963
15964 /**
15965 * Refresh sessionToken of current user.
15966 * @since 2.1.0
15967 * @param {AuthOptions} [options]
15968 * @return {Promise.<AV.User>} user with refreshed sessionToken
15969 */
15970 refreshSessionToken: function refreshSessionToken(options) {
15971 var _this14 = this;
15972
15973 return AVRequest('users/' + this.id + '/refreshSessionToken', null, null, 'PUT', null, options).then(function (response) {
15974 _this14._finishFetch(response);
15975 return _this14._handleSaveResult(true).then(function () {
15976 return _this14;
15977 });
15978 });
15979 },
15980
15981
15982 /**
15983 * Get this user's Roles.
15984 * @param {AuthOptions} [options]
15985 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
15986 * the query is complete.
15987 */
15988 getRoles: function getRoles(options) {
15989 return AV.Relation.reverseQuery('_Role', 'users', this).find(options);
15990 }
15991 },
15992 /** @lends AV.User */{
15993 // Class Variables
15994
15995 // The currently logged-in user.
15996 _currentUser: null,
15997
15998 // Whether currentUser is known to match the serialized version on disk.
15999 // This is useful for saving a localstorage check if you try to load
16000 // _currentUser frequently while there is none stored.
16001 _currentUserMatchesDisk: false,
16002
16003 // The localStorage key suffix that the current user is stored under.
16004 _CURRENT_USER_KEY: 'currentUser',
16005
16006 // The mapping of auth provider names to actual providers
16007 _authProviders: {},
16008
16009 // Class Methods
16010
16011 /**
16012 * Signs up a new user with a username (or email) and password.
16013 * This will create a new AV.User on the server, and also persist the
16014 * session in localStorage so that you can access the user using
16015 * {@link #current}.
16016 *
16017 * @param {String} username The username (or email) to sign up with.
16018 * @param {String} password The password to sign up with.
16019 * @param {Object} [attrs] Extra fields to set on the new user.
16020 * @param {AuthOptions} [options]
16021 * @return {Promise} A promise that is fulfilled with the user when
16022 * the signup completes.
16023 * @see AV.User#signUp
16024 */
16025 signUp: function signUp(username, password, attrs, options) {
16026 attrs = attrs || {};
16027 attrs.username = username;
16028 attrs.password = password;
16029 var user = AV.Object._create('_User');
16030 return user.signUp(attrs, options);
16031 },
16032
16033 /**
16034 * Logs in a user with a username (or email) and password. On success, this
16035 * saves the session to disk, so you can retrieve the currently logged in
16036 * user using <code>current</code>.
16037 *
16038 * @param {String} username The username (or email) to log in with.
16039 * @param {String} password The password to log in with.
16040 * @return {Promise} A promise that is fulfilled with the user when
16041 * the login completes.
16042 * @see AV.User#logIn
16043 */
16044 logIn: function logIn(username, password) {
16045 var user = AV.Object._create('_User');
16046 user._finishFetch({ username: username, password: password });
16047 return user.logIn();
16048 },
16049
16050 /**
16051 * Logs in a user with a session token. On success, this saves the session
16052 * to disk, so you can retrieve the currently logged in user using
16053 * <code>current</code>.
16054 *
16055 * @param {String} sessionToken The sessionToken to log in with.
16056 * @return {Promise} A promise that is fulfilled with the user when
16057 * the login completes.
16058 */
16059 become: function become(sessionToken) {
16060 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
16061 return user._handleSaveResult(true).then(function () {
16062 return user;
16063 });
16064 });
16065 },
16066
16067 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
16068 if (sessionToken === undefined) {
16069 return _promise2.default.reject(new Error('The sessionToken cannot be undefined'));
16070 }
16071
16072 var user = AV.Object._create('_User');
16073 return request({
16074 method: 'GET',
16075 path: '/users/me',
16076 authOptions: {
16077 sessionToken: sessionToken
16078 }
16079 }).then(function (resp) {
16080 var serverAttrs = user.parse(resp);
16081 user._finishFetch(serverAttrs);
16082 return user;
16083 });
16084 },
16085
16086 /**
16087 * Logs in a user with a mobile phone number and sms code sent by
16088 * AV.User.requestLoginSmsCode.On success, this
16089 * saves the session to disk, so you can retrieve the currently logged in
16090 * user using <code>current</code>.
16091 *
16092 * @param {String} mobilePhone The user's mobilePhoneNumber
16093 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
16094 * @return {Promise} A promise that is fulfilled with the user when
16095 * the login completes.
16096 * @see AV.User#logIn
16097 */
16098 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
16099 var user = AV.Object._create('_User');
16100 user._finishFetch({ mobilePhoneNumber: mobilePhone, smsCode: smsCode });
16101 return user.logIn();
16102 },
16103
16104 /**
16105 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
16106 * On success, this saves the session to disk, so you can retrieve the currently
16107 * logged in user using <code>current</code>.
16108 *
16109 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
16110 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
16111 * @param {Object} attributes The user's other attributes such as username etc.
16112 * @param {AuthOptions} options
16113 * @return {Promise} A promise that is fulfilled with the user when
16114 * the login completes.
16115 * @see AV.User#signUpOrlogInWithMobilePhone
16116 * @see AV.Cloud.requestSmsCode
16117 */
16118 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
16119 attrs = attrs || {};
16120 attrs.mobilePhoneNumber = mobilePhoneNumber;
16121 attrs.smsCode = smsCode;
16122 var user = AV.Object._create('_User');
16123 return user.signUpOrlogInWithMobilePhone(attrs, options);
16124 },
16125
16126 /**
16127 * Logs in a user with a mobile phone number and password. On success, this
16128 * saves the session to disk, so you can retrieve the currently logged in
16129 * user using <code>current</code>.
16130 *
16131 * @param {String} mobilePhone The user's mobilePhoneNumber
16132 * @param {String} password The password to log in with.
16133 * @return {Promise} A promise that is fulfilled with the user when
16134 * the login completes.
16135 * @see AV.User#logIn
16136 */
16137 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
16138 var user = AV.Object._create('_User');
16139 user._finishFetch({
16140 mobilePhoneNumber: mobilePhone,
16141 password: password
16142 });
16143 return user.logIn();
16144 },
16145
16146 /**
16147 * Logs in a user with email and password.
16148 *
16149 * @since 3.13.0
16150 * @param {String} email The user's email.
16151 * @param {String} password The password to log in with.
16152 * @return {Promise} A promise that is fulfilled with the user when
16153 * the login completes.
16154 */
16155 loginWithEmail: function loginWithEmail(email, password) {
16156 var user = AV.Object._create('_User');
16157 user._finishFetch({
16158 email: email,
16159 password: password
16160 });
16161 return user.logIn();
16162 },
16163
16164
16165 /**
16166 * Signs up or logs in a user with a third party auth data(AccessToken).
16167 * On success, this saves the session to disk, so you can retrieve the currently
16168 * logged in user using <code>current</code>.
16169 *
16170 * @since 3.7.0
16171 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
16172 * @param {string} platform Available platform for sign up.
16173 * @param {Object} [options]
16174 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
16175 * @return {Promise} A promise that is fulfilled with the user when
16176 * the login completes.
16177 * @example AV.User.loginWithAuthData({
16178 * openid: 'abc123',
16179 * access_token: '123abc',
16180 * expires_in: 1382686496
16181 * }, 'weixin').then(function(user) {
16182 * //Access user here
16183 * }).catch(function(error) {
16184 * //console.error("error: ", error);
16185 * });
16186 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
16187 */
16188 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
16189 return AV.User._logInWith(platform, authData, options);
16190 },
16191
16192
16193 /**
16194 * @deprecated renamed to {@link AV.User.loginWithAuthData}
16195 */
16196 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
16197 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
16198 return this.loginWithAuthData.apply(this, arguments);
16199 },
16200
16201
16202 /**
16203 * Signs up or logs in a user with a third party authData and unionId.
16204 * @since 3.7.0
16205 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
16206 * @param {string} platform Available platform for sign up.
16207 * @param {string} unionId
16208 * @param {Object} [unionLoginOptions]
16209 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
16210 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16211 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
16212 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
16213 * @example AV.User.loginWithAuthDataAndUnionId({
16214 * openid: 'abc123',
16215 * access_token: '123abc',
16216 * expires_in: 1382686496
16217 * }, 'weixin', 'union123', {
16218 * unionIdPlatform: 'weixin',
16219 * asMainAccount: true,
16220 * }).then(function(user) {
16221 * //Access user here
16222 * }).catch(function(error) {
16223 * //console.error("error: ", error);
16224 * });
16225 */
16226 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
16227 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
16228 },
16229
16230
16231 /**
16232 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
16233 * @since 3.5.0
16234 */
16235 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
16236 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
16237 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
16238 },
16239
16240
16241 /**
16242 * Merge unionId into authInfo.
16243 * @since 4.6.0
16244 * @param {Object} authInfo
16245 * @param {String} unionId
16246 * @param {Object} [unionIdOption]
16247 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
16248 */
16249 mergeUnionId: function mergeUnionId(authInfo, unionId) {
16250 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
16251 _ref14$asMainAccount = _ref14.asMainAccount,
16252 asMainAccount = _ref14$asMainAccount === undefined ? false : _ref14$asMainAccount;
16253
16254 authInfo = JSON.parse((0, _stringify2.default)(authInfo));
16255 var _authInfo = authInfo,
16256 authData = _authInfo.authData,
16257 platform = _authInfo.platform;
16258
16259 authData.platform = platform;
16260 authData.main_account = asMainAccount;
16261 authData.unionid = unionId;
16262 return authInfo;
16263 },
16264
16265
16266 /**
16267 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
16268 * 仅在微信小程序中可用。
16269 *
16270 * @deprecated please use {@link AV.User.loginWithMiniApp}
16271 * @since 2.0.0
16272 * @param {Object} [options]
16273 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
16274 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
16275 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
16276 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
16277 * @return {Promise.<AV.User>}
16278 */
16279 loginWithWeapp: function loginWithWeapp() {
16280 var _this15 = this;
16281
16282 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16283 _ref15$preferUnionId = _ref15.preferUnionId,
16284 preferUnionId = _ref15$preferUnionId === undefined ? false : _ref15$preferUnionId,
16285 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
16286 unionIdPlatform = _ref15$unionIdPlatfor === undefined ? 'weixin' : _ref15$unionIdPlatfor,
16287 _ref15$asMainAccount = _ref15.asMainAccount,
16288 asMainAccount = _ref15$asMainAccount === undefined ? true : _ref15$asMainAccount,
16289 _ref15$failOnNotExist = _ref15.failOnNotExist,
16290 failOnNotExist = _ref15$failOnNotExist === undefined ? false : _ref15$failOnNotExist;
16291
16292 var getAuthInfo = getAdapter('getAuthInfo');
16293 return getAuthInfo({
16294 preferUnionId: preferUnionId,
16295 asMainAccount: asMainAccount,
16296 platform: unionIdPlatform
16297 }).then(function (authInfo) {
16298 return _this15.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16299 });
16300 },
16301
16302
16303 /**
16304 * 使用当前使用微信小程序的微信用户身份注册或登录,
16305 * 仅在微信小程序中可用。
16306 *
16307 * @deprecated please use {@link AV.User.loginWithMiniApp}
16308 * @since 3.13.0
16309 * @param {Object} [unionLoginOptions]
16310 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
16311 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16312 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
16313 */
16314 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
16315 var _this16 = this;
16316
16317 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
16318 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
16319 unionIdPlatform = _ref16$unionIdPlatfor === undefined ? 'weixin' : _ref16$unionIdPlatfor,
16320 _ref16$asMainAccount = _ref16.asMainAccount,
16321 asMainAccount = _ref16$asMainAccount === undefined ? false : _ref16$asMainAccount,
16322 _ref16$failOnNotExist = _ref16.failOnNotExist,
16323 failOnNotExist = _ref16$failOnNotExist === undefined ? false : _ref16$failOnNotExist;
16324
16325 var getAuthInfo = getAdapter('getAuthInfo');
16326 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
16327 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
16328 return _this16.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16329 });
16330 },
16331
16332
16333 /**
16334 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
16335 * 仅在 QQ 小程序中可用。
16336 *
16337 * @deprecated please use {@link AV.User.loginWithMiniApp}
16338 * @since 4.2.0
16339 * @param {Object} [options]
16340 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
16341 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
16342 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
16343 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
16344 * @return {Promise.<AV.User>}
16345 */
16346 loginWithQQApp: function loginWithQQApp() {
16347 var _this17 = this;
16348
16349 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16350 _ref17$preferUnionId = _ref17.preferUnionId,
16351 preferUnionId = _ref17$preferUnionId === undefined ? false : _ref17$preferUnionId,
16352 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
16353 unionIdPlatform = _ref17$unionIdPlatfor === undefined ? 'qq' : _ref17$unionIdPlatfor,
16354 _ref17$asMainAccount = _ref17.asMainAccount,
16355 asMainAccount = _ref17$asMainAccount === undefined ? true : _ref17$asMainAccount,
16356 _ref17$failOnNotExist = _ref17.failOnNotExist,
16357 failOnNotExist = _ref17$failOnNotExist === undefined ? false : _ref17$failOnNotExist;
16358
16359 var getAuthInfo = getAdapter('getAuthInfo');
16360 return getAuthInfo({
16361 preferUnionId: preferUnionId,
16362 asMainAccount: asMainAccount,
16363 platform: unionIdPlatform
16364 }).then(function (authInfo) {
16365 authInfo.provider = PLATFORM_QQAPP;
16366 return _this17.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16367 });
16368 },
16369
16370
16371 /**
16372 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
16373 * 仅在 QQ 小程序中可用。
16374 *
16375 * @deprecated please use {@link AV.User.loginWithMiniApp}
16376 * @since 4.2.0
16377 * @param {Object} [unionLoginOptions]
16378 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
16379 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16380 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
16381 * @return {Promise.<AV.User>}
16382 */
16383 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
16384 var _this18 = this;
16385
16386 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
16387 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
16388 unionIdPlatform = _ref18$unionIdPlatfor === undefined ? 'qq' : _ref18$unionIdPlatfor,
16389 _ref18$asMainAccount = _ref18.asMainAccount,
16390 asMainAccount = _ref18$asMainAccount === undefined ? false : _ref18$asMainAccount,
16391 _ref18$failOnNotExist = _ref18.failOnNotExist,
16392 failOnNotExist = _ref18$failOnNotExist === undefined ? false : _ref18$failOnNotExist;
16393
16394 var getAuthInfo = getAdapter('getAuthInfo');
16395 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
16396 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
16397 authInfo.provider = PLATFORM_QQAPP;
16398 return _this18.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16399 });
16400 },
16401
16402
16403 /**
16404 * Register or login using the identity of the current mini-app.
16405 * @param {Object} authInfo
16406 * @param {Object} [option]
16407 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
16408 */
16409 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
16410 var _this19 = this;
16411
16412 if (authInfo === undefined) {
16413 var getAuthInfo = getAdapter('getAuthInfo');
16414 return getAuthInfo().then(function (authInfo) {
16415 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
16416 });
16417 }
16418 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
16419 },
16420
16421
16422 /**
16423 * Only use for DI in tests to produce deterministic IDs.
16424 */
16425 _genId: function _genId() {
16426 return uuid();
16427 },
16428
16429
16430 /**
16431 * Creates an anonymous user.
16432 *
16433 * @since 3.9.0
16434 * @return {Promise.<AV.User>}
16435 */
16436 loginAnonymously: function loginAnonymously() {
16437 return this.loginWithAuthData({
16438 id: AV.User._genId()
16439 }, 'anonymous');
16440 },
16441 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
16442 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
16443 return userObj._linkWith(platform, authData);
16444 },
16445
16446 /**
16447 * Logs out the currently logged in user session. This will remove the
16448 * session from disk, log out of linked services, and future calls to
16449 * <code>current</code> will return <code>null</code>.
16450 * @return {Promise}
16451 */
16452 logOut: function logOut() {
16453 if (AV._config.disableCurrentUser) {
16454 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');
16455 return _promise2.default.resolve(null);
16456 }
16457
16458 if (AV.User._currentUser !== null) {
16459 AV.User._currentUser._logOutWithAll();
16460 AV.User._currentUser._isCurrentUser = false;
16461 }
16462 AV.User._currentUserMatchesDisk = true;
16463 AV.User._currentUser = null;
16464 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
16465 return AV._refreshSubscriptionId();
16466 });
16467 },
16468
16469 /**
16470 *Create a follower query for special user to query the user's followers.
16471 * @param {String} userObjectId The user object id.
16472 * @return {AV.FriendShipQuery}
16473 * @since 0.3.0
16474 */
16475 followerQuery: function followerQuery(userObjectId) {
16476 if (!userObjectId || !_.isString(userObjectId)) {
16477 throw new Error('Invalid user object id.');
16478 }
16479 var query = new AV.FriendShipQuery('_Follower');
16480 query._friendshipTag = 'follower';
16481 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
16482 return query;
16483 },
16484
16485 /**
16486 *Create a followee query for special user to query the user's followees.
16487 * @param {String} userObjectId The user object id.
16488 * @return {AV.FriendShipQuery}
16489 * @since 0.3.0
16490 */
16491 followeeQuery: function followeeQuery(userObjectId) {
16492 if (!userObjectId || !_.isString(userObjectId)) {
16493 throw new Error('Invalid user object id.');
16494 }
16495 var query = new AV.FriendShipQuery('_Followee');
16496 query._friendshipTag = 'followee';
16497 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
16498 return query;
16499 },
16500
16501 /**
16502 * Requests a password reset email to be sent to the specified email address
16503 * associated with the user account. This email allows the user to securely
16504 * reset their password on the AV site.
16505 *
16506 * @param {String} email The email address associated with the user that
16507 * forgot their password.
16508 * @return {Promise}
16509 */
16510 requestPasswordReset: function requestPasswordReset(email) {
16511 var json = { email: email };
16512 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
16513 return request;
16514 },
16515
16516 /**
16517 * Requests a verify email to be sent to the specified email address
16518 * associated with the user account. This email allows the user to securely
16519 * verify their email address on the AV site.
16520 *
16521 * @param {String} email The email address associated with the user that
16522 * doesn't verify their email address.
16523 * @return {Promise}
16524 */
16525 requestEmailVerify: function requestEmailVerify(email) {
16526 var json = { email: email };
16527 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
16528 return request;
16529 },
16530
16531 /**
16532 * Requests a verify sms code to be sent to the specified mobile phone
16533 * number associated with the user account. This sms code allows the user to
16534 * verify their mobile phone number by calling AV.User.verifyMobilePhone
16535 *
16536 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16537 * user that doesn't verify their mobile phone number.
16538 * @param {SMSAuthOptions} [options]
16539 * @return {Promise}
16540 */
16541 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
16542 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16543
16544 var data = {
16545 mobilePhoneNumber: mobilePhoneNumber
16546 };
16547 if (options.validateToken) {
16548 data.validate_token = options.validateToken;
16549 }
16550 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
16551 return request;
16552 },
16553
16554 /**
16555 * Requests a reset password sms code to be sent to the specified mobile phone
16556 * number associated with the user account. This sms code allows the user to
16557 * reset their account's password by calling AV.User.resetPasswordBySmsCode
16558 *
16559 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16560 * user that doesn't verify their mobile phone number.
16561 * @param {SMSAuthOptions} [options]
16562 * @return {Promise}
16563 */
16564 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
16565 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16566
16567 var data = {
16568 mobilePhoneNumber: mobilePhoneNumber
16569 };
16570 if (options.validateToken) {
16571 data.validate_token = options.validateToken;
16572 }
16573 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
16574 return request;
16575 },
16576
16577 /**
16578 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
16579 * This sms code allows current user to reset it's mobilePhoneNumber by
16580 * calling {@link AV.User.changePhoneNumber}
16581 * @since 4.7.0
16582 * @param {String} mobilePhoneNumber
16583 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
16584 * @param {SMSAuthOptions} [options]
16585 * @return {Promise}
16586 */
16587 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
16588 var data = { mobilePhoneNumber: mobilePhoneNumber };
16589 if (ttl) {
16590 data.ttl = options.ttl;
16591 }
16592 if (options && options.validateToken) {
16593 data.validate_token = options.validateToken;
16594 }
16595 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
16596 },
16597
16598
16599 /**
16600 * Makes a call to reset user's account mobilePhoneNumber by sms code.
16601 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
16602 * @since 4.7.0
16603 * @param {String} mobilePhoneNumber
16604 * @param {String} code The sms code.
16605 * @return {Promise}
16606 */
16607 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
16608 var data = { mobilePhoneNumber: mobilePhoneNumber, code: code };
16609 return AVRequest('changePhoneNumber', null, null, 'POST', data);
16610 },
16611
16612
16613 /**
16614 * Makes a call to reset user's account password by sms code and new password.
16615 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
16616 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
16617 * @param {String} password The new password.
16618 * @return {Promise} A promise that will be resolved with the result
16619 * of the function.
16620 */
16621 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
16622 var json = { password: password };
16623 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
16624 return request;
16625 },
16626
16627 /**
16628 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
16629 * If verify successfully,the user mobilePhoneVerified attribute will be true.
16630 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
16631 * @return {Promise} A promise that will be resolved with the result
16632 * of the function.
16633 */
16634 verifyMobilePhone: function verifyMobilePhone(code) {
16635 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
16636 return request;
16637 },
16638
16639 /**
16640 * Requests a logIn sms code to be sent to the specified mobile phone
16641 * number associated with the user account. This sms code allows the user to
16642 * login by AV.User.logInWithMobilePhoneSmsCode function.
16643 *
16644 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16645 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
16646 * @param {SMSAuthOptions} [options]
16647 * @return {Promise}
16648 */
16649 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
16650 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16651
16652 var data = {
16653 mobilePhoneNumber: mobilePhoneNumber
16654 };
16655 if (options.validateToken) {
16656 data.validate_token = options.validateToken;
16657 }
16658 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
16659 return request;
16660 },
16661
16662 /**
16663 * Retrieves the currently logged in AVUser with a valid session,
16664 * either from memory or localStorage, if necessary.
16665 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
16666 */
16667 currentAsync: function currentAsync() {
16668 if (AV._config.disableCurrentUser) {
16669 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');
16670 return _promise2.default.resolve(null);
16671 }
16672
16673 if (AV.User._currentUser) {
16674 return _promise2.default.resolve(AV.User._currentUser);
16675 }
16676
16677 if (AV.User._currentUserMatchesDisk) {
16678 return _promise2.default.resolve(AV.User._currentUser);
16679 }
16680
16681 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
16682 if (!userData) {
16683 return null;
16684 }
16685
16686 // Load the user from local storage.
16687 AV.User._currentUserMatchesDisk = true;
16688
16689 AV.User._currentUser = AV.Object._create('_User');
16690 AV.User._currentUser._isCurrentUser = true;
16691
16692 var json = JSON.parse(userData);
16693 AV.User._currentUser.id = json._id;
16694 delete json._id;
16695 AV.User._currentUser._sessionToken = json._sessionToken;
16696 delete json._sessionToken;
16697 AV.User._currentUser._finishFetch(json);
16698 //AV.User._currentUser.set(json);
16699
16700 AV.User._currentUser._synchronizeAllAuthData();
16701 AV.User._currentUser._refreshCache();
16702 AV.User._currentUser._opSetQueue = [{}];
16703 return AV.User._currentUser;
16704 });
16705 },
16706
16707 /**
16708 * Retrieves the currently logged in AVUser with a valid session,
16709 * either from memory or localStorage, if necessary.
16710 * @return {AV.User} The currently logged in AV.User.
16711 */
16712 current: function current() {
16713 if (AV._config.disableCurrentUser) {
16714 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');
16715 return null;
16716 }
16717
16718 if (AV.localStorage.async) {
16719 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
16720 error.code = 'SYNC_API_NOT_AVAILABLE';
16721 throw error;
16722 }
16723
16724 if (AV.User._currentUser) {
16725 return AV.User._currentUser;
16726 }
16727
16728 if (AV.User._currentUserMatchesDisk) {
16729 return AV.User._currentUser;
16730 }
16731
16732 // Load the user from local storage.
16733 AV.User._currentUserMatchesDisk = true;
16734
16735 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
16736 if (!userData) {
16737 return null;
16738 }
16739 AV.User._currentUser = AV.Object._create('_User');
16740 AV.User._currentUser._isCurrentUser = true;
16741
16742 var json = JSON.parse(userData);
16743 AV.User._currentUser.id = json._id;
16744 delete json._id;
16745 AV.User._currentUser._sessionToken = json._sessionToken;
16746 delete json._sessionToken;
16747 AV.User._currentUser._finishFetch(json);
16748 //AV.User._currentUser.set(json);
16749
16750 AV.User._currentUser._synchronizeAllAuthData();
16751 AV.User._currentUser._refreshCache();
16752 AV.User._currentUser._opSetQueue = [{}];
16753 return AV.User._currentUser;
16754 },
16755
16756 /**
16757 * Persists a user as currentUser to localStorage, and into the singleton.
16758 * @private
16759 */
16760 _saveCurrentUser: function _saveCurrentUser(user) {
16761 var promise;
16762 if (AV.User._currentUser !== user) {
16763 promise = AV.User.logOut();
16764 } else {
16765 promise = _promise2.default.resolve();
16766 }
16767 return promise.then(function () {
16768 user._isCurrentUser = true;
16769 AV.User._currentUser = user;
16770
16771 var json = user._toFullJSON();
16772 json._id = user.id;
16773 json._sessionToken = user._sessionToken;
16774 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify2.default)(json)).then(function () {
16775 AV.User._currentUserMatchesDisk = true;
16776 return AV._refreshSubscriptionId();
16777 });
16778 });
16779 },
16780
16781 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
16782 AV.User._authProviders[provider.getAuthType()] = provider;
16783 // Synchronize the current user with the auth provider.
16784 if (!AV._config.disableCurrentUser && AV.User.current()) {
16785 AV.User.current()._synchronizeAuthData(provider.getAuthType());
16786 }
16787 },
16788
16789 _logInWith: function _logInWith(provider, authData, options) {
16790 var user = AV.Object._create('_User');
16791 return user._linkWith(provider, authData, options);
16792 }
16793 });
16794};
16795
16796/***/ }),
16797/* 330 */
16798/***/ (function(module, exports, __webpack_require__) {
16799
16800"use strict";
16801
16802
16803exports.__esModule = true;
16804
16805var _defineProperty = __webpack_require__(67);
16806
16807var _defineProperty2 = _interopRequireDefault(_defineProperty);
16808
16809function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16810
16811exports.default = function (obj, key, value) {
16812 if (key in obj) {
16813 (0, _defineProperty2.default)(obj, key, {
16814 value: value,
16815 enumerable: true,
16816 configurable: true,
16817 writable: true
16818 });
16819 } else {
16820 obj[key] = value;
16821 }
16822
16823 return obj;
16824};
16825
16826/***/ }),
16827/* 331 */
16828/***/ (function(module, exports, __webpack_require__) {
16829
16830"use strict";
16831
16832
16833var _stringify = __webpack_require__(21);
16834
16835var _stringify2 = _interopRequireDefault(_stringify);
16836
16837var _promise = __webpack_require__(3);
16838
16839var _promise2 = _interopRequireDefault(_promise);
16840
16841function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16842
16843var _ = __webpack_require__(0);
16844var debug = __webpack_require__(40)('leancloud:query');
16845var AVError = __webpack_require__(31);
16846
16847var _require = __webpack_require__(14),
16848 _request = _require._request,
16849 request = _require.request;
16850
16851var _require2 = __webpack_require__(17),
16852 ensureArray = _require2.ensureArray,
16853 transformFetchOptions = _require2.transformFetchOptions,
16854 continueWhile = _require2.continueWhile;
16855
16856var requires = function requires(value, message) {
16857 if (value === undefined) {
16858 throw new Error(message);
16859 }
16860};
16861
16862// AV.Query is a way to create a list of AV.Objects.
16863module.exports = function (AV) {
16864 /**
16865 * Creates a new AV.Query for the given AV.Object subclass.
16866 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
16867 * @class
16868 *
16869 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
16870 * most common use case is finding all objects that match a query through the
16871 * <code>find</code> method. For example, this sample code fetches all objects
16872 * of class <code>MyClass</code>. It calls a different function depending on
16873 * whether the fetch succeeded or not.
16874 *
16875 * <pre>
16876 * var query = new AV.Query(MyClass);
16877 * query.find().then(function(results) {
16878 * // results is an array of AV.Object.
16879 * }, function(error) {
16880 * // error is an instance of AVError.
16881 * });</pre></p>
16882 *
16883 * <p>An AV.Query can also be used to retrieve a single object whose id is
16884 * known, through the get method. For example, this sample code fetches an
16885 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
16886 * different function depending on whether the fetch succeeded or not.
16887 *
16888 * <pre>
16889 * var query = new AV.Query(MyClass);
16890 * query.get(myId).then(function(object) {
16891 * // object is an instance of AV.Object.
16892 * }, function(error) {
16893 * // error is an instance of AVError.
16894 * });</pre></p>
16895 *
16896 * <p>An AV.Query can also be used to count the number of objects that match
16897 * the query without retrieving all of those objects. For example, this
16898 * sample code counts the number of objects of the class <code>MyClass</code>
16899 * <pre>
16900 * var query = new AV.Query(MyClass);
16901 * query.count().then(function(number) {
16902 * // There are number instances of MyClass.
16903 * }, function(error) {
16904 * // error is an instance of AVError.
16905 * });</pre></p>
16906 */
16907 AV.Query = function (objectClass) {
16908 if (_.isString(objectClass)) {
16909 objectClass = AV.Object._getSubclass(objectClass);
16910 }
16911
16912 this.objectClass = objectClass;
16913
16914 this.className = objectClass.prototype.className;
16915
16916 this._where = {};
16917 this._include = [];
16918 this._select = [];
16919 this._limit = -1; // negative limit means, do not send a limit
16920 this._skip = 0;
16921 this._defaultParams = {};
16922 };
16923
16924 /**
16925 * Constructs a AV.Query that is the OR of the passed in queries. For
16926 * example:
16927 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
16928 *
16929 * will create a compoundQuery that is an or of the query1, query2, and
16930 * query3.
16931 * @param {...AV.Query} var_args The list of queries to OR.
16932 * @return {AV.Query} The query that is the OR of the passed in queries.
16933 */
16934 AV.Query.or = function () {
16935 var queries = _.toArray(arguments);
16936 var className = null;
16937 AV._arrayEach(queries, function (q) {
16938 if (_.isNull(className)) {
16939 className = q.className;
16940 }
16941
16942 if (className !== q.className) {
16943 throw new Error('All queries must be for the same class');
16944 }
16945 });
16946 var query = new AV.Query(className);
16947 query._orQuery(queries);
16948 return query;
16949 };
16950
16951 /**
16952 * Constructs a AV.Query that is the AND of the passed in queries. For
16953 * example:
16954 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
16955 *
16956 * will create a compoundQuery that is an 'and' of the query1, query2, and
16957 * query3.
16958 * @param {...AV.Query} var_args The list of queries to AND.
16959 * @return {AV.Query} The query that is the AND of the passed in queries.
16960 */
16961 AV.Query.and = function () {
16962 var queries = _.toArray(arguments);
16963 var className = null;
16964 AV._arrayEach(queries, function (q) {
16965 if (_.isNull(className)) {
16966 className = q.className;
16967 }
16968
16969 if (className !== q.className) {
16970 throw new Error('All queries must be for the same class');
16971 }
16972 });
16973 var query = new AV.Query(className);
16974 query._andQuery(queries);
16975 return query;
16976 };
16977
16978 /**
16979 * Retrieves a list of AVObjects that satisfy the CQL.
16980 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
16981 *
16982 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
16983 * @param {Array} pvalues An array contains placeholder values.
16984 * @param {AuthOptions} options
16985 * @return {Promise} A promise that is resolved with the results when
16986 * the query completes.
16987 */
16988 AV.Query.doCloudQuery = function (cql, pvalues, options) {
16989 var params = { cql: cql };
16990 if (_.isArray(pvalues)) {
16991 params.pvalues = pvalues;
16992 } else {
16993 options = pvalues;
16994 }
16995
16996 var request = _request('cloudQuery', null, null, 'GET', params, options);
16997 return request.then(function (response) {
16998 //query to process results.
16999 var query = new AV.Query(response.className);
17000 var results = _.map(response.results, function (json) {
17001 var obj = query._newObject(response);
17002 if (obj._finishFetch) {
17003 obj._finishFetch(query._processResult(json), true);
17004 }
17005 return obj;
17006 });
17007 return {
17008 results: results,
17009 count: response.count,
17010 className: response.className
17011 };
17012 });
17013 };
17014
17015 /**
17016 * Return a query with conditions from json.
17017 * This can be useful to send a query from server side to client side.
17018 * @since 4.0.0
17019 * @param {Object} json from {@link AV.Query#toJSON}
17020 * @return {AV.Query}
17021 */
17022 AV.Query.fromJSON = function (_ref) {
17023 var className = _ref.className,
17024 where = _ref.where,
17025 include = _ref.include,
17026 select = _ref.select,
17027 includeACL = _ref.includeACL,
17028 limit = _ref.limit,
17029 skip = _ref.skip,
17030 order = _ref.order;
17031
17032 if (typeof className !== 'string') {
17033 throw new TypeError('Invalid Query JSON, className must be a String.');
17034 }
17035 var query = new AV.Query(className);
17036 _.extend(query, {
17037 _where: where,
17038 _include: include,
17039 _select: select,
17040 _includeACL: includeACL,
17041 _limit: limit,
17042 _skip: skip,
17043 _order: order
17044 });
17045 return query;
17046 };
17047
17048 AV.Query._extend = AV._extend;
17049
17050 _.extend(AV.Query.prototype,
17051 /** @lends AV.Query.prototype */{
17052 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
17053 _processResult: function _processResult(obj) {
17054 return obj;
17055 },
17056
17057 /**
17058 * Constructs an AV.Object whose id is already known by fetching data from
17059 * the server.
17060 *
17061 * @param {String} objectId The id of the object to be fetched.
17062 * @param {AuthOptions} options
17063 * @return {Promise.<AV.Object>}
17064 */
17065 get: function get(objectId, options) {
17066 if (!_.isString(objectId)) {
17067 throw new Error('objectId must be a string');
17068 }
17069 if (objectId === '') {
17070 return _promise2.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
17071 }
17072
17073 var obj = this._newObject();
17074 obj.id = objectId;
17075
17076 var queryJSON = this._getParams();
17077 var fetchOptions = {};
17078
17079 if (queryJSON.keys) fetchOptions.keys = queryJSON.keys;
17080 if (queryJSON.include) fetchOptions.include = queryJSON.include;
17081 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
17082
17083 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
17084 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
17085 obj._finishFetch(obj.parse(response), true);
17086 return obj;
17087 });
17088 },
17089
17090 /**
17091 * Returns a JSON representation of this query.
17092 * @return {Object}
17093 */
17094 toJSON: function toJSON() {
17095 var className = this.className,
17096 where = this._where,
17097 include = this._include,
17098 select = this._select,
17099 includeACL = this._includeACL,
17100 limit = this._limit,
17101 skip = this._skip,
17102 order = this._order;
17103
17104 return {
17105 className: className,
17106 where: where,
17107 include: include,
17108 select: select,
17109 includeACL: includeACL,
17110 limit: limit,
17111 skip: skip,
17112 order: order
17113 };
17114 },
17115
17116
17117 _getParams: function _getParams() {
17118 var params = _.extend({}, this._defaultParams, {
17119 where: this._where
17120 });
17121
17122 if (this._include.length > 0) {
17123 params.include = this._include.join(',');
17124 }
17125 if (this._select.length > 0) {
17126 params.keys = this._select.join(',');
17127 }
17128 if (this._includeACL !== undefined) {
17129 params.returnACL = this._includeACL;
17130 }
17131 if (this._limit >= 0) {
17132 params.limit = this._limit;
17133 }
17134 if (this._skip > 0) {
17135 params.skip = this._skip;
17136 }
17137 if (this._order !== undefined) {
17138 params.order = this._order;
17139 }
17140
17141 return params;
17142 },
17143
17144 _newObject: function _newObject(response) {
17145 var obj;
17146 if (response && response.className) {
17147 obj = new AV.Object(response.className);
17148 } else {
17149 obj = new this.objectClass();
17150 }
17151 return obj;
17152 },
17153 _createRequest: function _createRequest() {
17154 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
17155 var options = arguments[1];
17156 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '/classes/' + this.className;
17157
17158 if (encodeURIComponent((0, _stringify2.default)(params)).length > 2000) {
17159 var body = {
17160 requests: [{
17161 method: 'GET',
17162 path: '/1.1' + path,
17163 params: params
17164 }]
17165 };
17166 return request({
17167 path: '/batch',
17168 method: 'POST',
17169 data: body,
17170 authOptions: options
17171 }).then(function (response) {
17172 var result = response[0];
17173 if (result.success) {
17174 return result.success;
17175 }
17176 var error = new Error(result.error.error || 'Unknown batch error');
17177 error.code = result.error.code;
17178 throw error;
17179 });
17180 }
17181 return request({
17182 method: 'GET',
17183 path: path,
17184 query: params,
17185 authOptions: options
17186 });
17187 },
17188 _parseResponse: function _parseResponse(response) {
17189 var _this = this;
17190
17191 return _.map(response.results, function (json) {
17192 var obj = _this._newObject(response);
17193 if (obj._finishFetch) {
17194 obj._finishFetch(_this._processResult(json), true);
17195 }
17196 return obj;
17197 });
17198 },
17199
17200
17201 /**
17202 * Retrieves a list of AVObjects that satisfy this query.
17203 *
17204 * @param {AuthOptions} options
17205 * @return {Promise} A promise that is resolved with the results when
17206 * the query completes.
17207 */
17208 find: function find(options) {
17209 var request = this._createRequest(undefined, options);
17210 return request.then(this._parseResponse.bind(this));
17211 },
17212
17213
17214 /**
17215 * Retrieves both AVObjects and total count.
17216 *
17217 * @since 4.12.0
17218 * @param {AuthOptions} options
17219 * @return {Promise} A tuple contains results and count.
17220 */
17221 findAndCount: function findAndCount(options) {
17222 var _this2 = this;
17223
17224 var params = this._getParams();
17225 params.count = 1;
17226 var request = this._createRequest(params, options);
17227
17228 return request.then(function (response) {
17229 return [_this2._parseResponse(response), response.count];
17230 });
17231 },
17232
17233
17234 /**
17235 * scan a Query. masterKey required.
17236 *
17237 * @since 2.1.0
17238 * @param {object} [options]
17239 * @param {string} [options.orderedBy] specify the key to sort
17240 * @param {number} [options.batchSize] specify the batch size for each request
17241 * @param {AuthOptions} [authOptions]
17242 * @return {AsyncIterator.<AV.Object>}
17243 * @example const testIterator = {
17244 * [Symbol.asyncIterator]() {
17245 * return new Query('Test').scan(undefined, { useMasterKey: true });
17246 * },
17247 * };
17248 * for await (const test of testIterator) {
17249 * console.log(test.id);
17250 * }
17251 */
17252 scan: function scan() {
17253 var _this3 = this;
17254
17255 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
17256 orderedBy = _ref2.orderedBy,
17257 batchSize = _ref2.batchSize;
17258
17259 var authOptions = arguments[1];
17260
17261 var condition = this._getParams();
17262 debug('scan %O', condition);
17263 if (condition.order) {
17264 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
17265 delete condition.order;
17266 }
17267 if (condition.skip) {
17268 console.warn('The skip option of the query is ignored for Query#scan.');
17269 delete condition.skip;
17270 }
17271 if (condition.limit) {
17272 console.warn('The limit option of the query is ignored for Query#scan.');
17273 delete condition.limit;
17274 }
17275 if (orderedBy) condition.scan_key = orderedBy;
17276 if (batchSize) condition.limit = batchSize;
17277 var promise = _promise2.default.resolve([]);
17278 var cursor = void 0;
17279 var endReached = false;
17280 return {
17281 next: function next() {
17282 promise = promise.then(function (remainResults) {
17283 if (endReached) return [];
17284 if (remainResults.length > 1) return remainResults;
17285 // no cursor means we have reached the end
17286 // except for the first time
17287 if (!cursor && remainResults.length !== 0) {
17288 endReached = true;
17289 return remainResults;
17290 }
17291 // when only 1 item left in queue
17292 // start the next request to see if it is the last one
17293 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, { cursor: cursor }) : condition, authOptions).then(function (response) {
17294 cursor = response.cursor;
17295 return _this3._parseResponse(response);
17296 }).then(function (results) {
17297 if (!results.length) endReached = true;
17298 return remainResults.concat(results);
17299 });
17300 });
17301 return promise.then(function (remainResults) {
17302 return remainResults.shift();
17303 }).then(function (result) {
17304 return {
17305 value: result,
17306 done: result === undefined
17307 };
17308 });
17309 }
17310 };
17311 },
17312
17313
17314 /**
17315 * Delete objects retrieved by this query.
17316 * @param {AuthOptions} options
17317 * @return {Promise} A promise that is fulfilled when the save
17318 * completes.
17319 */
17320 destroyAll: function destroyAll(options) {
17321 var self = this;
17322 return self.find(options).then(function (objects) {
17323 return AV.Object.destroyAll(objects, options);
17324 });
17325 },
17326
17327 /**
17328 * Counts the number of objects that match this query.
17329 *
17330 * @param {AuthOptions} options
17331 * @return {Promise} A promise that is resolved with the count when
17332 * the query completes.
17333 */
17334 count: function count(options) {
17335 var params = this._getParams();
17336 params.limit = 0;
17337 params.count = 1;
17338 var request = this._createRequest(params, options);
17339
17340 return request.then(function (response) {
17341 return response.count;
17342 });
17343 },
17344
17345 /**
17346 * Retrieves at most one AV.Object that satisfies this query.
17347 *
17348 * @param {AuthOptions} options
17349 * @return {Promise} A promise that is resolved with the object when
17350 * the query completes.
17351 */
17352 first: function first(options) {
17353 var self = this;
17354
17355 var params = this._getParams();
17356 params.limit = 1;
17357 var request = this._createRequest(params, options);
17358
17359 return request.then(function (response) {
17360 return _.map(response.results, function (json) {
17361 var obj = self._newObject();
17362 if (obj._finishFetch) {
17363 obj._finishFetch(self._processResult(json), true);
17364 }
17365 return obj;
17366 })[0];
17367 });
17368 },
17369
17370 /**
17371 * Sets the number of results to skip before returning any results.
17372 * This is useful for pagination.
17373 * Default is to skip zero results.
17374 * @param {Number} n the number of results to skip.
17375 * @return {AV.Query} Returns the query, so you can chain this call.
17376 */
17377 skip: function skip(n) {
17378 requires(n, 'undefined is not a valid skip value');
17379 this._skip = n;
17380 return this;
17381 },
17382
17383 /**
17384 * Sets the limit of the number of results to return. The default limit is
17385 * 100, with a maximum of 1000 results being returned at a time.
17386 * @param {Number} n the number of results to limit to.
17387 * @return {AV.Query} Returns the query, so you can chain this call.
17388 */
17389 limit: function limit(n) {
17390 requires(n, 'undefined is not a valid limit value');
17391 this._limit = n;
17392 return this;
17393 },
17394
17395 /**
17396 * Add a constraint to the query that requires a particular key's value to
17397 * be equal to the provided value.
17398 * @param {String} key The key to check.
17399 * @param value The value that the AV.Object must contain.
17400 * @return {AV.Query} Returns the query, so you can chain this call.
17401 */
17402 equalTo: function equalTo(key, value) {
17403 requires(key, 'undefined is not a valid key');
17404 requires(value, 'undefined is not a valid value');
17405 this._where[key] = AV._encode(value);
17406 return this;
17407 },
17408
17409 /**
17410 * Helper for condition queries
17411 * @private
17412 */
17413 _addCondition: function _addCondition(key, condition, value) {
17414 requires(key, 'undefined is not a valid condition key');
17415 requires(condition, 'undefined is not a valid condition');
17416 requires(value, 'undefined is not a valid condition value');
17417
17418 // Check if we already have a condition
17419 if (!this._where[key]) {
17420 this._where[key] = {};
17421 }
17422 this._where[key][condition] = AV._encode(value);
17423 return this;
17424 },
17425
17426 /**
17427 * Add a constraint to the query that requires a particular
17428 * <strong>array</strong> key's length to be equal to the provided value.
17429 * @param {String} key The array key to check.
17430 * @param value The length value.
17431 * @return {AV.Query} Returns the query, so you can chain this call.
17432 */
17433 sizeEqualTo: function sizeEqualTo(key, value) {
17434 this._addCondition(key, '$size', value);
17435 return this;
17436 },
17437
17438 /**
17439 * Add a constraint to the query that requires a particular key's value to
17440 * be not equal to the provided value.
17441 * @param {String} key The key to check.
17442 * @param value The value that must not be equalled.
17443 * @return {AV.Query} Returns the query, so you can chain this call.
17444 */
17445 notEqualTo: function notEqualTo(key, value) {
17446 this._addCondition(key, '$ne', value);
17447 return this;
17448 },
17449
17450 /**
17451 * Add a constraint to the query that requires a particular key's value to
17452 * be less than the provided value.
17453 * @param {String} key The key to check.
17454 * @param value The value that provides an upper bound.
17455 * @return {AV.Query} Returns the query, so you can chain this call.
17456 */
17457 lessThan: function lessThan(key, value) {
17458 this._addCondition(key, '$lt', value);
17459 return this;
17460 },
17461
17462 /**
17463 * Add a constraint to the query that requires a particular key's value to
17464 * be greater than the provided value.
17465 * @param {String} key The key to check.
17466 * @param value The value that provides an lower bound.
17467 * @return {AV.Query} Returns the query, so you can chain this call.
17468 */
17469 greaterThan: function greaterThan(key, value) {
17470 this._addCondition(key, '$gt', value);
17471 return this;
17472 },
17473
17474 /**
17475 * Add a constraint to the query that requires a particular key's value to
17476 * be less than or equal to the provided value.
17477 * @param {String} key The key to check.
17478 * @param value The value that provides an upper bound.
17479 * @return {AV.Query} Returns the query, so you can chain this call.
17480 */
17481 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
17482 this._addCondition(key, '$lte', value);
17483 return this;
17484 },
17485
17486 /**
17487 * Add a constraint to the query that requires a particular key's value to
17488 * be greater than or equal to the provided value.
17489 * @param {String} key The key to check.
17490 * @param value The value that provides an lower bound.
17491 * @return {AV.Query} Returns the query, so you can chain this call.
17492 */
17493 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
17494 this._addCondition(key, '$gte', value);
17495 return this;
17496 },
17497
17498 /**
17499 * Add a constraint to the query that requires a particular key's value to
17500 * be contained in the provided list of values.
17501 * @param {String} key The key to check.
17502 * @param {Array} values The values that will match.
17503 * @return {AV.Query} Returns the query, so you can chain this call.
17504 */
17505 containedIn: function containedIn(key, values) {
17506 this._addCondition(key, '$in', values);
17507 return this;
17508 },
17509
17510 /**
17511 * Add a constraint to the query that requires a particular key's value to
17512 * not be contained in the provided list of values.
17513 * @param {String} key The key to check.
17514 * @param {Array} values The values that will not match.
17515 * @return {AV.Query} Returns the query, so you can chain this call.
17516 */
17517 notContainedIn: function notContainedIn(key, values) {
17518 this._addCondition(key, '$nin', values);
17519 return this;
17520 },
17521
17522 /**
17523 * Add a constraint to the query that requires a particular key's value to
17524 * contain each one of the provided list of values.
17525 * @param {String} key The key to check. This key's value must be an array.
17526 * @param {Array} values The values that will match.
17527 * @return {AV.Query} Returns the query, so you can chain this call.
17528 */
17529 containsAll: function containsAll(key, values) {
17530 this._addCondition(key, '$all', values);
17531 return this;
17532 },
17533
17534 /**
17535 * Add a constraint for finding objects that contain the given key.
17536 * @param {String} key The key that should exist.
17537 * @return {AV.Query} Returns the query, so you can chain this call.
17538 */
17539 exists: function exists(key) {
17540 this._addCondition(key, '$exists', true);
17541 return this;
17542 },
17543
17544 /**
17545 * Add a constraint for finding objects that do not contain a given key.
17546 * @param {String} key The key that should not exist
17547 * @return {AV.Query} Returns the query, so you can chain this call.
17548 */
17549 doesNotExist: function doesNotExist(key) {
17550 this._addCondition(key, '$exists', false);
17551 return this;
17552 },
17553
17554 /**
17555 * Add a regular expression constraint for finding string values that match
17556 * the provided regular expression.
17557 * This may be slow for large datasets.
17558 * @param {String} key The key that the string to match is stored in.
17559 * @param {RegExp} regex The regular expression pattern to match.
17560 * @return {AV.Query} Returns the query, so you can chain this call.
17561 */
17562 matches: function matches(key, regex, modifiers) {
17563 this._addCondition(key, '$regex', regex);
17564 if (!modifiers) {
17565 modifiers = '';
17566 }
17567 // Javascript regex options support mig as inline options but store them
17568 // as properties of the object. We support mi & should migrate them to
17569 // modifiers
17570 if (regex.ignoreCase) {
17571 modifiers += 'i';
17572 }
17573 if (regex.multiline) {
17574 modifiers += 'm';
17575 }
17576
17577 if (modifiers && modifiers.length) {
17578 this._addCondition(key, '$options', modifiers);
17579 }
17580 return this;
17581 },
17582
17583 /**
17584 * Add a constraint that requires that a key's value matches a AV.Query
17585 * constraint.
17586 * @param {String} key The key that the contains the object to match the
17587 * query.
17588 * @param {AV.Query} query The query that should match.
17589 * @return {AV.Query} Returns the query, so you can chain this call.
17590 */
17591 matchesQuery: function matchesQuery(key, query) {
17592 var queryJSON = query._getParams();
17593 queryJSON.className = query.className;
17594 this._addCondition(key, '$inQuery', queryJSON);
17595 return this;
17596 },
17597
17598 /**
17599 * Add a constraint that requires that a key's value not matches a
17600 * AV.Query constraint.
17601 * @param {String} key The key that the contains the object to match the
17602 * query.
17603 * @param {AV.Query} query The query that should not match.
17604 * @return {AV.Query} Returns the query, so you can chain this call.
17605 */
17606 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
17607 var queryJSON = query._getParams();
17608 queryJSON.className = query.className;
17609 this._addCondition(key, '$notInQuery', queryJSON);
17610 return this;
17611 },
17612
17613 /**
17614 * Add a constraint that requires that a key's value matches a value in
17615 * an object returned by a different AV.Query.
17616 * @param {String} key The key that contains the value that is being
17617 * matched.
17618 * @param {String} queryKey The key in the objects returned by the query to
17619 * match against.
17620 * @param {AV.Query} query The query to run.
17621 * @return {AV.Query} Returns the query, so you can chain this call.
17622 */
17623 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
17624 var queryJSON = query._getParams();
17625 queryJSON.className = query.className;
17626 this._addCondition(key, '$select', { key: queryKey, query: queryJSON });
17627 return this;
17628 },
17629
17630 /**
17631 * Add a constraint that requires that a key's value not match a value in
17632 * an object returned by a different AV.Query.
17633 * @param {String} key The key that contains the value that is being
17634 * excluded.
17635 * @param {String} queryKey The key in the objects returned by the query to
17636 * match against.
17637 * @param {AV.Query} query The query to run.
17638 * @return {AV.Query} Returns the query, so you can chain this call.
17639 */
17640 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
17641 var queryJSON = query._getParams();
17642 queryJSON.className = query.className;
17643 this._addCondition(key, '$dontSelect', {
17644 key: queryKey,
17645 query: queryJSON
17646 });
17647 return this;
17648 },
17649
17650 /**
17651 * Add constraint that at least one of the passed in queries matches.
17652 * @param {Array} queries
17653 * @return {AV.Query} Returns the query, so you can chain this call.
17654 * @private
17655 */
17656 _orQuery: function _orQuery(queries) {
17657 var queryJSON = _.map(queries, function (q) {
17658 return q._getParams().where;
17659 });
17660
17661 this._where.$or = queryJSON;
17662 return this;
17663 },
17664
17665 /**
17666 * Add constraint that both of the passed in queries matches.
17667 * @param {Array} queries
17668 * @return {AV.Query} Returns the query, so you can chain this call.
17669 * @private
17670 */
17671 _andQuery: function _andQuery(queries) {
17672 var queryJSON = _.map(queries, function (q) {
17673 return q._getParams().where;
17674 });
17675
17676 this._where.$and = queryJSON;
17677 return this;
17678 },
17679
17680 /**
17681 * Converts a string into a regex that matches it.
17682 * Surrounding with \Q .. \E does this, we just need to escape \E's in
17683 * the text separately.
17684 * @private
17685 */
17686 _quote: function _quote(s) {
17687 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
17688 },
17689
17690 /**
17691 * Add a constraint for finding string values that contain a provided
17692 * string. This may be slow for large datasets.
17693 * @param {String} key The key that the string to match is stored in.
17694 * @param {String} substring The substring that the value must contain.
17695 * @return {AV.Query} Returns the query, so you can chain this call.
17696 */
17697 contains: function contains(key, value) {
17698 this._addCondition(key, '$regex', this._quote(value));
17699 return this;
17700 },
17701
17702 /**
17703 * Add a constraint for finding string values that start with a provided
17704 * string. This query will use the backend index, so it will be fast even
17705 * for large datasets.
17706 * @param {String} key The key that the string to match is stored in.
17707 * @param {String} prefix The substring that the value must start with.
17708 * @return {AV.Query} Returns the query, so you can chain this call.
17709 */
17710 startsWith: function startsWith(key, value) {
17711 this._addCondition(key, '$regex', '^' + this._quote(value));
17712 return this;
17713 },
17714
17715 /**
17716 * Add a constraint for finding string values that end with a provided
17717 * string. This will be slow for large datasets.
17718 * @param {String} key The key that the string to match is stored in.
17719 * @param {String} suffix The substring that the value must end with.
17720 * @return {AV.Query} Returns the query, so you can chain this call.
17721 */
17722 endsWith: function endsWith(key, value) {
17723 this._addCondition(key, '$regex', this._quote(value) + '$');
17724 return this;
17725 },
17726
17727 /**
17728 * Sorts the results in ascending order by the given key.
17729 *
17730 * @param {String} key The key to order by.
17731 * @return {AV.Query} Returns the query, so you can chain this call.
17732 */
17733 ascending: function ascending(key) {
17734 requires(key, 'undefined is not a valid key');
17735 this._order = key;
17736 return this;
17737 },
17738
17739 /**
17740 * Also sorts the results in ascending order by the given key. The previous sort keys have
17741 * precedence over this key.
17742 *
17743 * @param {String} key The key to order by
17744 * @return {AV.Query} Returns the query so you can chain this call.
17745 */
17746 addAscending: function addAscending(key) {
17747 requires(key, 'undefined is not a valid key');
17748 if (this._order) this._order += ',' + key;else this._order = key;
17749 return this;
17750 },
17751
17752 /**
17753 * Sorts the results in descending order by the given key.
17754 *
17755 * @param {String} key The key to order by.
17756 * @return {AV.Query} Returns the query, so you can chain this call.
17757 */
17758 descending: function descending(key) {
17759 requires(key, 'undefined is not a valid key');
17760 this._order = '-' + key;
17761 return this;
17762 },
17763
17764 /**
17765 * Also sorts the results in descending order by the given key. The previous sort keys have
17766 * precedence over this key.
17767 *
17768 * @param {String} key The key to order by
17769 * @return {AV.Query} Returns the query so you can chain this call.
17770 */
17771 addDescending: function addDescending(key) {
17772 requires(key, 'undefined is not a valid key');
17773 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
17774 return this;
17775 },
17776
17777 /**
17778 * Add a proximity based constraint for finding objects with key point
17779 * values near the point given.
17780 * @param {String} key The key that the AV.GeoPoint is stored in.
17781 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17782 * @return {AV.Query} Returns the query, so you can chain this call.
17783 */
17784 near: function near(key, point) {
17785 if (!(point instanceof AV.GeoPoint)) {
17786 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
17787 point = new AV.GeoPoint(point);
17788 }
17789 this._addCondition(key, '$nearSphere', point);
17790 return this;
17791 },
17792
17793 /**
17794 * Add a proximity based constraint for finding objects with key point
17795 * values near the point given and within the maximum distance given.
17796 * @param {String} key The key that the AV.GeoPoint is stored in.
17797 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17798 * @param maxDistance Maximum distance (in radians) of results to return.
17799 * @return {AV.Query} Returns the query, so you can chain this call.
17800 */
17801 withinRadians: function withinRadians(key, point, distance) {
17802 this.near(key, point);
17803 this._addCondition(key, '$maxDistance', distance);
17804 return this;
17805 },
17806
17807 /**
17808 * Add a proximity based constraint for finding objects with key point
17809 * values near the point given and within the maximum distance given.
17810 * Radius of earth used is 3958.8 miles.
17811 * @param {String} key The key that the AV.GeoPoint is stored in.
17812 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17813 * @param {Number} maxDistance Maximum distance (in miles) of results to
17814 * return.
17815 * @return {AV.Query} Returns the query, so you can chain this call.
17816 */
17817 withinMiles: function withinMiles(key, point, distance) {
17818 return this.withinRadians(key, point, distance / 3958.8);
17819 },
17820
17821 /**
17822 * Add a proximity based constraint for finding objects with key point
17823 * values near the point given and within the maximum distance given.
17824 * Radius of earth used is 6371.0 kilometers.
17825 * @param {String} key The key that the AV.GeoPoint is stored in.
17826 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17827 * @param {Number} maxDistance Maximum distance (in kilometers) of results
17828 * to return.
17829 * @return {AV.Query} Returns the query, so you can chain this call.
17830 */
17831 withinKilometers: function withinKilometers(key, point, distance) {
17832 return this.withinRadians(key, point, distance / 6371.0);
17833 },
17834
17835 /**
17836 * Add a constraint to the query that requires a particular key's
17837 * coordinates be contained within a given rectangular geographic bounding
17838 * box.
17839 * @param {String} key The key to be constrained.
17840 * @param {AV.GeoPoint} southwest
17841 * The lower-left inclusive corner of the box.
17842 * @param {AV.GeoPoint} northeast
17843 * The upper-right inclusive corner of the box.
17844 * @return {AV.Query} Returns the query, so you can chain this call.
17845 */
17846 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
17847 if (!(southwest instanceof AV.GeoPoint)) {
17848 southwest = new AV.GeoPoint(southwest);
17849 }
17850 if (!(northeast instanceof AV.GeoPoint)) {
17851 northeast = new AV.GeoPoint(northeast);
17852 }
17853 this._addCondition(key, '$within', { $box: [southwest, northeast] });
17854 return this;
17855 },
17856
17857 /**
17858 * Include nested AV.Objects for the provided key. You can use dot
17859 * notation to specify which fields in the included object are also fetch.
17860 * @param {String[]} keys The name of the key to include.
17861 * @return {AV.Query} Returns the query, so you can chain this call.
17862 */
17863 include: function include(keys) {
17864 var _this4 = this;
17865
17866 requires(keys, 'undefined is not a valid key');
17867 _.forEach(arguments, function (keys) {
17868 _this4._include = _this4._include.concat(ensureArray(keys));
17869 });
17870 return this;
17871 },
17872
17873 /**
17874 * Include the ACL.
17875 * @param {Boolean} [value=true] Whether to include the ACL
17876 * @return {AV.Query} Returns the query, so you can chain this call.
17877 */
17878 includeACL: function includeACL() {
17879 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
17880
17881 this._includeACL = value;
17882 return this;
17883 },
17884
17885 /**
17886 * Restrict the fields of the returned AV.Objects to include only the
17887 * provided keys. If this is called multiple times, then all of the keys
17888 * specified in each of the calls will be included.
17889 * @param {String[]} keys The names of the keys to include.
17890 * @return {AV.Query} Returns the query, so you can chain this call.
17891 */
17892 select: function select(keys) {
17893 var _this5 = this;
17894
17895 requires(keys, 'undefined is not a valid key');
17896 _.forEach(arguments, function (keys) {
17897 _this5._select = _this5._select.concat(ensureArray(keys));
17898 });
17899 return this;
17900 },
17901
17902 /**
17903 * Iterates over each result of a query, calling a callback for each one. If
17904 * the callback returns a promise, the iteration will not continue until
17905 * that promise has been fulfilled. If the callback returns a rejected
17906 * promise, then iteration will stop with that error. The items are
17907 * processed in an unspecified order. The query may not have any sort order,
17908 * and may not use limit or skip.
17909 * @param callback {Function} Callback that will be called with each result
17910 * of the query.
17911 * @return {Promise} A promise that will be fulfilled once the
17912 * iteration has completed.
17913 */
17914 each: function each(callback) {
17915 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17916
17917 if (this._order || this._skip || this._limit >= 0) {
17918 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
17919 return _promise2.default.reject(error);
17920 }
17921
17922 var query = new AV.Query(this.objectClass);
17923 // We can override the batch size from the options.
17924 // This is undocumented, but useful for testing.
17925 query._limit = options.batchSize || 100;
17926 query._where = _.clone(this._where);
17927 query._include = _.clone(this._include);
17928
17929 query.ascending('objectId');
17930
17931 var finished = false;
17932 return continueWhile(function () {
17933 return !finished;
17934 }, function () {
17935 return query.find(options).then(function (results) {
17936 var callbacksDone = _promise2.default.resolve();
17937 _.each(results, function (result) {
17938 callbacksDone = callbacksDone.then(function () {
17939 return callback(result);
17940 });
17941 });
17942
17943 return callbacksDone.then(function () {
17944 if (results.length >= query._limit) {
17945 query.greaterThan('objectId', results[results.length - 1].id);
17946 } else {
17947 finished = true;
17948 }
17949 });
17950 });
17951 });
17952 },
17953
17954 /**
17955 * Subscribe the changes of this query.
17956 *
17957 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
17958 *
17959 * @since 3.0.0
17960 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
17961 */
17962 subscribe: function subscribe(options) {
17963 return AV.LiveQuery.init(this, options);
17964 }
17965 });
17966
17967 AV.FriendShipQuery = AV.Query._extend({
17968 _newObject: function _newObject() {
17969 var UserClass = AV.Object._getSubclass('_User');
17970 return new UserClass();
17971 },
17972 _processResult: function _processResult(json) {
17973 if (json && json[this._friendshipTag]) {
17974 var user = json[this._friendshipTag];
17975 if (user.__type === 'Pointer' && user.className === '_User') {
17976 delete user.__type;
17977 delete user.className;
17978 }
17979 return user;
17980 } else {
17981 return null;
17982 }
17983 }
17984 });
17985};
17986
17987/***/ }),
17988/* 332 */
17989/***/ (function(module, exports, __webpack_require__) {
17990
17991"use strict";
17992
17993
17994var _promise = __webpack_require__(3);
17995
17996var _promise2 = _interopRequireDefault(_promise);
17997
17998function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17999
18000var _ = __webpack_require__(0);
18001var EventEmitter = __webpack_require__(167);
18002
18003var _require = __webpack_require__(17),
18004 inherits = _require.inherits;
18005
18006var _require2 = __webpack_require__(14),
18007 request = _require2.request;
18008
18009var subscribe = function subscribe(queryJSON, subscriptionId) {
18010 return request({
18011 method: 'POST',
18012 path: '/LiveQuery/subscribe',
18013 data: {
18014 query: queryJSON,
18015 id: subscriptionId
18016 }
18017 });
18018};
18019
18020module.exports = function (AV) {
18021 var requireRealtime = function requireRealtime() {
18022 if (!AV._config.realtime) {
18023 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
18024 }
18025 };
18026 /**
18027 * @class
18028 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
18029 * @since 3.0.0
18030 */
18031 AV.LiveQuery = inherits(EventEmitter,
18032 /** @lends AV.LiveQuery.prototype */{
18033 constructor: function constructor(id, client, queryJSON, subscriptionId) {
18034 var _this = this;
18035
18036 EventEmitter.apply(this);
18037 this.id = id;
18038 this._client = client;
18039 this._client.register(this);
18040 this._queryJSON = queryJSON;
18041 this._subscriptionId = subscriptionId;
18042 this._onMessage = this._dispatch.bind(this);
18043 this._onReconnect = function () {
18044 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
18045 return console.error('LiveQuery resubscribe error: ' + error.message);
18046 });
18047 };
18048 client.on('message', this._onMessage);
18049 client.on('reconnect', this._onReconnect);
18050 },
18051 _dispatch: function _dispatch(message) {
18052 var _this2 = this;
18053
18054 message.forEach(function (_ref) {
18055 var op = _ref.op,
18056 object = _ref.object,
18057 queryId = _ref.query_id,
18058 updatedKeys = _ref.updatedKeys;
18059
18060 if (queryId !== _this2.id) return;
18061 var target = AV.parseJSON(_.extend({
18062 __type: object.className === '_File' ? 'File' : 'Object'
18063 }, object));
18064 if (updatedKeys) {
18065 /**
18066 * An existing AV.Object which fulfills the Query you subscribe is updated.
18067 * @event AV.LiveQuery#update
18068 * @param {AV.Object|AV.File} target updated object
18069 * @param {String[]} updatedKeys updated keys
18070 */
18071 /**
18072 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
18073 * @event AV.LiveQuery#enter
18074 * @param {AV.Object|AV.File} target updated object
18075 * @param {String[]} updatedKeys updated keys
18076 */
18077 /**
18078 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
18079 * @event AV.LiveQuery#leave
18080 * @param {AV.Object|AV.File} target updated object
18081 * @param {String[]} updatedKeys updated keys
18082 */
18083 _this2.emit(op, target, updatedKeys);
18084 } else {
18085 /**
18086 * A new AV.Object which fulfills the Query you subscribe is created.
18087 * @event AV.LiveQuery#create
18088 * @param {AV.Object|AV.File} target updated object
18089 */
18090 /**
18091 * An existing AV.Object which fulfills the Query you subscribe is deleted.
18092 * @event AV.LiveQuery#delete
18093 * @param {AV.Object|AV.File} target updated object
18094 */
18095 _this2.emit(op, target);
18096 }
18097 });
18098 },
18099
18100 /**
18101 * unsubscribe the query
18102 *
18103 * @return {Promise}
18104 */
18105 unsubscribe: function unsubscribe() {
18106 var client = this._client;
18107 client.off('message', this._onMessage);
18108 client.off('reconnect', this._onReconnect);
18109 client.deregister(this);
18110 return request({
18111 method: 'POST',
18112 path: '/LiveQuery/unsubscribe',
18113 data: {
18114 id: client.id,
18115 query_id: this.id
18116 }
18117 });
18118 }
18119 },
18120 /** @lends AV.LiveQuery */
18121 {
18122 init: function init(query) {
18123 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
18124 _ref2$subscriptionId = _ref2.subscriptionId,
18125 userDefinedSubscriptionId = _ref2$subscriptionId === undefined ? AV._getSubscriptionId() : _ref2$subscriptionId;
18126
18127 requireRealtime();
18128 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
18129 return _promise2.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
18130 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
18131 var _query$_getParams = query._getParams(),
18132 where = _query$_getParams.where,
18133 keys = _query$_getParams.keys,
18134 returnACL = _query$_getParams.returnACL;
18135
18136 var queryJSON = {
18137 where: where,
18138 keys: keys,
18139 returnACL: returnACL,
18140 className: query.className
18141 };
18142 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
18143 var queryId = _ref3.query_id;
18144 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
18145 }).finally(function () {
18146 liveQueryClient.deregister(promise);
18147 });
18148 liveQueryClient.register(promise);
18149 return promise;
18150 });
18151 });
18152 },
18153
18154 /**
18155 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
18156 * @static
18157 * @return void
18158 */
18159 pause: function pause() {
18160 requireRealtime();
18161 return AV._config.realtime.pause();
18162 },
18163
18164 /**
18165 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
18166 * @static
18167 * @return void
18168 */
18169 resume: function resume() {
18170 requireRealtime();
18171 return AV._config.realtime.resume();
18172 }
18173 });
18174};
18175
18176/***/ }),
18177/* 333 */
18178/***/ (function(module, exports, __webpack_require__) {
18179
18180"use strict";
18181
18182
18183var _ = __webpack_require__(0);
18184
18185var _require = __webpack_require__(17),
18186 tap = _require.tap;
18187
18188module.exports = function (AV) {
18189 /**
18190 * @class
18191 * @example
18192 * AV.Captcha.request().then(captcha => {
18193 * captcha.bind({
18194 * textInput: 'code', // the id for textInput
18195 * image: 'captcha',
18196 * verifyButton: 'verify',
18197 * }, {
18198 * success: (validateCode) => {}, // next step
18199 * error: (error) => {}, // present error.message to user
18200 * });
18201 * });
18202 */
18203 AV.Captcha = function Captcha(options, authOptions) {
18204 this._options = options;
18205 this._authOptions = authOptions;
18206 /**
18207 * The image url of the captcha
18208 * @type string
18209 */
18210 this.url = undefined;
18211 /**
18212 * The captchaToken of the captcha.
18213 * @type string
18214 */
18215 this.captchaToken = undefined;
18216 /**
18217 * The validateToken of the captcha.
18218 * @type string
18219 */
18220 this.validateToken = undefined;
18221 };
18222
18223 /**
18224 * Refresh the captcha
18225 * @return {Promise.<string>} a new capcha url
18226 */
18227 AV.Captcha.prototype.refresh = function refresh() {
18228 var _this = this;
18229
18230 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
18231 var captchaToken = _ref.captchaToken,
18232 url = _ref.url;
18233
18234 _.extend(_this, { captchaToken: captchaToken, url: url });
18235 return url;
18236 });
18237 };
18238
18239 /**
18240 * Verify the captcha
18241 * @param {String} code The code from user input
18242 * @return {Promise.<string>} validateToken if the code is valid
18243 */
18244 AV.Captcha.prototype.verify = function verify(code) {
18245 var _this2 = this;
18246
18247 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
18248 return _this2.validateToken = validateToken;
18249 }));
18250 };
18251
18252 if (false) {
18253 /**
18254 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
18255 * @param [elements]
18256 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
18257 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
18258 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
18259 * @param [callbacks]
18260 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
18261 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
18262 */
18263 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
18264 var _this3 = this;
18265
18266 var textInput = _ref2.textInput,
18267 image = _ref2.image,
18268 verifyButton = _ref2.verifyButton;
18269 var success = _ref3.success,
18270 error = _ref3.error;
18271
18272 if (typeof textInput === 'string') {
18273 textInput = document.getElementById(textInput);
18274 if (!textInput) throw new Error('textInput with id ' + textInput + ' not found');
18275 }
18276 if (typeof image === 'string') {
18277 image = document.getElementById(image);
18278 if (!image) throw new Error('image with id ' + image + ' not found');
18279 }
18280 if (typeof verifyButton === 'string') {
18281 verifyButton = document.getElementById(verifyButton);
18282 if (!verifyButton) throw new Error('verifyButton with id ' + verifyButton + ' not found');
18283 }
18284
18285 this.__refresh = function () {
18286 return _this3.refresh().then(function (url) {
18287 image.src = url;
18288 if (textInput) {
18289 textInput.value = '';
18290 textInput.focus();
18291 }
18292 }).catch(function (err) {
18293 return console.warn('refresh captcha fail: ' + err.message);
18294 });
18295 };
18296 if (image) {
18297 this.__image = image;
18298 image.src = this.url;
18299 image.addEventListener('click', this.__refresh);
18300 }
18301
18302 this.__verify = function () {
18303 var code = textInput.value;
18304 _this3.verify(code).catch(function (err) {
18305 _this3.__refresh();
18306 throw err;
18307 }).then(success, error).catch(function (err) {
18308 return console.warn('verify captcha fail: ' + err.message);
18309 });
18310 };
18311 if (textInput && verifyButton) {
18312 this.__verifyButton = verifyButton;
18313 verifyButton.addEventListener('click', this.__verify);
18314 }
18315 };
18316
18317 /**
18318 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
18319 */
18320 AV.Captcha.prototype.unbind = function unbind() {
18321 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
18322 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
18323 };
18324 }
18325
18326 /**
18327 * Request a captcha
18328 * @param [options]
18329 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
18330 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
18331 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
18332 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
18333 * @return {Promise.<AV.Captcha>}
18334 */
18335 AV.Captcha.request = function (options, authOptions) {
18336 var captcha = new AV.Captcha(options, authOptions);
18337 return captcha.refresh().then(function () {
18338 return captcha;
18339 });
18340 };
18341};
18342
18343/***/ }),
18344/* 334 */
18345/***/ (function(module, exports, __webpack_require__) {
18346
18347"use strict";
18348
18349
18350var _promise = __webpack_require__(3);
18351
18352var _promise2 = _interopRequireDefault(_promise);
18353
18354function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18355
18356var _ = __webpack_require__(0);
18357
18358var _require = __webpack_require__(14),
18359 _request = _require._request,
18360 request = _require.request;
18361
18362module.exports = function (AV) {
18363 /**
18364 * Contains functions for calling and declaring
18365 * <p><strong><em>
18366 * Some functions are only available from Cloud Code.
18367 * </em></strong></p>
18368 *
18369 * @namespace
18370 * @borrows AV.Captcha.request as requestCaptcha
18371 */
18372 AV.Cloud = AV.Cloud || {};
18373
18374 _.extend(AV.Cloud,
18375 /** @lends AV.Cloud */{
18376 /**
18377 * Makes a call to a cloud function.
18378 * @param {String} name The function name.
18379 * @param {Object} [data] The parameters to send to the cloud function.
18380 * @param {AuthOptions} [options]
18381 * @return {Promise} A promise that will be resolved with the result
18382 * of the function.
18383 */
18384 run: function run(name, data, options) {
18385 return request({
18386 service: 'engine',
18387 method: 'POST',
18388 path: '/functions/' + name,
18389 data: AV._encode(data, null, true),
18390 authOptions: options
18391 }).then(function (resp) {
18392 return AV._decode(resp).result;
18393 });
18394 },
18395
18396
18397 /**
18398 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
18399 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
18400 * @param {String} name The function name.
18401 * @param {Object} [data] The parameters to send to the cloud function.
18402 * @param {AuthOptions} [options]
18403 * @return {Promise} A promise that will be resolved with the result of the function.
18404 */
18405 rpc: function rpc(name, data, options) {
18406 if (_.isArray(data)) {
18407 return _promise2.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
18408 }
18409
18410 return request({
18411 service: 'engine',
18412 method: 'POST',
18413 path: '/call/' + name,
18414 data: AV._encodeObjectOrArray(data),
18415 authOptions: options
18416 }).then(function (resp) {
18417 return AV._decode(resp).result;
18418 });
18419 },
18420
18421
18422 /**
18423 * Make a call to request server date time.
18424 * @return {Promise.<Date>} A promise that will be resolved with the result
18425 * of the function.
18426 * @since 0.5.9
18427 */
18428 getServerDate: function getServerDate() {
18429 return _request('date', null, null, 'GET').then(function (resp) {
18430 return AV._decode(resp);
18431 });
18432 },
18433
18434
18435 /**
18436 * Makes a call to request an sms code for operation verification.
18437 * @param {String|Object} data The mobile phone number string or a JSON
18438 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
18439 * @param {String} data.mobilePhoneNumber
18440 * @param {String} [data.template] sms template name
18441 * @param {String} [data.sign] sms signature name
18442 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
18443 * @param {SMSAuthOptions} [options]
18444 * @return {Promise} A promise that will be resolved if the request succeed
18445 */
18446 requestSmsCode: function requestSmsCode(data) {
18447 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18448
18449 if (_.isString(data)) {
18450 data = { mobilePhoneNumber: data };
18451 }
18452 if (!data.mobilePhoneNumber) {
18453 throw new Error('Missing mobilePhoneNumber.');
18454 }
18455 if (options.validateToken) {
18456 data = _.extend({}, data, {
18457 validate_token: options.validateToken
18458 });
18459 }
18460 return _request('requestSmsCode', null, null, 'POST', data, options);
18461 },
18462
18463
18464 /**
18465 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
18466 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
18467 * @param {phone} phone The mobile phoner number.
18468 * @return {Promise} A promise that will be resolved with the result
18469 * of the function.
18470 */
18471 verifySmsCode: function verifySmsCode(code, phone) {
18472 if (!code) throw new Error('Missing sms code.');
18473 var params = {};
18474 if (_.isString(phone)) {
18475 params['mobilePhoneNumber'] = phone;
18476 }
18477
18478 return _request('verifySmsCode', code, null, 'POST', params);
18479 },
18480 _requestCaptcha: function _requestCaptcha(options, authOptions) {
18481 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
18482 var url = _ref.captcha_url,
18483 captchaToken = _ref.captcha_token;
18484 return {
18485 captchaToken: captchaToken,
18486 url: url
18487 };
18488 });
18489 },
18490
18491
18492 /**
18493 * Request a captcha.
18494 */
18495 requestCaptcha: AV.Captcha.request,
18496
18497 /**
18498 * Verify captcha code. This is the low-level API for captcha.
18499 * Checkout {@link AV.Captcha} for high abstract APIs.
18500 * @param {String} code the code from user input
18501 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
18502 * @return {Promise.<String>} validateToken if the code is valid
18503 */
18504 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
18505 return _request('verifyCaptcha', null, null, 'POST', {
18506 captcha_code: code,
18507 captcha_token: captchaToken
18508 }).then(function (_ref2) {
18509 var validateToken = _ref2.validate_token;
18510 return validateToken;
18511 });
18512 }
18513 });
18514};
18515
18516/***/ }),
18517/* 335 */
18518/***/ (function(module, exports, __webpack_require__) {
18519
18520"use strict";
18521
18522
18523var request = __webpack_require__(14).request;
18524
18525module.exports = function (AV) {
18526 AV.Installation = AV.Object.extend('_Installation');
18527
18528 /**
18529 * @namespace
18530 */
18531 AV.Push = AV.Push || {};
18532
18533 /**
18534 * Sends a push notification.
18535 * @param {Object} data The data of the push notification.
18536 * @param {String[]} [data.channels] An Array of channels to push to.
18537 * @param {Date} [data.push_time] A Date object for when to send the push.
18538 * @param {Date} [data.expiration_time] A Date object for when to expire
18539 * the push.
18540 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
18541 * @param {Number} [data.flow_control] The clients to notify per second
18542 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
18543 * a set of installations to push to.
18544 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
18545 * a set of installations to push to.
18546 * @param {Object} data.data The data to send as part of the push.
18547 More details: https://url.leanapp.cn/pushData
18548 * @param {AuthOptions} [options]
18549 * @return {Promise}
18550 */
18551 AV.Push.send = function (data, options) {
18552 if (data.where) {
18553 data.where = data.where._getParams().where;
18554 }
18555
18556 if (data.where && data.cql) {
18557 throw new Error("Both where and cql can't be set");
18558 }
18559
18560 if (data.push_time) {
18561 data.push_time = data.push_time.toJSON();
18562 }
18563
18564 if (data.expiration_time) {
18565 data.expiration_time = data.expiration_time.toJSON();
18566 }
18567
18568 if (data.expiration_time && data.expiration_interval) {
18569 throw new Error("Both expiration_time and expiration_interval can't be set");
18570 }
18571
18572 return request({
18573 service: 'push',
18574 method: 'POST',
18575 path: '/push',
18576 data: data,
18577 authOptions: options
18578 });
18579 };
18580};
18581
18582/***/ }),
18583/* 336 */
18584/***/ (function(module, exports, __webpack_require__) {
18585
18586"use strict";
18587
18588
18589var _promise = __webpack_require__(3);
18590
18591var _promise2 = _interopRequireDefault(_promise);
18592
18593var _typeof2 = __webpack_require__(54);
18594
18595var _typeof3 = _interopRequireDefault(_typeof2);
18596
18597function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18598
18599var _ = __webpack_require__(0);
18600var AVRequest = __webpack_require__(14)._request;
18601
18602var _require = __webpack_require__(17),
18603 getSessionToken = _require.getSessionToken;
18604
18605module.exports = function (AV) {
18606 var getUser = function getUser() {
18607 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18608
18609 var sessionToken = getSessionToken(options);
18610 if (sessionToken) {
18611 return AV.User._fetchUserBySessionToken(getSessionToken(options));
18612 }
18613 return AV.User.currentAsync();
18614 };
18615
18616 var getUserPointer = function getUserPointer(options) {
18617 return getUser(options).then(function (currUser) {
18618 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
18619 });
18620 };
18621
18622 /**
18623 * Contains functions to deal with Status in LeanCloud.
18624 * @class
18625 */
18626 AV.Status = function (imageUrl, message) {
18627 this.data = {};
18628 this.inboxType = 'default';
18629 this.query = null;
18630 if (imageUrl && (typeof imageUrl === 'undefined' ? 'undefined' : (0, _typeof3.default)(imageUrl)) === 'object') {
18631 this.data = imageUrl;
18632 } else {
18633 if (imageUrl) {
18634 this.data.image = imageUrl;
18635 }
18636 if (message) {
18637 this.data.message = message;
18638 }
18639 }
18640 return this;
18641 };
18642
18643 _.extend(AV.Status.prototype,
18644 /** @lends AV.Status.prototype */{
18645 /**
18646 * Gets the value of an attribute in status data.
18647 * @param {String} attr The string name of an attribute.
18648 */
18649 get: function get(attr) {
18650 return this.data[attr];
18651 },
18652 /**
18653 * Sets a hash of model attributes on the status data.
18654 * @param {String} key The key to set.
18655 * @param {} value The value to give it.
18656 */
18657 set: function set(key, value) {
18658 this.data[key] = value;
18659 return this;
18660 },
18661 /**
18662 * Destroy this status,then it will not be avaiable in other user's inboxes.
18663 * @param {AuthOptions} options
18664 * @return {Promise} A promise that is fulfilled when the destroy
18665 * completes.
18666 */
18667 destroy: function destroy(options) {
18668 if (!this.id) return _promise2.default.reject(new Error('The status id is not exists.'));
18669 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
18670 return request;
18671 },
18672 /**
18673 * Cast the AV.Status object to an AV.Object pointer.
18674 * @return {AV.Object} A AV.Object pointer.
18675 */
18676 toObject: function toObject() {
18677 if (!this.id) return null;
18678 return AV.Object.createWithoutData('_Status', this.id);
18679 },
18680 _getDataJSON: function _getDataJSON() {
18681 var json = _.clone(this.data);
18682 return AV._encode(json);
18683 },
18684 /**
18685 * Send a status by a AV.Query object.
18686 * @since 0.3.0
18687 * @param {AuthOptions} options
18688 * @return {Promise} A promise that is fulfilled when the send
18689 * completes.
18690 * @example
18691 * // send a status to male users
18692 * var status = new AVStatus('image url', 'a message');
18693 * status.query = new AV.Query('_User');
18694 * status.query.equalTo('gender', 'male');
18695 * status.send().then(function(){
18696 * //send status successfully.
18697 * }, function(err){
18698 * //an error threw.
18699 * console.dir(err);
18700 * });
18701 */
18702 send: function send() {
18703 var _this = this;
18704
18705 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18706
18707 if (!getSessionToken(options) && !AV.User.current()) {
18708 throw new Error('Please signin an user.');
18709 }
18710 if (!this.query) {
18711 return AV.Status.sendStatusToFollowers(this, options);
18712 }
18713
18714 return getUserPointer(options).then(function (currUser) {
18715 var query = _this.query._getParams();
18716 query.className = _this.query.className;
18717 var data = {};
18718 data.query = query;
18719 _this.data = _this.data || {};
18720 _this.data.source = _this.data.source || currUser;
18721 data.data = _this._getDataJSON();
18722 data.inboxType = _this.inboxType || 'default';
18723
18724 return AVRequest('statuses', null, null, 'POST', data, options);
18725 }).then(function (response) {
18726 _this.id = response.objectId;
18727 _this.createdAt = AV._parseDate(response.createdAt);
18728 return _this;
18729 });
18730 },
18731
18732 _finishFetch: function _finishFetch(serverData) {
18733 this.id = serverData.objectId;
18734 this.createdAt = AV._parseDate(serverData.createdAt);
18735 this.updatedAt = AV._parseDate(serverData.updatedAt);
18736 this.messageId = serverData.messageId;
18737 delete serverData.messageId;
18738 delete serverData.objectId;
18739 delete serverData.createdAt;
18740 delete serverData.updatedAt;
18741 this.data = AV._decode(serverData);
18742 }
18743 });
18744
18745 /**
18746 * Send a status to current signined user's followers.
18747 * @since 0.3.0
18748 * @param {AV.Status} status A status object to be send to followers.
18749 * @param {AuthOptions} options
18750 * @return {Promise} A promise that is fulfilled when the send
18751 * completes.
18752 * @example
18753 * var status = new AVStatus('image url', 'a message');
18754 * AV.Status.sendStatusToFollowers(status).then(function(){
18755 * //send status successfully.
18756 * }, function(err){
18757 * //an error threw.
18758 * console.dir(err);
18759 * });
18760 */
18761 AV.Status.sendStatusToFollowers = function (status) {
18762 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18763
18764 if (!getSessionToken(options) && !AV.User.current()) {
18765 throw new Error('Please signin an user.');
18766 }
18767 return getUserPointer(options).then(function (currUser) {
18768 var query = {};
18769 query.className = '_Follower';
18770 query.keys = 'follower';
18771 query.where = { user: currUser };
18772 var data = {};
18773 data.query = query;
18774 status.data = status.data || {};
18775 status.data.source = status.data.source || currUser;
18776 data.data = status._getDataJSON();
18777 data.inboxType = status.inboxType || 'default';
18778
18779 var request = AVRequest('statuses', null, null, 'POST', data, options);
18780 return request.then(function (response) {
18781 status.id = response.objectId;
18782 status.createdAt = AV._parseDate(response.createdAt);
18783 return status;
18784 });
18785 });
18786 };
18787
18788 /**
18789 * <p>Send a status from current signined user to other user's private status inbox.</p>
18790 * @since 0.3.0
18791 * @param {AV.Status} status A status object to be send to followers.
18792 * @param {String} target The target user or user's objectId.
18793 * @param {AuthOptions} options
18794 * @return {Promise} A promise that is fulfilled when the send
18795 * completes.
18796 * @example
18797 * // send a private status to user '52e84e47e4b0f8de283b079b'
18798 * var status = new AVStatus('image url', 'a message');
18799 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
18800 * //send status successfully.
18801 * }, function(err){
18802 * //an error threw.
18803 * console.dir(err);
18804 * });
18805 */
18806 AV.Status.sendPrivateStatus = function (status, target) {
18807 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18808
18809 if (!getSessionToken(options) && !AV.User.current()) {
18810 throw new Error('Please signin an user.');
18811 }
18812 if (!target) {
18813 throw new Error('Invalid target user.');
18814 }
18815 var userObjectId = _.isString(target) ? target : target.id;
18816 if (!userObjectId) {
18817 throw new Error('Invalid target user.');
18818 }
18819 return getUserPointer(options).then(function (currUser) {
18820 var query = {};
18821 query.className = '_User';
18822 query.where = { objectId: userObjectId };
18823 var data = {};
18824 data.query = query;
18825 status.data = status.data || {};
18826 status.data.source = status.data.source || currUser;
18827 data.data = status._getDataJSON();
18828 data.inboxType = 'private';
18829 status.inboxType = 'private';
18830
18831 var request = AVRequest('statuses', null, null, 'POST', data, options);
18832 return request.then(function (response) {
18833 status.id = response.objectId;
18834 status.createdAt = AV._parseDate(response.createdAt);
18835 return status;
18836 });
18837 });
18838 };
18839
18840 /**
18841 * Count unread statuses in someone's inbox.
18842 * @since 0.3.0
18843 * @param {AV.User} owner The status owner.
18844 * @param {String} inboxType The inbox type, 'default' by default.
18845 * @param {AuthOptions} options
18846 * @return {Promise} A promise that is fulfilled when the count
18847 * completes.
18848 * @example
18849 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
18850 * console.log(response.unread); //unread statuses number.
18851 * console.log(response.total); //total statuses number.
18852 * });
18853 */
18854 AV.Status.countUnreadStatuses = function (owner) {
18855 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
18856 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18857
18858 if (!_.isString(inboxType)) options = inboxType;
18859 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
18860 throw new Error('Please signin an user or pass the owner objectId.');
18861 }
18862 return _promise2.default.resolve(owner || getUser(options)).then(function (owner) {
18863 var params = {};
18864 params.inboxType = AV._encode(inboxType);
18865 params.owner = AV._encode(owner);
18866 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
18867 });
18868 };
18869
18870 /**
18871 * reset unread statuses count in someone's inbox.
18872 * @since 2.1.0
18873 * @param {AV.User} owner The status owner.
18874 * @param {String} inboxType The inbox type, 'default' by default.
18875 * @param {AuthOptions} options
18876 * @return {Promise} A promise that is fulfilled when the reset
18877 * completes.
18878 * @example
18879 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
18880 * console.log(response.unread); //unread statuses number.
18881 * console.log(response.total); //total statuses number.
18882 * });
18883 */
18884 AV.Status.resetUnreadCount = function (owner) {
18885 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
18886 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18887
18888 if (!_.isString(inboxType)) options = inboxType;
18889 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
18890 throw new Error('Please signin an user or pass the owner objectId.');
18891 }
18892 return _promise2.default.resolve(owner || getUser(options)).then(function (owner) {
18893 var params = {};
18894 params.inboxType = AV._encode(inboxType);
18895 params.owner = AV._encode(owner);
18896 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
18897 });
18898 };
18899
18900 /**
18901 * Create a status query to find someone's published statuses.
18902 * @since 0.3.0
18903 * @param {AV.User} source The status source, typically the publisher.
18904 * @return {AV.Query} The query object for status.
18905 * @example
18906 * //Find current user's published statuses.
18907 * var query = AV.Status.statusQuery(AV.User.current());
18908 * query.find().then(function(statuses){
18909 * //process statuses
18910 * });
18911 */
18912 AV.Status.statusQuery = function (source) {
18913 var query = new AV.Query('_Status');
18914 if (source) {
18915 query.equalTo('source', source);
18916 }
18917 return query;
18918 };
18919
18920 /**
18921 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
18922 * @class
18923 */
18924 AV.InboxQuery = AV.Query._extend(
18925 /** @lends AV.InboxQuery.prototype */{
18926 _objectClass: AV.Status,
18927 _sinceId: 0,
18928 _maxId: 0,
18929 _inboxType: 'default',
18930 _owner: null,
18931 _newObject: function _newObject() {
18932 return new AV.Status();
18933 },
18934 _createRequest: function _createRequest(params, options) {
18935 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
18936 },
18937
18938 /**
18939 * Sets the messageId of results to skip before returning any results.
18940 * This is useful for pagination.
18941 * Default is zero.
18942 * @param {Number} n the mesage id.
18943 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18944 */
18945 sinceId: function sinceId(id) {
18946 this._sinceId = id;
18947 return this;
18948 },
18949 /**
18950 * Sets the maximal messageId of results。
18951 * This is useful for pagination.
18952 * Default is zero that is no limition.
18953 * @param {Number} n the mesage id.
18954 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18955 */
18956 maxId: function maxId(id) {
18957 this._maxId = id;
18958 return this;
18959 },
18960 /**
18961 * Sets the owner of the querying inbox.
18962 * @param {AV.User} owner The inbox owner.
18963 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18964 */
18965 owner: function owner(_owner) {
18966 this._owner = _owner;
18967 return this;
18968 },
18969 /**
18970 * Sets the querying inbox type.default is 'default'.
18971 * @param {Object} type The inbox type.
18972 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18973 */
18974 inboxType: function inboxType(type) {
18975 this._inboxType = type;
18976 return this;
18977 },
18978 _getParams: function _getParams() {
18979 var params = AV.InboxQuery.__super__._getParams.call(this);
18980 params.owner = AV._encode(this._owner);
18981 params.inboxType = AV._encode(this._inboxType);
18982 params.sinceId = AV._encode(this._sinceId);
18983 params.maxId = AV._encode(this._maxId);
18984 return params;
18985 }
18986 });
18987
18988 /**
18989 * Create a inbox status query to find someone's inbox statuses.
18990 * @since 0.3.0
18991 * @param {AV.User} owner The inbox's owner
18992 * @param {String} inboxType The inbox type,'default' by default.
18993 * @return {AV.InboxQuery} The inbox query object.
18994 * @see AV.InboxQuery
18995 * @example
18996 * //Find current user's default inbox statuses.
18997 * var query = AV.Status.inboxQuery(AV.User.current());
18998 * //find the statuses after the last message id
18999 * query.sinceId(lastMessageId);
19000 * query.find().then(function(statuses){
19001 * //process statuses
19002 * });
19003 */
19004 AV.Status.inboxQuery = function (owner, inboxType) {
19005 var query = new AV.InboxQuery(AV.Status);
19006 if (owner) {
19007 query._owner = owner;
19008 }
19009 if (inboxType) {
19010 query._inboxType = inboxType;
19011 }
19012 return query;
19013 };
19014};
19015
19016/***/ }),
19017/* 337 */
19018/***/ (function(module, exports, __webpack_require__) {
19019
19020"use strict";
19021
19022
19023var _stringify = __webpack_require__(21);
19024
19025var _stringify2 = _interopRequireDefault(_stringify);
19026
19027function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19028
19029var _ = __webpack_require__(0);
19030var AVRequest = __webpack_require__(14)._request;
19031
19032module.exports = function (AV) {
19033 /**
19034 * A builder to generate sort string for app searching.For example:
19035 * @class
19036 * @since 0.5.1
19037 * @example
19038 * var builder = new AV.SearchSortBuilder();
19039 * builder.ascending('key1').descending('key2','max');
19040 * var query = new AV.SearchQuery('Player');
19041 * query.sortBy(builder);
19042 * query.find().then();
19043 */
19044 AV.SearchSortBuilder = function () {
19045 this._sortFields = [];
19046 };
19047
19048 _.extend(AV.SearchSortBuilder.prototype,
19049 /** @lends AV.SearchSortBuilder.prototype */{
19050 _addField: function _addField(key, order, mode, missing) {
19051 var field = {};
19052 field[key] = {
19053 order: order || 'asc',
19054 mode: mode || 'avg',
19055 missing: '_' + (missing || 'last')
19056 };
19057 this._sortFields.push(field);
19058 return this;
19059 },
19060
19061 /**
19062 * Sorts the results in ascending order by the given key and options.
19063 *
19064 * @param {String} key The key to order by.
19065 * @param {String} mode The sort mode, default is 'avg', you can choose
19066 * 'max' or 'min' too.
19067 * @param {String} missing The missing key behaviour, default is 'last',
19068 * you can choose 'first' too.
19069 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
19070 */
19071 ascending: function ascending(key, mode, missing) {
19072 return this._addField(key, 'asc', mode, missing);
19073 },
19074
19075 /**
19076 * Sorts the results in descending order by the given key and options.
19077 *
19078 * @param {String} key The key to order by.
19079 * @param {String} mode The sort mode, default is 'avg', you can choose
19080 * 'max' or 'min' too.
19081 * @param {String} missing The missing key behaviour, default is 'last',
19082 * you can choose 'first' too.
19083 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
19084 */
19085 descending: function descending(key, mode, missing) {
19086 return this._addField(key, 'desc', mode, missing);
19087 },
19088
19089 /**
19090 * Add a proximity based constraint for finding objects with key point
19091 * values near the point given.
19092 * @param {String} key The key that the AV.GeoPoint is stored in.
19093 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
19094 * @param {Object} options The other options such as mode,order, unit etc.
19095 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
19096 */
19097 whereNear: function whereNear(key, point, options) {
19098 options = options || {};
19099 var field = {};
19100 var geo = {
19101 lat: point.latitude,
19102 lon: point.longitude
19103 };
19104 var m = {
19105 order: options.order || 'asc',
19106 mode: options.mode || 'avg',
19107 unit: options.unit || 'km'
19108 };
19109 m[key] = geo;
19110 field['_geo_distance'] = m;
19111
19112 this._sortFields.push(field);
19113 return this;
19114 },
19115
19116 /**
19117 * Build a sort string by configuration.
19118 * @return {String} the sort string.
19119 */
19120 build: function build() {
19121 return (0, _stringify2.default)(AV._encode(this._sortFields));
19122 }
19123 });
19124
19125 /**
19126 * App searching query.Use just like AV.Query:
19127 *
19128 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
19129 * for more details.
19130 * @class
19131 * @since 0.5.1
19132 * @example
19133 * var query = new AV.SearchQuery('Player');
19134 * query.queryString('*');
19135 * query.find().then(function(results) {
19136 * console.log('Found %d objects', query.hits());
19137 * //Process results
19138 * });
19139 */
19140 AV.SearchQuery = AV.Query._extend(
19141 /** @lends AV.SearchQuery.prototype */{
19142 _sid: null,
19143 _hits: 0,
19144 _queryString: null,
19145 _highlights: null,
19146 _sortBuilder: null,
19147 _clazz: null,
19148
19149 constructor: function constructor(className) {
19150 if (className) {
19151 this._clazz = className;
19152 } else {
19153 className = '__INVALID_CLASS';
19154 }
19155 AV.Query.call(this, className);
19156 },
19157
19158 _createRequest: function _createRequest(params, options) {
19159 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
19160 },
19161
19162 /**
19163 * Sets the sid of app searching query.Default is null.
19164 * @param {String} sid Scroll id for searching.
19165 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19166 */
19167 sid: function sid(_sid) {
19168 this._sid = _sid;
19169 return this;
19170 },
19171
19172 /**
19173 * Sets the query string of app searching.
19174 * @param {String} q The query string.
19175 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19176 */
19177 queryString: function queryString(q) {
19178 this._queryString = q;
19179 return this;
19180 },
19181
19182 /**
19183 * Sets the highlight fields. Such as
19184 * <pre><code>
19185 * query.highlights('title');
19186 * //or pass an array.
19187 * query.highlights(['title', 'content'])
19188 * </code></pre>
19189 * @param {String|String[]} highlights a list of fields.
19190 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19191 */
19192 highlights: function highlights(_highlights) {
19193 var objects;
19194 if (_highlights && _.isString(_highlights)) {
19195 objects = _.toArray(arguments);
19196 } else {
19197 objects = _highlights;
19198 }
19199 this._highlights = objects;
19200 return this;
19201 },
19202
19203 /**
19204 * Sets the sort builder for this query.
19205 * @see AV.SearchSortBuilder
19206 * @param { AV.SearchSortBuilder} builder The sort builder.
19207 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19208 *
19209 */
19210 sortBy: function sortBy(builder) {
19211 this._sortBuilder = builder;
19212 return this;
19213 },
19214
19215 /**
19216 * Returns the number of objects that match this query.
19217 * @return {Number}
19218 */
19219 hits: function hits() {
19220 if (!this._hits) {
19221 this._hits = 0;
19222 }
19223 return this._hits;
19224 },
19225
19226 _processResult: function _processResult(json) {
19227 delete json['className'];
19228 delete json['_app_url'];
19229 delete json['_deeplink'];
19230 return json;
19231 },
19232
19233 /**
19234 * Returns true when there are more documents can be retrieved by this
19235 * query instance, you can call find function to get more results.
19236 * @see AV.SearchQuery#find
19237 * @return {Boolean}
19238 */
19239 hasMore: function hasMore() {
19240 return !this._hitEnd;
19241 },
19242
19243 /**
19244 * Reset current query instance state(such as sid, hits etc) except params
19245 * for a new searching. After resetting, hasMore() will return true.
19246 */
19247 reset: function reset() {
19248 this._hitEnd = false;
19249 this._sid = null;
19250 this._hits = 0;
19251 },
19252
19253 /**
19254 * Retrieves a list of AVObjects that satisfy this query.
19255 * Either options.success or options.error is called when the find
19256 * completes.
19257 *
19258 * @see AV.Query#find
19259 * @param {AuthOptions} options
19260 * @return {Promise} A promise that is resolved with the results when
19261 * the query completes.
19262 */
19263 find: function find(options) {
19264 var self = this;
19265
19266 var request = this._createRequest(undefined, options);
19267
19268 return request.then(function (response) {
19269 //update sid for next querying.
19270 if (response.sid) {
19271 self._oldSid = self._sid;
19272 self._sid = response.sid;
19273 } else {
19274 self._sid = null;
19275 self._hitEnd = true;
19276 }
19277 self._hits = response.hits || 0;
19278
19279 return _.map(response.results, function (json) {
19280 if (json.className) {
19281 response.className = json.className;
19282 }
19283 var obj = self._newObject(response);
19284 obj.appURL = json['_app_url'];
19285 obj._finishFetch(self._processResult(json), true);
19286 return obj;
19287 });
19288 });
19289 },
19290
19291 _getParams: function _getParams() {
19292 var params = AV.SearchQuery.__super__._getParams.call(this);
19293 delete params.where;
19294 if (this._clazz) {
19295 params.clazz = this.className;
19296 }
19297 if (this._sid) {
19298 params.sid = this._sid;
19299 }
19300 if (!this._queryString) {
19301 throw new Error('Please set query string.');
19302 } else {
19303 params.q = this._queryString;
19304 }
19305 if (this._highlights) {
19306 params.highlights = this._highlights.join(',');
19307 }
19308 if (this._sortBuilder && params.order) {
19309 throw new Error('sort and order can not be set at same time.');
19310 }
19311 if (this._sortBuilder) {
19312 params.sort = this._sortBuilder.build();
19313 }
19314
19315 return params;
19316 }
19317 });
19318};
19319
19320/**
19321 * Sorts the results in ascending order by the given key.
19322 *
19323 * @method AV.SearchQuery#ascending
19324 * @param {String} key The key to order by.
19325 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19326 */
19327/**
19328 * Also sorts the results in ascending order by the given key. The previous sort keys have
19329 * precedence over this key.
19330 *
19331 * @method AV.SearchQuery#addAscending
19332 * @param {String} key The key to order by
19333 * @return {AV.SearchQuery} Returns the query so you can chain this call.
19334 */
19335/**
19336 * Sorts the results in descending order by the given key.
19337 *
19338 * @method AV.SearchQuery#descending
19339 * @param {String} key The key to order by.
19340 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19341 */
19342/**
19343 * Also sorts the results in descending order by the given key. The previous sort keys have
19344 * precedence over this key.
19345 *
19346 * @method AV.SearchQuery#addDescending
19347 * @param {String} key The key to order by
19348 * @return {AV.SearchQuery} Returns the query so you can chain this call.
19349 */
19350/**
19351 * Include nested AV.Objects for the provided key. You can use dot
19352 * notation to specify which fields in the included object are also fetch.
19353 * @method AV.SearchQuery#include
19354 * @param {String[]} keys The name of the key to include.
19355 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19356 */
19357/**
19358 * Sets the number of results to skip before returning any results.
19359 * This is useful for pagination.
19360 * Default is to skip zero results.
19361 * @method AV.SearchQuery#skip
19362 * @param {Number} n the number of results to skip.
19363 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19364 */
19365/**
19366 * Sets the limit of the number of results to return. The default limit is
19367 * 100, with a maximum of 1000 results being returned at a time.
19368 * @method AV.SearchQuery#limit
19369 * @param {Number} n the number of results to limit to.
19370 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19371 */
19372
19373/***/ }),
19374/* 338 */
19375/***/ (function(module, exports, __webpack_require__) {
19376
19377"use strict";
19378
19379
19380var _promise = __webpack_require__(3);
19381
19382var _promise2 = _interopRequireDefault(_promise);
19383
19384function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19385
19386var _ = __webpack_require__(0);
19387var AVError = __webpack_require__(31);
19388
19389var _require = __webpack_require__(14),
19390 request = _require.request;
19391
19392module.exports = function (AV) {
19393 /**
19394 * 包含了使用了 LeanCloud
19395 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
19396 * <p><strong><em>
19397 * 仅在云引擎运行环境下有效。
19398 * </em></strong></p>
19399 * @namespace
19400 */
19401 AV.Insight = AV.Insight || {};
19402
19403 _.extend(AV.Insight,
19404 /** @lends AV.Insight */{
19405 /**
19406 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
19407 * AV.Insight.JobQuery 查询任务状态和结果。
19408 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
19409 * { "sql" : "select count(*) as c,gender from _User group by gender",
19410 * "saveAs": {
19411 * "className" : "UserGender",
19412 * "limit": 1
19413 * }
19414 * }
19415 * </pre></code>
19416 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
19417 * @param {AuthOptions} [options]
19418 * @return {Promise} A promise that will be resolved with the result
19419 * of the function.
19420 */
19421 startJob: function startJob(jobConfig, options) {
19422 if (!jobConfig || !jobConfig.sql) {
19423 throw new Error('Please provide the sql to run the job.');
19424 }
19425 var data = {
19426 jobConfig: jobConfig,
19427 appId: AV.applicationId
19428 };
19429 return request({
19430 path: '/bigquery/jobs',
19431 method: 'POST',
19432 data: AV._encode(data, null, true),
19433 authOptions: options,
19434 signKey: false
19435 }).then(function (resp) {
19436 return AV._decode(resp).id;
19437 });
19438 },
19439
19440 /**
19441 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
19442 * <p><strong><em>
19443 * 仅在云引擎运行环境下有效。
19444 * </em></strong></p>
19445 * @param {String} event 监听的事件,目前尚不支持。
19446 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
19447 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
19448 *
19449 */
19450 on: function on(event, cb) {}
19451 });
19452
19453 /**
19454 * 创建一个对象,用于查询 Insight 任务状态和结果。
19455 * @class
19456 * @param {String} id 任务 id
19457 * @since 0.5.5
19458 */
19459 AV.Insight.JobQuery = function (id, className) {
19460 if (!id) {
19461 throw new Error('Please provide the job id.');
19462 }
19463 this.id = id;
19464 this.className = className;
19465 this._skip = 0;
19466 this._limit = 100;
19467 };
19468
19469 _.extend(AV.Insight.JobQuery.prototype,
19470 /** @lends AV.Insight.JobQuery.prototype */{
19471 /**
19472 * Sets the number of results to skip before returning any results.
19473 * This is useful for pagination.
19474 * Default is to skip zero results.
19475 * @param {Number} n the number of results to skip.
19476 * @return {AV.Query} Returns the query, so you can chain this call.
19477 */
19478 skip: function skip(n) {
19479 this._skip = n;
19480 return this;
19481 },
19482
19483 /**
19484 * Sets the limit of the number of results to return. The default limit is
19485 * 100, with a maximum of 1000 results being returned at a time.
19486 * @param {Number} n the number of results to limit to.
19487 * @return {AV.Query} Returns the query, so you can chain this call.
19488 */
19489 limit: function limit(n) {
19490 this._limit = n;
19491 return this;
19492 },
19493
19494 /**
19495 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
19496 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
19497 * startTime、endTime 等信息。
19498 *
19499 * @param {AuthOptions} [options]
19500 * @return {Promise} A promise that will be resolved with the result
19501 * of the function.
19502 *
19503 */
19504 find: function find(options) {
19505 var params = {
19506 skip: this._skip,
19507 limit: this._limit
19508 };
19509
19510 return request({
19511 path: '/bigquery/jobs/' + this.id,
19512 method: 'GET',
19513 query: params,
19514 authOptions: options,
19515 signKey: false
19516 }).then(function (response) {
19517 if (response.error) {
19518 return _promise2.default.reject(new AVError(response.code, response.error));
19519 }
19520 return _promise2.default.resolve(response);
19521 });
19522 }
19523 });
19524};
19525
19526/***/ }),
19527/* 339 */
19528/***/ (function(module, exports, __webpack_require__) {
19529
19530"use strict";
19531
19532
19533var _ = __webpack_require__(0);
19534
19535var _require = __webpack_require__(14),
19536 LCRequest = _require.request;
19537
19538var _require2 = __webpack_require__(17),
19539 getSessionToken = _require2.getSessionToken;
19540
19541module.exports = function (AV) {
19542 /**
19543 * Contains functions to deal with Friendship in LeanCloud.
19544 * @class
19545 */
19546 AV.Friendship = {
19547 /**
19548 * Request friendship.
19549 * @since 4.8.0
19550 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
19551 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
19552 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
19553 * @param {*} [authOptions]
19554 * @return {Promise<void>}
19555 */
19556 request: function request(options, authOptions) {
19557 if (!AV.User.current()) {
19558 throw new Error('Please signin an user.');
19559 }
19560 var friend = void 0;
19561 var attributes = void 0;
19562 if (options.friend) {
19563 friend = options.friend;
19564 attributes = options.attributes;
19565 } else {
19566 friend = options;
19567 }
19568 var friendObject = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
19569 return LCRequest({
19570 method: 'POST',
19571 path: '/users/friendshipRequests',
19572 data: AV._encode({
19573 user: AV.User.current(),
19574 friend: friendObject,
19575 friendship: attributes
19576 }),
19577 authOptions: authOptions
19578 });
19579 },
19580
19581 /**
19582 * Accept a friendship request.
19583 * @since 4.8.0
19584 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
19585 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
19586 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
19587 * @param {AuthOptions} [authOptions]
19588 * @return {Promise<void>}
19589 */
19590 acceptRequest: function acceptRequest(options) {
19591 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19592
19593 if (!getSessionToken(authOptions) && !AV.User.current()) {
19594 throw new Error('Please signin an user.');
19595 }
19596 var request = void 0;
19597 var attributes = void 0;
19598 if (options.request) {
19599 request = options.request;
19600 attributes = options.attributes;
19601 } else {
19602 request = options;
19603 }
19604 var requestId = _.isString(request) ? request : request.id;
19605 return LCRequest({
19606 method: 'PUT',
19607 path: '/users/friendshipRequests/' + requestId + '/accept',
19608 data: {
19609 friendship: AV._encode(attributes)
19610 },
19611 authOptions: authOptions
19612 });
19613 },
19614
19615 /**
19616 * Decline a friendship request.
19617 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
19618 * @param {AuthOptions} [authOptions]
19619 * @return {Promise<void>}
19620 */
19621 declineRequest: function declineRequest(request) {
19622 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19623
19624 if (!getSessionToken(authOptions) && !AV.User.current()) {
19625 throw new Error('Please signin an user.');
19626 }
19627 var requestId = _.isString(request) ? request : request.id;
19628 return LCRequest({
19629 method: 'PUT',
19630 path: '/users/friendshipRequests/' + requestId + '/decline',
19631 authOptions: authOptions
19632 });
19633 }
19634 };
19635};
19636
19637/***/ }),
19638/* 340 */
19639/***/ (function(module, exports, __webpack_require__) {
19640
19641"use strict";
19642
19643
19644var _stringify = __webpack_require__(21);
19645
19646var _stringify2 = _interopRequireDefault(_stringify);
19647
19648function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19649
19650var _ = __webpack_require__(0);
19651
19652var _require = __webpack_require__(14),
19653 _request = _require._request;
19654
19655var AV = __webpack_require__(39);
19656
19657var serializeMessage = function serializeMessage(message) {
19658 if (typeof message === 'string') {
19659 return message;
19660 }
19661 if (typeof message.getPayload === 'function') {
19662 return (0, _stringify2.default)(message.getPayload());
19663 }
19664 return (0, _stringify2.default)(message);
19665};
19666
19667/**
19668 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
19669 * conversation. This class is a subclass of AV.Object, and retains the
19670 * same functionality of an AV.Object, but also extends it with various
19671 * conversation specific methods, like get members, creators of this conversation.
19672 * </p>
19673 *
19674 * @class AV.Conversation
19675 * @param {String} name The name of the Role to create.
19676 * @param {Object} [options]
19677 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
19678 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
19679 */
19680module.exports = AV.Object.extend('_Conversation',
19681/** @lends AV.Conversation.prototype */{
19682 constructor: function constructor(name) {
19683 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19684
19685 AV.Object.prototype.constructor.call(this, null, null);
19686 this.set('name', name);
19687 if (options.isSystem !== undefined) {
19688 this.set('sys', options.isSystem ? true : false);
19689 }
19690 if (options.isTransient !== undefined) {
19691 this.set('tr', options.isTransient ? true : false);
19692 }
19693 },
19694
19695 /**
19696 * Get current conversation's creator.
19697 *
19698 * @return {String}
19699 */
19700 getCreator: function getCreator() {
19701 return this.get('c');
19702 },
19703
19704
19705 /**
19706 * Get the last message's time.
19707 *
19708 * @return {Date}
19709 */
19710 getLastMessageAt: function getLastMessageAt() {
19711 return this.get('lm');
19712 },
19713
19714
19715 /**
19716 * Get this conversation's members
19717 *
19718 * @return {String[]}
19719 */
19720 getMembers: function getMembers() {
19721 return this.get('m');
19722 },
19723
19724
19725 /**
19726 * Add a member to this conversation
19727 *
19728 * @param {String} member
19729 */
19730 addMember: function addMember(member) {
19731 return this.add('m', member);
19732 },
19733
19734
19735 /**
19736 * Get this conversation's members who set this conversation as muted.
19737 *
19738 * @return {String[]}
19739 */
19740 getMutedMembers: function getMutedMembers() {
19741 return this.get('mu');
19742 },
19743
19744
19745 /**
19746 * Get this conversation's name field.
19747 *
19748 * @return String
19749 */
19750 getName: function getName() {
19751 return this.get('name');
19752 },
19753
19754
19755 /**
19756 * Returns true if this conversation is transient conversation.
19757 *
19758 * @return {Boolean}
19759 */
19760 isTransient: function isTransient() {
19761 return this.get('tr');
19762 },
19763
19764
19765 /**
19766 * Returns true if this conversation is system conversation.
19767 *
19768 * @return {Boolean}
19769 */
19770 isSystem: function isSystem() {
19771 return this.get('sys');
19772 },
19773
19774
19775 /**
19776 * Send realtime message to this conversation, using HTTP request.
19777 *
19778 * @param {String} fromClient Sender's client id.
19779 * @param {String|Object} message The message which will send to conversation.
19780 * It could be a raw string, or an object with a `toJSON` method, like a
19781 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
19782 * @param {Object} [options]
19783 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
19784 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
19785 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
19786 * @param {AuthOptions} [authOptions]
19787 * @return {Promise}
19788 */
19789 send: function send(fromClient, message) {
19790 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19791 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
19792
19793 var data = {
19794 from_peer: fromClient,
19795 conv_id: this.id,
19796 transient: false,
19797 message: serializeMessage(message)
19798 };
19799 if (options.toClients !== undefined) {
19800 data.to_peers = options.toClients;
19801 }
19802 if (options.transient !== undefined) {
19803 data.transient = options.transient ? true : false;
19804 }
19805 if (options.pushData !== undefined) {
19806 data.push_data = options.pushData;
19807 }
19808 return _request('rtm', 'messages', null, 'POST', data, authOptions);
19809 },
19810
19811
19812 /**
19813 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
19814 *
19815 * @param {String} fromClient Sender's client id.
19816 * @param {String|Object} message The message which will send to conversation.
19817 * It could be a raw string, or an object with a `toJSON` method, like a
19818 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
19819 * @param {Object} [options]
19820 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
19821 * @param {Object} [options.validTill] The message will valid till this time.
19822 * @param {AuthOptions} [authOptions]
19823 * @return {Promise}
19824 */
19825 broadcast: function broadcast(fromClient, message) {
19826 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19827 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
19828
19829 var data = {
19830 from_peer: fromClient,
19831 conv_id: this.id,
19832 message: serializeMessage(message)
19833 };
19834 if (options.pushData !== undefined) {
19835 data.push = options.pushData;
19836 }
19837 if (options.validTill !== undefined) {
19838 var ts = options.validTill;
19839 if (_.isDate(ts)) {
19840 ts = ts.getTime();
19841 }
19842 options.valid_till = ts;
19843 }
19844 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
19845 }
19846});
19847
19848/***/ }),
19849/* 341 */
19850/***/ (function(module, exports, __webpack_require__) {
19851
19852"use strict";
19853
19854
19855var _promise = __webpack_require__(3);
19856
19857var _promise2 = _interopRequireDefault(_promise);
19858
19859function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19860
19861var _ = __webpack_require__(0);
19862
19863var _require = __webpack_require__(14),
19864 request = _require.request;
19865
19866var _require2 = __webpack_require__(17),
19867 ensureArray = _require2.ensureArray,
19868 parseDate = _require2.parseDate;
19869
19870var AV = __webpack_require__(39);
19871
19872/**
19873 * The version change interval for Leaderboard
19874 * @enum
19875 */
19876AV.LeaderboardVersionChangeInterval = {
19877 NEVER: 'never',
19878 DAY: 'day',
19879 WEEK: 'week',
19880 MONTH: 'month'
19881};
19882
19883/**
19884 * The order of the leaderboard results
19885 * @enum
19886 */
19887AV.LeaderboardOrder = {
19888 ASCENDING: 'ascending',
19889 DESCENDING: 'descending'
19890};
19891
19892/**
19893 * The update strategy for Leaderboard
19894 * @enum
19895 */
19896AV.LeaderboardUpdateStrategy = {
19897 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
19898 BETTER: 'better',
19899 /** Keep the last updated statistic */
19900 LAST: 'last',
19901 /** Keep the sum of all updated statistics */
19902 SUM: 'sum'
19903};
19904
19905/**
19906 * @typedef {Object} Ranking
19907 * @property {number} rank Starts at 0
19908 * @property {number} value the statistic value of this ranking
19909 * @property {AV.User} user The user of this ranking
19910 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
19911 */
19912
19913/**
19914 * @typedef {Object} LeaderboardArchive
19915 * @property {string} statisticName
19916 * @property {number} version version of the leaderboard
19917 * @property {string} status
19918 * @property {string} url URL for the downloadable archive
19919 * @property {Date} activatedAt time when this version became active
19920 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
19921 */
19922
19923/**
19924 * @class
19925 */
19926function Statistic(_ref) {
19927 var name = _ref.name,
19928 value = _ref.value,
19929 version = _ref.version;
19930
19931 /**
19932 * @type {string}
19933 */
19934 this.name = name;
19935 /**
19936 * @type {number}
19937 */
19938 this.value = value;
19939 /**
19940 * @type {number?}
19941 */
19942 this.version = version;
19943}
19944
19945var parseStatisticData = function parseStatisticData(statisticData) {
19946 var _AV$_decode = AV._decode(statisticData),
19947 name = _AV$_decode.statisticName,
19948 value = _AV$_decode.statisticValue,
19949 version = _AV$_decode.version;
19950
19951 return new Statistic({ name: name, value: value, version: version });
19952};
19953
19954/**
19955 * @class
19956 */
19957AV.Leaderboard = function Leaderboard(statisticName) {
19958 /**
19959 * @type {string}
19960 */
19961 this.statisticName = statisticName;
19962 /**
19963 * @type {AV.LeaderboardOrder}
19964 */
19965 this.order = undefined;
19966 /**
19967 * @type {AV.LeaderboardUpdateStrategy}
19968 */
19969 this.updateStrategy = undefined;
19970 /**
19971 * @type {AV.LeaderboardVersionChangeInterval}
19972 */
19973 this.versionChangeInterval = undefined;
19974 /**
19975 * @type {number}
19976 */
19977 this.version = undefined;
19978 /**
19979 * @type {Date?}
19980 */
19981 this.nextResetAt = undefined;
19982 /**
19983 * @type {Date?}
19984 */
19985 this.createdAt = undefined;
19986};
19987var Leaderboard = AV.Leaderboard;
19988
19989/**
19990 * Create an instance of Leaderboard for the give statistic name.
19991 * @param {string} statisticName
19992 * @return {AV.Leaderboard}
19993 */
19994AV.Leaderboard.createWithoutData = function (statisticName) {
19995 return new Leaderboard(statisticName);
19996};
19997/**
19998 * (masterKey required) Create a new Leaderboard.
19999 * @param {Object} options
20000 * @param {string} options.statisticName
20001 * @param {AV.LeaderboardOrder} options.order
20002 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
20003 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
20004 * @param {AuthOptions} [authOptions]
20005 * @return {Promise<AV.Leaderboard>}
20006 */
20007AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
20008 var statisticName = _ref2.statisticName,
20009 order = _ref2.order,
20010 versionChangeInterval = _ref2.versionChangeInterval,
20011 updateStrategy = _ref2.updateStrategy;
20012 return request({
20013 method: 'POST',
20014 path: '/leaderboard/leaderboards',
20015 data: {
20016 statisticName: statisticName,
20017 order: order,
20018 versionChangeInterval: versionChangeInterval,
20019 updateStrategy: updateStrategy
20020 },
20021 authOptions: authOptions
20022 }).then(function (data) {
20023 var leaderboard = new Leaderboard(statisticName);
20024 return leaderboard._finishFetch(data);
20025 });
20026};
20027/**
20028 * Get the Leaderboard with the specified statistic name.
20029 * @param {string} statisticName
20030 * @param {AuthOptions} [authOptions]
20031 * @return {Promise<AV.Leaderboard>}
20032 */
20033AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
20034 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
20035};
20036/**
20037 * Get Statistics for the specified user.
20038 * @param {AV.User} user The specified AV.User pointer.
20039 * @param {Object} [options]
20040 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
20041 * @param {AuthOptions} [authOptions]
20042 * @return {Promise<Statistic[]>}
20043 */
20044AV.Leaderboard.getStatistics = function (user) {
20045 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20046 statisticNames = _ref3.statisticNames;
20047
20048 var authOptions = arguments[2];
20049 return _promise2.default.resolve().then(function () {
20050 if (!(user && user.id)) throw new Error('user must be an AV.User');
20051 return request({
20052 method: 'GET',
20053 path: '/leaderboard/users/' + user.id + '/statistics',
20054 query: {
20055 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
20056 },
20057 authOptions: authOptions
20058 }).then(function (_ref4) {
20059 var results = _ref4.results;
20060 return results.map(parseStatisticData);
20061 });
20062 });
20063};
20064
20065/**
20066 * Update Statistics for the specified user.
20067 * @param {AV.User} user The specified AV.User pointer.
20068 * @param {Object} statistics A name-value pair representing the statistics to update.
20069 * @param {AuthOptions} [options] AuthOptions plus:
20070 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
20071 * @return {Promise<Statistic[]>}
20072 */
20073AV.Leaderboard.updateStatistics = function (user, statistics) {
20074 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
20075 return _promise2.default.resolve().then(function () {
20076 if (!(user && user.id)) throw new Error('user must be an AV.User');
20077 var data = _.map(statistics, function (value, key) {
20078 return {
20079 statisticName: key,
20080 statisticValue: value
20081 };
20082 });
20083 var overwrite = options.overwrite;
20084
20085 return request({
20086 method: 'POST',
20087 path: '/leaderboard/users/' + user.id + '/statistics',
20088 query: {
20089 overwrite: overwrite ? 1 : undefined
20090 },
20091 data: data,
20092 authOptions: options
20093 }).then(function (_ref5) {
20094 var results = _ref5.results;
20095 return results.map(parseStatisticData);
20096 });
20097 });
20098};
20099
20100/**
20101 * Delete Statistics for the specified user.
20102 * @param {AV.User} user The specified AV.User pointer.
20103 * @param {Object} statistics A name-value pair representing the statistics to delete.
20104 * @param {AuthOptions} [options]
20105 * @return {Promise<void>}
20106 */
20107AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
20108 return _promise2.default.resolve().then(function () {
20109 if (!(user && user.id)) throw new Error('user must be an AV.User');
20110 return request({
20111 method: 'DELETE',
20112 path: '/leaderboard/users/' + user.id + '/statistics',
20113 query: {
20114 statistics: ensureArray(statisticNames).join(',')
20115 },
20116 authOptions: authOptions
20117 }).then(function () {
20118 return undefined;
20119 });
20120 });
20121};
20122
20123_.extend(Leaderboard.prototype,
20124/** @lends AV.Leaderboard.prototype */{
20125 _finishFetch: function _finishFetch(data) {
20126 var _this = this;
20127
20128 _.forEach(data, function (value, key) {
20129 if (key === 'updatedAt' || key === 'objectId') return;
20130 if (key === 'expiredAt') {
20131 key = 'nextResetAt';
20132 }
20133 if (key === 'createdAt') {
20134 value = parseDate(value);
20135 }
20136 if (value && value.__type === 'Date') {
20137 value = parseDate(value.iso);
20138 }
20139 _this[key] = value;
20140 });
20141 return this;
20142 },
20143
20144 /**
20145 * Fetch data from the srever.
20146 * @param {AuthOptions} [authOptions]
20147 * @return {Promise<AV.Leaderboard>}
20148 */
20149 fetch: function fetch(authOptions) {
20150 var _this2 = this;
20151
20152 return request({
20153 method: 'GET',
20154 path: '/leaderboard/leaderboards/' + this.statisticName,
20155 authOptions: authOptions
20156 }).then(function (data) {
20157 return _this2._finishFetch(data);
20158 });
20159 },
20160
20161 /**
20162 * Counts the number of users participated in this leaderboard
20163 * @param {Object} [options]
20164 * @param {number} [options.version] Specify the version of the leaderboard
20165 * @param {AuthOptions} [authOptions]
20166 * @return {Promise<number>}
20167 */
20168 count: function count() {
20169 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20170 version = _ref6.version;
20171
20172 var authOptions = arguments[1];
20173
20174 return request({
20175 method: 'GET',
20176 path: '/leaderboard/leaderboards/' + this.statisticName + '/ranks',
20177 query: {
20178 count: 1,
20179 limit: 0,
20180 version: version
20181 },
20182 authOptions: authOptions
20183 }).then(function (_ref7) {
20184 var count = _ref7.count;
20185 return count;
20186 });
20187 },
20188 _getResults: function _getResults(_ref8, authOptions, userId) {
20189 var skip = _ref8.skip,
20190 limit = _ref8.limit,
20191 selectUserKeys = _ref8.selectUserKeys,
20192 includeUserKeys = _ref8.includeUserKeys,
20193 includeStatistics = _ref8.includeStatistics,
20194 version = _ref8.version;
20195
20196 return request({
20197 method: 'GET',
20198 path: '/leaderboard/leaderboards/' + this.statisticName + '/ranks' + (userId ? '/' + userId : ''),
20199 query: {
20200 skip: skip,
20201 limit: limit,
20202 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
20203 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
20204 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
20205 version: version
20206 },
20207 authOptions: authOptions
20208 }).then(function (_ref9) {
20209 var rankings = _ref9.results;
20210 return rankings.map(function (rankingData) {
20211 var _AV$_decode2 = AV._decode(rankingData),
20212 user = _AV$_decode2.user,
20213 value = _AV$_decode2.statisticValue,
20214 rank = _AV$_decode2.rank,
20215 _AV$_decode2$statisti = _AV$_decode2.statistics,
20216 statistics = _AV$_decode2$statisti === undefined ? [] : _AV$_decode2$statisti;
20217
20218 return {
20219 user: user,
20220 value: value,
20221 rank: rank,
20222 includedStatistics: statistics.map(parseStatisticData)
20223 };
20224 });
20225 });
20226 },
20227
20228 /**
20229 * Retrieve a list of ranked users for this Leaderboard.
20230 * @param {Object} [options]
20231 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
20232 * @param {number} [options.limit] The limit of the number of results.
20233 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
20234 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
20235 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
20236 * @param {number} [options.version] Specify the version of the leaderboard
20237 * @param {AuthOptions} [authOptions]
20238 * @return {Promise<Ranking[]>}
20239 */
20240 getResults: function getResults() {
20241 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20242 skip = _ref10.skip,
20243 limit = _ref10.limit,
20244 selectUserKeys = _ref10.selectUserKeys,
20245 includeUserKeys = _ref10.includeUserKeys,
20246 includeStatistics = _ref10.includeStatistics,
20247 version = _ref10.version;
20248
20249 var authOptions = arguments[1];
20250
20251 return this._getResults({
20252 skip: skip,
20253 limit: limit,
20254 selectUserKeys: selectUserKeys,
20255 includeUserKeys: includeUserKeys,
20256 includeStatistics: includeStatistics,
20257 version: version
20258 }, authOptions);
20259 },
20260
20261 /**
20262 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
20263 * @param {AV.User} user The specified AV.User pointer.
20264 * @param {Object} [options]
20265 * @param {number} [options.limit] The limit of the number of results.
20266 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
20267 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
20268 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
20269 * @param {number} [options.version] Specify the version of the leaderboard
20270 * @param {AuthOptions} [authOptions]
20271 * @return {Promise<Ranking[]>}
20272 */
20273 getResultsAroundUser: function getResultsAroundUser(user) {
20274 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20275 var authOptions = arguments[2];
20276
20277 // getResultsAroundUser(options, authOptions)
20278 if (user && typeof user.id !== 'string') {
20279 return this.getResultsAroundUser(undefined, user, options);
20280 }
20281 var limit = options.limit,
20282 selectUserKeys = options.selectUserKeys,
20283 includeUserKeys = options.includeUserKeys,
20284 includeStatistics = options.includeStatistics,
20285 version = options.version;
20286
20287 return this._getResults({ limit: limit, selectUserKeys: selectUserKeys, includeUserKeys: includeUserKeys, includeStatistics: includeStatistics, version: version }, authOptions, user ? user.id : 'self');
20288 },
20289 _update: function _update(data, authOptions) {
20290 var _this3 = this;
20291
20292 return request({
20293 method: 'PUT',
20294 path: '/leaderboard/leaderboards/' + this.statisticName,
20295 data: data,
20296 authOptions: authOptions
20297 }).then(function (result) {
20298 return _this3._finishFetch(result);
20299 });
20300 },
20301
20302 /**
20303 * (masterKey required) Update the version change interval of the Leaderboard.
20304 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
20305 * @param {AuthOptions} [authOptions]
20306 * @return {Promise<AV.Leaderboard>}
20307 */
20308 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
20309 return this._update({ versionChangeInterval: versionChangeInterval }, authOptions);
20310 },
20311
20312 /**
20313 * (masterKey required) Update the version change interval of the Leaderboard.
20314 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
20315 * @param {AuthOptions} [authOptions]
20316 * @return {Promise<AV.Leaderboard>}
20317 */
20318 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
20319 return this._update({ updateStrategy: updateStrategy }, authOptions);
20320 },
20321
20322 /**
20323 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
20324 * @param {AuthOptions} [authOptions]
20325 * @return {Promise<AV.Leaderboard>}
20326 */
20327 reset: function reset(authOptions) {
20328 var _this4 = this;
20329
20330 return request({
20331 method: 'PUT',
20332 path: '/leaderboard/leaderboards/' + this.statisticName + '/incrementVersion',
20333 authOptions: authOptions
20334 }).then(function (data) {
20335 return _this4._finishFetch(data);
20336 });
20337 },
20338
20339 /**
20340 * (masterKey required) Delete the Leaderboard and its all archived versions.
20341 * @param {AuthOptions} [authOptions]
20342 * @return {void}
20343 */
20344 destroy: function destroy(authOptions) {
20345 return AV.request({
20346 method: 'DELETE',
20347 path: '/leaderboard/leaderboards/' + this.statisticName,
20348 authOptions: authOptions
20349 }).then(function () {
20350 return undefined;
20351 });
20352 },
20353
20354 /**
20355 * (masterKey required) Get archived versions.
20356 * @param {Object} [options]
20357 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
20358 * @param {number} [options.limit] The limit of the number of results.
20359 * @param {AuthOptions} [authOptions]
20360 * @return {Promise<LeaderboardArchive[]>}
20361 */
20362 getArchives: function getArchives() {
20363 var _this5 = this;
20364
20365 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20366 skip = _ref11.skip,
20367 limit = _ref11.limit;
20368
20369 var authOptions = arguments[1];
20370
20371 return request({
20372 method: 'GET',
20373 path: '/leaderboard/leaderboards/' + this.statisticName + '/archives',
20374 query: {
20375 skip: skip,
20376 limit: limit
20377 },
20378 authOptions: authOptions
20379 }).then(function (_ref12) {
20380 var results = _ref12.results;
20381 return results.map(function (_ref13) {
20382 var version = _ref13.version,
20383 status = _ref13.status,
20384 url = _ref13.url,
20385 activatedAt = _ref13.activatedAt,
20386 deactivatedAt = _ref13.deactivatedAt;
20387 return {
20388 statisticName: _this5.statisticName,
20389 version: version,
20390 status: status,
20391 url: url,
20392 activatedAt: parseDate(activatedAt.iso),
20393 deactivatedAt: parseDate(deactivatedAt.iso)
20394 };
20395 });
20396 });
20397 }
20398});
20399
20400/***/ }),
20401/* 342 */
20402/***/ (function(module, exports, __webpack_require__) {
20403
20404"use strict";
20405
20406
20407var adapters = __webpack_require__(343);
20408
20409module.exports = function (AV) {
20410 AV.setAdapters(adapters);
20411 return AV;
20412};
20413
20414/***/ }),
20415/* 343 */
20416/***/ (function(module, exports, __webpack_require__) {
20417
20418"use strict";
20419
20420
20421var _map = __webpack_require__(344);
20422
20423var _map2 = _interopRequireDefault(_map);
20424
20425var _typeof2 = __webpack_require__(54);
20426
20427var _typeof3 = _interopRequireDefault(_typeof2);
20428
20429var _getPrototypeOf = __webpack_require__(99);
20430
20431var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
20432
20433var _getOwnPropertyDescriptor = __webpack_require__(179);
20434
20435var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
20436
20437var _defineProperty = __webpack_require__(67);
20438
20439var _defineProperty2 = _interopRequireDefault(_defineProperty);
20440
20441var _keys = __webpack_require__(97);
20442
20443var _keys2 = _interopRequireDefault(_keys);
20444
20445var _weakMap = __webpack_require__(355);
20446
20447var _weakMap2 = _interopRequireDefault(_weakMap);
20448
20449var _iterator = __webpack_require__(170);
20450
20451var _iterator2 = _interopRequireDefault(_iterator);
20452
20453var _symbol = __webpack_require__(171);
20454
20455var _symbol2 = _interopRequireDefault(_symbol);
20456
20457var _promise = __webpack_require__(3);
20458
20459var _promise2 = _interopRequireDefault(_promise);
20460
20461var _getOwnPropertySymbols = __webpack_require__(361);
20462
20463var _getOwnPropertySymbols2 = _interopRequireDefault(_getOwnPropertySymbols);
20464
20465var _assign2 = __webpack_require__(363);
20466
20467var _assign3 = _interopRequireDefault(_assign2);
20468
20469var _create = __webpack_require__(176);
20470
20471var _create2 = _interopRequireDefault(_create);
20472
20473var _setPrototypeOf = __webpack_require__(175);
20474
20475var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
20476
20477function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20478
20479Object.defineProperty(exports, '__esModule', { value: true });
20480
20481/*! *****************************************************************************
20482Copyright (c) Microsoft Corporation.
20483
20484Permission to use, copy, modify, and/or distribute this software for any
20485purpose with or without fee is hereby granted.
20486
20487THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20488REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20489AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20490INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20491LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20492OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20493PERFORMANCE OF THIS SOFTWARE.
20494***************************************************************************** */
20495/* global Reflect, Promise */
20496
20497var _extendStatics = function extendStatics(d, b) {
20498 _extendStatics = _setPrototypeOf2.default || { __proto__: [] } instanceof Array && function (d, b) {
20499 d.__proto__ = b;
20500 } || function (d, b) {
20501 for (var p in b) {
20502 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
20503 }
20504 };
20505 return _extendStatics(d, b);
20506};
20507
20508function __extends(d, b) {
20509 _extendStatics(d, b);
20510 function __() {
20511 this.constructor = d;
20512 }
20513 d.prototype = b === null ? (0, _create2.default)(b) : (__.prototype = b.prototype, new __());
20514}
20515
20516var _assign = function __assign() {
20517 _assign = _assign3.default || function __assign(t) {
20518 for (var s, i = 1, n = arguments.length; i < n; i++) {
20519 s = arguments[i];
20520 for (var p in s) {
20521 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
20522 }
20523 }
20524 return t;
20525 };
20526 return _assign.apply(this, arguments);
20527};
20528
20529function __rest(s, e) {
20530 var t = {};
20531 for (var p in s) {
20532 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
20533 }if (s != null && typeof _getOwnPropertySymbols2.default === "function") for (var i = 0, p = (0, _getOwnPropertySymbols2.default)(s); i < p.length; i++) {
20534 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
20535 }
20536 return t;
20537}
20538
20539function __awaiter(thisArg, _arguments, P, generator) {
20540 function adopt(value) {
20541 return value instanceof P ? value : new P(function (resolve) {
20542 resolve(value);
20543 });
20544 }
20545 return new (P || (P = _promise2.default))(function (resolve, reject) {
20546 function fulfilled(value) {
20547 try {
20548 step(generator.next(value));
20549 } catch (e) {
20550 reject(e);
20551 }
20552 }
20553 function rejected(value) {
20554 try {
20555 step(generator["throw"](value));
20556 } catch (e) {
20557 reject(e);
20558 }
20559 }
20560 function step(result) {
20561 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
20562 }
20563 step((generator = generator.apply(thisArg, _arguments || [])).next());
20564 });
20565}
20566
20567function __generator(thisArg, body) {
20568 var _ = { label: 0, sent: function sent() {
20569 if (t[0] & 1) throw t[1];return t[1];
20570 }, trys: [], ops: [] },
20571 f,
20572 y,
20573 t,
20574 g;
20575 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof _symbol2.default === "function" && (g[_iterator2.default] = function () {
20576 return this;
20577 }), g;
20578 function verb(n) {
20579 return function (v) {
20580 return step([n, v]);
20581 };
20582 }
20583 function step(op) {
20584 if (f) throw new TypeError("Generator is already executing.");
20585 while (_) {
20586 try {
20587 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;
20588 if (y = 0, t) op = [op[0] & 2, t.value];
20589 switch (op[0]) {
20590 case 0:case 1:
20591 t = op;break;
20592 case 4:
20593 _.label++;return { value: op[1], done: false };
20594 case 5:
20595 _.label++;y = op[1];op = [0];continue;
20596 case 7:
20597 op = _.ops.pop();_.trys.pop();continue;
20598 default:
20599 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
20600 _ = 0;continue;
20601 }
20602 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
20603 _.label = op[1];break;
20604 }
20605 if (op[0] === 6 && _.label < t[1]) {
20606 _.label = t[1];t = op;break;
20607 }
20608 if (t && _.label < t[2]) {
20609 _.label = t[2];_.ops.push(op);break;
20610 }
20611 if (t[2]) _.ops.pop();
20612 _.trys.pop();continue;
20613 }
20614 op = body.call(thisArg, _);
20615 } catch (e) {
20616 op = [6, e];y = 0;
20617 } finally {
20618 f = t = 0;
20619 }
20620 }if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true };
20621 }
20622}
20623
20624var PROVIDER = "lc_weapp";
20625var PLATFORM = "weixin";
20626function getLoginCode() {
20627 return new _promise2.default(function (resolve, reject) {
20628 wx.login({
20629 success: function success(res) {
20630 return res.code ? resolve(res.code) : reject(new Error(res.errMsg));
20631 },
20632 fail: function fail(_a) {
20633 var errMsg = _a.errMsg;
20634 return reject(new Error(errMsg));
20635 }
20636 });
20637 });
20638}
20639var getAuthInfo = function getAuthInfo(_a) {
20640 var _b = _a === void 0 ? {} : _a,
20641 _c = _b.platform,
20642 platform = _c === void 0 ? PLATFORM : _c,
20643 _d = _b.preferUnionId,
20644 preferUnionId = _d === void 0 ? false : _d,
20645 _e = _b.asMainAccount,
20646 asMainAccount = _e === void 0 ? false : _e;
20647 return __awaiter(this, void 0, void 0, function () {
20648 var code, authData;
20649 return __generator(this, function (_f) {
20650 switch (_f.label) {
20651 case 0:
20652 return [4 /*yield*/, getLoginCode()];
20653 case 1:
20654 code = _f.sent();
20655 authData = { code: code };
20656 if (preferUnionId) {
20657 authData.platform = platform;
20658 authData.main_account = asMainAccount;
20659 }
20660 return [2 /*return*/, {
20661 authData: authData,
20662 platform: platform,
20663 provider: PROVIDER
20664 }];
20665 }
20666 });
20667 });
20668};
20669
20670var storage = {
20671 getItem: function getItem(key) {
20672 return wx.getStorageSync(key);
20673 },
20674 setItem: function setItem(key, value) {
20675 return wx.setStorageSync(key, value);
20676 },
20677 removeItem: function removeItem(key) {
20678 return wx.removeStorageSync(key);
20679 },
20680 clear: function clear() {
20681 return wx.clearStorageSync();
20682 }
20683};
20684
20685/*! *****************************************************************************
20686Copyright (c) Microsoft Corporation.
20687
20688Permission to use, copy, modify, and/or distribute this software for any
20689purpose with or without fee is hereby granted.
20690
20691THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20692REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20693AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20694INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20695LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20696OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20697PERFORMANCE OF THIS SOFTWARE.
20698***************************************************************************** */
20699/* global Reflect, Promise */
20700
20701var _extendStatics$ = function extendStatics$1(d, b) {
20702 _extendStatics$ = _setPrototypeOf2.default || { __proto__: [] } instanceof Array && function (d, b) {
20703 d.__proto__ = b;
20704 } || function (d, b) {
20705 for (var p in b) {
20706 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
20707 }
20708 };
20709 return _extendStatics$(d, b);
20710};
20711
20712function __extends$1(d, b) {
20713 _extendStatics$(d, b);
20714 function __() {
20715 this.constructor = d;
20716 }
20717 d.prototype = b === null ? (0, _create2.default)(b) : (__.prototype = b.prototype, new __());
20718}
20719
20720var AbortError = /** @class */function (_super) {
20721 __extends$1(AbortError, _super);
20722 function AbortError() {
20723 var _this = _super !== null && _super.apply(this, arguments) || this;
20724 _this.name = "AbortError";
20725 return _this;
20726 }
20727 return AbortError;
20728}(Error);
20729
20730var request = function request(url, options) {
20731 if (options === void 0) {
20732 options = {};
20733 }
20734 var method = options.method,
20735 data = options.data,
20736 headers = options.headers,
20737 signal = options.signal;
20738 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
20739 return _promise2.default.reject(new AbortError("Request aborted"));
20740 }
20741 return new _promise2.default(function (resolve, reject) {
20742 var task = wx.request({
20743 url: url,
20744 method: method,
20745 data: data,
20746 header: headers,
20747 complete: function complete(res) {
20748 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
20749 if (!res.statusCode) {
20750 reject(new Error(res.errMsg));
20751 return;
20752 }
20753 resolve({
20754 ok: !(res.statusCode >= 400),
20755 status: res.statusCode,
20756 headers: res.header,
20757 data: res.data
20758 });
20759 }
20760 });
20761 var abortListener = function abortListener() {
20762 reject(new AbortError("Request aborted"));
20763 task.abort();
20764 };
20765 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
20766 });
20767};
20768var upload = function upload(url, file, options) {
20769 if (options === void 0) {
20770 options = {};
20771 }
20772 var headers = options.headers,
20773 data = options.data,
20774 onprogress = options.onprogress,
20775 signal = options.signal;
20776 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
20777 return _promise2.default.reject(new AbortError("Request aborted"));
20778 }
20779 if (!(file && file.data && file.data.uri)) {
20780 return _promise2.default.reject(new TypeError("File data must be an object like { uri: localPath }."));
20781 }
20782 return new _promise2.default(function (resolve, reject) {
20783 var task = wx.uploadFile({
20784 url: url,
20785 header: headers,
20786 filePath: file.data.uri,
20787 name: file.field,
20788 formData: data,
20789 success: function success(response) {
20790 var status = response.statusCode,
20791 data = response.data,
20792 rest = __rest(response, ["statusCode", "data"]);
20793 resolve(_assign(_assign({}, rest), { data: typeof data === "string" ? JSON.parse(data) : data, status: status, ok: !(status >= 400) }));
20794 },
20795 fail: function fail(response) {
20796 reject(new Error(response.errMsg));
20797 },
20798 complete: function complete() {
20799 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
20800 }
20801 });
20802 var abortListener = function abortListener() {
20803 reject(new AbortError("Request aborted"));
20804 task.abort();
20805 };
20806 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
20807 if (onprogress) {
20808 task.onProgressUpdate(function (event) {
20809 return onprogress({
20810 loaded: event.totalBytesSent,
20811 total: event.totalBytesExpectedToSend,
20812 percent: event.progress
20813 });
20814 });
20815 }
20816 });
20817};
20818
20819/**
20820 * @author Toru Nagashima <https://github.com/mysticatea>
20821 * @copyright 2015 Toru Nagashima. All rights reserved.
20822 * See LICENSE file in root directory for full license.
20823 */
20824/**
20825 * @typedef {object} PrivateData
20826 * @property {EventTarget} eventTarget The event target.
20827 * @property {{type:string}} event The original event object.
20828 * @property {number} eventPhase The current event phase.
20829 * @property {EventTarget|null} currentTarget The current event target.
20830 * @property {boolean} canceled The flag to prevent default.
20831 * @property {boolean} stopped The flag to stop propagation.
20832 * @property {boolean} immediateStopped The flag to stop propagation immediately.
20833 * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
20834 * @property {number} timeStamp The unix time.
20835 * @private
20836 */
20837
20838/**
20839 * Private data for event wrappers.
20840 * @type {WeakMap<Event, PrivateData>}
20841 * @private
20842 */
20843var privateData = new _weakMap2.default();
20844
20845/**
20846 * Cache for wrapper classes.
20847 * @type {WeakMap<Object, Function>}
20848 * @private
20849 */
20850var wrappers = new _weakMap2.default();
20851
20852/**
20853 * Get private data.
20854 * @param {Event} event The event object to get private data.
20855 * @returns {PrivateData} The private data of the event.
20856 * @private
20857 */
20858function pd(event) {
20859 var retv = privateData.get(event);
20860 console.assert(retv != null, "'this' is expected an Event object, but got", event);
20861 return retv;
20862}
20863
20864/**
20865 * https://dom.spec.whatwg.org/#set-the-canceled-flag
20866 * @param data {PrivateData} private data.
20867 */
20868function setCancelFlag(data) {
20869 if (data.passiveListener != null) {
20870 if (typeof console !== "undefined" && typeof console.error === "function") {
20871 console.error("Unable to preventDefault inside passive event listener invocation.", data.passiveListener);
20872 }
20873 return;
20874 }
20875 if (!data.event.cancelable) {
20876 return;
20877 }
20878
20879 data.canceled = true;
20880 if (typeof data.event.preventDefault === "function") {
20881 data.event.preventDefault();
20882 }
20883}
20884
20885/**
20886 * @see https://dom.spec.whatwg.org/#interface-event
20887 * @private
20888 */
20889/**
20890 * The event wrapper.
20891 * @constructor
20892 * @param {EventTarget} eventTarget The event target of this dispatching.
20893 * @param {Event|{type:string}} event The original event to wrap.
20894 */
20895function Event(eventTarget, event) {
20896 privateData.set(this, {
20897 eventTarget: eventTarget,
20898 event: event,
20899 eventPhase: 2,
20900 currentTarget: eventTarget,
20901 canceled: false,
20902 stopped: false,
20903 immediateStopped: false,
20904 passiveListener: null,
20905 timeStamp: event.timeStamp || Date.now()
20906 });
20907
20908 // https://heycam.github.io/webidl/#Unforgeable
20909 Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
20910
20911 // Define accessors
20912 var keys = (0, _keys2.default)(event);
20913 for (var i = 0; i < keys.length; ++i) {
20914 var key = keys[i];
20915 if (!(key in this)) {
20916 (0, _defineProperty2.default)(this, key, defineRedirectDescriptor(key));
20917 }
20918 }
20919}
20920
20921// Should be enumerable, but class methods are not enumerable.
20922Event.prototype = {
20923 /**
20924 * The type of this event.
20925 * @type {string}
20926 */
20927 get type() {
20928 return pd(this).event.type;
20929 },
20930
20931 /**
20932 * The target of this event.
20933 * @type {EventTarget}
20934 */
20935 get target() {
20936 return pd(this).eventTarget;
20937 },
20938
20939 /**
20940 * The target of this event.
20941 * @type {EventTarget}
20942 */
20943 get currentTarget() {
20944 return pd(this).currentTarget;
20945 },
20946
20947 /**
20948 * @returns {EventTarget[]} The composed path of this event.
20949 */
20950 composedPath: function composedPath() {
20951 var currentTarget = pd(this).currentTarget;
20952 if (currentTarget == null) {
20953 return [];
20954 }
20955 return [currentTarget];
20956 },
20957
20958
20959 /**
20960 * Constant of NONE.
20961 * @type {number}
20962 */
20963 get NONE() {
20964 return 0;
20965 },
20966
20967 /**
20968 * Constant of CAPTURING_PHASE.
20969 * @type {number}
20970 */
20971 get CAPTURING_PHASE() {
20972 return 1;
20973 },
20974
20975 /**
20976 * Constant of AT_TARGET.
20977 * @type {number}
20978 */
20979 get AT_TARGET() {
20980 return 2;
20981 },
20982
20983 /**
20984 * Constant of BUBBLING_PHASE.
20985 * @type {number}
20986 */
20987 get BUBBLING_PHASE() {
20988 return 3;
20989 },
20990
20991 /**
20992 * The target of this event.
20993 * @type {number}
20994 */
20995 get eventPhase() {
20996 return pd(this).eventPhase;
20997 },
20998
20999 /**
21000 * Stop event bubbling.
21001 * @returns {void}
21002 */
21003 stopPropagation: function stopPropagation() {
21004 var data = pd(this);
21005
21006 data.stopped = true;
21007 if (typeof data.event.stopPropagation === "function") {
21008 data.event.stopPropagation();
21009 }
21010 },
21011
21012
21013 /**
21014 * Stop event bubbling.
21015 * @returns {void}
21016 */
21017 stopImmediatePropagation: function stopImmediatePropagation() {
21018 var data = pd(this);
21019
21020 data.stopped = true;
21021 data.immediateStopped = true;
21022 if (typeof data.event.stopImmediatePropagation === "function") {
21023 data.event.stopImmediatePropagation();
21024 }
21025 },
21026
21027
21028 /**
21029 * The flag to be bubbling.
21030 * @type {boolean}
21031 */
21032 get bubbles() {
21033 return Boolean(pd(this).event.bubbles);
21034 },
21035
21036 /**
21037 * The flag to be cancelable.
21038 * @type {boolean}
21039 */
21040 get cancelable() {
21041 return Boolean(pd(this).event.cancelable);
21042 },
21043
21044 /**
21045 * Cancel this event.
21046 * @returns {void}
21047 */
21048 preventDefault: function preventDefault() {
21049 setCancelFlag(pd(this));
21050 },
21051
21052
21053 /**
21054 * The flag to indicate cancellation state.
21055 * @type {boolean}
21056 */
21057 get defaultPrevented() {
21058 return pd(this).canceled;
21059 },
21060
21061 /**
21062 * The flag to be composed.
21063 * @type {boolean}
21064 */
21065 get composed() {
21066 return Boolean(pd(this).event.composed);
21067 },
21068
21069 /**
21070 * The unix time of this event.
21071 * @type {number}
21072 */
21073 get timeStamp() {
21074 return pd(this).timeStamp;
21075 },
21076
21077 /**
21078 * The target of this event.
21079 * @type {EventTarget}
21080 * @deprecated
21081 */
21082 get srcElement() {
21083 return pd(this).eventTarget;
21084 },
21085
21086 /**
21087 * The flag to stop event bubbling.
21088 * @type {boolean}
21089 * @deprecated
21090 */
21091 get cancelBubble() {
21092 return pd(this).stopped;
21093 },
21094 set cancelBubble(value) {
21095 if (!value) {
21096 return;
21097 }
21098 var data = pd(this);
21099
21100 data.stopped = true;
21101 if (typeof data.event.cancelBubble === "boolean") {
21102 data.event.cancelBubble = true;
21103 }
21104 },
21105
21106 /**
21107 * The flag to indicate cancellation state.
21108 * @type {boolean}
21109 * @deprecated
21110 */
21111 get returnValue() {
21112 return !pd(this).canceled;
21113 },
21114 set returnValue(value) {
21115 if (!value) {
21116 setCancelFlag(pd(this));
21117 }
21118 },
21119
21120 /**
21121 * Initialize this event object. But do nothing under event dispatching.
21122 * @param {string} type The event type.
21123 * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
21124 * @param {boolean} [cancelable=false] The flag to be possible to cancel.
21125 * @deprecated
21126 */
21127 initEvent: function initEvent() {
21128 // Do nothing.
21129 }
21130};
21131
21132// `constructor` is not enumerable.
21133Object.defineProperty(Event.prototype, "constructor", {
21134 value: Event,
21135 configurable: true,
21136 writable: true
21137});
21138
21139// Ensure `event instanceof window.Event` is `true`.
21140if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
21141 (0, _setPrototypeOf2.default)(Event.prototype, window.Event.prototype);
21142
21143 // Make association for wrappers.
21144 wrappers.set(window.Event.prototype, Event);
21145}
21146
21147/**
21148 * Get the property descriptor to redirect a given property.
21149 * @param {string} key Property name to define property descriptor.
21150 * @returns {PropertyDescriptor} The property descriptor to redirect the property.
21151 * @private
21152 */
21153function defineRedirectDescriptor(key) {
21154 return {
21155 get: function get() {
21156 return pd(this).event[key];
21157 },
21158 set: function set(value) {
21159 pd(this).event[key] = value;
21160 },
21161
21162 configurable: true,
21163 enumerable: true
21164 };
21165}
21166
21167/**
21168 * Get the property descriptor to call a given method property.
21169 * @param {string} key Property name to define property descriptor.
21170 * @returns {PropertyDescriptor} The property descriptor to call the method property.
21171 * @private
21172 */
21173function defineCallDescriptor(key) {
21174 return {
21175 value: function value() {
21176 var event = pd(this).event;
21177 return event[key].apply(event, arguments);
21178 },
21179
21180 configurable: true,
21181 enumerable: true
21182 };
21183}
21184
21185/**
21186 * Define new wrapper class.
21187 * @param {Function} BaseEvent The base wrapper class.
21188 * @param {Object} proto The prototype of the original event.
21189 * @returns {Function} The defined wrapper class.
21190 * @private
21191 */
21192function defineWrapper(BaseEvent, proto) {
21193 var keys = (0, _keys2.default)(proto);
21194 if (keys.length === 0) {
21195 return BaseEvent;
21196 }
21197
21198 /** CustomEvent */
21199 function CustomEvent(eventTarget, event) {
21200 BaseEvent.call(this, eventTarget, event);
21201 }
21202
21203 CustomEvent.prototype = (0, _create2.default)(BaseEvent.prototype, {
21204 constructor: { value: CustomEvent, configurable: true, writable: true }
21205 });
21206
21207 // Define accessors.
21208 for (var i = 0; i < keys.length; ++i) {
21209 var key = keys[i];
21210 if (!(key in BaseEvent.prototype)) {
21211 var descriptor = (0, _getOwnPropertyDescriptor2.default)(proto, key);
21212 var isFunc = typeof descriptor.value === "function";
21213 (0, _defineProperty2.default)(CustomEvent.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key));
21214 }
21215 }
21216
21217 return CustomEvent;
21218}
21219
21220/**
21221 * Get the wrapper class of a given prototype.
21222 * @param {Object} proto The prototype of the original event to get its wrapper.
21223 * @returns {Function} The wrapper class.
21224 * @private
21225 */
21226function getWrapper(proto) {
21227 if (proto == null || proto === Object.prototype) {
21228 return Event;
21229 }
21230
21231 var wrapper = wrappers.get(proto);
21232 if (wrapper == null) {
21233 wrapper = defineWrapper(getWrapper((0, _getPrototypeOf2.default)(proto)), proto);
21234 wrappers.set(proto, wrapper);
21235 }
21236 return wrapper;
21237}
21238
21239/**
21240 * Wrap a given event to management a dispatching.
21241 * @param {EventTarget} eventTarget The event target of this dispatching.
21242 * @param {Object} event The event to wrap.
21243 * @returns {Event} The wrapper instance.
21244 * @private
21245 */
21246function wrapEvent(eventTarget, event) {
21247 var Wrapper = getWrapper((0, _getPrototypeOf2.default)(event));
21248 return new Wrapper(eventTarget, event);
21249}
21250
21251/**
21252 * Get the immediateStopped flag of a given event.
21253 * @param {Event} event The event to get.
21254 * @returns {boolean} The flag to stop propagation immediately.
21255 * @private
21256 */
21257function isStopped(event) {
21258 return pd(event).immediateStopped;
21259}
21260
21261/**
21262 * Set the current event phase of a given event.
21263 * @param {Event} event The event to set current target.
21264 * @param {number} eventPhase New event phase.
21265 * @returns {void}
21266 * @private
21267 */
21268function setEventPhase(event, eventPhase) {
21269 pd(event).eventPhase = eventPhase;
21270}
21271
21272/**
21273 * Set the current target of a given event.
21274 * @param {Event} event The event to set current target.
21275 * @param {EventTarget|null} currentTarget New current target.
21276 * @returns {void}
21277 * @private
21278 */
21279function setCurrentTarget(event, currentTarget) {
21280 pd(event).currentTarget = currentTarget;
21281}
21282
21283/**
21284 * Set a passive listener of a given event.
21285 * @param {Event} event The event to set current target.
21286 * @param {Function|null} passiveListener New passive listener.
21287 * @returns {void}
21288 * @private
21289 */
21290function setPassiveListener(event, passiveListener) {
21291 pd(event).passiveListener = passiveListener;
21292}
21293
21294/**
21295 * @typedef {object} ListenerNode
21296 * @property {Function} listener
21297 * @property {1|2|3} listenerType
21298 * @property {boolean} passive
21299 * @property {boolean} once
21300 * @property {ListenerNode|null} next
21301 * @private
21302 */
21303
21304/**
21305 * @type {WeakMap<object, Map<string, ListenerNode>>}
21306 * @private
21307 */
21308var listenersMap = new _weakMap2.default();
21309
21310// Listener types
21311var CAPTURE = 1;
21312var BUBBLE = 2;
21313var ATTRIBUTE = 3;
21314
21315/**
21316 * Check whether a given value is an object or not.
21317 * @param {any} x The value to check.
21318 * @returns {boolean} `true` if the value is an object.
21319 */
21320function isObject(x) {
21321 return x !== null && (typeof x === 'undefined' ? 'undefined' : (0, _typeof3.default)(x)) === "object"; //eslint-disable-line no-restricted-syntax
21322}
21323
21324/**
21325 * Get listeners.
21326 * @param {EventTarget} eventTarget The event target to get.
21327 * @returns {Map<string, ListenerNode>} The listeners.
21328 * @private
21329 */
21330function getListeners(eventTarget) {
21331 var listeners = listenersMap.get(eventTarget);
21332 if (listeners == null) {
21333 throw new TypeError("'this' is expected an EventTarget object, but got another value.");
21334 }
21335 return listeners;
21336}
21337
21338/**
21339 * Get the property descriptor for the event attribute of a given event.
21340 * @param {string} eventName The event name to get property descriptor.
21341 * @returns {PropertyDescriptor} The property descriptor.
21342 * @private
21343 */
21344function defineEventAttributeDescriptor(eventName) {
21345 return {
21346 get: function get() {
21347 var listeners = getListeners(this);
21348 var node = listeners.get(eventName);
21349 while (node != null) {
21350 if (node.listenerType === ATTRIBUTE) {
21351 return node.listener;
21352 }
21353 node = node.next;
21354 }
21355 return null;
21356 },
21357 set: function set(listener) {
21358 if (typeof listener !== "function" && !isObject(listener)) {
21359 listener = null; // eslint-disable-line no-param-reassign
21360 }
21361 var listeners = getListeners(this);
21362
21363 // Traverse to the tail while removing old value.
21364 var prev = null;
21365 var node = listeners.get(eventName);
21366 while (node != null) {
21367 if (node.listenerType === ATTRIBUTE) {
21368 // Remove old value.
21369 if (prev !== null) {
21370 prev.next = node.next;
21371 } else if (node.next !== null) {
21372 listeners.set(eventName, node.next);
21373 } else {
21374 listeners.delete(eventName);
21375 }
21376 } else {
21377 prev = node;
21378 }
21379
21380 node = node.next;
21381 }
21382
21383 // Add new value.
21384 if (listener !== null) {
21385 var newNode = {
21386 listener: listener,
21387 listenerType: ATTRIBUTE,
21388 passive: false,
21389 once: false,
21390 next: null
21391 };
21392 if (prev === null) {
21393 listeners.set(eventName, newNode);
21394 } else {
21395 prev.next = newNode;
21396 }
21397 }
21398 },
21399
21400 configurable: true,
21401 enumerable: true
21402 };
21403}
21404
21405/**
21406 * Define an event attribute (e.g. `eventTarget.onclick`).
21407 * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
21408 * @param {string} eventName The event name to define.
21409 * @returns {void}
21410 */
21411function defineEventAttribute(eventTargetPrototype, eventName) {
21412 Object.defineProperty(eventTargetPrototype, 'on' + eventName, defineEventAttributeDescriptor(eventName));
21413}
21414
21415/**
21416 * Define a custom EventTarget with event attributes.
21417 * @param {string[]} eventNames Event names for event attributes.
21418 * @returns {EventTarget} The custom EventTarget.
21419 * @private
21420 */
21421function defineCustomEventTarget(eventNames) {
21422 /** CustomEventTarget */
21423 function CustomEventTarget() {
21424 EventTarget.call(this);
21425 }
21426
21427 CustomEventTarget.prototype = (0, _create2.default)(EventTarget.prototype, {
21428 constructor: {
21429 value: CustomEventTarget,
21430 configurable: true,
21431 writable: true
21432 }
21433 });
21434
21435 for (var i = 0; i < eventNames.length; ++i) {
21436 defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
21437 }
21438
21439 return CustomEventTarget;
21440}
21441
21442/**
21443 * EventTarget.
21444 *
21445 * - This is constructor if no arguments.
21446 * - This is a function which returns a CustomEventTarget constructor if there are arguments.
21447 *
21448 * For example:
21449 *
21450 * class A extends EventTarget {}
21451 * class B extends EventTarget("message") {}
21452 * class C extends EventTarget("message", "error") {}
21453 * class D extends EventTarget(["message", "error"]) {}
21454 */
21455function EventTarget() {
21456 /*eslint-disable consistent-return */
21457 if (this instanceof EventTarget) {
21458 listenersMap.set(this, new _map2.default());
21459 return;
21460 }
21461 if (arguments.length === 1 && Array.isArray(arguments[0])) {
21462 return defineCustomEventTarget(arguments[0]);
21463 }
21464 if (arguments.length > 0) {
21465 var types = new Array(arguments.length);
21466 for (var i = 0; i < arguments.length; ++i) {
21467 types[i] = arguments[i];
21468 }
21469 return defineCustomEventTarget(types);
21470 }
21471 throw new TypeError("Cannot call a class as a function");
21472 /*eslint-enable consistent-return */
21473}
21474
21475// Should be enumerable, but class methods are not enumerable.
21476EventTarget.prototype = {
21477 /**
21478 * Add a given listener to this event target.
21479 * @param {string} eventName The event name to add.
21480 * @param {Function} listener The listener to add.
21481 * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
21482 * @returns {void}
21483 */
21484 addEventListener: function addEventListener(eventName, listener, options) {
21485 if (listener == null) {
21486 return;
21487 }
21488 if (typeof listener !== "function" && !isObject(listener)) {
21489 throw new TypeError("'listener' should be a function or an object.");
21490 }
21491
21492 var listeners = getListeners(this);
21493 var optionsIsObj = isObject(options);
21494 var capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
21495 var listenerType = capture ? CAPTURE : BUBBLE;
21496 var newNode = {
21497 listener: listener,
21498 listenerType: listenerType,
21499 passive: optionsIsObj && Boolean(options.passive),
21500 once: optionsIsObj && Boolean(options.once),
21501 next: null
21502 };
21503
21504 // Set it as the first node if the first node is null.
21505 var node = listeners.get(eventName);
21506 if (node === undefined) {
21507 listeners.set(eventName, newNode);
21508 return;
21509 }
21510
21511 // Traverse to the tail while checking duplication..
21512 var prev = null;
21513 while (node != null) {
21514 if (node.listener === listener && node.listenerType === listenerType) {
21515 // Should ignore duplication.
21516 return;
21517 }
21518 prev = node;
21519 node = node.next;
21520 }
21521
21522 // Add it.
21523 prev.next = newNode;
21524 },
21525
21526
21527 /**
21528 * Remove a given listener from this event target.
21529 * @param {string} eventName The event name to remove.
21530 * @param {Function} listener The listener to remove.
21531 * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
21532 * @returns {void}
21533 */
21534 removeEventListener: function removeEventListener(eventName, listener, options) {
21535 if (listener == null) {
21536 return;
21537 }
21538
21539 var listeners = getListeners(this);
21540 var capture = isObject(options) ? Boolean(options.capture) : Boolean(options);
21541 var listenerType = capture ? CAPTURE : BUBBLE;
21542
21543 var prev = null;
21544 var node = listeners.get(eventName);
21545 while (node != null) {
21546 if (node.listener === listener && node.listenerType === listenerType) {
21547 if (prev !== null) {
21548 prev.next = node.next;
21549 } else if (node.next !== null) {
21550 listeners.set(eventName, node.next);
21551 } else {
21552 listeners.delete(eventName);
21553 }
21554 return;
21555 }
21556
21557 prev = node;
21558 node = node.next;
21559 }
21560 },
21561
21562
21563 /**
21564 * Dispatch a given event.
21565 * @param {Event|{type:string}} event The event to dispatch.
21566 * @returns {boolean} `false` if canceled.
21567 */
21568 dispatchEvent: function dispatchEvent(event) {
21569 if (event == null || typeof event.type !== "string") {
21570 throw new TypeError('"event.type" should be a string.');
21571 }
21572
21573 // If listeners aren't registered, terminate.
21574 var listeners = getListeners(this);
21575 var eventName = event.type;
21576 var node = listeners.get(eventName);
21577 if (node == null) {
21578 return true;
21579 }
21580
21581 // Since we cannot rewrite several properties, so wrap object.
21582 var wrappedEvent = wrapEvent(this, event);
21583
21584 // This doesn't process capturing phase and bubbling phase.
21585 // This isn't participating in a tree.
21586 var prev = null;
21587 while (node != null) {
21588 // Remove this listener if it's once
21589 if (node.once) {
21590 if (prev !== null) {
21591 prev.next = node.next;
21592 } else if (node.next !== null) {
21593 listeners.set(eventName, node.next);
21594 } else {
21595 listeners.delete(eventName);
21596 }
21597 } else {
21598 prev = node;
21599 }
21600
21601 // Call this listener
21602 setPassiveListener(wrappedEvent, node.passive ? node.listener : null);
21603 if (typeof node.listener === "function") {
21604 try {
21605 node.listener.call(this, wrappedEvent);
21606 } catch (err) {
21607 if (typeof console !== "undefined" && typeof console.error === "function") {
21608 console.error(err);
21609 }
21610 }
21611 } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
21612 node.listener.handleEvent(wrappedEvent);
21613 }
21614
21615 // Break if `event.stopImmediatePropagation` was called.
21616 if (isStopped(wrappedEvent)) {
21617 break;
21618 }
21619
21620 node = node.next;
21621 }
21622 setPassiveListener(wrappedEvent, null);
21623 setEventPhase(wrappedEvent, 0);
21624 setCurrentTarget(wrappedEvent, null);
21625
21626 return !wrappedEvent.defaultPrevented;
21627 }
21628};
21629
21630// `constructor` is not enumerable.
21631Object.defineProperty(EventTarget.prototype, "constructor", {
21632 value: EventTarget,
21633 configurable: true,
21634 writable: true
21635});
21636
21637// Ensure `eventTarget instanceof window.EventTarget` is `true`.
21638if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
21639 (0, _setPrototypeOf2.default)(EventTarget.prototype, window.EventTarget.prototype);
21640}
21641
21642var WS = /** @class */function (_super) {
21643 __extends(WS, _super);
21644 function WS(url, protocol) {
21645 var _this = _super.call(this) || this;
21646 _this._readyState = WS.CLOSED;
21647 if (!url) {
21648 throw new TypeError("Failed to construct 'WebSocket': url required");
21649 }
21650 _this._url = url;
21651 _this._protocol = protocol;
21652 return _this;
21653 }
21654 Object.defineProperty(WS.prototype, "url", {
21655 get: function get() {
21656 return this._url;
21657 },
21658 enumerable: false,
21659 configurable: true
21660 });
21661 Object.defineProperty(WS.prototype, "protocol", {
21662 get: function get() {
21663 return this._protocol;
21664 },
21665 enumerable: false,
21666 configurable: true
21667 });
21668 Object.defineProperty(WS.prototype, "readyState", {
21669 get: function get() {
21670 return this._readyState;
21671 },
21672 enumerable: false,
21673 configurable: true
21674 });
21675 WS.CONNECTING = 0;
21676 WS.OPEN = 1;
21677 WS.CLOSING = 2;
21678 WS.CLOSED = 3;
21679 return WS;
21680}(EventTarget("open", "error", "message", "close"));
21681var WechatWS = /** @class */function (_super) {
21682 __extends(WechatWS, _super);
21683 function WechatWS(url, protocol) {
21684 var _this = _super.call(this, url, protocol) || this;
21685 if (protocol && !(wx.canIUse && wx.canIUse("connectSocket.object.protocols"))) {
21686 throw new Error("subprotocol not supported in weapp");
21687 }
21688 _this._readyState = WS.CONNECTING;
21689 var errorHandler = function errorHandler(event) {
21690 _this._readyState = WS.CLOSED;
21691 _this.dispatchEvent({
21692 type: "error",
21693 message: event.errMsg
21694 });
21695 };
21696 var socketTask = wx.connectSocket({
21697 url: url,
21698 protocols: _this._protocol === undefined || Array.isArray(_this._protocol) ? _this._protocol : [_this._protocol],
21699 fail: function fail(error) {
21700 return setTimeout(function () {
21701 return errorHandler(error);
21702 }, 0);
21703 }
21704 });
21705 _this._socketTask = socketTask;
21706 socketTask.onOpen(function () {
21707 _this._readyState = WS.OPEN;
21708 _this.dispatchEvent({
21709 type: "open"
21710 });
21711 });
21712 socketTask.onError(errorHandler);
21713 socketTask.onMessage(function (event) {
21714 var data = event.data;
21715 _this.dispatchEvent({
21716 data: data,
21717 type: "message"
21718 });
21719 });
21720 socketTask.onClose(function (event) {
21721 _this._readyState = WS.CLOSED;
21722 var code = event.code,
21723 reason = event.reason;
21724 _this.dispatchEvent({
21725 code: code,
21726 reason: reason,
21727 type: "close"
21728 });
21729 });
21730 return _this;
21731 }
21732 WechatWS.prototype.close = function () {
21733 if (this.readyState === WS.CLOSED) return;
21734 if (this.readyState === WS.CONNECTING) {
21735 console.warn("close WebSocket which is connecting might not work");
21736 }
21737 this._socketTask.close({});
21738 };
21739 WechatWS.prototype.send = function (data) {
21740 if (this.readyState !== WS.OPEN) {
21741 throw new Error("INVALID_STATE_ERR");
21742 }
21743 if (!(typeof data === "string" || data instanceof ArrayBuffer)) {
21744 throw new TypeError("only String/ArrayBuffer supported");
21745 }
21746 this._socketTask.send({
21747 data: data
21748 });
21749 };
21750 return WechatWS;
21751}(WS);
21752var WebSocket = WechatWS;
21753
21754var platformInfo = {
21755 name: "Weapp"
21756};
21757
21758exports.WebSocket = WebSocket;
21759exports.getAuthInfo = getAuthInfo;
21760exports.platformInfo = platformInfo;
21761exports.request = request;
21762exports.storage = storage;
21763exports.upload = upload;
21764//# sourceMappingURL=index.js.map
21765
21766/***/ }),
21767/* 344 */
21768/***/ (function(module, exports, __webpack_require__) {
21769
21770module.exports = { "default": __webpack_require__(345), __esModule: true };
21771
21772/***/ }),
21773/* 345 */
21774/***/ (function(module, exports, __webpack_require__) {
21775
21776__webpack_require__(57);
21777__webpack_require__(42);
21778__webpack_require__(34);
21779__webpack_require__(346);
21780__webpack_require__(350);
21781__webpack_require__(353);
21782__webpack_require__(354);
21783module.exports = __webpack_require__(2).Map;
21784
21785
21786/***/ }),
21787/* 346 */
21788/***/ (function(module, exports, __webpack_require__) {
21789
21790"use strict";
21791
21792var strong = __webpack_require__(347);
21793var validate = __webpack_require__(56);
21794var MAP = 'Map';
21795
21796// 23.1 Map Objects
21797module.exports = __webpack_require__(180)(MAP, function (get) {
21798 return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
21799}, {
21800 // 23.1.3.6 Map.prototype.get(key)
21801 get: function get(key) {
21802 var entry = strong.getEntry(validate(this, MAP), key);
21803 return entry && entry.v;
21804 },
21805 // 23.1.3.9 Map.prototype.set(key, value)
21806 set: function set(key, value) {
21807 return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
21808 }
21809}, strong, true);
21810
21811
21812/***/ }),
21813/* 347 */
21814/***/ (function(module, exports, __webpack_require__) {
21815
21816"use strict";
21817
21818var dP = __webpack_require__(20).f;
21819var create = __webpack_require__(59);
21820var redefineAll = __webpack_require__(63);
21821var ctx = __webpack_require__(22);
21822var anInstance = __webpack_require__(62);
21823var forOf = __webpack_require__(35);
21824var $iterDefine = __webpack_require__(72);
21825var step = __webpack_require__(109);
21826var setSpecies = __webpack_require__(115);
21827var DESCRIPTORS = __webpack_require__(19);
21828var fastKey = __webpack_require__(55).fastKey;
21829var validate = __webpack_require__(56);
21830var SIZE = DESCRIPTORS ? '_s' : 'size';
21831
21832var getEntry = function (that, key) {
21833 // fast case
21834 var index = fastKey(key);
21835 var entry;
21836 if (index !== 'F') return that._i[index];
21837 // frozen object case
21838 for (entry = that._f; entry; entry = entry.n) {
21839 if (entry.k == key) return entry;
21840 }
21841};
21842
21843module.exports = {
21844 getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
21845 var C = wrapper(function (that, iterable) {
21846 anInstance(that, C, NAME, '_i');
21847 that._t = NAME; // collection type
21848 that._i = create(null); // index
21849 that._f = undefined; // first entry
21850 that._l = undefined; // last entry
21851 that[SIZE] = 0; // size
21852 if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
21853 });
21854 redefineAll(C.prototype, {
21855 // 23.1.3.1 Map.prototype.clear()
21856 // 23.2.3.2 Set.prototype.clear()
21857 clear: function clear() {
21858 for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
21859 entry.r = true;
21860 if (entry.p) entry.p = entry.p.n = undefined;
21861 delete data[entry.i];
21862 }
21863 that._f = that._l = undefined;
21864 that[SIZE] = 0;
21865 },
21866 // 23.1.3.3 Map.prototype.delete(key)
21867 // 23.2.3.4 Set.prototype.delete(value)
21868 'delete': function (key) {
21869 var that = validate(this, NAME);
21870 var entry = getEntry(that, key);
21871 if (entry) {
21872 var next = entry.n;
21873 var prev = entry.p;
21874 delete that._i[entry.i];
21875 entry.r = true;
21876 if (prev) prev.n = next;
21877 if (next) next.p = prev;
21878 if (that._f == entry) that._f = next;
21879 if (that._l == entry) that._l = prev;
21880 that[SIZE]--;
21881 } return !!entry;
21882 },
21883 // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
21884 // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
21885 forEach: function forEach(callbackfn /* , that = undefined */) {
21886 validate(this, NAME);
21887 var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
21888 var entry;
21889 while (entry = entry ? entry.n : this._f) {
21890 f(entry.v, entry.k, this);
21891 // revert to the last existing entry
21892 while (entry && entry.r) entry = entry.p;
21893 }
21894 },
21895 // 23.1.3.7 Map.prototype.has(key)
21896 // 23.2.3.7 Set.prototype.has(value)
21897 has: function has(key) {
21898 return !!getEntry(validate(this, NAME), key);
21899 }
21900 });
21901 if (DESCRIPTORS) dP(C.prototype, 'size', {
21902 get: function () {
21903 return validate(this, NAME)[SIZE];
21904 }
21905 });
21906 return C;
21907 },
21908 def: function (that, key, value) {
21909 var entry = getEntry(that, key);
21910 var prev, index;
21911 // change existing entry
21912 if (entry) {
21913 entry.v = value;
21914 // create new entry
21915 } else {
21916 that._l = entry = {
21917 i: index = fastKey(key, true), // <- index
21918 k: key, // <- key
21919 v: value, // <- value
21920 p: prev = that._l, // <- previous entry
21921 n: undefined, // <- next entry
21922 r: false // <- removed
21923 };
21924 if (!that._f) that._f = entry;
21925 if (prev) prev.n = entry;
21926 that[SIZE]++;
21927 // add to index
21928 if (index !== 'F') that._i[index] = entry;
21929 } return that;
21930 },
21931 getEntry: getEntry,
21932 setStrong: function (C, NAME, IS_MAP) {
21933 // add .keys, .values, .entries, [@@iterator]
21934 // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
21935 $iterDefine(C, NAME, function (iterated, kind) {
21936 this._t = validate(iterated, NAME); // target
21937 this._k = kind; // kind
21938 this._l = undefined; // previous
21939 }, function () {
21940 var that = this;
21941 var kind = that._k;
21942 var entry = that._l;
21943 // revert to the last existing entry
21944 while (entry && entry.r) entry = entry.p;
21945 // get next entry
21946 if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
21947 // or finish the iteration
21948 that._t = undefined;
21949 return step(1);
21950 }
21951 // return step by kind
21952 if (kind == 'keys') return step(0, entry.k);
21953 if (kind == 'values') return step(0, entry.v);
21954 return step(0, [entry.k, entry.v]);
21955 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
21956
21957 // add [@@species], 23.1.2.2, 23.2.2.2
21958 setSpecies(NAME);
21959 }
21960};
21961
21962
21963/***/ }),
21964/* 348 */
21965/***/ (function(module, exports, __webpack_require__) {
21966
21967// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
21968var speciesConstructor = __webpack_require__(349);
21969
21970module.exports = function (original, length) {
21971 return new (speciesConstructor(original))(length);
21972};
21973
21974
21975/***/ }),
21976/* 349 */
21977/***/ (function(module, exports, __webpack_require__) {
21978
21979var isObject = __webpack_require__(10);
21980var isArray = __webpack_require__(173);
21981var SPECIES = __webpack_require__(7)('species');
21982
21983module.exports = function (original) {
21984 var C;
21985 if (isArray(original)) {
21986 C = original.constructor;
21987 // cross-realm fallback
21988 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
21989 if (isObject(C)) {
21990 C = C[SPECIES];
21991 if (C === null) C = undefined;
21992 }
21993 } return C === undefined ? Array : C;
21994};
21995
21996
21997/***/ }),
21998/* 350 */
21999/***/ (function(module, exports, __webpack_require__) {
22000
22001// https://github.com/DavidBruant/Map-Set.prototype.toJSON
22002var $export = __webpack_require__(8);
22003
22004$export($export.P + $export.R, 'Map', { toJSON: __webpack_require__(351)('Map') });
22005
22006
22007/***/ }),
22008/* 351 */
22009/***/ (function(module, exports, __webpack_require__) {
22010
22011// https://github.com/DavidBruant/Map-Set.prototype.toJSON
22012var classof = __webpack_require__(61);
22013var from = __webpack_require__(352);
22014module.exports = function (NAME) {
22015 return function toJSON() {
22016 if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
22017 return from(this);
22018 };
22019};
22020
22021
22022/***/ }),
22023/* 352 */
22024/***/ (function(module, exports, __webpack_require__) {
22025
22026var forOf = __webpack_require__(35);
22027
22028module.exports = function (iter, ITERATOR) {
22029 var result = [];
22030 forOf(iter, false, result.push, result, ITERATOR);
22031 return result;
22032};
22033
22034
22035/***/ }),
22036/* 353 */
22037/***/ (function(module, exports, __webpack_require__) {
22038
22039// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
22040__webpack_require__(181)('Map');
22041
22042
22043/***/ }),
22044/* 354 */
22045/***/ (function(module, exports, __webpack_require__) {
22046
22047// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
22048__webpack_require__(182)('Map');
22049
22050
22051/***/ }),
22052/* 355 */
22053/***/ (function(module, exports, __webpack_require__) {
22054
22055module.exports = { "default": __webpack_require__(356), __esModule: true };
22056
22057/***/ }),
22058/* 356 */
22059/***/ (function(module, exports, __webpack_require__) {
22060
22061__webpack_require__(57);
22062__webpack_require__(34);
22063__webpack_require__(357);
22064__webpack_require__(359);
22065__webpack_require__(360);
22066module.exports = __webpack_require__(2).WeakMap;
22067
22068
22069/***/ }),
22070/* 357 */
22071/***/ (function(module, exports, __webpack_require__) {
22072
22073"use strict";
22074
22075var global = __webpack_require__(5);
22076var each = __webpack_require__(104)(0);
22077var redefine = __webpack_require__(75);
22078var meta = __webpack_require__(55);
22079var assign = __webpack_require__(183);
22080var weak = __webpack_require__(358);
22081var isObject = __webpack_require__(10);
22082var validate = __webpack_require__(56);
22083var NATIVE_WEAK_MAP = __webpack_require__(56);
22084var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
22085var WEAK_MAP = 'WeakMap';
22086var getWeak = meta.getWeak;
22087var isExtensible = Object.isExtensible;
22088var uncaughtFrozenStore = weak.ufstore;
22089var InternalMap;
22090
22091var wrapper = function (get) {
22092 return function WeakMap() {
22093 return get(this, arguments.length > 0 ? arguments[0] : undefined);
22094 };
22095};
22096
22097var methods = {
22098 // 23.3.3.3 WeakMap.prototype.get(key)
22099 get: function get(key) {
22100 if (isObject(key)) {
22101 var data = getWeak(key);
22102 if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
22103 return data ? data[this._i] : undefined;
22104 }
22105 },
22106 // 23.3.3.5 WeakMap.prototype.set(key, value)
22107 set: function set(key, value) {
22108 return weak.def(validate(this, WEAK_MAP), key, value);
22109 }
22110};
22111
22112// 23.3 WeakMap Objects
22113var $WeakMap = module.exports = __webpack_require__(180)(WEAK_MAP, wrapper, methods, weak, true, true);
22114
22115// IE11 WeakMap frozen keys fix
22116if (NATIVE_WEAK_MAP && IS_IE11) {
22117 InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
22118 assign(InternalMap.prototype, methods);
22119 meta.NEED = true;
22120 each(['delete', 'has', 'get', 'set'], function (key) {
22121 var proto = $WeakMap.prototype;
22122 var method = proto[key];
22123 redefine(proto, key, function (a, b) {
22124 // store frozen objects on internal weakmap shim
22125 if (isObject(a) && !isExtensible(a)) {
22126 if (!this._f) this._f = new InternalMap();
22127 var result = this._f[key](a, b);
22128 return key == 'set' ? this : result;
22129 // store all the rest on native weakmap
22130 } return method.call(this, a, b);
22131 });
22132 });
22133}
22134
22135
22136/***/ }),
22137/* 358 */
22138/***/ (function(module, exports, __webpack_require__) {
22139
22140"use strict";
22141
22142var redefineAll = __webpack_require__(63);
22143var getWeak = __webpack_require__(55).getWeak;
22144var anObject = __webpack_require__(18);
22145var isObject = __webpack_require__(10);
22146var anInstance = __webpack_require__(62);
22147var forOf = __webpack_require__(35);
22148var createArrayMethod = __webpack_require__(104);
22149var $has = __webpack_require__(24);
22150var validate = __webpack_require__(56);
22151var arrayFind = createArrayMethod(5);
22152var arrayFindIndex = createArrayMethod(6);
22153var id = 0;
22154
22155// fallback for uncaught frozen keys
22156var uncaughtFrozenStore = function (that) {
22157 return that._l || (that._l = new UncaughtFrozenStore());
22158};
22159var UncaughtFrozenStore = function () {
22160 this.a = [];
22161};
22162var findUncaughtFrozen = function (store, key) {
22163 return arrayFind(store.a, function (it) {
22164 return it[0] === key;
22165 });
22166};
22167UncaughtFrozenStore.prototype = {
22168 get: function (key) {
22169 var entry = findUncaughtFrozen(this, key);
22170 if (entry) return entry[1];
22171 },
22172 has: function (key) {
22173 return !!findUncaughtFrozen(this, key);
22174 },
22175 set: function (key, value) {
22176 var entry = findUncaughtFrozen(this, key);
22177 if (entry) entry[1] = value;
22178 else this.a.push([key, value]);
22179 },
22180 'delete': function (key) {
22181 var index = arrayFindIndex(this.a, function (it) {
22182 return it[0] === key;
22183 });
22184 if (~index) this.a.splice(index, 1);
22185 return !!~index;
22186 }
22187};
22188
22189module.exports = {
22190 getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
22191 var C = wrapper(function (that, iterable) {
22192 anInstance(that, C, NAME, '_i');
22193 that._t = NAME; // collection type
22194 that._i = id++; // collection id
22195 that._l = undefined; // leak store for uncaught frozen objects
22196 if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
22197 });
22198 redefineAll(C.prototype, {
22199 // 23.3.3.2 WeakMap.prototype.delete(key)
22200 // 23.4.3.3 WeakSet.prototype.delete(value)
22201 'delete': function (key) {
22202 if (!isObject(key)) return false;
22203 var data = getWeak(key);
22204 if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
22205 return data && $has(data, this._i) && delete data[this._i];
22206 },
22207 // 23.3.3.4 WeakMap.prototype.has(key)
22208 // 23.4.3.4 WeakSet.prototype.has(value)
22209 has: function has(key) {
22210 if (!isObject(key)) return false;
22211 var data = getWeak(key);
22212 if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
22213 return data && $has(data, this._i);
22214 }
22215 });
22216 return C;
22217 },
22218 def: function (that, key, value) {
22219 var data = getWeak(anObject(key), true);
22220 if (data === true) uncaughtFrozenStore(that).set(key, value);
22221 else data[that._i] = value;
22222 return that;
22223 },
22224 ufstore: uncaughtFrozenStore
22225};
22226
22227
22228/***/ }),
22229/* 359 */
22230/***/ (function(module, exports, __webpack_require__) {
22231
22232// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of
22233__webpack_require__(181)('WeakMap');
22234
22235
22236/***/ }),
22237/* 360 */
22238/***/ (function(module, exports, __webpack_require__) {
22239
22240// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from
22241__webpack_require__(182)('WeakMap');
22242
22243
22244/***/ }),
22245/* 361 */
22246/***/ (function(module, exports, __webpack_require__) {
22247
22248module.exports = { "default": __webpack_require__(362), __esModule: true };
22249
22250/***/ }),
22251/* 362 */
22252/***/ (function(module, exports, __webpack_require__) {
22253
22254__webpack_require__(172);
22255module.exports = __webpack_require__(2).Object.getOwnPropertySymbols;
22256
22257
22258/***/ }),
22259/* 363 */
22260/***/ (function(module, exports, __webpack_require__) {
22261
22262module.exports = { "default": __webpack_require__(364), __esModule: true };
22263
22264/***/ }),
22265/* 364 */
22266/***/ (function(module, exports, __webpack_require__) {
22267
22268__webpack_require__(365);
22269module.exports = __webpack_require__(2).Object.assign;
22270
22271
22272/***/ }),
22273/* 365 */
22274/***/ (function(module, exports, __webpack_require__) {
22275
22276// 19.1.3.1 Object.assign(target, source)
22277var $export = __webpack_require__(8);
22278
22279$export($export.S + $export.F, 'Object', { assign: __webpack_require__(183) });
22280
22281
22282/***/ })
22283/******/ ]);
22284});
22285//# sourceMappingURL=av-weapp.js.map
\No newline at end of file