UNPKG

765 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 = 171);
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__(194);
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__(74);
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__(109)))
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__(174), __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__(26);
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__(22);
344/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(120);
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, __webpack_exports__, __webpack_require__) {
366
367"use strict";
368/* harmony export (immutable) */ __webpack_exports__["a"] = tagTester;
369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
370
371
372// Internal function for creating a `toString`-based type tester.
373function tagTester(name) {
374 var tag = '[object ' + name + ']';
375 return function(obj) {
376 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag;
377 };
378}
379
380
381/***/ }),
382/* 6 */
383/***/ (function(module, exports) {
384
385// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
386var global = module.exports = typeof window != 'undefined' && window.Math == Math
387 ? window : typeof self != 'undefined' && self.Math == Math ? self
388 // eslint-disable-next-line no-new-func
389 : Function('return this')();
390if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
391
392
393/***/ }),
394/* 7 */
395/***/ (function(module, exports, __webpack_require__) {
396
397var store = __webpack_require__(69)('wks');
398var uid = __webpack_require__(54);
399var Symbol = __webpack_require__(6).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, __webpack_exports__, __webpack_require__) {
413
414"use strict";
415/* harmony export (immutable) */ __webpack_exports__["a"] = cb;
416/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
417/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(130);
418/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(131);
419
420
421
422
423// The function we call internally to generate a callback. It invokes
424// `_.iteratee` if overridden, otherwise `baseIteratee`.
425function cb(value, context, argCount) {
426 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);
427 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount);
428}
429
430
431/***/ }),
432/* 9 */
433/***/ (function(module, __webpack_exports__, __webpack_require__) {
434
435"use strict";
436/* harmony export (immutable) */ __webpack_exports__["a"] = restArguments;
437// Some functions take a variable number of arguments, or a few expected
438// arguments at the beginning and then a variable number of values to operate
439// on. This helper accumulates all remaining arguments past the function’s
440// argument length (or an explicit `startIndex`), into an array that becomes
441// the last argument. Similar to ES6’s "rest parameter".
442function restArguments(func, startIndex) {
443 startIndex = startIndex == null ? func.length - 1 : +startIndex;
444 return function() {
445 var length = Math.max(arguments.length - startIndex, 0),
446 rest = Array(length),
447 index = 0;
448 for (; index < length; index++) {
449 rest[index] = arguments[index + startIndex];
450 }
451 switch (startIndex) {
452 case 0: return func.call(this, rest);
453 case 1: return func.call(this, arguments[0], rest);
454 case 2: return func.call(this, arguments[0], arguments[1], rest);
455 }
456 var args = Array(startIndex + 1);
457 for (index = 0; index < startIndex; index++) {
458 args[index] = arguments[index];
459 }
460 args[startIndex] = rest;
461 return func.apply(this, args);
462 };
463}
464
465
466/***/ }),
467/* 10 */
468/***/ (function(module, __webpack_exports__, __webpack_require__) {
469
470"use strict";
471/* harmony export (immutable) */ __webpack_exports__["a"] = _;
472/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
473
474
475// If Underscore is called as a function, it returns a wrapped object that can
476// be used OO-style. This wrapper holds altered versions of all functions added
477// through `_.mixin`. Wrapped objects may be chained.
478function _(obj) {
479 if (obj instanceof _) return obj;
480 if (!(this instanceof _)) return new _(obj);
481 this._wrapped = obj;
482}
483
484_.VERSION = __WEBPACK_IMPORTED_MODULE_0__setup_js__["e" /* VERSION */];
485
486// Extracts the result from a wrapped and chained object.
487_.prototype.value = function() {
488 return this._wrapped;
489};
490
491// Provide unwrapping proxies for some methods used in engine operations
492// such as arithmetic and JSON stringification.
493_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
494
495_.prototype.toString = function() {
496 return String(this._wrapped);
497};
498
499
500/***/ }),
501/* 11 */
502/***/ (function(module, __webpack_exports__, __webpack_require__) {
503
504"use strict";
505/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(118);
506/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
507
508
509
510// Internal helper for collection methods to determine whether a collection
511// should be iterated as an array or as an object.
512// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
513// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
514/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]));
515
516
517/***/ }),
518/* 12 */
519/***/ (function(module, exports, __webpack_require__) {
520
521"use strict";
522
523
524var _promise = __webpack_require__(3);
525
526var _promise2 = _interopRequireDefault(_promise);
527
528function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
529
530var _ = __webpack_require__(0);
531var md5 = __webpack_require__(312);
532
533var _require = __webpack_require__(0),
534 extend = _require.extend;
535
536var AV = __webpack_require__(36);
537
538var _require2 = __webpack_require__(15),
539 getSessionToken = _require2.getSessionToken;
540
541var ajax = __webpack_require__(60);
542
543// 计算 X-LC-Sign 的签名方法
544var sign = function sign(key, isMasterKey) {
545 var now = new Date().getTime();
546 var signature = md5(now + key);
547 if (isMasterKey) {
548 return signature + ',' + now + ',master';
549 }
550 return signature + ',' + now;
551};
552
553var setAppKey = function setAppKey(headers, signKey) {
554 if (signKey) {
555 headers['X-LC-Sign'] = sign(AV.applicationKey);
556 } else {
557 headers['X-LC-Key'] = AV.applicationKey;
558 }
559};
560
561var setHeaders = function setHeaders() {
562 var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
563 var signKey = arguments[1];
564
565 var headers = {
566 'X-LC-Id': AV.applicationId,
567 'Content-Type': 'application/json;charset=UTF-8'
568 };
569 var useMasterKey = false;
570 if (typeof authOptions.useMasterKey === 'boolean') {
571 useMasterKey = authOptions.useMasterKey;
572 } else if (typeof AV._config.useMasterKey === 'boolean') {
573 useMasterKey = AV._config.useMasterKey;
574 }
575 if (useMasterKey) {
576 if (AV.masterKey) {
577 if (signKey) {
578 headers['X-LC-Sign'] = sign(AV.masterKey, true);
579 } else {
580 headers['X-LC-Key'] = AV.masterKey + ',master';
581 }
582 } else {
583 console.warn('masterKey is not set, fall back to use appKey');
584 setAppKey(headers, signKey);
585 }
586 } else {
587 setAppKey(headers, signKey);
588 }
589 if (AV.hookKey) {
590 headers['X-LC-Hook-Key'] = AV.hookKey;
591 }
592 if (AV._config.production !== null) {
593 headers['X-LC-Prod'] = String(AV._config.production);
594 }
595 headers[ false ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
596
597 return _promise2.default.resolve().then(function () {
598 // Pass the session token
599 var sessionToken = getSessionToken(authOptions);
600 if (sessionToken) {
601 headers['X-LC-Session'] = sessionToken;
602 } else if (!AV._config.disableCurrentUser) {
603 return AV.User.currentAsync().then(function (currentUser) {
604 if (currentUser && currentUser._sessionToken) {
605 headers['X-LC-Session'] = currentUser._sessionToken;
606 }
607 return headers;
608 });
609 }
610 return headers;
611 });
612};
613
614var createApiUrl = function createApiUrl(_ref) {
615 var _ref$service = _ref.service,
616 service = _ref$service === undefined ? 'api' : _ref$service,
617 _ref$version = _ref.version,
618 version = _ref$version === undefined ? '1.1' : _ref$version,
619 path = _ref.path;
620
621 var apiURL = AV._config.serverURLs[service];
622
623 if (!apiURL) throw new Error('undefined server URL for ' + service);
624
625 if (apiURL.charAt(apiURL.length - 1) !== '/') {
626 apiURL += '/';
627 }
628 apiURL += version;
629 if (path) {
630 apiURL += path;
631 }
632
633 return apiURL;
634};
635
636/**
637 * Low level REST API client. Call REST endpoints with authorization headers.
638 * @function AV.request
639 * @since 3.0.0
640 * @param {Object} options
641 * @param {String} options.method HTTP method
642 * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
643 * @param {Object} [options.query] query string dict
644 * @param {Object} [options.data] HTTP body
645 * @param {AuthOptions} [options.authOptions]
646 * @param {String} [options.service = 'api']
647 * @param {String} [options.version = '1.1']
648 */
649var request = function request(_ref2) {
650 var service = _ref2.service,
651 version = _ref2.version,
652 method = _ref2.method,
653 path = _ref2.path,
654 query = _ref2.query,
655 data = _ref2.data,
656 authOptions = _ref2.authOptions,
657 _ref2$signKey = _ref2.signKey,
658 signKey = _ref2$signKey === undefined ? true : _ref2$signKey;
659
660 if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
661 throw new Error('Not initialized');
662 }
663 if (AV._appRouter) {
664 AV._appRouter.refresh();
665 }
666 var timeout = AV._config.requestTimeout;
667
668 var url = createApiUrl({ service: service, path: path, version: version });
669 return setHeaders(authOptions, signKey).then(function (headers) {
670 return ajax({ method: method, url: url, query: query, data: data, headers: headers, timeout: timeout }).catch(function (error) {
671 var errorJSON = {
672 code: error.code || -1,
673 error: error.message || error.responseText
674 };
675 if (error.response && error.response.code) {
676 errorJSON = error.response;
677 } else if (error.responseText) {
678 try {
679 errorJSON = JSON.parse(error.responseText);
680 } catch (e) {
681 // If we fail to parse the error text, that's okay.
682 }
683 }
684 errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
685 if (!AV._sharedConfig.keepErrorRawMessage) {
686 errorJSON.error += ' [' + (error.statusCode || 'N/A') + ' ' + method + ' ' + url + ']';
687 }
688 // Transform the error into an instance of AVError by trying to parse
689 // the error string as JSON.
690 var err = new Error(errorJSON.error);
691 delete errorJSON.error;
692 throw _.extend(err, errorJSON);
693 });
694 });
695};
696
697// lagecy request
698var _request = function _request(route, className, objectId, method, data, authOptions, query) {
699 var path = '';
700 if (route) path += '/' + route;
701 if (className) path += '/' + className;
702 if (objectId) path += '/' + objectId;
703 // for migeration
704 if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
705 if (data && data._where) throw new Error('_where should be in the query');
706 if (method && method.toLowerCase() === 'get') {
707 query = extend({}, query, data);
708 data = null;
709 }
710 return request({
711 method: method,
712 path: path,
713 query: query,
714 data: data,
715 authOptions: authOptions
716 });
717};
718
719AV.request = request;
720
721module.exports = {
722 _request: _request,
723 request: request
724};
725
726/***/ }),
727/* 13 */
728/***/ (function(module, __webpack_exports__, __webpack_require__) {
729
730"use strict";
731/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
732/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
733
734
735
736var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
737
738// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
739// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
740var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
741if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
742 isFunction = function(obj) {
743 return typeof obj == 'function' || false;
744 };
745}
746
747/* harmony default export */ __webpack_exports__["a"] = (isFunction);
748
749
750/***/ }),
751/* 14 */
752/***/ (function(module, __webpack_exports__, __webpack_require__) {
753
754"use strict";
755/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(119);
756
757
758// Internal helper to obtain the `length` property of an object.
759/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
760
761
762/***/ }),
763/* 15 */
764/***/ (function(module, exports, __webpack_require__) {
765
766"use strict";
767
768
769var _promise = __webpack_require__(3);
770
771var _promise2 = _interopRequireDefault(_promise);
772
773var _getPrototypeOf = __webpack_require__(160);
774
775var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
776
777function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
778
779var _ = __webpack_require__(0);
780
781// Helper function to check null or undefined.
782var isNullOrUndefined = function isNullOrUndefined(x) {
783 return _.isNull(x) || _.isUndefined(x);
784};
785
786var ensureArray = function ensureArray(target) {
787 if (_.isArray(target)) {
788 return target;
789 }
790 if (target === undefined || target === null) {
791 return [];
792 }
793 return [target];
794};
795
796var transformFetchOptions = function transformFetchOptions() {
797 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
798 keys = _ref.keys,
799 include = _ref.include,
800 includeACL = _ref.includeACL;
801
802 var fetchOptions = {};
803 if (keys) {
804 fetchOptions.keys = ensureArray(keys).join(',');
805 }
806 if (include) {
807 fetchOptions.include = ensureArray(include).join(',');
808 }
809 if (includeACL) {
810 fetchOptions.returnACL = includeACL;
811 }
812 return fetchOptions;
813};
814
815var getSessionToken = function getSessionToken(authOptions) {
816 if (authOptions.sessionToken) {
817 return authOptions.sessionToken;
818 }
819 if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
820 return authOptions.user.getSessionToken();
821 }
822};
823
824var tap = function tap(interceptor) {
825 return function (value) {
826 return interceptor(value), value;
827 };
828};
829
830// Shared empty constructor function to aid in prototype-chain creation.
831var EmptyConstructor = function EmptyConstructor() {};
832
833// Helper function to correctly set up the prototype chain, for subclasses.
834// Similar to `goog.inherits`, but uses a hash of prototype properties and
835// class properties to be extended.
836var inherits = function inherits(parent, protoProps, staticProps) {
837 var child;
838
839 // The constructor function for the new subclass is either defined by you
840 // (the "constructor" property in your `extend` definition), or defaulted
841 // by us to simply call the parent's constructor.
842 if (protoProps && protoProps.hasOwnProperty('constructor')) {
843 child = protoProps.constructor;
844 } else {
845 /** @ignore */
846 child = function child() {
847 parent.apply(this, arguments);
848 };
849 }
850
851 // Inherit class (static) properties from parent.
852 _.extend(child, parent);
853
854 // Set the prototype chain to inherit from `parent`, without calling
855 // `parent`'s constructor function.
856 EmptyConstructor.prototype = parent.prototype;
857 child.prototype = new EmptyConstructor();
858
859 // Add prototype properties (instance properties) to the subclass,
860 // if supplied.
861 if (protoProps) {
862 _.extend(child.prototype, protoProps);
863 }
864
865 // Add static properties to the constructor function, if supplied.
866 if (staticProps) {
867 _.extend(child, staticProps);
868 }
869
870 // Correctly set child's `prototype.constructor`.
871 child.prototype.constructor = child;
872
873 // Set a convenience property in case the parent's prototype is
874 // needed later.
875 child.__super__ = parent.prototype;
876
877 return child;
878};
879
880var parseDate = function parseDate(iso8601) {
881 return new Date(iso8601);
882};
883
884var setValue = function setValue(target, key, value) {
885 // '.' is not allowed in Class keys, escaping is not in concern now.
886 var segs = key.split('.');
887 var lastSeg = segs.pop();
888 var currentTarget = target;
889 segs.forEach(function (seg) {
890 if (currentTarget[seg] === undefined) currentTarget[seg] = {};
891 currentTarget = currentTarget[seg];
892 });
893 currentTarget[lastSeg] = value;
894 return target;
895};
896
897var findValue = function findValue(target, key) {
898 var segs = key.split('.');
899 var firstSeg = segs[0];
900 var lastSeg = segs.pop();
901 var currentTarget = target;
902 for (var i = 0; i < segs.length; i++) {
903 currentTarget = currentTarget[segs[i]];
904 if (currentTarget === undefined) {
905 return [undefined, undefined, lastSeg];
906 }
907 }
908 var value = currentTarget[lastSeg];
909 return [value, currentTarget, lastSeg, firstSeg];
910};
911
912var isPlainObject = function isPlainObject(obj) {
913 return _.isObject(obj) && (0, _getPrototypeOf2.default)(obj) === Object.prototype;
914};
915
916var continueWhile = function continueWhile(predicate, asyncFunction) {
917 if (predicate()) {
918 return asyncFunction().then(function () {
919 return continueWhile(predicate, asyncFunction);
920 });
921 }
922 return _promise2.default.resolve();
923};
924
925module.exports = {
926 isNullOrUndefined: isNullOrUndefined,
927 ensureArray: ensureArray,
928 transformFetchOptions: transformFetchOptions,
929 getSessionToken: getSessionToken,
930 tap: tap,
931 inherits: inherits,
932 parseDate: parseDate,
933 setValue: setValue,
934 findValue: findValue,
935 isPlainObject: isPlainObject,
936 continueWhile: continueWhile
937};
938
939/***/ }),
940/* 16 */
941/***/ (function(module, exports, __webpack_require__) {
942
943var global = __webpack_require__(6);
944var core = __webpack_require__(2);
945var ctx = __webpack_require__(31);
946var hide = __webpack_require__(23);
947var has = __webpack_require__(24);
948var PROTOTYPE = 'prototype';
949
950var $export = function (type, name, source) {
951 var IS_FORCED = type & $export.F;
952 var IS_GLOBAL = type & $export.G;
953 var IS_STATIC = type & $export.S;
954 var IS_PROTO = type & $export.P;
955 var IS_BIND = type & $export.B;
956 var IS_WRAP = type & $export.W;
957 var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
958 var expProto = exports[PROTOTYPE];
959 var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
960 var key, own, out;
961 if (IS_GLOBAL) source = name;
962 for (key in source) {
963 // contains in native
964 own = !IS_FORCED && target && target[key] !== undefined;
965 if (own && has(exports, key)) continue;
966 // export native or passed
967 out = own ? target[key] : source[key];
968 // prevent global pollution for namespaces
969 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
970 // bind timers to global for call from export context
971 : IS_BIND && own ? ctx(out, global)
972 // wrap global constructors for prevent change them in library
973 : IS_WRAP && target[key] == out ? (function (C) {
974 var F = function (a, b, c) {
975 if (this instanceof C) {
976 switch (arguments.length) {
977 case 0: return new C();
978 case 1: return new C(a);
979 case 2: return new C(a, b);
980 } return new C(a, b, c);
981 } return C.apply(this, arguments);
982 };
983 F[PROTOTYPE] = C[PROTOTYPE];
984 return F;
985 // make static versions for prototype methods
986 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
987 // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
988 if (IS_PROTO) {
989 (exports.virtual || (exports.virtual = {}))[key] = out;
990 // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
991 if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
992 }
993 }
994};
995// type bitmap
996$export.F = 1; // forced
997$export.G = 2; // global
998$export.S = 4; // static
999$export.P = 8; // proto
1000$export.B = 16; // bind
1001$export.W = 32; // wrap
1002$export.U = 64; // safe
1003$export.R = 128; // real proto method for `library`
1004module.exports = $export;
1005
1006
1007/***/ }),
1008/* 17 */
1009/***/ (function(module, exports, __webpack_require__) {
1010
1011var isObject = __webpack_require__(20);
1012module.exports = function (it) {
1013 if (!isObject(it)) throw TypeError(it + ' is not an object!');
1014 return it;
1015};
1016
1017
1018/***/ }),
1019/* 18 */
1020/***/ (function(module, exports, __webpack_require__) {
1021
1022var anObject = __webpack_require__(17);
1023var IE8_DOM_DEFINE = __webpack_require__(97);
1024var toPrimitive = __webpack_require__(65);
1025var dP = Object.defineProperty;
1026
1027exports.f = __webpack_require__(21) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
1028 anObject(O);
1029 P = toPrimitive(P, true);
1030 anObject(Attributes);
1031 if (IE8_DOM_DEFINE) try {
1032 return dP(O, P, Attributes);
1033 } catch (e) { /* empty */ }
1034 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
1035 if ('value' in Attributes) O[P] = Attributes.value;
1036 return O;
1037};
1038
1039
1040/***/ }),
1041/* 19 */
1042/***/ (function(module, exports, __webpack_require__) {
1043
1044module.exports = { "default": __webpack_require__(266), __esModule: true };
1045
1046/***/ }),
1047/* 20 */
1048/***/ (function(module, exports) {
1049
1050module.exports = function (it) {
1051 return typeof it === 'object' ? it !== null : typeof it === 'function';
1052};
1053
1054
1055/***/ }),
1056/* 21 */
1057/***/ (function(module, exports, __webpack_require__) {
1058
1059// Thank's IE8 for his funny defineProperty
1060module.exports = !__webpack_require__(41)(function () {
1061 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
1062});
1063
1064
1065/***/ }),
1066/* 22 */
1067/***/ (function(module, __webpack_exports__, __webpack_require__) {
1068
1069"use strict";
1070/* harmony export (immutable) */ __webpack_exports__["a"] = has;
1071/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
1072
1073
1074// Internal function to check whether `key` is an own property name of `obj`.
1075function has(obj, key) {
1076 return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
1077}
1078
1079
1080/***/ }),
1081/* 23 */
1082/***/ (function(module, exports, __webpack_require__) {
1083
1084var dP = __webpack_require__(18);
1085var createDesc = __webpack_require__(42);
1086module.exports = __webpack_require__(21) ? function (object, key, value) {
1087 return dP.f(object, key, createDesc(1, value));
1088} : function (object, key, value) {
1089 object[key] = value;
1090 return object;
1091};
1092
1093
1094/***/ }),
1095/* 24 */
1096/***/ (function(module, exports) {
1097
1098var hasOwnProperty = {}.hasOwnProperty;
1099module.exports = function (it, key) {
1100 return hasOwnProperty.call(it, key);
1101};
1102
1103
1104/***/ }),
1105/* 25 */
1106/***/ (function(module, exports, __webpack_require__) {
1107
1108// to indexed object, toObject with fallback for non-array-like ES3 strings
1109var IObject = __webpack_require__(178);
1110var defined = __webpack_require__(63);
1111module.exports = function (it) {
1112 return IObject(defined(it));
1113};
1114
1115
1116/***/ }),
1117/* 26 */
1118/***/ (function(module, __webpack_exports__, __webpack_require__) {
1119
1120"use strict";
1121/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
1122// Is a given variable an object?
1123function isObject(obj) {
1124 var type = typeof obj;
1125 return type === 'function' || type === 'object' && !!obj;
1126}
1127
1128
1129/***/ }),
1130/* 27 */
1131/***/ (function(module, __webpack_exports__, __webpack_require__) {
1132
1133"use strict";
1134/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
1135/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(5);
1136
1137
1138
1139// Is a given value an array?
1140// Delegates to ECMA5's native `Array.isArray`.
1141/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
1142
1143
1144/***/ }),
1145/* 28 */
1146/***/ (function(module, __webpack_exports__, __webpack_require__) {
1147
1148"use strict";
1149/* harmony export (immutable) */ __webpack_exports__["a"] = each;
1150/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(48);
1151/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
1152/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(4);
1153
1154
1155
1156
1157// The cornerstone for collection functions, an `each`
1158// implementation, aka `forEach`.
1159// Handles raw objects in addition to array-likes. Treats all
1160// sparse array-likes as if they were dense.
1161function each(obj, iteratee, context) {
1162 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
1163 var i, length;
1164 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
1165 for (i = 0, length = obj.length; i < length; i++) {
1166 iteratee(obj[i], i, obj);
1167 }
1168 } else {
1169 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
1170 for (i = 0, length = _keys.length; i < length; i++) {
1171 iteratee(obj[_keys[i]], _keys[i], obj);
1172 }
1173 }
1174 return obj;
1175}
1176
1177
1178/***/ }),
1179/* 29 */
1180/***/ (function(module, exports, __webpack_require__) {
1181
1182"use strict";
1183
1184
1185var _ = __webpack_require__(0);
1186
1187/**
1188 * @class AV.Error
1189 */
1190
1191function AVError(code, message) {
1192 var error = new Error(message);
1193 error.code = code;
1194 return error;
1195}
1196
1197_.extend(AVError,
1198/** @lends AV.Error */{
1199 /**
1200 * Error code indicating some error other than those enumerated here.
1201 * @constant
1202 */
1203 OTHER_CAUSE: -1,
1204
1205 /**
1206 * Error code indicating that something has gone wrong with the server.
1207 * If you get this error code, it is AV's fault. Contact us at
1208 * https://avoscloud.com/help
1209 * @constant
1210 */
1211 INTERNAL_SERVER_ERROR: 1,
1212
1213 /**
1214 * Error code indicating the connection to the AV servers failed.
1215 * @constant
1216 */
1217 CONNECTION_FAILED: 100,
1218
1219 /**
1220 * Error code indicating the specified object doesn't exist.
1221 * @constant
1222 */
1223 OBJECT_NOT_FOUND: 101,
1224
1225 /**
1226 * Error code indicating you tried to query with a datatype that doesn't
1227 * support it, like exact matching an array or object.
1228 * @constant
1229 */
1230 INVALID_QUERY: 102,
1231
1232 /**
1233 * Error code indicating a missing or invalid classname. Classnames are
1234 * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1235 * only valid characters.
1236 * @constant
1237 */
1238 INVALID_CLASS_NAME: 103,
1239
1240 /**
1241 * Error code indicating an unspecified object id.
1242 * @constant
1243 */
1244 MISSING_OBJECT_ID: 104,
1245
1246 /**
1247 * Error code indicating an invalid key name. Keys are case-sensitive. They
1248 * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1249 * @constant
1250 */
1251 INVALID_KEY_NAME: 105,
1252
1253 /**
1254 * Error code indicating a malformed pointer. You should not see this unless
1255 * you have been mucking about changing internal AV code.
1256 * @constant
1257 */
1258 INVALID_POINTER: 106,
1259
1260 /**
1261 * Error code indicating that badly formed JSON was received upstream. This
1262 * either indicates you have done something unusual with modifying how
1263 * things encode to JSON, or the network is failing badly.
1264 * @constant
1265 */
1266 INVALID_JSON: 107,
1267
1268 /**
1269 * Error code indicating that the feature you tried to access is only
1270 * available internally for testing purposes.
1271 * @constant
1272 */
1273 COMMAND_UNAVAILABLE: 108,
1274
1275 /**
1276 * You must call AV.initialize before using the AV library.
1277 * @constant
1278 */
1279 NOT_INITIALIZED: 109,
1280
1281 /**
1282 * Error code indicating that a field was set to an inconsistent type.
1283 * @constant
1284 */
1285 INCORRECT_TYPE: 111,
1286
1287 /**
1288 * Error code indicating an invalid channel name. A channel name is either
1289 * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1290 * characters.
1291 * @constant
1292 */
1293 INVALID_CHANNEL_NAME: 112,
1294
1295 /**
1296 * Error code indicating that push is misconfigured.
1297 * @constant
1298 */
1299 PUSH_MISCONFIGURED: 115,
1300
1301 /**
1302 * Error code indicating that the object is too large.
1303 * @constant
1304 */
1305 OBJECT_TOO_LARGE: 116,
1306
1307 /**
1308 * Error code indicating that the operation isn't allowed for clients.
1309 * @constant
1310 */
1311 OPERATION_FORBIDDEN: 119,
1312
1313 /**
1314 * Error code indicating the result was not found in the cache.
1315 * @constant
1316 */
1317 CACHE_MISS: 120,
1318
1319 /**
1320 * Error code indicating that an invalid key was used in a nested
1321 * JSONObject.
1322 * @constant
1323 */
1324 INVALID_NESTED_KEY: 121,
1325
1326 /**
1327 * Error code indicating that an invalid filename was used for AVFile.
1328 * A valid file name contains only a-zA-Z0-9_. characters and is between 1
1329 * and 128 characters.
1330 * @constant
1331 */
1332 INVALID_FILE_NAME: 122,
1333
1334 /**
1335 * Error code indicating an invalid ACL was provided.
1336 * @constant
1337 */
1338 INVALID_ACL: 123,
1339
1340 /**
1341 * Error code indicating that the request timed out on the server. Typically
1342 * this indicates that the request is too expensive to run.
1343 * @constant
1344 */
1345 TIMEOUT: 124,
1346
1347 /**
1348 * Error code indicating that the email address was invalid.
1349 * @constant
1350 */
1351 INVALID_EMAIL_ADDRESS: 125,
1352
1353 /**
1354 * Error code indicating a missing content type.
1355 * @constant
1356 */
1357 MISSING_CONTENT_TYPE: 126,
1358
1359 /**
1360 * Error code indicating a missing content length.
1361 * @constant
1362 */
1363 MISSING_CONTENT_LENGTH: 127,
1364
1365 /**
1366 * Error code indicating an invalid content length.
1367 * @constant
1368 */
1369 INVALID_CONTENT_LENGTH: 128,
1370
1371 /**
1372 * Error code indicating a file that was too large.
1373 * @constant
1374 */
1375 FILE_TOO_LARGE: 129,
1376
1377 /**
1378 * Error code indicating an error saving a file.
1379 * @constant
1380 */
1381 FILE_SAVE_ERROR: 130,
1382
1383 /**
1384 * Error code indicating an error deleting a file.
1385 * @constant
1386 */
1387 FILE_DELETE_ERROR: 153,
1388
1389 /**
1390 * Error code indicating that a unique field was given a value that is
1391 * already taken.
1392 * @constant
1393 */
1394 DUPLICATE_VALUE: 137,
1395
1396 /**
1397 * Error code indicating that a role's name is invalid.
1398 * @constant
1399 */
1400 INVALID_ROLE_NAME: 139,
1401
1402 /**
1403 * Error code indicating that an application quota was exceeded. Upgrade to
1404 * resolve.
1405 * @constant
1406 */
1407 EXCEEDED_QUOTA: 140,
1408
1409 /**
1410 * Error code indicating that a Cloud Code script failed.
1411 * @constant
1412 */
1413 SCRIPT_FAILED: 141,
1414
1415 /**
1416 * Error code indicating that a Cloud Code validation failed.
1417 * @constant
1418 */
1419 VALIDATION_ERROR: 142,
1420
1421 /**
1422 * Error code indicating that invalid image data was provided.
1423 * @constant
1424 */
1425 INVALID_IMAGE_DATA: 150,
1426
1427 /**
1428 * Error code indicating an unsaved file.
1429 * @constant
1430 */
1431 UNSAVED_FILE_ERROR: 151,
1432
1433 /**
1434 * Error code indicating an invalid push time.
1435 */
1436 INVALID_PUSH_TIME_ERROR: 152,
1437
1438 /**
1439 * Error code indicating that the username is missing or empty.
1440 * @constant
1441 */
1442 USERNAME_MISSING: 200,
1443
1444 /**
1445 * Error code indicating that the password is missing or empty.
1446 * @constant
1447 */
1448 PASSWORD_MISSING: 201,
1449
1450 /**
1451 * Error code indicating that the username has already been taken.
1452 * @constant
1453 */
1454 USERNAME_TAKEN: 202,
1455
1456 /**
1457 * Error code indicating that the email has already been taken.
1458 * @constant
1459 */
1460 EMAIL_TAKEN: 203,
1461
1462 /**
1463 * Error code indicating that the email is missing, but must be specified.
1464 * @constant
1465 */
1466 EMAIL_MISSING: 204,
1467
1468 /**
1469 * Error code indicating that a user with the specified email was not found.
1470 * @constant
1471 */
1472 EMAIL_NOT_FOUND: 205,
1473
1474 /**
1475 * Error code indicating that a user object without a valid session could
1476 * not be altered.
1477 * @constant
1478 */
1479 SESSION_MISSING: 206,
1480
1481 /**
1482 * Error code indicating that a user can only be created through signup.
1483 * @constant
1484 */
1485 MUST_CREATE_USER_THROUGH_SIGNUP: 207,
1486
1487 /**
1488 * Error code indicating that an an account being linked is already linked
1489 * to another user.
1490 * @constant
1491 */
1492 ACCOUNT_ALREADY_LINKED: 208,
1493
1494 /**
1495 * Error code indicating that a user cannot be linked to an account because
1496 * that account's id could not be found.
1497 * @constant
1498 */
1499 LINKED_ID_MISSING: 250,
1500
1501 /**
1502 * Error code indicating that a user with a linked (e.g. Facebook) account
1503 * has an invalid session.
1504 * @constant
1505 */
1506 INVALID_LINKED_SESSION: 251,
1507
1508 /**
1509 * Error code indicating that a service being linked (e.g. Facebook or
1510 * Twitter) is unsupported.
1511 * @constant
1512 */
1513 UNSUPPORTED_SERVICE: 252,
1514 /**
1515 * Error code indicating a real error code is unavailable because
1516 * we had to use an XDomainRequest object to allow CORS requests in
1517 * Internet Explorer, which strips the body from HTTP responses that have
1518 * a non-2XX status code.
1519 * @constant
1520 */
1521 X_DOMAIN_REQUEST: 602
1522});
1523
1524module.exports = AVError;
1525
1526/***/ }),
1527/* 30 */
1528/***/ (function(module, exports, __webpack_require__) {
1529
1530"use strict";
1531
1532
1533exports.__esModule = true;
1534
1535var _iterator = __webpack_require__(61);
1536
1537var _iterator2 = _interopRequireDefault(_iterator);
1538
1539var _symbol = __webpack_require__(51);
1540
1541var _symbol2 = _interopRequireDefault(_symbol);
1542
1543var _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; };
1544
1545function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1546
1547exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
1548 return typeof obj === "undefined" ? "undefined" : _typeof(obj);
1549} : function (obj) {
1550 return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
1551};
1552
1553/***/ }),
1554/* 31 */
1555/***/ (function(module, exports, __webpack_require__) {
1556
1557// optional / simple context binding
1558var aFunction = __webpack_require__(52);
1559module.exports = function (fn, that, length) {
1560 aFunction(fn);
1561 if (that === undefined) return fn;
1562 switch (length) {
1563 case 1: return function (a) {
1564 return fn.call(that, a);
1565 };
1566 case 2: return function (a, b) {
1567 return fn.call(that, a, b);
1568 };
1569 case 3: return function (a, b, c) {
1570 return fn.call(that, a, b, c);
1571 };
1572 }
1573 return function (/* ...args */) {
1574 return fn.apply(that, arguments);
1575 };
1576};
1577
1578
1579/***/ }),
1580/* 32 */
1581/***/ (function(module, exports) {
1582
1583module.exports = {};
1584
1585
1586/***/ }),
1587/* 33 */
1588/***/ (function(module, __webpack_exports__, __webpack_require__) {
1589
1590"use strict";
1591/* harmony export (immutable) */ __webpack_exports__["a"] = values;
1592/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
1593
1594
1595// Retrieve the values of an object's properties.
1596function values(obj) {
1597 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
1598 var length = _keys.length;
1599 var values = Array(length);
1600 for (var i = 0; i < length; i++) {
1601 values[i] = obj[_keys[i]];
1602 }
1603 return values;
1604}
1605
1606
1607/***/ }),
1608/* 34 */
1609/***/ (function(module, __webpack_exports__, __webpack_require__) {
1610
1611"use strict";
1612/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
1613/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
1614/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
1615/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(27);
1616/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(77);
1617
1618
1619
1620
1621
1622// Internal implementation of a recursive `flatten` function.
1623function flatten(input, depth, strict, output) {
1624 output = output || [];
1625 if (!depth && depth !== 0) {
1626 depth = Infinity;
1627 } else if (depth <= 0) {
1628 return output.concat(input);
1629 }
1630 var idx = output.length;
1631 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
1632 var value = input[i];
1633 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))) {
1634 // Flatten current level of array or arguments object.
1635 if (depth > 1) {
1636 flatten(value, depth - 1, strict, output);
1637 idx = output.length;
1638 } else {
1639 var j = 0, len = value.length;
1640 while (j < len) output[idx++] = value[j++];
1641 }
1642 } else if (!strict) {
1643 output[idx++] = value;
1644 }
1645 }
1646 return output;
1647}
1648
1649
1650/***/ }),
1651/* 35 */
1652/***/ (function(module, __webpack_exports__, __webpack_require__) {
1653
1654"use strict";
1655/* harmony export (immutable) */ __webpack_exports__["a"] = map;
1656/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
1657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
1658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(4);
1659
1660
1661
1662
1663// Return the results of applying the iteratee to each element.
1664function map(obj, iteratee, context) {
1665 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
1666 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
1667 length = (_keys || obj).length,
1668 results = Array(length);
1669 for (var index = 0; index < length; index++) {
1670 var currentKey = _keys ? _keys[index] : index;
1671 results[index] = iteratee(obj[currentKey], currentKey, obj);
1672 }
1673 return results;
1674}
1675
1676
1677/***/ }),
1678/* 36 */
1679/***/ (function(module, exports, __webpack_require__) {
1680
1681"use strict";
1682/* WEBPACK VAR INJECTION */(function(global) {
1683
1684var _stringify = __webpack_require__(19);
1685
1686var _stringify2 = _interopRequireDefault(_stringify);
1687
1688var _keys = __webpack_require__(158);
1689
1690var _keys2 = _interopRequireDefault(_keys);
1691
1692var _promise = __webpack_require__(3);
1693
1694var _promise2 = _interopRequireDefault(_promise);
1695
1696function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1697
1698var _ = __webpack_require__(0);
1699var uuid = __webpack_require__(159);
1700var debug = __webpack_require__(37);
1701
1702var _require = __webpack_require__(15),
1703 inherits = _require.inherits,
1704 parseDate = _require.parseDate;
1705
1706var version = __webpack_require__(161);
1707
1708var _require2 = __webpack_require__(38),
1709 setAdapters = _require2.setAdapters,
1710 adapterManager = _require2.adapterManager;
1711
1712var AV = global.AV || {};
1713
1714// All internal configuration items
1715AV._config = {
1716 serverURLs: {},
1717 useMasterKey: false,
1718 production: null,
1719 realtime: null,
1720 requestTimeout: null
1721};
1722
1723var initialUserAgent = 'LeanCloud-JS-SDK/' + version;
1724
1725// configs shared by all AV instances
1726AV._sharedConfig = {
1727 userAgent: initialUserAgent,
1728 liveQueryRealtime: null
1729};
1730
1731adapterManager.on('platformInfo', function (platformInfo) {
1732 var ua = initialUserAgent;
1733 if (platformInfo) {
1734 if (platformInfo.userAgent) {
1735 ua = platformInfo.userAgent;
1736 } else {
1737 var comments = platformInfo.name;
1738 if (platformInfo.version) {
1739 comments += '/' + platformInfo.version;
1740 }
1741 if (platformInfo.extra) {
1742 comments += '; ' + platformInfo.extra;
1743 }
1744 ua += ' (' + comments + ')';
1745 }
1746 }
1747 AV._sharedConfig.userAgent = ua;
1748});
1749
1750/**
1751 * Contains all AV API classes and functions.
1752 * @namespace AV
1753 */
1754
1755/**
1756 * Returns prefix for localStorage keys used by this instance of AV.
1757 * @param {String} path The relative suffix to append to it.
1758 * null or undefined is treated as the empty string.
1759 * @return {String} The full key name.
1760 * @private
1761 */
1762AV._getAVPath = function (path) {
1763 if (!AV.applicationId) {
1764 throw new Error('You need to call AV.initialize before using AV.');
1765 }
1766 if (!path) {
1767 path = '';
1768 }
1769 if (!_.isString(path)) {
1770 throw new Error("Tried to get a localStorage path that wasn't a String.");
1771 }
1772 if (path[0] === '/') {
1773 path = path.substring(1);
1774 }
1775 return 'AV/' + AV.applicationId + '/' + path;
1776};
1777
1778/**
1779 * Returns the unique string for this app on this machine.
1780 * Gets reset when localStorage is cleared.
1781 * @private
1782 */
1783AV._installationId = null;
1784AV._getInstallationId = function () {
1785 // See if it's cached in RAM.
1786 if (AV._installationId) {
1787 return _promise2.default.resolve(AV._installationId);
1788 }
1789
1790 // Try to get it from localStorage.
1791 var path = AV._getAVPath('installationId');
1792 return AV.localStorage.getItemAsync(path).then(function (_installationId) {
1793 AV._installationId = _installationId;
1794 if (!AV._installationId) {
1795 // It wasn't in localStorage, so create a new one.
1796 AV._installationId = _installationId = uuid();
1797 return AV.localStorage.setItemAsync(path, _installationId).then(function () {
1798 return _installationId;
1799 });
1800 }
1801 return _installationId;
1802 });
1803};
1804
1805AV._subscriptionId = null;
1806AV._refreshSubscriptionId = function () {
1807 var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
1808
1809 var subscriptionId = AV._subscriptionId = uuid();
1810 return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
1811 return subscriptionId;
1812 });
1813};
1814AV._getSubscriptionId = function () {
1815 // See if it's cached in RAM.
1816 if (AV._subscriptionId) {
1817 return _promise2.default.resolve(AV._subscriptionId);
1818 }
1819
1820 // Try to get it from localStorage.
1821 var path = AV._getAVPath('subscriptionId');
1822 return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
1823 AV._subscriptionId = _subscriptionId;
1824 if (!AV._subscriptionId) {
1825 // It wasn't in localStorage, so create a new one.
1826 _subscriptionId = AV._refreshSubscriptionId(path);
1827 }
1828 return _subscriptionId;
1829 });
1830};
1831
1832AV._parseDate = parseDate;
1833
1834// A self-propagating extend function.
1835AV._extend = function (protoProps, classProps) {
1836 var child = inherits(this, protoProps, classProps);
1837 child.extend = this.extend;
1838 return child;
1839};
1840
1841/**
1842 * Converts a value in a AV Object into the appropriate representation.
1843 * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
1844 * if seenObjects is falsey. Otherwise any AV.Objects not in
1845 * seenObjects will be fully embedded rather than encoded
1846 * as a pointer. This array will be used to prevent going into an infinite
1847 * loop because we have circular references. If <seenObjects>
1848 * is set, then none of the AV Objects that are serialized can be dirty.
1849 * @private
1850 */
1851AV._encode = function (value, seenObjects, disallowObjects) {
1852 var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1853
1854 if (value instanceof AV.Object) {
1855 if (disallowObjects) {
1856 throw new Error('AV.Objects not allowed here');
1857 }
1858 if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
1859 return value._toPointer();
1860 }
1861 return value._toFullJSON(seenObjects.concat(value), full);
1862 }
1863 if (value instanceof AV.ACL) {
1864 return value.toJSON();
1865 }
1866 if (_.isDate(value)) {
1867 return full ? { __type: 'Date', iso: value.toJSON() } : value.toJSON();
1868 }
1869 if (value instanceof AV.GeoPoint) {
1870 return value.toJSON();
1871 }
1872 if (_.isArray(value)) {
1873 return _.map(value, function (x) {
1874 return AV._encode(x, seenObjects, disallowObjects, full);
1875 });
1876 }
1877 if (_.isRegExp(value)) {
1878 return value.source;
1879 }
1880 if (value instanceof AV.Relation) {
1881 return value.toJSON();
1882 }
1883 if (value instanceof AV.Op) {
1884 return value.toJSON();
1885 }
1886 if (value instanceof AV.File) {
1887 if (!value.url() && !value.id) {
1888 throw new Error('Tried to save an object containing an unsaved file.');
1889 }
1890 return value._toFullJSON(seenObjects, full);
1891 }
1892 if (_.isObject(value)) {
1893 return _.mapObject(value, function (v, k) {
1894 return AV._encode(v, seenObjects, disallowObjects, full);
1895 });
1896 }
1897 return value;
1898};
1899
1900/**
1901 * The inverse function of AV._encode.
1902 * @private
1903 */
1904AV._decode = function (value, key) {
1905 if (!_.isObject(value) || _.isDate(value)) {
1906 return value;
1907 }
1908 if (_.isArray(value)) {
1909 return _.map(value, function (v) {
1910 return AV._decode(v);
1911 });
1912 }
1913 if (value instanceof AV.Object) {
1914 return value;
1915 }
1916 if (value instanceof AV.File) {
1917 return value;
1918 }
1919 if (value instanceof AV.Op) {
1920 return value;
1921 }
1922 if (value instanceof AV.GeoPoint) {
1923 return value;
1924 }
1925 if (value instanceof AV.ACL) {
1926 return value;
1927 }
1928 if (key === 'ACL') {
1929 return new AV.ACL(value);
1930 }
1931 if (value.__op) {
1932 return AV.Op._decode(value);
1933 }
1934 var className;
1935 if (value.__type === 'Pointer') {
1936 className = value.className;
1937 var pointer = AV.Object._create(className);
1938 if ((0, _keys2.default)(value).length > 3) {
1939 var v = _.clone(value);
1940 delete v.__type;
1941 delete v.className;
1942 pointer._finishFetch(v, true);
1943 } else {
1944 pointer._finishFetch({ objectId: value.objectId }, false);
1945 }
1946 return pointer;
1947 }
1948 if (value.__type === 'Object') {
1949 // It's an Object included in a query result.
1950 className = value.className;
1951 var _v = _.clone(value);
1952 delete _v.__type;
1953 delete _v.className;
1954 var object = AV.Object._create(className);
1955 object._finishFetch(_v, true);
1956 return object;
1957 }
1958 if (value.__type === 'Date') {
1959 return AV._parseDate(value.iso);
1960 }
1961 if (value.__type === 'GeoPoint') {
1962 return new AV.GeoPoint({
1963 latitude: value.latitude,
1964 longitude: value.longitude
1965 });
1966 }
1967 if (value.__type === 'Relation') {
1968 if (!key) throw new Error('key missing decoding a Relation');
1969 var relation = new AV.Relation(null, key);
1970 relation.targetClassName = value.className;
1971 return relation;
1972 }
1973 if (value.__type === 'File') {
1974 var file = new AV.File(value.name);
1975 var _v2 = _.clone(value);
1976 delete _v2.__type;
1977 file._finishFetch(_v2);
1978 return file;
1979 }
1980 return _.mapObject(value, AV._decode);
1981};
1982
1983/**
1984 * The inverse function of {@link AV.Object#toFullJSON}.
1985 * @since 3.0.0
1986 * @method
1987 * @param {Object}
1988 * return {AV.Object|AV.File|any}
1989 */
1990AV.parseJSON = AV._decode;
1991
1992/**
1993 * Similar to JSON.parse, except that AV internal types will be used if possible.
1994 * Inverse to {@link AV.stringify}
1995 * @since 3.14.0
1996 * @param {string} text the string to parse.
1997 * @return {AV.Object|AV.File|any}
1998 */
1999AV.parse = function (text) {
2000 return AV.parseJSON(JSON.parse(text));
2001};
2002/**
2003 * Serialize a target containing AV.Object, similar to JSON.stringify.
2004 * Inverse to {@link AV.parse}
2005 * @since 3.14.0
2006 * @return {string}
2007 */
2008AV.stringify = function (target) {
2009 return (0, _stringify2.default)(AV._encode(target, [], false, true));
2010};
2011
2012AV._encodeObjectOrArray = function (value) {
2013 var encodeAVObject = function encodeAVObject(object) {
2014 if (object && object._toFullJSON) {
2015 object = object._toFullJSON([]);
2016 }
2017
2018 return _.mapObject(object, function (value) {
2019 return AV._encode(value, []);
2020 });
2021 };
2022
2023 if (_.isArray(value)) {
2024 return value.map(function (object) {
2025 return encodeAVObject(object);
2026 });
2027 } else {
2028 return encodeAVObject(value);
2029 }
2030};
2031
2032AV._arrayEach = _.each;
2033
2034/**
2035 * Does a deep traversal of every item in object, calling func on every one.
2036 * @param {Object} object The object or array to traverse deeply.
2037 * @param {Function} func The function to call for every item. It will
2038 * be passed the item as an argument. If it returns a truthy value, that
2039 * value will replace the item in its parent container.
2040 * @returns {} the result of calling func on the top-level object itself.
2041 * @private
2042 */
2043AV._traverse = function (object, func, seen) {
2044 if (object instanceof AV.Object) {
2045 seen = seen || [];
2046 if (_.indexOf(seen, object) >= 0) {
2047 // We've already visited this object in this call.
2048 return;
2049 }
2050 seen.push(object);
2051 AV._traverse(object.attributes, func, seen);
2052 return func(object);
2053 }
2054 if (object instanceof AV.Relation || object instanceof AV.File) {
2055 // Nothing needs to be done, but we don't want to recurse into the
2056 // object's parent infinitely, so we catch this case.
2057 return func(object);
2058 }
2059 if (_.isArray(object)) {
2060 _.each(object, function (child, index) {
2061 var newChild = AV._traverse(child, func, seen);
2062 if (newChild) {
2063 object[index] = newChild;
2064 }
2065 });
2066 return func(object);
2067 }
2068 if (_.isObject(object)) {
2069 AV._each(object, function (child, key) {
2070 var newChild = AV._traverse(child, func, seen);
2071 if (newChild) {
2072 object[key] = newChild;
2073 }
2074 });
2075 return func(object);
2076 }
2077 return func(object);
2078};
2079
2080/**
2081 * This is like _.each, except:
2082 * * it doesn't work for so-called array-like objects,
2083 * * it does work for dictionaries with a "length" attribute.
2084 * @private
2085 */
2086AV._objectEach = AV._each = function (obj, callback) {
2087 if (_.isObject(obj)) {
2088 _.each(_.keys(obj), function (key) {
2089 callback(obj[key], key);
2090 });
2091 } else {
2092 _.each(obj, callback);
2093 }
2094};
2095
2096/**
2097 * @namespace
2098 * @since 3.14.0
2099 */
2100AV.debug = {
2101 /**
2102 * Enable debug
2103 */
2104 enable: function enable() {
2105 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
2106 return debug.enable(namespaces);
2107 },
2108 /**
2109 * Disable debug
2110 */
2111 disable: debug.disable
2112};
2113
2114/**
2115 * Specify Adapters
2116 * @since 4.4.0
2117 * @function
2118 * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
2119 */
2120AV.setAdapters = setAdapters;
2121
2122module.exports = AV;
2123/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(109)))
2124
2125/***/ }),
2126/* 37 */
2127/***/ (function(module, exports, __webpack_require__) {
2128
2129"use strict";
2130
2131
2132function _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); }
2133
2134/* eslint-env browser */
2135
2136/**
2137 * This is the web browser implementation of `debug()`.
2138 */
2139exports.log = log;
2140exports.formatArgs = formatArgs;
2141exports.save = save;
2142exports.load = load;
2143exports.useColors = useColors;
2144exports.storage = localstorage();
2145/**
2146 * Colors.
2147 */
2148
2149exports.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'];
2150/**
2151 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2152 * and the Firebug extension (any Firefox version) are known
2153 * to support "%c" CSS customizations.
2154 *
2155 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2156 */
2157// eslint-disable-next-line complexity
2158
2159function useColors() {
2160 // NB: In an Electron preload script, document will be defined but not fully
2161 // initialized. Since we know we're in Chrome, we'll just detect this case
2162 // explicitly
2163 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2164 return true;
2165 } // Internet Explorer and Edge do not support colors.
2166
2167
2168 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2169 return false;
2170 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2171 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2172
2173
2174 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2175 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2176 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2177 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
2178 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2179}
2180/**
2181 * Colorize log arguments if enabled.
2182 *
2183 * @api public
2184 */
2185
2186
2187function formatArgs(args) {
2188 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2189
2190 if (!this.useColors) {
2191 return;
2192 }
2193
2194 var c = 'color: ' + this.color;
2195 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2196 // arguments passed either before or after the %c, so we need to
2197 // figure out the correct index to insert the CSS into
2198
2199 var index = 0;
2200 var lastC = 0;
2201 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2202 if (match === '%%') {
2203 return;
2204 }
2205
2206 index++;
2207
2208 if (match === '%c') {
2209 // We only are interested in the *last* %c
2210 // (the user may have provided their own)
2211 lastC = index;
2212 }
2213 });
2214 args.splice(lastC, 0, c);
2215}
2216/**
2217 * Invokes `console.log()` when available.
2218 * No-op when `console.log` is not a "function".
2219 *
2220 * @api public
2221 */
2222
2223
2224function log() {
2225 var _console;
2226
2227 // This hackery is required for IE8/9, where
2228 // the `console.log` function doesn't have 'apply'
2229 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2230}
2231/**
2232 * Save `namespaces`.
2233 *
2234 * @param {String} namespaces
2235 * @api private
2236 */
2237
2238
2239function save(namespaces) {
2240 try {
2241 if (namespaces) {
2242 exports.storage.setItem('debug', namespaces);
2243 } else {
2244 exports.storage.removeItem('debug');
2245 }
2246 } catch (error) {// Swallow
2247 // XXX (@Qix-) should we be logging these?
2248 }
2249}
2250/**
2251 * Load `namespaces`.
2252 *
2253 * @return {String} returns the previously persisted debug modes
2254 * @api private
2255 */
2256
2257
2258function load() {
2259 var r;
2260
2261 try {
2262 r = exports.storage.getItem('debug');
2263 } catch (error) {} // Swallow
2264 // XXX (@Qix-) should we be logging these?
2265 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2266
2267
2268 if (!r && typeof process !== 'undefined' && 'env' in process) {
2269 r = process.env.DEBUG;
2270 }
2271
2272 return r;
2273}
2274/**
2275 * Localstorage attempts to return the localstorage.
2276 *
2277 * This is necessary because safari throws
2278 * when a user disables cookies/localstorage
2279 * and you attempt to access it.
2280 *
2281 * @return {LocalStorage}
2282 * @api private
2283 */
2284
2285
2286function localstorage() {
2287 try {
2288 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2289 // The Browser also has localStorage in the global context.
2290 return localStorage;
2291 } catch (error) {// Swallow
2292 // XXX (@Qix-) should we be logging these?
2293 }
2294}
2295
2296module.exports = __webpack_require__(271)(exports);
2297var formatters = module.exports.formatters;
2298/**
2299 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2300 */
2301
2302formatters.j = function (v) {
2303 try {
2304 return JSON.stringify(v);
2305 } catch (error) {
2306 return '[UnexpectedJSONParseError]: ' + error.message;
2307 }
2308};
2309
2310
2311
2312/***/ }),
2313/* 38 */
2314/***/ (function(module, exports, __webpack_require__) {
2315
2316"use strict";
2317
2318
2319var _ = __webpack_require__(0);
2320var EventEmitter = __webpack_require__(162);
2321
2322var _require = __webpack_require__(15),
2323 inherits = _require.inherits;
2324
2325var AdapterManager = inherits(EventEmitter, {
2326 constructor: function constructor() {
2327 EventEmitter.apply(this);
2328 this._adapters = {};
2329 },
2330 getAdapter: function getAdapter(name) {
2331 var adapter = this._adapters[name];
2332 if (adapter === undefined) {
2333 throw new Error(name + ' adapter is not configured');
2334 }
2335 return adapter;
2336 },
2337 setAdapters: function setAdapters(newAdapters) {
2338 var _this = this;
2339
2340 _.extend(this._adapters, newAdapters);
2341 _.keys(newAdapters).forEach(function (name) {
2342 return _this.emit(name, newAdapters[name]);
2343 });
2344 }
2345});
2346
2347var adapterManager = new AdapterManager();
2348
2349module.exports = {
2350 getAdapter: adapterManager.getAdapter.bind(adapterManager),
2351 setAdapters: adapterManager.setAdapters.bind(adapterManager),
2352 adapterManager: adapterManager
2353};
2354
2355/***/ }),
2356/* 39 */
2357/***/ (function(module, exports, __webpack_require__) {
2358
2359"use strict";
2360
2361var $at = __webpack_require__(175)(true);
2362
2363// 21.1.3.27 String.prototype[@@iterator]()
2364__webpack_require__(96)(String, 'String', function (iterated) {
2365 this._t = String(iterated); // target
2366 this._i = 0; // next index
2367// 21.1.5.2.1 %StringIteratorPrototype%.next()
2368}, function () {
2369 var O = this._t;
2370 var index = this._i;
2371 var point;
2372 if (index >= O.length) return { value: undefined, done: true };
2373 point = $at(O, index);
2374 this._i += point.length;
2375 return { value: point, done: false };
2376});
2377
2378
2379/***/ }),
2380/* 40 */
2381/***/ (function(module, exports) {
2382
2383module.exports = true;
2384
2385
2386/***/ }),
2387/* 41 */
2388/***/ (function(module, exports) {
2389
2390module.exports = function (exec) {
2391 try {
2392 return !!exec();
2393 } catch (e) {
2394 return true;
2395 }
2396};
2397
2398
2399/***/ }),
2400/* 42 */
2401/***/ (function(module, exports) {
2402
2403module.exports = function (bitmap, value) {
2404 return {
2405 enumerable: !(bitmap & 1),
2406 configurable: !(bitmap & 2),
2407 writable: !(bitmap & 4),
2408 value: value
2409 };
2410};
2411
2412
2413/***/ }),
2414/* 43 */
2415/***/ (function(module, exports) {
2416
2417var toString = {}.toString;
2418
2419module.exports = function (it) {
2420 return toString.call(it).slice(8, -1);
2421};
2422
2423
2424/***/ }),
2425/* 44 */
2426/***/ (function(module, exports, __webpack_require__) {
2427
2428// 7.1.13 ToObject(argument)
2429var defined = __webpack_require__(63);
2430module.exports = function (it) {
2431 return Object(defined(it));
2432};
2433
2434
2435/***/ }),
2436/* 45 */
2437/***/ (function(module, __webpack_exports__, __webpack_require__) {
2438
2439"use strict";
2440/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
2441/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
2442/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
2443/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(200);
2444
2445
2446
2447// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
2448// In IE 11, the most common among them, this problem also applies to
2449// `Map`, `WeakMap` and `Set`.
2450var hasStringTagBug = (
2451 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
2452 ),
2453 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
2454
2455
2456/***/ }),
2457/* 46 */
2458/***/ (function(module, __webpack_exports__, __webpack_require__) {
2459
2460"use strict";
2461/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
2462/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(26);
2463/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
2464/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(120);
2465
2466
2467
2468
2469// Retrieve all the enumerable property names of an object.
2470function allKeys(obj) {
2471 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
2472 var keys = [];
2473 for (var key in obj) keys.push(key);
2474 // Ahem, IE < 9.
2475 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
2476 return keys;
2477}
2478
2479
2480/***/ }),
2481/* 47 */
2482/***/ (function(module, __webpack_exports__, __webpack_require__) {
2483
2484"use strict";
2485/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
2486/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
2487/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(129);
2488
2489
2490
2491// Internal wrapper for `_.toPath` to enable minification.
2492// Similar to `cb` for `_.iteratee`.
2493function toPath(path) {
2494 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
2495}
2496
2497
2498/***/ }),
2499/* 48 */
2500/***/ (function(module, __webpack_exports__, __webpack_require__) {
2501
2502"use strict";
2503/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
2504// Internal function that returns an efficient (for current engines) version
2505// of the passed-in callback, to be repeatedly applied in other Underscore
2506// functions.
2507function optimizeCb(func, context, argCount) {
2508 if (context === void 0) return func;
2509 switch (argCount == null ? 3 : argCount) {
2510 case 1: return function(value) {
2511 return func.call(context, value);
2512 };
2513 // The 2-argument case is omitted because we’re not using it.
2514 case 3: return function(value, index, collection) {
2515 return func.call(context, value, index, collection);
2516 };
2517 case 4: return function(accumulator, value, index, collection) {
2518 return func.call(context, accumulator, value, index, collection);
2519 };
2520 }
2521 return function() {
2522 return func.apply(context, arguments);
2523 };
2524}
2525
2526
2527/***/ }),
2528/* 49 */
2529/***/ (function(module, __webpack_exports__, __webpack_require__) {
2530
2531"use strict";
2532/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
2533/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
2534/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(28);
2535
2536
2537
2538// Return all the elements that pass a truth test.
2539function filter(obj, predicate, context) {
2540 var results = [];
2541 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
2542 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
2543 if (predicate(value, index, list)) results.push(value);
2544 });
2545 return results;
2546}
2547
2548
2549/***/ }),
2550/* 50 */
2551/***/ (function(module, __webpack_exports__, __webpack_require__) {
2552
2553"use strict";
2554/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
2555/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
2556/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(33);
2557/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(145);
2558
2559
2560
2561
2562// Determine if the array or object contains a given item (using `===`).
2563function contains(obj, item, fromIndex, guard) {
2564 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
2565 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
2566 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
2567}
2568
2569
2570/***/ }),
2571/* 51 */
2572/***/ (function(module, exports, __webpack_require__) {
2573
2574module.exports = { "default": __webpack_require__(280), __esModule: true };
2575
2576/***/ }),
2577/* 52 */
2578/***/ (function(module, exports) {
2579
2580module.exports = function (it) {
2581 if (typeof it != 'function') throw TypeError(it + ' is not a function!');
2582 return it;
2583};
2584
2585
2586/***/ }),
2587/* 53 */
2588/***/ (function(module, exports, __webpack_require__) {
2589
2590// 19.1.2.14 / 15.2.3.14 Object.keys(O)
2591var $keys = __webpack_require__(99);
2592var enumBugKeys = __webpack_require__(70);
2593
2594module.exports = Object.keys || function keys(O) {
2595 return $keys(O, enumBugKeys);
2596};
2597
2598
2599/***/ }),
2600/* 54 */
2601/***/ (function(module, exports) {
2602
2603var id = 0;
2604var px = Math.random();
2605module.exports = function (key) {
2606 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
2607};
2608
2609
2610/***/ }),
2611/* 55 */
2612/***/ (function(module, exports, __webpack_require__) {
2613
2614var def = __webpack_require__(18).f;
2615var has = __webpack_require__(24);
2616var TAG = __webpack_require__(7)('toStringTag');
2617
2618module.exports = function (it, tag, stat) {
2619 if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
2620};
2621
2622
2623/***/ }),
2624/* 56 */
2625/***/ (function(module, exports, __webpack_require__) {
2626
2627__webpack_require__(181);
2628var global = __webpack_require__(6);
2629var hide = __webpack_require__(23);
2630var Iterators = __webpack_require__(32);
2631var TO_STRING_TAG = __webpack_require__(7)('toStringTag');
2632
2633var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
2634 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
2635 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
2636 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
2637 'TextTrackList,TouchList').split(',');
2638
2639for (var i = 0; i < DOMIterables.length; i++) {
2640 var NAME = DOMIterables[i];
2641 var Collection = global[NAME];
2642 var proto = Collection && Collection.prototype;
2643 if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
2644 Iterators[NAME] = Iterators.Array;
2645}
2646
2647
2648/***/ }),
2649/* 57 */
2650/***/ (function(module, __webpack_exports__, __webpack_require__) {
2651
2652"use strict";
2653/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
2654/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(81);
2655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(121);
2656
2657
2658
2659// Returns a predicate for checking whether an object has a given set of
2660// `key:value` pairs.
2661function matcher(attrs) {
2662 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
2663 return function(obj) {
2664 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
2665 };
2666}
2667
2668
2669/***/ }),
2670/* 58 */
2671/***/ (function(module, __webpack_exports__, __webpack_require__) {
2672
2673"use strict";
2674/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
2675/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(137);
2676/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(10);
2677
2678
2679
2680
2681// Partially apply a function by creating a version that has had some of its
2682// arguments pre-filled, without changing its dynamic `this` context. `_` acts
2683// as a placeholder by default, allowing any combination of arguments to be
2684// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
2685var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
2686 var placeholder = partial.placeholder;
2687 var bound = function() {
2688 var position = 0, length = boundArgs.length;
2689 var args = Array(length);
2690 for (var i = 0; i < length; i++) {
2691 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
2692 }
2693 while (position < arguments.length) args.push(arguments[position++]);
2694 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
2695 };
2696 return bound;
2697});
2698
2699partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
2700/* harmony default export */ __webpack_exports__["a"] = (partial);
2701
2702
2703/***/ }),
2704/* 59 */
2705/***/ (function(module, __webpack_exports__, __webpack_require__) {
2706
2707"use strict";
2708/* harmony export (immutable) */ __webpack_exports__["a"] = group;
2709/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
2710/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(28);
2711
2712
2713
2714// An internal function used for aggregate "group by" operations.
2715function group(behavior, partition) {
2716 return function(obj, iteratee, context) {
2717 var result = partition ? [[], []] : {};
2718 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
2719 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
2720 var key = iteratee(value, index, obj);
2721 behavior(result, value, key);
2722 });
2723 return result;
2724 };
2725}
2726
2727
2728/***/ }),
2729/* 60 */
2730/***/ (function(module, exports, __webpack_require__) {
2731
2732"use strict";
2733
2734
2735var _stringify = __webpack_require__(19);
2736
2737var _stringify2 = _interopRequireDefault(_stringify);
2738
2739var _typeof2 = __webpack_require__(30);
2740
2741var _typeof3 = _interopRequireDefault(_typeof2);
2742
2743var _keys = __webpack_require__(158);
2744
2745var _keys2 = _interopRequireDefault(_keys);
2746
2747function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2748
2749var _ = __webpack_require__(0);
2750
2751var _require = __webpack_require__(288),
2752 timeout = _require.timeout;
2753
2754var debug = __webpack_require__(37);
2755var debugRequest = debug('leancloud:request');
2756var debugRequestError = debug('leancloud:request:error');
2757
2758var _require2 = __webpack_require__(38),
2759 getAdapter = _require2.getAdapter;
2760
2761var requestsCount = 0;
2762
2763var ajax = function ajax(_ref) {
2764 var method = _ref.method,
2765 url = _ref.url,
2766 query = _ref.query,
2767 data = _ref.data,
2768 _ref$headers = _ref.headers,
2769 headers = _ref$headers === undefined ? {} : _ref$headers,
2770 time = _ref.timeout,
2771 onprogress = _ref.onprogress;
2772
2773 if (query) {
2774 var queryString = (0, _keys2.default)(query).map(function (key) {
2775 var value = query[key];
2776 if (value === undefined) return undefined;
2777 var v = (typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) === 'object' ? (0, _stringify2.default)(value) : value;
2778 return encodeURIComponent(key) + '=' + encodeURIComponent(v);
2779 }).filter(function (qs) {
2780 return qs;
2781 }).join('&');
2782 url = url + '?' + queryString;
2783 }
2784
2785 var count = requestsCount++;
2786 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
2787
2788 var request = getAdapter('request');
2789 var promise = request(url, { method: method, headers: headers, data: data, onprogress: onprogress }).then(function (response) {
2790 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
2791 if (response.ok === false) {
2792 var error = new Error();
2793 error.response = response;
2794 throw error;
2795 }
2796 return response.data;
2797 }).catch(function (error) {
2798 if (error.response) {
2799 if (!debug.enabled('leancloud:request')) {
2800 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
2801 }
2802 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
2803 error.statusCode = error.response.status;
2804 error.responseText = error.response.text;
2805 error.response = error.response.data;
2806 }
2807 throw error;
2808 });
2809 return time ? timeout(promise, time) : promise;
2810};
2811
2812module.exports = ajax;
2813
2814/***/ }),
2815/* 61 */
2816/***/ (function(module, exports, __webpack_require__) {
2817
2818module.exports = { "default": __webpack_require__(279), __esModule: true };
2819
2820/***/ }),
2821/* 62 */
2822/***/ (function(module, exports) {
2823
2824// 7.1.4 ToInteger
2825var ceil = Math.ceil;
2826var floor = Math.floor;
2827module.exports = function (it) {
2828 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
2829};
2830
2831
2832/***/ }),
2833/* 63 */
2834/***/ (function(module, exports) {
2835
2836// 7.2.1 RequireObjectCoercible(argument)
2837module.exports = function (it) {
2838 if (it == undefined) throw TypeError("Can't call method on " + it);
2839 return it;
2840};
2841
2842
2843/***/ }),
2844/* 64 */
2845/***/ (function(module, exports, __webpack_require__) {
2846
2847var isObject = __webpack_require__(20);
2848var document = __webpack_require__(6).document;
2849// typeof document.createElement is 'object' in old IE
2850var is = isObject(document) && isObject(document.createElement);
2851module.exports = function (it) {
2852 return is ? document.createElement(it) : {};
2853};
2854
2855
2856/***/ }),
2857/* 65 */
2858/***/ (function(module, exports, __webpack_require__) {
2859
2860// 7.1.1 ToPrimitive(input [, PreferredType])
2861var isObject = __webpack_require__(20);
2862// instead of the ES6 spec version, we didn't implement @@toPrimitive case
2863// and the second argument - flag - preferred type is a string
2864module.exports = function (it, S) {
2865 if (!isObject(it)) return it;
2866 var fn, val;
2867 if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
2868 if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
2869 if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
2870 throw TypeError("Can't convert object to primitive value");
2871};
2872
2873
2874/***/ }),
2875/* 66 */
2876/***/ (function(module, exports, __webpack_require__) {
2877
2878// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
2879var anObject = __webpack_require__(17);
2880var dPs = __webpack_require__(177);
2881var enumBugKeys = __webpack_require__(70);
2882var IE_PROTO = __webpack_require__(68)('IE_PROTO');
2883var Empty = function () { /* empty */ };
2884var PROTOTYPE = 'prototype';
2885
2886// Create object with fake `null` prototype: use iframe Object with cleared prototype
2887var createDict = function () {
2888 // Thrash, waste and sodomy: IE GC bug
2889 var iframe = __webpack_require__(64)('iframe');
2890 var i = enumBugKeys.length;
2891 var lt = '<';
2892 var gt = '>';
2893 var iframeDocument;
2894 iframe.style.display = 'none';
2895 __webpack_require__(100).appendChild(iframe);
2896 iframe.src = 'javascript:'; // eslint-disable-line no-script-url
2897 // createDict = iframe.contentWindow.Object;
2898 // html.removeChild(iframe);
2899 iframeDocument = iframe.contentWindow.document;
2900 iframeDocument.open();
2901 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
2902 iframeDocument.close();
2903 createDict = iframeDocument.F;
2904 while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
2905 return createDict();
2906};
2907
2908module.exports = Object.create || function create(O, Properties) {
2909 var result;
2910 if (O !== null) {
2911 Empty[PROTOTYPE] = anObject(O);
2912 result = new Empty();
2913 Empty[PROTOTYPE] = null;
2914 // add "__proto__" for Object.getPrototypeOf polyfill
2915 result[IE_PROTO] = O;
2916 } else result = createDict();
2917 return Properties === undefined ? result : dPs(result, Properties);
2918};
2919
2920
2921/***/ }),
2922/* 67 */
2923/***/ (function(module, exports, __webpack_require__) {
2924
2925// 7.1.15 ToLength
2926var toInteger = __webpack_require__(62);
2927var min = Math.min;
2928module.exports = function (it) {
2929 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
2930};
2931
2932
2933/***/ }),
2934/* 68 */
2935/***/ (function(module, exports, __webpack_require__) {
2936
2937var shared = __webpack_require__(69)('keys');
2938var uid = __webpack_require__(54);
2939module.exports = function (key) {
2940 return shared[key] || (shared[key] = uid(key));
2941};
2942
2943
2944/***/ }),
2945/* 69 */
2946/***/ (function(module, exports, __webpack_require__) {
2947
2948var core = __webpack_require__(2);
2949var global = __webpack_require__(6);
2950var SHARED = '__core-js_shared__';
2951var store = global[SHARED] || (global[SHARED] = {});
2952
2953(module.exports = function (key, value) {
2954 return store[key] || (store[key] = value !== undefined ? value : {});
2955})('versions', []).push({
2956 version: core.version,
2957 mode: __webpack_require__(40) ? 'pure' : 'global',
2958 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
2959});
2960
2961
2962/***/ }),
2963/* 70 */
2964/***/ (function(module, exports) {
2965
2966// IE 8- don't enum bug keys
2967module.exports = (
2968 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
2969).split(',');
2970
2971
2972/***/ }),
2973/* 71 */
2974/***/ (function(module, exports, __webpack_require__) {
2975
2976// getting tag from 19.1.3.6 Object.prototype.toString()
2977var cof = __webpack_require__(43);
2978var TAG = __webpack_require__(7)('toStringTag');
2979// ES3 wrong here
2980var ARG = cof(function () { return arguments; }()) == 'Arguments';
2981
2982// fallback for IE11 Script Access Denied error
2983var tryGet = function (it, key) {
2984 try {
2985 return it[key];
2986 } catch (e) { /* empty */ }
2987};
2988
2989module.exports = function (it) {
2990 var O, T, B;
2991 return it === undefined ? 'Undefined' : it === null ? 'Null'
2992 // @@toStringTag case
2993 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
2994 // builtinTag case
2995 : ARG ? cof(O)
2996 // ES3 arguments fallback
2997 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
2998};
2999
3000
3001/***/ }),
3002/* 72 */
3003/***/ (function(module, exports, __webpack_require__) {
3004
3005var classof = __webpack_require__(71);
3006var ITERATOR = __webpack_require__(7)('iterator');
3007var Iterators = __webpack_require__(32);
3008module.exports = __webpack_require__(2).getIteratorMethod = function (it) {
3009 if (it != undefined) return it[ITERATOR]
3010 || it['@@iterator']
3011 || Iterators[classof(it)];
3012};
3013
3014
3015/***/ }),
3016/* 73 */
3017/***/ (function(module, exports, __webpack_require__) {
3018
3019"use strict";
3020
3021// 25.4.1.5 NewPromiseCapability(C)
3022var aFunction = __webpack_require__(52);
3023
3024function PromiseCapability(C) {
3025 var resolve, reject;
3026 this.promise = new C(function ($$resolve, $$reject) {
3027 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
3028 resolve = $$resolve;
3029 reject = $$reject;
3030 });
3031 this.resolve = aFunction(resolve);
3032 this.reject = aFunction(reject);
3033}
3034
3035module.exports.f = function (C) {
3036 return new PromiseCapability(C);
3037};
3038
3039
3040/***/ }),
3041/* 74 */
3042/***/ (function(module, __webpack_exports__, __webpack_require__) {
3043
3044"use strict";
3045Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
3046/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
3047/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
3048/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(9);
3049/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
3050/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(26);
3051/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
3052/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(195);
3053/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
3054/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(110);
3055/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
3056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(111);
3057/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
3058/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(196);
3059/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
3060/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(75);
3061/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
3062/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(112);
3063/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
3064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(197);
3065/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
3066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(198);
3067/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
3068/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(199);
3069/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
3070/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(113);
3071/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
3072/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(114);
3073/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
3074/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(76);
3075/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
3076/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(27);
3077/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
3078/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(13);
3079/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
3080/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(77);
3081/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
3082/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(201);
3083/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
3084/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(115);
3085/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
3086/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(116);
3087/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
3088/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(203);
3089/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
3090/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(121);
3091/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
3092/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(204);
3093/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
3094/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(206);
3095/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
3096/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(207);
3097/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
3098/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(208);
3099/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
3100/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(209);
3101/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
3102/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(4);
3103/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
3104/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(46);
3105/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
3106/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(33);
3107/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
3108/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(210);
3109/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
3110/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(122);
3111/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
3112/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(123);
3113/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
3114/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
3115/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(124);
3116/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
3117/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(81);
3118/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
3119/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
3120/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(125);
3121/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
3122/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(211);
3123/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
3124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(127);
3125/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
3126/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(212);
3127/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
3128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(128);
3129/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
3130/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(213);
3131/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
3132/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(214);
3133/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
3134/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(83);
3135/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
3136/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(117);
3137/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
3138/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(132);
3139/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
3140/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(129);
3141/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
3142/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(84);
3143/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
3144/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(215);
3145/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
3146/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(57);
3147/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
3148/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
3149/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(216);
3150/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
3151/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(133);
3152/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
3153/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(85);
3154/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
3155/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(217);
3156/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
3157/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(218);
3158/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
3159/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(136);
3160/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
3161/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(220);
3162/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
3163/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(221);
3164/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
3165/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(222);
3166/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
3167/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(223);
3168/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
3169/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(131);
3170/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
3171/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(58);
3172/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
3173/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(138);
3174/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
3175/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(224);
3176/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
3177/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(225);
3178/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
3179/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(139);
3180/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
3181/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(226);
3182/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
3183/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(227);
3184/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
3185/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(228);
3186/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
3187/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(229);
3188/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
3189/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(86);
3190/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
3191/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(230);
3192/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
3193/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(231);
3194/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
3195/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(140);
3196/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
3197/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(232);
3198/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
3199/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(141);
3200/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
3201/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(87);
3202/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
3203/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(143);
3204/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
3205/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(144);
3206/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
3207/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(145);
3208/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
3209/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(233);
3210/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
3211/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(147);
3212/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
3213/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
3214/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(234);
3215/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
3216/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(28);
3217/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
3218/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
3219/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(35);
3220/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
3221/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
3222/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(235);
3223/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3224/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3225/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3226/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(236);
3227/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
3228/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
3229/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(49);
3230/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
3231/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
3232/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(237);
3233/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
3234/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(238);
3235/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
3236/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
3237/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(239);
3238/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
3239/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
3240/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(50);
3241/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3242/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3243/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3244/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(240);
3245/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
3246/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(88);
3247/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
3248/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(241);
3249/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
3250/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(149);
3251/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
3252/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(242);
3253/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
3254/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(243);
3255/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
3256/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(150);
3257/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
3258/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(244);
3259/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
3260/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(245);
3261/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
3262/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(246);
3263/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
3264/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(247);
3265/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
3266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(248);
3267/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
3268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(249);
3269/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
3270/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(250);
3271/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
3272/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(151);
3273/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
3274/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(252);
3275/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
3276/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(253);
3277/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3278/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3279/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3280/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(152);
3281/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
3282/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(254);
3283/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
3284/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(153);
3285/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3286/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3287/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3288/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(255);
3289/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
3290/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(256);
3291/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
3292/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(257);
3293/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
3294/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(155);
3295/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
3296/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
3297/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(258);
3298/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
3299/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(259);
3300/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
3301/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(154);
3302/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
3303/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(156);
3304/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
3305/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
3306/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(260);
3307/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
3308/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(261);
3309/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
3310/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(262);
3311/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
3312/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(263);
3313/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
3314/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(264);
3315/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
3316/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(265);
3317/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
3318// Named Exports
3319// =============
3320
3321// Underscore.js 1.12.1
3322// https://underscorejs.org
3323// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3324// Underscore may be freely distributed under the MIT license.
3325
3326// Baseline setup.
3327
3328
3329
3330// Object Functions
3331// ----------------
3332// Our most fundamental functions operate on any JavaScript object.
3333// Most functions in Underscore depend on at least one function in this section.
3334
3335// A group of functions that check the types of core JavaScript values.
3336// These are often informally referred to as the "isType" functions.
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364// Functions that treat an object as a dictionary of key-value pairs.
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381// Utility Functions
3382// -----------------
3383// A bit of a grab bag: Predicate-generating functions for use with filters and
3384// loops, string escaping and templating, create random numbers and unique ids,
3385// and functions that facilitate Underscore's chaining and iteration conventions.
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405// Function (ahem) Functions
3406// -------------------------
3407// These functions take a function as an argument and return a new function
3408// as the result. Also known as higher-order functions.
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424// Finders
3425// -------
3426// Functions that extract (the position of) a single element from an object
3427// or array based on some criterion.
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437// Collection Functions
3438// --------------------
3439// Functions that work on any collection of elements: either an array, or
3440// an object of key-value pairs.
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465// `_.pick` and `_.omit` are actually object functions, but we put
3466// them here in order to create a more natural reading order in the
3467// monolithic build as they depend on `_.contains`.
3468
3469
3470
3471// Array Functions
3472// ---------------
3473// Functions that operate on arrays (and array-likes) only, because they’re
3474// expressed in terms of operations on an ordered list of values.
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492// OOP
3493// ---
3494// These modules support the "object-oriented" calling style. See also
3495// `underscore.js` and `index-default.js`.
3496
3497
3498
3499
3500/***/ }),
3501/* 75 */
3502/***/ (function(module, __webpack_exports__, __webpack_require__) {
3503
3504"use strict";
3505/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
3506
3507
3508/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
3509
3510
3511/***/ }),
3512/* 76 */
3513/***/ (function(module, __webpack_exports__, __webpack_require__) {
3514
3515"use strict";
3516/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
3517/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
3518/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(114);
3519/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(45);
3520
3521
3522
3523
3524
3525var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
3526
3527// In IE 10 - Edge 13, we need a different heuristic
3528// to determine whether an object is a `DataView`.
3529function ie10IsDataView(obj) {
3530 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);
3531}
3532
3533/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
3534
3535
3536/***/ }),
3537/* 77 */
3538/***/ (function(module, __webpack_exports__, __webpack_require__) {
3539
3540"use strict";
3541/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
3542/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(22);
3543
3544
3545
3546var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
3547
3548// Define a fallback version of the method in browsers (ahem, IE < 9), where
3549// there isn't any inspectable "Arguments" type.
3550(function() {
3551 if (!isArguments(arguments)) {
3552 isArguments = function(obj) {
3553 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
3554 };
3555 }
3556}());
3557
3558/* harmony default export */ __webpack_exports__["a"] = (isArguments);
3559
3560
3561/***/ }),
3562/* 78 */
3563/***/ (function(module, __webpack_exports__, __webpack_require__) {
3564
3565"use strict";
3566/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(119);
3567
3568
3569// Internal helper to obtain the `byteLength` property of an object.
3570/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
3571
3572
3573/***/ }),
3574/* 79 */
3575/***/ (function(module, __webpack_exports__, __webpack_require__) {
3576
3577"use strict";
3578/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
3579/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
3580/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
3581/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
3582/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
3583/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
3584/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(46);
3585
3586
3587
3588
3589// Since the regular `Object.prototype.toString` type tests don't work for
3590// some types in IE 11, we use a fingerprinting heuristic instead, based
3591// on the methods. It's not great, but it's the best we got.
3592// The fingerprint method lists are defined below.
3593function ie11fingerprint(methods) {
3594 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
3595 return function(obj) {
3596 if (obj == null) return false;
3597 // `Map`, `WeakMap` and `Set` have no enumerable keys.
3598 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
3599 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
3600 for (var i = 0; i < length; i++) {
3601 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
3602 }
3603 // If we are testing against `WeakMap`, we need to ensure that
3604 // `obj` doesn't have a `forEach` method in order to distinguish
3605 // it from a regular `Map`.
3606 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
3607 };
3608}
3609
3610// In the interest of compact minification, we write
3611// each string in the fingerprints only once.
3612var forEachName = 'forEach',
3613 hasName = 'has',
3614 commonInit = ['clear', 'delete'],
3615 mapTail = ['get', hasName, 'set'];
3616
3617// `Map`, `WeakMap` and `Set` each have slightly different
3618// combinations of the above sublists.
3619var mapMethods = commonInit.concat(forEachName, mapTail),
3620 weakMapMethods = commonInit.concat(mapTail),
3621 setMethods = ['add'].concat(commonInit, forEachName, hasName);
3622
3623
3624/***/ }),
3625/* 80 */
3626/***/ (function(module, __webpack_exports__, __webpack_require__) {
3627
3628"use strict";
3629/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
3630// An internal function for creating assigner functions.
3631function createAssigner(keysFunc, defaults) {
3632 return function(obj) {
3633 var length = arguments.length;
3634 if (defaults) obj = Object(obj);
3635 if (length < 2 || obj == null) return obj;
3636 for (var index = 1; index < length; index++) {
3637 var source = arguments[index],
3638 keys = keysFunc(source),
3639 l = keys.length;
3640 for (var i = 0; i < l; i++) {
3641 var key = keys[i];
3642 if (!defaults || obj[key] === void 0) obj[key] = source[key];
3643 }
3644 }
3645 return obj;
3646 };
3647}
3648
3649
3650/***/ }),
3651/* 81 */
3652/***/ (function(module, __webpack_exports__, __webpack_require__) {
3653
3654"use strict";
3655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(80);
3656/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
3657
3658
3659
3660// Assigns a given object with all the own properties in the passed-in
3661// object(s).
3662// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
3663/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
3664
3665
3666/***/ }),
3667/* 82 */
3668/***/ (function(module, __webpack_exports__, __webpack_require__) {
3669
3670"use strict";
3671/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
3672// Internal function to obtain a nested property in `obj` along `path`.
3673function deepGet(obj, path) {
3674 var length = path.length;
3675 for (var i = 0; i < length; i++) {
3676 if (obj == null) return void 0;
3677 obj = obj[path[i]];
3678 }
3679 return length ? obj : void 0;
3680}
3681
3682
3683/***/ }),
3684/* 83 */
3685/***/ (function(module, __webpack_exports__, __webpack_require__) {
3686
3687"use strict";
3688/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
3689// Keep the identity function around for default iteratees.
3690function identity(value) {
3691 return value;
3692}
3693
3694
3695/***/ }),
3696/* 84 */
3697/***/ (function(module, __webpack_exports__, __webpack_require__) {
3698
3699"use strict";
3700/* harmony export (immutable) */ __webpack_exports__["a"] = property;
3701/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(82);
3702/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(47);
3703
3704
3705
3706// Creates a function that, when passed an object, will traverse that object’s
3707// properties down the given `path`, specified as an array of keys or indices.
3708function property(path) {
3709 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
3710 return function(obj) {
3711 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
3712 };
3713}
3714
3715
3716/***/ }),
3717/* 85 */
3718/***/ (function(module, __webpack_exports__, __webpack_require__) {
3719
3720"use strict";
3721// A (possibly faster) way to get the current timestamp as an integer.
3722/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
3723 return new Date().getTime();
3724});
3725
3726
3727/***/ }),
3728/* 86 */
3729/***/ (function(module, __webpack_exports__, __webpack_require__) {
3730
3731"use strict";
3732/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
3733// Returns a negated version of the passed-in predicate.
3734function negate(predicate) {
3735 return function() {
3736 return !predicate.apply(this, arguments);
3737 };
3738}
3739
3740
3741/***/ }),
3742/* 87 */
3743/***/ (function(module, __webpack_exports__, __webpack_require__) {
3744
3745"use strict";
3746/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(142);
3747
3748
3749// Returns the first index on an array-like that passes a truth test.
3750/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
3751
3752
3753/***/ }),
3754/* 88 */
3755/***/ (function(module, __webpack_exports__, __webpack_require__) {
3756
3757"use strict";
3758/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
3759/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(35);
3760/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(84);
3761
3762
3763
3764// Convenience version of a common use case of `_.map`: fetching a property.
3765function pluck(obj, key) {
3766 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
3767}
3768
3769
3770/***/ }),
3771/* 89 */
3772/***/ (function(module, exports, __webpack_require__) {
3773
3774// most Object methods by ES6 should accept primitives
3775var $export = __webpack_require__(16);
3776var core = __webpack_require__(2);
3777var fails = __webpack_require__(41);
3778module.exports = function (KEY, exec) {
3779 var fn = (core.Object || {})[KEY] || Object[KEY];
3780 var exp = {};
3781 exp[KEY] = exec(fn);
3782 $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
3783};
3784
3785
3786/***/ }),
3787/* 90 */
3788/***/ (function(module, exports, __webpack_require__) {
3789
3790module.exports = { "default": __webpack_require__(276), __esModule: true };
3791
3792/***/ }),
3793/* 91 */
3794/***/ (function(module, exports, __webpack_require__) {
3795
3796exports.f = __webpack_require__(7);
3797
3798
3799/***/ }),
3800/* 92 */
3801/***/ (function(module, exports, __webpack_require__) {
3802
3803var global = __webpack_require__(6);
3804var core = __webpack_require__(2);
3805var LIBRARY = __webpack_require__(40);
3806var wksExt = __webpack_require__(91);
3807var defineProperty = __webpack_require__(18).f;
3808module.exports = function (name) {
3809 var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
3810 if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
3811};
3812
3813
3814/***/ }),
3815/* 93 */
3816/***/ (function(module, exports) {
3817
3818exports.f = {}.propertyIsEnumerable;
3819
3820
3821/***/ }),
3822/* 94 */
3823/***/ (function(module, exports, __webpack_require__) {
3824
3825var pIE = __webpack_require__(93);
3826var createDesc = __webpack_require__(42);
3827var toIObject = __webpack_require__(25);
3828var toPrimitive = __webpack_require__(65);
3829var has = __webpack_require__(24);
3830var IE8_DOM_DEFINE = __webpack_require__(97);
3831var gOPD = Object.getOwnPropertyDescriptor;
3832
3833exports.f = __webpack_require__(21) ? gOPD : function getOwnPropertyDescriptor(O, P) {
3834 O = toIObject(O);
3835 P = toPrimitive(P, true);
3836 if (IE8_DOM_DEFINE) try {
3837 return gOPD(O, P);
3838 } catch (e) { /* empty */ }
3839 if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
3840};
3841
3842
3843/***/ }),
3844/* 95 */
3845/***/ (function(module, exports) {
3846
3847
3848
3849/***/ }),
3850/* 96 */
3851/***/ (function(module, exports, __webpack_require__) {
3852
3853"use strict";
3854
3855var LIBRARY = __webpack_require__(40);
3856var $export = __webpack_require__(16);
3857var redefine = __webpack_require__(98);
3858var hide = __webpack_require__(23);
3859var Iterators = __webpack_require__(32);
3860var $iterCreate = __webpack_require__(176);
3861var setToStringTag = __webpack_require__(55);
3862var getPrototypeOf = __webpack_require__(101);
3863var ITERATOR = __webpack_require__(7)('iterator');
3864var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
3865var FF_ITERATOR = '@@iterator';
3866var KEYS = 'keys';
3867var VALUES = 'values';
3868
3869var returnThis = function () { return this; };
3870
3871module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
3872 $iterCreate(Constructor, NAME, next);
3873 var getMethod = function (kind) {
3874 if (!BUGGY && kind in proto) return proto[kind];
3875 switch (kind) {
3876 case KEYS: return function keys() { return new Constructor(this, kind); };
3877 case VALUES: return function values() { return new Constructor(this, kind); };
3878 } return function entries() { return new Constructor(this, kind); };
3879 };
3880 var TAG = NAME + ' Iterator';
3881 var DEF_VALUES = DEFAULT == VALUES;
3882 var VALUES_BUG = false;
3883 var proto = Base.prototype;
3884 var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
3885 var $default = $native || getMethod(DEFAULT);
3886 var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
3887 var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
3888 var methods, key, IteratorPrototype;
3889 // Fix native
3890 if ($anyNative) {
3891 IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
3892 if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
3893 // Set @@toStringTag to native iterators
3894 setToStringTag(IteratorPrototype, TAG, true);
3895 // fix for some old engines
3896 if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
3897 }
3898 }
3899 // fix Array#{values, @@iterator}.name in V8 / FF
3900 if (DEF_VALUES && $native && $native.name !== VALUES) {
3901 VALUES_BUG = true;
3902 $default = function values() { return $native.call(this); };
3903 }
3904 // Define iterator
3905 if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
3906 hide(proto, ITERATOR, $default);
3907 }
3908 // Plug for library
3909 Iterators[NAME] = $default;
3910 Iterators[TAG] = returnThis;
3911 if (DEFAULT) {
3912 methods = {
3913 values: DEF_VALUES ? $default : getMethod(VALUES),
3914 keys: IS_SET ? $default : getMethod(KEYS),
3915 entries: $entries
3916 };
3917 if (FORCED) for (key in methods) {
3918 if (!(key in proto)) redefine(proto, key, methods[key]);
3919 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
3920 }
3921 return methods;
3922};
3923
3924
3925/***/ }),
3926/* 97 */
3927/***/ (function(module, exports, __webpack_require__) {
3928
3929module.exports = !__webpack_require__(21) && !__webpack_require__(41)(function () {
3930 return Object.defineProperty(__webpack_require__(64)('div'), 'a', { get: function () { return 7; } }).a != 7;
3931});
3932
3933
3934/***/ }),
3935/* 98 */
3936/***/ (function(module, exports, __webpack_require__) {
3937
3938module.exports = __webpack_require__(23);
3939
3940
3941/***/ }),
3942/* 99 */
3943/***/ (function(module, exports, __webpack_require__) {
3944
3945var has = __webpack_require__(24);
3946var toIObject = __webpack_require__(25);
3947var arrayIndexOf = __webpack_require__(179)(false);
3948var IE_PROTO = __webpack_require__(68)('IE_PROTO');
3949
3950module.exports = function (object, names) {
3951 var O = toIObject(object);
3952 var i = 0;
3953 var result = [];
3954 var key;
3955 for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
3956 // Don't enum bug & hidden keys
3957 while (names.length > i) if (has(O, key = names[i++])) {
3958 ~arrayIndexOf(result, key) || result.push(key);
3959 }
3960 return result;
3961};
3962
3963
3964/***/ }),
3965/* 100 */
3966/***/ (function(module, exports, __webpack_require__) {
3967
3968var document = __webpack_require__(6).document;
3969module.exports = document && document.documentElement;
3970
3971
3972/***/ }),
3973/* 101 */
3974/***/ (function(module, exports, __webpack_require__) {
3975
3976// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
3977var has = __webpack_require__(24);
3978var toObject = __webpack_require__(44);
3979var IE_PROTO = __webpack_require__(68)('IE_PROTO');
3980var ObjectProto = Object.prototype;
3981
3982module.exports = Object.getPrototypeOf || function (O) {
3983 O = toObject(O);
3984 if (has(O, IE_PROTO)) return O[IE_PROTO];
3985 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
3986 return O.constructor.prototype;
3987 } return O instanceof Object ? ObjectProto : null;
3988};
3989
3990
3991/***/ }),
3992/* 102 */
3993/***/ (function(module, exports, __webpack_require__) {
3994
3995// call something on iterator step with safe closing on error
3996var anObject = __webpack_require__(17);
3997module.exports = function (iterator, fn, value, entries) {
3998 try {
3999 return entries ? fn(anObject(value)[0], value[1]) : fn(value);
4000 // 7.4.6 IteratorClose(iterator, completion)
4001 } catch (e) {
4002 var ret = iterator['return'];
4003 if (ret !== undefined) anObject(ret.call(iterator));
4004 throw e;
4005 }
4006};
4007
4008
4009/***/ }),
4010/* 103 */
4011/***/ (function(module, exports, __webpack_require__) {
4012
4013// check on default Array iterator
4014var Iterators = __webpack_require__(32);
4015var ITERATOR = __webpack_require__(7)('iterator');
4016var ArrayProto = Array.prototype;
4017
4018module.exports = function (it) {
4019 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
4020};
4021
4022
4023/***/ }),
4024/* 104 */
4025/***/ (function(module, exports, __webpack_require__) {
4026
4027// 7.3.20 SpeciesConstructor(O, defaultConstructor)
4028var anObject = __webpack_require__(17);
4029var aFunction = __webpack_require__(52);
4030var SPECIES = __webpack_require__(7)('species');
4031module.exports = function (O, D) {
4032 var C = anObject(O).constructor;
4033 var S;
4034 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
4035};
4036
4037
4038/***/ }),
4039/* 105 */
4040/***/ (function(module, exports, __webpack_require__) {
4041
4042var ctx = __webpack_require__(31);
4043var invoke = __webpack_require__(187);
4044var html = __webpack_require__(100);
4045var cel = __webpack_require__(64);
4046var global = __webpack_require__(6);
4047var process = global.process;
4048var setTask = global.setImmediate;
4049var clearTask = global.clearImmediate;
4050var MessageChannel = global.MessageChannel;
4051var Dispatch = global.Dispatch;
4052var counter = 0;
4053var queue = {};
4054var ONREADYSTATECHANGE = 'onreadystatechange';
4055var defer, channel, port;
4056var run = function () {
4057 var id = +this;
4058 // eslint-disable-next-line no-prototype-builtins
4059 if (queue.hasOwnProperty(id)) {
4060 var fn = queue[id];
4061 delete queue[id];
4062 fn();
4063 }
4064};
4065var listener = function (event) {
4066 run.call(event.data);
4067};
4068// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
4069if (!setTask || !clearTask) {
4070 setTask = function setImmediate(fn) {
4071 var args = [];
4072 var i = 1;
4073 while (arguments.length > i) args.push(arguments[i++]);
4074 queue[++counter] = function () {
4075 // eslint-disable-next-line no-new-func
4076 invoke(typeof fn == 'function' ? fn : Function(fn), args);
4077 };
4078 defer(counter);
4079 return counter;
4080 };
4081 clearTask = function clearImmediate(id) {
4082 delete queue[id];
4083 };
4084 // Node.js 0.8-
4085 if (__webpack_require__(43)(process) == 'process') {
4086 defer = function (id) {
4087 process.nextTick(ctx(run, id, 1));
4088 };
4089 // Sphere (JS game engine) Dispatch API
4090 } else if (Dispatch && Dispatch.now) {
4091 defer = function (id) {
4092 Dispatch.now(ctx(run, id, 1));
4093 };
4094 // Browsers with MessageChannel, includes WebWorkers
4095 } else if (MessageChannel) {
4096 channel = new MessageChannel();
4097 port = channel.port2;
4098 channel.port1.onmessage = listener;
4099 defer = ctx(port.postMessage, port, 1);
4100 // Browsers with postMessage, skip WebWorkers
4101 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
4102 } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
4103 defer = function (id) {
4104 global.postMessage(id + '', '*');
4105 };
4106 global.addEventListener('message', listener, false);
4107 // IE8-
4108 } else if (ONREADYSTATECHANGE in cel('script')) {
4109 defer = function (id) {
4110 html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
4111 html.removeChild(this);
4112 run.call(id);
4113 };
4114 };
4115 // Rest old browsers
4116 } else {
4117 defer = function (id) {
4118 setTimeout(ctx(run, id, 1), 0);
4119 };
4120 }
4121}
4122module.exports = {
4123 set: setTask,
4124 clear: clearTask
4125};
4126
4127
4128/***/ }),
4129/* 106 */
4130/***/ (function(module, exports) {
4131
4132module.exports = function (exec) {
4133 try {
4134 return { e: false, v: exec() };
4135 } catch (e) {
4136 return { e: true, v: e };
4137 }
4138};
4139
4140
4141/***/ }),
4142/* 107 */
4143/***/ (function(module, exports, __webpack_require__) {
4144
4145var anObject = __webpack_require__(17);
4146var isObject = __webpack_require__(20);
4147var newPromiseCapability = __webpack_require__(73);
4148
4149module.exports = function (C, x) {
4150 anObject(C);
4151 if (isObject(x) && x.constructor === C) return x;
4152 var promiseCapability = newPromiseCapability.f(C);
4153 var resolve = promiseCapability.resolve;
4154 resolve(x);
4155 return promiseCapability.promise;
4156};
4157
4158
4159/***/ }),
4160/* 108 */
4161/***/ (function(module, exports, __webpack_require__) {
4162
4163var ITERATOR = __webpack_require__(7)('iterator');
4164var SAFE_CLOSING = false;
4165
4166try {
4167 var riter = [7][ITERATOR]();
4168 riter['return'] = function () { SAFE_CLOSING = true; };
4169 // eslint-disable-next-line no-throw-literal
4170 Array.from(riter, function () { throw 2; });
4171} catch (e) { /* empty */ }
4172
4173module.exports = function (exec, skipClosing) {
4174 if (!skipClosing && !SAFE_CLOSING) return false;
4175 var safe = false;
4176 try {
4177 var arr = [7];
4178 var iter = arr[ITERATOR]();
4179 iter.next = function () { return { done: safe = true }; };
4180 arr[ITERATOR] = function () { return iter; };
4181 exec(arr);
4182 } catch (e) { /* empty */ }
4183 return safe;
4184};
4185
4186
4187/***/ }),
4188/* 109 */
4189/***/ (function(module, exports) {
4190
4191var g;
4192
4193// This works in non-strict mode
4194g = (function() {
4195 return this;
4196})();
4197
4198try {
4199 // This works if eval is allowed (see CSP)
4200 g = g || Function("return this")() || (1,eval)("this");
4201} catch(e) {
4202 // This works if the window reference is available
4203 if(typeof window === "object")
4204 g = window;
4205}
4206
4207// g can still be undefined, but nothing to do about it...
4208// We return undefined, instead of nothing here, so it's
4209// easier to handle this case. if(!global) { ...}
4210
4211module.exports = g;
4212
4213
4214/***/ }),
4215/* 110 */
4216/***/ (function(module, __webpack_exports__, __webpack_require__) {
4217
4218"use strict";
4219/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
4220// Is a given variable undefined?
4221function isUndefined(obj) {
4222 return obj === void 0;
4223}
4224
4225
4226/***/ }),
4227/* 111 */
4228/***/ (function(module, __webpack_exports__, __webpack_require__) {
4229
4230"use strict";
4231/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
4232/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4233
4234
4235// Is a given value a boolean?
4236function isBoolean(obj) {
4237 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
4238}
4239
4240
4241/***/ }),
4242/* 112 */
4243/***/ (function(module, __webpack_exports__, __webpack_require__) {
4244
4245"use strict";
4246/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
4247
4248
4249/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
4250
4251
4252/***/ }),
4253/* 113 */
4254/***/ (function(module, __webpack_exports__, __webpack_require__) {
4255
4256"use strict";
4257/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
4258
4259
4260/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
4261
4262
4263/***/ }),
4264/* 114 */
4265/***/ (function(module, __webpack_exports__, __webpack_require__) {
4266
4267"use strict";
4268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
4269
4270
4271/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
4272
4273
4274/***/ }),
4275/* 115 */
4276/***/ (function(module, __webpack_exports__, __webpack_require__) {
4277
4278"use strict";
4279/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
4280/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4281/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(112);
4282
4283
4284
4285// Is the given value `NaN`?
4286function isNaN(obj) {
4287 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
4288}
4289
4290
4291/***/ }),
4292/* 116 */
4293/***/ (function(module, __webpack_exports__, __webpack_require__) {
4294
4295"use strict";
4296/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4297/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(76);
4298/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(117);
4299/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(202);
4300
4301
4302
4303
4304
4305// Is a given value a typed array?
4306var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
4307function isTypedArray(obj) {
4308 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
4309 // Otherwise, fall back on the above regular expression.
4310 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)) :
4311 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
4312}
4313
4314/* 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));
4315
4316
4317/***/ }),
4318/* 117 */
4319/***/ (function(module, __webpack_exports__, __webpack_require__) {
4320
4321"use strict";
4322/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
4323// Predicate-generating function. Often useful outside of Underscore.
4324function constant(value) {
4325 return function() {
4326 return value;
4327 };
4328}
4329
4330
4331/***/ }),
4332/* 118 */
4333/***/ (function(module, __webpack_exports__, __webpack_require__) {
4334
4335"use strict";
4336/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
4337/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4338
4339
4340// Common internal logic for `isArrayLike` and `isBufferLike`.
4341function createSizePropertyCheck(getSizeProperty) {
4342 return function(collection) {
4343 var sizeProperty = getSizeProperty(collection);
4344 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
4345 }
4346}
4347
4348
4349/***/ }),
4350/* 119 */
4351/***/ (function(module, __webpack_exports__, __webpack_require__) {
4352
4353"use strict";
4354/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
4355// Internal helper to generate a function to obtain property `key` from `obj`.
4356function shallowProperty(key) {
4357 return function(obj) {
4358 return obj == null ? void 0 : obj[key];
4359 };
4360}
4361
4362
4363/***/ }),
4364/* 120 */
4365/***/ (function(module, __webpack_exports__, __webpack_require__) {
4366
4367"use strict";
4368/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
4369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
4371/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(22);
4372
4373
4374
4375
4376// Internal helper to create a simple lookup structure.
4377// `collectNonEnumProps` used to depend on `_.contains`, but this led to
4378// circular imports. `emulatedSet` is a one-off solution that only works for
4379// arrays of strings.
4380function emulatedSet(keys) {
4381 var hash = {};
4382 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
4383 return {
4384 contains: function(key) { return hash[key]; },
4385 push: function(key) {
4386 hash[key] = true;
4387 return keys.push(key);
4388 }
4389 };
4390}
4391
4392// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
4393// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
4394// needed.
4395function collectNonEnumProps(obj, keys) {
4396 keys = emulatedSet(keys);
4397 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
4398 var constructor = obj.constructor;
4399 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
4400
4401 // Constructor is a special case.
4402 var prop = 'constructor';
4403 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
4404
4405 while (nonEnumIdx--) {
4406 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
4407 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
4408 keys.push(prop);
4409 }
4410 }
4411}
4412
4413
4414/***/ }),
4415/* 121 */
4416/***/ (function(module, __webpack_exports__, __webpack_require__) {
4417
4418"use strict";
4419/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
4420/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
4421
4422
4423// Returns whether an object has a given set of `key:value` pairs.
4424function isMatch(object, attrs) {
4425 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
4426 if (object == null) return !length;
4427 var obj = Object(object);
4428 for (var i = 0; i < length; i++) {
4429 var key = _keys[i];
4430 if (attrs[key] !== obj[key] || !(key in obj)) return false;
4431 }
4432 return true;
4433}
4434
4435
4436/***/ }),
4437/* 122 */
4438/***/ (function(module, __webpack_exports__, __webpack_require__) {
4439
4440"use strict";
4441/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
4442/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
4443
4444
4445// Invert the keys and values of an object. The values must be serializable.
4446function invert(obj) {
4447 var result = {};
4448 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
4449 for (var i = 0, length = _keys.length; i < length; i++) {
4450 result[obj[_keys[i]]] = _keys[i];
4451 }
4452 return result;
4453}
4454
4455
4456/***/ }),
4457/* 123 */
4458/***/ (function(module, __webpack_exports__, __webpack_require__) {
4459
4460"use strict";
4461/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
4462/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(13);
4463
4464
4465// Return a sorted list of the function names available on the object.
4466function functions(obj) {
4467 var names = [];
4468 for (var key in obj) {
4469 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
4470 }
4471 return names.sort();
4472}
4473
4474
4475/***/ }),
4476/* 124 */
4477/***/ (function(module, __webpack_exports__, __webpack_require__) {
4478
4479"use strict";
4480/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(80);
4481/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(46);
4482
4483
4484
4485// Extend a given object with all the properties in passed-in object(s).
4486/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
4487
4488
4489/***/ }),
4490/* 125 */
4491/***/ (function(module, __webpack_exports__, __webpack_require__) {
4492
4493"use strict";
4494/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(80);
4495/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(46);
4496
4497
4498
4499// Fill in a given object with default properties.
4500/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
4501
4502
4503/***/ }),
4504/* 126 */
4505/***/ (function(module, __webpack_exports__, __webpack_require__) {
4506
4507"use strict";
4508/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
4509/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(26);
4510/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
4511
4512
4513
4514// Create a naked function reference for surrogate-prototype-swapping.
4515function ctor() {
4516 return function(){};
4517}
4518
4519// An internal function for creating a new object that inherits from another.
4520function baseCreate(prototype) {
4521 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
4522 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
4523 var Ctor = ctor();
4524 Ctor.prototype = prototype;
4525 var result = new Ctor;
4526 Ctor.prototype = null;
4527 return result;
4528}
4529
4530
4531/***/ }),
4532/* 127 */
4533/***/ (function(module, __webpack_exports__, __webpack_require__) {
4534
4535"use strict";
4536/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
4537/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(26);
4538/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(27);
4539/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(124);
4540
4541
4542
4543
4544// Create a (shallow-cloned) duplicate of an object.
4545function clone(obj) {
4546 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
4547 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
4548}
4549
4550
4551/***/ }),
4552/* 128 */
4553/***/ (function(module, __webpack_exports__, __webpack_require__) {
4554
4555"use strict";
4556/* harmony export (immutable) */ __webpack_exports__["a"] = get;
4557/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(47);
4558/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(82);
4559/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(110);
4560
4561
4562
4563
4564// Get the value of the (deep) property on `path` from `object`.
4565// If any property in `path` does not exist or if the value is
4566// `undefined`, return `defaultValue` instead.
4567// The `path` is normalized through `_.toPath`.
4568function get(object, path, defaultValue) {
4569 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
4570 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
4571}
4572
4573
4574/***/ }),
4575/* 129 */
4576/***/ (function(module, __webpack_exports__, __webpack_require__) {
4577
4578"use strict";
4579/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
4580/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
4581/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(27);
4582
4583
4584
4585// Normalize a (deep) property `path` to array.
4586// Like `_.iteratee`, this function can be customized.
4587function toPath(path) {
4588 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
4589}
4590__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
4591
4592
4593/***/ }),
4594/* 130 */
4595/***/ (function(module, __webpack_exports__, __webpack_require__) {
4596
4597"use strict";
4598/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
4599/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(83);
4600/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
4601/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(26);
4602/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(27);
4603/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(57);
4604/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(84);
4605/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(48);
4606
4607
4608
4609
4610
4611
4612
4613
4614// An internal function to generate callbacks that can be applied to each
4615// element in a collection, returning the desired result — either `_.identity`,
4616// an arbitrary callback, a property matcher, or a property accessor.
4617function baseIteratee(value, context, argCount) {
4618 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
4619 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
4620 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);
4621 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
4622}
4623
4624
4625/***/ }),
4626/* 131 */
4627/***/ (function(module, __webpack_exports__, __webpack_require__) {
4628
4629"use strict";
4630/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
4631/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
4632/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(130);
4633
4634
4635
4636// External wrapper for our callback generator. Users may customize
4637// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
4638// This abstraction hides the internal-only `argCount` argument.
4639function iteratee(value, context) {
4640 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
4641}
4642__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
4643
4644
4645/***/ }),
4646/* 132 */
4647/***/ (function(module, __webpack_exports__, __webpack_require__) {
4648
4649"use strict";
4650/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
4651// Predicate-generating function. Often useful outside of Underscore.
4652function noop(){}
4653
4654
4655/***/ }),
4656/* 133 */
4657/***/ (function(module, __webpack_exports__, __webpack_require__) {
4658
4659"use strict";
4660/* harmony export (immutable) */ __webpack_exports__["a"] = random;
4661// Return a random integer between `min` and `max` (inclusive).
4662function random(min, max) {
4663 if (max == null) {
4664 max = min;
4665 min = 0;
4666 }
4667 return min + Math.floor(Math.random() * (max - min + 1));
4668}
4669
4670
4671/***/ }),
4672/* 134 */
4673/***/ (function(module, __webpack_exports__, __webpack_require__) {
4674
4675"use strict";
4676/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
4677/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
4678
4679
4680// Internal helper to generate functions for escaping and unescaping strings
4681// to/from HTML interpolation.
4682function createEscaper(map) {
4683 var escaper = function(match) {
4684 return map[match];
4685 };
4686 // Regexes for identifying a key that needs to be escaped.
4687 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
4688 var testRegexp = RegExp(source);
4689 var replaceRegexp = RegExp(source, 'g');
4690 return function(string) {
4691 string = string == null ? '' : '' + string;
4692 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
4693 };
4694}
4695
4696
4697/***/ }),
4698/* 135 */
4699/***/ (function(module, __webpack_exports__, __webpack_require__) {
4700
4701"use strict";
4702// Internal list of HTML entities for escaping.
4703/* harmony default export */ __webpack_exports__["a"] = ({
4704 '&': '&amp;',
4705 '<': '&lt;',
4706 '>': '&gt;',
4707 '"': '&quot;',
4708 "'": '&#x27;',
4709 '`': '&#x60;'
4710});
4711
4712
4713/***/ }),
4714/* 136 */
4715/***/ (function(module, __webpack_exports__, __webpack_require__) {
4716
4717"use strict";
4718/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
4719
4720
4721// By default, Underscore uses ERB-style template delimiters. Change the
4722// following template settings to use alternative delimiters.
4723/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
4724 evaluate: /<%([\s\S]+?)%>/g,
4725 interpolate: /<%=([\s\S]+?)%>/g,
4726 escape: /<%-([\s\S]+?)%>/g
4727});
4728
4729
4730/***/ }),
4731/* 137 */
4732/***/ (function(module, __webpack_exports__, __webpack_require__) {
4733
4734"use strict";
4735/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
4736/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(126);
4737/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(26);
4738
4739
4740
4741// Internal function to execute `sourceFunc` bound to `context` with optional
4742// `args`. Determines whether to execute a function as a constructor or as a
4743// normal function.
4744function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
4745 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
4746 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
4747 var result = sourceFunc.apply(self, args);
4748 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
4749 return self;
4750}
4751
4752
4753/***/ }),
4754/* 138 */
4755/***/ (function(module, __webpack_exports__, __webpack_require__) {
4756
4757"use strict";
4758/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
4759/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
4760/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(137);
4761
4762
4763
4764
4765// Create a function bound to a given object (assigning `this`, and arguments,
4766// optionally).
4767/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
4768 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
4769 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
4770 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
4771 });
4772 return bound;
4773}));
4774
4775
4776/***/ }),
4777/* 139 */
4778/***/ (function(module, __webpack_exports__, __webpack_require__) {
4779
4780"use strict";
4781/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
4782
4783
4784// Delays a function for the given number of milliseconds, and then calls
4785// it with the arguments supplied.
4786/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
4787 return setTimeout(function() {
4788 return func.apply(null, args);
4789 }, wait);
4790}));
4791
4792
4793/***/ }),
4794/* 140 */
4795/***/ (function(module, __webpack_exports__, __webpack_require__) {
4796
4797"use strict";
4798/* harmony export (immutable) */ __webpack_exports__["a"] = before;
4799// Returns a function that will only be executed up to (but not including) the
4800// Nth call.
4801function before(times, func) {
4802 var memo;
4803 return function() {
4804 if (--times > 0) {
4805 memo = func.apply(this, arguments);
4806 }
4807 if (times <= 1) func = null;
4808 return memo;
4809 };
4810}
4811
4812
4813/***/ }),
4814/* 141 */
4815/***/ (function(module, __webpack_exports__, __webpack_require__) {
4816
4817"use strict";
4818/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
4819/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
4820/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
4821
4822
4823
4824// Returns the first key on an object that passes a truth test.
4825function findKey(obj, predicate, context) {
4826 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
4827 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
4828 for (var i = 0, length = _keys.length; i < length; i++) {
4829 key = _keys[i];
4830 if (predicate(obj[key], key, obj)) return key;
4831 }
4832}
4833
4834
4835/***/ }),
4836/* 142 */
4837/***/ (function(module, __webpack_exports__, __webpack_require__) {
4838
4839"use strict";
4840/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
4841/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
4842/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
4843
4844
4845
4846// Internal function to generate `_.findIndex` and `_.findLastIndex`.
4847function createPredicateIndexFinder(dir) {
4848 return function(array, predicate, context) {
4849 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
4850 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
4851 var index = dir > 0 ? 0 : length - 1;
4852 for (; index >= 0 && index < length; index += dir) {
4853 if (predicate(array[index], index, array)) return index;
4854 }
4855 return -1;
4856 };
4857}
4858
4859
4860/***/ }),
4861/* 143 */
4862/***/ (function(module, __webpack_exports__, __webpack_require__) {
4863
4864"use strict";
4865/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(142);
4866
4867
4868// Returns the last index on an array-like that passes a truth test.
4869/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
4870
4871
4872/***/ }),
4873/* 144 */
4874/***/ (function(module, __webpack_exports__, __webpack_require__) {
4875
4876"use strict";
4877/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
4878/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
4879/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
4880
4881
4882
4883// Use a comparator function to figure out the smallest index at which
4884// an object should be inserted so as to maintain order. Uses binary search.
4885function sortedIndex(array, obj, iteratee, context) {
4886 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
4887 var value = iteratee(obj);
4888 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
4889 while (low < high) {
4890 var mid = Math.floor((low + high) / 2);
4891 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
4892 }
4893 return low;
4894}
4895
4896
4897/***/ }),
4898/* 145 */
4899/***/ (function(module, __webpack_exports__, __webpack_require__) {
4900
4901"use strict";
4902/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(144);
4903/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(87);
4904/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(146);
4905
4906
4907
4908
4909// Return the position of the first occurrence of an item in an array,
4910// or -1 if the item is not included in the array.
4911// If the array is large and already in sort order, pass `true`
4912// for **isSorted** to use binary search.
4913/* 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 */]));
4914
4915
4916/***/ }),
4917/* 146 */
4918/***/ (function(module, __webpack_exports__, __webpack_require__) {
4919
4920"use strict";
4921/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
4922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
4923/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
4924/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(115);
4925
4926
4927
4928
4929// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
4930function createIndexFinder(dir, predicateFind, sortedIndex) {
4931 return function(array, item, idx) {
4932 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
4933 if (typeof idx == 'number') {
4934 if (dir > 0) {
4935 i = idx >= 0 ? idx : Math.max(idx + length, i);
4936 } else {
4937 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
4938 }
4939 } else if (sortedIndex && idx && length) {
4940 idx = sortedIndex(array, item);
4941 return array[idx] === item ? idx : -1;
4942 }
4943 if (item !== item) {
4944 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
4945 return idx >= 0 ? idx + i : -1;
4946 }
4947 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
4948 if (array[idx] === item) return idx;
4949 }
4950 return -1;
4951 };
4952}
4953
4954
4955/***/ }),
4956/* 147 */
4957/***/ (function(module, __webpack_exports__, __webpack_require__) {
4958
4959"use strict";
4960/* harmony export (immutable) */ __webpack_exports__["a"] = find;
4961/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4962/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(87);
4963/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(141);
4964
4965
4966
4967
4968// Return the first value which passes a truth test.
4969function find(obj, predicate, context) {
4970 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 */];
4971 var key = keyFinder(obj, predicate, context);
4972 if (key !== void 0 && key !== -1) return obj[key];
4973}
4974
4975
4976/***/ }),
4977/* 148 */
4978/***/ (function(module, __webpack_exports__, __webpack_require__) {
4979
4980"use strict";
4981/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
4982/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4983/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
4984/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(48);
4985
4986
4987
4988
4989// Internal helper to create a reducing function, iterating left or right.
4990function createReduce(dir) {
4991 // Wrap code that reassigns argument variables in a separate function than
4992 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
4993 var reducer = function(obj, iteratee, memo, initial) {
4994 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
4995 length = (_keys || obj).length,
4996 index = dir > 0 ? 0 : length - 1;
4997 if (!initial) {
4998 memo = obj[_keys ? _keys[index] : index];
4999 index += dir;
5000 }
5001 for (; index >= 0 && index < length; index += dir) {
5002 var currentKey = _keys ? _keys[index] : index;
5003 memo = iteratee(memo, obj[currentKey], currentKey, obj);
5004 }
5005 return memo;
5006 };
5007
5008 return function(obj, iteratee, memo, context) {
5009 var initial = arguments.length >= 3;
5010 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
5011 };
5012}
5013
5014
5015/***/ }),
5016/* 149 */
5017/***/ (function(module, __webpack_exports__, __webpack_require__) {
5018
5019"use strict";
5020/* harmony export (immutable) */ __webpack_exports__["a"] = max;
5021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
5022/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(33);
5023/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(8);
5024/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(28);
5025
5026
5027
5028
5029
5030// Return the maximum element (or element-based computation).
5031function max(obj, iteratee, context) {
5032 var result = -Infinity, lastComputed = -Infinity,
5033 value, computed;
5034 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
5035 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
5036 for (var i = 0, length = obj.length; i < length; i++) {
5037 value = obj[i];
5038 if (value != null && value > result) {
5039 result = value;
5040 }
5041 }
5042 } else {
5043 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
5044 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
5045 computed = iteratee(v, index, list);
5046 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
5047 result = v;
5048 lastComputed = computed;
5049 }
5050 });
5051 }
5052 return result;
5053}
5054
5055
5056/***/ }),
5057/* 150 */
5058/***/ (function(module, __webpack_exports__, __webpack_require__) {
5059
5060"use strict";
5061/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
5062/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
5063/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(127);
5064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(33);
5065/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(14);
5066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(133);
5067
5068
5069
5070
5071
5072
5073// Sample **n** random values from a collection using the modern version of the
5074// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
5075// If **n** is not specified, returns a single random element.
5076// The internal `guard` argument allows it to work with `_.map`.
5077function sample(obj, n, guard) {
5078 if (n == null || guard) {
5079 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
5080 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
5081 }
5082 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);
5083 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
5084 n = Math.max(Math.min(n, length), 0);
5085 var last = length - 1;
5086 for (var index = 0; index < n; index++) {
5087 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
5088 var temp = sample[index];
5089 sample[index] = sample[rand];
5090 sample[rand] = temp;
5091 }
5092 return sample.slice(0, n);
5093}
5094
5095
5096/***/ }),
5097/* 151 */
5098/***/ (function(module, __webpack_exports__, __webpack_require__) {
5099
5100"use strict";
5101/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
5102/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
5103/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(48);
5104/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(46);
5105/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(251);
5106/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(34);
5107
5108
5109
5110
5111
5112
5113
5114// Return a copy of the object only containing the allowed properties.
5115/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
5116 var result = {}, iteratee = keys[0];
5117 if (obj == null) return result;
5118 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
5119 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
5120 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
5121 } else {
5122 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
5123 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
5124 obj = Object(obj);
5125 }
5126 for (var i = 0, length = keys.length; i < length; i++) {
5127 var key = keys[i];
5128 var value = obj[key];
5129 if (iteratee(value, key, obj)) result[key] = value;
5130 }
5131 return result;
5132}));
5133
5134
5135/***/ }),
5136/* 152 */
5137/***/ (function(module, __webpack_exports__, __webpack_require__) {
5138
5139"use strict";
5140/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
5141/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
5142
5143
5144// Returns everything but the last entry of the array. Especially useful on
5145// the arguments object. Passing **n** will return all the values in
5146// the array, excluding the last N.
5147function initial(array, n, guard) {
5148 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
5149}
5150
5151
5152/***/ }),
5153/* 153 */
5154/***/ (function(module, __webpack_exports__, __webpack_require__) {
5155
5156"use strict";
5157/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
5158/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
5159
5160
5161// Returns everything but the first entry of the `array`. Especially useful on
5162// the `arguments` object. Passing an **n** will return the rest N values in the
5163// `array`.
5164function rest(array, n, guard) {
5165 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
5166}
5167
5168
5169/***/ }),
5170/* 154 */
5171/***/ (function(module, __webpack_exports__, __webpack_require__) {
5172
5173"use strict";
5174/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
5175/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(34);
5176/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(49);
5177/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(50);
5178
5179
5180
5181
5182
5183// Take the difference between one array and a number of other arrays.
5184// Only the elements present in just the first array will remain.
5185/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
5186 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
5187 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
5188 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
5189 });
5190}));
5191
5192
5193/***/ }),
5194/* 155 */
5195/***/ (function(module, __webpack_exports__, __webpack_require__) {
5196
5197"use strict";
5198/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
5199/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(111);
5200/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(8);
5201/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(14);
5202/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(50);
5203
5204
5205
5206
5207
5208// Produce a duplicate-free version of the array. If the array has already
5209// been sorted, you have the option of using a faster algorithm.
5210// The faster algorithm will not work with an iteratee if the iteratee
5211// is not a one-to-one function, so providing an iteratee will disable
5212// the faster algorithm.
5213function uniq(array, isSorted, iteratee, context) {
5214 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
5215 context = iteratee;
5216 iteratee = isSorted;
5217 isSorted = false;
5218 }
5219 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
5220 var result = [];
5221 var seen = [];
5222 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
5223 var value = array[i],
5224 computed = iteratee ? iteratee(value, i, array) : value;
5225 if (isSorted && !iteratee) {
5226 if (!i || seen !== computed) result.push(value);
5227 seen = computed;
5228 } else if (iteratee) {
5229 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
5230 seen.push(computed);
5231 result.push(value);
5232 }
5233 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
5234 result.push(value);
5235 }
5236 }
5237 return result;
5238}
5239
5240
5241/***/ }),
5242/* 156 */
5243/***/ (function(module, __webpack_exports__, __webpack_require__) {
5244
5245"use strict";
5246/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
5247/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(149);
5248/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
5249/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(88);
5250
5251
5252
5253
5254// Complement of zip. Unzip accepts an array of arrays and groups
5255// each array's elements on shared indices.
5256function unzip(array) {
5257 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
5258 var result = Array(length);
5259
5260 for (var index = 0; index < length; index++) {
5261 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
5262 }
5263 return result;
5264}
5265
5266
5267/***/ }),
5268/* 157 */
5269/***/ (function(module, __webpack_exports__, __webpack_require__) {
5270
5271"use strict";
5272/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
5273/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
5274
5275
5276// Helper function to continue chaining intermediate results.
5277function chainResult(instance, obj) {
5278 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
5279}
5280
5281
5282/***/ }),
5283/* 158 */
5284/***/ (function(module, exports, __webpack_require__) {
5285
5286module.exports = { "default": __webpack_require__(267), __esModule: true };
5287
5288/***/ }),
5289/* 159 */
5290/***/ (function(module, exports, __webpack_require__) {
5291
5292var rng = __webpack_require__(269);
5293var bytesToUuid = __webpack_require__(270);
5294
5295function v4(options, buf, offset) {
5296 var i = buf && offset || 0;
5297
5298 if (typeof(options) == 'string') {
5299 buf = options === 'binary' ? new Array(16) : null;
5300 options = null;
5301 }
5302 options = options || {};
5303
5304 var rnds = options.random || (options.rng || rng)();
5305
5306 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
5307 rnds[6] = (rnds[6] & 0x0f) | 0x40;
5308 rnds[8] = (rnds[8] & 0x3f) | 0x80;
5309
5310 // Copy bytes to buffer, if provided
5311 if (buf) {
5312 for (var ii = 0; ii < 16; ++ii) {
5313 buf[i + ii] = rnds[ii];
5314 }
5315 }
5316
5317 return buf || bytesToUuid(rnds);
5318}
5319
5320module.exports = v4;
5321
5322
5323/***/ }),
5324/* 160 */
5325/***/ (function(module, exports, __webpack_require__) {
5326
5327module.exports = { "default": __webpack_require__(273), __esModule: true };
5328
5329/***/ }),
5330/* 161 */
5331/***/ (function(module, exports, __webpack_require__) {
5332
5333"use strict";
5334
5335
5336module.exports = '4.12.2';
5337
5338/***/ }),
5339/* 162 */
5340/***/ (function(module, exports, __webpack_require__) {
5341
5342"use strict";
5343
5344
5345var has = Object.prototype.hasOwnProperty
5346 , prefix = '~';
5347
5348/**
5349 * Constructor to create a storage for our `EE` objects.
5350 * An `Events` instance is a plain object whose properties are event names.
5351 *
5352 * @constructor
5353 * @api private
5354 */
5355function Events() {}
5356
5357//
5358// We try to not inherit from `Object.prototype`. In some engines creating an
5359// instance in this way is faster than calling `Object.create(null)` directly.
5360// If `Object.create(null)` is not supported we prefix the event names with a
5361// character to make sure that the built-in object properties are not
5362// overridden or used as an attack vector.
5363//
5364if (Object.create) {
5365 Events.prototype = Object.create(null);
5366
5367 //
5368 // This hack is needed because the `__proto__` property is still inherited in
5369 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
5370 //
5371 if (!new Events().__proto__) prefix = false;
5372}
5373
5374/**
5375 * Representation of a single event listener.
5376 *
5377 * @param {Function} fn The listener function.
5378 * @param {Mixed} context The context to invoke the listener with.
5379 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
5380 * @constructor
5381 * @api private
5382 */
5383function EE(fn, context, once) {
5384 this.fn = fn;
5385 this.context = context;
5386 this.once = once || false;
5387}
5388
5389/**
5390 * Minimal `EventEmitter` interface that is molded against the Node.js
5391 * `EventEmitter` interface.
5392 *
5393 * @constructor
5394 * @api public
5395 */
5396function EventEmitter() {
5397 this._events = new Events();
5398 this._eventsCount = 0;
5399}
5400
5401/**
5402 * Return an array listing the events for which the emitter has registered
5403 * listeners.
5404 *
5405 * @returns {Array}
5406 * @api public
5407 */
5408EventEmitter.prototype.eventNames = function eventNames() {
5409 var names = []
5410 , events
5411 , name;
5412
5413 if (this._eventsCount === 0) return names;
5414
5415 for (name in (events = this._events)) {
5416 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
5417 }
5418
5419 if (Object.getOwnPropertySymbols) {
5420 return names.concat(Object.getOwnPropertySymbols(events));
5421 }
5422
5423 return names;
5424};
5425
5426/**
5427 * Return the listeners registered for a given event.
5428 *
5429 * @param {String|Symbol} event The event name.
5430 * @param {Boolean} exists Only check if there are listeners.
5431 * @returns {Array|Boolean}
5432 * @api public
5433 */
5434EventEmitter.prototype.listeners = function listeners(event, exists) {
5435 var evt = prefix ? prefix + event : event
5436 , available = this._events[evt];
5437
5438 if (exists) return !!available;
5439 if (!available) return [];
5440 if (available.fn) return [available.fn];
5441
5442 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
5443 ee[i] = available[i].fn;
5444 }
5445
5446 return ee;
5447};
5448
5449/**
5450 * Calls each of the listeners registered for a given event.
5451 *
5452 * @param {String|Symbol} event The event name.
5453 * @returns {Boolean} `true` if the event had listeners, else `false`.
5454 * @api public
5455 */
5456EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
5457 var evt = prefix ? prefix + event : event;
5458
5459 if (!this._events[evt]) return false;
5460
5461 var listeners = this._events[evt]
5462 , len = arguments.length
5463 , args
5464 , i;
5465
5466 if (listeners.fn) {
5467 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
5468
5469 switch (len) {
5470 case 1: return listeners.fn.call(listeners.context), true;
5471 case 2: return listeners.fn.call(listeners.context, a1), true;
5472 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
5473 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
5474 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
5475 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
5476 }
5477
5478 for (i = 1, args = new Array(len -1); i < len; i++) {
5479 args[i - 1] = arguments[i];
5480 }
5481
5482 listeners.fn.apply(listeners.context, args);
5483 } else {
5484 var length = listeners.length
5485 , j;
5486
5487 for (i = 0; i < length; i++) {
5488 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
5489
5490 switch (len) {
5491 case 1: listeners[i].fn.call(listeners[i].context); break;
5492 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
5493 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
5494 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
5495 default:
5496 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
5497 args[j - 1] = arguments[j];
5498 }
5499
5500 listeners[i].fn.apply(listeners[i].context, args);
5501 }
5502 }
5503 }
5504
5505 return true;
5506};
5507
5508/**
5509 * Add a listener for a given event.
5510 *
5511 * @param {String|Symbol} event The event name.
5512 * @param {Function} fn The listener function.
5513 * @param {Mixed} [context=this] The context to invoke the listener with.
5514 * @returns {EventEmitter} `this`.
5515 * @api public
5516 */
5517EventEmitter.prototype.on = function on(event, fn, context) {
5518 var listener = new EE(fn, context || this)
5519 , evt = prefix ? prefix + event : event;
5520
5521 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
5522 else if (!this._events[evt].fn) this._events[evt].push(listener);
5523 else this._events[evt] = [this._events[evt], listener];
5524
5525 return this;
5526};
5527
5528/**
5529 * Add a one-time listener for a given event.
5530 *
5531 * @param {String|Symbol} event The event name.
5532 * @param {Function} fn The listener function.
5533 * @param {Mixed} [context=this] The context to invoke the listener with.
5534 * @returns {EventEmitter} `this`.
5535 * @api public
5536 */
5537EventEmitter.prototype.once = function once(event, fn, context) {
5538 var listener = new EE(fn, context || this, true)
5539 , evt = prefix ? prefix + event : event;
5540
5541 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
5542 else if (!this._events[evt].fn) this._events[evt].push(listener);
5543 else this._events[evt] = [this._events[evt], listener];
5544
5545 return this;
5546};
5547
5548/**
5549 * Remove the listeners of a given event.
5550 *
5551 * @param {String|Symbol} event The event name.
5552 * @param {Function} fn Only remove the listeners that match this function.
5553 * @param {Mixed} context Only remove the listeners that have this context.
5554 * @param {Boolean} once Only remove one-time listeners.
5555 * @returns {EventEmitter} `this`.
5556 * @api public
5557 */
5558EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
5559 var evt = prefix ? prefix + event : event;
5560
5561 if (!this._events[evt]) return this;
5562 if (!fn) {
5563 if (--this._eventsCount === 0) this._events = new Events();
5564 else delete this._events[evt];
5565 return this;
5566 }
5567
5568 var listeners = this._events[evt];
5569
5570 if (listeners.fn) {
5571 if (
5572 listeners.fn === fn
5573 && (!once || listeners.once)
5574 && (!context || listeners.context === context)
5575 ) {
5576 if (--this._eventsCount === 0) this._events = new Events();
5577 else delete this._events[evt];
5578 }
5579 } else {
5580 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
5581 if (
5582 listeners[i].fn !== fn
5583 || (once && !listeners[i].once)
5584 || (context && listeners[i].context !== context)
5585 ) {
5586 events.push(listeners[i]);
5587 }
5588 }
5589
5590 //
5591 // Reset the array, or remove it completely if we have no more listeners.
5592 //
5593 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
5594 else if (--this._eventsCount === 0) this._events = new Events();
5595 else delete this._events[evt];
5596 }
5597
5598 return this;
5599};
5600
5601/**
5602 * Remove all listeners, or those of the specified event.
5603 *
5604 * @param {String|Symbol} [event] The event name.
5605 * @returns {EventEmitter} `this`.
5606 * @api public
5607 */
5608EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
5609 var evt;
5610
5611 if (event) {
5612 evt = prefix ? prefix + event : event;
5613 if (this._events[evt]) {
5614 if (--this._eventsCount === 0) this._events = new Events();
5615 else delete this._events[evt];
5616 }
5617 } else {
5618 this._events = new Events();
5619 this._eventsCount = 0;
5620 }
5621
5622 return this;
5623};
5624
5625//
5626// Alias methods names because people roll like that.
5627//
5628EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
5629EventEmitter.prototype.addListener = EventEmitter.prototype.on;
5630
5631//
5632// This function doesn't apply anymore.
5633//
5634EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
5635 return this;
5636};
5637
5638//
5639// Expose the prefix.
5640//
5641EventEmitter.prefixed = prefix;
5642
5643//
5644// Allow `EventEmitter` to be imported as module namespace.
5645//
5646EventEmitter.EventEmitter = EventEmitter;
5647
5648//
5649// Expose the module.
5650//
5651if (true) {
5652 module.exports = EventEmitter;
5653}
5654
5655
5656/***/ }),
5657/* 163 */
5658/***/ (function(module, exports, __webpack_require__) {
5659
5660"use strict";
5661
5662
5663var _promise = __webpack_require__(3);
5664
5665var _promise2 = _interopRequireDefault(_promise);
5666
5667function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5668
5669var _require = __webpack_require__(38),
5670 getAdapter = _require.getAdapter;
5671
5672var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
5673
5674var localStorage = {
5675 get async() {
5676 return getAdapter('storage').async;
5677 }
5678};
5679
5680// wrap sync apis with async ones.
5681syncApiNames.forEach(function (apiName) {
5682 localStorage[apiName + 'Async'] = function () {
5683 var storage = getAdapter('storage');
5684 return _promise2.default.resolve(storage[apiName].apply(storage, arguments));
5685 };
5686
5687 localStorage[apiName] = function () {
5688 var storage = getAdapter('storage');
5689 if (!storage.async) {
5690 return storage[apiName].apply(storage, arguments);
5691 }
5692 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
5693 error.code = 'SYNC_API_NOT_AVAILABLE';
5694 throw error;
5695 };
5696});
5697
5698module.exports = localStorage;
5699
5700/***/ }),
5701/* 164 */
5702/***/ (function(module, exports, __webpack_require__) {
5703
5704"use strict";
5705
5706
5707var _stringify = __webpack_require__(19);
5708
5709var _stringify2 = _interopRequireDefault(_stringify);
5710
5711function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5712
5713var storage = __webpack_require__(163);
5714var AV = __webpack_require__(36);
5715
5716var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
5717
5718var getCacheData = function getCacheData(cacheData, key) {
5719 try {
5720 cacheData = JSON.parse(cacheData);
5721 } catch (e) {
5722 return null;
5723 }
5724 if (cacheData) {
5725 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
5726 if (!expired) {
5727 return cacheData.value;
5728 }
5729 return removeAsync(key).then(function () {
5730 return null;
5731 });
5732 }
5733 return null;
5734};
5735
5736exports.getAsync = function (key) {
5737 key = 'AV/' + AV.applicationId + '/' + key;
5738 return storage.getItemAsync(key).then(function (cache) {
5739 return getCacheData(cache, key);
5740 });
5741};
5742
5743exports.setAsync = function (key, value, ttl) {
5744 var cache = { value: value };
5745 if (typeof ttl === 'number') {
5746 cache.expiredAt = Date.now() + ttl;
5747 }
5748 return storage.setItemAsync('AV/' + AV.applicationId + '/' + key, (0, _stringify2.default)(cache));
5749};
5750
5751/***/ }),
5752/* 165 */
5753/***/ (function(module, exports) {
5754
5755exports.f = Object.getOwnPropertySymbols;
5756
5757
5758/***/ }),
5759/* 166 */
5760/***/ (function(module, exports, __webpack_require__) {
5761
5762// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
5763var $keys = __webpack_require__(99);
5764var hiddenKeys = __webpack_require__(70).concat('length', 'prototype');
5765
5766exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
5767 return $keys(O, hiddenKeys);
5768};
5769
5770
5771/***/ }),
5772/* 167 */
5773/***/ (function(module, exports, __webpack_require__) {
5774
5775module.exports = { "default": __webpack_require__(308), __esModule: true };
5776
5777/***/ }),
5778/* 168 */
5779/***/ (function(module, exports) {
5780
5781var charenc = {
5782 // UTF-8 encoding
5783 utf8: {
5784 // Convert a string to a byte array
5785 stringToBytes: function(str) {
5786 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
5787 },
5788
5789 // Convert a byte array to a string
5790 bytesToString: function(bytes) {
5791 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
5792 }
5793 },
5794
5795 // Binary encoding
5796 bin: {
5797 // Convert a string to a byte array
5798 stringToBytes: function(str) {
5799 for (var bytes = [], i = 0; i < str.length; i++)
5800 bytes.push(str.charCodeAt(i) & 0xFF);
5801 return bytes;
5802 },
5803
5804 // Convert a byte array to a string
5805 bytesToString: function(bytes) {
5806 for (var str = [], i = 0; i < bytes.length; i++)
5807 str.push(String.fromCharCode(bytes[i]));
5808 return str.join('');
5809 }
5810 }
5811};
5812
5813module.exports = charenc;
5814
5815
5816/***/ }),
5817/* 169 */
5818/***/ (function(module, exports, __webpack_require__) {
5819
5820module.exports = { "default": __webpack_require__(321), __esModule: true };
5821
5822/***/ }),
5823/* 170 */
5824/***/ (function(module, exports, __webpack_require__) {
5825
5826"use strict";
5827
5828
5829var _iterator = __webpack_require__(61);
5830
5831var _iterator2 = _interopRequireDefault(_iterator);
5832
5833var _typeof3 = __webpack_require__(30);
5834
5835var _typeof4 = _interopRequireDefault(_typeof3);
5836
5837var _symbol = __webpack_require__(51);
5838
5839var _symbol2 = _interopRequireDefault(_symbol);
5840
5841function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5842
5843function _typeof(obj) {
5844 "@babel/helpers - typeof";
5845 if (typeof _symbol2.default === "function" && (0, _typeof4.default)(_iterator2.default) === "symbol") {
5846 _typeof = function _typeof(obj) {
5847 return typeof obj === "undefined" ? "undefined" : (0, _typeof4.default)(obj);
5848 };
5849 } else {
5850 _typeof = function _typeof(obj) {
5851 return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : (0, _typeof4.default)(obj);
5852 };
5853 }return _typeof(obj);
5854}
5855
5856/**
5857 * Check if `obj` is an object.
5858 *
5859 * @param {Object} obj
5860 * @return {Boolean}
5861 * @api private
5862 */
5863function isObject(obj) {
5864 return obj !== null && _typeof(obj) === 'object';
5865}
5866
5867module.exports = isObject;
5868
5869/***/ }),
5870/* 171 */
5871/***/ (function(module, exports, __webpack_require__) {
5872
5873"use strict";
5874
5875
5876var AV = __webpack_require__(172);
5877var useAdatpers = __webpack_require__(337);
5878
5879module.exports = useAdatpers(AV);
5880
5881/***/ }),
5882/* 172 */
5883/***/ (function(module, exports, __webpack_require__) {
5884
5885"use strict";
5886
5887
5888module.exports = __webpack_require__(173);
5889
5890/***/ }),
5891/* 173 */
5892/***/ (function(module, exports, __webpack_require__) {
5893
5894"use strict";
5895
5896
5897var _promise = __webpack_require__(3);
5898
5899var _promise2 = _interopRequireDefault(_promise);
5900
5901function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5902
5903/*!
5904 * LeanCloud JavaScript SDK
5905 * https://leancloud.cn
5906 *
5907 * Copyright 2016 LeanCloud.cn, Inc.
5908 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
5909 */
5910var _ = __webpack_require__(0);
5911
5912var AV = __webpack_require__(36);
5913
5914AV._ = _;
5915AV.version = __webpack_require__(161);
5916AV.Promise = _promise2.default;
5917AV.localStorage = __webpack_require__(163);
5918AV.Cache = __webpack_require__(164);
5919AV.Error = __webpack_require__(29);
5920
5921__webpack_require__(275);
5922__webpack_require__(289)(AV);
5923__webpack_require__(290)(AV);
5924__webpack_require__(291)(AV);
5925__webpack_require__(292)(AV);
5926__webpack_require__(293)(AV);
5927__webpack_require__(294)(AV);
5928__webpack_require__(316)(AV);
5929__webpack_require__(323)(AV);
5930__webpack_require__(324)(AV);
5931__webpack_require__(326)(AV);
5932__webpack_require__(327)(AV);
5933__webpack_require__(328)(AV);
5934__webpack_require__(329)(AV);
5935__webpack_require__(330)(AV);
5936__webpack_require__(331)(AV);
5937__webpack_require__(332)(AV);
5938__webpack_require__(333)(AV);
5939__webpack_require__(334)(AV);
5940
5941AV.Conversation = __webpack_require__(335);
5942__webpack_require__(336);
5943module.exports = AV;
5944
5945/**
5946 * Options to controll the authentication for an operation
5947 * @typedef {Object} AuthOptions
5948 * @property {String} [sessionToken] Specify a user to excute the operation as.
5949 * @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.
5950 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
5951 */
5952
5953/**
5954 * Options to controll the authentication for an SMS operation
5955 * @typedef {Object} SMSAuthOptions
5956 * @property {String} [sessionToken] Specify a user to excute the operation as.
5957 * @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.
5958 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
5959 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
5960 */
5961
5962/***/ }),
5963/* 174 */
5964/***/ (function(module, exports, __webpack_require__) {
5965
5966__webpack_require__(95);
5967__webpack_require__(39);
5968__webpack_require__(56);
5969__webpack_require__(184);
5970__webpack_require__(192);
5971__webpack_require__(193);
5972module.exports = __webpack_require__(2).Promise;
5973
5974
5975/***/ }),
5976/* 175 */
5977/***/ (function(module, exports, __webpack_require__) {
5978
5979var toInteger = __webpack_require__(62);
5980var defined = __webpack_require__(63);
5981// true -> String#at
5982// false -> String#codePointAt
5983module.exports = function (TO_STRING) {
5984 return function (that, pos) {
5985 var s = String(defined(that));
5986 var i = toInteger(pos);
5987 var l = s.length;
5988 var a, b;
5989 if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
5990 a = s.charCodeAt(i);
5991 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
5992 ? TO_STRING ? s.charAt(i) : a
5993 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
5994 };
5995};
5996
5997
5998/***/ }),
5999/* 176 */
6000/***/ (function(module, exports, __webpack_require__) {
6001
6002"use strict";
6003
6004var create = __webpack_require__(66);
6005var descriptor = __webpack_require__(42);
6006var setToStringTag = __webpack_require__(55);
6007var IteratorPrototype = {};
6008
6009// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
6010__webpack_require__(23)(IteratorPrototype, __webpack_require__(7)('iterator'), function () { return this; });
6011
6012module.exports = function (Constructor, NAME, next) {
6013 Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
6014 setToStringTag(Constructor, NAME + ' Iterator');
6015};
6016
6017
6018/***/ }),
6019/* 177 */
6020/***/ (function(module, exports, __webpack_require__) {
6021
6022var dP = __webpack_require__(18);
6023var anObject = __webpack_require__(17);
6024var getKeys = __webpack_require__(53);
6025
6026module.exports = __webpack_require__(21) ? Object.defineProperties : function defineProperties(O, Properties) {
6027 anObject(O);
6028 var keys = getKeys(Properties);
6029 var length = keys.length;
6030 var i = 0;
6031 var P;
6032 while (length > i) dP.f(O, P = keys[i++], Properties[P]);
6033 return O;
6034};
6035
6036
6037/***/ }),
6038/* 178 */
6039/***/ (function(module, exports, __webpack_require__) {
6040
6041// fallback for non-array-like ES3 and non-enumerable old V8 strings
6042var cof = __webpack_require__(43);
6043// eslint-disable-next-line no-prototype-builtins
6044module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
6045 return cof(it) == 'String' ? it.split('') : Object(it);
6046};
6047
6048
6049/***/ }),
6050/* 179 */
6051/***/ (function(module, exports, __webpack_require__) {
6052
6053// false -> Array#indexOf
6054// true -> Array#includes
6055var toIObject = __webpack_require__(25);
6056var toLength = __webpack_require__(67);
6057var toAbsoluteIndex = __webpack_require__(180);
6058module.exports = function (IS_INCLUDES) {
6059 return function ($this, el, fromIndex) {
6060 var O = toIObject($this);
6061 var length = toLength(O.length);
6062 var index = toAbsoluteIndex(fromIndex, length);
6063 var value;
6064 // Array#includes uses SameValueZero equality algorithm
6065 // eslint-disable-next-line no-self-compare
6066 if (IS_INCLUDES && el != el) while (length > index) {
6067 value = O[index++];
6068 // eslint-disable-next-line no-self-compare
6069 if (value != value) return true;
6070 // Array#indexOf ignores holes, Array#includes - not
6071 } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
6072 if (O[index] === el) return IS_INCLUDES || index || 0;
6073 } return !IS_INCLUDES && -1;
6074 };
6075};
6076
6077
6078/***/ }),
6079/* 180 */
6080/***/ (function(module, exports, __webpack_require__) {
6081
6082var toInteger = __webpack_require__(62);
6083var max = Math.max;
6084var min = Math.min;
6085module.exports = function (index, length) {
6086 index = toInteger(index);
6087 return index < 0 ? max(index + length, 0) : min(index, length);
6088};
6089
6090
6091/***/ }),
6092/* 181 */
6093/***/ (function(module, exports, __webpack_require__) {
6094
6095"use strict";
6096
6097var addToUnscopables = __webpack_require__(182);
6098var step = __webpack_require__(183);
6099var Iterators = __webpack_require__(32);
6100var toIObject = __webpack_require__(25);
6101
6102// 22.1.3.4 Array.prototype.entries()
6103// 22.1.3.13 Array.prototype.keys()
6104// 22.1.3.29 Array.prototype.values()
6105// 22.1.3.30 Array.prototype[@@iterator]()
6106module.exports = __webpack_require__(96)(Array, 'Array', function (iterated, kind) {
6107 this._t = toIObject(iterated); // target
6108 this._i = 0; // next index
6109 this._k = kind; // kind
6110// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
6111}, function () {
6112 var O = this._t;
6113 var kind = this._k;
6114 var index = this._i++;
6115 if (!O || index >= O.length) {
6116 this._t = undefined;
6117 return step(1);
6118 }
6119 if (kind == 'keys') return step(0, index);
6120 if (kind == 'values') return step(0, O[index]);
6121 return step(0, [index, O[index]]);
6122}, 'values');
6123
6124// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
6125Iterators.Arguments = Iterators.Array;
6126
6127addToUnscopables('keys');
6128addToUnscopables('values');
6129addToUnscopables('entries');
6130
6131
6132/***/ }),
6133/* 182 */
6134/***/ (function(module, exports) {
6135
6136module.exports = function () { /* empty */ };
6137
6138
6139/***/ }),
6140/* 183 */
6141/***/ (function(module, exports) {
6142
6143module.exports = function (done, value) {
6144 return { value: value, done: !!done };
6145};
6146
6147
6148/***/ }),
6149/* 184 */
6150/***/ (function(module, exports, __webpack_require__) {
6151
6152"use strict";
6153
6154var LIBRARY = __webpack_require__(40);
6155var global = __webpack_require__(6);
6156var ctx = __webpack_require__(31);
6157var classof = __webpack_require__(71);
6158var $export = __webpack_require__(16);
6159var isObject = __webpack_require__(20);
6160var aFunction = __webpack_require__(52);
6161var anInstance = __webpack_require__(185);
6162var forOf = __webpack_require__(186);
6163var speciesConstructor = __webpack_require__(104);
6164var task = __webpack_require__(105).set;
6165var microtask = __webpack_require__(188)();
6166var newPromiseCapabilityModule = __webpack_require__(73);
6167var perform = __webpack_require__(106);
6168var userAgent = __webpack_require__(189);
6169var promiseResolve = __webpack_require__(107);
6170var PROMISE = 'Promise';
6171var TypeError = global.TypeError;
6172var process = global.process;
6173var versions = process && process.versions;
6174var v8 = versions && versions.v8 || '';
6175var $Promise = global[PROMISE];
6176var isNode = classof(process) == 'process';
6177var empty = function () { /* empty */ };
6178var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
6179var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
6180
6181var USE_NATIVE = !!function () {
6182 try {
6183 // correct subclassing with @@species support
6184 var promise = $Promise.resolve(1);
6185 var FakePromise = (promise.constructor = {})[__webpack_require__(7)('species')] = function (exec) {
6186 exec(empty, empty);
6187 };
6188 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
6189 return (isNode || typeof PromiseRejectionEvent == 'function')
6190 && promise.then(empty) instanceof FakePromise
6191 // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
6192 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
6193 // we can't detect it synchronously, so just check versions
6194 && v8.indexOf('6.6') !== 0
6195 && userAgent.indexOf('Chrome/66') === -1;
6196 } catch (e) { /* empty */ }
6197}();
6198
6199// helpers
6200var isThenable = function (it) {
6201 var then;
6202 return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
6203};
6204var notify = function (promise, isReject) {
6205 if (promise._n) return;
6206 promise._n = true;
6207 var chain = promise._c;
6208 microtask(function () {
6209 var value = promise._v;
6210 var ok = promise._s == 1;
6211 var i = 0;
6212 var run = function (reaction) {
6213 var handler = ok ? reaction.ok : reaction.fail;
6214 var resolve = reaction.resolve;
6215 var reject = reaction.reject;
6216 var domain = reaction.domain;
6217 var result, then, exited;
6218 try {
6219 if (handler) {
6220 if (!ok) {
6221 if (promise._h == 2) onHandleUnhandled(promise);
6222 promise._h = 1;
6223 }
6224 if (handler === true) result = value;
6225 else {
6226 if (domain) domain.enter();
6227 result = handler(value); // may throw
6228 if (domain) {
6229 domain.exit();
6230 exited = true;
6231 }
6232 }
6233 if (result === reaction.promise) {
6234 reject(TypeError('Promise-chain cycle'));
6235 } else if (then = isThenable(result)) {
6236 then.call(result, resolve, reject);
6237 } else resolve(result);
6238 } else reject(value);
6239 } catch (e) {
6240 if (domain && !exited) domain.exit();
6241 reject(e);
6242 }
6243 };
6244 while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
6245 promise._c = [];
6246 promise._n = false;
6247 if (isReject && !promise._h) onUnhandled(promise);
6248 });
6249};
6250var onUnhandled = function (promise) {
6251 task.call(global, function () {
6252 var value = promise._v;
6253 var unhandled = isUnhandled(promise);
6254 var result, handler, console;
6255 if (unhandled) {
6256 result = perform(function () {
6257 if (isNode) {
6258 process.emit('unhandledRejection', value, promise);
6259 } else if (handler = global.onunhandledrejection) {
6260 handler({ promise: promise, reason: value });
6261 } else if ((console = global.console) && console.error) {
6262 console.error('Unhandled promise rejection', value);
6263 }
6264 });
6265 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
6266 promise._h = isNode || isUnhandled(promise) ? 2 : 1;
6267 } promise._a = undefined;
6268 if (unhandled && result.e) throw result.v;
6269 });
6270};
6271var isUnhandled = function (promise) {
6272 return promise._h !== 1 && (promise._a || promise._c).length === 0;
6273};
6274var onHandleUnhandled = function (promise) {
6275 task.call(global, function () {
6276 var handler;
6277 if (isNode) {
6278 process.emit('rejectionHandled', promise);
6279 } else if (handler = global.onrejectionhandled) {
6280 handler({ promise: promise, reason: promise._v });
6281 }
6282 });
6283};
6284var $reject = function (value) {
6285 var promise = this;
6286 if (promise._d) return;
6287 promise._d = true;
6288 promise = promise._w || promise; // unwrap
6289 promise._v = value;
6290 promise._s = 2;
6291 if (!promise._a) promise._a = promise._c.slice();
6292 notify(promise, true);
6293};
6294var $resolve = function (value) {
6295 var promise = this;
6296 var then;
6297 if (promise._d) return;
6298 promise._d = true;
6299 promise = promise._w || promise; // unwrap
6300 try {
6301 if (promise === value) throw TypeError("Promise can't be resolved itself");
6302 if (then = isThenable(value)) {
6303 microtask(function () {
6304 var wrapper = { _w: promise, _d: false }; // wrap
6305 try {
6306 then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
6307 } catch (e) {
6308 $reject.call(wrapper, e);
6309 }
6310 });
6311 } else {
6312 promise._v = value;
6313 promise._s = 1;
6314 notify(promise, false);
6315 }
6316 } catch (e) {
6317 $reject.call({ _w: promise, _d: false }, e); // wrap
6318 }
6319};
6320
6321// constructor polyfill
6322if (!USE_NATIVE) {
6323 // 25.4.3.1 Promise(executor)
6324 $Promise = function Promise(executor) {
6325 anInstance(this, $Promise, PROMISE, '_h');
6326 aFunction(executor);
6327 Internal.call(this);
6328 try {
6329 executor(ctx($resolve, this, 1), ctx($reject, this, 1));
6330 } catch (err) {
6331 $reject.call(this, err);
6332 }
6333 };
6334 // eslint-disable-next-line no-unused-vars
6335 Internal = function Promise(executor) {
6336 this._c = []; // <- awaiting reactions
6337 this._a = undefined; // <- checked in isUnhandled reactions
6338 this._s = 0; // <- state
6339 this._d = false; // <- done
6340 this._v = undefined; // <- value
6341 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
6342 this._n = false; // <- notify
6343 };
6344 Internal.prototype = __webpack_require__(190)($Promise.prototype, {
6345 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
6346 then: function then(onFulfilled, onRejected) {
6347 var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
6348 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
6349 reaction.fail = typeof onRejected == 'function' && onRejected;
6350 reaction.domain = isNode ? process.domain : undefined;
6351 this._c.push(reaction);
6352 if (this._a) this._a.push(reaction);
6353 if (this._s) notify(this, false);
6354 return reaction.promise;
6355 },
6356 // 25.4.5.1 Promise.prototype.catch(onRejected)
6357 'catch': function (onRejected) {
6358 return this.then(undefined, onRejected);
6359 }
6360 });
6361 OwnPromiseCapability = function () {
6362 var promise = new Internal();
6363 this.promise = promise;
6364 this.resolve = ctx($resolve, promise, 1);
6365 this.reject = ctx($reject, promise, 1);
6366 };
6367 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
6368 return C === $Promise || C === Wrapper
6369 ? new OwnPromiseCapability(C)
6370 : newGenericPromiseCapability(C);
6371 };
6372}
6373
6374$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
6375__webpack_require__(55)($Promise, PROMISE);
6376__webpack_require__(191)(PROMISE);
6377Wrapper = __webpack_require__(2)[PROMISE];
6378
6379// statics
6380$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
6381 // 25.4.4.5 Promise.reject(r)
6382 reject: function reject(r) {
6383 var capability = newPromiseCapability(this);
6384 var $$reject = capability.reject;
6385 $$reject(r);
6386 return capability.promise;
6387 }
6388});
6389$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
6390 // 25.4.4.6 Promise.resolve(x)
6391 resolve: function resolve(x) {
6392 return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
6393 }
6394});
6395$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(108)(function (iter) {
6396 $Promise.all(iter)['catch'](empty);
6397})), PROMISE, {
6398 // 25.4.4.1 Promise.all(iterable)
6399 all: function all(iterable) {
6400 var C = this;
6401 var capability = newPromiseCapability(C);
6402 var resolve = capability.resolve;
6403 var reject = capability.reject;
6404 var result = perform(function () {
6405 var values = [];
6406 var index = 0;
6407 var remaining = 1;
6408 forOf(iterable, false, function (promise) {
6409 var $index = index++;
6410 var alreadyCalled = false;
6411 values.push(undefined);
6412 remaining++;
6413 C.resolve(promise).then(function (value) {
6414 if (alreadyCalled) return;
6415 alreadyCalled = true;
6416 values[$index] = value;
6417 --remaining || resolve(values);
6418 }, reject);
6419 });
6420 --remaining || resolve(values);
6421 });
6422 if (result.e) reject(result.v);
6423 return capability.promise;
6424 },
6425 // 25.4.4.4 Promise.race(iterable)
6426 race: function race(iterable) {
6427 var C = this;
6428 var capability = newPromiseCapability(C);
6429 var reject = capability.reject;
6430 var result = perform(function () {
6431 forOf(iterable, false, function (promise) {
6432 C.resolve(promise).then(capability.resolve, reject);
6433 });
6434 });
6435 if (result.e) reject(result.v);
6436 return capability.promise;
6437 }
6438});
6439
6440
6441/***/ }),
6442/* 185 */
6443/***/ (function(module, exports) {
6444
6445module.exports = function (it, Constructor, name, forbiddenField) {
6446 if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
6447 throw TypeError(name + ': incorrect invocation!');
6448 } return it;
6449};
6450
6451
6452/***/ }),
6453/* 186 */
6454/***/ (function(module, exports, __webpack_require__) {
6455
6456var ctx = __webpack_require__(31);
6457var call = __webpack_require__(102);
6458var isArrayIter = __webpack_require__(103);
6459var anObject = __webpack_require__(17);
6460var toLength = __webpack_require__(67);
6461var getIterFn = __webpack_require__(72);
6462var BREAK = {};
6463var RETURN = {};
6464var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
6465 var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
6466 var f = ctx(fn, that, entries ? 2 : 1);
6467 var index = 0;
6468 var length, step, iterator, result;
6469 if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
6470 // fast case for arrays with default iterator
6471 if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
6472 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
6473 if (result === BREAK || result === RETURN) return result;
6474 } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
6475 result = call(iterator, f, step.value, entries);
6476 if (result === BREAK || result === RETURN) return result;
6477 }
6478};
6479exports.BREAK = BREAK;
6480exports.RETURN = RETURN;
6481
6482
6483/***/ }),
6484/* 187 */
6485/***/ (function(module, exports) {
6486
6487// fast apply, http://jsperf.lnkit.com/fast-apply/5
6488module.exports = function (fn, args, that) {
6489 var un = that === undefined;
6490 switch (args.length) {
6491 case 0: return un ? fn()
6492 : fn.call(that);
6493 case 1: return un ? fn(args[0])
6494 : fn.call(that, args[0]);
6495 case 2: return un ? fn(args[0], args[1])
6496 : fn.call(that, args[0], args[1]);
6497 case 3: return un ? fn(args[0], args[1], args[2])
6498 : fn.call(that, args[0], args[1], args[2]);
6499 case 4: return un ? fn(args[0], args[1], args[2], args[3])
6500 : fn.call(that, args[0], args[1], args[2], args[3]);
6501 } return fn.apply(that, args);
6502};
6503
6504
6505/***/ }),
6506/* 188 */
6507/***/ (function(module, exports, __webpack_require__) {
6508
6509var global = __webpack_require__(6);
6510var macrotask = __webpack_require__(105).set;
6511var Observer = global.MutationObserver || global.WebKitMutationObserver;
6512var process = global.process;
6513var Promise = global.Promise;
6514var isNode = __webpack_require__(43)(process) == 'process';
6515
6516module.exports = function () {
6517 var head, last, notify;
6518
6519 var flush = function () {
6520 var parent, fn;
6521 if (isNode && (parent = process.domain)) parent.exit();
6522 while (head) {
6523 fn = head.fn;
6524 head = head.next;
6525 try {
6526 fn();
6527 } catch (e) {
6528 if (head) notify();
6529 else last = undefined;
6530 throw e;
6531 }
6532 } last = undefined;
6533 if (parent) parent.enter();
6534 };
6535
6536 // Node.js
6537 if (isNode) {
6538 notify = function () {
6539 process.nextTick(flush);
6540 };
6541 // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
6542 } else if (Observer && !(global.navigator && global.navigator.standalone)) {
6543 var toggle = true;
6544 var node = document.createTextNode('');
6545 new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
6546 notify = function () {
6547 node.data = toggle = !toggle;
6548 };
6549 // environments with maybe non-completely correct, but existent Promise
6550 } else if (Promise && Promise.resolve) {
6551 // Promise.resolve without an argument throws an error in LG WebOS 2
6552 var promise = Promise.resolve(undefined);
6553 notify = function () {
6554 promise.then(flush);
6555 };
6556 // for other environments - macrotask based on:
6557 // - setImmediate
6558 // - MessageChannel
6559 // - window.postMessag
6560 // - onreadystatechange
6561 // - setTimeout
6562 } else {
6563 notify = function () {
6564 // strange IE + webpack dev server bug - use .call(global)
6565 macrotask.call(global, flush);
6566 };
6567 }
6568
6569 return function (fn) {
6570 var task = { fn: fn, next: undefined };
6571 if (last) last.next = task;
6572 if (!head) {
6573 head = task;
6574 notify();
6575 } last = task;
6576 };
6577};
6578
6579
6580/***/ }),
6581/* 189 */
6582/***/ (function(module, exports, __webpack_require__) {
6583
6584var global = __webpack_require__(6);
6585var navigator = global.navigator;
6586
6587module.exports = navigator && navigator.userAgent || '';
6588
6589
6590/***/ }),
6591/* 190 */
6592/***/ (function(module, exports, __webpack_require__) {
6593
6594var hide = __webpack_require__(23);
6595module.exports = function (target, src, safe) {
6596 for (var key in src) {
6597 if (safe && target[key]) target[key] = src[key];
6598 else hide(target, key, src[key]);
6599 } return target;
6600};
6601
6602
6603/***/ }),
6604/* 191 */
6605/***/ (function(module, exports, __webpack_require__) {
6606
6607"use strict";
6608
6609var global = __webpack_require__(6);
6610var core = __webpack_require__(2);
6611var dP = __webpack_require__(18);
6612var DESCRIPTORS = __webpack_require__(21);
6613var SPECIES = __webpack_require__(7)('species');
6614
6615module.exports = function (KEY) {
6616 var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
6617 if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
6618 configurable: true,
6619 get: function () { return this; }
6620 });
6621};
6622
6623
6624/***/ }),
6625/* 192 */
6626/***/ (function(module, exports, __webpack_require__) {
6627
6628"use strict";
6629// https://github.com/tc39/proposal-promise-finally
6630
6631var $export = __webpack_require__(16);
6632var core = __webpack_require__(2);
6633var global = __webpack_require__(6);
6634var speciesConstructor = __webpack_require__(104);
6635var promiseResolve = __webpack_require__(107);
6636
6637$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
6638 var C = speciesConstructor(this, core.Promise || global.Promise);
6639 var isFunction = typeof onFinally == 'function';
6640 return this.then(
6641 isFunction ? function (x) {
6642 return promiseResolve(C, onFinally()).then(function () { return x; });
6643 } : onFinally,
6644 isFunction ? function (e) {
6645 return promiseResolve(C, onFinally()).then(function () { throw e; });
6646 } : onFinally
6647 );
6648} });
6649
6650
6651/***/ }),
6652/* 193 */
6653/***/ (function(module, exports, __webpack_require__) {
6654
6655"use strict";
6656
6657// https://github.com/tc39/proposal-promise-try
6658var $export = __webpack_require__(16);
6659var newPromiseCapability = __webpack_require__(73);
6660var perform = __webpack_require__(106);
6661
6662$export($export.S, 'Promise', { 'try': function (callbackfn) {
6663 var promiseCapability = newPromiseCapability.f(this);
6664 var result = perform(callbackfn);
6665 (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
6666 return promiseCapability.promise;
6667} });
6668
6669
6670/***/ }),
6671/* 194 */
6672/***/ (function(module, __webpack_exports__, __webpack_require__) {
6673
6674"use strict";
6675/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(74);
6676// Default Export
6677// ==============
6678// In this module, we mix our bundled exports into the `_` object and export
6679// the result. This is analogous to setting `module.exports = _` in CommonJS.
6680// Hence, this module is also the entry point of our UMD bundle and the package
6681// entry point for CommonJS and AMD users. In other words, this is (the source
6682// of) the module you are interfacing with when you do any of the following:
6683//
6684// ```js
6685// // CommonJS
6686// var _ = require('underscore');
6687//
6688// // AMD
6689// define(['underscore'], function(_) {...});
6690//
6691// // UMD in the browser
6692// // _ is available as a global variable
6693// ```
6694
6695
6696
6697// Add all of the Underscore functions to the wrapper object.
6698var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
6699// Legacy Node.js API.
6700_._ = _;
6701// Export the Underscore API.
6702/* harmony default export */ __webpack_exports__["a"] = (_);
6703
6704
6705/***/ }),
6706/* 195 */
6707/***/ (function(module, __webpack_exports__, __webpack_require__) {
6708
6709"use strict";
6710/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
6711// Is a given value equal to null?
6712function isNull(obj) {
6713 return obj === null;
6714}
6715
6716
6717/***/ }),
6718/* 196 */
6719/***/ (function(module, __webpack_exports__, __webpack_require__) {
6720
6721"use strict";
6722/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
6723// Is a given value a DOM element?
6724function isElement(obj) {
6725 return !!(obj && obj.nodeType === 1);
6726}
6727
6728
6729/***/ }),
6730/* 197 */
6731/***/ (function(module, __webpack_exports__, __webpack_require__) {
6732
6733"use strict";
6734/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6735
6736
6737/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
6738
6739
6740/***/ }),
6741/* 198 */
6742/***/ (function(module, __webpack_exports__, __webpack_require__) {
6743
6744"use strict";
6745/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6746
6747
6748/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
6749
6750
6751/***/ }),
6752/* 199 */
6753/***/ (function(module, __webpack_exports__, __webpack_require__) {
6754
6755"use strict";
6756/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6757
6758
6759/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
6760
6761
6762/***/ }),
6763/* 200 */
6764/***/ (function(module, __webpack_exports__, __webpack_require__) {
6765
6766"use strict";
6767/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6768
6769
6770/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
6771
6772
6773/***/ }),
6774/* 201 */
6775/***/ (function(module, __webpack_exports__, __webpack_require__) {
6776
6777"use strict";
6778/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
6779/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
6780/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(113);
6781
6782
6783
6784// Is a given object a finite number?
6785function isFinite(obj) {
6786 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
6787}
6788
6789
6790/***/ }),
6791/* 202 */
6792/***/ (function(module, __webpack_exports__, __webpack_require__) {
6793
6794"use strict";
6795/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(118);
6796/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(78);
6797
6798
6799
6800// Internal helper to determine whether we should spend extensive checks against
6801// `ArrayBuffer` et al.
6802/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
6803
6804
6805/***/ }),
6806/* 203 */
6807/***/ (function(module, __webpack_exports__, __webpack_require__) {
6808
6809"use strict";
6810/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
6811/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
6812/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(27);
6813/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(75);
6814/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(77);
6815/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(4);
6816
6817
6818
6819
6820
6821
6822// Is a given array, string, or object empty?
6823// An "empty" object has no enumerable own-properties.
6824function isEmpty(obj) {
6825 if (obj == null) return true;
6826 // Skip the more expensive `toString`-based type checks if `obj` has no
6827 // `.length`.
6828 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
6829 if (typeof length == 'number' && (
6830 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)
6831 )) return length === 0;
6832 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
6833}
6834
6835
6836/***/ }),
6837/* 204 */
6838/***/ (function(module, __webpack_exports__, __webpack_require__) {
6839
6840"use strict";
6841/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
6842/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
6843/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
6844/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(78);
6845/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(116);
6846/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(13);
6847/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(45);
6848/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(76);
6849/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(4);
6850/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(22);
6851/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(205);
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863// We use this string twice, so give it a name for minification.
6864var tagDataView = '[object DataView]';
6865
6866// Internal recursive comparison function for `_.isEqual`.
6867function eq(a, b, aStack, bStack) {
6868 // Identical objects are equal. `0 === -0`, but they aren't identical.
6869 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
6870 if (a === b) return a !== 0 || 1 / a === 1 / b;
6871 // `null` or `undefined` only equal to itself (strict comparison).
6872 if (a == null || b == null) return false;
6873 // `NaN`s are equivalent, but non-reflexive.
6874 if (a !== a) return b !== b;
6875 // Exhaust primitive checks
6876 var type = typeof a;
6877 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
6878 return deepEq(a, b, aStack, bStack);
6879}
6880
6881// Internal recursive comparison function for `_.isEqual`.
6882function deepEq(a, b, aStack, bStack) {
6883 // Unwrap any wrapped objects.
6884 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
6885 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
6886 // Compare `[[Class]]` names.
6887 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
6888 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
6889 // Work around a bug in IE 10 - Edge 13.
6890 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
6891 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
6892 className = tagDataView;
6893 }
6894 switch (className) {
6895 // These types are compared by value.
6896 case '[object RegExp]':
6897 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
6898 case '[object String]':
6899 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
6900 // equivalent to `new String("5")`.
6901 return '' + a === '' + b;
6902 case '[object Number]':
6903 // `NaN`s are equivalent, but non-reflexive.
6904 // Object(NaN) is equivalent to NaN.
6905 if (+a !== +a) return +b !== +b;
6906 // An `egal` comparison is performed for other numeric values.
6907 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
6908 case '[object Date]':
6909 case '[object Boolean]':
6910 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
6911 // millisecond representations. Note that invalid dates with millisecond representations
6912 // of `NaN` are not equivalent.
6913 return +a === +b;
6914 case '[object Symbol]':
6915 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
6916 case '[object ArrayBuffer]':
6917 case tagDataView:
6918 // Coerce to typed array so we can fall through.
6919 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
6920 }
6921
6922 var areArrays = className === '[object Array]';
6923 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
6924 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
6925 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
6926 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
6927 areArrays = true;
6928 }
6929 if (!areArrays) {
6930 if (typeof a != 'object' || typeof b != 'object') return false;
6931
6932 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
6933 // from different frames are.
6934 var aCtor = a.constructor, bCtor = b.constructor;
6935 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
6936 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
6937 && ('constructor' in a && 'constructor' in b)) {
6938 return false;
6939 }
6940 }
6941 // Assume equality for cyclic structures. The algorithm for detecting cyclic
6942 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
6943
6944 // Initializing stack of traversed objects.
6945 // It's done here since we only need them for objects and arrays comparison.
6946 aStack = aStack || [];
6947 bStack = bStack || [];
6948 var length = aStack.length;
6949 while (length--) {
6950 // Linear search. Performance is inversely proportional to the number of
6951 // unique nested structures.
6952 if (aStack[length] === a) return bStack[length] === b;
6953 }
6954
6955 // Add the first object to the stack of traversed objects.
6956 aStack.push(a);
6957 bStack.push(b);
6958
6959 // Recursively compare objects and arrays.
6960 if (areArrays) {
6961 // Compare array lengths to determine if a deep comparison is necessary.
6962 length = a.length;
6963 if (length !== b.length) return false;
6964 // Deep compare the contents, ignoring non-numeric properties.
6965 while (length--) {
6966 if (!eq(a[length], b[length], aStack, bStack)) return false;
6967 }
6968 } else {
6969 // Deep compare objects.
6970 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
6971 length = _keys.length;
6972 // Ensure that both objects contain the same number of properties before comparing deep equality.
6973 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
6974 while (length--) {
6975 // Deep compare each member
6976 key = _keys[length];
6977 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
6978 }
6979 }
6980 // Remove the first object from the stack of traversed objects.
6981 aStack.pop();
6982 bStack.pop();
6983 return true;
6984}
6985
6986// Perform a deep comparison to check if two objects are equal.
6987function isEqual(a, b) {
6988 return eq(a, b);
6989}
6990
6991
6992/***/ }),
6993/* 205 */
6994/***/ (function(module, __webpack_exports__, __webpack_require__) {
6995
6996"use strict";
6997/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
6998/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(78);
6999
7000
7001// Internal function to wrap or shallow-copy an ArrayBuffer,
7002// typed array or DataView to a new view, reusing the buffer.
7003function toBufferView(bufferSource) {
7004 return new Uint8Array(
7005 bufferSource.buffer || bufferSource,
7006 bufferSource.byteOffset || 0,
7007 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
7008 );
7009}
7010
7011
7012/***/ }),
7013/* 206 */
7014/***/ (function(module, __webpack_exports__, __webpack_require__) {
7015
7016"use strict";
7017/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
7018/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(45);
7019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(79);
7020
7021
7022
7023
7024/* 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'));
7025
7026
7027/***/ }),
7028/* 207 */
7029/***/ (function(module, __webpack_exports__, __webpack_require__) {
7030
7031"use strict";
7032/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
7033/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(45);
7034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(79);
7035
7036
7037
7038
7039/* 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'));
7040
7041
7042/***/ }),
7043/* 208 */
7044/***/ (function(module, __webpack_exports__, __webpack_require__) {
7045
7046"use strict";
7047/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
7048/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(45);
7049/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(79);
7050
7051
7052
7053
7054/* 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'));
7055
7056
7057/***/ }),
7058/* 209 */
7059/***/ (function(module, __webpack_exports__, __webpack_require__) {
7060
7061"use strict";
7062/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
7063
7064
7065/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
7066
7067
7068/***/ }),
7069/* 210 */
7070/***/ (function(module, __webpack_exports__, __webpack_require__) {
7071
7072"use strict";
7073/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
7074/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(4);
7075
7076
7077// Convert an object into a list of `[key, value]` pairs.
7078// The opposite of `_.object` with one argument.
7079function pairs(obj) {
7080 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
7081 var length = _keys.length;
7082 var pairs = Array(length);
7083 for (var i = 0; i < length; i++) {
7084 pairs[i] = [_keys[i], obj[_keys[i]]];
7085 }
7086 return pairs;
7087}
7088
7089
7090/***/ }),
7091/* 211 */
7092/***/ (function(module, __webpack_exports__, __webpack_require__) {
7093
7094"use strict";
7095/* harmony export (immutable) */ __webpack_exports__["a"] = create;
7096/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(126);
7097/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(81);
7098
7099
7100
7101// Creates an object that inherits from the given prototype object.
7102// If additional properties are provided then they will be added to the
7103// created object.
7104function create(prototype, props) {
7105 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
7106 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
7107 return result;
7108}
7109
7110
7111/***/ }),
7112/* 212 */
7113/***/ (function(module, __webpack_exports__, __webpack_require__) {
7114
7115"use strict";
7116/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
7117// Invokes `interceptor` with the `obj` and then returns `obj`.
7118// The primary purpose of this method is to "tap into" a method chain, in
7119// order to perform operations on intermediate results within the chain.
7120function tap(obj, interceptor) {
7121 interceptor(obj);
7122 return obj;
7123}
7124
7125
7126/***/ }),
7127/* 213 */
7128/***/ (function(module, __webpack_exports__, __webpack_require__) {
7129
7130"use strict";
7131/* harmony export (immutable) */ __webpack_exports__["a"] = has;
7132/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(22);
7133/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(47);
7134
7135
7136
7137// Shortcut function for checking if an object has a given property directly on
7138// itself (in other words, not on a prototype). Unlike the internal `has`
7139// function, this public version can also traverse nested properties.
7140function has(obj, path) {
7141 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
7142 var length = path.length;
7143 for (var i = 0; i < length; i++) {
7144 var key = path[i];
7145 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
7146 obj = obj[key];
7147 }
7148 return !!length;
7149}
7150
7151
7152/***/ }),
7153/* 214 */
7154/***/ (function(module, __webpack_exports__, __webpack_require__) {
7155
7156"use strict";
7157/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
7158/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7159/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
7160
7161
7162
7163// Returns the results of applying the `iteratee` to each element of `obj`.
7164// In contrast to `_.map` it returns an object.
7165function mapObject(obj, iteratee, context) {
7166 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
7167 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
7168 length = _keys.length,
7169 results = {};
7170 for (var index = 0; index < length; index++) {
7171 var currentKey = _keys[index];
7172 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
7173 }
7174 return results;
7175}
7176
7177
7178/***/ }),
7179/* 215 */
7180/***/ (function(module, __webpack_exports__, __webpack_require__) {
7181
7182"use strict";
7183/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
7184/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(132);
7185/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(128);
7186
7187
7188
7189// Generates a function for a given object that returns a given property.
7190function propertyOf(obj) {
7191 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
7192 return function(path) {
7193 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
7194 };
7195}
7196
7197
7198/***/ }),
7199/* 216 */
7200/***/ (function(module, __webpack_exports__, __webpack_require__) {
7201
7202"use strict";
7203/* harmony export (immutable) */ __webpack_exports__["a"] = times;
7204/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(48);
7205
7206
7207// Run a function **n** times.
7208function times(n, iteratee, context) {
7209 var accum = Array(Math.max(0, n));
7210 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
7211 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
7212 return accum;
7213}
7214
7215
7216/***/ }),
7217/* 217 */
7218/***/ (function(module, __webpack_exports__, __webpack_require__) {
7219
7220"use strict";
7221/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(134);
7222/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(135);
7223
7224
7225
7226// Function for escaping strings to HTML interpolation.
7227/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
7228
7229
7230/***/ }),
7231/* 218 */
7232/***/ (function(module, __webpack_exports__, __webpack_require__) {
7233
7234"use strict";
7235/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(134);
7236/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(219);
7237
7238
7239
7240// Function for unescaping strings from HTML interpolation.
7241/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
7242
7243
7244/***/ }),
7245/* 219 */
7246/***/ (function(module, __webpack_exports__, __webpack_require__) {
7247
7248"use strict";
7249/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(122);
7250/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(135);
7251
7252
7253
7254// Internal list of HTML entities for unescaping.
7255/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
7256
7257
7258/***/ }),
7259/* 220 */
7260/***/ (function(module, __webpack_exports__, __webpack_require__) {
7261
7262"use strict";
7263/* harmony export (immutable) */ __webpack_exports__["a"] = template;
7264/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(125);
7265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(10);
7266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(136);
7267
7268
7269
7270
7271// When customizing `_.templateSettings`, if you don't want to define an
7272// interpolation, evaluation or escaping regex, we need one that is
7273// guaranteed not to match.
7274var noMatch = /(.)^/;
7275
7276// Certain characters need to be escaped so that they can be put into a
7277// string literal.
7278var escapes = {
7279 "'": "'",
7280 '\\': '\\',
7281 '\r': 'r',
7282 '\n': 'n',
7283 '\u2028': 'u2028',
7284 '\u2029': 'u2029'
7285};
7286
7287var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
7288
7289function escapeChar(match) {
7290 return '\\' + escapes[match];
7291}
7292
7293var bareIdentifier = /^\s*(\w|\$)+\s*$/;
7294
7295// JavaScript micro-templating, similar to John Resig's implementation.
7296// Underscore templating handles arbitrary delimiters, preserves whitespace,
7297// and correctly escapes quotes within interpolated code.
7298// NB: `oldSettings` only exists for backwards compatibility.
7299function template(text, settings, oldSettings) {
7300 if (!settings && oldSettings) settings = oldSettings;
7301 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
7302
7303 // Combine delimiters into one regular expression via alternation.
7304 var matcher = RegExp([
7305 (settings.escape || noMatch).source,
7306 (settings.interpolate || noMatch).source,
7307 (settings.evaluate || noMatch).source
7308 ].join('|') + '|$', 'g');
7309
7310 // Compile the template source, escaping string literals appropriately.
7311 var index = 0;
7312 var source = "__p+='";
7313 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
7314 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
7315 index = offset + match.length;
7316
7317 if (escape) {
7318 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
7319 } else if (interpolate) {
7320 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
7321 } else if (evaluate) {
7322 source += "';\n" + evaluate + "\n__p+='";
7323 }
7324
7325 // Adobe VMs need the match returned to produce the correct offset.
7326 return match;
7327 });
7328 source += "';\n";
7329
7330 var argument = settings.variable;
7331 if (argument) {
7332 if (!bareIdentifier.test(argument)) throw new Error(argument);
7333 } else {
7334 // If a variable is not specified, place data values in local scope.
7335 source = 'with(obj||{}){\n' + source + '}\n';
7336 argument = 'obj';
7337 }
7338
7339 source = "var __t,__p='',__j=Array.prototype.join," +
7340 "print=function(){__p+=__j.call(arguments,'');};\n" +
7341 source + 'return __p;\n';
7342
7343 var render;
7344 try {
7345 render = new Function(argument, '_', source);
7346 } catch (e) {
7347 e.source = source;
7348 throw e;
7349 }
7350
7351 var template = function(data) {
7352 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
7353 };
7354
7355 // Provide the compiled source as a convenience for precompilation.
7356 template.source = 'function(' + argument + '){\n' + source + '}';
7357
7358 return template;
7359}
7360
7361
7362/***/ }),
7363/* 221 */
7364/***/ (function(module, __webpack_exports__, __webpack_require__) {
7365
7366"use strict";
7367/* harmony export (immutable) */ __webpack_exports__["a"] = result;
7368/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(13);
7369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(47);
7370
7371
7372
7373// Traverses the children of `obj` along `path`. If a child is a function, it
7374// is invoked with its parent as context. Returns the value of the final
7375// child, or `fallback` if any child is undefined.
7376function result(obj, path, fallback) {
7377 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
7378 var length = path.length;
7379 if (!length) {
7380 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
7381 }
7382 for (var i = 0; i < length; i++) {
7383 var prop = obj == null ? void 0 : obj[path[i]];
7384 if (prop === void 0) {
7385 prop = fallback;
7386 i = length; // Ensure we don't continue iterating.
7387 }
7388 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
7389 }
7390 return obj;
7391}
7392
7393
7394/***/ }),
7395/* 222 */
7396/***/ (function(module, __webpack_exports__, __webpack_require__) {
7397
7398"use strict";
7399/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
7400// Generate a unique integer id (unique within the entire client session).
7401// Useful for temporary DOM ids.
7402var idCounter = 0;
7403function uniqueId(prefix) {
7404 var id = ++idCounter + '';
7405 return prefix ? prefix + id : id;
7406}
7407
7408
7409/***/ }),
7410/* 223 */
7411/***/ (function(module, __webpack_exports__, __webpack_require__) {
7412
7413"use strict";
7414/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
7415/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
7416
7417
7418// Start chaining a wrapped Underscore object.
7419function chain(obj) {
7420 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
7421 instance._chain = true;
7422 return instance;
7423}
7424
7425
7426/***/ }),
7427/* 224 */
7428/***/ (function(module, __webpack_exports__, __webpack_require__) {
7429
7430"use strict";
7431/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
7432/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(34);
7433/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(138);
7434
7435
7436
7437
7438// Bind a number of an object's methods to that object. Remaining arguments
7439// are the method names to be bound. Useful for ensuring that all callbacks
7440// defined on an object belong to it.
7441/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7442 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
7443 var index = keys.length;
7444 if (index < 1) throw new Error('bindAll must be passed function names');
7445 while (index--) {
7446 var key = keys[index];
7447 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
7448 }
7449 return obj;
7450}));
7451
7452
7453/***/ }),
7454/* 225 */
7455/***/ (function(module, __webpack_exports__, __webpack_require__) {
7456
7457"use strict";
7458/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
7459/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(22);
7460
7461
7462// Memoize an expensive function by storing its results.
7463function memoize(func, hasher) {
7464 var memoize = function(key) {
7465 var cache = memoize.cache;
7466 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
7467 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
7468 return cache[address];
7469 };
7470 memoize.cache = {};
7471 return memoize;
7472}
7473
7474
7475/***/ }),
7476/* 226 */
7477/***/ (function(module, __webpack_exports__, __webpack_require__) {
7478
7479"use strict";
7480/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(58);
7481/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(139);
7482/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(10);
7483
7484
7485
7486
7487// Defers a function, scheduling it to run after the current call stack has
7488// cleared.
7489/* 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));
7490
7491
7492/***/ }),
7493/* 227 */
7494/***/ (function(module, __webpack_exports__, __webpack_require__) {
7495
7496"use strict";
7497/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
7498/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(85);
7499
7500
7501// Returns a function, that, when invoked, will only be triggered at most once
7502// during a given window of time. Normally, the throttled function will run
7503// as much as it can, without ever going more than once per `wait` duration;
7504// but if you'd like to disable the execution on the leading edge, pass
7505// `{leading: false}`. To disable execution on the trailing edge, ditto.
7506function throttle(func, wait, options) {
7507 var timeout, context, args, result;
7508 var previous = 0;
7509 if (!options) options = {};
7510
7511 var later = function() {
7512 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
7513 timeout = null;
7514 result = func.apply(context, args);
7515 if (!timeout) context = args = null;
7516 };
7517
7518 var throttled = function() {
7519 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
7520 if (!previous && options.leading === false) previous = _now;
7521 var remaining = wait - (_now - previous);
7522 context = this;
7523 args = arguments;
7524 if (remaining <= 0 || remaining > wait) {
7525 if (timeout) {
7526 clearTimeout(timeout);
7527 timeout = null;
7528 }
7529 previous = _now;
7530 result = func.apply(context, args);
7531 if (!timeout) context = args = null;
7532 } else if (!timeout && options.trailing !== false) {
7533 timeout = setTimeout(later, remaining);
7534 }
7535 return result;
7536 };
7537
7538 throttled.cancel = function() {
7539 clearTimeout(timeout);
7540 previous = 0;
7541 timeout = context = args = null;
7542 };
7543
7544 return throttled;
7545}
7546
7547
7548/***/ }),
7549/* 228 */
7550/***/ (function(module, __webpack_exports__, __webpack_require__) {
7551
7552"use strict";
7553/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
7554/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
7555/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(85);
7556
7557
7558
7559// When a sequence of calls of the returned function ends, the argument
7560// function is triggered. The end of a sequence is defined by the `wait`
7561// parameter. If `immediate` is passed, the argument function will be
7562// triggered at the beginning of the sequence instead of at the end.
7563function debounce(func, wait, immediate) {
7564 var timeout, previous, args, result, context;
7565
7566 var later = function() {
7567 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
7568 if (wait > passed) {
7569 timeout = setTimeout(later, wait - passed);
7570 } else {
7571 timeout = null;
7572 if (!immediate) result = func.apply(context, args);
7573 // This check is needed because `func` can recursively invoke `debounced`.
7574 if (!timeout) args = context = null;
7575 }
7576 };
7577
7578 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
7579 context = this;
7580 args = _args;
7581 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
7582 if (!timeout) {
7583 timeout = setTimeout(later, wait);
7584 if (immediate) result = func.apply(context, args);
7585 }
7586 return result;
7587 });
7588
7589 debounced.cancel = function() {
7590 clearTimeout(timeout);
7591 timeout = args = context = null;
7592 };
7593
7594 return debounced;
7595}
7596
7597
7598/***/ }),
7599/* 229 */
7600/***/ (function(module, __webpack_exports__, __webpack_require__) {
7601
7602"use strict";
7603/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
7604/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(58);
7605
7606
7607// Returns the first function passed as an argument to the second,
7608// allowing you to adjust arguments, run code before and after, and
7609// conditionally execute the original function.
7610function wrap(func, wrapper) {
7611 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
7612}
7613
7614
7615/***/ }),
7616/* 230 */
7617/***/ (function(module, __webpack_exports__, __webpack_require__) {
7618
7619"use strict";
7620/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
7621// Returns a function that is the composition of a list of functions, each
7622// consuming the return value of the function that follows.
7623function compose() {
7624 var args = arguments;
7625 var start = args.length - 1;
7626 return function() {
7627 var i = start;
7628 var result = args[start].apply(this, arguments);
7629 while (i--) result = args[i].call(this, result);
7630 return result;
7631 };
7632}
7633
7634
7635/***/ }),
7636/* 231 */
7637/***/ (function(module, __webpack_exports__, __webpack_require__) {
7638
7639"use strict";
7640/* harmony export (immutable) */ __webpack_exports__["a"] = after;
7641// Returns a function that will only be executed on and after the Nth call.
7642function after(times, func) {
7643 return function() {
7644 if (--times < 1) {
7645 return func.apply(this, arguments);
7646 }
7647 };
7648}
7649
7650
7651/***/ }),
7652/* 232 */
7653/***/ (function(module, __webpack_exports__, __webpack_require__) {
7654
7655"use strict";
7656/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(58);
7657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(140);
7658
7659
7660
7661// Returns a function that will be executed at most one time, no matter how
7662// often you call it. Useful for lazy initialization.
7663/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
7664
7665
7666/***/ }),
7667/* 233 */
7668/***/ (function(module, __webpack_exports__, __webpack_require__) {
7669
7670"use strict";
7671/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(143);
7672/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(146);
7673
7674
7675
7676// Return the position of the last occurrence of an item in an array,
7677// or -1 if the item is not included in the array.
7678/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
7679
7680
7681/***/ }),
7682/* 234 */
7683/***/ (function(module, __webpack_exports__, __webpack_require__) {
7684
7685"use strict";
7686/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
7687/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(147);
7688/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(57);
7689
7690
7691
7692// Convenience version of a common use case of `_.find`: getting the first
7693// object containing specific `key:value` pairs.
7694function findWhere(obj, attrs) {
7695 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
7696}
7697
7698
7699/***/ }),
7700/* 235 */
7701/***/ (function(module, __webpack_exports__, __webpack_require__) {
7702
7703"use strict";
7704/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(148);
7705
7706
7707// **Reduce** builds up a single result from a list of values, aka `inject`,
7708// or `foldl`.
7709/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
7710
7711
7712/***/ }),
7713/* 236 */
7714/***/ (function(module, __webpack_exports__, __webpack_require__) {
7715
7716"use strict";
7717/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(148);
7718
7719
7720// The right-associative version of reduce, also known as `foldr`.
7721/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
7722
7723
7724/***/ }),
7725/* 237 */
7726/***/ (function(module, __webpack_exports__, __webpack_require__) {
7727
7728"use strict";
7729/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
7730/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(49);
7731/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(86);
7732/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(8);
7733
7734
7735
7736
7737// Return all the elements for which a truth test fails.
7738function reject(obj, predicate, context) {
7739 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);
7740}
7741
7742
7743/***/ }),
7744/* 238 */
7745/***/ (function(module, __webpack_exports__, __webpack_require__) {
7746
7747"use strict";
7748/* harmony export (immutable) */ __webpack_exports__["a"] = every;
7749/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7750/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
7751/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(4);
7752
7753
7754
7755
7756// Determine whether all of the elements pass a truth test.
7757function every(obj, predicate, context) {
7758 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
7759 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
7760 length = (_keys || obj).length;
7761 for (var index = 0; index < length; index++) {
7762 var currentKey = _keys ? _keys[index] : index;
7763 if (!predicate(obj[currentKey], currentKey, obj)) return false;
7764 }
7765 return true;
7766}
7767
7768
7769/***/ }),
7770/* 239 */
7771/***/ (function(module, __webpack_exports__, __webpack_require__) {
7772
7773"use strict";
7774/* harmony export (immutable) */ __webpack_exports__["a"] = some;
7775/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7776/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
7777/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(4);
7778
7779
7780
7781
7782// Determine if at least one element in the object passes a truth test.
7783function some(obj, predicate, context) {
7784 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
7785 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
7786 length = (_keys || obj).length;
7787 for (var index = 0; index < length; index++) {
7788 var currentKey = _keys ? _keys[index] : index;
7789 if (predicate(obj[currentKey], currentKey, obj)) return true;
7790 }
7791 return false;
7792}
7793
7794
7795/***/ }),
7796/* 240 */
7797/***/ (function(module, __webpack_exports__, __webpack_require__) {
7798
7799"use strict";
7800/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
7801/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
7802/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(35);
7803/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(82);
7804/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(47);
7805
7806
7807
7808
7809
7810
7811// Invoke a method (with arguments) on every item in a collection.
7812/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
7813 var contextPath, func;
7814 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
7815 func = path;
7816 } else {
7817 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
7818 contextPath = path.slice(0, -1);
7819 path = path[path.length - 1];
7820 }
7821 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
7822 var method = func;
7823 if (!method) {
7824 if (contextPath && contextPath.length) {
7825 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
7826 }
7827 if (context == null) return void 0;
7828 method = context[path];
7829 }
7830 return method == null ? method : method.apply(context, args);
7831 });
7832}));
7833
7834
7835/***/ }),
7836/* 241 */
7837/***/ (function(module, __webpack_exports__, __webpack_require__) {
7838
7839"use strict";
7840/* harmony export (immutable) */ __webpack_exports__["a"] = where;
7841/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(49);
7842/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(57);
7843
7844
7845
7846// Convenience version of a common use case of `_.filter`: selecting only
7847// objects containing specific `key:value` pairs.
7848function where(obj, attrs) {
7849 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
7850}
7851
7852
7853/***/ }),
7854/* 242 */
7855/***/ (function(module, __webpack_exports__, __webpack_require__) {
7856
7857"use strict";
7858/* harmony export (immutable) */ __webpack_exports__["a"] = min;
7859/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
7860/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(33);
7861/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(8);
7862/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(28);
7863
7864
7865
7866
7867
7868// Return the minimum element (or element-based computation).
7869function min(obj, iteratee, context) {
7870 var result = Infinity, lastComputed = Infinity,
7871 value, computed;
7872 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
7873 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
7874 for (var i = 0, length = obj.length; i < length; i++) {
7875 value = obj[i];
7876 if (value != null && value < result) {
7877 result = value;
7878 }
7879 }
7880 } else {
7881 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
7882 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
7883 computed = iteratee(v, index, list);
7884 if (computed < lastComputed || computed === Infinity && result === Infinity) {
7885 result = v;
7886 lastComputed = computed;
7887 }
7888 });
7889 }
7890 return result;
7891}
7892
7893
7894/***/ }),
7895/* 243 */
7896/***/ (function(module, __webpack_exports__, __webpack_require__) {
7897
7898"use strict";
7899/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
7900/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(150);
7901
7902
7903// Shuffle a collection.
7904function shuffle(obj) {
7905 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
7906}
7907
7908
7909/***/ }),
7910/* 244 */
7911/***/ (function(module, __webpack_exports__, __webpack_require__) {
7912
7913"use strict";
7914/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
7915/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7916/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(88);
7917/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(35);
7918
7919
7920
7921
7922// Sort the object's values by a criterion produced by an iteratee.
7923function sortBy(obj, iteratee, context) {
7924 var index = 0;
7925 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
7926 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
7927 return {
7928 value: value,
7929 index: index++,
7930 criteria: iteratee(value, key, list)
7931 };
7932 }).sort(function(left, right) {
7933 var a = left.criteria;
7934 var b = right.criteria;
7935 if (a !== b) {
7936 if (a > b || a === void 0) return 1;
7937 if (a < b || b === void 0) return -1;
7938 }
7939 return left.index - right.index;
7940 }), 'value');
7941}
7942
7943
7944/***/ }),
7945/* 245 */
7946/***/ (function(module, __webpack_exports__, __webpack_require__) {
7947
7948"use strict";
7949/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(59);
7950/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(22);
7951
7952
7953
7954// Groups the object's values by a criterion. Pass either a string attribute
7955// to group by, or a function that returns the criterion.
7956/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
7957 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
7958}));
7959
7960
7961/***/ }),
7962/* 246 */
7963/***/ (function(module, __webpack_exports__, __webpack_require__) {
7964
7965"use strict";
7966/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(59);
7967
7968
7969// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
7970// when you know that your index values will be unique.
7971/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
7972 result[key] = value;
7973}));
7974
7975
7976/***/ }),
7977/* 247 */
7978/***/ (function(module, __webpack_exports__, __webpack_require__) {
7979
7980"use strict";
7981/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(59);
7982/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(22);
7983
7984
7985
7986// Counts instances of an object that group by a certain criterion. Pass
7987// either a string attribute to count by, or a function that returns the
7988// criterion.
7989/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
7990 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
7991}));
7992
7993
7994/***/ }),
7995/* 248 */
7996/***/ (function(module, __webpack_exports__, __webpack_require__) {
7997
7998"use strict";
7999/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(59);
8000
8001
8002// Split a collection into two arrays: one whose elements all pass the given
8003// truth test, and one whose elements all do not pass the truth test.
8004/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
8005 result[pass ? 0 : 1].push(value);
8006}, true));
8007
8008
8009/***/ }),
8010/* 249 */
8011/***/ (function(module, __webpack_exports__, __webpack_require__) {
8012
8013"use strict";
8014/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
8015/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(27);
8016/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
8017/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(75);
8018/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(11);
8019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(35);
8020/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(83);
8021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(33);
8022
8023
8024
8025
8026
8027
8028
8029
8030// Safely create a real, live array from anything iterable.
8031var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
8032function toArray(obj) {
8033 if (!obj) return [];
8034 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
8035 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
8036 // Keep surrogate pair characters together.
8037 return obj.match(reStrSymbol);
8038 }
8039 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 */]);
8040 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
8041}
8042
8043
8044/***/ }),
8045/* 250 */
8046/***/ (function(module, __webpack_exports__, __webpack_require__) {
8047
8048"use strict";
8049/* harmony export (immutable) */ __webpack_exports__["a"] = size;
8050/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
8051/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(4);
8052
8053
8054
8055// Return the number of elements in a collection.
8056function size(obj) {
8057 if (obj == null) return 0;
8058 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
8059}
8060
8061
8062/***/ }),
8063/* 251 */
8064/***/ (function(module, __webpack_exports__, __webpack_require__) {
8065
8066"use strict";
8067/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
8068// Internal `_.pick` helper function to determine whether `key` is an enumerable
8069// property name of `obj`.
8070function keyInObj(value, key, obj) {
8071 return key in obj;
8072}
8073
8074
8075/***/ }),
8076/* 252 */
8077/***/ (function(module, __webpack_exports__, __webpack_require__) {
8078
8079"use strict";
8080/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8081/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
8082/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(86);
8083/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(35);
8084/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(34);
8085/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(50);
8086/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(151);
8087
8088
8089
8090
8091
8092
8093
8094
8095// Return a copy of the object without the disallowed properties.
8096/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
8097 var iteratee = keys[0], context;
8098 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
8099 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
8100 if (keys.length > 1) context = keys[1];
8101 } else {
8102 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
8103 iteratee = function(value, key) {
8104 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
8105 };
8106 }
8107 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
8108}));
8109
8110
8111/***/ }),
8112/* 253 */
8113/***/ (function(module, __webpack_exports__, __webpack_require__) {
8114
8115"use strict";
8116/* harmony export (immutable) */ __webpack_exports__["a"] = first;
8117/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(152);
8118
8119
8120// Get the first element of an array. Passing **n** will return the first N
8121// values in the array. The **guard** check allows it to work with `_.map`.
8122function first(array, n, guard) {
8123 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
8124 if (n == null || guard) return array[0];
8125 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
8126}
8127
8128
8129/***/ }),
8130/* 254 */
8131/***/ (function(module, __webpack_exports__, __webpack_require__) {
8132
8133"use strict";
8134/* harmony export (immutable) */ __webpack_exports__["a"] = last;
8135/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(153);
8136
8137
8138// Get the last element of an array. Passing **n** will return the last N
8139// values in the array.
8140function last(array, n, guard) {
8141 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
8142 if (n == null || guard) return array[array.length - 1];
8143 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
8144}
8145
8146
8147/***/ }),
8148/* 255 */
8149/***/ (function(module, __webpack_exports__, __webpack_require__) {
8150
8151"use strict";
8152/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
8153/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(49);
8154
8155
8156// Trim out all falsy values from an array.
8157function compact(array) {
8158 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
8159}
8160
8161
8162/***/ }),
8163/* 256 */
8164/***/ (function(module, __webpack_exports__, __webpack_require__) {
8165
8166"use strict";
8167/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
8168/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(34);
8169
8170
8171// Flatten out an array, either recursively (by default), or up to `depth`.
8172// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
8173function flatten(array, depth) {
8174 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
8175}
8176
8177
8178/***/ }),
8179/* 257 */
8180/***/ (function(module, __webpack_exports__, __webpack_require__) {
8181
8182"use strict";
8183/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8184/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(154);
8185
8186
8187
8188// Return a version of the array that does not contain the specified value(s).
8189/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
8190 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
8191}));
8192
8193
8194/***/ }),
8195/* 258 */
8196/***/ (function(module, __webpack_exports__, __webpack_require__) {
8197
8198"use strict";
8199/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8200/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(155);
8201/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(34);
8202
8203
8204
8205
8206// Produce an array that contains the union: each distinct element from all of
8207// the passed-in arrays.
8208/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
8209 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
8210}));
8211
8212
8213/***/ }),
8214/* 259 */
8215/***/ (function(module, __webpack_exports__, __webpack_require__) {
8216
8217"use strict";
8218/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
8219/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
8220/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(50);
8221
8222
8223
8224// Produce an array that contains every item shared between all the
8225// passed-in arrays.
8226function intersection(array) {
8227 var result = [];
8228 var argsLength = arguments.length;
8229 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
8230 var item = array[i];
8231 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
8232 var j;
8233 for (j = 1; j < argsLength; j++) {
8234 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
8235 }
8236 if (j === argsLength) result.push(item);
8237 }
8238 return result;
8239}
8240
8241
8242/***/ }),
8243/* 260 */
8244/***/ (function(module, __webpack_exports__, __webpack_require__) {
8245
8246"use strict";
8247/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8248/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(156);
8249
8250
8251
8252// Zip together multiple lists into a single array -- elements that share
8253// an index go together.
8254/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
8255
8256
8257/***/ }),
8258/* 261 */
8259/***/ (function(module, __webpack_exports__, __webpack_require__) {
8260
8261"use strict";
8262/* harmony export (immutable) */ __webpack_exports__["a"] = object;
8263/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
8264
8265
8266// Converts lists into objects. Pass either a single array of `[key, value]`
8267// pairs, or two parallel arrays of the same length -- one of keys, and one of
8268// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
8269function object(list, values) {
8270 var result = {};
8271 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
8272 if (values) {
8273 result[list[i]] = values[i];
8274 } else {
8275 result[list[i][0]] = list[i][1];
8276 }
8277 }
8278 return result;
8279}
8280
8281
8282/***/ }),
8283/* 262 */
8284/***/ (function(module, __webpack_exports__, __webpack_require__) {
8285
8286"use strict";
8287/* harmony export (immutable) */ __webpack_exports__["a"] = range;
8288// Generate an integer Array containing an arithmetic progression. A port of
8289// the native Python `range()` function. See
8290// [the Python documentation](https://docs.python.org/library/functions.html#range).
8291function range(start, stop, step) {
8292 if (stop == null) {
8293 stop = start || 0;
8294 start = 0;
8295 }
8296 if (!step) {
8297 step = stop < start ? -1 : 1;
8298 }
8299
8300 var length = Math.max(Math.ceil((stop - start) / step), 0);
8301 var range = Array(length);
8302
8303 for (var idx = 0; idx < length; idx++, start += step) {
8304 range[idx] = start;
8305 }
8306
8307 return range;
8308}
8309
8310
8311/***/ }),
8312/* 263 */
8313/***/ (function(module, __webpack_exports__, __webpack_require__) {
8314
8315"use strict";
8316/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
8317/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
8318
8319
8320// Chunk a single array into multiple arrays, each containing `count` or fewer
8321// items.
8322function chunk(array, count) {
8323 if (count == null || count < 1) return [];
8324 var result = [];
8325 var i = 0, length = array.length;
8326 while (i < length) {
8327 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
8328 }
8329 return result;
8330}
8331
8332
8333/***/ }),
8334/* 264 */
8335/***/ (function(module, __webpack_exports__, __webpack_require__) {
8336
8337"use strict";
8338/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
8339/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
8340/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(28);
8341/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(123);
8342/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(1);
8343/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(157);
8344
8345
8346
8347
8348
8349
8350// Add your own custom functions to the Underscore object.
8351function mixin(obj) {
8352 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
8353 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
8354 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8355 var args = [this._wrapped];
8356 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
8357 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
8358 };
8359 });
8360 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
8361}
8362
8363
8364/***/ }),
8365/* 265 */
8366/***/ (function(module, __webpack_exports__, __webpack_require__) {
8367
8368"use strict";
8369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
8370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(28);
8371/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(1);
8372/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(157);
8373
8374
8375
8376
8377
8378// Add all mutator `Array` functions to the wrapper.
8379Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
8380 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
8381 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8382 var obj = this._wrapped;
8383 if (obj != null) {
8384 method.apply(obj, arguments);
8385 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
8386 delete obj[0];
8387 }
8388 }
8389 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
8390 };
8391});
8392
8393// Add all accessor `Array` functions to the wrapper.
8394Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
8395 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
8396 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8397 var obj = this._wrapped;
8398 if (obj != null) obj = method.apply(obj, arguments);
8399 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
8400 };
8401});
8402
8403/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
8404
8405
8406/***/ }),
8407/* 266 */
8408/***/ (function(module, exports, __webpack_require__) {
8409
8410var core = __webpack_require__(2);
8411var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
8412module.exports = function stringify(it) { // eslint-disable-line no-unused-vars
8413 return $JSON.stringify.apply($JSON, arguments);
8414};
8415
8416
8417/***/ }),
8418/* 267 */
8419/***/ (function(module, exports, __webpack_require__) {
8420
8421__webpack_require__(268);
8422module.exports = __webpack_require__(2).Object.keys;
8423
8424
8425/***/ }),
8426/* 268 */
8427/***/ (function(module, exports, __webpack_require__) {
8428
8429// 19.1.2.14 Object.keys(O)
8430var toObject = __webpack_require__(44);
8431var $keys = __webpack_require__(53);
8432
8433__webpack_require__(89)('keys', function () {
8434 return function keys(it) {
8435 return $keys(toObject(it));
8436 };
8437});
8438
8439
8440/***/ }),
8441/* 269 */
8442/***/ (function(module, exports) {
8443
8444// Unique ID creation requires a high quality random # generator. In the
8445// browser this is a little complicated due to unknown quality of Math.random()
8446// and inconsistent support for the `crypto` API. We do the best we can via
8447// feature-detection
8448
8449// getRandomValues needs to be invoked in a context where "this" is a Crypto
8450// implementation. Also, find the complete implementation of crypto on IE11.
8451var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
8452 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
8453
8454if (getRandomValues) {
8455 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
8456 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
8457
8458 module.exports = function whatwgRNG() {
8459 getRandomValues(rnds8);
8460 return rnds8;
8461 };
8462} else {
8463 // Math.random()-based (RNG)
8464 //
8465 // If all else fails, use Math.random(). It's fast, but is of unspecified
8466 // quality.
8467 var rnds = new Array(16);
8468
8469 module.exports = function mathRNG() {
8470 for (var i = 0, r; i < 16; i++) {
8471 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
8472 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
8473 }
8474
8475 return rnds;
8476 };
8477}
8478
8479
8480/***/ }),
8481/* 270 */
8482/***/ (function(module, exports) {
8483
8484/**
8485 * Convert array of 16 byte values to UUID string format of the form:
8486 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
8487 */
8488var byteToHex = [];
8489for (var i = 0; i < 256; ++i) {
8490 byteToHex[i] = (i + 0x100).toString(16).substr(1);
8491}
8492
8493function bytesToUuid(buf, offset) {
8494 var i = offset || 0;
8495 var bth = byteToHex;
8496 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
8497 return ([bth[buf[i++]], bth[buf[i++]],
8498 bth[buf[i++]], bth[buf[i++]], '-',
8499 bth[buf[i++]], bth[buf[i++]], '-',
8500 bth[buf[i++]], bth[buf[i++]], '-',
8501 bth[buf[i++]], bth[buf[i++]], '-',
8502 bth[buf[i++]], bth[buf[i++]],
8503 bth[buf[i++]], bth[buf[i++]],
8504 bth[buf[i++]], bth[buf[i++]]]).join('');
8505}
8506
8507module.exports = bytesToUuid;
8508
8509
8510/***/ }),
8511/* 271 */
8512/***/ (function(module, exports, __webpack_require__) {
8513
8514"use strict";
8515
8516
8517/**
8518 * This is the common logic for both the Node.js and web browser
8519 * implementations of `debug()`.
8520 */
8521function setup(env) {
8522 createDebug.debug = createDebug;
8523 createDebug.default = createDebug;
8524 createDebug.coerce = coerce;
8525 createDebug.disable = disable;
8526 createDebug.enable = enable;
8527 createDebug.enabled = enabled;
8528 createDebug.humanize = __webpack_require__(272);
8529 Object.keys(env).forEach(function (key) {
8530 createDebug[key] = env[key];
8531 });
8532 /**
8533 * Active `debug` instances.
8534 */
8535
8536 createDebug.instances = [];
8537 /**
8538 * The currently active debug mode names, and names to skip.
8539 */
8540
8541 createDebug.names = [];
8542 createDebug.skips = [];
8543 /**
8544 * Map of special "%n" handling functions, for the debug "format" argument.
8545 *
8546 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
8547 */
8548
8549 createDebug.formatters = {};
8550 /**
8551 * Selects a color for a debug namespace
8552 * @param {String} namespace The namespace string for the for the debug instance to be colored
8553 * @return {Number|String} An ANSI color code for the given namespace
8554 * @api private
8555 */
8556
8557 function selectColor(namespace) {
8558 var hash = 0;
8559
8560 for (var i = 0; i < namespace.length; i++) {
8561 hash = (hash << 5) - hash + namespace.charCodeAt(i);
8562 hash |= 0; // Convert to 32bit integer
8563 }
8564
8565 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
8566 }
8567
8568 createDebug.selectColor = selectColor;
8569 /**
8570 * Create a debugger with the given `namespace`.
8571 *
8572 * @param {String} namespace
8573 * @return {Function}
8574 * @api public
8575 */
8576
8577 function createDebug(namespace) {
8578 var prevTime;
8579
8580 function debug() {
8581 // Disabled?
8582 if (!debug.enabled) {
8583 return;
8584 }
8585
8586 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8587 args[_key] = arguments[_key];
8588 }
8589
8590 var self = debug; // Set `diff` timestamp
8591
8592 var curr = Number(new Date());
8593 var ms = curr - (prevTime || curr);
8594 self.diff = ms;
8595 self.prev = prevTime;
8596 self.curr = curr;
8597 prevTime = curr;
8598 args[0] = createDebug.coerce(args[0]);
8599
8600 if (typeof args[0] !== 'string') {
8601 // Anything else let's inspect with %O
8602 args.unshift('%O');
8603 } // Apply any `formatters` transformations
8604
8605
8606 var index = 0;
8607 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
8608 // If we encounter an escaped % then don't increase the array index
8609 if (match === '%%') {
8610 return match;
8611 }
8612
8613 index++;
8614 var formatter = createDebug.formatters[format];
8615
8616 if (typeof formatter === 'function') {
8617 var val = args[index];
8618 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
8619
8620 args.splice(index, 1);
8621 index--;
8622 }
8623
8624 return match;
8625 }); // Apply env-specific formatting (colors, etc.)
8626
8627 createDebug.formatArgs.call(self, args);
8628 var logFn = self.log || createDebug.log;
8629 logFn.apply(self, args);
8630 }
8631
8632 debug.namespace = namespace;
8633 debug.enabled = createDebug.enabled(namespace);
8634 debug.useColors = createDebug.useColors();
8635 debug.color = selectColor(namespace);
8636 debug.destroy = destroy;
8637 debug.extend = extend; // Debug.formatArgs = formatArgs;
8638 // debug.rawLog = rawLog;
8639 // env-specific initialization logic for debug instances
8640
8641 if (typeof createDebug.init === 'function') {
8642 createDebug.init(debug);
8643 }
8644
8645 createDebug.instances.push(debug);
8646 return debug;
8647 }
8648
8649 function destroy() {
8650 var index = createDebug.instances.indexOf(this);
8651
8652 if (index !== -1) {
8653 createDebug.instances.splice(index, 1);
8654 return true;
8655 }
8656
8657 return false;
8658 }
8659
8660 function extend(namespace, delimiter) {
8661 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
8662 }
8663 /**
8664 * Enables a debug mode by namespaces. This can include modes
8665 * separated by a colon and wildcards.
8666 *
8667 * @param {String} namespaces
8668 * @api public
8669 */
8670
8671
8672 function enable(namespaces) {
8673 createDebug.save(namespaces);
8674 createDebug.names = [];
8675 createDebug.skips = [];
8676 var i;
8677 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
8678 var len = split.length;
8679
8680 for (i = 0; i < len; i++) {
8681 if (!split[i]) {
8682 // ignore empty strings
8683 continue;
8684 }
8685
8686 namespaces = split[i].replace(/\*/g, '.*?');
8687
8688 if (namespaces[0] === '-') {
8689 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
8690 } else {
8691 createDebug.names.push(new RegExp('^' + namespaces + '$'));
8692 }
8693 }
8694
8695 for (i = 0; i < createDebug.instances.length; i++) {
8696 var instance = createDebug.instances[i];
8697 instance.enabled = createDebug.enabled(instance.namespace);
8698 }
8699 }
8700 /**
8701 * Disable debug output.
8702 *
8703 * @api public
8704 */
8705
8706
8707 function disable() {
8708 createDebug.enable('');
8709 }
8710 /**
8711 * Returns true if the given mode name is enabled, false otherwise.
8712 *
8713 * @param {String} name
8714 * @return {Boolean}
8715 * @api public
8716 */
8717
8718
8719 function enabled(name) {
8720 if (name[name.length - 1] === '*') {
8721 return true;
8722 }
8723
8724 var i;
8725 var len;
8726
8727 for (i = 0, len = createDebug.skips.length; i < len; i++) {
8728 if (createDebug.skips[i].test(name)) {
8729 return false;
8730 }
8731 }
8732
8733 for (i = 0, len = createDebug.names.length; i < len; i++) {
8734 if (createDebug.names[i].test(name)) {
8735 return true;
8736 }
8737 }
8738
8739 return false;
8740 }
8741 /**
8742 * Coerce `val`.
8743 *
8744 * @param {Mixed} val
8745 * @return {Mixed}
8746 * @api private
8747 */
8748
8749
8750 function coerce(val) {
8751 if (val instanceof Error) {
8752 return val.stack || val.message;
8753 }
8754
8755 return val;
8756 }
8757
8758 createDebug.enable(createDebug.load());
8759 return createDebug;
8760}
8761
8762module.exports = setup;
8763
8764
8765
8766/***/ }),
8767/* 272 */
8768/***/ (function(module, exports) {
8769
8770/**
8771 * Helpers.
8772 */
8773
8774var s = 1000;
8775var m = s * 60;
8776var h = m * 60;
8777var d = h * 24;
8778var w = d * 7;
8779var y = d * 365.25;
8780
8781/**
8782 * Parse or format the given `val`.
8783 *
8784 * Options:
8785 *
8786 * - `long` verbose formatting [false]
8787 *
8788 * @param {String|Number} val
8789 * @param {Object} [options]
8790 * @throws {Error} throw an error if val is not a non-empty string or a number
8791 * @return {String|Number}
8792 * @api public
8793 */
8794
8795module.exports = function(val, options) {
8796 options = options || {};
8797 var type = typeof val;
8798 if (type === 'string' && val.length > 0) {
8799 return parse(val);
8800 } else if (type === 'number' && isFinite(val)) {
8801 return options.long ? fmtLong(val) : fmtShort(val);
8802 }
8803 throw new Error(
8804 'val is not a non-empty string or a valid number. val=' +
8805 JSON.stringify(val)
8806 );
8807};
8808
8809/**
8810 * Parse the given `str` and return milliseconds.
8811 *
8812 * @param {String} str
8813 * @return {Number}
8814 * @api private
8815 */
8816
8817function parse(str) {
8818 str = String(str);
8819 if (str.length > 100) {
8820 return;
8821 }
8822 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(
8823 str
8824 );
8825 if (!match) {
8826 return;
8827 }
8828 var n = parseFloat(match[1]);
8829 var type = (match[2] || 'ms').toLowerCase();
8830 switch (type) {
8831 case 'years':
8832 case 'year':
8833 case 'yrs':
8834 case 'yr':
8835 case 'y':
8836 return n * y;
8837 case 'weeks':
8838 case 'week':
8839 case 'w':
8840 return n * w;
8841 case 'days':
8842 case 'day':
8843 case 'd':
8844 return n * d;
8845 case 'hours':
8846 case 'hour':
8847 case 'hrs':
8848 case 'hr':
8849 case 'h':
8850 return n * h;
8851 case 'minutes':
8852 case 'minute':
8853 case 'mins':
8854 case 'min':
8855 case 'm':
8856 return n * m;
8857 case 'seconds':
8858 case 'second':
8859 case 'secs':
8860 case 'sec':
8861 case 's':
8862 return n * s;
8863 case 'milliseconds':
8864 case 'millisecond':
8865 case 'msecs':
8866 case 'msec':
8867 case 'ms':
8868 return n;
8869 default:
8870 return undefined;
8871 }
8872}
8873
8874/**
8875 * Short format for `ms`.
8876 *
8877 * @param {Number} ms
8878 * @return {String}
8879 * @api private
8880 */
8881
8882function fmtShort(ms) {
8883 var msAbs = Math.abs(ms);
8884 if (msAbs >= d) {
8885 return Math.round(ms / d) + 'd';
8886 }
8887 if (msAbs >= h) {
8888 return Math.round(ms / h) + 'h';
8889 }
8890 if (msAbs >= m) {
8891 return Math.round(ms / m) + 'm';
8892 }
8893 if (msAbs >= s) {
8894 return Math.round(ms / s) + 's';
8895 }
8896 return ms + 'ms';
8897}
8898
8899/**
8900 * Long format for `ms`.
8901 *
8902 * @param {Number} ms
8903 * @return {String}
8904 * @api private
8905 */
8906
8907function fmtLong(ms) {
8908 var msAbs = Math.abs(ms);
8909 if (msAbs >= d) {
8910 return plural(ms, msAbs, d, 'day');
8911 }
8912 if (msAbs >= h) {
8913 return plural(ms, msAbs, h, 'hour');
8914 }
8915 if (msAbs >= m) {
8916 return plural(ms, msAbs, m, 'minute');
8917 }
8918 if (msAbs >= s) {
8919 return plural(ms, msAbs, s, 'second');
8920 }
8921 return ms + ' ms';
8922}
8923
8924/**
8925 * Pluralization helper.
8926 */
8927
8928function plural(ms, msAbs, n, name) {
8929 var isPlural = msAbs >= n * 1.5;
8930 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
8931}
8932
8933
8934/***/ }),
8935/* 273 */
8936/***/ (function(module, exports, __webpack_require__) {
8937
8938__webpack_require__(274);
8939module.exports = __webpack_require__(2).Object.getPrototypeOf;
8940
8941
8942/***/ }),
8943/* 274 */
8944/***/ (function(module, exports, __webpack_require__) {
8945
8946// 19.1.2.9 Object.getPrototypeOf(O)
8947var toObject = __webpack_require__(44);
8948var $getPrototypeOf = __webpack_require__(101);
8949
8950__webpack_require__(89)('getPrototypeOf', function () {
8951 return function getPrototypeOf(it) {
8952 return $getPrototypeOf(toObject(it));
8953 };
8954});
8955
8956
8957/***/ }),
8958/* 275 */
8959/***/ (function(module, exports, __webpack_require__) {
8960
8961"use strict";
8962
8963
8964var _defineProperty = __webpack_require__(90);
8965
8966var _defineProperty2 = _interopRequireDefault(_defineProperty);
8967
8968function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8969
8970var AV = __webpack_require__(36);
8971var AppRouter = __webpack_require__(278);
8972
8973var _require = __webpack_require__(15),
8974 isNullOrUndefined = _require.isNullOrUndefined;
8975
8976var _require2 = __webpack_require__(0),
8977 extend = _require2.extend,
8978 isObject = _require2.isObject,
8979 isEmpty = _require2.isEmpty;
8980
8981var isCNApp = function isCNApp(appId) {
8982 return appId.slice(-9) !== '-MdYXbMMI';
8983};
8984
8985var fillServerURLs = function fillServerURLs(url) {
8986 return {
8987 push: url,
8988 stats: url,
8989 engine: url,
8990 api: url,
8991 rtm: url
8992 };
8993};
8994
8995function getDefaultServerURLs(appId) {
8996 if (isCNApp(appId)) {
8997 return {};
8998 }
8999 var id = appId.slice(0, 8).toLowerCase();
9000 var domain = 'lncldglobal.com';
9001 return {
9002 push: 'https://' + id + '.push.' + domain,
9003 stats: 'https://' + id + '.stats.' + domain,
9004 engine: 'https://' + id + '.engine.' + domain,
9005 api: 'https://' + id + '.api.' + domain,
9006 rtm: 'https://' + id + '.rtm.' + domain
9007 };
9008}
9009
9010var _disableAppRouter = false;
9011var _initialized = false;
9012
9013/**
9014 * URLs for services
9015 * @typedef {Object} ServerURLs
9016 * @property {String} [api] serverURL for API service
9017 * @property {String} [engine] serverURL for engine service
9018 * @property {String} [stats] serverURL for stats service
9019 * @property {String} [push] serverURL for push service
9020 * @property {String} [rtm] serverURL for LiveQuery service
9021 */
9022
9023/**
9024 * Call this method first to set up your authentication tokens for AV.
9025 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
9026 * @function AV.init
9027 * @param {Object} options
9028 * @param {String} options.appId application id
9029 * @param {String} options.appKey application key
9030 * @param {String} [options.masterKey] application master key
9031 * @param {Boolean} [options.production]
9032 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
9033 * @param {Boolean} [options.disableCurrentUser]
9034 */
9035AV.init = function init(options) {
9036 if (!isObject(options)) {
9037 return AV.init({
9038 appId: options,
9039 appKey: arguments.length <= 1 ? undefined : arguments[1],
9040 masterKey: arguments.length <= 2 ? undefined : arguments[2]
9041 });
9042 }
9043 var appId = options.appId,
9044 appKey = options.appKey,
9045 masterKey = options.masterKey,
9046 hookKey = options.hookKey,
9047 serverURL = options.serverURL,
9048 _options$serverURLs = options.serverURLs,
9049 serverURLs = _options$serverURLs === undefined ? serverURL : _options$serverURLs,
9050 disableCurrentUser = options.disableCurrentUser,
9051 production = options.production,
9052 realtime = options.realtime;
9053
9054 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.');
9055 if (!appId) throw new TypeError('appId must be a string');
9056 if (!appKey) throw new TypeError('appKey must be a string');
9057 if ('Browser' !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
9058 if (isCNApp(appId)) {
9059 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
9060 throw new TypeError('serverURL option is required for apps from CN region');
9061 }
9062 }
9063 if (appId !== AV._config.applicationId) {
9064 // overwrite all keys when reinitializing as a new app
9065 AV._config.masterKey = masterKey;
9066 AV._config.hookKey = hookKey;
9067 } else {
9068 if (masterKey) AV._config.masterKey = masterKey;
9069 if (hookKey) AV._config.hookKey = hookKey;
9070 }
9071 AV._config.applicationId = appId;
9072 AV._config.applicationKey = appKey;
9073 if (!isNullOrUndefined(production)) {
9074 AV.setProduction(production);
9075 }
9076 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
9077 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
9078 if (!disableAppRouter) {
9079 AV._appRouter = new AppRouter(AV);
9080 }
9081 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
9082 if (realtime) {
9083 AV._config.realtime = realtime;
9084 } else if (AV._sharedConfig.liveQueryRealtime) {
9085 var _AV$_config$serverURL = AV._config.serverURLs,
9086 api = _AV$_config$serverURL.api,
9087 rtm = _AV$_config$serverURL.rtm;
9088
9089 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
9090 appId: appId,
9091 appKey: appKey,
9092 server: {
9093 api: api,
9094 RTMRouter: rtm
9095 }
9096 });
9097 }
9098 _initialized = true;
9099};
9100
9101// If we're running in node.js, allow using the master key.
9102if (false) {
9103 AV.Cloud = AV.Cloud || {};
9104 /**
9105 * Switches the LeanCloud SDK to using the Master key. The Master key grants
9106 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
9107 * other restrictions that are applied to the client SDKs.
9108 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
9109 * </p>
9110 */
9111 AV.Cloud.useMasterKey = function () {
9112 AV._config.useMasterKey = true;
9113 };
9114}
9115
9116/**
9117 * Call this method to set production environment variable.
9118 * @function AV.setProduction
9119 * @param {Boolean} production True is production environment,and
9120 * it's true by default.
9121 */
9122AV.setProduction = function (production) {
9123 if (!isNullOrUndefined(production)) {
9124 AV._config.production = production ? 1 : 0;
9125 } else {
9126 // change to default value
9127 AV._config.production = null;
9128 }
9129};
9130
9131AV._setServerURLs = function (urls) {
9132 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
9133
9134 if (typeof urls !== 'string') {
9135 extend(AV._config.serverURLs, urls);
9136 } else {
9137 AV._config.serverURLs = fillServerURLs(urls);
9138 }
9139 if (disableAppRouter) {
9140 if (AV._appRouter) {
9141 AV._appRouter.disable();
9142 } else {
9143 _disableAppRouter = true;
9144 }
9145 }
9146};
9147/**
9148 * Set server URLs for services.
9149 * @function AV.setServerURL
9150 * @since 4.3.0
9151 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
9152 * You can also set them when initializing SDK with `options.serverURL`
9153 */
9154AV.setServerURL = function (urls) {
9155 return AV._setServerURLs(urls);
9156};
9157AV.setServerURLs = AV.setServerURL;
9158
9159AV.keepErrorRawMessage = function (value) {
9160 AV._sharedConfig.keepErrorRawMessage = value;
9161};
9162
9163/**
9164 * Set a deadline for requests to complete.
9165 * Note that file upload requests are not affected.
9166 * @function AV.setRequestTimeout
9167 * @since 3.6.0
9168 * @param {number} ms
9169 */
9170AV.setRequestTimeout = function (ms) {
9171 AV._config.requestTimeout = ms;
9172};
9173
9174// backword compatible
9175AV.initialize = AV.init;
9176
9177var defineConfig = function defineConfig(property) {
9178 return (0, _defineProperty2.default)(AV, property, {
9179 get: function get() {
9180 return AV._config[property];
9181 },
9182 set: function set(value) {
9183 AV._config[property] = value;
9184 }
9185 });
9186};
9187
9188['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
9189
9190/***/ }),
9191/* 276 */
9192/***/ (function(module, exports, __webpack_require__) {
9193
9194__webpack_require__(277);
9195var $Object = __webpack_require__(2).Object;
9196module.exports = function defineProperty(it, key, desc) {
9197 return $Object.defineProperty(it, key, desc);
9198};
9199
9200
9201/***/ }),
9202/* 277 */
9203/***/ (function(module, exports, __webpack_require__) {
9204
9205var $export = __webpack_require__(16);
9206// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
9207$export($export.S + $export.F * !__webpack_require__(21), 'Object', { defineProperty: __webpack_require__(18).f });
9208
9209
9210/***/ }),
9211/* 278 */
9212/***/ (function(module, exports, __webpack_require__) {
9213
9214"use strict";
9215
9216
9217var ajax = __webpack_require__(60);
9218var Cache = __webpack_require__(164);
9219
9220function AppRouter(AV) {
9221 var _this = this;
9222
9223 this.AV = AV;
9224 this.lockedUntil = 0;
9225 Cache.getAsync('serverURLs').then(function (data) {
9226 if (_this.disabled) return;
9227 if (!data) return _this.lock(0);
9228 var serverURLs = data.serverURLs,
9229 lockedUntil = data.lockedUntil;
9230
9231 _this.AV._setServerURLs(serverURLs, false);
9232 _this.lockedUntil = lockedUntil;
9233 }).catch(function () {
9234 return _this.lock(0);
9235 });
9236}
9237
9238AppRouter.prototype.disable = function disable() {
9239 this.disabled = true;
9240};
9241AppRouter.prototype.lock = function lock(ttl) {
9242 this.lockedUntil = Date.now() + ttl;
9243};
9244AppRouter.prototype.refresh = function refresh() {
9245 var _this2 = this;
9246
9247 if (this.disabled) return;
9248 if (Date.now() < this.lockedUntil) return;
9249 this.lock(10);
9250 var url = 'https://app-router.com/2/route';
9251 return ajax({
9252 method: 'get',
9253 url: url,
9254 query: {
9255 appId: this.AV.applicationId
9256 }
9257 }).then(function (servers) {
9258 if (_this2.disabled) return;
9259 var ttl = servers.ttl;
9260 if (!ttl) throw new Error('missing ttl');
9261 ttl = ttl * 1000;
9262 var protocal = 'https://';
9263 var serverURLs = {
9264 push: protocal + servers.push_server,
9265 stats: protocal + servers.stats_server,
9266 engine: protocal + servers.engine_server,
9267 api: protocal + servers.api_server
9268 };
9269 _this2.AV._setServerURLs(serverURLs, false);
9270 _this2.lock(ttl);
9271 return Cache.setAsync('serverURLs', {
9272 serverURLs: serverURLs,
9273 lockedUntil: _this2.lockedUntil
9274 }, ttl);
9275 }).catch(function (error) {
9276 // bypass all errors
9277 console.warn('refresh server URLs failed: ' + error.message);
9278 _this2.lock(600);
9279 });
9280};
9281
9282module.exports = AppRouter;
9283
9284/***/ }),
9285/* 279 */
9286/***/ (function(module, exports, __webpack_require__) {
9287
9288__webpack_require__(39);
9289__webpack_require__(56);
9290module.exports = __webpack_require__(91).f('iterator');
9291
9292
9293/***/ }),
9294/* 280 */
9295/***/ (function(module, exports, __webpack_require__) {
9296
9297__webpack_require__(281);
9298__webpack_require__(95);
9299__webpack_require__(286);
9300__webpack_require__(287);
9301module.exports = __webpack_require__(2).Symbol;
9302
9303
9304/***/ }),
9305/* 281 */
9306/***/ (function(module, exports, __webpack_require__) {
9307
9308"use strict";
9309
9310// ECMAScript 6 symbols shim
9311var global = __webpack_require__(6);
9312var has = __webpack_require__(24);
9313var DESCRIPTORS = __webpack_require__(21);
9314var $export = __webpack_require__(16);
9315var redefine = __webpack_require__(98);
9316var META = __webpack_require__(282).KEY;
9317var $fails = __webpack_require__(41);
9318var shared = __webpack_require__(69);
9319var setToStringTag = __webpack_require__(55);
9320var uid = __webpack_require__(54);
9321var wks = __webpack_require__(7);
9322var wksExt = __webpack_require__(91);
9323var wksDefine = __webpack_require__(92);
9324var enumKeys = __webpack_require__(283);
9325var isArray = __webpack_require__(284);
9326var anObject = __webpack_require__(17);
9327var isObject = __webpack_require__(20);
9328var toObject = __webpack_require__(44);
9329var toIObject = __webpack_require__(25);
9330var toPrimitive = __webpack_require__(65);
9331var createDesc = __webpack_require__(42);
9332var _create = __webpack_require__(66);
9333var gOPNExt = __webpack_require__(285);
9334var $GOPD = __webpack_require__(94);
9335var $GOPS = __webpack_require__(165);
9336var $DP = __webpack_require__(18);
9337var $keys = __webpack_require__(53);
9338var gOPD = $GOPD.f;
9339var dP = $DP.f;
9340var gOPN = gOPNExt.f;
9341var $Symbol = global.Symbol;
9342var $JSON = global.JSON;
9343var _stringify = $JSON && $JSON.stringify;
9344var PROTOTYPE = 'prototype';
9345var HIDDEN = wks('_hidden');
9346var TO_PRIMITIVE = wks('toPrimitive');
9347var isEnum = {}.propertyIsEnumerable;
9348var SymbolRegistry = shared('symbol-registry');
9349var AllSymbols = shared('symbols');
9350var OPSymbols = shared('op-symbols');
9351var ObjectProto = Object[PROTOTYPE];
9352var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f;
9353var QObject = global.QObject;
9354// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
9355var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
9356
9357// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
9358var setSymbolDesc = DESCRIPTORS && $fails(function () {
9359 return _create(dP({}, 'a', {
9360 get: function () { return dP(this, 'a', { value: 7 }).a; }
9361 })).a != 7;
9362}) ? function (it, key, D) {
9363 var protoDesc = gOPD(ObjectProto, key);
9364 if (protoDesc) delete ObjectProto[key];
9365 dP(it, key, D);
9366 if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
9367} : dP;
9368
9369var wrap = function (tag) {
9370 var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
9371 sym._k = tag;
9372 return sym;
9373};
9374
9375var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
9376 return typeof it == 'symbol';
9377} : function (it) {
9378 return it instanceof $Symbol;
9379};
9380
9381var $defineProperty = function defineProperty(it, key, D) {
9382 if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
9383 anObject(it);
9384 key = toPrimitive(key, true);
9385 anObject(D);
9386 if (has(AllSymbols, key)) {
9387 if (!D.enumerable) {
9388 if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
9389 it[HIDDEN][key] = true;
9390 } else {
9391 if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
9392 D = _create(D, { enumerable: createDesc(0, false) });
9393 } return setSymbolDesc(it, key, D);
9394 } return dP(it, key, D);
9395};
9396var $defineProperties = function defineProperties(it, P) {
9397 anObject(it);
9398 var keys = enumKeys(P = toIObject(P));
9399 var i = 0;
9400 var l = keys.length;
9401 var key;
9402 while (l > i) $defineProperty(it, key = keys[i++], P[key]);
9403 return it;
9404};
9405var $create = function create(it, P) {
9406 return P === undefined ? _create(it) : $defineProperties(_create(it), P);
9407};
9408var $propertyIsEnumerable = function propertyIsEnumerable(key) {
9409 var E = isEnum.call(this, key = toPrimitive(key, true));
9410 if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
9411 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
9412};
9413var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
9414 it = toIObject(it);
9415 key = toPrimitive(key, true);
9416 if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
9417 var D = gOPD(it, key);
9418 if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
9419 return D;
9420};
9421var $getOwnPropertyNames = function getOwnPropertyNames(it) {
9422 var names = gOPN(toIObject(it));
9423 var result = [];
9424 var i = 0;
9425 var key;
9426 while (names.length > i) {
9427 if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
9428 } return result;
9429};
9430var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
9431 var IS_OP = it === ObjectProto;
9432 var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
9433 var result = [];
9434 var i = 0;
9435 var key;
9436 while (names.length > i) {
9437 if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
9438 } return result;
9439};
9440
9441// 19.4.1.1 Symbol([description])
9442if (!USE_NATIVE) {
9443 $Symbol = function Symbol() {
9444 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
9445 var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
9446 var $set = function (value) {
9447 if (this === ObjectProto) $set.call(OPSymbols, value);
9448 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
9449 setSymbolDesc(this, tag, createDesc(1, value));
9450 };
9451 if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
9452 return wrap(tag);
9453 };
9454 redefine($Symbol[PROTOTYPE], 'toString', function toString() {
9455 return this._k;
9456 });
9457
9458 $GOPD.f = $getOwnPropertyDescriptor;
9459 $DP.f = $defineProperty;
9460 __webpack_require__(166).f = gOPNExt.f = $getOwnPropertyNames;
9461 __webpack_require__(93).f = $propertyIsEnumerable;
9462 $GOPS.f = $getOwnPropertySymbols;
9463
9464 if (DESCRIPTORS && !__webpack_require__(40)) {
9465 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
9466 }
9467
9468 wksExt.f = function (name) {
9469 return wrap(wks(name));
9470 };
9471}
9472
9473$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
9474
9475for (var es6Symbols = (
9476 // 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
9477 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
9478).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
9479
9480for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
9481
9482$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
9483 // 19.4.2.1 Symbol.for(key)
9484 'for': function (key) {
9485 return has(SymbolRegistry, key += '')
9486 ? SymbolRegistry[key]
9487 : SymbolRegistry[key] = $Symbol(key);
9488 },
9489 // 19.4.2.5 Symbol.keyFor(sym)
9490 keyFor: function keyFor(sym) {
9491 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
9492 for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
9493 },
9494 useSetter: function () { setter = true; },
9495 useSimple: function () { setter = false; }
9496});
9497
9498$export($export.S + $export.F * !USE_NATIVE, 'Object', {
9499 // 19.1.2.2 Object.create(O [, Properties])
9500 create: $create,
9501 // 19.1.2.4 Object.defineProperty(O, P, Attributes)
9502 defineProperty: $defineProperty,
9503 // 19.1.2.3 Object.defineProperties(O, Properties)
9504 defineProperties: $defineProperties,
9505 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
9506 getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
9507 // 19.1.2.7 Object.getOwnPropertyNames(O)
9508 getOwnPropertyNames: $getOwnPropertyNames,
9509 // 19.1.2.8 Object.getOwnPropertySymbols(O)
9510 getOwnPropertySymbols: $getOwnPropertySymbols
9511});
9512
9513// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
9514// https://bugs.chromium.org/p/v8/issues/detail?id=3443
9515var FAILS_ON_PRIMITIVES = $fails(function () { $GOPS.f(1); });
9516
9517$export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', {
9518 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
9519 return $GOPS.f(toObject(it));
9520 }
9521});
9522
9523// 24.3.2 JSON.stringify(value [, replacer [, space]])
9524$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
9525 var S = $Symbol();
9526 // MS Edge converts symbol values to JSON as {}
9527 // WebKit converts symbol values to JSON as null
9528 // V8 throws on boxed symbols
9529 return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
9530})), 'JSON', {
9531 stringify: function stringify(it) {
9532 var args = [it];
9533 var i = 1;
9534 var replacer, $replacer;
9535 while (arguments.length > i) args.push(arguments[i++]);
9536 $replacer = replacer = args[1];
9537 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
9538 if (!isArray(replacer)) replacer = function (key, value) {
9539 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
9540 if (!isSymbol(value)) return value;
9541 };
9542 args[1] = replacer;
9543 return _stringify.apply($JSON, args);
9544 }
9545});
9546
9547// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
9548$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(23)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
9549// 19.4.3.5 Symbol.prototype[@@toStringTag]
9550setToStringTag($Symbol, 'Symbol');
9551// 20.2.1.9 Math[@@toStringTag]
9552setToStringTag(Math, 'Math', true);
9553// 24.3.3 JSON[@@toStringTag]
9554setToStringTag(global.JSON, 'JSON', true);
9555
9556
9557/***/ }),
9558/* 282 */
9559/***/ (function(module, exports, __webpack_require__) {
9560
9561var META = __webpack_require__(54)('meta');
9562var isObject = __webpack_require__(20);
9563var has = __webpack_require__(24);
9564var setDesc = __webpack_require__(18).f;
9565var id = 0;
9566var isExtensible = Object.isExtensible || function () {
9567 return true;
9568};
9569var FREEZE = !__webpack_require__(41)(function () {
9570 return isExtensible(Object.preventExtensions({}));
9571});
9572var setMeta = function (it) {
9573 setDesc(it, META, { value: {
9574 i: 'O' + ++id, // object ID
9575 w: {} // weak collections IDs
9576 } });
9577};
9578var fastKey = function (it, create) {
9579 // return primitive with prefix
9580 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
9581 if (!has(it, META)) {
9582 // can't set metadata to uncaught frozen object
9583 if (!isExtensible(it)) return 'F';
9584 // not necessary to add metadata
9585 if (!create) return 'E';
9586 // add missing metadata
9587 setMeta(it);
9588 // return object ID
9589 } return it[META].i;
9590};
9591var getWeak = function (it, create) {
9592 if (!has(it, META)) {
9593 // can't set metadata to uncaught frozen object
9594 if (!isExtensible(it)) return true;
9595 // not necessary to add metadata
9596 if (!create) return false;
9597 // add missing metadata
9598 setMeta(it);
9599 // return hash weak collections IDs
9600 } return it[META].w;
9601};
9602// add metadata on freeze-family methods calling
9603var onFreeze = function (it) {
9604 if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
9605 return it;
9606};
9607var meta = module.exports = {
9608 KEY: META,
9609 NEED: false,
9610 fastKey: fastKey,
9611 getWeak: getWeak,
9612 onFreeze: onFreeze
9613};
9614
9615
9616/***/ }),
9617/* 283 */
9618/***/ (function(module, exports, __webpack_require__) {
9619
9620// all enumerable object keys, includes symbols
9621var getKeys = __webpack_require__(53);
9622var gOPS = __webpack_require__(165);
9623var pIE = __webpack_require__(93);
9624module.exports = function (it) {
9625 var result = getKeys(it);
9626 var getSymbols = gOPS.f;
9627 if (getSymbols) {
9628 var symbols = getSymbols(it);
9629 var isEnum = pIE.f;
9630 var i = 0;
9631 var key;
9632 while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
9633 } return result;
9634};
9635
9636
9637/***/ }),
9638/* 284 */
9639/***/ (function(module, exports, __webpack_require__) {
9640
9641// 7.2.2 IsArray(argument)
9642var cof = __webpack_require__(43);
9643module.exports = Array.isArray || function isArray(arg) {
9644 return cof(arg) == 'Array';
9645};
9646
9647
9648/***/ }),
9649/* 285 */
9650/***/ (function(module, exports, __webpack_require__) {
9651
9652// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
9653var toIObject = __webpack_require__(25);
9654var gOPN = __webpack_require__(166).f;
9655var toString = {}.toString;
9656
9657var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
9658 ? Object.getOwnPropertyNames(window) : [];
9659
9660var getWindowNames = function (it) {
9661 try {
9662 return gOPN(it);
9663 } catch (e) {
9664 return windowNames.slice();
9665 }
9666};
9667
9668module.exports.f = function getOwnPropertyNames(it) {
9669 return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
9670};
9671
9672
9673/***/ }),
9674/* 286 */
9675/***/ (function(module, exports, __webpack_require__) {
9676
9677__webpack_require__(92)('asyncIterator');
9678
9679
9680/***/ }),
9681/* 287 */
9682/***/ (function(module, exports, __webpack_require__) {
9683
9684__webpack_require__(92)('observable');
9685
9686
9687/***/ }),
9688/* 288 */
9689/***/ (function(module, exports, __webpack_require__) {
9690
9691"use strict";
9692// Copyright (c) 2015-2017 David M. Lee, II
9693
9694
9695/**
9696 * Local reference to TimeoutError
9697 * @private
9698 */
9699var TimeoutError;
9700
9701/**
9702 * Rejects a promise with a {@link TimeoutError} if it does not settle within
9703 * the specified timeout.
9704 *
9705 * @param {Promise} promise The promise.
9706 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
9707 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
9708 * `TimeoutError`, whichever settles first.
9709 */
9710var timeout = module.exports.timeout = function(promise, timeoutMillis) {
9711 var error = new TimeoutError(),
9712 timeout;
9713
9714 return Promise.race([
9715 promise,
9716 new Promise(function(resolve, reject) {
9717 timeout = setTimeout(function() {
9718 reject(error);
9719 }, timeoutMillis);
9720 }),
9721 ]).then(function(v) {
9722 clearTimeout(timeout);
9723 return v;
9724 }, function(err) {
9725 clearTimeout(timeout);
9726 throw err;
9727 });
9728};
9729
9730/**
9731 * Exception indicating that the timeout expired.
9732 */
9733TimeoutError = module.exports.TimeoutError = function() {
9734 Error.call(this)
9735 this.stack = Error().stack
9736 this.message = 'Timeout';
9737};
9738
9739TimeoutError.prototype = Object.create(Error.prototype);
9740TimeoutError.prototype.name = "TimeoutError";
9741
9742
9743/***/ }),
9744/* 289 */
9745/***/ (function(module, exports, __webpack_require__) {
9746
9747"use strict";
9748
9749
9750var _ = __webpack_require__(0);
9751
9752module.exports = function (AV) {
9753 var eventSplitter = /\s+/;
9754 var slice = Array.prototype.slice;
9755
9756 /**
9757 * @class
9758 *
9759 * <p>AV.Events is a fork of Backbone's Events module, provided for your
9760 * convenience.</p>
9761 *
9762 * <p>A module that can be mixed in to any object in order to provide
9763 * it with custom events. You may bind callback functions to an event
9764 * with `on`, or remove these functions with `off`.
9765 * Triggering an event fires all callbacks in the order that `on` was
9766 * called.
9767 *
9768 * @private
9769 * @example
9770 * var object = {};
9771 * _.extend(object, AV.Events);
9772 * object.on('expand', function(){ alert('expanded'); });
9773 * object.trigger('expand');</pre></p>
9774 *
9775 */
9776 AV.Events = {
9777 /**
9778 * Bind one or more space separated events, `events`, to a `callback`
9779 * function. Passing `"all"` will bind the callback to all events fired.
9780 */
9781 on: function on(events, callback, context) {
9782 var calls, event, node, tail, list;
9783 if (!callback) {
9784 return this;
9785 }
9786 events = events.split(eventSplitter);
9787 calls = this._callbacks || (this._callbacks = {});
9788
9789 // Create an immutable callback list, allowing traversal during
9790 // modification. The tail is an empty object that will always be used
9791 // as the next node.
9792 event = events.shift();
9793 while (event) {
9794 list = calls[event];
9795 node = list ? list.tail : {};
9796 node.next = tail = {};
9797 node.context = context;
9798 node.callback = callback;
9799 calls[event] = { tail: tail, next: list ? list.next : node };
9800 event = events.shift();
9801 }
9802
9803 return this;
9804 },
9805
9806 /**
9807 * Remove one or many callbacks. If `context` is null, removes all callbacks
9808 * with that function. If `callback` is null, removes all callbacks for the
9809 * event. If `events` is null, removes all bound callbacks for all events.
9810 */
9811 off: function off(events, callback, context) {
9812 var event, calls, node, tail, cb, ctx;
9813
9814 // No events, or removing *all* events.
9815 if (!(calls = this._callbacks)) {
9816 return;
9817 }
9818 if (!(events || callback || context)) {
9819 delete this._callbacks;
9820 return this;
9821 }
9822
9823 // Loop through the listed events and contexts, splicing them out of the
9824 // linked list of callbacks if appropriate.
9825 events = events ? events.split(eventSplitter) : _.keys(calls);
9826 event = events.shift();
9827 while (event) {
9828 node = calls[event];
9829 delete calls[event];
9830 if (!node || !(callback || context)) {
9831 continue;
9832 }
9833 // Create a new list, omitting the indicated callbacks.
9834 tail = node.tail;
9835 node = node.next;
9836 while (node !== tail) {
9837 cb = node.callback;
9838 ctx = node.context;
9839 if (callback && cb !== callback || context && ctx !== context) {
9840 this.on(event, cb, ctx);
9841 }
9842 node = node.next;
9843 }
9844 event = events.shift();
9845 }
9846
9847 return this;
9848 },
9849
9850 /**
9851 * Trigger one or many events, firing all bound callbacks. Callbacks are
9852 * passed the same arguments as `trigger` is, apart from the event name
9853 * (unless you're listening on `"all"`, which will cause your callback to
9854 * receive the true name of the event as the first argument).
9855 */
9856 trigger: function trigger(events) {
9857 var event, node, calls, tail, args, all, rest;
9858 if (!(calls = this._callbacks)) {
9859 return this;
9860 }
9861 all = calls.all;
9862 events = events.split(eventSplitter);
9863 rest = slice.call(arguments, 1);
9864
9865 // For each event, walk through the linked list of callbacks twice,
9866 // first to trigger the event, then to trigger any `"all"` callbacks.
9867 event = events.shift();
9868 while (event) {
9869 node = calls[event];
9870 if (node) {
9871 tail = node.tail;
9872 while ((node = node.next) !== tail) {
9873 node.callback.apply(node.context || this, rest);
9874 }
9875 }
9876 node = all;
9877 if (node) {
9878 tail = node.tail;
9879 args = [event].concat(rest);
9880 while ((node = node.next) !== tail) {
9881 node.callback.apply(node.context || this, args);
9882 }
9883 }
9884 event = events.shift();
9885 }
9886
9887 return this;
9888 }
9889 };
9890
9891 /**
9892 * @function
9893 */
9894 AV.Events.bind = AV.Events.on;
9895
9896 /**
9897 * @function
9898 */
9899 AV.Events.unbind = AV.Events.off;
9900};
9901
9902/***/ }),
9903/* 290 */
9904/***/ (function(module, exports, __webpack_require__) {
9905
9906"use strict";
9907
9908
9909var _promise = __webpack_require__(3);
9910
9911var _promise2 = _interopRequireDefault(_promise);
9912
9913function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9914
9915var _ = __webpack_require__(0);
9916
9917/*global navigator: false */
9918module.exports = function (AV) {
9919 /**
9920 * Creates a new GeoPoint with any of the following forms:<br>
9921 * @example
9922 * new GeoPoint(otherGeoPoint)
9923 * new GeoPoint(30, 30)
9924 * new GeoPoint([30, 30])
9925 * new GeoPoint({latitude: 30, longitude: 30})
9926 * new GeoPoint() // defaults to (0, 0)
9927 * @class
9928 *
9929 * <p>Represents a latitude / longitude point that may be associated
9930 * with a key in a AVObject or used as a reference point for geo queries.
9931 * This allows proximity-based queries on the key.</p>
9932 *
9933 * <p>Only one key in a class may contain a GeoPoint.</p>
9934 *
9935 * <p>Example:<pre>
9936 * var point = new AV.GeoPoint(30.0, -20.0);
9937 * var object = new AV.Object("PlaceObject");
9938 * object.set("location", point);
9939 * object.save();</pre></p>
9940 */
9941 AV.GeoPoint = function (arg1, arg2) {
9942 if (_.isArray(arg1)) {
9943 AV.GeoPoint._validate(arg1[0], arg1[1]);
9944 this.latitude = arg1[0];
9945 this.longitude = arg1[1];
9946 } else if (_.isObject(arg1)) {
9947 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
9948 this.latitude = arg1.latitude;
9949 this.longitude = arg1.longitude;
9950 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
9951 AV.GeoPoint._validate(arg1, arg2);
9952 this.latitude = arg1;
9953 this.longitude = arg2;
9954 } else {
9955 this.latitude = 0;
9956 this.longitude = 0;
9957 }
9958
9959 // Add properties so that anyone using Webkit or Mozilla will get an error
9960 // if they try to set values that are out of bounds.
9961 var self = this;
9962 if (this.__defineGetter__ && this.__defineSetter__) {
9963 // Use _latitude and _longitude to actually store the values, and add
9964 // getters and setters for latitude and longitude.
9965 this._latitude = this.latitude;
9966 this._longitude = this.longitude;
9967 this.__defineGetter__('latitude', function () {
9968 return self._latitude;
9969 });
9970 this.__defineGetter__('longitude', function () {
9971 return self._longitude;
9972 });
9973 this.__defineSetter__('latitude', function (val) {
9974 AV.GeoPoint._validate(val, self.longitude);
9975 self._latitude = val;
9976 });
9977 this.__defineSetter__('longitude', function (val) {
9978 AV.GeoPoint._validate(self.latitude, val);
9979 self._longitude = val;
9980 });
9981 }
9982 };
9983
9984 /**
9985 * @lends AV.GeoPoint.prototype
9986 * @property {float} latitude North-south portion of the coordinate, in range
9987 * [-90, 90]. Throws an exception if set out of range in a modern browser.
9988 * @property {float} longitude East-west portion of the coordinate, in range
9989 * [-180, 180]. Throws if set out of range in a modern browser.
9990 */
9991
9992 /**
9993 * Throws an exception if the given lat-long is out of bounds.
9994 * @private
9995 */
9996 AV.GeoPoint._validate = function (latitude, longitude) {
9997 if (latitude < -90.0) {
9998 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
9999 }
10000 if (latitude > 90.0) {
10001 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
10002 }
10003 if (longitude < -180.0) {
10004 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
10005 }
10006 if (longitude > 180.0) {
10007 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
10008 }
10009 };
10010
10011 /**
10012 * Creates a GeoPoint with the user's current location, if available.
10013 * @return {Promise.<AV.GeoPoint>}
10014 */
10015 AV.GeoPoint.current = function () {
10016 return new _promise2.default(function (resolve, reject) {
10017 navigator.geolocation.getCurrentPosition(function (location) {
10018 resolve(new AV.GeoPoint({
10019 latitude: location.coords.latitude,
10020 longitude: location.coords.longitude
10021 }));
10022 }, reject);
10023 });
10024 };
10025
10026 _.extend(AV.GeoPoint.prototype,
10027 /** @lends AV.GeoPoint.prototype */{
10028 /**
10029 * Returns a JSON representation of the GeoPoint, suitable for AV.
10030 * @return {Object}
10031 */
10032 toJSON: function toJSON() {
10033 AV.GeoPoint._validate(this.latitude, this.longitude);
10034 return {
10035 __type: 'GeoPoint',
10036 latitude: this.latitude,
10037 longitude: this.longitude
10038 };
10039 },
10040
10041 /**
10042 * Returns the distance from this GeoPoint to another in radians.
10043 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10044 * @return {Number}
10045 */
10046 radiansTo: function radiansTo(point) {
10047 var d2r = Math.PI / 180.0;
10048 var lat1rad = this.latitude * d2r;
10049 var long1rad = this.longitude * d2r;
10050 var lat2rad = point.latitude * d2r;
10051 var long2rad = point.longitude * d2r;
10052 var deltaLat = lat1rad - lat2rad;
10053 var deltaLong = long1rad - long2rad;
10054 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
10055 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2);
10056 // Square of half the straight line chord distance between both points.
10057 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
10058 a = Math.min(1.0, a);
10059 return 2 * Math.asin(Math.sqrt(a));
10060 },
10061
10062 /**
10063 * Returns the distance from this GeoPoint to another in kilometers.
10064 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10065 * @return {Number}
10066 */
10067 kilometersTo: function kilometersTo(point) {
10068 return this.radiansTo(point) * 6371.0;
10069 },
10070
10071 /**
10072 * Returns the distance from this GeoPoint to another in miles.
10073 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10074 * @return {Number}
10075 */
10076 milesTo: function milesTo(point) {
10077 return this.radiansTo(point) * 3958.8;
10078 }
10079 });
10080};
10081
10082/***/ }),
10083/* 291 */
10084/***/ (function(module, exports, __webpack_require__) {
10085
10086"use strict";
10087
10088
10089var _ = __webpack_require__(0);
10090
10091module.exports = function (AV) {
10092 var PUBLIC_KEY = '*';
10093
10094 /**
10095 * Creates a new ACL.
10096 * If no argument is given, the ACL has no permissions for anyone.
10097 * If the argument is a AV.User, the ACL will have read and write
10098 * permission for only that user.
10099 * If the argument is any other JSON object, that object will be interpretted
10100 * as a serialized ACL created with toJSON().
10101 * @see AV.Object#setACL
10102 * @class
10103 *
10104 * <p>An ACL, or Access Control List can be added to any
10105 * <code>AV.Object</code> to restrict access to only a subset of users
10106 * of your application.</p>
10107 */
10108 AV.ACL = function (arg1) {
10109 var self = this;
10110 self.permissionsById = {};
10111 if (_.isObject(arg1)) {
10112 if (arg1 instanceof AV.User) {
10113 self.setReadAccess(arg1, true);
10114 self.setWriteAccess(arg1, true);
10115 } else {
10116 if (_.isFunction(arg1)) {
10117 throw new Error('AV.ACL() called with a function. Did you forget ()?');
10118 }
10119 AV._objectEach(arg1, function (accessList, userId) {
10120 if (!_.isString(userId)) {
10121 throw new Error('Tried to create an ACL with an invalid userId.');
10122 }
10123 self.permissionsById[userId] = {};
10124 AV._objectEach(accessList, function (allowed, permission) {
10125 if (permission !== 'read' && permission !== 'write') {
10126 throw new Error('Tried to create an ACL with an invalid permission type.');
10127 }
10128 if (!_.isBoolean(allowed)) {
10129 throw new Error('Tried to create an ACL with an invalid permission value.');
10130 }
10131 self.permissionsById[userId][permission] = allowed;
10132 });
10133 });
10134 }
10135 }
10136 };
10137
10138 /**
10139 * Returns a JSON-encoded version of the ACL.
10140 * @return {Object}
10141 */
10142 AV.ACL.prototype.toJSON = function () {
10143 return _.clone(this.permissionsById);
10144 };
10145
10146 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
10147 if (userId instanceof AV.User) {
10148 userId = userId.id;
10149 } else if (userId instanceof AV.Role) {
10150 userId = 'role:' + userId.getName();
10151 }
10152 if (!_.isString(userId)) {
10153 throw new Error('userId must be a string.');
10154 }
10155 if (!_.isBoolean(allowed)) {
10156 throw new Error('allowed must be either true or false.');
10157 }
10158 var permissions = this.permissionsById[userId];
10159 if (!permissions) {
10160 if (!allowed) {
10161 // The user already doesn't have this permission, so no action needed.
10162 return;
10163 } else {
10164 permissions = {};
10165 this.permissionsById[userId] = permissions;
10166 }
10167 }
10168
10169 if (allowed) {
10170 this.permissionsById[userId][accessType] = true;
10171 } else {
10172 delete permissions[accessType];
10173 if (_.isEmpty(permissions)) {
10174 delete this.permissionsById[userId];
10175 }
10176 }
10177 };
10178
10179 AV.ACL.prototype._getAccess = function (accessType, userId) {
10180 if (userId instanceof AV.User) {
10181 userId = userId.id;
10182 } else if (userId instanceof AV.Role) {
10183 userId = 'role:' + userId.getName();
10184 }
10185 var permissions = this.permissionsById[userId];
10186 if (!permissions) {
10187 return false;
10188 }
10189 return permissions[accessType] ? true : false;
10190 };
10191
10192 /**
10193 * Set whether the given user is allowed to read this object.
10194 * @param userId An instance of AV.User or its objectId.
10195 * @param {Boolean} allowed Whether that user should have read access.
10196 */
10197 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
10198 this._setAccess('read', userId, allowed);
10199 };
10200
10201 /**
10202 * Get whether the given user id is *explicitly* allowed to read this object.
10203 * Even if this returns false, the user may still be able to access it if
10204 * getPublicReadAccess returns true or a role that the user belongs to has
10205 * write access.
10206 * @param userId An instance of AV.User or its objectId, or a AV.Role.
10207 * @return {Boolean}
10208 */
10209 AV.ACL.prototype.getReadAccess = function (userId) {
10210 return this._getAccess('read', userId);
10211 };
10212
10213 /**
10214 * Set whether the given user id is allowed to write this object.
10215 * @param userId An instance of AV.User or its objectId, or a AV.Role..
10216 * @param {Boolean} allowed Whether that user should have write access.
10217 */
10218 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
10219 this._setAccess('write', userId, allowed);
10220 };
10221
10222 /**
10223 * Get whether the given user id is *explicitly* allowed to write this object.
10224 * Even if this returns false, the user may still be able to write it if
10225 * getPublicWriteAccess returns true or a role that the user belongs to has
10226 * write access.
10227 * @param userId An instance of AV.User or its objectId, or a AV.Role.
10228 * @return {Boolean}
10229 */
10230 AV.ACL.prototype.getWriteAccess = function (userId) {
10231 return this._getAccess('write', userId);
10232 };
10233
10234 /**
10235 * Set whether the public is allowed to read this object.
10236 * @param {Boolean} allowed
10237 */
10238 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
10239 this.setReadAccess(PUBLIC_KEY, allowed);
10240 };
10241
10242 /**
10243 * Get whether the public is allowed to read this object.
10244 * @return {Boolean}
10245 */
10246 AV.ACL.prototype.getPublicReadAccess = function () {
10247 return this.getReadAccess(PUBLIC_KEY);
10248 };
10249
10250 /**
10251 * Set whether the public is allowed to write this object.
10252 * @param {Boolean} allowed
10253 */
10254 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
10255 this.setWriteAccess(PUBLIC_KEY, allowed);
10256 };
10257
10258 /**
10259 * Get whether the public is allowed to write this object.
10260 * @return {Boolean}
10261 */
10262 AV.ACL.prototype.getPublicWriteAccess = function () {
10263 return this.getWriteAccess(PUBLIC_KEY);
10264 };
10265
10266 /**
10267 * Get whether users belonging to the given role are allowed
10268 * to read this object. Even if this returns false, the role may
10269 * still be able to write it if a parent role has read access.
10270 *
10271 * @param role The name of the role, or a AV.Role object.
10272 * @return {Boolean} true if the role has read access. false otherwise.
10273 * @throws {String} If role is neither a AV.Role nor a String.
10274 */
10275 AV.ACL.prototype.getRoleReadAccess = function (role) {
10276 if (role instanceof AV.Role) {
10277 // Normalize to the String name
10278 role = role.getName();
10279 }
10280 if (_.isString(role)) {
10281 return this.getReadAccess('role:' + role);
10282 }
10283 throw new Error('role must be a AV.Role or a String');
10284 };
10285
10286 /**
10287 * Get whether users belonging to the given role are allowed
10288 * to write this object. Even if this returns false, the role may
10289 * still be able to write it if a parent role has write access.
10290 *
10291 * @param role The name of the role, or a AV.Role object.
10292 * @return {Boolean} true if the role has write access. false otherwise.
10293 * @throws {String} If role is neither a AV.Role nor a String.
10294 */
10295 AV.ACL.prototype.getRoleWriteAccess = function (role) {
10296 if (role instanceof AV.Role) {
10297 // Normalize to the String name
10298 role = role.getName();
10299 }
10300 if (_.isString(role)) {
10301 return this.getWriteAccess('role:' + role);
10302 }
10303 throw new Error('role must be a AV.Role or a String');
10304 };
10305
10306 /**
10307 * Set whether users belonging to the given role are allowed
10308 * to read this object.
10309 *
10310 * @param role The name of the role, or a AV.Role object.
10311 * @param {Boolean} allowed Whether the given role can read this object.
10312 * @throws {String} If role is neither a AV.Role nor a String.
10313 */
10314 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
10315 if (role instanceof AV.Role) {
10316 // Normalize to the String name
10317 role = role.getName();
10318 }
10319 if (_.isString(role)) {
10320 this.setReadAccess('role:' + role, allowed);
10321 return;
10322 }
10323 throw new Error('role must be a AV.Role or a String');
10324 };
10325
10326 /**
10327 * Set whether users belonging to the given role are allowed
10328 * to write this object.
10329 *
10330 * @param role The name of the role, or a AV.Role object.
10331 * @param {Boolean} allowed Whether the given role can write this object.
10332 * @throws {String} If role is neither a AV.Role nor a String.
10333 */
10334 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
10335 if (role instanceof AV.Role) {
10336 // Normalize to the String name
10337 role = role.getName();
10338 }
10339 if (_.isString(role)) {
10340 this.setWriteAccess('role:' + role, allowed);
10341 return;
10342 }
10343 throw new Error('role must be a AV.Role or a String');
10344 };
10345};
10346
10347/***/ }),
10348/* 292 */
10349/***/ (function(module, exports, __webpack_require__) {
10350
10351"use strict";
10352
10353
10354var _ = __webpack_require__(0);
10355
10356module.exports = function (AV) {
10357 /**
10358 * @private
10359 * @class
10360 * A AV.Op is an atomic operation that can be applied to a field in a
10361 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
10362 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
10363 * is a AV.Op.Unset. These operations are stored in a AV.Object and
10364 * sent to the server as part of <code>object.save()</code> operations.
10365 * Instances of AV.Op should be immutable.
10366 *
10367 * You should not create subclasses of AV.Op or instantiate AV.Op
10368 * directly.
10369 */
10370 AV.Op = function () {
10371 this._initialize.apply(this, arguments);
10372 };
10373
10374 _.extend(AV.Op.prototype,
10375 /** @lends AV.Op.prototype */{
10376 _initialize: function _initialize() {}
10377 });
10378
10379 _.extend(AV.Op, {
10380 /**
10381 * To create a new Op, call AV.Op._extend();
10382 * @private
10383 */
10384 _extend: AV._extend,
10385
10386 // A map of __op string to decoder function.
10387 _opDecoderMap: {},
10388
10389 /**
10390 * Registers a function to convert a json object with an __op field into an
10391 * instance of a subclass of AV.Op.
10392 * @private
10393 */
10394 _registerDecoder: function _registerDecoder(opName, decoder) {
10395 AV.Op._opDecoderMap[opName] = decoder;
10396 },
10397
10398 /**
10399 * Converts a json object into an instance of a subclass of AV.Op.
10400 * @private
10401 */
10402 _decode: function _decode(json) {
10403 var decoder = AV.Op._opDecoderMap[json.__op];
10404 if (decoder) {
10405 return decoder(json);
10406 } else {
10407 return undefined;
10408 }
10409 }
10410 });
10411
10412 /*
10413 * Add a handler for Batch ops.
10414 */
10415 AV.Op._registerDecoder('Batch', function (json) {
10416 var op = null;
10417 AV._arrayEach(json.ops, function (nextOp) {
10418 nextOp = AV.Op._decode(nextOp);
10419 op = nextOp._mergeWithPrevious(op);
10420 });
10421 return op;
10422 });
10423
10424 /**
10425 * @private
10426 * @class
10427 * A Set operation indicates that either the field was changed using
10428 * AV.Object.set, or it is a mutable container that was detected as being
10429 * changed.
10430 */
10431 AV.Op.Set = AV.Op._extend(
10432 /** @lends AV.Op.Set.prototype */{
10433 _initialize: function _initialize(value) {
10434 this._value = value;
10435 },
10436
10437 /**
10438 * Returns the new value of this field after the set.
10439 */
10440 value: function value() {
10441 return this._value;
10442 },
10443
10444 /**
10445 * Returns a JSON version of the operation suitable for sending to AV.
10446 * @return {Object}
10447 */
10448 toJSON: function toJSON() {
10449 return AV._encode(this.value());
10450 },
10451
10452 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10453 return this;
10454 },
10455
10456 _estimate: function _estimate(oldValue) {
10457 return this.value();
10458 }
10459 });
10460
10461 /**
10462 * A sentinel value that is returned by AV.Op.Unset._estimate to
10463 * indicate the field should be deleted. Basically, if you find _UNSET as a
10464 * value in your object, you should remove that key.
10465 */
10466 AV.Op._UNSET = {};
10467
10468 /**
10469 * @private
10470 * @class
10471 * An Unset operation indicates that this field has been deleted from the
10472 * object.
10473 */
10474 AV.Op.Unset = AV.Op._extend(
10475 /** @lends AV.Op.Unset.prototype */{
10476 /**
10477 * Returns a JSON version of the operation suitable for sending to AV.
10478 * @return {Object}
10479 */
10480 toJSON: function toJSON() {
10481 return { __op: 'Delete' };
10482 },
10483
10484 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10485 return this;
10486 },
10487
10488 _estimate: function _estimate(oldValue) {
10489 return AV.Op._UNSET;
10490 }
10491 });
10492
10493 AV.Op._registerDecoder('Delete', function (json) {
10494 return new AV.Op.Unset();
10495 });
10496
10497 /**
10498 * @private
10499 * @class
10500 * An Increment is an atomic operation where the numeric value for the field
10501 * will be increased by a given amount.
10502 */
10503 AV.Op.Increment = AV.Op._extend(
10504 /** @lends AV.Op.Increment.prototype */{
10505 _initialize: function _initialize(amount) {
10506 this._amount = amount;
10507 },
10508
10509 /**
10510 * Returns the amount to increment by.
10511 * @return {Number} the amount to increment by.
10512 */
10513 amount: function amount() {
10514 return this._amount;
10515 },
10516
10517 /**
10518 * Returns a JSON version of the operation suitable for sending to AV.
10519 * @return {Object}
10520 */
10521 toJSON: function toJSON() {
10522 return { __op: 'Increment', amount: this._amount };
10523 },
10524
10525 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10526 if (!previous) {
10527 return this;
10528 } else if (previous instanceof AV.Op.Unset) {
10529 return new AV.Op.Set(this.amount());
10530 } else if (previous instanceof AV.Op.Set) {
10531 return new AV.Op.Set(previous.value() + this.amount());
10532 } else if (previous instanceof AV.Op.Increment) {
10533 return new AV.Op.Increment(this.amount() + previous.amount());
10534 } else {
10535 throw new Error('Op is invalid after previous op.');
10536 }
10537 },
10538
10539 _estimate: function _estimate(oldValue) {
10540 if (!oldValue) {
10541 return this.amount();
10542 }
10543 return oldValue + this.amount();
10544 }
10545 });
10546
10547 AV.Op._registerDecoder('Increment', function (json) {
10548 return new AV.Op.Increment(json.amount);
10549 });
10550
10551 /**
10552 * @private
10553 * @class
10554 * BitAnd is an atomic operation where the given value will be bit and to the
10555 * value than is stored in this field.
10556 */
10557 AV.Op.BitAnd = AV.Op._extend(
10558 /** @lends AV.Op.BitAnd.prototype */{
10559 _initialize: function _initialize(value) {
10560 this._value = value;
10561 },
10562 value: function value() {
10563 return this._value;
10564 },
10565
10566
10567 /**
10568 * Returns a JSON version of the operation suitable for sending to AV.
10569 * @return {Object}
10570 */
10571 toJSON: function toJSON() {
10572 return { __op: 'BitAnd', value: this.value() };
10573 },
10574 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10575 if (!previous) {
10576 return this;
10577 } else if (previous instanceof AV.Op.Unset) {
10578 return new AV.Op.Set(0);
10579 } else if (previous instanceof AV.Op.Set) {
10580 return new AV.Op.Set(previous.value() & this.value());
10581 } else {
10582 throw new Error('Op is invalid after previous op.');
10583 }
10584 },
10585 _estimate: function _estimate(oldValue) {
10586 return oldValue & this.value();
10587 }
10588 });
10589
10590 AV.Op._registerDecoder('BitAnd', function (json) {
10591 return new AV.Op.BitAnd(json.value);
10592 });
10593
10594 /**
10595 * @private
10596 * @class
10597 * BitOr is an atomic operation where the given value will be bit and to the
10598 * value than is stored in this field.
10599 */
10600 AV.Op.BitOr = AV.Op._extend(
10601 /** @lends AV.Op.BitOr.prototype */{
10602 _initialize: function _initialize(value) {
10603 this._value = value;
10604 },
10605 value: function value() {
10606 return this._value;
10607 },
10608
10609
10610 /**
10611 * Returns a JSON version of the operation suitable for sending to AV.
10612 * @return {Object}
10613 */
10614 toJSON: function toJSON() {
10615 return { __op: 'BitOr', value: this.value() };
10616 },
10617 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10618 if (!previous) {
10619 return this;
10620 } else if (previous instanceof AV.Op.Unset) {
10621 return new AV.Op.Set(this.value());
10622 } else if (previous instanceof AV.Op.Set) {
10623 return new AV.Op.Set(previous.value() | this.value());
10624 } else {
10625 throw new Error('Op is invalid after previous op.');
10626 }
10627 },
10628 _estimate: function _estimate(oldValue) {
10629 return oldValue | this.value();
10630 }
10631 });
10632
10633 AV.Op._registerDecoder('BitOr', function (json) {
10634 return new AV.Op.BitOr(json.value);
10635 });
10636
10637 /**
10638 * @private
10639 * @class
10640 * BitXor is an atomic operation where the given value will be bit and to the
10641 * value than is stored in this field.
10642 */
10643 AV.Op.BitXor = AV.Op._extend(
10644 /** @lends AV.Op.BitXor.prototype */{
10645 _initialize: function _initialize(value) {
10646 this._value = value;
10647 },
10648 value: function value() {
10649 return this._value;
10650 },
10651
10652
10653 /**
10654 * Returns a JSON version of the operation suitable for sending to AV.
10655 * @return {Object}
10656 */
10657 toJSON: function toJSON() {
10658 return { __op: 'BitXor', value: this.value() };
10659 },
10660 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10661 if (!previous) {
10662 return this;
10663 } else if (previous instanceof AV.Op.Unset) {
10664 return new AV.Op.Set(this.value());
10665 } else if (previous instanceof AV.Op.Set) {
10666 return new AV.Op.Set(previous.value() ^ this.value());
10667 } else {
10668 throw new Error('Op is invalid after previous op.');
10669 }
10670 },
10671 _estimate: function _estimate(oldValue) {
10672 return oldValue ^ this.value();
10673 }
10674 });
10675
10676 AV.Op._registerDecoder('BitXor', function (json) {
10677 return new AV.Op.BitXor(json.value);
10678 });
10679
10680 /**
10681 * @private
10682 * @class
10683 * Add is an atomic operation where the given objects will be appended to the
10684 * array that is stored in this field.
10685 */
10686 AV.Op.Add = AV.Op._extend(
10687 /** @lends AV.Op.Add.prototype */{
10688 _initialize: function _initialize(objects) {
10689 this._objects = objects;
10690 },
10691
10692 /**
10693 * Returns the objects to be added to the array.
10694 * @return {Array} The objects to be added to the array.
10695 */
10696 objects: function objects() {
10697 return this._objects;
10698 },
10699
10700 /**
10701 * Returns a JSON version of the operation suitable for sending to AV.
10702 * @return {Object}
10703 */
10704 toJSON: function toJSON() {
10705 return { __op: 'Add', objects: AV._encode(this.objects()) };
10706 },
10707
10708 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10709 if (!previous) {
10710 return this;
10711 } else if (previous instanceof AV.Op.Unset) {
10712 return new AV.Op.Set(this.objects());
10713 } else if (previous instanceof AV.Op.Set) {
10714 return new AV.Op.Set(this._estimate(previous.value()));
10715 } else if (previous instanceof AV.Op.Add) {
10716 return new AV.Op.Add(previous.objects().concat(this.objects()));
10717 } else {
10718 throw new Error('Op is invalid after previous op.');
10719 }
10720 },
10721
10722 _estimate: function _estimate(oldValue) {
10723 if (!oldValue) {
10724 return _.clone(this.objects());
10725 } else {
10726 return oldValue.concat(this.objects());
10727 }
10728 }
10729 });
10730
10731 AV.Op._registerDecoder('Add', function (json) {
10732 return new AV.Op.Add(AV._decode(json.objects));
10733 });
10734
10735 /**
10736 * @private
10737 * @class
10738 * AddUnique is an atomic operation where the given items will be appended to
10739 * the array that is stored in this field only if they were not already
10740 * present in the array.
10741 */
10742 AV.Op.AddUnique = AV.Op._extend(
10743 /** @lends AV.Op.AddUnique.prototype */{
10744 _initialize: function _initialize(objects) {
10745 this._objects = _.uniq(objects);
10746 },
10747
10748 /**
10749 * Returns the objects to be added to the array.
10750 * @return {Array} The objects to be added to the array.
10751 */
10752 objects: function objects() {
10753 return this._objects;
10754 },
10755
10756 /**
10757 * Returns a JSON version of the operation suitable for sending to AV.
10758 * @return {Object}
10759 */
10760 toJSON: function toJSON() {
10761 return { __op: 'AddUnique', objects: AV._encode(this.objects()) };
10762 },
10763
10764 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10765 if (!previous) {
10766 return this;
10767 } else if (previous instanceof AV.Op.Unset) {
10768 return new AV.Op.Set(this.objects());
10769 } else if (previous instanceof AV.Op.Set) {
10770 return new AV.Op.Set(this._estimate(previous.value()));
10771 } else if (previous instanceof AV.Op.AddUnique) {
10772 return new AV.Op.AddUnique(this._estimate(previous.objects()));
10773 } else {
10774 throw new Error('Op is invalid after previous op.');
10775 }
10776 },
10777
10778 _estimate: function _estimate(oldValue) {
10779 if (!oldValue) {
10780 return _.clone(this.objects());
10781 } else {
10782 // We can't just take the _.uniq(_.union(...)) of oldValue and
10783 // this.objects, because the uniqueness may not apply to oldValue
10784 // (especially if the oldValue was set via .set())
10785 var newValue = _.clone(oldValue);
10786 AV._arrayEach(this.objects(), function (obj) {
10787 if (obj instanceof AV.Object && obj.id) {
10788 var matchingObj = _.find(newValue, function (anObj) {
10789 return anObj instanceof AV.Object && anObj.id === obj.id;
10790 });
10791 if (!matchingObj) {
10792 newValue.push(obj);
10793 } else {
10794 var index = _.indexOf(newValue, matchingObj);
10795 newValue[index] = obj;
10796 }
10797 } else if (!_.contains(newValue, obj)) {
10798 newValue.push(obj);
10799 }
10800 });
10801 return newValue;
10802 }
10803 }
10804 });
10805
10806 AV.Op._registerDecoder('AddUnique', function (json) {
10807 return new AV.Op.AddUnique(AV._decode(json.objects));
10808 });
10809
10810 /**
10811 * @private
10812 * @class
10813 * Remove is an atomic operation where the given objects will be removed from
10814 * the array that is stored in this field.
10815 */
10816 AV.Op.Remove = AV.Op._extend(
10817 /** @lends AV.Op.Remove.prototype */{
10818 _initialize: function _initialize(objects) {
10819 this._objects = _.uniq(objects);
10820 },
10821
10822 /**
10823 * Returns the objects to be removed from the array.
10824 * @return {Array} The objects to be removed from the array.
10825 */
10826 objects: function objects() {
10827 return this._objects;
10828 },
10829
10830 /**
10831 * Returns a JSON version of the operation suitable for sending to AV.
10832 * @return {Object}
10833 */
10834 toJSON: function toJSON() {
10835 return { __op: 'Remove', objects: AV._encode(this.objects()) };
10836 },
10837
10838 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10839 if (!previous) {
10840 return this;
10841 } else if (previous instanceof AV.Op.Unset) {
10842 return previous;
10843 } else if (previous instanceof AV.Op.Set) {
10844 return new AV.Op.Set(this._estimate(previous.value()));
10845 } else if (previous instanceof AV.Op.Remove) {
10846 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
10847 } else {
10848 throw new Error('Op is invalid after previous op.');
10849 }
10850 },
10851
10852 _estimate: function _estimate(oldValue) {
10853 if (!oldValue) {
10854 return [];
10855 } else {
10856 var newValue = _.difference(oldValue, this.objects());
10857 // If there are saved AV Objects being removed, also remove them.
10858 AV._arrayEach(this.objects(), function (obj) {
10859 if (obj instanceof AV.Object && obj.id) {
10860 newValue = _.reject(newValue, function (other) {
10861 return other instanceof AV.Object && other.id === obj.id;
10862 });
10863 }
10864 });
10865 return newValue;
10866 }
10867 }
10868 });
10869
10870 AV.Op._registerDecoder('Remove', function (json) {
10871 return new AV.Op.Remove(AV._decode(json.objects));
10872 });
10873
10874 /**
10875 * @private
10876 * @class
10877 * A Relation operation indicates that the field is an instance of
10878 * AV.Relation, and objects are being added to, or removed from, that
10879 * relation.
10880 */
10881 AV.Op.Relation = AV.Op._extend(
10882 /** @lends AV.Op.Relation.prototype */{
10883 _initialize: function _initialize(adds, removes) {
10884 this._targetClassName = null;
10885
10886 var self = this;
10887
10888 var pointerToId = function pointerToId(object) {
10889 if (object instanceof AV.Object) {
10890 if (!object.id) {
10891 throw new Error("You can't add an unsaved AV.Object to a relation.");
10892 }
10893 if (!self._targetClassName) {
10894 self._targetClassName = object.className;
10895 }
10896 if (self._targetClassName !== object.className) {
10897 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
10898 }
10899 return object.id;
10900 }
10901 return object;
10902 };
10903
10904 this.relationsToAdd = _.uniq(_.map(adds, pointerToId));
10905 this.relationsToRemove = _.uniq(_.map(removes, pointerToId));
10906 },
10907
10908 /**
10909 * Returns an array of unfetched AV.Object that are being added to the
10910 * relation.
10911 * @return {Array}
10912 */
10913 added: function added() {
10914 var self = this;
10915 return _.map(this.relationsToAdd, function (objectId) {
10916 var object = AV.Object._create(self._targetClassName);
10917 object.id = objectId;
10918 return object;
10919 });
10920 },
10921
10922 /**
10923 * Returns an array of unfetched AV.Object that are being removed from
10924 * the relation.
10925 * @return {Array}
10926 */
10927 removed: function removed() {
10928 var self = this;
10929 return _.map(this.relationsToRemove, function (objectId) {
10930 var object = AV.Object._create(self._targetClassName);
10931 object.id = objectId;
10932 return object;
10933 });
10934 },
10935
10936 /**
10937 * Returns a JSON version of the operation suitable for sending to AV.
10938 * @return {Object}
10939 */
10940 toJSON: function toJSON() {
10941 var adds = null;
10942 var removes = null;
10943 var self = this;
10944 var idToPointer = function idToPointer(id) {
10945 return {
10946 __type: 'Pointer',
10947 className: self._targetClassName,
10948 objectId: id
10949 };
10950 };
10951 var pointers = null;
10952 if (this.relationsToAdd.length > 0) {
10953 pointers = _.map(this.relationsToAdd, idToPointer);
10954 adds = { __op: 'AddRelation', objects: pointers };
10955 }
10956
10957 if (this.relationsToRemove.length > 0) {
10958 pointers = _.map(this.relationsToRemove, idToPointer);
10959 removes = { __op: 'RemoveRelation', objects: pointers };
10960 }
10961
10962 if (adds && removes) {
10963 return { __op: 'Batch', ops: [adds, removes] };
10964 }
10965
10966 return adds || removes || {};
10967 },
10968
10969 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10970 if (!previous) {
10971 return this;
10972 } else if (previous instanceof AV.Op.Unset) {
10973 throw new Error("You can't modify a relation after deleting it.");
10974 } else if (previous instanceof AV.Op.Relation) {
10975 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
10976 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
10977 }
10978 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
10979 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
10980
10981 var newRelation = new AV.Op.Relation(newAdd, newRemove);
10982 newRelation._targetClassName = this._targetClassName;
10983 return newRelation;
10984 } else {
10985 throw new Error('Op is invalid after previous op.');
10986 }
10987 },
10988
10989 _estimate: function _estimate(oldValue, object, key) {
10990 if (!oldValue) {
10991 var relation = new AV.Relation(object, key);
10992 relation.targetClassName = this._targetClassName;
10993 } else if (oldValue instanceof AV.Relation) {
10994 if (this._targetClassName) {
10995 if (oldValue.targetClassName) {
10996 if (oldValue.targetClassName !== this._targetClassName) {
10997 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
10998 }
10999 } else {
11000 oldValue.targetClassName = this._targetClassName;
11001 }
11002 }
11003 return oldValue;
11004 } else {
11005 throw new Error('Op is invalid after previous op.');
11006 }
11007 }
11008 });
11009
11010 AV.Op._registerDecoder('AddRelation', function (json) {
11011 return new AV.Op.Relation(AV._decode(json.objects), []);
11012 });
11013 AV.Op._registerDecoder('RemoveRelation', function (json) {
11014 return new AV.Op.Relation([], AV._decode(json.objects));
11015 });
11016};
11017
11018/***/ }),
11019/* 293 */
11020/***/ (function(module, exports, __webpack_require__) {
11021
11022"use strict";
11023
11024
11025var _ = __webpack_require__(0);
11026
11027module.exports = function (AV) {
11028 /**
11029 * Creates a new Relation for the given parent object and key. This
11030 * constructor should rarely be used directly, but rather created by
11031 * {@link AV.Object#relation}.
11032 * @param {AV.Object} parent The parent of this relation.
11033 * @param {String} key The key for this relation on the parent.
11034 * @see AV.Object#relation
11035 * @class
11036 *
11037 * <p>
11038 * A class that is used to access all of the children of a many-to-many
11039 * relationship. Each instance of AV.Relation is associated with a
11040 * particular parent object and key.
11041 * </p>
11042 */
11043 AV.Relation = function (parent, key) {
11044 if (!_.isString(key)) {
11045 throw new TypeError('key must be a string');
11046 }
11047 this.parent = parent;
11048 this.key = key;
11049 this.targetClassName = null;
11050 };
11051
11052 /**
11053 * Creates a query that can be used to query the parent objects in this relation.
11054 * @param {String} parentClass The parent class or name.
11055 * @param {String} relationKey The relation field key in parent.
11056 * @param {AV.Object} child The child object.
11057 * @return {AV.Query}
11058 */
11059 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
11060 var query = new AV.Query(parentClass);
11061 query.equalTo(relationKey, child._toPointer());
11062 return query;
11063 };
11064
11065 _.extend(AV.Relation.prototype,
11066 /** @lends AV.Relation.prototype */{
11067 /**
11068 * Makes sure that this relation has the right parent and key.
11069 * @private
11070 */
11071 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
11072 this.parent = this.parent || parent;
11073 this.key = this.key || key;
11074 if (this.parent !== parent) {
11075 throw new Error('Internal Error. Relation retrieved from two different Objects.');
11076 }
11077 if (this.key !== key) {
11078 throw new Error('Internal Error. Relation retrieved from two different keys.');
11079 }
11080 },
11081
11082 /**
11083 * Adds a AV.Object or an array of AV.Objects to the relation.
11084 * @param {AV.Object|AV.Object[]} objects The item or items to add.
11085 */
11086 add: function add(objects) {
11087 if (!_.isArray(objects)) {
11088 objects = [objects];
11089 }
11090
11091 var change = new AV.Op.Relation(objects, []);
11092 this.parent.set(this.key, change);
11093 this.targetClassName = change._targetClassName;
11094 },
11095
11096 /**
11097 * Removes a AV.Object or an array of AV.Objects from this relation.
11098 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
11099 */
11100 remove: function remove(objects) {
11101 if (!_.isArray(objects)) {
11102 objects = [objects];
11103 }
11104
11105 var change = new AV.Op.Relation([], objects);
11106 this.parent.set(this.key, change);
11107 this.targetClassName = change._targetClassName;
11108 },
11109
11110 /**
11111 * Returns a JSON version of the object suitable for saving to disk.
11112 * @return {Object}
11113 */
11114 toJSON: function toJSON() {
11115 return { __type: 'Relation', className: this.targetClassName };
11116 },
11117
11118 /**
11119 * Returns a AV.Query that is limited to objects in this
11120 * relation.
11121 * @return {AV.Query}
11122 */
11123 query: function query() {
11124 var targetClass;
11125 var query;
11126 if (!this.targetClassName) {
11127 targetClass = AV.Object._getSubclass(this.parent.className);
11128 query = new AV.Query(targetClass);
11129 query._defaultParams.redirectClassNameForKey = this.key;
11130 } else {
11131 targetClass = AV.Object._getSubclass(this.targetClassName);
11132 query = new AV.Query(targetClass);
11133 }
11134 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
11135 query._addCondition('$relatedTo', 'key', this.key);
11136
11137 return query;
11138 }
11139 });
11140};
11141
11142/***/ }),
11143/* 294 */
11144/***/ (function(module, exports, __webpack_require__) {
11145
11146"use strict";
11147
11148
11149var _promise = __webpack_require__(3);
11150
11151var _promise2 = _interopRequireDefault(_promise);
11152
11153function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11154
11155var _ = __webpack_require__(0);
11156var cos = __webpack_require__(295);
11157var qiniu = __webpack_require__(296);
11158var s3 = __webpack_require__(311);
11159var AVError = __webpack_require__(29);
11160var AVRequest = __webpack_require__(12)._request;
11161
11162var _require = __webpack_require__(15),
11163 tap = _require.tap,
11164 transformFetchOptions = _require.transformFetchOptions;
11165
11166var debug = __webpack_require__(37)('leancloud:file');
11167var parseBase64 = __webpack_require__(315);
11168
11169module.exports = function (AV) {
11170 // port from browserify path module
11171 // since react-native packager won't shim node modules.
11172 var extname = function extname(path) {
11173 if (!_.isString(path)) return '';
11174 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
11175 };
11176
11177 var b64Digit = function b64Digit(number) {
11178 if (number < 26) {
11179 return String.fromCharCode(65 + number);
11180 }
11181 if (number < 52) {
11182 return String.fromCharCode(97 + (number - 26));
11183 }
11184 if (number < 62) {
11185 return String.fromCharCode(48 + (number - 52));
11186 }
11187 if (number === 62) {
11188 return '+';
11189 }
11190 if (number === 63) {
11191 return '/';
11192 }
11193 throw new Error('Tried to encode large digit ' + number + ' in base64.');
11194 };
11195
11196 var encodeBase64 = function encodeBase64(array) {
11197 var chunks = [];
11198 chunks.length = Math.ceil(array.length / 3);
11199 _.times(chunks.length, function (i) {
11200 var b1 = array[i * 3];
11201 var b2 = array[i * 3 + 1] || 0;
11202 var b3 = array[i * 3 + 2] || 0;
11203
11204 var has2 = i * 3 + 1 < array.length;
11205 var has3 = i * 3 + 2 < array.length;
11206
11207 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('');
11208 });
11209 return chunks.join('');
11210 };
11211
11212 /**
11213 * An AV.File is a local representation of a file that is saved to the AV
11214 * cloud.
11215 * @param name {String} The file's name. This will change to a unique value
11216 * once the file has finished saving.
11217 * @param data {Array} The data for the file, as either:
11218 * 1. an Array of byte value Numbers, or
11219 * 2. an Object like { base64: "..." } with a base64-encoded String.
11220 * 3. a Blob(File) selected with a file upload control in a browser.
11221 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
11222 * in some non-browser environments such as React Native.
11223 * 5. a Buffer in Node.js runtime.
11224 * 6. a Stream in Node.js runtime.
11225 *
11226 * For example:<pre>
11227 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
11228 * if (fileUploadControl.files.length > 0) {
11229 * var file = fileUploadControl.files[0];
11230 * var name = "photo.jpg";
11231 * var file = new AV.File(name, file);
11232 * file.save().then(function() {
11233 * // The file has been saved to AV.
11234 * }, function(error) {
11235 * // The file either could not be read, or could not be saved to AV.
11236 * });
11237 * }</pre>
11238 *
11239 * @class
11240 * @param [mimeType] {String} Content-Type header to use for the file. If
11241 * this is omitted, the content type will be inferred from the name's
11242 * extension.
11243 */
11244 AV.File = function (name, data, mimeType) {
11245 this.attributes = {
11246 name: name,
11247 url: '',
11248 metaData: {},
11249 // 用来存储转换后要上传的 base64 String
11250 base64: ''
11251 };
11252
11253 if (_.isString(data)) {
11254 throw new TypeError('Creating an AV.File from a String is not yet supported.');
11255 }
11256 if (_.isArray(data)) {
11257 this.attributes.metaData.size = data.length;
11258 data = { base64: encodeBase64(data) };
11259 }
11260
11261 this._extName = '';
11262 this._data = data;
11263 this._uploadHeaders = {};
11264
11265 if (data && data.blob && typeof data.blob.uri === 'string') {
11266 this._extName = extname(data.blob.uri);
11267 }
11268
11269 if (typeof Blob !== 'undefined' && data instanceof Blob) {
11270 if (data.size) {
11271 this.attributes.metaData.size = data.size;
11272 }
11273 if (data.name) {
11274 this._extName = extname(data.name);
11275 }
11276 }
11277
11278 var owner = void 0;
11279 if (data && data.owner) {
11280 owner = data.owner;
11281 } else if (!AV._config.disableCurrentUser) {
11282 try {
11283 owner = AV.User.current();
11284 } catch (error) {
11285 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
11286 throw error;
11287 }
11288 }
11289 }
11290
11291 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
11292
11293 this.set('mime_type', mimeType);
11294 };
11295
11296 /**
11297 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
11298 * @param {String} name the file name
11299 * @param {String} url the file url.
11300 * @param {Object} [metaData] the file metadata object.
11301 * @param {String} [type] Content-Type header to use for the file. If
11302 * this is omitted, the content type will be inferred from the name's
11303 * extension.
11304 * @return {AV.File} the file object
11305 */
11306 AV.File.withURL = function (name, url, metaData, type) {
11307 if (!name || !url) {
11308 throw new Error('Please provide file name and url');
11309 }
11310 var file = new AV.File(name, null, type);
11311 //copy metaData properties to file.
11312 if (metaData) {
11313 for (var prop in metaData) {
11314 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
11315 }
11316 }
11317 file.attributes.url = url;
11318 //Mark the file is from external source.
11319 file.attributes.metaData.__source = 'external';
11320 file.attributes.metaData.size = 0;
11321 return file;
11322 };
11323
11324 /**
11325 * Creates a file object with exists objectId.
11326 * @param {String} objectId The objectId string
11327 * @return {AV.File} the file object
11328 */
11329 AV.File.createWithoutData = function (objectId) {
11330 if (!objectId) {
11331 throw new TypeError('The objectId must be provided');
11332 }
11333 var file = new AV.File();
11334 file.id = objectId;
11335 return file;
11336 };
11337
11338 _.extend(AV.File.prototype,
11339 /** @lends AV.File.prototype */{
11340 className: '_File',
11341
11342 _toFullJSON: function _toFullJSON(seenObjects) {
11343 var _this = this;
11344
11345 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
11346
11347 var json = _.clone(this.attributes);
11348 AV._objectEach(json, function (val, key) {
11349 json[key] = AV._encode(val, seenObjects, undefined, full);
11350 });
11351 AV._objectEach(this._operations, function (val, key) {
11352 json[key] = val;
11353 });
11354
11355 if (_.has(this, 'id')) {
11356 json.objectId = this.id;
11357 }
11358 ['createdAt', 'updatedAt'].forEach(function (key) {
11359 if (_.has(_this, key)) {
11360 var val = _this[key];
11361 json[key] = _.isDate(val) ? val.toJSON() : val;
11362 }
11363 });
11364 if (full) {
11365 json.__type = 'File';
11366 }
11367 return json;
11368 },
11369
11370
11371 /**
11372 * Returns a JSON version of the file with meta data.
11373 * Inverse to {@link AV.parseJSON}
11374 * @since 3.0.0
11375 * @return {Object}
11376 */
11377 toFullJSON: function toFullJSON() {
11378 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11379
11380 return this._toFullJSON(seenObjects);
11381 },
11382
11383
11384 /**
11385 * Returns a JSON version of the object.
11386 * @return {Object}
11387 */
11388 toJSON: function toJSON(key, holder) {
11389 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
11390
11391 return this._toFullJSON(seenObjects, false);
11392 },
11393
11394
11395 /**
11396 * Gets a Pointer referencing this file.
11397 * @private
11398 */
11399 _toPointer: function _toPointer() {
11400 return {
11401 __type: 'Pointer',
11402 className: this.className,
11403 objectId: this.id
11404 };
11405 },
11406
11407
11408 /**
11409 * Returns the ACL for this file.
11410 * @returns {AV.ACL} An instance of AV.ACL.
11411 */
11412 getACL: function getACL() {
11413 return this._acl;
11414 },
11415
11416
11417 /**
11418 * Sets the ACL to be used for this file.
11419 * @param {AV.ACL} acl An instance of AV.ACL.
11420 */
11421 setACL: function setACL(acl) {
11422 if (!(acl instanceof AV.ACL)) {
11423 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
11424 }
11425 this._acl = acl;
11426 return this;
11427 },
11428
11429
11430 /**
11431 * Gets the name of the file. Before save is called, this is the filename
11432 * given by the user. After save is called, that name gets prefixed with a
11433 * unique identifier.
11434 */
11435 name: function name() {
11436 return this.get('name');
11437 },
11438
11439
11440 /**
11441 * Gets the url of the file. It is only available after you save the file or
11442 * after you get the file from a AV.Object.
11443 * @return {String}
11444 */
11445 url: function url() {
11446 return this.get('url');
11447 },
11448
11449
11450 /**
11451 * Gets the attributs of the file object.
11452 * @param {String} The attribute name which want to get.
11453 * @returns {Any}
11454 */
11455 get: function get(attrName) {
11456 switch (attrName) {
11457 case 'objectId':
11458 return this.id;
11459 case 'url':
11460 case 'name':
11461 case 'mime_type':
11462 case 'metaData':
11463 case 'createdAt':
11464 case 'updatedAt':
11465 return this.attributes[attrName];
11466 default:
11467 return this.attributes.metaData[attrName];
11468 }
11469 },
11470
11471
11472 /**
11473 * Set the metaData of the file object.
11474 * @param {Object} Object is an key value Object for setting metaData.
11475 * @param {String} attr is an optional metadata key.
11476 * @param {Object} value is an optional metadata value.
11477 * @returns {String|Number|Array|Object}
11478 */
11479 set: function set() {
11480 var _this2 = this;
11481
11482 var set = function set(attrName, value) {
11483 switch (attrName) {
11484 case 'name':
11485 case 'url':
11486 case 'mime_type':
11487 case 'base64':
11488 case 'metaData':
11489 _this2.attributes[attrName] = value;
11490 break;
11491 default:
11492 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
11493 _this2.attributes.metaData[attrName] = value;
11494 break;
11495 }
11496 };
11497
11498 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
11499 args[_key] = arguments[_key];
11500 }
11501
11502 switch (args.length) {
11503 case 1:
11504 // 传入一个 Object
11505 for (var k in args[0]) {
11506 set(k, args[0][k]);
11507 }
11508 break;
11509 case 2:
11510 set(args[0], args[1]);
11511 break;
11512 }
11513 return this;
11514 },
11515
11516
11517 /**
11518 * Set a header for the upload request.
11519 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
11520 *
11521 * @param {String} key header key
11522 * @param {String} value header value
11523 * @return {AV.File} this
11524 */
11525 setUploadHeader: function setUploadHeader(key, value) {
11526 this._uploadHeaders[key] = value;
11527 return this;
11528 },
11529
11530
11531 /**
11532 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
11533 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
11534 * <p><pre>
11535 * var metadata = file.metaData(); //Get metadata JSON object.
11536 * var size = file.metaData('size'); // Get the size metadata value.
11537 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
11538 *</pre></p>
11539 * @return {Object} The file's metadata JSON object.
11540 * @param {String} attr an optional metadata key.
11541 * @param {Object} value an optional metadata value.
11542 **/
11543 metaData: function metaData(attr, value) {
11544 if (attr && value) {
11545 this.attributes.metaData[attr] = value;
11546 return this;
11547 } else if (attr && !value) {
11548 return this.attributes.metaData[attr];
11549 } else {
11550 return this.attributes.metaData;
11551 }
11552 },
11553
11554
11555 /**
11556 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
11557 * @return {String} 缩略图URL
11558 * @param {Number} width 宽度,单位:像素
11559 * @param {Number} heigth 高度,单位:像素
11560 * @param {Number} quality 质量,1-100的数字,默认100
11561 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
11562 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
11563 */
11564
11565 thumbnailURL: function thumbnailURL(width, height) {
11566 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
11567 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
11568 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
11569
11570 var url = this.attributes.url;
11571 if (!url) {
11572 throw new Error('Invalid url.');
11573 }
11574 if (!width || !height || width <= 0 || height <= 0) {
11575 throw new Error('Invalid width or height value.');
11576 }
11577 if (quality <= 0 || quality > 100) {
11578 throw new Error('Invalid quality value.');
11579 }
11580 var mode = scaleToFit ? 2 : 1;
11581 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
11582 },
11583
11584
11585 /**
11586 * Returns the file's size.
11587 * @return {Number} The file's size in bytes.
11588 **/
11589 size: function size() {
11590 return this.metaData().size;
11591 },
11592
11593
11594 /**
11595 * Returns the file's owner.
11596 * @return {String} The file's owner id.
11597 */
11598 ownerId: function ownerId() {
11599 return this.metaData().owner;
11600 },
11601
11602
11603 /**
11604 * Destroy the file.
11605 * @param {AuthOptions} options
11606 * @return {Promise} A promise that is fulfilled when the destroy
11607 * completes.
11608 */
11609 destroy: function destroy(options) {
11610 if (!this.id) {
11611 return _promise2.default.reject(new Error('The file id does not eixst.'));
11612 }
11613 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
11614 return request;
11615 },
11616
11617
11618 /**
11619 * Request Qiniu upload token
11620 * @param {string} type
11621 * @return {Promise} Resolved with the response
11622 * @private
11623 */
11624 _fileToken: function _fileToken(type, authOptions) {
11625 var name = this.attributes.name;
11626
11627 var extName = extname(name);
11628 if (!extName && this._extName) {
11629 name += this._extName;
11630 extName = this._extName;
11631 }
11632 var data = {
11633 name: name,
11634 keep_file_name: authOptions.keepFileName,
11635 key: authOptions.key,
11636 ACL: this._acl,
11637 mime_type: type,
11638 metaData: this.attributes.metaData
11639 };
11640 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
11641 },
11642
11643
11644 /**
11645 * @callback UploadProgressCallback
11646 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
11647 */
11648 /**
11649 * Saves the file to the AV cloud.
11650 * @param {AuthOptions} [options] AuthOptions plus:
11651 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
11652 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
11653 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
11654 * @return {Promise} Promise that is resolved when the save finishes.
11655 */
11656 save: function save() {
11657 var _this3 = this;
11658
11659 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11660
11661 if (this.id) {
11662 throw new Error('File is already saved.');
11663 }
11664 if (!this._previousSave) {
11665 if (this._data) {
11666 var mimeType = this.get('mime_type');
11667 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
11668 if (uploadInfo.mime_type) {
11669 mimeType = uploadInfo.mime_type;
11670 _this3.set('mime_type', mimeType);
11671 }
11672 _this3._token = uploadInfo.token;
11673 return _promise2.default.resolve().then(function () {
11674 var data = _this3._data;
11675 if (data && data.base64) {
11676 return parseBase64(data.base64, mimeType);
11677 }
11678 if (data && data.blob) {
11679 if (!data.blob.type && mimeType) {
11680 data.blob.type = mimeType;
11681 }
11682 if (!data.blob.name) {
11683 data.blob.name = _this3.get('name');
11684 }
11685 return data.blob;
11686 }
11687 if (typeof Blob !== 'undefined' && data instanceof Blob) {
11688 return data;
11689 }
11690 throw new TypeError('malformed file data');
11691 }).then(function (data) {
11692 var _options = _.extend({}, options);
11693 // filter out download progress events
11694 if (options.onprogress) {
11695 _options.onprogress = function (event) {
11696 if (event.direction === 'download') return;
11697 return options.onprogress(event);
11698 };
11699 }
11700 switch (uploadInfo.provider) {
11701 case 's3':
11702 return s3(uploadInfo, data, _this3, _options);
11703 case 'qcloud':
11704 return cos(uploadInfo, data, _this3, _options);
11705 case 'qiniu':
11706 default:
11707 return qiniu(uploadInfo, data, _this3, _options);
11708 }
11709 }).then(tap(function () {
11710 return _this3._callback(true);
11711 }), function (error) {
11712 _this3._callback(false);
11713 throw error;
11714 });
11715 });
11716 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
11717 // external link file.
11718 var data = {
11719 name: this.attributes.name,
11720 ACL: this._acl,
11721 metaData: this.attributes.metaData,
11722 mime_type: this.mimeType,
11723 url: this.attributes.url
11724 };
11725 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
11726 _this3.id = response.objectId;
11727 return _this3;
11728 });
11729 }
11730 }
11731 return this._previousSave;
11732 },
11733 _callback: function _callback(success) {
11734 AVRequest('fileCallback', null, null, 'post', {
11735 token: this._token,
11736 result: success
11737 }).catch(debug);
11738 delete this._token;
11739 delete this._data;
11740 },
11741
11742
11743 /**
11744 * fetch the file from server. If the server's representation of the
11745 * model differs from its current attributes, they will be overriden,
11746 * @param {Object} fetchOptions Optional options to set 'keys',
11747 * 'include' and 'includeACL' option.
11748 * @param {AuthOptions} options
11749 * @return {Promise} A promise that is fulfilled when the fetch
11750 * completes.
11751 */
11752 fetch: function fetch(fetchOptions, options) {
11753 if (!this.id) {
11754 throw new Error('Cannot fetch unsaved file');
11755 }
11756 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
11757 return request.then(this._finishFetch.bind(this));
11758 },
11759 _finishFetch: function _finishFetch(response) {
11760 var value = AV.Object.prototype.parse(response);
11761 value.attributes = {
11762 name: value.name,
11763 url: value.url,
11764 mime_type: value.mime_type,
11765 bucket: value.bucket
11766 };
11767 value.attributes.metaData = value.metaData || {};
11768 value.id = value.objectId;
11769 // clean
11770 delete value.objectId;
11771 delete value.metaData;
11772 delete value.url;
11773 delete value.name;
11774 delete value.mime_type;
11775 delete value.bucket;
11776 _.extend(this, value);
11777 return this;
11778 }
11779 });
11780};
11781
11782/***/ }),
11783/* 295 */
11784/***/ (function(module, exports, __webpack_require__) {
11785
11786"use strict";
11787
11788
11789var _require = __webpack_require__(38),
11790 getAdapter = _require.getAdapter;
11791
11792var debug = __webpack_require__(37)('cos');
11793
11794module.exports = function (uploadInfo, data, file) {
11795 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
11796
11797 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
11798 var fileFormData = {
11799 field: 'fileContent',
11800 data: data,
11801 name: file.attributes.name
11802 };
11803 var options = {
11804 headers: file._uploadHeaders,
11805 data: {
11806 op: 'upload'
11807 },
11808 onprogress: saveOptions.onprogress
11809 };
11810 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
11811 var upload = getAdapter('upload');
11812 return upload(url, fileFormData, options).then(function (response) {
11813 debug(response.status, response.data);
11814 if (response.ok === false) {
11815 var error = new Error(response.status);
11816 error.response = response;
11817 throw error;
11818 }
11819 file.attributes.url = uploadInfo.url;
11820 file._bucket = uploadInfo.bucket;
11821 file.id = uploadInfo.objectId;
11822 return file;
11823 }, function (error) {
11824 var response = error.response;
11825
11826 if (response) {
11827 debug(response.status, response.data);
11828 error.statusCode = response.status;
11829 error.response = response.data;
11830 }
11831 throw error;
11832 });
11833};
11834
11835/***/ }),
11836/* 296 */
11837/***/ (function(module, exports, __webpack_require__) {
11838
11839"use strict";
11840
11841
11842var _getPrototypeOf = __webpack_require__(160);
11843
11844var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
11845
11846var _possibleConstructorReturn2 = __webpack_require__(297);
11847
11848var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
11849
11850var _inherits2 = __webpack_require__(298);
11851
11852var _inherits3 = _interopRequireDefault(_inherits2);
11853
11854var _promise = __webpack_require__(3);
11855
11856var _promise2 = _interopRequireDefault(_promise);
11857
11858var _classCallCheck2 = __webpack_require__(306);
11859
11860var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
11861
11862var _createClass2 = __webpack_require__(307);
11863
11864var _createClass3 = _interopRequireDefault(_createClass2);
11865
11866var _getIterator2 = __webpack_require__(167);
11867
11868var _getIterator3 = _interopRequireDefault(_getIterator2);
11869
11870var _stringify = __webpack_require__(19);
11871
11872var _stringify2 = _interopRequireDefault(_stringify);
11873
11874function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11875
11876var _require = __webpack_require__(38),
11877 getAdapter = _require.getAdapter;
11878
11879var debug = __webpack_require__(37)('leancloud:qiniu');
11880var ajax = __webpack_require__(60);
11881var btoa = __webpack_require__(310);
11882
11883var SHARD_THRESHOLD = 1024 * 1024 * 64;
11884
11885var CHUNK_SIZE = 1024 * 1024 * 16;
11886
11887function upload(uploadInfo, data, file) {
11888 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
11889
11890 // Get the uptoken to upload files to qiniu.
11891 var uptoken = uploadInfo.token;
11892 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
11893 var fileFormData = {
11894 field: 'file',
11895 data: data,
11896 name: file.attributes.name
11897 };
11898 var options = {
11899 headers: file._uploadHeaders,
11900 data: {
11901 name: file.attributes.name,
11902 key: uploadInfo.key,
11903 token: uptoken
11904 },
11905 onprogress: saveOptions.onprogress
11906 };
11907 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
11908 var upload = getAdapter('upload');
11909 return upload(url, fileFormData, options).then(function (response) {
11910 debug(response.status, response.data);
11911 if (response.ok === false) {
11912 var message = response.status;
11913 if (response.data) {
11914 if (response.data.error) {
11915 message = response.data.error;
11916 } else {
11917 message = (0, _stringify2.default)(response.data);
11918 }
11919 }
11920 var error = new Error(message);
11921 error.response = response;
11922 throw error;
11923 }
11924 file.attributes.url = uploadInfo.url;
11925 file._bucket = uploadInfo.bucket;
11926 file.id = uploadInfo.objectId;
11927 return file;
11928 }, function (error) {
11929 var response = error.response;
11930
11931 if (response) {
11932 debug(response.status, response.data);
11933 error.statusCode = response.status;
11934 error.response = response.data;
11935 }
11936 throw error;
11937 });
11938}
11939
11940function urlSafeBase64(string) {
11941 var base64 = btoa(unescape(encodeURIComponent(string)));
11942 var result = '';
11943 var _iteratorNormalCompletion = true;
11944 var _didIteratorError = false;
11945 var _iteratorError = undefined;
11946
11947 try {
11948 for (var _iterator = (0, _getIterator3.default)(base64), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
11949 var ch = _step.value;
11950
11951 switch (ch) {
11952 case '+':
11953 result += '-';
11954 break;
11955 case '/':
11956 result += '_';
11957 break;
11958 default:
11959 result += ch;
11960 }
11961 }
11962 } catch (err) {
11963 _didIteratorError = true;
11964 _iteratorError = err;
11965 } finally {
11966 try {
11967 if (!_iteratorNormalCompletion && _iterator.return) {
11968 _iterator.return();
11969 }
11970 } finally {
11971 if (_didIteratorError) {
11972 throw _iteratorError;
11973 }
11974 }
11975 }
11976
11977 return result;
11978}
11979
11980var ShardUploader = function () {
11981 function ShardUploader(uploadInfo, data, file, saveOptions) {
11982 var _this = this;
11983
11984 (0, _classCallCheck3.default)(this, ShardUploader);
11985
11986 this.uploadInfo = uploadInfo;
11987 this.data = data;
11988 this.file = file;
11989 this.size = undefined;
11990 this.offset = 0;
11991 this.uploadedChunks = 0;
11992
11993 var key = urlSafeBase64(uploadInfo.key);
11994 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
11995 this.baseURL = uploadURL + '/buckets/' + uploadInfo.bucket + '/objects/' + key + '/uploads';
11996 this.upToken = 'UpToken ' + uploadInfo.token;
11997
11998 this.uploaded = 0;
11999 if (saveOptions && saveOptions.onprogress) {
12000 this.onProgress = function (_ref) {
12001 var loaded = _ref.loaded;
12002
12003 loaded += _this.uploadedChunks * CHUNK_SIZE;
12004 if (loaded <= _this.uploaded) {
12005 return;
12006 }
12007 if (_this.size) {
12008 saveOptions.onprogress({
12009 loaded: loaded,
12010 total: _this.size,
12011 percent: loaded / _this.size * 100
12012 });
12013 } else {
12014 saveOptions.onprogress({ loaded: loaded });
12015 }
12016 _this.uploaded = loaded;
12017 };
12018 }
12019 }
12020
12021 /**
12022 * @returns {Promise<string>}
12023 */
12024
12025
12026 (0, _createClass3.default)(ShardUploader, [{
12027 key: 'getUploadId',
12028 value: function getUploadId() {
12029 return ajax({
12030 method: 'POST',
12031 url: this.baseURL,
12032 headers: {
12033 Authorization: this.upToken
12034 }
12035 }).then(function (res) {
12036 return res.uploadId;
12037 });
12038 }
12039 }, {
12040 key: 'getChunk',
12041 value: function getChunk() {
12042 throw new Error('Not implemented');
12043 }
12044
12045 /**
12046 * @param {string} uploadId
12047 * @param {number} partNumber
12048 * @param {any} data
12049 * @returns {Promise<{ partNumber: number, etag: string }>}
12050 */
12051
12052 }, {
12053 key: 'uploadPart',
12054 value: function uploadPart(uploadId, partNumber, data) {
12055 return ajax({
12056 method: 'PUT',
12057 url: this.baseURL + '/' + uploadId + '/' + partNumber,
12058 headers: {
12059 Authorization: this.upToken
12060 },
12061 data: data,
12062 onprogress: this.onProgress
12063 }).then(function (_ref2) {
12064 var etag = _ref2.etag;
12065 return { partNumber: partNumber, etag: etag };
12066 });
12067 }
12068 }, {
12069 key: 'stopUpload',
12070 value: function stopUpload(uploadId) {
12071 return ajax({
12072 method: 'DELETE',
12073 url: this.baseURL + '/' + uploadId,
12074 headers: {
12075 Authorization: this.upToken
12076 }
12077 });
12078 }
12079 }, {
12080 key: 'upload',
12081 value: function upload() {
12082 var _this2 = this;
12083
12084 var parts = [];
12085 return this.getUploadId().then(function (uploadId) {
12086 var uploadPart = function uploadPart() {
12087 return _promise2.default.resolve(_this2.getChunk()).then(function (chunk) {
12088 if (!chunk) {
12089 return;
12090 }
12091 var partNumber = parts.length + 1;
12092 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
12093 parts.push(part);
12094 _this2.uploadedChunks++;
12095 return uploadPart();
12096 });
12097 }).catch(function (error) {
12098 return _this2.stopUpload(uploadId).then(function () {
12099 return _promise2.default.reject(error);
12100 });
12101 });
12102 };
12103
12104 return uploadPart().then(function () {
12105 return ajax({
12106 method: 'POST',
12107 url: _this2.baseURL + '/' + uploadId,
12108 headers: {
12109 Authorization: _this2.upToken
12110 },
12111 data: {
12112 parts: parts,
12113 fname: _this2.file.attributes.name,
12114 mimeType: _this2.file.attributes.mime_type
12115 }
12116 });
12117 });
12118 }).then(function () {
12119 _this2.file.attributes.url = _this2.uploadInfo.url;
12120 _this2.file._bucket = _this2.uploadInfo.bucket;
12121 _this2.file.id = _this2.uploadInfo.objectId;
12122 return _this2.file;
12123 });
12124 }
12125 }]);
12126 return ShardUploader;
12127}();
12128
12129var BlobUploader = function (_ShardUploader) {
12130 (0, _inherits3.default)(BlobUploader, _ShardUploader);
12131
12132 function BlobUploader(uploadInfo, data, file, saveOptions) {
12133 (0, _classCallCheck3.default)(this, BlobUploader);
12134
12135 var _this3 = (0, _possibleConstructorReturn3.default)(this, (BlobUploader.__proto__ || (0, _getPrototypeOf2.default)(BlobUploader)).call(this, uploadInfo, data, file, saveOptions));
12136
12137 _this3.size = data.size;
12138 return _this3;
12139 }
12140
12141 /**
12142 * @returns {Blob | null}
12143 */
12144
12145
12146 (0, _createClass3.default)(BlobUploader, [{
12147 key: 'getChunk',
12148 value: function getChunk() {
12149 if (this.offset >= this.size) {
12150 return null;
12151 }
12152 var chunk = this.data.slice(this.offset, this.offset + CHUNK_SIZE);
12153 this.offset += chunk.size;
12154 return chunk;
12155 }
12156 }]);
12157 return BlobUploader;
12158}(ShardUploader);
12159
12160function isBlob(data) {
12161 return typeof Blob !== 'undefined' && data instanceof Blob;
12162}
12163
12164module.exports = function (uploadInfo, data, file) {
12165 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12166
12167 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
12168 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
12169 }
12170 return upload(uploadInfo, data, file, saveOptions);
12171};
12172
12173/***/ }),
12174/* 297 */
12175/***/ (function(module, exports, __webpack_require__) {
12176
12177"use strict";
12178
12179
12180exports.__esModule = true;
12181
12182var _typeof2 = __webpack_require__(30);
12183
12184var _typeof3 = _interopRequireDefault(_typeof2);
12185
12186function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12187
12188exports.default = function (self, call) {
12189 if (!self) {
12190 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12191 }
12192
12193 return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
12194};
12195
12196/***/ }),
12197/* 298 */
12198/***/ (function(module, exports, __webpack_require__) {
12199
12200"use strict";
12201
12202
12203exports.__esModule = true;
12204
12205var _setPrototypeOf = __webpack_require__(299);
12206
12207var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
12208
12209var _create = __webpack_require__(303);
12210
12211var _create2 = _interopRequireDefault(_create);
12212
12213var _typeof2 = __webpack_require__(30);
12214
12215var _typeof3 = _interopRequireDefault(_typeof2);
12216
12217function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12218
12219exports.default = function (subClass, superClass) {
12220 if (typeof superClass !== "function" && superClass !== null) {
12221 throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
12222 }
12223
12224 subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
12225 constructor: {
12226 value: subClass,
12227 enumerable: false,
12228 writable: true,
12229 configurable: true
12230 }
12231 });
12232 if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
12233};
12234
12235/***/ }),
12236/* 299 */
12237/***/ (function(module, exports, __webpack_require__) {
12238
12239module.exports = { "default": __webpack_require__(300), __esModule: true };
12240
12241/***/ }),
12242/* 300 */
12243/***/ (function(module, exports, __webpack_require__) {
12244
12245__webpack_require__(301);
12246module.exports = __webpack_require__(2).Object.setPrototypeOf;
12247
12248
12249/***/ }),
12250/* 301 */
12251/***/ (function(module, exports, __webpack_require__) {
12252
12253// 19.1.3.19 Object.setPrototypeOf(O, proto)
12254var $export = __webpack_require__(16);
12255$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(302).set });
12256
12257
12258/***/ }),
12259/* 302 */
12260/***/ (function(module, exports, __webpack_require__) {
12261
12262// Works with __proto__ only. Old v8 can't work with null proto objects.
12263/* eslint-disable no-proto */
12264var isObject = __webpack_require__(20);
12265var anObject = __webpack_require__(17);
12266var check = function (O, proto) {
12267 anObject(O);
12268 if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
12269};
12270module.exports = {
12271 set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
12272 function (test, buggy, set) {
12273 try {
12274 set = __webpack_require__(31)(Function.call, __webpack_require__(94).f(Object.prototype, '__proto__').set, 2);
12275 set(test, []);
12276 buggy = !(test instanceof Array);
12277 } catch (e) { buggy = true; }
12278 return function setPrototypeOf(O, proto) {
12279 check(O, proto);
12280 if (buggy) O.__proto__ = proto;
12281 else set(O, proto);
12282 return O;
12283 };
12284 }({}, false) : undefined),
12285 check: check
12286};
12287
12288
12289/***/ }),
12290/* 303 */
12291/***/ (function(module, exports, __webpack_require__) {
12292
12293module.exports = { "default": __webpack_require__(304), __esModule: true };
12294
12295/***/ }),
12296/* 304 */
12297/***/ (function(module, exports, __webpack_require__) {
12298
12299__webpack_require__(305);
12300var $Object = __webpack_require__(2).Object;
12301module.exports = function create(P, D) {
12302 return $Object.create(P, D);
12303};
12304
12305
12306/***/ }),
12307/* 305 */
12308/***/ (function(module, exports, __webpack_require__) {
12309
12310var $export = __webpack_require__(16);
12311// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
12312$export($export.S, 'Object', { create: __webpack_require__(66) });
12313
12314
12315/***/ }),
12316/* 306 */
12317/***/ (function(module, exports, __webpack_require__) {
12318
12319"use strict";
12320
12321
12322exports.__esModule = true;
12323
12324exports.default = function (instance, Constructor) {
12325 if (!(instance instanceof Constructor)) {
12326 throw new TypeError("Cannot call a class as a function");
12327 }
12328};
12329
12330/***/ }),
12331/* 307 */
12332/***/ (function(module, exports, __webpack_require__) {
12333
12334"use strict";
12335
12336
12337exports.__esModule = true;
12338
12339var _defineProperty = __webpack_require__(90);
12340
12341var _defineProperty2 = _interopRequireDefault(_defineProperty);
12342
12343function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12344
12345exports.default = function () {
12346 function defineProperties(target, props) {
12347 for (var i = 0; i < props.length; i++) {
12348 var descriptor = props[i];
12349 descriptor.enumerable = descriptor.enumerable || false;
12350 descriptor.configurable = true;
12351 if ("value" in descriptor) descriptor.writable = true;
12352 (0, _defineProperty2.default)(target, descriptor.key, descriptor);
12353 }
12354 }
12355
12356 return function (Constructor, protoProps, staticProps) {
12357 if (protoProps) defineProperties(Constructor.prototype, protoProps);
12358 if (staticProps) defineProperties(Constructor, staticProps);
12359 return Constructor;
12360 };
12361}();
12362
12363/***/ }),
12364/* 308 */
12365/***/ (function(module, exports, __webpack_require__) {
12366
12367__webpack_require__(56);
12368__webpack_require__(39);
12369module.exports = __webpack_require__(309);
12370
12371
12372/***/ }),
12373/* 309 */
12374/***/ (function(module, exports, __webpack_require__) {
12375
12376var anObject = __webpack_require__(17);
12377var get = __webpack_require__(72);
12378module.exports = __webpack_require__(2).getIterator = function (it) {
12379 var iterFn = get(it);
12380 if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
12381 return anObject(iterFn.call(it));
12382};
12383
12384
12385/***/ }),
12386/* 310 */
12387/***/ (function(module, exports, __webpack_require__) {
12388
12389"use strict";
12390
12391
12392// base64 character set, plus padding character (=)
12393var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
12394
12395module.exports = function (string) {
12396 var result = '';
12397
12398 for (var i = 0; i < string.length;) {
12399 var a = string.charCodeAt(i++);
12400 var b = string.charCodeAt(i++);
12401 var c = string.charCodeAt(i++);
12402 if (a > 255 || b > 255 || c > 255) {
12403 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
12404 }
12405
12406 var bitmap = a << 16 | b << 8 | c;
12407 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
12408 }
12409
12410 // To determine the final padding
12411 var rest = string.length % 3;
12412 // If there's need of padding, replace the last 'A's with equal signs
12413 return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
12414};
12415
12416/***/ }),
12417/* 311 */
12418/***/ (function(module, exports, __webpack_require__) {
12419
12420"use strict";
12421
12422
12423var _ = __webpack_require__(0);
12424var ajax = __webpack_require__(60);
12425
12426module.exports = function upload(uploadInfo, data, file) {
12427 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12428
12429
12430 return ajax({
12431 url: uploadInfo.upload_url,
12432 method: 'PUT',
12433 data: data,
12434 headers: _.extend({
12435 'Content-Type': file.get('mime_type'),
12436 'Cache-Control': 'public, max-age=31536000'
12437 }, file._uploadHeaders),
12438 onprogress: saveOptions.onprogress
12439 }).then(function () {
12440 file.attributes.url = uploadInfo.url;
12441 file._bucket = uploadInfo.bucket;
12442 file.id = uploadInfo.objectId;
12443 return file;
12444 });
12445};
12446
12447/***/ }),
12448/* 312 */
12449/***/ (function(module, exports, __webpack_require__) {
12450
12451(function(){
12452 var crypt = __webpack_require__(313),
12453 utf8 = __webpack_require__(168).utf8,
12454 isBuffer = __webpack_require__(314),
12455 bin = __webpack_require__(168).bin,
12456
12457 // The core
12458 md5 = function (message, options) {
12459 // Convert to byte array
12460 if (message.constructor == String)
12461 if (options && options.encoding === 'binary')
12462 message = bin.stringToBytes(message);
12463 else
12464 message = utf8.stringToBytes(message);
12465 else if (isBuffer(message))
12466 message = Array.prototype.slice.call(message, 0);
12467 else if (!Array.isArray(message))
12468 message = message.toString();
12469 // else, assume byte array already
12470
12471 var m = crypt.bytesToWords(message),
12472 l = message.length * 8,
12473 a = 1732584193,
12474 b = -271733879,
12475 c = -1732584194,
12476 d = 271733878;
12477
12478 // Swap endian
12479 for (var i = 0; i < m.length; i++) {
12480 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
12481 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
12482 }
12483
12484 // Padding
12485 m[l >>> 5] |= 0x80 << (l % 32);
12486 m[(((l + 64) >>> 9) << 4) + 14] = l;
12487
12488 // Method shortcuts
12489 var FF = md5._ff,
12490 GG = md5._gg,
12491 HH = md5._hh,
12492 II = md5._ii;
12493
12494 for (var i = 0; i < m.length; i += 16) {
12495
12496 var aa = a,
12497 bb = b,
12498 cc = c,
12499 dd = d;
12500
12501 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
12502 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
12503 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
12504 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
12505 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
12506 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
12507 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
12508 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
12509 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
12510 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
12511 c = FF(c, d, a, b, m[i+10], 17, -42063);
12512 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
12513 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
12514 d = FF(d, a, b, c, m[i+13], 12, -40341101);
12515 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
12516 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
12517
12518 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
12519 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
12520 c = GG(c, d, a, b, m[i+11], 14, 643717713);
12521 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
12522 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
12523 d = GG(d, a, b, c, m[i+10], 9, 38016083);
12524 c = GG(c, d, a, b, m[i+15], 14, -660478335);
12525 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
12526 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
12527 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
12528 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
12529 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
12530 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
12531 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
12532 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
12533 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
12534
12535 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
12536 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
12537 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
12538 b = HH(b, c, d, a, m[i+14], 23, -35309556);
12539 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
12540 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
12541 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
12542 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
12543 a = HH(a, b, c, d, m[i+13], 4, 681279174);
12544 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
12545 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
12546 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
12547 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
12548 d = HH(d, a, b, c, m[i+12], 11, -421815835);
12549 c = HH(c, d, a, b, m[i+15], 16, 530742520);
12550 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
12551
12552 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
12553 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
12554 c = II(c, d, a, b, m[i+14], 15, -1416354905);
12555 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
12556 a = II(a, b, c, d, m[i+12], 6, 1700485571);
12557 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
12558 c = II(c, d, a, b, m[i+10], 15, -1051523);
12559 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
12560 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
12561 d = II(d, a, b, c, m[i+15], 10, -30611744);
12562 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
12563 b = II(b, c, d, a, m[i+13], 21, 1309151649);
12564 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
12565 d = II(d, a, b, c, m[i+11], 10, -1120210379);
12566 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
12567 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
12568
12569 a = (a + aa) >>> 0;
12570 b = (b + bb) >>> 0;
12571 c = (c + cc) >>> 0;
12572 d = (d + dd) >>> 0;
12573 }
12574
12575 return crypt.endian([a, b, c, d]);
12576 };
12577
12578 // Auxiliary functions
12579 md5._ff = function (a, b, c, d, x, s, t) {
12580 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
12581 return ((n << s) | (n >>> (32 - s))) + b;
12582 };
12583 md5._gg = function (a, b, c, d, x, s, t) {
12584 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
12585 return ((n << s) | (n >>> (32 - s))) + b;
12586 };
12587 md5._hh = function (a, b, c, d, x, s, t) {
12588 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
12589 return ((n << s) | (n >>> (32 - s))) + b;
12590 };
12591 md5._ii = function (a, b, c, d, x, s, t) {
12592 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
12593 return ((n << s) | (n >>> (32 - s))) + b;
12594 };
12595
12596 // Package private blocksize
12597 md5._blocksize = 16;
12598 md5._digestsize = 16;
12599
12600 module.exports = function (message, options) {
12601 if (message === undefined || message === null)
12602 throw new Error('Illegal argument ' + message);
12603
12604 var digestbytes = crypt.wordsToBytes(md5(message, options));
12605 return options && options.asBytes ? digestbytes :
12606 options && options.asString ? bin.bytesToString(digestbytes) :
12607 crypt.bytesToHex(digestbytes);
12608 };
12609
12610})();
12611
12612
12613/***/ }),
12614/* 313 */
12615/***/ (function(module, exports) {
12616
12617(function() {
12618 var base64map
12619 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
12620
12621 crypt = {
12622 // Bit-wise rotation left
12623 rotl: function(n, b) {
12624 return (n << b) | (n >>> (32 - b));
12625 },
12626
12627 // Bit-wise rotation right
12628 rotr: function(n, b) {
12629 return (n << (32 - b)) | (n >>> b);
12630 },
12631
12632 // Swap big-endian to little-endian and vice versa
12633 endian: function(n) {
12634 // If number given, swap endian
12635 if (n.constructor == Number) {
12636 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
12637 }
12638
12639 // Else, assume array and swap all items
12640 for (var i = 0; i < n.length; i++)
12641 n[i] = crypt.endian(n[i]);
12642 return n;
12643 },
12644
12645 // Generate an array of any length of random bytes
12646 randomBytes: function(n) {
12647 for (var bytes = []; n > 0; n--)
12648 bytes.push(Math.floor(Math.random() * 256));
12649 return bytes;
12650 },
12651
12652 // Convert a byte array to big-endian 32-bit words
12653 bytesToWords: function(bytes) {
12654 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
12655 words[b >>> 5] |= bytes[i] << (24 - b % 32);
12656 return words;
12657 },
12658
12659 // Convert big-endian 32-bit words to a byte array
12660 wordsToBytes: function(words) {
12661 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
12662 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
12663 return bytes;
12664 },
12665
12666 // Convert a byte array to a hex string
12667 bytesToHex: function(bytes) {
12668 for (var hex = [], i = 0; i < bytes.length; i++) {
12669 hex.push((bytes[i] >>> 4).toString(16));
12670 hex.push((bytes[i] & 0xF).toString(16));
12671 }
12672 return hex.join('');
12673 },
12674
12675 // Convert a hex string to a byte array
12676 hexToBytes: function(hex) {
12677 for (var bytes = [], c = 0; c < hex.length; c += 2)
12678 bytes.push(parseInt(hex.substr(c, 2), 16));
12679 return bytes;
12680 },
12681
12682 // Convert a byte array to a base-64 string
12683 bytesToBase64: function(bytes) {
12684 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
12685 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
12686 for (var j = 0; j < 4; j++)
12687 if (i * 8 + j * 6 <= bytes.length * 8)
12688 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
12689 else
12690 base64.push('=');
12691 }
12692 return base64.join('');
12693 },
12694
12695 // Convert a base-64 string to a byte array
12696 base64ToBytes: function(base64) {
12697 // Remove non-base-64 characters
12698 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
12699
12700 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
12701 imod4 = ++i % 4) {
12702 if (imod4 == 0) continue;
12703 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
12704 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
12705 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
12706 }
12707 return bytes;
12708 }
12709 };
12710
12711 module.exports = crypt;
12712})();
12713
12714
12715/***/ }),
12716/* 314 */
12717/***/ (function(module, exports) {
12718
12719/*!
12720 * Determine if an object is a Buffer
12721 *
12722 * @author Feross Aboukhadijeh <https://feross.org>
12723 * @license MIT
12724 */
12725
12726// The _isBuffer check is for Safari 5-7 support, because it's missing
12727// Object.prototype.constructor. Remove this eventually
12728module.exports = function (obj) {
12729 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
12730}
12731
12732function isBuffer (obj) {
12733 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
12734}
12735
12736// For Node v0.10 support. Remove this eventually.
12737function isSlowBuffer (obj) {
12738 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
12739}
12740
12741
12742/***/ }),
12743/* 315 */
12744/***/ (function(module, exports, __webpack_require__) {
12745
12746"use strict";
12747
12748
12749var dataURItoBlob = function dataURItoBlob(dataURI, type) {
12750 var byteString;
12751
12752 // 传入的 base64,不是 dataURL
12753 if (dataURI.indexOf('base64') < 0) {
12754 byteString = atob(dataURI);
12755 } else if (dataURI.split(',')[0].indexOf('base64') >= 0) {
12756 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
12757 byteString = atob(dataURI.split(',')[1]);
12758 } else {
12759 byteString = unescape(dataURI.split(',')[1]);
12760 }
12761 var ia = new Uint8Array(byteString.length);
12762 for (var i = 0; i < byteString.length; i++) {
12763 ia[i] = byteString.charCodeAt(i);
12764 }
12765 return new Blob([ia], { type: type });
12766};
12767
12768module.exports = dataURItoBlob;
12769
12770/***/ }),
12771/* 316 */
12772/***/ (function(module, exports, __webpack_require__) {
12773
12774"use strict";
12775
12776
12777var _getOwnPropertyDescriptor = __webpack_require__(317);
12778
12779var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
12780
12781var _stringify = __webpack_require__(19);
12782
12783var _stringify2 = _interopRequireDefault(_stringify);
12784
12785var _slicedToArray2 = __webpack_require__(320);
12786
12787var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
12788
12789var _promise = __webpack_require__(3);
12790
12791var _promise2 = _interopRequireDefault(_promise);
12792
12793function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12794
12795var _ = __webpack_require__(0);
12796var AVError = __webpack_require__(29);
12797
12798var _require = __webpack_require__(12),
12799 _request = _require._request;
12800
12801var _require2 = __webpack_require__(15),
12802 isNullOrUndefined = _require2.isNullOrUndefined,
12803 ensureArray = _require2.ensureArray,
12804 transformFetchOptions = _require2.transformFetchOptions,
12805 setValue = _require2.setValue,
12806 findValue = _require2.findValue,
12807 isPlainObject = _require2.isPlainObject,
12808 continueWhile = _require2.continueWhile;
12809
12810var recursiveToPointer = function recursiveToPointer(value) {
12811 if (_.isArray(value)) return value.map(recursiveToPointer);
12812 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
12813 if (_.isObject(value) && value._toPointer) return value._toPointer();
12814 return value;
12815};
12816
12817var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
12818var checkReservedKey = function checkReservedKey(key) {
12819 if (RESERVED_KEYS.indexOf(key) !== -1) {
12820 throw new Error('key[' + key + '] is reserved');
12821 }
12822};
12823
12824var handleBatchResults = function handleBatchResults(results) {
12825 var firstError = _.find(results, function (result) {
12826 return result instanceof Error;
12827 });
12828 if (!firstError) {
12829 return results;
12830 }
12831 var error = new AVError(firstError.code, firstError.message);
12832 error.results = results;
12833 throw error;
12834};
12835
12836// Helper function to get a value from a Backbone object as a property
12837// or as a function.
12838function getValue(object, prop) {
12839 if (!(object && object[prop])) {
12840 return null;
12841 }
12842 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
12843}
12844
12845// AV.Object is analogous to the Java AVObject.
12846// It also implements the same interface as a Backbone model.
12847
12848module.exports = function (AV) {
12849 /**
12850 * Creates a new model with defined attributes. A client id (cid) is
12851 * automatically generated and assigned for you.
12852 *
12853 * <p>You won't normally call this method directly. It is recommended that
12854 * you use a subclass of <code>AV.Object</code> instead, created by calling
12855 * <code>extend</code>.</p>
12856 *
12857 * <p>However, if you don't want to use a subclass, or aren't sure which
12858 * subclass is appropriate, you can use this form:<pre>
12859 * var object = new AV.Object("ClassName");
12860 * </pre>
12861 * That is basically equivalent to:<pre>
12862 * var MyClass = AV.Object.extend("ClassName");
12863 * var object = new MyClass();
12864 * </pre></p>
12865 *
12866 * @param {Object} attributes The initial set of data to store in the object.
12867 * @param {Object} options A set of Backbone-like options for creating the
12868 * object. The only option currently supported is "collection".
12869 * @see AV.Object.extend
12870 *
12871 * @class
12872 *
12873 * <p>The fundamental unit of AV data, which implements the Backbone Model
12874 * interface.</p>
12875 */
12876 AV.Object = function (attributes, options) {
12877 // Allow new AV.Object("ClassName") as a shortcut to _create.
12878 if (_.isString(attributes)) {
12879 return AV.Object._create.apply(this, arguments);
12880 }
12881
12882 attributes = attributes || {};
12883 if (options && options.parse) {
12884 attributes = this.parse(attributes);
12885 attributes = this._mergeMagicFields(attributes);
12886 }
12887 var defaults = getValue(this, 'defaults');
12888 if (defaults) {
12889 attributes = _.extend({}, defaults, attributes);
12890 }
12891 if (options && options.collection) {
12892 this.collection = options.collection;
12893 }
12894
12895 this._serverData = {}; // The last known data for this object from cloud.
12896 this._opSetQueue = [{}]; // List of sets of changes to the data.
12897 this._flags = {};
12898 this.attributes = {}; // The best estimate of this's current data.
12899
12900 this._hashedJSON = {}; // Hash of values of containers at last save.
12901 this._escapedAttributes = {};
12902 this.cid = _.uniqueId('c');
12903 this.changed = {};
12904 this._silent = {};
12905 this._pending = {};
12906 this.set(attributes, { silent: true });
12907 this.changed = {};
12908 this._silent = {};
12909 this._pending = {};
12910 this._hasData = true;
12911 this._previousAttributes = _.clone(this.attributes);
12912 this.initialize.apply(this, arguments);
12913 };
12914
12915 /**
12916 * @lends AV.Object.prototype
12917 * @property {String} id The objectId of the AV Object.
12918 */
12919
12920 /**
12921 * Saves the given list of AV.Object.
12922 * If any error is encountered, stops and calls the error handler.
12923 *
12924 * @example
12925 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
12926 * // All the objects were saved.
12927 * }, function(error) {
12928 * // An error occurred while saving one of the objects.
12929 * });
12930 *
12931 * @param {Array} list A list of <code>AV.Object</code>.
12932 */
12933 AV.Object.saveAll = function (list, options) {
12934 return AV.Object._deepSaveAsync(list, null, options);
12935 };
12936
12937 /**
12938 * Fetch the given list of AV.Object.
12939 *
12940 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
12941 * @param {AuthOptions} options
12942 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
12943 */
12944
12945 AV.Object.fetchAll = function (objects, options) {
12946 return _promise2.default.resolve().then(function () {
12947 return _request('batch', null, null, 'POST', {
12948 requests: _.map(objects, function (object) {
12949 if (!object.className) throw new Error('object must have className to fetch');
12950 if (!object.id) throw new Error('object must have id to fetch');
12951 if (object.dirty()) throw new Error('object is modified but not saved');
12952 return {
12953 method: 'GET',
12954 path: '/1.1/classes/' + object.className + '/' + object.id
12955 };
12956 })
12957 }, options);
12958 }).then(function (response) {
12959 var results = _.map(objects, function (object, i) {
12960 if (response[i].success) {
12961 var fetchedAttrs = object.parse(response[i].success);
12962 object._cleanupUnsetKeys(fetchedAttrs);
12963 object._finishFetch(fetchedAttrs);
12964 return object;
12965 }
12966 if (response[i].success === null) {
12967 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
12968 }
12969 return new AVError(response[i].error.code, response[i].error.error);
12970 });
12971 return handleBatchResults(results);
12972 });
12973 };
12974
12975 // Attach all inheritable methods to the AV.Object prototype.
12976 _.extend(AV.Object.prototype, AV.Events,
12977 /** @lends AV.Object.prototype */{
12978 _fetchWhenSave: false,
12979
12980 /**
12981 * Initialize is an empty function by default. Override it with your own
12982 * initialization logic.
12983 */
12984 initialize: function initialize() {},
12985
12986 /**
12987 * Set whether to enable fetchWhenSave option when updating object.
12988 * When set true, SDK would fetch the latest object after saving.
12989 * Default is false.
12990 *
12991 * @deprecated use AV.Object#save with options.fetchWhenSave instead
12992 * @param {boolean} enable true to enable fetchWhenSave option.
12993 */
12994 fetchWhenSave: function fetchWhenSave(enable) {
12995 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
12996 if (!_.isBoolean(enable)) {
12997 throw new Error('Expect boolean value for fetchWhenSave');
12998 }
12999 this._fetchWhenSave = enable;
13000 },
13001
13002 /**
13003 * Returns the object's objectId.
13004 * @return {String} the objectId.
13005 */
13006 getObjectId: function getObjectId() {
13007 return this.id;
13008 },
13009
13010 /**
13011 * Returns the object's createdAt attribute.
13012 * @return {Date}
13013 */
13014 getCreatedAt: function getCreatedAt() {
13015 return this.createdAt;
13016 },
13017
13018 /**
13019 * Returns the object's updatedAt attribute.
13020 * @return {Date}
13021 */
13022 getUpdatedAt: function getUpdatedAt() {
13023 return this.updatedAt;
13024 },
13025
13026 /**
13027 * Returns a JSON version of the object.
13028 * @return {Object}
13029 */
13030 toJSON: function toJSON(key, holder) {
13031 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
13032
13033 return this._toFullJSON(seenObjects, false);
13034 },
13035
13036 /**
13037 * Returns a JSON version of the object with meta data.
13038 * Inverse to {@link AV.parseJSON}
13039 * @since 3.0.0
13040 * @return {Object}
13041 */
13042 toFullJSON: function toFullJSON() {
13043 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
13044
13045 return this._toFullJSON(seenObjects);
13046 },
13047
13048
13049 _toFullJSON: function _toFullJSON(seenObjects) {
13050 var _this = this;
13051
13052 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
13053
13054 var json = _.clone(this.attributes);
13055 if (_.isArray(seenObjects)) {
13056 var newSeenObjects = seenObjects.concat(this);
13057 }
13058 AV._objectEach(json, function (val, key) {
13059 json[key] = AV._encode(val, newSeenObjects, undefined, full);
13060 });
13061 AV._objectEach(this._operations, function (val, key) {
13062 json[key] = val;
13063 });
13064
13065 if (_.has(this, 'id')) {
13066 json.objectId = this.id;
13067 }
13068 ['createdAt', 'updatedAt'].forEach(function (key) {
13069 if (_.has(_this, key)) {
13070 var val = _this[key];
13071 json[key] = _.isDate(val) ? val.toJSON() : val;
13072 }
13073 });
13074 if (full) {
13075 json.__type = 'Object';
13076 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
13077 json.className = this.className;
13078 }
13079 return json;
13080 },
13081
13082 /**
13083 * Updates _hashedJSON to reflect the current state of this object.
13084 * Adds any changed hash values to the set of pending changes.
13085 * @private
13086 */
13087 _refreshCache: function _refreshCache() {
13088 var self = this;
13089 if (self._refreshingCache) {
13090 return;
13091 }
13092 self._refreshingCache = true;
13093 AV._objectEach(this.attributes, function (value, key) {
13094 if (value instanceof AV.Object) {
13095 value._refreshCache();
13096 } else if (_.isObject(value)) {
13097 if (self._resetCacheForKey(key)) {
13098 self.set(key, new AV.Op.Set(value), { silent: true });
13099 }
13100 }
13101 });
13102 delete self._refreshingCache;
13103 },
13104
13105 /**
13106 * Returns true if this object has been modified since its last
13107 * save/refresh. If an attribute is specified, it returns true only if that
13108 * particular attribute has been modified since the last save/refresh.
13109 * @param {String} attr An attribute name (optional).
13110 * @return {Boolean}
13111 */
13112 dirty: function dirty(attr) {
13113 this._refreshCache();
13114
13115 var currentChanges = _.last(this._opSetQueue);
13116
13117 if (attr) {
13118 return currentChanges[attr] ? true : false;
13119 }
13120 if (!this.id) {
13121 return true;
13122 }
13123 if (_.keys(currentChanges).length > 0) {
13124 return true;
13125 }
13126 return false;
13127 },
13128
13129 /**
13130 * Returns the keys of the modified attribute since its last save/refresh.
13131 * @return {String[]}
13132 */
13133 dirtyKeys: function dirtyKeys() {
13134 this._refreshCache();
13135 var currentChanges = _.last(this._opSetQueue);
13136 return _.keys(currentChanges);
13137 },
13138
13139 /**
13140 * Gets a Pointer referencing this Object.
13141 * @private
13142 */
13143 _toPointer: function _toPointer() {
13144 // if (!this.id) {
13145 // throw new Error("Can't serialize an unsaved AV.Object");
13146 // }
13147 return {
13148 __type: 'Pointer',
13149 className: this.className,
13150 objectId: this.id
13151 };
13152 },
13153
13154 /**
13155 * Gets the value of an attribute.
13156 * @param {String} attr The string name of an attribute.
13157 */
13158 get: function get(attr) {
13159 switch (attr) {
13160 case 'objectId':
13161 return this.id;
13162 case 'createdAt':
13163 case 'updatedAt':
13164 return this[attr];
13165 default:
13166 return this.attributes[attr];
13167 }
13168 },
13169
13170 /**
13171 * Gets a relation on the given class for the attribute.
13172 * @param {String} attr The attribute to get the relation for.
13173 * @return {AV.Relation}
13174 */
13175 relation: function relation(attr) {
13176 var value = this.get(attr);
13177 if (value) {
13178 if (!(value instanceof AV.Relation)) {
13179 throw new Error('Called relation() on non-relation field ' + attr);
13180 }
13181 value._ensureParentAndKey(this, attr);
13182 return value;
13183 } else {
13184 return new AV.Relation(this, attr);
13185 }
13186 },
13187
13188 /**
13189 * Gets the HTML-escaped value of an attribute.
13190 */
13191 escape: function escape(attr) {
13192 var html = this._escapedAttributes[attr];
13193 if (html) {
13194 return html;
13195 }
13196 var val = this.attributes[attr];
13197 var escaped;
13198 if (isNullOrUndefined(val)) {
13199 escaped = '';
13200 } else {
13201 escaped = _.escape(val.toString());
13202 }
13203 this._escapedAttributes[attr] = escaped;
13204 return escaped;
13205 },
13206
13207 /**
13208 * Returns <code>true</code> if the attribute contains a value that is not
13209 * null or undefined.
13210 * @param {String} attr The string name of the attribute.
13211 * @return {Boolean}
13212 */
13213 has: function has(attr) {
13214 return !isNullOrUndefined(this.attributes[attr]);
13215 },
13216
13217 /**
13218 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
13219 * and puts them on "this" directly. Removes them from attrs.
13220 * @param attrs - A dictionary with the data for this AV.Object.
13221 * @private
13222 */
13223 _mergeMagicFields: function _mergeMagicFields(attrs) {
13224 // Check for changes of magic fields.
13225 var model = this;
13226 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
13227 AV._arrayEach(specialFields, function (attr) {
13228 if (attrs[attr]) {
13229 if (attr === 'objectId') {
13230 model.id = attrs[attr];
13231 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
13232 model[attr] = AV._parseDate(attrs[attr]);
13233 } else {
13234 model[attr] = attrs[attr];
13235 }
13236 delete attrs[attr];
13237 }
13238 });
13239 return attrs;
13240 },
13241
13242 /**
13243 * Returns the json to be sent to the server.
13244 * @private
13245 */
13246 _startSave: function _startSave() {
13247 this._opSetQueue.push({});
13248 },
13249
13250 /**
13251 * Called when a save fails because of an error. Any changes that were part
13252 * of the save need to be merged with changes made after the save. This
13253 * might throw an exception is you do conflicting operations. For example,
13254 * if you do:
13255 * object.set("foo", "bar");
13256 * object.set("invalid field name", "baz");
13257 * object.save();
13258 * object.increment("foo");
13259 * then this will throw when the save fails and the client tries to merge
13260 * "bar" with the +1.
13261 * @private
13262 */
13263 _cancelSave: function _cancelSave() {
13264 var failedChanges = _.first(this._opSetQueue);
13265 this._opSetQueue = _.rest(this._opSetQueue);
13266 var nextChanges = _.first(this._opSetQueue);
13267 AV._objectEach(failedChanges, function (op, key) {
13268 var op1 = failedChanges[key];
13269 var op2 = nextChanges[key];
13270 if (op1 && op2) {
13271 nextChanges[key] = op2._mergeWithPrevious(op1);
13272 } else if (op1) {
13273 nextChanges[key] = op1;
13274 }
13275 });
13276 this._saving = this._saving - 1;
13277 },
13278
13279 /**
13280 * Called when a save completes successfully. This merges the changes that
13281 * were saved into the known server data, and overrides it with any data
13282 * sent directly from the server.
13283 * @private
13284 */
13285 _finishSave: function _finishSave(serverData) {
13286 // Grab a copy of any object referenced by this object. These instances
13287 // may have already been fetched, and we don't want to lose their data.
13288 // Note that doing it like this means we will unify separate copies of the
13289 // same object, but that's a risk we have to take.
13290 var fetchedObjects = {};
13291 AV._traverse(this.attributes, function (object) {
13292 if (object instanceof AV.Object && object.id && object._hasData) {
13293 fetchedObjects[object.id] = object;
13294 }
13295 });
13296
13297 var savedChanges = _.first(this._opSetQueue);
13298 this._opSetQueue = _.rest(this._opSetQueue);
13299 this._applyOpSet(savedChanges, this._serverData);
13300 this._mergeMagicFields(serverData);
13301 var self = this;
13302 AV._objectEach(serverData, function (value, key) {
13303 self._serverData[key] = AV._decode(value, key);
13304
13305 // Look for any objects that might have become unfetched and fix them
13306 // by replacing their values with the previously observed values.
13307 var fetched = AV._traverse(self._serverData[key], function (object) {
13308 if (object instanceof AV.Object && fetchedObjects[object.id]) {
13309 return fetchedObjects[object.id];
13310 }
13311 });
13312 if (fetched) {
13313 self._serverData[key] = fetched;
13314 }
13315 });
13316 this._rebuildAllEstimatedData();
13317 var opSetQueue = this._opSetQueue.map(_.clone);
13318 this._refreshCache();
13319 this._opSetQueue = opSetQueue;
13320 this._saving = this._saving - 1;
13321 },
13322
13323 /**
13324 * Called when a fetch or login is complete to set the known server data to
13325 * the given object.
13326 * @private
13327 */
13328 _finishFetch: function _finishFetch(serverData, hasData) {
13329 // Clear out any changes the user might have made previously.
13330 this._opSetQueue = [{}];
13331
13332 // Bring in all the new server data.
13333 this._mergeMagicFields(serverData);
13334 var self = this;
13335 AV._objectEach(serverData, function (value, key) {
13336 self._serverData[key] = AV._decode(value, key);
13337 });
13338
13339 // Refresh the attributes.
13340 this._rebuildAllEstimatedData();
13341
13342 // Clear out the cache of mutable containers.
13343 this._refreshCache();
13344 this._opSetQueue = [{}];
13345
13346 this._hasData = hasData;
13347 },
13348
13349 /**
13350 * Applies the set of AV.Op in opSet to the object target.
13351 * @private
13352 */
13353 _applyOpSet: function _applyOpSet(opSet, target) {
13354 var self = this;
13355 AV._objectEach(opSet, function (change, key) {
13356 var _findValue = findValue(target, key),
13357 _findValue2 = (0, _slicedToArray3.default)(_findValue, 3),
13358 value = _findValue2[0],
13359 actualTarget = _findValue2[1],
13360 actualKey = _findValue2[2];
13361
13362 setValue(target, key, change._estimate(value, self, key));
13363 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
13364 delete actualTarget[actualKey];
13365 }
13366 });
13367 },
13368
13369 /**
13370 * Replaces the cached value for key with the current value.
13371 * Returns true if the new value is different than the old value.
13372 * @private
13373 */
13374 _resetCacheForKey: function _resetCacheForKey(key) {
13375 var value = this.attributes[key];
13376 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
13377 var json = (0, _stringify2.default)(recursiveToPointer(value));
13378 if (this._hashedJSON[key] !== json) {
13379 var wasSet = !!this._hashedJSON[key];
13380 this._hashedJSON[key] = json;
13381 return wasSet;
13382 }
13383 }
13384 return false;
13385 },
13386
13387 /**
13388 * Populates attributes[key] by starting with the last known data from the
13389 * server, and applying all of the local changes that have been made to that
13390 * key since then.
13391 * @private
13392 */
13393 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
13394 var self = this;
13395 delete this.attributes[key];
13396 if (this._serverData[key]) {
13397 this.attributes[key] = this._serverData[key];
13398 }
13399 AV._arrayEach(this._opSetQueue, function (opSet) {
13400 var op = opSet[key];
13401 if (op) {
13402 var _findValue3 = findValue(self.attributes, key),
13403 _findValue4 = (0, _slicedToArray3.default)(_findValue3, 4),
13404 value = _findValue4[0],
13405 actualTarget = _findValue4[1],
13406 actualKey = _findValue4[2],
13407 firstKey = _findValue4[3];
13408
13409 setValue(self.attributes, key, op._estimate(value, self, key));
13410 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
13411 delete actualTarget[actualKey];
13412 }
13413 self._resetCacheForKey(firstKey);
13414 }
13415 });
13416 },
13417
13418 /**
13419 * Populates attributes by starting with the last known data from the
13420 * server, and applying all of the local changes that have been made since
13421 * then.
13422 * @private
13423 */
13424 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
13425 var self = this;
13426
13427 var previousAttributes = _.clone(this.attributes);
13428
13429 this.attributes = _.clone(this._serverData);
13430 AV._arrayEach(this._opSetQueue, function (opSet) {
13431 self._applyOpSet(opSet, self.attributes);
13432 AV._objectEach(opSet, function (op, key) {
13433 self._resetCacheForKey(key);
13434 });
13435 });
13436
13437 // Trigger change events for anything that changed because of the fetch.
13438 AV._objectEach(previousAttributes, function (oldValue, key) {
13439 if (self.attributes[key] !== oldValue) {
13440 self.trigger('change:' + key, self, self.attributes[key], {});
13441 }
13442 });
13443 AV._objectEach(this.attributes, function (newValue, key) {
13444 if (!_.has(previousAttributes, key)) {
13445 self.trigger('change:' + key, self, newValue, {});
13446 }
13447 });
13448 },
13449
13450 /**
13451 * Sets a hash of model attributes on the object, firing
13452 * <code>"change"</code> unless you choose to silence it.
13453 *
13454 * <p>You can call it with an object containing keys and values, or with one
13455 * key and value. For example:</p>
13456 *
13457 * @example
13458 * gameTurn.set({
13459 * player: player1,
13460 * diceRoll: 2
13461 * });
13462 *
13463 * game.set("currentPlayer", player2);
13464 *
13465 * game.set("finished", true);
13466 *
13467 * @param {String} key The key to set.
13468 * @param {Any} value The value to give it.
13469 * @param {Object} [options]
13470 * @param {Boolean} [options.silent]
13471 * @return {AV.Object} self if succeeded, throws if the value is not valid.
13472 * @see AV.Object#validate
13473 */
13474 set: function set(key, value, options) {
13475 var attrs;
13476 if (_.isObject(key) || isNullOrUndefined(key)) {
13477 attrs = _.mapObject(key, function (v, k) {
13478 checkReservedKey(k);
13479 return AV._decode(v, k);
13480 });
13481 options = value;
13482 } else {
13483 attrs = {};
13484 checkReservedKey(key);
13485 attrs[key] = AV._decode(value, key);
13486 }
13487
13488 // Extract attributes and options.
13489 options = options || {};
13490 if (!attrs) {
13491 return this;
13492 }
13493 if (attrs instanceof AV.Object) {
13494 attrs = attrs.attributes;
13495 }
13496
13497 // If the unset option is used, every attribute should be a Unset.
13498 if (options.unset) {
13499 AV._objectEach(attrs, function (unused_value, key) {
13500 attrs[key] = new AV.Op.Unset();
13501 });
13502 }
13503
13504 // Apply all the attributes to get the estimated values.
13505 var dataToValidate = _.clone(attrs);
13506 var self = this;
13507 AV._objectEach(dataToValidate, function (value, key) {
13508 if (value instanceof AV.Op) {
13509 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
13510 if (dataToValidate[key] === AV.Op._UNSET) {
13511 delete dataToValidate[key];
13512 }
13513 }
13514 });
13515
13516 // Run validation.
13517 this._validate(attrs, options);
13518
13519 options.changes = {};
13520 var escaped = this._escapedAttributes;
13521
13522 // Update attributes.
13523 AV._arrayEach(_.keys(attrs), function (attr) {
13524 var val = attrs[attr];
13525
13526 // If this is a relation object we need to set the parent correctly,
13527 // since the location where it was parsed does not have access to
13528 // this object.
13529 if (val instanceof AV.Relation) {
13530 val.parent = self;
13531 }
13532
13533 if (!(val instanceof AV.Op)) {
13534 val = new AV.Op.Set(val);
13535 }
13536
13537 // See if this change will actually have any effect.
13538 var isRealChange = true;
13539 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
13540 isRealChange = false;
13541 }
13542
13543 if (isRealChange) {
13544 delete escaped[attr];
13545 if (options.silent) {
13546 self._silent[attr] = true;
13547 } else {
13548 options.changes[attr] = true;
13549 }
13550 }
13551
13552 var currentChanges = _.last(self._opSetQueue);
13553 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
13554 self._rebuildEstimatedDataForKey(attr);
13555
13556 if (isRealChange) {
13557 self.changed[attr] = self.attributes[attr];
13558 if (!options.silent) {
13559 self._pending[attr] = true;
13560 }
13561 } else {
13562 delete self.changed[attr];
13563 delete self._pending[attr];
13564 }
13565 });
13566
13567 if (!options.silent) {
13568 this.change(options);
13569 }
13570 return this;
13571 },
13572
13573 /**
13574 * Remove an attribute from the model, firing <code>"change"</code> unless
13575 * you choose to silence it. This is a noop if the attribute doesn't
13576 * exist.
13577 * @param key {String} The key.
13578 */
13579 unset: function unset(attr, options) {
13580 options = options || {};
13581 options.unset = true;
13582 return this.set(attr, null, options);
13583 },
13584
13585 /**
13586 * Atomically increments the value of the given attribute the next time the
13587 * object is saved. If no amount is specified, 1 is used by default.
13588 *
13589 * @param key {String} The key.
13590 * @param amount {Number} The amount to increment by.
13591 */
13592 increment: function increment(attr, amount) {
13593 if (_.isUndefined(amount) || _.isNull(amount)) {
13594 amount = 1;
13595 }
13596 return this.set(attr, new AV.Op.Increment(amount));
13597 },
13598
13599 /**
13600 * Atomically add an object to the end of the array associated with a given
13601 * key.
13602 * @param key {String} The key.
13603 * @param item {} The item to add.
13604 */
13605 add: function add(attr, item) {
13606 return this.set(attr, new AV.Op.Add(ensureArray(item)));
13607 },
13608
13609 /**
13610 * Atomically add an object to the array associated with a given key, only
13611 * if it is not already present in the array. The position of the insert is
13612 * not guaranteed.
13613 *
13614 * @param key {String} The key.
13615 * @param item {} The object to add.
13616 */
13617 addUnique: function addUnique(attr, item) {
13618 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
13619 },
13620
13621 /**
13622 * Atomically remove all instances of an object from the array associated
13623 * with a given key.
13624 *
13625 * @param key {String} The key.
13626 * @param item {} The object to remove.
13627 */
13628 remove: function remove(attr, item) {
13629 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
13630 },
13631
13632 /**
13633 * Atomically apply a "bit and" operation on the value associated with a
13634 * given key.
13635 *
13636 * @param key {String} The key.
13637 * @param value {Number} The value to apply.
13638 */
13639 bitAnd: function bitAnd(attr, value) {
13640 return this.set(attr, new AV.Op.BitAnd(value));
13641 },
13642
13643
13644 /**
13645 * Atomically apply a "bit or" operation on the value associated with a
13646 * given key.
13647 *
13648 * @param key {String} The key.
13649 * @param value {Number} The value to apply.
13650 */
13651 bitOr: function bitOr(attr, value) {
13652 return this.set(attr, new AV.Op.BitOr(value));
13653 },
13654
13655
13656 /**
13657 * Atomically apply a "bit xor" operation on the value associated with a
13658 * given key.
13659 *
13660 * @param key {String} The key.
13661 * @param value {Number} The value to apply.
13662 */
13663 bitXor: function bitXor(attr, value) {
13664 return this.set(attr, new AV.Op.BitXor(value));
13665 },
13666
13667
13668 /**
13669 * Returns an instance of a subclass of AV.Op describing what kind of
13670 * modification has been performed on this field since the last time it was
13671 * saved. For example, after calling object.increment("x"), calling
13672 * object.op("x") would return an instance of AV.Op.Increment.
13673 *
13674 * @param key {String} The key.
13675 * @returns {AV.Op} The operation, or undefined if none.
13676 */
13677 op: function op(attr) {
13678 return _.last(this._opSetQueue)[attr];
13679 },
13680
13681 /**
13682 * Clear all attributes on the model, firing <code>"change"</code> unless
13683 * you choose to silence it.
13684 */
13685 clear: function clear(options) {
13686 options = options || {};
13687 options.unset = true;
13688 var keysToClear = _.extend(this.attributes, this._operations);
13689 return this.set(keysToClear, options);
13690 },
13691
13692 /**
13693 * Clears any (or specific) changes to the model made since the last save.
13694 * @param {string|string[]} [keys] specify keys to revert.
13695 */
13696 revert: function revert(keys) {
13697 var lastOp = _.last(this._opSetQueue);
13698 var _keys = ensureArray(keys || _.keys(lastOp));
13699 _keys.forEach(function (key) {
13700 delete lastOp[key];
13701 });
13702 this._rebuildAllEstimatedData();
13703 return this;
13704 },
13705
13706
13707 /**
13708 * Returns a JSON-encoded set of operations to be sent with the next save
13709 * request.
13710 * @private
13711 */
13712 _getSaveJSON: function _getSaveJSON() {
13713 var json = _.clone(_.first(this._opSetQueue));
13714 AV._objectEach(json, function (op, key) {
13715 json[key] = op.toJSON();
13716 });
13717 return json;
13718 },
13719
13720 /**
13721 * Returns true if this object can be serialized for saving.
13722 * @private
13723 */
13724 _canBeSerialized: function _canBeSerialized() {
13725 return AV.Object._canBeSerializedAsValue(this.attributes);
13726 },
13727
13728 /**
13729 * Fetch the model from the server. If the server's representation of the
13730 * model differs from its current attributes, they will be overriden,
13731 * triggering a <code>"change"</code> event.
13732 * @param {Object} fetchOptions Optional options to set 'keys',
13733 * 'include' and 'includeACL' option.
13734 * @param {AuthOptions} options
13735 * @return {Promise} A promise that is fulfilled when the fetch
13736 * completes.
13737 */
13738 fetch: function fetch() {
13739 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13740 var options = arguments[1];
13741
13742 if (!this.id) {
13743 throw new Error('Cannot fetch unsaved object');
13744 }
13745 var self = this;
13746 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
13747 return request.then(function (response) {
13748 var fetchedAttrs = self.parse(response);
13749 self._cleanupUnsetKeys(fetchedAttrs, fetchOptions.keys ? ensureArray(fetchOptions.keys).join(',').split(',') : undefined);
13750 self._finishFetch(fetchedAttrs, true);
13751 return self;
13752 });
13753 },
13754
13755 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
13756 var _this2 = this;
13757
13758 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _.keys(this._serverData);
13759
13760 _.forEach(fetchedKeys, function (key) {
13761 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
13762 });
13763 },
13764
13765
13766 /**
13767 * Set a hash of model attributes, and save the model to the server.
13768 * updatedAt will be updated when the request returns.
13769 * You can either call it as:<pre>
13770 * object.save();</pre>
13771 * or<pre>
13772 * object.save(null, options);</pre>
13773 * or<pre>
13774 * object.save(attrs, options);</pre>
13775 * or<pre>
13776 * object.save(key, value, options);</pre>
13777 *
13778 * @example
13779 * gameTurn.save({
13780 * player: "Jake Cutter",
13781 * diceRoll: 2
13782 * }).then(function(gameTurnAgain) {
13783 * // The save was successful.
13784 * }, function(error) {
13785 * // The save failed. Error is an instance of AVError.
13786 * });
13787 *
13788 * @param {AuthOptions} options AuthOptions plus:
13789 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
13790 * @param {AV.Query} options.query Save object only when it matches the query
13791 * @return {Promise} A promise that is fulfilled when the save
13792 * completes.
13793 * @see AVError
13794 */
13795 save: function save(arg1, arg2, arg3) {
13796 var attrs, current, options;
13797 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
13798 attrs = arg1;
13799 options = arg2;
13800 } else {
13801 attrs = {};
13802 attrs[arg1] = arg2;
13803 options = arg3;
13804 }
13805
13806 options = _.clone(options) || {};
13807 if (options.wait) {
13808 current = _.clone(this.attributes);
13809 }
13810
13811 var setOptions = _.clone(options) || {};
13812 if (setOptions.wait) {
13813 setOptions.silent = true;
13814 }
13815 if (attrs) {
13816 this.set(attrs, setOptions);
13817 }
13818
13819 var model = this;
13820
13821 var unsavedChildren = [];
13822 var unsavedFiles = [];
13823 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
13824 if (unsavedChildren.length + unsavedFiles.length > 1) {
13825 return AV.Object._deepSaveAsync(this, model, options);
13826 }
13827
13828 this._startSave();
13829 this._saving = (this._saving || 0) + 1;
13830
13831 this._allPreviousSaves = this._allPreviousSaves || _promise2.default.resolve();
13832 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
13833 var method = model.id ? 'PUT' : 'POST';
13834
13835 var json = model._getSaveJSON();
13836 var query = {};
13837
13838 if (model._fetchWhenSave || options.fetchWhenSave) {
13839 query['new'] = 'true';
13840 }
13841 // user login option
13842 if (options._failOnNotExist) {
13843 query.failOnNotExist = 'true';
13844 }
13845
13846 if (options.query) {
13847 var queryParams;
13848 if (typeof options.query._getParams === 'function') {
13849 queryParams = options.query._getParams();
13850 if (queryParams) {
13851 query.where = queryParams.where;
13852 }
13853 }
13854 if (!query.where) {
13855 var error = new Error('options.query is not an AV.Query');
13856 throw error;
13857 }
13858 }
13859
13860 _.extend(json, model._flags);
13861
13862 var route = 'classes';
13863 var className = model.className;
13864 if (model.className === '_User' && !model.id) {
13865 // Special-case user sign-up.
13866 route = 'users';
13867 className = null;
13868 }
13869 //hook makeRequest in options.
13870 var makeRequest = options._makeRequest || _request;
13871 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
13872
13873 requestPromise = requestPromise.then(function (resp) {
13874 var serverAttrs = model.parse(resp);
13875 if (options.wait) {
13876 serverAttrs = _.extend(attrs || {}, serverAttrs);
13877 }
13878 model._finishSave(serverAttrs);
13879 if (options.wait) {
13880 model.set(current, setOptions);
13881 }
13882 return model;
13883 }, function (error) {
13884 model._cancelSave();
13885 throw error;
13886 });
13887
13888 return requestPromise;
13889 });
13890 return this._allPreviousSaves;
13891 },
13892
13893 /**
13894 * Destroy this model on the server if it was already persisted.
13895 * Optimistically removes the model from its collection, if it has one.
13896 * @param {AuthOptions} options AuthOptions plus:
13897 * @param {Boolean} [options.wait] wait for the server to respond
13898 * before removal.
13899 *
13900 * @return {Promise} A promise that is fulfilled when the destroy
13901 * completes.
13902 */
13903 destroy: function destroy(options) {
13904 options = options || {};
13905 var model = this;
13906
13907 var triggerDestroy = function triggerDestroy() {
13908 model.trigger('destroy', model, model.collection, options);
13909 };
13910
13911 if (!this.id) {
13912 return triggerDestroy();
13913 }
13914
13915 if (!options.wait) {
13916 triggerDestroy();
13917 }
13918
13919 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
13920 return request.then(function () {
13921 if (options.wait) {
13922 triggerDestroy();
13923 }
13924 return model;
13925 });
13926 },
13927
13928 /**
13929 * Converts a response into the hash of attributes to be set on the model.
13930 * @ignore
13931 */
13932 parse: function parse(resp) {
13933 var output = _.clone(resp);
13934 ['createdAt', 'updatedAt'].forEach(function (key) {
13935 if (output[key]) {
13936 output[key] = AV._parseDate(output[key]);
13937 }
13938 });
13939 if (output.createdAt && !output.updatedAt) {
13940 output.updatedAt = output.createdAt;
13941 }
13942 return output;
13943 },
13944
13945 /**
13946 * Creates a new model with identical attributes to this one.
13947 * @return {AV.Object}
13948 */
13949 clone: function clone() {
13950 return new this.constructor(this.attributes);
13951 },
13952
13953 /**
13954 * Returns true if this object has never been saved to AV.
13955 * @return {Boolean}
13956 */
13957 isNew: function isNew() {
13958 return !this.id;
13959 },
13960
13961 /**
13962 * Call this method to manually fire a `"change"` event for this model and
13963 * a `"change:attribute"` event for each changed attribute.
13964 * Calling this will cause all objects observing the model to update.
13965 */
13966 change: function change(options) {
13967 options = options || {};
13968 var changing = this._changing;
13969 this._changing = true;
13970
13971 // Silent changes become pending changes.
13972 var self = this;
13973 AV._objectEach(this._silent, function (attr) {
13974 self._pending[attr] = true;
13975 });
13976
13977 // Silent changes are triggered.
13978 var changes = _.extend({}, options.changes, this._silent);
13979 this._silent = {};
13980 AV._objectEach(changes, function (unused_value, attr) {
13981 self.trigger('change:' + attr, self, self.get(attr), options);
13982 });
13983 if (changing) {
13984 return this;
13985 }
13986
13987 // This is to get around lint not letting us make a function in a loop.
13988 var deleteChanged = function deleteChanged(value, attr) {
13989 if (!self._pending[attr] && !self._silent[attr]) {
13990 delete self.changed[attr];
13991 }
13992 };
13993
13994 // Continue firing `"change"` events while there are pending changes.
13995 while (!_.isEmpty(this._pending)) {
13996 this._pending = {};
13997 this.trigger('change', this, options);
13998 // Pending and silent changes still remain.
13999 AV._objectEach(this.changed, deleteChanged);
14000 self._previousAttributes = _.clone(this.attributes);
14001 }
14002
14003 this._changing = false;
14004 return this;
14005 },
14006
14007 /**
14008 * Gets the previous value of an attribute, recorded at the time the last
14009 * <code>"change"</code> event was fired.
14010 * @param {String} attr Name of the attribute to get.
14011 */
14012 previous: function previous(attr) {
14013 if (!arguments.length || !this._previousAttributes) {
14014 return null;
14015 }
14016 return this._previousAttributes[attr];
14017 },
14018
14019 /**
14020 * Gets all of the attributes of the model at the time of the previous
14021 * <code>"change"</code> event.
14022 * @return {Object}
14023 */
14024 previousAttributes: function previousAttributes() {
14025 return _.clone(this._previousAttributes);
14026 },
14027
14028 /**
14029 * Checks if the model is currently in a valid state. It's only possible to
14030 * get into an *invalid* state if you're using silent changes.
14031 * @return {Boolean}
14032 */
14033 isValid: function isValid() {
14034 try {
14035 this.validate(this.attributes);
14036 } catch (error) {
14037 return false;
14038 }
14039 return true;
14040 },
14041
14042 /**
14043 * You should not call this function directly unless you subclass
14044 * <code>AV.Object</code>, in which case you can override this method
14045 * to provide additional validation on <code>set</code> and
14046 * <code>save</code>. Your implementation should throw an Error if
14047 * the attrs is invalid
14048 *
14049 * @param {Object} attrs The current data to validate.
14050 * @see AV.Object#set
14051 */
14052 validate: function validate(attrs) {
14053 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
14054 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
14055 }
14056 },
14057
14058 /**
14059 * Run validation against a set of incoming attributes, returning `true`
14060 * if all is well. If a specific `error` callback has been passed,
14061 * call that instead of firing the general `"error"` event.
14062 * @private
14063 */
14064 _validate: function _validate(attrs, options) {
14065 if (options.silent || !this.validate) {
14066 return;
14067 }
14068 attrs = _.extend({}, this.attributes, attrs);
14069 this.validate(attrs);
14070 },
14071
14072 /**
14073 * Returns the ACL for this object.
14074 * @returns {AV.ACL} An instance of AV.ACL.
14075 * @see AV.Object#get
14076 */
14077 getACL: function getACL() {
14078 return this.get('ACL');
14079 },
14080
14081 /**
14082 * Sets the ACL to be used for this object.
14083 * @param {AV.ACL} acl An instance of AV.ACL.
14084 * @param {Object} options Optional Backbone-like options object to be
14085 * passed in to set.
14086 * @return {AV.Object} self
14087 * @see AV.Object#set
14088 */
14089 setACL: function setACL(acl, options) {
14090 return this.set('ACL', acl, options);
14091 },
14092
14093 disableBeforeHook: function disableBeforeHook() {
14094 this.ignoreHook('beforeSave');
14095 this.ignoreHook('beforeUpdate');
14096 this.ignoreHook('beforeDelete');
14097 },
14098
14099 disableAfterHook: function disableAfterHook() {
14100 this.ignoreHook('afterSave');
14101 this.ignoreHook('afterUpdate');
14102 this.ignoreHook('afterDelete');
14103 },
14104
14105 ignoreHook: function ignoreHook(hookName) {
14106 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
14107 throw new Error('Unsupported hookName: ' + hookName);
14108 }
14109
14110 if (!AV.hookKey) {
14111 throw new Error('ignoreHook required hookKey');
14112 }
14113
14114 if (!this._flags.__ignore_hooks) {
14115 this._flags.__ignore_hooks = [];
14116 }
14117
14118 this._flags.__ignore_hooks.push(hookName);
14119 }
14120 });
14121
14122 /**
14123 * Creates an instance of a subclass of AV.Object for the give classname
14124 * and id.
14125 * @param {String|Function} class the className or a subclass of AV.Object.
14126 * @param {String} id The object id of this model.
14127 * @return {AV.Object} A new subclass instance of AV.Object.
14128 */
14129 AV.Object.createWithoutData = function (klass, id, hasData) {
14130 var _klass = void 0;
14131 if (_.isString(klass)) {
14132 _klass = AV.Object._getSubclass(klass);
14133 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
14134 _klass = klass;
14135 } else {
14136 throw new Error('class must be a string or a subclass of AV.Object.');
14137 }
14138 if (!id) {
14139 throw new TypeError('The objectId must be provided');
14140 }
14141 var object = new _klass();
14142 object.id = id;
14143 object._hasData = hasData;
14144 return object;
14145 };
14146 /**
14147 * Delete objects in batch.
14148 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
14149 * @param {AuthOptions} options
14150 * @return {Promise} A promise that is fulfilled when the save
14151 * completes.
14152 */
14153 AV.Object.destroyAll = function (objects) {
14154 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14155
14156 if (!objects || objects.length === 0) {
14157 return _promise2.default.resolve();
14158 }
14159 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
14160 return (0, _stringify2.default)({
14161 className: object.className,
14162 flags: object._flags
14163 });
14164 });
14165 var body = {
14166 requests: _.map(objectsByClassNameAndFlags, function (objects) {
14167 var ids = _.map(objects, 'id').join(',');
14168 return {
14169 method: 'DELETE',
14170 path: '/1.1/classes/' + objects[0].className + '/' + ids,
14171 body: objects[0]._flags
14172 };
14173 })
14174 };
14175 return _request('batch', null, null, 'POST', body, options).then(function (response) {
14176 var firstError = _.find(response, function (result) {
14177 return !result.success;
14178 });
14179 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
14180 return undefined;
14181 });
14182 };
14183
14184 /**
14185 * Returns the appropriate subclass for making new instances of the given
14186 * className string.
14187 * @private
14188 */
14189 AV.Object._getSubclass = function (className) {
14190 if (!_.isString(className)) {
14191 throw new Error('AV.Object._getSubclass requires a string argument.');
14192 }
14193 var ObjectClass = AV.Object._classMap[className];
14194 if (!ObjectClass) {
14195 ObjectClass = AV.Object.extend(className);
14196 AV.Object._classMap[className] = ObjectClass;
14197 }
14198 return ObjectClass;
14199 };
14200
14201 /**
14202 * Creates an instance of a subclass of AV.Object for the given classname.
14203 * @private
14204 */
14205 AV.Object._create = function (className, attributes, options) {
14206 var ObjectClass = AV.Object._getSubclass(className);
14207 return new ObjectClass(attributes, options);
14208 };
14209
14210 // Set up a map of className to class so that we can create new instances of
14211 // AV Objects from JSON automatically.
14212 AV.Object._classMap = {};
14213
14214 AV.Object._extend = AV._extend;
14215
14216 /**
14217 * Creates a new model with defined attributes,
14218 * It's the same with
14219 * <pre>
14220 * new AV.Object(attributes, options);
14221 * </pre>
14222 * @param {Object} attributes The initial set of data to store in the object.
14223 * @param {Object} options A set of Backbone-like options for creating the
14224 * object. The only option currently supported is "collection".
14225 * @return {AV.Object}
14226 * @since v0.4.4
14227 * @see AV.Object
14228 * @see AV.Object.extend
14229 */
14230 AV.Object['new'] = function (attributes, options) {
14231 return new AV.Object(attributes, options);
14232 };
14233
14234 /**
14235 * Creates a new subclass of AV.Object for the given AV class name.
14236 *
14237 * <p>Every extension of a AV class will inherit from the most recent
14238 * previous extension of that class. When a AV.Object is automatically
14239 * created by parsing JSON, it will use the most recent extension of that
14240 * class.</p>
14241 *
14242 * @example
14243 * var MyClass = AV.Object.extend("MyClass", {
14244 * // Instance properties
14245 * }, {
14246 * // Class properties
14247 * });
14248 *
14249 * @param {String} className The name of the AV class backing this model.
14250 * @param {Object} protoProps Instance properties to add to instances of the
14251 * class returned from this method.
14252 * @param {Object} classProps Class properties to add the class returned from
14253 * this method.
14254 * @return {Class} A new subclass of AV.Object.
14255 */
14256 AV.Object.extend = function (className, protoProps, classProps) {
14257 // Handle the case with only two args.
14258 if (!_.isString(className)) {
14259 if (className && _.has(className, 'className')) {
14260 return AV.Object.extend(className.className, className, protoProps);
14261 } else {
14262 throw new Error("AV.Object.extend's first argument should be the className.");
14263 }
14264 }
14265
14266 // If someone tries to subclass "User", coerce it to the right type.
14267 if (className === 'User') {
14268 className = '_User';
14269 }
14270
14271 var NewClassObject = null;
14272 if (_.has(AV.Object._classMap, className)) {
14273 var OldClassObject = AV.Object._classMap[className];
14274 // This new subclass has been told to extend both from "this" and from
14275 // OldClassObject. This is multiple inheritance, which isn't supported.
14276 // For now, let's just pick one.
14277 if (protoProps || classProps) {
14278 NewClassObject = OldClassObject._extend(protoProps, classProps);
14279 } else {
14280 return OldClassObject;
14281 }
14282 } else {
14283 protoProps = protoProps || {};
14284 protoProps._className = className;
14285 NewClassObject = this._extend(protoProps, classProps);
14286 }
14287 // Extending a subclass should reuse the classname automatically.
14288 NewClassObject.extend = function (arg0) {
14289 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
14290 return AV.Object.extend.apply(NewClassObject, arguments);
14291 }
14292 var newArguments = [className].concat(_.toArray(arguments));
14293 return AV.Object.extend.apply(NewClassObject, newArguments);
14294 };
14295 // Add the query property descriptor.
14296 Object.defineProperty(NewClassObject, 'query', (0, _getOwnPropertyDescriptor2.default)(AV.Object, 'query'));
14297 NewClassObject['new'] = function (attributes, options) {
14298 return new NewClassObject(attributes, options);
14299 };
14300 AV.Object._classMap[className] = NewClassObject;
14301 return NewClassObject;
14302 };
14303
14304 // ES6 class syntax support
14305 Object.defineProperty(AV.Object.prototype, 'className', {
14306 get: function get() {
14307 var className = this._className || this.constructor._LCClassName || this.constructor.name;
14308 // If someone tries to subclass "User", coerce it to the right type.
14309 if (className === 'User') {
14310 return '_User';
14311 }
14312 return className;
14313 }
14314 });
14315
14316 /**
14317 * Register a class.
14318 * If a subclass of <code>AV.Object</code> is defined with your own implement
14319 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
14320 * @param {Function} klass A subclass of <code>AV.Object</code>
14321 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
14322 * @example
14323 * class Person extend AV.Object {}
14324 * AV.Object.register(Person);
14325 */
14326 AV.Object.register = function (klass, name) {
14327 if (!(klass.prototype instanceof AV.Object)) {
14328 throw new Error('registered class is not a subclass of AV.Object');
14329 }
14330 var className = name || klass.name;
14331 if (!className.length) {
14332 throw new Error('registered class must be named');
14333 }
14334 if (name) {
14335 klass._LCClassName = name;
14336 }
14337 AV.Object._classMap[className] = klass;
14338 };
14339
14340 /**
14341 * Get a new Query of the current class
14342 * @name query
14343 * @memberof AV.Object
14344 * @type AV.Query
14345 * @readonly
14346 * @since v3.1.0
14347 * @example
14348 * const Post = AV.Object.extend('Post');
14349 * Post.query.equalTo('author', 'leancloud').find().then();
14350 */
14351 Object.defineProperty(AV.Object, 'query', {
14352 get: function get() {
14353 return new AV.Query(this.prototype.className);
14354 }
14355 });
14356
14357 AV.Object._findUnsavedChildren = function (objects, children, files) {
14358 AV._traverse(objects, function (object) {
14359 if (object instanceof AV.Object) {
14360 if (object.dirty()) {
14361 children.push(object);
14362 }
14363 return;
14364 }
14365
14366 if (object instanceof AV.File) {
14367 if (!object.id) {
14368 files.push(object);
14369 }
14370 return;
14371 }
14372 });
14373 };
14374
14375 AV.Object._canBeSerializedAsValue = function (object) {
14376 var canBeSerializedAsValue = true;
14377
14378 if (object instanceof AV.Object || object instanceof AV.File) {
14379 canBeSerializedAsValue = !!object.id;
14380 } else if (_.isArray(object)) {
14381 AV._arrayEach(object, function (child) {
14382 if (!AV.Object._canBeSerializedAsValue(child)) {
14383 canBeSerializedAsValue = false;
14384 }
14385 });
14386 } else if (_.isObject(object)) {
14387 AV._objectEach(object, function (child) {
14388 if (!AV.Object._canBeSerializedAsValue(child)) {
14389 canBeSerializedAsValue = false;
14390 }
14391 });
14392 }
14393
14394 return canBeSerializedAsValue;
14395 };
14396
14397 AV.Object._deepSaveAsync = function (object, model, options) {
14398 var unsavedChildren = [];
14399 var unsavedFiles = [];
14400 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
14401
14402 unsavedFiles = _.uniq(unsavedFiles);
14403
14404 var promise = _promise2.default.resolve();
14405 _.each(unsavedFiles, function (file) {
14406 promise = promise.then(function () {
14407 return file.save();
14408 });
14409 });
14410
14411 var objects = _.uniq(unsavedChildren);
14412 var remaining = _.uniq(objects);
14413
14414 return promise.then(function () {
14415 return continueWhile(function () {
14416 return remaining.length > 0;
14417 }, function () {
14418 // Gather up all the objects that can be saved in this batch.
14419 var batch = [];
14420 var newRemaining = [];
14421 AV._arrayEach(remaining, function (object) {
14422 if (object._canBeSerialized()) {
14423 batch.push(object);
14424 } else {
14425 newRemaining.push(object);
14426 }
14427 });
14428 remaining = newRemaining;
14429
14430 // If we can't save any objects, there must be a circular reference.
14431 if (batch.length === 0) {
14432 return _promise2.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
14433 }
14434
14435 // Reserve a spot in every object's save queue.
14436 var readyToStart = _promise2.default.resolve(_.map(batch, function (object) {
14437 return object._allPreviousSaves || _promise2.default.resolve();
14438 }));
14439
14440 // Save a single batch, whether previous saves succeeded or failed.
14441 var bathSavePromise = readyToStart.then(function () {
14442 return _request('batch', null, null, 'POST', {
14443 requests: _.map(batch, function (object) {
14444 var method = object.id ? 'PUT' : 'POST';
14445
14446 var json = object._getSaveJSON();
14447
14448 _.extend(json, object._flags);
14449
14450 var route = 'classes';
14451 var className = object.className;
14452 var path = '/' + route + '/' + className;
14453 if (object.className === '_User' && !object.id) {
14454 // Special-case user sign-up.
14455 path = '/users';
14456 }
14457
14458 var path = '/1.1' + path;
14459 if (object.id) {
14460 path = path + '/' + object.id;
14461 }
14462
14463 object._startSave();
14464
14465 return {
14466 method: method,
14467 path: path,
14468 body: json,
14469 params: options && options.fetchWhenSave ? { fetchWhenSave: true } : undefined
14470 };
14471 })
14472 }, options).then(function (response) {
14473 var results = _.map(batch, function (object, i) {
14474 if (response[i].success) {
14475 object._finishSave(object.parse(response[i].success));
14476 return object;
14477 }
14478 object._cancelSave();
14479 return new AVError(response[i].error.code, response[i].error.error);
14480 });
14481 return handleBatchResults(results);
14482 });
14483 });
14484 AV._arrayEach(batch, function (object) {
14485 object._allPreviousSaves = bathSavePromise;
14486 });
14487 return bathSavePromise;
14488 });
14489 }).then(function () {
14490 return object;
14491 });
14492 };
14493};
14494
14495/***/ }),
14496/* 317 */
14497/***/ (function(module, exports, __webpack_require__) {
14498
14499module.exports = { "default": __webpack_require__(318), __esModule: true };
14500
14501/***/ }),
14502/* 318 */
14503/***/ (function(module, exports, __webpack_require__) {
14504
14505__webpack_require__(319);
14506var $Object = __webpack_require__(2).Object;
14507module.exports = function getOwnPropertyDescriptor(it, key) {
14508 return $Object.getOwnPropertyDescriptor(it, key);
14509};
14510
14511
14512/***/ }),
14513/* 319 */
14514/***/ (function(module, exports, __webpack_require__) {
14515
14516// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
14517var toIObject = __webpack_require__(25);
14518var $getOwnPropertyDescriptor = __webpack_require__(94).f;
14519
14520__webpack_require__(89)('getOwnPropertyDescriptor', function () {
14521 return function getOwnPropertyDescriptor(it, key) {
14522 return $getOwnPropertyDescriptor(toIObject(it), key);
14523 };
14524});
14525
14526
14527/***/ }),
14528/* 320 */
14529/***/ (function(module, exports, __webpack_require__) {
14530
14531"use strict";
14532
14533
14534exports.__esModule = true;
14535
14536var _isIterable2 = __webpack_require__(169);
14537
14538var _isIterable3 = _interopRequireDefault(_isIterable2);
14539
14540var _getIterator2 = __webpack_require__(167);
14541
14542var _getIterator3 = _interopRequireDefault(_getIterator2);
14543
14544function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14545
14546exports.default = function () {
14547 function sliceIterator(arr, i) {
14548 var _arr = [];
14549 var _n = true;
14550 var _d = false;
14551 var _e = undefined;
14552
14553 try {
14554 for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
14555 _arr.push(_s.value);
14556
14557 if (i && _arr.length === i) break;
14558 }
14559 } catch (err) {
14560 _d = true;
14561 _e = err;
14562 } finally {
14563 try {
14564 if (!_n && _i["return"]) _i["return"]();
14565 } finally {
14566 if (_d) throw _e;
14567 }
14568 }
14569
14570 return _arr;
14571 }
14572
14573 return function (arr, i) {
14574 if (Array.isArray(arr)) {
14575 return arr;
14576 } else if ((0, _isIterable3.default)(Object(arr))) {
14577 return sliceIterator(arr, i);
14578 } else {
14579 throw new TypeError("Invalid attempt to destructure non-iterable instance");
14580 }
14581 };
14582}();
14583
14584/***/ }),
14585/* 321 */
14586/***/ (function(module, exports, __webpack_require__) {
14587
14588__webpack_require__(56);
14589__webpack_require__(39);
14590module.exports = __webpack_require__(322);
14591
14592
14593/***/ }),
14594/* 322 */
14595/***/ (function(module, exports, __webpack_require__) {
14596
14597var classof = __webpack_require__(71);
14598var ITERATOR = __webpack_require__(7)('iterator');
14599var Iterators = __webpack_require__(32);
14600module.exports = __webpack_require__(2).isIterable = function (it) {
14601 var O = Object(it);
14602 return O[ITERATOR] !== undefined
14603 || '@@iterator' in O
14604 // eslint-disable-next-line no-prototype-builtins
14605 || Iterators.hasOwnProperty(classof(O));
14606};
14607
14608
14609/***/ }),
14610/* 323 */
14611/***/ (function(module, exports, __webpack_require__) {
14612
14613"use strict";
14614
14615
14616var _ = __webpack_require__(0);
14617var AVError = __webpack_require__(29);
14618
14619module.exports = function (AV) {
14620 AV.Role = AV.Object.extend('_Role',
14621 /** @lends AV.Role.prototype */{
14622 // Instance Methods
14623
14624 /**
14625 * Represents a Role on the AV server. Roles represent groupings of
14626 * Users for the purposes of granting permissions (e.g. specifying an ACL
14627 * for an Object). Roles are specified by their sets of child users and
14628 * child roles, all of which are granted any permissions that the parent
14629 * role has.
14630 *
14631 * <p>Roles must have a name (which cannot be changed after creation of the
14632 * role), and must specify an ACL.</p>
14633 * An AV.Role is a local representation of a role persisted to the AV
14634 * cloud.
14635 * @class AV.Role
14636 * @param {String} name The name of the Role to create.
14637 * @param {AV.ACL} acl The ACL for this role.
14638 */
14639 constructor: function constructor(name, acl) {
14640 if (_.isString(name)) {
14641 AV.Object.prototype.constructor.call(this, null, null);
14642 this.setName(name);
14643 } else {
14644 AV.Object.prototype.constructor.call(this, name, acl);
14645 }
14646 if (acl) {
14647 if (!(acl instanceof AV.ACL)) {
14648 throw new TypeError('acl must be an instance of AV.ACL');
14649 } else {
14650 this.setACL(acl);
14651 }
14652 }
14653 },
14654
14655 /**
14656 * Gets the name of the role. You can alternatively call role.get("name")
14657 *
14658 * @return {String} the name of the role.
14659 */
14660 getName: function getName() {
14661 return this.get('name');
14662 },
14663
14664 /**
14665 * Sets the name for a role. This value must be set before the role has
14666 * been saved to the server, and cannot be set once the role has been
14667 * saved.
14668 *
14669 * <p>
14670 * A role's name can only contain alphanumeric characters, _, -, and
14671 * spaces.
14672 * </p>
14673 *
14674 * <p>This is equivalent to calling role.set("name", name)</p>
14675 *
14676 * @param {String} name The name of the role.
14677 */
14678 setName: function setName(name, options) {
14679 return this.set('name', name, options);
14680 },
14681
14682 /**
14683 * Gets the AV.Relation for the AV.Users that are direct
14684 * children of this role. These users are granted any privileges that this
14685 * role has been granted (e.g. read or write access through ACLs). You can
14686 * add or remove users from the role through this relation.
14687 *
14688 * <p>This is equivalent to calling role.relation("users")</p>
14689 *
14690 * @return {AV.Relation} the relation for the users belonging to this
14691 * role.
14692 */
14693 getUsers: function getUsers() {
14694 return this.relation('users');
14695 },
14696
14697 /**
14698 * Gets the AV.Relation for the AV.Roles that are direct
14699 * children of this role. These roles' users are granted any privileges that
14700 * this role has been granted (e.g. read or write access through ACLs). You
14701 * can add or remove child roles from this role through this relation.
14702 *
14703 * <p>This is equivalent to calling role.relation("roles")</p>
14704 *
14705 * @return {AV.Relation} the relation for the roles belonging to this
14706 * role.
14707 */
14708 getRoles: function getRoles() {
14709 return this.relation('roles');
14710 },
14711
14712 /**
14713 * @ignore
14714 */
14715 validate: function validate(attrs, options) {
14716 if ('name' in attrs && attrs.name !== this.getName()) {
14717 var newName = attrs.name;
14718 if (this.id && this.id !== attrs.objectId) {
14719 // Check to see if the objectId being set matches this.id.
14720 // This happens during a fetch -- the id is set before calling fetch.
14721 // Let the name be set in this case.
14722 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
14723 }
14724 if (!_.isString(newName)) {
14725 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
14726 }
14727 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
14728 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
14729 }
14730 }
14731 if (AV.Object.prototype.validate) {
14732 return AV.Object.prototype.validate.call(this, attrs, options);
14733 }
14734 return false;
14735 }
14736 });
14737};
14738
14739/***/ }),
14740/* 324 */
14741/***/ (function(module, exports, __webpack_require__) {
14742
14743"use strict";
14744
14745
14746var _stringify = __webpack_require__(19);
14747
14748var _stringify2 = _interopRequireDefault(_stringify);
14749
14750var _defineProperty2 = __webpack_require__(325);
14751
14752var _defineProperty3 = _interopRequireDefault(_defineProperty2);
14753
14754var _promise = __webpack_require__(3);
14755
14756var _promise2 = _interopRequireDefault(_promise);
14757
14758function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14759
14760var _ = __webpack_require__(0);
14761var uuid = __webpack_require__(159);
14762var AVError = __webpack_require__(29);
14763
14764var _require = __webpack_require__(12),
14765 AVRequest = _require._request,
14766 request = _require.request;
14767
14768var _require2 = __webpack_require__(38),
14769 getAdapter = _require2.getAdapter;
14770
14771var PLATFORM_ANONYMOUS = 'anonymous';
14772var PLATFORM_QQAPP = 'lc_qqapp';
14773
14774var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
14775 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
14776 return function (authData, unionId) {
14777 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
14778 _ref$unionIdPlatform = _ref.unionIdPlatform,
14779 unionIdPlatform = _ref$unionIdPlatform === undefined ? defaultUnionIdPlatform : _ref$unionIdPlatform,
14780 _ref$asMainAccount = _ref.asMainAccount,
14781 asMainAccount = _ref$asMainAccount === undefined ? false : _ref$asMainAccount;
14782
14783 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
14784 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
14785
14786 return _.extend({}, authData, {
14787 platform: unionIdPlatform,
14788 unionid: unionId,
14789 main_account: Boolean(asMainAccount)
14790 });
14791 };
14792};
14793
14794module.exports = function (AV) {
14795 /**
14796 * @class
14797 *
14798 * <p>An AV.User object is a local representation of a user persisted to the
14799 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
14800 * same functionality of an AV.Object, but also extends it with various
14801 * user specific methods, like authentication, signing up, and validation of
14802 * uniqueness.</p>
14803 */
14804 AV.User = AV.Object.extend('_User',
14805 /** @lends AV.User.prototype */{
14806 // Instance Variables
14807 _isCurrentUser: false,
14808
14809 // Instance Methods
14810
14811 /**
14812 * Internal method to handle special fields in a _User response.
14813 * @private
14814 */
14815 _mergeMagicFields: function _mergeMagicFields(attrs) {
14816 if (attrs.sessionToken) {
14817 this._sessionToken = attrs.sessionToken;
14818 delete attrs.sessionToken;
14819 }
14820 return AV.User.__super__._mergeMagicFields.call(this, attrs);
14821 },
14822
14823 /**
14824 * Removes null values from authData (which exist temporarily for
14825 * unlinking)
14826 * @private
14827 */
14828 _cleanupAuthData: function _cleanupAuthData() {
14829 if (!this.isCurrent()) {
14830 return;
14831 }
14832 var authData = this.get('authData');
14833 if (!authData) {
14834 return;
14835 }
14836 AV._objectEach(this.get('authData'), function (value, key) {
14837 if (!authData[key]) {
14838 delete authData[key];
14839 }
14840 });
14841 },
14842
14843 /**
14844 * Synchronizes authData for all providers.
14845 * @private
14846 */
14847 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
14848 var authData = this.get('authData');
14849 if (!authData) {
14850 return;
14851 }
14852
14853 var self = this;
14854 AV._objectEach(this.get('authData'), function (value, key) {
14855 self._synchronizeAuthData(key);
14856 });
14857 },
14858
14859 /**
14860 * Synchronizes auth data for a provider (e.g. puts the access token in the
14861 * right place to be used by the Facebook SDK).
14862 * @private
14863 */
14864 _synchronizeAuthData: function _synchronizeAuthData(provider) {
14865 if (!this.isCurrent()) {
14866 return;
14867 }
14868 var authType;
14869 if (_.isString(provider)) {
14870 authType = provider;
14871 provider = AV.User._authProviders[authType];
14872 } else {
14873 authType = provider.getAuthType();
14874 }
14875 var authData = this.get('authData');
14876 if (!authData || !provider) {
14877 return;
14878 }
14879 var success = provider.restoreAuthentication(authData[authType]);
14880 if (!success) {
14881 this.dissociateAuthData(provider);
14882 }
14883 },
14884
14885 _handleSaveResult: function _handleSaveResult(makeCurrent) {
14886 // Clean up and synchronize the authData object, removing any unset values
14887 if (makeCurrent && !AV._config.disableCurrentUser) {
14888 this._isCurrentUser = true;
14889 }
14890 this._cleanupAuthData();
14891 this._synchronizeAllAuthData();
14892 // Don't keep the password around.
14893 delete this._serverData.password;
14894 this._rebuildEstimatedDataForKey('password');
14895 this._refreshCache();
14896 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
14897 // Some old version of leanengine-node-sdk will overwrite
14898 // AV.User._saveCurrentUser which returns no Promise.
14899 // So we need a Promise wrapper.
14900 return _promise2.default.resolve(AV.User._saveCurrentUser(this));
14901 } else {
14902 return _promise2.default.resolve();
14903 }
14904 },
14905
14906 /**
14907 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
14908 * call linkWith on the user (even if it doesn't exist yet on the server).
14909 * @private
14910 */
14911 _linkWith: function _linkWith(provider, data) {
14912 var _this = this;
14913
14914 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
14915 _ref2$failOnNotExist = _ref2.failOnNotExist,
14916 failOnNotExist = _ref2$failOnNotExist === undefined ? false : _ref2$failOnNotExist;
14917
14918 var authType;
14919 if (_.isString(provider)) {
14920 authType = provider;
14921 provider = AV.User._authProviders[provider];
14922 } else {
14923 authType = provider.getAuthType();
14924 }
14925 if (data) {
14926 return this.save({ authData: (0, _defineProperty3.default)({}, authType, data) }, {
14927 fetchWhenSave: !!this.get('authData'),
14928 _failOnNotExist: failOnNotExist
14929 }).then(function (model) {
14930 return model._handleSaveResult(true).then(function () {
14931 return model;
14932 });
14933 });
14934 } else {
14935 return provider.authenticate().then(function (result) {
14936 return _this._linkWith(provider, result);
14937 });
14938 }
14939 },
14940
14941 /**
14942 * Associate the user with a third party authData.
14943 * @since 3.3.0
14944 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
14945 * @param {string} platform Available platform for sign up.
14946 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
14947 * @example user.associateWithAuthData({
14948 * openid: 'abc123',
14949 * access_token: '123abc',
14950 * expires_in: 1382686496
14951 * }, 'weixin').then(function(user) {
14952 * //Access user here
14953 * }).catch(function(error) {
14954 * //console.error("error: ", error);
14955 * });
14956 */
14957 associateWithAuthData: function associateWithAuthData(authData, platform) {
14958 return this._linkWith(platform, authData);
14959 },
14960
14961
14962 /**
14963 * Associate the user with a third party authData and unionId.
14964 * @since 3.5.0
14965 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
14966 * @param {string} platform Available platform for sign up.
14967 * @param {string} unionId
14968 * @param {Object} [unionLoginOptions]
14969 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
14970 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
14971 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
14972 * @example user.associateWithAuthDataAndUnionId({
14973 * openid: 'abc123',
14974 * access_token: '123abc',
14975 * expires_in: 1382686496
14976 * }, 'weixin', 'union123', {
14977 * unionIdPlatform: 'weixin',
14978 * asMainAccount: true,
14979 * }).then(function(user) {
14980 * //Access user here
14981 * }).catch(function(error) {
14982 * //console.error("error: ", error);
14983 * });
14984 */
14985 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
14986 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
14987 },
14988
14989
14990 /**
14991 * Associate the user with the identity of the current mini-app.
14992 * @since 4.6.0
14993 * @param {Object} [authInfo]
14994 * @param {Object} [option]
14995 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
14996 * @return {Promise<AV.User>}
14997 */
14998 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
14999 var _this2 = this;
15000
15001 if (authInfo === undefined) {
15002 var getAuthInfo = getAdapter('getAuthInfo');
15003 return getAuthInfo().then(function (authInfo) {
15004 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
15005 });
15006 }
15007 return this._linkWith(authInfo.provider, authInfo.authData, option);
15008 },
15009
15010
15011 /**
15012 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
15013 * 仅在 QQ 小程序中可用。
15014 *
15015 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15016 * @since 4.2.0
15017 * @param {Object} [options]
15018 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
15019 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
15020 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15021 * @return {Promise<AV.User>}
15022 */
15023 associateWithQQApp: function associateWithQQApp() {
15024 var _this3 = this;
15025
15026 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15027 _ref3$preferUnionId = _ref3.preferUnionId,
15028 preferUnionId = _ref3$preferUnionId === undefined ? false : _ref3$preferUnionId,
15029 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
15030 unionIdPlatform = _ref3$unionIdPlatform === undefined ? 'qq' : _ref3$unionIdPlatform,
15031 _ref3$asMainAccount = _ref3.asMainAccount,
15032 asMainAccount = _ref3$asMainAccount === undefined ? true : _ref3$asMainAccount;
15033
15034 var getAuthInfo = getAdapter('getAuthInfo');
15035 return getAuthInfo({
15036 preferUnionId: preferUnionId,
15037 asMainAccount: asMainAccount,
15038 platform: unionIdPlatform
15039 }).then(function (authInfo) {
15040 authInfo.provider = PLATFORM_QQAPP;
15041 return _this3.associateWithMiniApp(authInfo);
15042 });
15043 },
15044
15045
15046 /**
15047 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
15048 * 仅在微信小程序中可用。
15049 *
15050 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15051 * @since 3.13.0
15052 * @param {Object} [options]
15053 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
15054 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
15055 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15056 * @return {Promise<AV.User>}
15057 */
15058 associateWithWeapp: function associateWithWeapp() {
15059 var _this4 = this;
15060
15061 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15062 _ref4$preferUnionId = _ref4.preferUnionId,
15063 preferUnionId = _ref4$preferUnionId === undefined ? false : _ref4$preferUnionId,
15064 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
15065 unionIdPlatform = _ref4$unionIdPlatform === undefined ? 'weixin' : _ref4$unionIdPlatform,
15066 _ref4$asMainAccount = _ref4.asMainAccount,
15067 asMainAccount = _ref4$asMainAccount === undefined ? true : _ref4$asMainAccount;
15068
15069 var getAuthInfo = getAdapter('getAuthInfo');
15070 return getAuthInfo({
15071 preferUnionId: preferUnionId,
15072 asMainAccount: asMainAccount,
15073 platform: unionIdPlatform
15074 }).then(function (authInfo) {
15075 return _this4.associateWithMiniApp(authInfo);
15076 });
15077 },
15078
15079
15080 /**
15081 * @deprecated renamed to {@link AV.User#associateWithWeapp}
15082 * @return {Promise<AV.User>}
15083 */
15084 linkWithWeapp: function linkWithWeapp(options) {
15085 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
15086 return this.associateWithWeapp(options);
15087 },
15088
15089
15090 /**
15091 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
15092 * 仅在 QQ 小程序中可用。
15093 *
15094 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15095 * @since 4.2.0
15096 * @param {string} unionId
15097 * @param {Object} [unionOptions]
15098 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
15099 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15100 * @return {Promise<AV.User>}
15101 */
15102 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
15103 var _this5 = this;
15104
15105 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15106 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
15107 unionIdPlatform = _ref5$unionIdPlatform === undefined ? 'qq' : _ref5$unionIdPlatform,
15108 _ref5$asMainAccount = _ref5.asMainAccount,
15109 asMainAccount = _ref5$asMainAccount === undefined ? false : _ref5$asMainAccount;
15110
15111 var getAuthInfo = getAdapter('getAuthInfo');
15112 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15113 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15114 authInfo.provider = PLATFORM_QQAPP;
15115 return _this5.associateWithMiniApp(authInfo);
15116 });
15117 },
15118
15119
15120 /**
15121 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
15122 * 仅在微信小程序中可用。
15123 *
15124 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15125 * @since 3.13.0
15126 * @param {string} unionId
15127 * @param {Object} [unionOptions]
15128 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
15129 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15130 * @return {Promise<AV.User>}
15131 */
15132 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
15133 var _this6 = this;
15134
15135 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15136 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
15137 unionIdPlatform = _ref6$unionIdPlatform === undefined ? 'weixin' : _ref6$unionIdPlatform,
15138 _ref6$asMainAccount = _ref6.asMainAccount,
15139 asMainAccount = _ref6$asMainAccount === undefined ? false : _ref6$asMainAccount;
15140
15141 var getAuthInfo = getAdapter('getAuthInfo');
15142 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15143 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15144 return _this6.associateWithMiniApp(authInfo);
15145 });
15146 },
15147
15148
15149 /**
15150 * Unlinks a user from a service.
15151 * @param {string} platform
15152 * @return {Promise<AV.User>}
15153 * @since 3.3.0
15154 */
15155 dissociateAuthData: function dissociateAuthData(provider) {
15156 this.unset('authData.' + provider);
15157 return this.save().then(function (model) {
15158 return model._handleSaveResult(true).then(function () {
15159 return model;
15160 });
15161 });
15162 },
15163
15164
15165 /**
15166 * @private
15167 * @deprecated
15168 */
15169 _unlinkFrom: function _unlinkFrom(provider) {
15170 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
15171 return this.dissociateAuthData(provider);
15172 },
15173
15174
15175 /**
15176 * Checks whether a user is linked to a service.
15177 * @private
15178 */
15179 _isLinked: function _isLinked(provider) {
15180 var authType;
15181 if (_.isString(provider)) {
15182 authType = provider;
15183 } else {
15184 authType = provider.getAuthType();
15185 }
15186 var authData = this.get('authData') || {};
15187 return !!authData[authType];
15188 },
15189
15190 /**
15191 * Checks whether a user is anonymous.
15192 * @since 3.9.0
15193 * @return {boolean}
15194 */
15195 isAnonymous: function isAnonymous() {
15196 return this._isLinked(PLATFORM_ANONYMOUS);
15197 },
15198
15199
15200 logOut: function logOut() {
15201 this._logOutWithAll();
15202 this._isCurrentUser = false;
15203 },
15204
15205 /**
15206 * Deauthenticates all providers.
15207 * @private
15208 */
15209 _logOutWithAll: function _logOutWithAll() {
15210 var authData = this.get('authData');
15211 if (!authData) {
15212 return;
15213 }
15214 var self = this;
15215 AV._objectEach(this.get('authData'), function (value, key) {
15216 self._logOutWith(key);
15217 });
15218 },
15219
15220 /**
15221 * Deauthenticates a single provider (e.g. removing access tokens from the
15222 * Facebook SDK).
15223 * @private
15224 */
15225 _logOutWith: function _logOutWith(provider) {
15226 if (!this.isCurrent()) {
15227 return;
15228 }
15229 if (_.isString(provider)) {
15230 provider = AV.User._authProviders[provider];
15231 }
15232 if (provider && provider.deauthenticate) {
15233 provider.deauthenticate();
15234 }
15235 },
15236
15237 /**
15238 * Signs up a new user. You should call this instead of save for
15239 * new AV.Users. This will create a new AV.User on the server, and
15240 * also persist the session on disk so that you can access the user using
15241 * <code>current</code>.
15242 *
15243 * <p>A username and password must be set before calling signUp.</p>
15244 *
15245 * @param {Object} attrs Extra fields to set on the new user, or null.
15246 * @param {AuthOptions} options
15247 * @return {Promise} A promise that is fulfilled when the signup
15248 * finishes.
15249 * @see AV.User.signUp
15250 */
15251 signUp: function signUp(attrs, options) {
15252 var error;
15253
15254 var username = attrs && attrs.username || this.get('username');
15255 if (!username || username === '') {
15256 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
15257 throw error;
15258 }
15259
15260 var password = attrs && attrs.password || this.get('password');
15261 if (!password || password === '') {
15262 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
15263 throw error;
15264 }
15265
15266 return this.save(attrs, options).then(function (model) {
15267 if (model.isAnonymous()) {
15268 model.unset('authData.' + PLATFORM_ANONYMOUS);
15269 model._opSetQueue = [{}];
15270 }
15271 return model._handleSaveResult(true).then(function () {
15272 return model;
15273 });
15274 });
15275 },
15276
15277 /**
15278 * Signs up a new user with mobile phone and sms code.
15279 * You should call this instead of save for
15280 * new AV.Users. This will create a new AV.User on the server, and
15281 * also persist the session on disk so that you can access the user using
15282 * <code>current</code>.
15283 *
15284 * <p>A username and password must be set before calling signUp.</p>
15285 *
15286 * @param {Object} attrs Extra fields to set on the new user, or null.
15287 * @param {AuthOptions} options
15288 * @return {Promise} A promise that is fulfilled when the signup
15289 * finishes.
15290 * @see AV.User.signUpOrlogInWithMobilePhone
15291 * @see AV.Cloud.requestSmsCode
15292 */
15293 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
15294 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15295
15296 var error;
15297
15298 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
15299 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
15300 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
15301 throw error;
15302 }
15303
15304 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
15305 if (!smsCode || smsCode === '') {
15306 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
15307 throw error;
15308 }
15309
15310 options._makeRequest = function (route, className, id, method, json) {
15311 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
15312 };
15313 return this.save(attrs, options).then(function (model) {
15314 delete model.attributes.smsCode;
15315 delete model._serverData.smsCode;
15316 return model._handleSaveResult(true).then(function () {
15317 return model;
15318 });
15319 });
15320 },
15321
15322 /**
15323 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
15324 * @since 3.7.0
15325 */
15326 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
15327 return this._linkWith(platform, authData, options);
15328 },
15329
15330
15331 /**
15332 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
15333 * @since 3.7.0
15334 */
15335 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
15336 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
15337 },
15338
15339
15340 /**
15341 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
15342 * @deprecated please use {@link AV.User#loginWithMiniApp}
15343 * @since 3.7.0
15344 * @param {Object} [options]
15345 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15346 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
15347 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
15348 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15349 * @return {Promise<AV.User>}
15350 */
15351 loginWithWeapp: function loginWithWeapp() {
15352 var _this7 = this;
15353
15354 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15355 _ref7$preferUnionId = _ref7.preferUnionId,
15356 preferUnionId = _ref7$preferUnionId === undefined ? false : _ref7$preferUnionId,
15357 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
15358 unionIdPlatform = _ref7$unionIdPlatform === undefined ? 'weixin' : _ref7$unionIdPlatform,
15359 _ref7$asMainAccount = _ref7.asMainAccount,
15360 asMainAccount = _ref7$asMainAccount === undefined ? true : _ref7$asMainAccount,
15361 _ref7$failOnNotExist = _ref7.failOnNotExist,
15362 failOnNotExist = _ref7$failOnNotExist === undefined ? false : _ref7$failOnNotExist;
15363
15364 var getAuthInfo = getAdapter('getAuthInfo');
15365 return getAuthInfo({
15366 preferUnionId: preferUnionId,
15367 asMainAccount: asMainAccount,
15368 platform: unionIdPlatform
15369 }).then(function (authInfo) {
15370 return _this7.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15371 });
15372 },
15373
15374
15375 /**
15376 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
15377 * @deprecated please use {@link AV.User#loginWithMiniApp}
15378 * @since 3.13.0
15379 */
15380 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
15381 var _this8 = this;
15382
15383 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15384 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
15385 unionIdPlatform = _ref8$unionIdPlatform === undefined ? 'weixin' : _ref8$unionIdPlatform,
15386 _ref8$asMainAccount = _ref8.asMainAccount,
15387 asMainAccount = _ref8$asMainAccount === undefined ? false : _ref8$asMainAccount,
15388 _ref8$failOnNotExist = _ref8.failOnNotExist,
15389 failOnNotExist = _ref8$failOnNotExist === undefined ? false : _ref8$failOnNotExist;
15390
15391 var getAuthInfo = getAdapter('getAuthInfo');
15392 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15393 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15394 return _this8.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15395 });
15396 },
15397
15398
15399 /**
15400 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
15401 * @deprecated please use {@link AV.User#loginWithMiniApp}
15402 * @since 4.2.0
15403 * @param {Object} [options]
15404 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15405 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
15406 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
15407 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15408 */
15409 loginWithQQApp: function loginWithQQApp() {
15410 var _this9 = this;
15411
15412 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15413 _ref9$preferUnionId = _ref9.preferUnionId,
15414 preferUnionId = _ref9$preferUnionId === undefined ? false : _ref9$preferUnionId,
15415 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
15416 unionIdPlatform = _ref9$unionIdPlatform === undefined ? 'qq' : _ref9$unionIdPlatform,
15417 _ref9$asMainAccount = _ref9.asMainAccount,
15418 asMainAccount = _ref9$asMainAccount === undefined ? true : _ref9$asMainAccount,
15419 _ref9$failOnNotExist = _ref9.failOnNotExist,
15420 failOnNotExist = _ref9$failOnNotExist === undefined ? false : _ref9$failOnNotExist;
15421
15422 var getAuthInfo = getAdapter('getAuthInfo');
15423 return getAuthInfo({
15424 preferUnionId: preferUnionId,
15425 asMainAccount: asMainAccount,
15426 platform: unionIdPlatform
15427 }).then(function (authInfo) {
15428 authInfo.provider = PLATFORM_QQAPP;
15429 return _this9.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15430 });
15431 },
15432
15433
15434 /**
15435 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
15436 * @deprecated please use {@link AV.User#loginWithMiniApp}
15437 * @since 4.2.0
15438 */
15439 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
15440 var _this10 = this;
15441
15442 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15443 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
15444 unionIdPlatform = _ref10$unionIdPlatfor === undefined ? 'qq' : _ref10$unionIdPlatfor,
15445 _ref10$asMainAccount = _ref10.asMainAccount,
15446 asMainAccount = _ref10$asMainAccount === undefined ? false : _ref10$asMainAccount,
15447 _ref10$failOnNotExist = _ref10.failOnNotExist,
15448 failOnNotExist = _ref10$failOnNotExist === undefined ? false : _ref10$failOnNotExist;
15449
15450 var getAuthInfo = getAdapter('getAuthInfo');
15451 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15452 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15453 authInfo.provider = PLATFORM_QQAPP;
15454 return _this10.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15455 });
15456 },
15457
15458
15459 /**
15460 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
15461 * @since 4.6.0
15462 */
15463 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
15464 var _this11 = this;
15465
15466 if (authInfo === undefined) {
15467 var getAuthInfo = getAdapter('getAuthInfo');
15468 return getAuthInfo().then(function (authInfo) {
15469 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
15470 });
15471 }
15472 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
15473 },
15474
15475
15476 /**
15477 * Logs in a AV.User. On success, this saves the session to localStorage,
15478 * so you can retrieve the currently logged in user using
15479 * <code>current</code>.
15480 *
15481 * <p>A username and password must be set before calling logIn.</p>
15482 *
15483 * @see AV.User.logIn
15484 * @return {Promise} A promise that is fulfilled with the user when
15485 * the login is complete.
15486 */
15487 logIn: function logIn() {
15488 var model = this;
15489 var request = AVRequest('login', null, null, 'POST', this.toJSON());
15490 return request.then(function (resp) {
15491 var serverAttrs = model.parse(resp);
15492 model._finishFetch(serverAttrs);
15493 return model._handleSaveResult(true).then(function () {
15494 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
15495 return model;
15496 });
15497 });
15498 },
15499 /**
15500 * @see AV.Object#save
15501 */
15502 save: function save(arg1, arg2, arg3) {
15503 var attrs, options;
15504 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
15505 attrs = arg1;
15506 options = arg2;
15507 } else {
15508 attrs = {};
15509 attrs[arg1] = arg2;
15510 options = arg3;
15511 }
15512 options = options || {};
15513
15514 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
15515 return model._handleSaveResult(false).then(function () {
15516 return model;
15517 });
15518 });
15519 },
15520
15521 /**
15522 * Follow a user
15523 * @since 0.3.0
15524 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
15525 * @param {AV.User | String} options.user The target user or user's objectId to follow.
15526 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
15527 * conditions of followerQuery/followeeQuery.
15528 * @param {AuthOptions} [authOptions]
15529 */
15530 follow: function follow(options, authOptions) {
15531 if (!this.id) {
15532 throw new Error('Please signin.');
15533 }
15534 var user = void 0;
15535 var attributes = void 0;
15536 if (options.user) {
15537 user = options.user;
15538 attributes = options.attributes;
15539 } else {
15540 user = options;
15541 }
15542 var userObjectId = _.isString(user) ? user : user.id;
15543 if (!userObjectId) {
15544 throw new Error('Invalid target user.');
15545 }
15546 var route = 'users/' + this.id + '/friendship/' + userObjectId;
15547 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
15548 return request;
15549 },
15550
15551 /**
15552 * Unfollow a user.
15553 * @since 0.3.0
15554 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
15555 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
15556 * @param {AuthOptions} [authOptions]
15557 */
15558 unfollow: function unfollow(options, authOptions) {
15559 if (!this.id) {
15560 throw new Error('Please signin.');
15561 }
15562 var user = void 0;
15563 if (options.user) {
15564 user = options.user;
15565 } else {
15566 user = options;
15567 }
15568 var userObjectId = _.isString(user) ? user : user.id;
15569 if (!userObjectId) {
15570 throw new Error('Invalid target user.');
15571 }
15572 var route = 'users/' + this.id + '/friendship/' + userObjectId;
15573 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
15574 return request;
15575 },
15576
15577 /**
15578 * Get the user's followers and followees.
15579 * @since 4.8.0
15580 * @param {Object} [options]
15581 * @param {Number} [options.skip]
15582 * @param {Number} [options.limit]
15583 * @param {AuthOptions} [authOptions]
15584 */
15585 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
15586 if (!this.id) {
15587 throw new Error('Please signin.');
15588 }
15589 return request({
15590 method: 'GET',
15591 path: '/users/' + this.id + '/followersAndFollowees',
15592 query: {
15593 skip: options && options.skip,
15594 limit: options && options.limit,
15595 include: 'follower,followee',
15596 keys: 'follower,followee'
15597 },
15598 authOptions: authOptions
15599 }).then(function (_ref11) {
15600 var followers = _ref11.followers,
15601 followees = _ref11.followees;
15602 return {
15603 followers: followers.map(function (_ref12) {
15604 var follower = _ref12.follower;
15605 return AV._decode(follower);
15606 }),
15607 followees: followees.map(function (_ref13) {
15608 var followee = _ref13.followee;
15609 return AV._decode(followee);
15610 })
15611 };
15612 });
15613 },
15614
15615 /**
15616 *Create a follower query to query the user's followers.
15617 * @since 0.3.0
15618 * @see AV.User#followerQuery
15619 */
15620 followerQuery: function followerQuery() {
15621 return AV.User.followerQuery(this.id);
15622 },
15623
15624 /**
15625 *Create a followee query to query the user's followees.
15626 * @since 0.3.0
15627 * @see AV.User#followeeQuery
15628 */
15629 followeeQuery: function followeeQuery() {
15630 return AV.User.followeeQuery(this.id);
15631 },
15632
15633 /**
15634 * @see AV.Object#fetch
15635 */
15636 fetch: function fetch(fetchOptions, options) {
15637 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
15638 return model._handleSaveResult(false).then(function () {
15639 return model;
15640 });
15641 });
15642 },
15643
15644 /**
15645 * Update user's new password safely based on old password.
15646 * @param {String} oldPassword the old password.
15647 * @param {String} newPassword the new password.
15648 * @param {AuthOptions} options
15649 */
15650 updatePassword: function updatePassword(oldPassword, newPassword, options) {
15651 var _this12 = this;
15652
15653 var route = 'users/' + this.id + '/updatePassword';
15654 var params = {
15655 old_password: oldPassword,
15656 new_password: newPassword
15657 };
15658 var request = AVRequest(route, null, null, 'PUT', params, options);
15659 return request.then(function (resp) {
15660 _this12._finishFetch(_this12.parse(resp));
15661 return _this12._handleSaveResult(true).then(function () {
15662 return resp;
15663 });
15664 });
15665 },
15666
15667 /**
15668 * Returns true if <code>current</code> would return this user.
15669 * @see AV.User#current
15670 */
15671 isCurrent: function isCurrent() {
15672 return this._isCurrentUser;
15673 },
15674
15675 /**
15676 * Returns get("username").
15677 * @return {String}
15678 * @see AV.Object#get
15679 */
15680 getUsername: function getUsername() {
15681 return this.get('username');
15682 },
15683
15684 /**
15685 * Returns get("mobilePhoneNumber").
15686 * @return {String}
15687 * @see AV.Object#get
15688 */
15689 getMobilePhoneNumber: function getMobilePhoneNumber() {
15690 return this.get('mobilePhoneNumber');
15691 },
15692
15693 /**
15694 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
15695 * @param {String} mobilePhoneNumber
15696 * @return {Boolean}
15697 * @see AV.Object#set
15698 */
15699 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
15700 return this.set('mobilePhoneNumber', phone, options);
15701 },
15702
15703 /**
15704 * Calls set("username", username, options) and returns the result.
15705 * @param {String} username
15706 * @return {Boolean}
15707 * @see AV.Object#set
15708 */
15709 setUsername: function setUsername(username, options) {
15710 return this.set('username', username, options);
15711 },
15712
15713 /**
15714 * Calls set("password", password, options) and returns the result.
15715 * @param {String} password
15716 * @return {Boolean}
15717 * @see AV.Object#set
15718 */
15719 setPassword: function setPassword(password, options) {
15720 return this.set('password', password, options);
15721 },
15722
15723 /**
15724 * Returns get("email").
15725 * @return {String}
15726 * @see AV.Object#get
15727 */
15728 getEmail: function getEmail() {
15729 return this.get('email');
15730 },
15731
15732 /**
15733 * Calls set("email", email, options) and returns the result.
15734 * @param {String} email
15735 * @param {AuthOptions} options
15736 * @return {Boolean}
15737 * @see AV.Object#set
15738 */
15739 setEmail: function setEmail(email, options) {
15740 return this.set('email', email, options);
15741 },
15742
15743 /**
15744 * Checks whether this user is the current user and has been authenticated.
15745 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
15746 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
15747 * @return (Boolean) whether this user is the current user and is logged in.
15748 */
15749 authenticated: function authenticated() {
15750 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
15751 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
15752 },
15753
15754 /**
15755 * Detects if current sessionToken is valid.
15756 *
15757 * @since 2.0.0
15758 * @return Promise.<Boolean>
15759 */
15760 isAuthenticated: function isAuthenticated() {
15761 var _this13 = this;
15762
15763 return _promise2.default.resolve().then(function () {
15764 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
15765 return true;
15766 }, function (error) {
15767 if (error.code === 211) {
15768 return false;
15769 }
15770 throw error;
15771 });
15772 });
15773 },
15774
15775
15776 /**
15777 * Get sessionToken of current user.
15778 * @return {String} sessionToken
15779 */
15780 getSessionToken: function getSessionToken() {
15781 return this._sessionToken;
15782 },
15783
15784
15785 /**
15786 * Refresh sessionToken of current user.
15787 * @since 2.1.0
15788 * @param {AuthOptions} [options]
15789 * @return {Promise.<AV.User>} user with refreshed sessionToken
15790 */
15791 refreshSessionToken: function refreshSessionToken(options) {
15792 var _this14 = this;
15793
15794 return AVRequest('users/' + this.id + '/refreshSessionToken', null, null, 'PUT', null, options).then(function (response) {
15795 _this14._finishFetch(response);
15796 return _this14._handleSaveResult(true).then(function () {
15797 return _this14;
15798 });
15799 });
15800 },
15801
15802
15803 /**
15804 * Get this user's Roles.
15805 * @param {AuthOptions} [options]
15806 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
15807 * the query is complete.
15808 */
15809 getRoles: function getRoles(options) {
15810 return AV.Relation.reverseQuery('_Role', 'users', this).find(options);
15811 }
15812 },
15813 /** @lends AV.User */{
15814 // Class Variables
15815
15816 // The currently logged-in user.
15817 _currentUser: null,
15818
15819 // Whether currentUser is known to match the serialized version on disk.
15820 // This is useful for saving a localstorage check if you try to load
15821 // _currentUser frequently while there is none stored.
15822 _currentUserMatchesDisk: false,
15823
15824 // The localStorage key suffix that the current user is stored under.
15825 _CURRENT_USER_KEY: 'currentUser',
15826
15827 // The mapping of auth provider names to actual providers
15828 _authProviders: {},
15829
15830 // Class Methods
15831
15832 /**
15833 * Signs up a new user with a username (or email) and password.
15834 * This will create a new AV.User on the server, and also persist the
15835 * session in localStorage so that you can access the user using
15836 * {@link #current}.
15837 *
15838 * @param {String} username The username (or email) to sign up with.
15839 * @param {String} password The password to sign up with.
15840 * @param {Object} [attrs] Extra fields to set on the new user.
15841 * @param {AuthOptions} [options]
15842 * @return {Promise} A promise that is fulfilled with the user when
15843 * the signup completes.
15844 * @see AV.User#signUp
15845 */
15846 signUp: function signUp(username, password, attrs, options) {
15847 attrs = attrs || {};
15848 attrs.username = username;
15849 attrs.password = password;
15850 var user = AV.Object._create('_User');
15851 return user.signUp(attrs, options);
15852 },
15853
15854 /**
15855 * Logs in a user with a username (or email) and password. On success, this
15856 * saves the session to disk, so you can retrieve the currently logged in
15857 * user using <code>current</code>.
15858 *
15859 * @param {String} username The username (or email) to log in with.
15860 * @param {String} password The password to log in with.
15861 * @return {Promise} A promise that is fulfilled with the user when
15862 * the login completes.
15863 * @see AV.User#logIn
15864 */
15865 logIn: function logIn(username, password) {
15866 var user = AV.Object._create('_User');
15867 user._finishFetch({ username: username, password: password });
15868 return user.logIn();
15869 },
15870
15871 /**
15872 * Logs in a user with a session token. On success, this saves the session
15873 * to disk, so you can retrieve the currently logged in user using
15874 * <code>current</code>.
15875 *
15876 * @param {String} sessionToken The sessionToken to log in with.
15877 * @return {Promise} A promise that is fulfilled with the user when
15878 * the login completes.
15879 */
15880 become: function become(sessionToken) {
15881 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
15882 return user._handleSaveResult(true).then(function () {
15883 return user;
15884 });
15885 });
15886 },
15887
15888 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
15889 if (sessionToken === undefined) {
15890 return _promise2.default.reject(new Error('The sessionToken cannot be undefined'));
15891 }
15892
15893 var user = AV.Object._create('_User');
15894 return request({
15895 method: 'GET',
15896 path: '/users/me',
15897 authOptions: {
15898 sessionToken: sessionToken
15899 }
15900 }).then(function (resp) {
15901 var serverAttrs = user.parse(resp);
15902 user._finishFetch(serverAttrs);
15903 return user;
15904 });
15905 },
15906
15907 /**
15908 * Logs in a user with a mobile phone number and sms code sent by
15909 * AV.User.requestLoginSmsCode.On success, this
15910 * saves the session to disk, so you can retrieve the currently logged in
15911 * user using <code>current</code>.
15912 *
15913 * @param {String} mobilePhone The user's mobilePhoneNumber
15914 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
15915 * @return {Promise} A promise that is fulfilled with the user when
15916 * the login completes.
15917 * @see AV.User#logIn
15918 */
15919 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
15920 var user = AV.Object._create('_User');
15921 user._finishFetch({ mobilePhoneNumber: mobilePhone, smsCode: smsCode });
15922 return user.logIn();
15923 },
15924
15925 /**
15926 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
15927 * On success, this saves the session to disk, so you can retrieve the currently
15928 * logged in user using <code>current</code>.
15929 *
15930 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
15931 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
15932 * @param {Object} attributes The user's other attributes such as username etc.
15933 * @param {AuthOptions} options
15934 * @return {Promise} A promise that is fulfilled with the user when
15935 * the login completes.
15936 * @see AV.User#signUpOrlogInWithMobilePhone
15937 * @see AV.Cloud.requestSmsCode
15938 */
15939 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
15940 attrs = attrs || {};
15941 attrs.mobilePhoneNumber = mobilePhoneNumber;
15942 attrs.smsCode = smsCode;
15943 var user = AV.Object._create('_User');
15944 return user.signUpOrlogInWithMobilePhone(attrs, options);
15945 },
15946
15947 /**
15948 * Logs in a user with a mobile phone number and password. On success, this
15949 * saves the session to disk, so you can retrieve the currently logged in
15950 * user using <code>current</code>.
15951 *
15952 * @param {String} mobilePhone The user's mobilePhoneNumber
15953 * @param {String} password The password to log in with.
15954 * @return {Promise} A promise that is fulfilled with the user when
15955 * the login completes.
15956 * @see AV.User#logIn
15957 */
15958 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
15959 var user = AV.Object._create('_User');
15960 user._finishFetch({
15961 mobilePhoneNumber: mobilePhone,
15962 password: password
15963 });
15964 return user.logIn();
15965 },
15966
15967 /**
15968 * Logs in a user with email and password.
15969 *
15970 * @since 3.13.0
15971 * @param {String} email The user's email.
15972 * @param {String} password The password to log in with.
15973 * @return {Promise} A promise that is fulfilled with the user when
15974 * the login completes.
15975 */
15976 loginWithEmail: function loginWithEmail(email, password) {
15977 var user = AV.Object._create('_User');
15978 user._finishFetch({
15979 email: email,
15980 password: password
15981 });
15982 return user.logIn();
15983 },
15984
15985
15986 /**
15987 * Signs up or logs in a user with a third party auth data(AccessToken).
15988 * On success, this saves the session to disk, so you can retrieve the currently
15989 * logged in user using <code>current</code>.
15990 *
15991 * @since 3.7.0
15992 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
15993 * @param {string} platform Available platform for sign up.
15994 * @param {Object} [options]
15995 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15996 * @return {Promise} A promise that is fulfilled with the user when
15997 * the login completes.
15998 * @example AV.User.loginWithAuthData({
15999 * openid: 'abc123',
16000 * access_token: '123abc',
16001 * expires_in: 1382686496
16002 * }, 'weixin').then(function(user) {
16003 * //Access user here
16004 * }).catch(function(error) {
16005 * //console.error("error: ", error);
16006 * });
16007 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
16008 */
16009 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
16010 return AV.User._logInWith(platform, authData, options);
16011 },
16012
16013
16014 /**
16015 * @deprecated renamed to {@link AV.User.loginWithAuthData}
16016 */
16017 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
16018 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
16019 return this.loginWithAuthData.apply(this, arguments);
16020 },
16021
16022
16023 /**
16024 * Signs up or logs in a user with a third party authData and unionId.
16025 * @since 3.7.0
16026 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
16027 * @param {string} platform Available platform for sign up.
16028 * @param {string} unionId
16029 * @param {Object} [unionLoginOptions]
16030 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
16031 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16032 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
16033 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
16034 * @example AV.User.loginWithAuthDataAndUnionId({
16035 * openid: 'abc123',
16036 * access_token: '123abc',
16037 * expires_in: 1382686496
16038 * }, 'weixin', 'union123', {
16039 * unionIdPlatform: 'weixin',
16040 * asMainAccount: true,
16041 * }).then(function(user) {
16042 * //Access user here
16043 * }).catch(function(error) {
16044 * //console.error("error: ", error);
16045 * });
16046 */
16047 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
16048 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
16049 },
16050
16051
16052 /**
16053 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
16054 * @since 3.5.0
16055 */
16056 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
16057 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
16058 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
16059 },
16060
16061
16062 /**
16063 * Merge unionId into authInfo.
16064 * @since 4.6.0
16065 * @param {Object} authInfo
16066 * @param {String} unionId
16067 * @param {Object} [unionIdOption]
16068 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
16069 */
16070 mergeUnionId: function mergeUnionId(authInfo, unionId) {
16071 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
16072 _ref14$asMainAccount = _ref14.asMainAccount,
16073 asMainAccount = _ref14$asMainAccount === undefined ? false : _ref14$asMainAccount;
16074
16075 authInfo = JSON.parse((0, _stringify2.default)(authInfo));
16076 var _authInfo = authInfo,
16077 authData = _authInfo.authData,
16078 platform = _authInfo.platform;
16079
16080 authData.platform = platform;
16081 authData.main_account = asMainAccount;
16082 authData.unionid = unionId;
16083 return authInfo;
16084 },
16085
16086
16087 /**
16088 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
16089 * 仅在微信小程序中可用。
16090 *
16091 * @deprecated please use {@link AV.User.loginWithMiniApp}
16092 * @since 2.0.0
16093 * @param {Object} [options]
16094 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
16095 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
16096 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
16097 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
16098 * @return {Promise.<AV.User>}
16099 */
16100 loginWithWeapp: function loginWithWeapp() {
16101 var _this15 = this;
16102
16103 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16104 _ref15$preferUnionId = _ref15.preferUnionId,
16105 preferUnionId = _ref15$preferUnionId === undefined ? false : _ref15$preferUnionId,
16106 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
16107 unionIdPlatform = _ref15$unionIdPlatfor === undefined ? 'weixin' : _ref15$unionIdPlatfor,
16108 _ref15$asMainAccount = _ref15.asMainAccount,
16109 asMainAccount = _ref15$asMainAccount === undefined ? true : _ref15$asMainAccount,
16110 _ref15$failOnNotExist = _ref15.failOnNotExist,
16111 failOnNotExist = _ref15$failOnNotExist === undefined ? false : _ref15$failOnNotExist;
16112
16113 var getAuthInfo = getAdapter('getAuthInfo');
16114 return getAuthInfo({
16115 preferUnionId: preferUnionId,
16116 asMainAccount: asMainAccount,
16117 platform: unionIdPlatform
16118 }).then(function (authInfo) {
16119 return _this15.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16120 });
16121 },
16122
16123
16124 /**
16125 * 使用当前使用微信小程序的微信用户身份注册或登录,
16126 * 仅在微信小程序中可用。
16127 *
16128 * @deprecated please use {@link AV.User.loginWithMiniApp}
16129 * @since 3.13.0
16130 * @param {Object} [unionLoginOptions]
16131 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
16132 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16133 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
16134 */
16135 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
16136 var _this16 = this;
16137
16138 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
16139 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
16140 unionIdPlatform = _ref16$unionIdPlatfor === undefined ? 'weixin' : _ref16$unionIdPlatfor,
16141 _ref16$asMainAccount = _ref16.asMainAccount,
16142 asMainAccount = _ref16$asMainAccount === undefined ? false : _ref16$asMainAccount,
16143 _ref16$failOnNotExist = _ref16.failOnNotExist,
16144 failOnNotExist = _ref16$failOnNotExist === undefined ? false : _ref16$failOnNotExist;
16145
16146 var getAuthInfo = getAdapter('getAuthInfo');
16147 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
16148 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
16149 return _this16.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16150 });
16151 },
16152
16153
16154 /**
16155 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
16156 * 仅在 QQ 小程序中可用。
16157 *
16158 * @deprecated please use {@link AV.User.loginWithMiniApp}
16159 * @since 4.2.0
16160 * @param {Object} [options]
16161 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
16162 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
16163 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
16164 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
16165 * @return {Promise.<AV.User>}
16166 */
16167 loginWithQQApp: function loginWithQQApp() {
16168 var _this17 = this;
16169
16170 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16171 _ref17$preferUnionId = _ref17.preferUnionId,
16172 preferUnionId = _ref17$preferUnionId === undefined ? false : _ref17$preferUnionId,
16173 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
16174 unionIdPlatform = _ref17$unionIdPlatfor === undefined ? 'qq' : _ref17$unionIdPlatfor,
16175 _ref17$asMainAccount = _ref17.asMainAccount,
16176 asMainAccount = _ref17$asMainAccount === undefined ? true : _ref17$asMainAccount,
16177 _ref17$failOnNotExist = _ref17.failOnNotExist,
16178 failOnNotExist = _ref17$failOnNotExist === undefined ? false : _ref17$failOnNotExist;
16179
16180 var getAuthInfo = getAdapter('getAuthInfo');
16181 return getAuthInfo({
16182 preferUnionId: preferUnionId,
16183 asMainAccount: asMainAccount,
16184 platform: unionIdPlatform
16185 }).then(function (authInfo) {
16186 authInfo.provider = PLATFORM_QQAPP;
16187 return _this17.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16188 });
16189 },
16190
16191
16192 /**
16193 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
16194 * 仅在 QQ 小程序中可用。
16195 *
16196 * @deprecated please use {@link AV.User.loginWithMiniApp}
16197 * @since 4.2.0
16198 * @param {Object} [unionLoginOptions]
16199 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
16200 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16201 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
16202 * @return {Promise.<AV.User>}
16203 */
16204 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
16205 var _this18 = this;
16206
16207 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
16208 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
16209 unionIdPlatform = _ref18$unionIdPlatfor === undefined ? 'qq' : _ref18$unionIdPlatfor,
16210 _ref18$asMainAccount = _ref18.asMainAccount,
16211 asMainAccount = _ref18$asMainAccount === undefined ? false : _ref18$asMainAccount,
16212 _ref18$failOnNotExist = _ref18.failOnNotExist,
16213 failOnNotExist = _ref18$failOnNotExist === undefined ? false : _ref18$failOnNotExist;
16214
16215 var getAuthInfo = getAdapter('getAuthInfo');
16216 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
16217 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
16218 authInfo.provider = PLATFORM_QQAPP;
16219 return _this18.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16220 });
16221 },
16222
16223
16224 /**
16225 * Register or login using the identity of the current mini-app.
16226 * @param {Object} authInfo
16227 * @param {Object} [option]
16228 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
16229 */
16230 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
16231 var _this19 = this;
16232
16233 if (authInfo === undefined) {
16234 var getAuthInfo = getAdapter('getAuthInfo');
16235 return getAuthInfo().then(function (authInfo) {
16236 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
16237 });
16238 }
16239 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
16240 },
16241
16242
16243 /**
16244 * Only use for DI in tests to produce deterministic IDs.
16245 */
16246 _genId: function _genId() {
16247 return uuid();
16248 },
16249
16250
16251 /**
16252 * Creates an anonymous user.
16253 *
16254 * @since 3.9.0
16255 * @return {Promise.<AV.User>}
16256 */
16257 loginAnonymously: function loginAnonymously() {
16258 return this.loginWithAuthData({
16259 id: AV.User._genId()
16260 }, 'anonymous');
16261 },
16262 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
16263 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
16264 return userObj._linkWith(platform, authData);
16265 },
16266
16267 /**
16268 * Logs out the currently logged in user session. This will remove the
16269 * session from disk, log out of linked services, and future calls to
16270 * <code>current</code> will return <code>null</code>.
16271 * @return {Promise}
16272 */
16273 logOut: function logOut() {
16274 if (AV._config.disableCurrentUser) {
16275 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');
16276 return _promise2.default.resolve(null);
16277 }
16278
16279 if (AV.User._currentUser !== null) {
16280 AV.User._currentUser._logOutWithAll();
16281 AV.User._currentUser._isCurrentUser = false;
16282 }
16283 AV.User._currentUserMatchesDisk = true;
16284 AV.User._currentUser = null;
16285 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
16286 return AV._refreshSubscriptionId();
16287 });
16288 },
16289
16290 /**
16291 *Create a follower query for special user to query the user's followers.
16292 * @param {String} userObjectId The user object id.
16293 * @return {AV.FriendShipQuery}
16294 * @since 0.3.0
16295 */
16296 followerQuery: function followerQuery(userObjectId) {
16297 if (!userObjectId || !_.isString(userObjectId)) {
16298 throw new Error('Invalid user object id.');
16299 }
16300 var query = new AV.FriendShipQuery('_Follower');
16301 query._friendshipTag = 'follower';
16302 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
16303 return query;
16304 },
16305
16306 /**
16307 *Create a followee query for special user to query the user's followees.
16308 * @param {String} userObjectId The user object id.
16309 * @return {AV.FriendShipQuery}
16310 * @since 0.3.0
16311 */
16312 followeeQuery: function followeeQuery(userObjectId) {
16313 if (!userObjectId || !_.isString(userObjectId)) {
16314 throw new Error('Invalid user object id.');
16315 }
16316 var query = new AV.FriendShipQuery('_Followee');
16317 query._friendshipTag = 'followee';
16318 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
16319 return query;
16320 },
16321
16322 /**
16323 * Requests a password reset email to be sent to the specified email address
16324 * associated with the user account. This email allows the user to securely
16325 * reset their password on the AV site.
16326 *
16327 * @param {String} email The email address associated with the user that
16328 * forgot their password.
16329 * @return {Promise}
16330 */
16331 requestPasswordReset: function requestPasswordReset(email) {
16332 var json = { email: email };
16333 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
16334 return request;
16335 },
16336
16337 /**
16338 * Requests a verify email to be sent to the specified email address
16339 * associated with the user account. This email allows the user to securely
16340 * verify their email address on the AV site.
16341 *
16342 * @param {String} email The email address associated with the user that
16343 * doesn't verify their email address.
16344 * @return {Promise}
16345 */
16346 requestEmailVerify: function requestEmailVerify(email) {
16347 var json = { email: email };
16348 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
16349 return request;
16350 },
16351
16352 /**
16353 * Requests a verify sms code to be sent to the specified mobile phone
16354 * number associated with the user account. This sms code allows the user to
16355 * verify their mobile phone number by calling AV.User.verifyMobilePhone
16356 *
16357 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16358 * user that doesn't verify their mobile phone number.
16359 * @param {SMSAuthOptions} [options]
16360 * @return {Promise}
16361 */
16362 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
16363 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16364
16365 var data = {
16366 mobilePhoneNumber: mobilePhoneNumber
16367 };
16368 if (options.validateToken) {
16369 data.validate_token = options.validateToken;
16370 }
16371 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
16372 return request;
16373 },
16374
16375 /**
16376 * Requests a reset password sms code to be sent to the specified mobile phone
16377 * number associated with the user account. This sms code allows the user to
16378 * reset their account's password by calling AV.User.resetPasswordBySmsCode
16379 *
16380 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16381 * user that doesn't verify their mobile phone number.
16382 * @param {SMSAuthOptions} [options]
16383 * @return {Promise}
16384 */
16385 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
16386 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16387
16388 var data = {
16389 mobilePhoneNumber: mobilePhoneNumber
16390 };
16391 if (options.validateToken) {
16392 data.validate_token = options.validateToken;
16393 }
16394 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
16395 return request;
16396 },
16397
16398 /**
16399 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
16400 * This sms code allows current user to reset it's mobilePhoneNumber by
16401 * calling {@link AV.User.changePhoneNumber}
16402 * @since 4.7.0
16403 * @param {String} mobilePhoneNumber
16404 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
16405 * @param {SMSAuthOptions} [options]
16406 * @return {Promise}
16407 */
16408 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
16409 var data = { mobilePhoneNumber: mobilePhoneNumber };
16410 if (ttl) {
16411 data.ttl = options.ttl;
16412 }
16413 if (options && options.validateToken) {
16414 data.validate_token = options.validateToken;
16415 }
16416 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
16417 },
16418
16419
16420 /**
16421 * Makes a call to reset user's account mobilePhoneNumber by sms code.
16422 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
16423 * @since 4.7.0
16424 * @param {String} mobilePhoneNumber
16425 * @param {String} code The sms code.
16426 * @return {Promise}
16427 */
16428 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
16429 var data = { mobilePhoneNumber: mobilePhoneNumber, code: code };
16430 return AVRequest('changePhoneNumber', null, null, 'POST', data);
16431 },
16432
16433
16434 /**
16435 * Makes a call to reset user's account password by sms code and new password.
16436 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
16437 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
16438 * @param {String} password The new password.
16439 * @return {Promise} A promise that will be resolved with the result
16440 * of the function.
16441 */
16442 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
16443 var json = { password: password };
16444 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
16445 return request;
16446 },
16447
16448 /**
16449 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
16450 * If verify successfully,the user mobilePhoneVerified attribute will be true.
16451 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
16452 * @return {Promise} A promise that will be resolved with the result
16453 * of the function.
16454 */
16455 verifyMobilePhone: function verifyMobilePhone(code) {
16456 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
16457 return request;
16458 },
16459
16460 /**
16461 * Requests a logIn sms code to be sent to the specified mobile phone
16462 * number associated with the user account. This sms code allows the user to
16463 * login by AV.User.logInWithMobilePhoneSmsCode function.
16464 *
16465 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16466 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
16467 * @param {SMSAuthOptions} [options]
16468 * @return {Promise}
16469 */
16470 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
16471 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16472
16473 var data = {
16474 mobilePhoneNumber: mobilePhoneNumber
16475 };
16476 if (options.validateToken) {
16477 data.validate_token = options.validateToken;
16478 }
16479 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
16480 return request;
16481 },
16482
16483 /**
16484 * Retrieves the currently logged in AVUser with a valid session,
16485 * either from memory or localStorage, if necessary.
16486 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
16487 */
16488 currentAsync: function currentAsync() {
16489 if (AV._config.disableCurrentUser) {
16490 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');
16491 return _promise2.default.resolve(null);
16492 }
16493
16494 if (AV.User._currentUser) {
16495 return _promise2.default.resolve(AV.User._currentUser);
16496 }
16497
16498 if (AV.User._currentUserMatchesDisk) {
16499 return _promise2.default.resolve(AV.User._currentUser);
16500 }
16501
16502 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
16503 if (!userData) {
16504 return null;
16505 }
16506
16507 // Load the user from local storage.
16508 AV.User._currentUserMatchesDisk = true;
16509
16510 AV.User._currentUser = AV.Object._create('_User');
16511 AV.User._currentUser._isCurrentUser = true;
16512
16513 var json = JSON.parse(userData);
16514 AV.User._currentUser.id = json._id;
16515 delete json._id;
16516 AV.User._currentUser._sessionToken = json._sessionToken;
16517 delete json._sessionToken;
16518 AV.User._currentUser._finishFetch(json);
16519 //AV.User._currentUser.set(json);
16520
16521 AV.User._currentUser._synchronizeAllAuthData();
16522 AV.User._currentUser._refreshCache();
16523 AV.User._currentUser._opSetQueue = [{}];
16524 return AV.User._currentUser;
16525 });
16526 },
16527
16528 /**
16529 * Retrieves the currently logged in AVUser with a valid session,
16530 * either from memory or localStorage, if necessary.
16531 * @return {AV.User} The currently logged in AV.User.
16532 */
16533 current: function current() {
16534 if (AV._config.disableCurrentUser) {
16535 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');
16536 return null;
16537 }
16538
16539 if (AV.localStorage.async) {
16540 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
16541 error.code = 'SYNC_API_NOT_AVAILABLE';
16542 throw error;
16543 }
16544
16545 if (AV.User._currentUser) {
16546 return AV.User._currentUser;
16547 }
16548
16549 if (AV.User._currentUserMatchesDisk) {
16550 return AV.User._currentUser;
16551 }
16552
16553 // Load the user from local storage.
16554 AV.User._currentUserMatchesDisk = true;
16555
16556 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
16557 if (!userData) {
16558 return null;
16559 }
16560 AV.User._currentUser = AV.Object._create('_User');
16561 AV.User._currentUser._isCurrentUser = true;
16562
16563 var json = JSON.parse(userData);
16564 AV.User._currentUser.id = json._id;
16565 delete json._id;
16566 AV.User._currentUser._sessionToken = json._sessionToken;
16567 delete json._sessionToken;
16568 AV.User._currentUser._finishFetch(json);
16569 //AV.User._currentUser.set(json);
16570
16571 AV.User._currentUser._synchronizeAllAuthData();
16572 AV.User._currentUser._refreshCache();
16573 AV.User._currentUser._opSetQueue = [{}];
16574 return AV.User._currentUser;
16575 },
16576
16577 /**
16578 * Persists a user as currentUser to localStorage, and into the singleton.
16579 * @private
16580 */
16581 _saveCurrentUser: function _saveCurrentUser(user) {
16582 var promise;
16583 if (AV.User._currentUser !== user) {
16584 promise = AV.User.logOut();
16585 } else {
16586 promise = _promise2.default.resolve();
16587 }
16588 return promise.then(function () {
16589 user._isCurrentUser = true;
16590 AV.User._currentUser = user;
16591
16592 var json = user._toFullJSON();
16593 json._id = user.id;
16594 json._sessionToken = user._sessionToken;
16595 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify2.default)(json)).then(function () {
16596 AV.User._currentUserMatchesDisk = true;
16597 return AV._refreshSubscriptionId();
16598 });
16599 });
16600 },
16601
16602 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
16603 AV.User._authProviders[provider.getAuthType()] = provider;
16604 // Synchronize the current user with the auth provider.
16605 if (!AV._config.disableCurrentUser && AV.User.current()) {
16606 AV.User.current()._synchronizeAuthData(provider.getAuthType());
16607 }
16608 },
16609
16610 _logInWith: function _logInWith(provider, authData, options) {
16611 var user = AV.Object._create('_User');
16612 return user._linkWith(provider, authData, options);
16613 }
16614 });
16615};
16616
16617/***/ }),
16618/* 325 */
16619/***/ (function(module, exports, __webpack_require__) {
16620
16621"use strict";
16622
16623
16624exports.__esModule = true;
16625
16626var _defineProperty = __webpack_require__(90);
16627
16628var _defineProperty2 = _interopRequireDefault(_defineProperty);
16629
16630function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16631
16632exports.default = function (obj, key, value) {
16633 if (key in obj) {
16634 (0, _defineProperty2.default)(obj, key, {
16635 value: value,
16636 enumerable: true,
16637 configurable: true,
16638 writable: true
16639 });
16640 } else {
16641 obj[key] = value;
16642 }
16643
16644 return obj;
16645};
16646
16647/***/ }),
16648/* 326 */
16649/***/ (function(module, exports, __webpack_require__) {
16650
16651"use strict";
16652
16653
16654var _stringify = __webpack_require__(19);
16655
16656var _stringify2 = _interopRequireDefault(_stringify);
16657
16658var _promise = __webpack_require__(3);
16659
16660var _promise2 = _interopRequireDefault(_promise);
16661
16662function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16663
16664var _ = __webpack_require__(0);
16665var debug = __webpack_require__(37)('leancloud:query');
16666var AVError = __webpack_require__(29);
16667
16668var _require = __webpack_require__(12),
16669 _request = _require._request,
16670 request = _require.request;
16671
16672var _require2 = __webpack_require__(15),
16673 ensureArray = _require2.ensureArray,
16674 transformFetchOptions = _require2.transformFetchOptions,
16675 continueWhile = _require2.continueWhile;
16676
16677var requires = function requires(value, message) {
16678 if (value === undefined) {
16679 throw new Error(message);
16680 }
16681};
16682
16683// AV.Query is a way to create a list of AV.Objects.
16684module.exports = function (AV) {
16685 /**
16686 * Creates a new AV.Query for the given AV.Object subclass.
16687 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
16688 * @class
16689 *
16690 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
16691 * most common use case is finding all objects that match a query through the
16692 * <code>find</code> method. For example, this sample code fetches all objects
16693 * of class <code>MyClass</code>. It calls a different function depending on
16694 * whether the fetch succeeded or not.
16695 *
16696 * <pre>
16697 * var query = new AV.Query(MyClass);
16698 * query.find().then(function(results) {
16699 * // results is an array of AV.Object.
16700 * }, function(error) {
16701 * // error is an instance of AVError.
16702 * });</pre></p>
16703 *
16704 * <p>An AV.Query can also be used to retrieve a single object whose id is
16705 * known, through the get method. For example, this sample code fetches an
16706 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
16707 * different function depending on whether the fetch succeeded or not.
16708 *
16709 * <pre>
16710 * var query = new AV.Query(MyClass);
16711 * query.get(myId).then(function(object) {
16712 * // object is an instance of AV.Object.
16713 * }, function(error) {
16714 * // error is an instance of AVError.
16715 * });</pre></p>
16716 *
16717 * <p>An AV.Query can also be used to count the number of objects that match
16718 * the query without retrieving all of those objects. For example, this
16719 * sample code counts the number of objects of the class <code>MyClass</code>
16720 * <pre>
16721 * var query = new AV.Query(MyClass);
16722 * query.count().then(function(number) {
16723 * // There are number instances of MyClass.
16724 * }, function(error) {
16725 * // error is an instance of AVError.
16726 * });</pre></p>
16727 */
16728 AV.Query = function (objectClass) {
16729 if (_.isString(objectClass)) {
16730 objectClass = AV.Object._getSubclass(objectClass);
16731 }
16732
16733 this.objectClass = objectClass;
16734
16735 this.className = objectClass.prototype.className;
16736
16737 this._where = {};
16738 this._include = [];
16739 this._select = [];
16740 this._limit = -1; // negative limit means, do not send a limit
16741 this._skip = 0;
16742 this._defaultParams = {};
16743 };
16744
16745 /**
16746 * Constructs a AV.Query that is the OR of the passed in queries. For
16747 * example:
16748 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
16749 *
16750 * will create a compoundQuery that is an or of the query1, query2, and
16751 * query3.
16752 * @param {...AV.Query} var_args The list of queries to OR.
16753 * @return {AV.Query} The query that is the OR of the passed in queries.
16754 */
16755 AV.Query.or = function () {
16756 var queries = _.toArray(arguments);
16757 var className = null;
16758 AV._arrayEach(queries, function (q) {
16759 if (_.isNull(className)) {
16760 className = q.className;
16761 }
16762
16763 if (className !== q.className) {
16764 throw new Error('All queries must be for the same class');
16765 }
16766 });
16767 var query = new AV.Query(className);
16768 query._orQuery(queries);
16769 return query;
16770 };
16771
16772 /**
16773 * Constructs a AV.Query that is the AND of the passed in queries. For
16774 * example:
16775 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
16776 *
16777 * will create a compoundQuery that is an 'and' of the query1, query2, and
16778 * query3.
16779 * @param {...AV.Query} var_args The list of queries to AND.
16780 * @return {AV.Query} The query that is the AND of the passed in queries.
16781 */
16782 AV.Query.and = function () {
16783 var queries = _.toArray(arguments);
16784 var className = null;
16785 AV._arrayEach(queries, function (q) {
16786 if (_.isNull(className)) {
16787 className = q.className;
16788 }
16789
16790 if (className !== q.className) {
16791 throw new Error('All queries must be for the same class');
16792 }
16793 });
16794 var query = new AV.Query(className);
16795 query._andQuery(queries);
16796 return query;
16797 };
16798
16799 /**
16800 * Retrieves a list of AVObjects that satisfy the CQL.
16801 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
16802 *
16803 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
16804 * @param {Array} pvalues An array contains placeholder values.
16805 * @param {AuthOptions} options
16806 * @return {Promise} A promise that is resolved with the results when
16807 * the query completes.
16808 */
16809 AV.Query.doCloudQuery = function (cql, pvalues, options) {
16810 var params = { cql: cql };
16811 if (_.isArray(pvalues)) {
16812 params.pvalues = pvalues;
16813 } else {
16814 options = pvalues;
16815 }
16816
16817 var request = _request('cloudQuery', null, null, 'GET', params, options);
16818 return request.then(function (response) {
16819 //query to process results.
16820 var query = new AV.Query(response.className);
16821 var results = _.map(response.results, function (json) {
16822 var obj = query._newObject(response);
16823 if (obj._finishFetch) {
16824 obj._finishFetch(query._processResult(json), true);
16825 }
16826 return obj;
16827 });
16828 return {
16829 results: results,
16830 count: response.count,
16831 className: response.className
16832 };
16833 });
16834 };
16835
16836 /**
16837 * Return a query with conditions from json.
16838 * This can be useful to send a query from server side to client side.
16839 * @since 4.0.0
16840 * @param {Object} json from {@link AV.Query#toJSON}
16841 * @return {AV.Query}
16842 */
16843 AV.Query.fromJSON = function (_ref) {
16844 var className = _ref.className,
16845 where = _ref.where,
16846 include = _ref.include,
16847 select = _ref.select,
16848 includeACL = _ref.includeACL,
16849 limit = _ref.limit,
16850 skip = _ref.skip,
16851 order = _ref.order;
16852
16853 if (typeof className !== 'string') {
16854 throw new TypeError('Invalid Query JSON, className must be a String.');
16855 }
16856 var query = new AV.Query(className);
16857 _.extend(query, {
16858 _where: where,
16859 _include: include,
16860 _select: select,
16861 _includeACL: includeACL,
16862 _limit: limit,
16863 _skip: skip,
16864 _order: order
16865 });
16866 return query;
16867 };
16868
16869 AV.Query._extend = AV._extend;
16870
16871 _.extend(AV.Query.prototype,
16872 /** @lends AV.Query.prototype */{
16873 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
16874 _processResult: function _processResult(obj) {
16875 return obj;
16876 },
16877
16878 /**
16879 * Constructs an AV.Object whose id is already known by fetching data from
16880 * the server.
16881 *
16882 * @param {String} objectId The id of the object to be fetched.
16883 * @param {AuthOptions} options
16884 * @return {Promise.<AV.Object>}
16885 */
16886 get: function get(objectId, options) {
16887 if (!_.isString(objectId)) {
16888 throw new Error('objectId must be a string');
16889 }
16890 if (objectId === '') {
16891 return _promise2.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
16892 }
16893
16894 var obj = this._newObject();
16895 obj.id = objectId;
16896
16897 var queryJSON = this._getParams();
16898 var fetchOptions = {};
16899
16900 if (queryJSON.keys) fetchOptions.keys = queryJSON.keys;
16901 if (queryJSON.include) fetchOptions.include = queryJSON.include;
16902 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
16903
16904 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
16905 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
16906 obj._finishFetch(obj.parse(response), true);
16907 return obj;
16908 });
16909 },
16910
16911 /**
16912 * Returns a JSON representation of this query.
16913 * @return {Object}
16914 */
16915 toJSON: function toJSON() {
16916 var className = this.className,
16917 where = this._where,
16918 include = this._include,
16919 select = this._select,
16920 includeACL = this._includeACL,
16921 limit = this._limit,
16922 skip = this._skip,
16923 order = this._order;
16924
16925 return {
16926 className: className,
16927 where: where,
16928 include: include,
16929 select: select,
16930 includeACL: includeACL,
16931 limit: limit,
16932 skip: skip,
16933 order: order
16934 };
16935 },
16936
16937
16938 _getParams: function _getParams() {
16939 var params = _.extend({}, this._defaultParams, {
16940 where: this._where
16941 });
16942
16943 if (this._include.length > 0) {
16944 params.include = this._include.join(',');
16945 }
16946 if (this._select.length > 0) {
16947 params.keys = this._select.join(',');
16948 }
16949 if (this._includeACL !== undefined) {
16950 params.returnACL = this._includeACL;
16951 }
16952 if (this._limit >= 0) {
16953 params.limit = this._limit;
16954 }
16955 if (this._skip > 0) {
16956 params.skip = this._skip;
16957 }
16958 if (this._order !== undefined) {
16959 params.order = this._order;
16960 }
16961
16962 return params;
16963 },
16964
16965 _newObject: function _newObject(response) {
16966 var obj;
16967 if (response && response.className) {
16968 obj = new AV.Object(response.className);
16969 } else {
16970 obj = new this.objectClass();
16971 }
16972 return obj;
16973 },
16974 _createRequest: function _createRequest() {
16975 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
16976 var options = arguments[1];
16977 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '/classes/' + this.className;
16978
16979 if (encodeURIComponent((0, _stringify2.default)(params)).length > 2000) {
16980 var body = {
16981 requests: [{
16982 method: 'GET',
16983 path: '/1.1' + path,
16984 params: params
16985 }]
16986 };
16987 return request({
16988 path: '/batch',
16989 method: 'POST',
16990 data: body,
16991 authOptions: options
16992 }).then(function (response) {
16993 var result = response[0];
16994 if (result.success) {
16995 return result.success;
16996 }
16997 var error = new Error(result.error.error || 'Unknown batch error');
16998 error.code = result.error.code;
16999 throw error;
17000 });
17001 }
17002 return request({
17003 method: 'GET',
17004 path: path,
17005 query: params,
17006 authOptions: options
17007 });
17008 },
17009 _parseResponse: function _parseResponse(response) {
17010 var _this = this;
17011
17012 return _.map(response.results, function (json) {
17013 var obj = _this._newObject(response);
17014 if (obj._finishFetch) {
17015 obj._finishFetch(_this._processResult(json), true);
17016 }
17017 return obj;
17018 });
17019 },
17020
17021
17022 /**
17023 * Retrieves a list of AVObjects that satisfy this query.
17024 *
17025 * @param {AuthOptions} options
17026 * @return {Promise} A promise that is resolved with the results when
17027 * the query completes.
17028 */
17029 find: function find(options) {
17030 var request = this._createRequest(undefined, options);
17031 return request.then(this._parseResponse.bind(this));
17032 },
17033
17034
17035 /**
17036 * Retrieves both AVObjects and total count.
17037 *
17038 * @since 4.12.0
17039 * @param {AuthOptions} options
17040 * @return {Promise} A tuple contains results and count.
17041 */
17042 findAndCount: function findAndCount(options) {
17043 var _this2 = this;
17044
17045 var params = this._getParams();
17046 params.count = 1;
17047 var request = this._createRequest(params, options);
17048
17049 return request.then(function (response) {
17050 return [_this2._parseResponse(response), response.count];
17051 });
17052 },
17053
17054
17055 /**
17056 * scan a Query. masterKey required.
17057 *
17058 * @since 2.1.0
17059 * @param {object} [options]
17060 * @param {string} [options.orderedBy] specify the key to sort
17061 * @param {number} [options.batchSize] specify the batch size for each request
17062 * @param {AuthOptions} [authOptions]
17063 * @return {AsyncIterator.<AV.Object>}
17064 * @example const testIterator = {
17065 * [Symbol.asyncIterator]() {
17066 * return new Query('Test').scan(undefined, { useMasterKey: true });
17067 * },
17068 * };
17069 * for await (const test of testIterator) {
17070 * console.log(test.id);
17071 * }
17072 */
17073 scan: function scan() {
17074 var _this3 = this;
17075
17076 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
17077 orderedBy = _ref2.orderedBy,
17078 batchSize = _ref2.batchSize;
17079
17080 var authOptions = arguments[1];
17081
17082 var condition = this._getParams();
17083 debug('scan %O', condition);
17084 if (condition.order) {
17085 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
17086 delete condition.order;
17087 }
17088 if (condition.skip) {
17089 console.warn('The skip option of the query is ignored for Query#scan.');
17090 delete condition.skip;
17091 }
17092 if (condition.limit) {
17093 console.warn('The limit option of the query is ignored for Query#scan.');
17094 delete condition.limit;
17095 }
17096 if (orderedBy) condition.scan_key = orderedBy;
17097 if (batchSize) condition.limit = batchSize;
17098 var promise = _promise2.default.resolve([]);
17099 var cursor = void 0;
17100 var endReached = false;
17101 return {
17102 next: function next() {
17103 promise = promise.then(function (remainResults) {
17104 if (endReached) return [];
17105 if (remainResults.length > 1) return remainResults;
17106 // no cursor means we have reached the end
17107 // except for the first time
17108 if (!cursor && remainResults.length !== 0) {
17109 endReached = true;
17110 return remainResults;
17111 }
17112 // when only 1 item left in queue
17113 // start the next request to see if it is the last one
17114 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, { cursor: cursor }) : condition, authOptions).then(function (response) {
17115 cursor = response.cursor;
17116 return _this3._parseResponse(response);
17117 }).then(function (results) {
17118 if (!results.length) endReached = true;
17119 return remainResults.concat(results);
17120 });
17121 });
17122 return promise.then(function (remainResults) {
17123 return remainResults.shift();
17124 }).then(function (result) {
17125 return {
17126 value: result,
17127 done: result === undefined
17128 };
17129 });
17130 }
17131 };
17132 },
17133
17134
17135 /**
17136 * Delete objects retrieved by this query.
17137 * @param {AuthOptions} options
17138 * @return {Promise} A promise that is fulfilled when the save
17139 * completes.
17140 */
17141 destroyAll: function destroyAll(options) {
17142 var self = this;
17143 return self.find(options).then(function (objects) {
17144 return AV.Object.destroyAll(objects, options);
17145 });
17146 },
17147
17148 /**
17149 * Counts the number of objects that match this query.
17150 *
17151 * @param {AuthOptions} options
17152 * @return {Promise} A promise that is resolved with the count when
17153 * the query completes.
17154 */
17155 count: function count(options) {
17156 var params = this._getParams();
17157 params.limit = 0;
17158 params.count = 1;
17159 var request = this._createRequest(params, options);
17160
17161 return request.then(function (response) {
17162 return response.count;
17163 });
17164 },
17165
17166 /**
17167 * Retrieves at most one AV.Object that satisfies this query.
17168 *
17169 * @param {AuthOptions} options
17170 * @return {Promise} A promise that is resolved with the object when
17171 * the query completes.
17172 */
17173 first: function first(options) {
17174 var self = this;
17175
17176 var params = this._getParams();
17177 params.limit = 1;
17178 var request = this._createRequest(params, options);
17179
17180 return request.then(function (response) {
17181 return _.map(response.results, function (json) {
17182 var obj = self._newObject();
17183 if (obj._finishFetch) {
17184 obj._finishFetch(self._processResult(json), true);
17185 }
17186 return obj;
17187 })[0];
17188 });
17189 },
17190
17191 /**
17192 * Sets the number of results to skip before returning any results.
17193 * This is useful for pagination.
17194 * Default is to skip zero results.
17195 * @param {Number} n the number of results to skip.
17196 * @return {AV.Query} Returns the query, so you can chain this call.
17197 */
17198 skip: function skip(n) {
17199 requires(n, 'undefined is not a valid skip value');
17200 this._skip = n;
17201 return this;
17202 },
17203
17204 /**
17205 * Sets the limit of the number of results to return. The default limit is
17206 * 100, with a maximum of 1000 results being returned at a time.
17207 * @param {Number} n the number of results to limit to.
17208 * @return {AV.Query} Returns the query, so you can chain this call.
17209 */
17210 limit: function limit(n) {
17211 requires(n, 'undefined is not a valid limit value');
17212 this._limit = n;
17213 return this;
17214 },
17215
17216 /**
17217 * Add a constraint to the query that requires a particular key's value to
17218 * be equal to the provided value.
17219 * @param {String} key The key to check.
17220 * @param value The value that the AV.Object must contain.
17221 * @return {AV.Query} Returns the query, so you can chain this call.
17222 */
17223 equalTo: function equalTo(key, value) {
17224 requires(key, 'undefined is not a valid key');
17225 requires(value, 'undefined is not a valid value');
17226 this._where[key] = AV._encode(value);
17227 return this;
17228 },
17229
17230 /**
17231 * Helper for condition queries
17232 * @private
17233 */
17234 _addCondition: function _addCondition(key, condition, value) {
17235 requires(key, 'undefined is not a valid condition key');
17236 requires(condition, 'undefined is not a valid condition');
17237 requires(value, 'undefined is not a valid condition value');
17238
17239 // Check if we already have a condition
17240 if (!this._where[key]) {
17241 this._where[key] = {};
17242 }
17243 this._where[key][condition] = AV._encode(value);
17244 return this;
17245 },
17246
17247 /**
17248 * Add a constraint to the query that requires a particular
17249 * <strong>array</strong> key's length to be equal to the provided value.
17250 * @param {String} key The array key to check.
17251 * @param value The length value.
17252 * @return {AV.Query} Returns the query, so you can chain this call.
17253 */
17254 sizeEqualTo: function sizeEqualTo(key, value) {
17255 this._addCondition(key, '$size', value);
17256 return this;
17257 },
17258
17259 /**
17260 * Add a constraint to the query that requires a particular key's value to
17261 * be not equal to the provided value.
17262 * @param {String} key The key to check.
17263 * @param value The value that must not be equalled.
17264 * @return {AV.Query} Returns the query, so you can chain this call.
17265 */
17266 notEqualTo: function notEqualTo(key, value) {
17267 this._addCondition(key, '$ne', value);
17268 return this;
17269 },
17270
17271 /**
17272 * Add a constraint to the query that requires a particular key's value to
17273 * be less than the provided value.
17274 * @param {String} key The key to check.
17275 * @param value The value that provides an upper bound.
17276 * @return {AV.Query} Returns the query, so you can chain this call.
17277 */
17278 lessThan: function lessThan(key, value) {
17279 this._addCondition(key, '$lt', value);
17280 return this;
17281 },
17282
17283 /**
17284 * Add a constraint to the query that requires a particular key's value to
17285 * be greater than the provided value.
17286 * @param {String} key The key to check.
17287 * @param value The value that provides an lower bound.
17288 * @return {AV.Query} Returns the query, so you can chain this call.
17289 */
17290 greaterThan: function greaterThan(key, value) {
17291 this._addCondition(key, '$gt', value);
17292 return this;
17293 },
17294
17295 /**
17296 * Add a constraint to the query that requires a particular key's value to
17297 * be less than or equal to the provided value.
17298 * @param {String} key The key to check.
17299 * @param value The value that provides an upper bound.
17300 * @return {AV.Query} Returns the query, so you can chain this call.
17301 */
17302 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
17303 this._addCondition(key, '$lte', value);
17304 return this;
17305 },
17306
17307 /**
17308 * Add a constraint to the query that requires a particular key's value to
17309 * be greater than or equal to the provided value.
17310 * @param {String} key The key to check.
17311 * @param value The value that provides an lower bound.
17312 * @return {AV.Query} Returns the query, so you can chain this call.
17313 */
17314 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
17315 this._addCondition(key, '$gte', value);
17316 return this;
17317 },
17318
17319 /**
17320 * Add a constraint to the query that requires a particular key's value to
17321 * be contained in the provided list of values.
17322 * @param {String} key The key to check.
17323 * @param {Array} values The values that will match.
17324 * @return {AV.Query} Returns the query, so you can chain this call.
17325 */
17326 containedIn: function containedIn(key, values) {
17327 this._addCondition(key, '$in', values);
17328 return this;
17329 },
17330
17331 /**
17332 * Add a constraint to the query that requires a particular key's value to
17333 * not be contained in the provided list of values.
17334 * @param {String} key The key to check.
17335 * @param {Array} values The values that will not match.
17336 * @return {AV.Query} Returns the query, so you can chain this call.
17337 */
17338 notContainedIn: function notContainedIn(key, values) {
17339 this._addCondition(key, '$nin', values);
17340 return this;
17341 },
17342
17343 /**
17344 * Add a constraint to the query that requires a particular key's value to
17345 * contain each one of the provided list of values.
17346 * @param {String} key The key to check. This key's value must be an array.
17347 * @param {Array} values The values that will match.
17348 * @return {AV.Query} Returns the query, so you can chain this call.
17349 */
17350 containsAll: function containsAll(key, values) {
17351 this._addCondition(key, '$all', values);
17352 return this;
17353 },
17354
17355 /**
17356 * Add a constraint for finding objects that contain the given key.
17357 * @param {String} key The key that should exist.
17358 * @return {AV.Query} Returns the query, so you can chain this call.
17359 */
17360 exists: function exists(key) {
17361 this._addCondition(key, '$exists', true);
17362 return this;
17363 },
17364
17365 /**
17366 * Add a constraint for finding objects that do not contain a given key.
17367 * @param {String} key The key that should not exist
17368 * @return {AV.Query} Returns the query, so you can chain this call.
17369 */
17370 doesNotExist: function doesNotExist(key) {
17371 this._addCondition(key, '$exists', false);
17372 return this;
17373 },
17374
17375 /**
17376 * Add a regular expression constraint for finding string values that match
17377 * the provided regular expression.
17378 * This may be slow for large datasets.
17379 * @param {String} key The key that the string to match is stored in.
17380 * @param {RegExp} regex The regular expression pattern to match.
17381 * @return {AV.Query} Returns the query, so you can chain this call.
17382 */
17383 matches: function matches(key, regex, modifiers) {
17384 this._addCondition(key, '$regex', regex);
17385 if (!modifiers) {
17386 modifiers = '';
17387 }
17388 // Javascript regex options support mig as inline options but store them
17389 // as properties of the object. We support mi & should migrate them to
17390 // modifiers
17391 if (regex.ignoreCase) {
17392 modifiers += 'i';
17393 }
17394 if (regex.multiline) {
17395 modifiers += 'm';
17396 }
17397
17398 if (modifiers && modifiers.length) {
17399 this._addCondition(key, '$options', modifiers);
17400 }
17401 return this;
17402 },
17403
17404 /**
17405 * Add a constraint that requires that a key's value matches a AV.Query
17406 * constraint.
17407 * @param {String} key The key that the contains the object to match the
17408 * query.
17409 * @param {AV.Query} query The query that should match.
17410 * @return {AV.Query} Returns the query, so you can chain this call.
17411 */
17412 matchesQuery: function matchesQuery(key, query) {
17413 var queryJSON = query._getParams();
17414 queryJSON.className = query.className;
17415 this._addCondition(key, '$inQuery', queryJSON);
17416 return this;
17417 },
17418
17419 /**
17420 * Add a constraint that requires that a key's value not matches a
17421 * AV.Query constraint.
17422 * @param {String} key The key that the contains the object to match the
17423 * query.
17424 * @param {AV.Query} query The query that should not match.
17425 * @return {AV.Query} Returns the query, so you can chain this call.
17426 */
17427 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
17428 var queryJSON = query._getParams();
17429 queryJSON.className = query.className;
17430 this._addCondition(key, '$notInQuery', queryJSON);
17431 return this;
17432 },
17433
17434 /**
17435 * Add a constraint that requires that a key's value matches a value in
17436 * an object returned by a different AV.Query.
17437 * @param {String} key The key that contains the value that is being
17438 * matched.
17439 * @param {String} queryKey The key in the objects returned by the query to
17440 * match against.
17441 * @param {AV.Query} query The query to run.
17442 * @return {AV.Query} Returns the query, so you can chain this call.
17443 */
17444 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
17445 var queryJSON = query._getParams();
17446 queryJSON.className = query.className;
17447 this._addCondition(key, '$select', { key: queryKey, query: queryJSON });
17448 return this;
17449 },
17450
17451 /**
17452 * Add a constraint that requires that a key's value not match a value in
17453 * an object returned by a different AV.Query.
17454 * @param {String} key The key that contains the value that is being
17455 * excluded.
17456 * @param {String} queryKey The key in the objects returned by the query to
17457 * match against.
17458 * @param {AV.Query} query The query to run.
17459 * @return {AV.Query} Returns the query, so you can chain this call.
17460 */
17461 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
17462 var queryJSON = query._getParams();
17463 queryJSON.className = query.className;
17464 this._addCondition(key, '$dontSelect', {
17465 key: queryKey,
17466 query: queryJSON
17467 });
17468 return this;
17469 },
17470
17471 /**
17472 * Add constraint that at least one of the passed in queries matches.
17473 * @param {Array} queries
17474 * @return {AV.Query} Returns the query, so you can chain this call.
17475 * @private
17476 */
17477 _orQuery: function _orQuery(queries) {
17478 var queryJSON = _.map(queries, function (q) {
17479 return q._getParams().where;
17480 });
17481
17482 this._where.$or = queryJSON;
17483 return this;
17484 },
17485
17486 /**
17487 * Add constraint that both of the passed in queries matches.
17488 * @param {Array} queries
17489 * @return {AV.Query} Returns the query, so you can chain this call.
17490 * @private
17491 */
17492 _andQuery: function _andQuery(queries) {
17493 var queryJSON = _.map(queries, function (q) {
17494 return q._getParams().where;
17495 });
17496
17497 this._where.$and = queryJSON;
17498 return this;
17499 },
17500
17501 /**
17502 * Converts a string into a regex that matches it.
17503 * Surrounding with \Q .. \E does this, we just need to escape \E's in
17504 * the text separately.
17505 * @private
17506 */
17507 _quote: function _quote(s) {
17508 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
17509 },
17510
17511 /**
17512 * Add a constraint for finding string values that contain a provided
17513 * string. This may be slow for large datasets.
17514 * @param {String} key The key that the string to match is stored in.
17515 * @param {String} substring The substring that the value must contain.
17516 * @return {AV.Query} Returns the query, so you can chain this call.
17517 */
17518 contains: function contains(key, value) {
17519 this._addCondition(key, '$regex', this._quote(value));
17520 return this;
17521 },
17522
17523 /**
17524 * Add a constraint for finding string values that start with a provided
17525 * string. This query will use the backend index, so it will be fast even
17526 * for large datasets.
17527 * @param {String} key The key that the string to match is stored in.
17528 * @param {String} prefix The substring that the value must start with.
17529 * @return {AV.Query} Returns the query, so you can chain this call.
17530 */
17531 startsWith: function startsWith(key, value) {
17532 this._addCondition(key, '$regex', '^' + this._quote(value));
17533 return this;
17534 },
17535
17536 /**
17537 * Add a constraint for finding string values that end with a provided
17538 * string. This will be slow for large datasets.
17539 * @param {String} key The key that the string to match is stored in.
17540 * @param {String} suffix The substring that the value must end with.
17541 * @return {AV.Query} Returns the query, so you can chain this call.
17542 */
17543 endsWith: function endsWith(key, value) {
17544 this._addCondition(key, '$regex', this._quote(value) + '$');
17545 return this;
17546 },
17547
17548 /**
17549 * Sorts the results in ascending order by the given key.
17550 *
17551 * @param {String} key The key to order by.
17552 * @return {AV.Query} Returns the query, so you can chain this call.
17553 */
17554 ascending: function ascending(key) {
17555 requires(key, 'undefined is not a valid key');
17556 this._order = key;
17557 return this;
17558 },
17559
17560 /**
17561 * Also sorts the results in ascending order by the given key. The previous sort keys have
17562 * precedence over this key.
17563 *
17564 * @param {String} key The key to order by
17565 * @return {AV.Query} Returns the query so you can chain this call.
17566 */
17567 addAscending: function addAscending(key) {
17568 requires(key, 'undefined is not a valid key');
17569 if (this._order) this._order += ',' + key;else this._order = key;
17570 return this;
17571 },
17572
17573 /**
17574 * Sorts the results in descending order by the given key.
17575 *
17576 * @param {String} key The key to order by.
17577 * @return {AV.Query} Returns the query, so you can chain this call.
17578 */
17579 descending: function descending(key) {
17580 requires(key, 'undefined is not a valid key');
17581 this._order = '-' + key;
17582 return this;
17583 },
17584
17585 /**
17586 * Also sorts the results in descending order by the given key. The previous sort keys have
17587 * precedence over this key.
17588 *
17589 * @param {String} key The key to order by
17590 * @return {AV.Query} Returns the query so you can chain this call.
17591 */
17592 addDescending: function addDescending(key) {
17593 requires(key, 'undefined is not a valid key');
17594 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
17595 return this;
17596 },
17597
17598 /**
17599 * Add a proximity based constraint for finding objects with key point
17600 * values near the point given.
17601 * @param {String} key The key that the AV.GeoPoint is stored in.
17602 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17603 * @return {AV.Query} Returns the query, so you can chain this call.
17604 */
17605 near: function near(key, point) {
17606 if (!(point instanceof AV.GeoPoint)) {
17607 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
17608 point = new AV.GeoPoint(point);
17609 }
17610 this._addCondition(key, '$nearSphere', point);
17611 return this;
17612 },
17613
17614 /**
17615 * Add a proximity based constraint for finding objects with key point
17616 * values near the point given and within the maximum distance given.
17617 * @param {String} key The key that the AV.GeoPoint is stored in.
17618 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17619 * @param maxDistance Maximum distance (in radians) of results to return.
17620 * @return {AV.Query} Returns the query, so you can chain this call.
17621 */
17622 withinRadians: function withinRadians(key, point, distance) {
17623 this.near(key, point);
17624 this._addCondition(key, '$maxDistance', distance);
17625 return this;
17626 },
17627
17628 /**
17629 * Add a proximity based constraint for finding objects with key point
17630 * values near the point given and within the maximum distance given.
17631 * Radius of earth used is 3958.8 miles.
17632 * @param {String} key The key that the AV.GeoPoint is stored in.
17633 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17634 * @param {Number} maxDistance Maximum distance (in miles) of results to
17635 * return.
17636 * @return {AV.Query} Returns the query, so you can chain this call.
17637 */
17638 withinMiles: function withinMiles(key, point, distance) {
17639 return this.withinRadians(key, point, distance / 3958.8);
17640 },
17641
17642 /**
17643 * Add a proximity based constraint for finding objects with key point
17644 * values near the point given and within the maximum distance given.
17645 * Radius of earth used is 6371.0 kilometers.
17646 * @param {String} key The key that the AV.GeoPoint is stored in.
17647 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17648 * @param {Number} maxDistance Maximum distance (in kilometers) of results
17649 * to return.
17650 * @return {AV.Query} Returns the query, so you can chain this call.
17651 */
17652 withinKilometers: function withinKilometers(key, point, distance) {
17653 return this.withinRadians(key, point, distance / 6371.0);
17654 },
17655
17656 /**
17657 * Add a constraint to the query that requires a particular key's
17658 * coordinates be contained within a given rectangular geographic bounding
17659 * box.
17660 * @param {String} key The key to be constrained.
17661 * @param {AV.GeoPoint} southwest
17662 * The lower-left inclusive corner of the box.
17663 * @param {AV.GeoPoint} northeast
17664 * The upper-right inclusive corner of the box.
17665 * @return {AV.Query} Returns the query, so you can chain this call.
17666 */
17667 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
17668 if (!(southwest instanceof AV.GeoPoint)) {
17669 southwest = new AV.GeoPoint(southwest);
17670 }
17671 if (!(northeast instanceof AV.GeoPoint)) {
17672 northeast = new AV.GeoPoint(northeast);
17673 }
17674 this._addCondition(key, '$within', { $box: [southwest, northeast] });
17675 return this;
17676 },
17677
17678 /**
17679 * Include nested AV.Objects for the provided key. You can use dot
17680 * notation to specify which fields in the included object are also fetch.
17681 * @param {String[]} keys The name of the key to include.
17682 * @return {AV.Query} Returns the query, so you can chain this call.
17683 */
17684 include: function include(keys) {
17685 var _this4 = this;
17686
17687 requires(keys, 'undefined is not a valid key');
17688 _.forEach(arguments, function (keys) {
17689 _this4._include = _this4._include.concat(ensureArray(keys));
17690 });
17691 return this;
17692 },
17693
17694 /**
17695 * Include the ACL.
17696 * @param {Boolean} [value=true] Whether to include the ACL
17697 * @return {AV.Query} Returns the query, so you can chain this call.
17698 */
17699 includeACL: function includeACL() {
17700 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
17701
17702 this._includeACL = value;
17703 return this;
17704 },
17705
17706 /**
17707 * Restrict the fields of the returned AV.Objects to include only the
17708 * provided keys. If this is called multiple times, then all of the keys
17709 * specified in each of the calls will be included.
17710 * @param {String[]} keys The names of the keys to include.
17711 * @return {AV.Query} Returns the query, so you can chain this call.
17712 */
17713 select: function select(keys) {
17714 var _this5 = this;
17715
17716 requires(keys, 'undefined is not a valid key');
17717 _.forEach(arguments, function (keys) {
17718 _this5._select = _this5._select.concat(ensureArray(keys));
17719 });
17720 return this;
17721 },
17722
17723 /**
17724 * Iterates over each result of a query, calling a callback for each one. If
17725 * the callback returns a promise, the iteration will not continue until
17726 * that promise has been fulfilled. If the callback returns a rejected
17727 * promise, then iteration will stop with that error. The items are
17728 * processed in an unspecified order. The query may not have any sort order,
17729 * and may not use limit or skip.
17730 * @param callback {Function} Callback that will be called with each result
17731 * of the query.
17732 * @return {Promise} A promise that will be fulfilled once the
17733 * iteration has completed.
17734 */
17735 each: function each(callback) {
17736 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17737
17738 if (this._order || this._skip || this._limit >= 0) {
17739 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
17740 return _promise2.default.reject(error);
17741 }
17742
17743 var query = new AV.Query(this.objectClass);
17744 // We can override the batch size from the options.
17745 // This is undocumented, but useful for testing.
17746 query._limit = options.batchSize || 100;
17747 query._where = _.clone(this._where);
17748 query._include = _.clone(this._include);
17749
17750 query.ascending('objectId');
17751
17752 var finished = false;
17753 return continueWhile(function () {
17754 return !finished;
17755 }, function () {
17756 return query.find(options).then(function (results) {
17757 var callbacksDone = _promise2.default.resolve();
17758 _.each(results, function (result) {
17759 callbacksDone = callbacksDone.then(function () {
17760 return callback(result);
17761 });
17762 });
17763
17764 return callbacksDone.then(function () {
17765 if (results.length >= query._limit) {
17766 query.greaterThan('objectId', results[results.length - 1].id);
17767 } else {
17768 finished = true;
17769 }
17770 });
17771 });
17772 });
17773 },
17774
17775 /**
17776 * Subscribe the changes of this query.
17777 *
17778 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
17779 *
17780 * @since 3.0.0
17781 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
17782 */
17783 subscribe: function subscribe(options) {
17784 return AV.LiveQuery.init(this, options);
17785 }
17786 });
17787
17788 AV.FriendShipQuery = AV.Query._extend({
17789 _newObject: function _newObject() {
17790 var UserClass = AV.Object._getSubclass('_User');
17791 return new UserClass();
17792 },
17793 _processResult: function _processResult(json) {
17794 if (json && json[this._friendshipTag]) {
17795 var user = json[this._friendshipTag];
17796 if (user.__type === 'Pointer' && user.className === '_User') {
17797 delete user.__type;
17798 delete user.className;
17799 }
17800 return user;
17801 } else {
17802 return null;
17803 }
17804 }
17805 });
17806};
17807
17808/***/ }),
17809/* 327 */
17810/***/ (function(module, exports, __webpack_require__) {
17811
17812"use strict";
17813
17814
17815var _promise = __webpack_require__(3);
17816
17817var _promise2 = _interopRequireDefault(_promise);
17818
17819function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17820
17821var _ = __webpack_require__(0);
17822var EventEmitter = __webpack_require__(162);
17823
17824var _require = __webpack_require__(15),
17825 inherits = _require.inherits;
17826
17827var _require2 = __webpack_require__(12),
17828 request = _require2.request;
17829
17830var subscribe = function subscribe(queryJSON, subscriptionId) {
17831 return request({
17832 method: 'POST',
17833 path: '/LiveQuery/subscribe',
17834 data: {
17835 query: queryJSON,
17836 id: subscriptionId
17837 }
17838 });
17839};
17840
17841module.exports = function (AV) {
17842 var requireRealtime = function requireRealtime() {
17843 if (!AV._config.realtime) {
17844 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
17845 }
17846 };
17847 /**
17848 * @class
17849 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
17850 * @since 3.0.0
17851 */
17852 AV.LiveQuery = inherits(EventEmitter,
17853 /** @lends AV.LiveQuery.prototype */{
17854 constructor: function constructor(id, client, queryJSON, subscriptionId) {
17855 var _this = this;
17856
17857 EventEmitter.apply(this);
17858 this.id = id;
17859 this._client = client;
17860 this._client.register(this);
17861 this._queryJSON = queryJSON;
17862 this._subscriptionId = subscriptionId;
17863 this._onMessage = this._dispatch.bind(this);
17864 this._onReconnect = function () {
17865 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
17866 return console.error('LiveQuery resubscribe error: ' + error.message);
17867 });
17868 };
17869 client.on('message', this._onMessage);
17870 client.on('reconnect', this._onReconnect);
17871 },
17872 _dispatch: function _dispatch(message) {
17873 var _this2 = this;
17874
17875 message.forEach(function (_ref) {
17876 var op = _ref.op,
17877 object = _ref.object,
17878 queryId = _ref.query_id,
17879 updatedKeys = _ref.updatedKeys;
17880
17881 if (queryId !== _this2.id) return;
17882 var target = AV.parseJSON(_.extend({
17883 __type: object.className === '_File' ? 'File' : 'Object'
17884 }, object));
17885 if (updatedKeys) {
17886 /**
17887 * An existing AV.Object which fulfills the Query you subscribe is updated.
17888 * @event AV.LiveQuery#update
17889 * @param {AV.Object|AV.File} target updated object
17890 * @param {String[]} updatedKeys updated keys
17891 */
17892 /**
17893 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
17894 * @event AV.LiveQuery#enter
17895 * @param {AV.Object|AV.File} target updated object
17896 * @param {String[]} updatedKeys updated keys
17897 */
17898 /**
17899 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
17900 * @event AV.LiveQuery#leave
17901 * @param {AV.Object|AV.File} target updated object
17902 * @param {String[]} updatedKeys updated keys
17903 */
17904 _this2.emit(op, target, updatedKeys);
17905 } else {
17906 /**
17907 * A new AV.Object which fulfills the Query you subscribe is created.
17908 * @event AV.LiveQuery#create
17909 * @param {AV.Object|AV.File} target updated object
17910 */
17911 /**
17912 * An existing AV.Object which fulfills the Query you subscribe is deleted.
17913 * @event AV.LiveQuery#delete
17914 * @param {AV.Object|AV.File} target updated object
17915 */
17916 _this2.emit(op, target);
17917 }
17918 });
17919 },
17920
17921 /**
17922 * unsubscribe the query
17923 *
17924 * @return {Promise}
17925 */
17926 unsubscribe: function unsubscribe() {
17927 var client = this._client;
17928 client.off('message', this._onMessage);
17929 client.off('reconnect', this._onReconnect);
17930 client.deregister(this);
17931 return request({
17932 method: 'POST',
17933 path: '/LiveQuery/unsubscribe',
17934 data: {
17935 id: client.id,
17936 query_id: this.id
17937 }
17938 });
17939 }
17940 },
17941 /** @lends AV.LiveQuery */
17942 {
17943 init: function init(query) {
17944 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
17945 _ref2$subscriptionId = _ref2.subscriptionId,
17946 userDefinedSubscriptionId = _ref2$subscriptionId === undefined ? AV._getSubscriptionId() : _ref2$subscriptionId;
17947
17948 requireRealtime();
17949 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
17950 return _promise2.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
17951 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
17952 var _query$_getParams = query._getParams(),
17953 where = _query$_getParams.where,
17954 keys = _query$_getParams.keys,
17955 returnACL = _query$_getParams.returnACL;
17956
17957 var queryJSON = {
17958 where: where,
17959 keys: keys,
17960 returnACL: returnACL,
17961 className: query.className
17962 };
17963 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
17964 var queryId = _ref3.query_id;
17965 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
17966 }).finally(function () {
17967 liveQueryClient.deregister(promise);
17968 });
17969 liveQueryClient.register(promise);
17970 return promise;
17971 });
17972 });
17973 },
17974
17975 /**
17976 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
17977 * @static
17978 * @return void
17979 */
17980 pause: function pause() {
17981 requireRealtime();
17982 return AV._config.realtime.pause();
17983 },
17984
17985 /**
17986 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
17987 * @static
17988 * @return void
17989 */
17990 resume: function resume() {
17991 requireRealtime();
17992 return AV._config.realtime.resume();
17993 }
17994 });
17995};
17996
17997/***/ }),
17998/* 328 */
17999/***/ (function(module, exports, __webpack_require__) {
18000
18001"use strict";
18002
18003
18004var _ = __webpack_require__(0);
18005
18006var _require = __webpack_require__(15),
18007 tap = _require.tap;
18008
18009module.exports = function (AV) {
18010 /**
18011 * @class
18012 * @example
18013 * AV.Captcha.request().then(captcha => {
18014 * captcha.bind({
18015 * textInput: 'code', // the id for textInput
18016 * image: 'captcha',
18017 * verifyButton: 'verify',
18018 * }, {
18019 * success: (validateCode) => {}, // next step
18020 * error: (error) => {}, // present error.message to user
18021 * });
18022 * });
18023 */
18024 AV.Captcha = function Captcha(options, authOptions) {
18025 this._options = options;
18026 this._authOptions = authOptions;
18027 /**
18028 * The image url of the captcha
18029 * @type string
18030 */
18031 this.url = undefined;
18032 /**
18033 * The captchaToken of the captcha.
18034 * @type string
18035 */
18036 this.captchaToken = undefined;
18037 /**
18038 * The validateToken of the captcha.
18039 * @type string
18040 */
18041 this.validateToken = undefined;
18042 };
18043
18044 /**
18045 * Refresh the captcha
18046 * @return {Promise.<string>} a new capcha url
18047 */
18048 AV.Captcha.prototype.refresh = function refresh() {
18049 var _this = this;
18050
18051 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
18052 var captchaToken = _ref.captchaToken,
18053 url = _ref.url;
18054
18055 _.extend(_this, { captchaToken: captchaToken, url: url });
18056 return url;
18057 });
18058 };
18059
18060 /**
18061 * Verify the captcha
18062 * @param {String} code The code from user input
18063 * @return {Promise.<string>} validateToken if the code is valid
18064 */
18065 AV.Captcha.prototype.verify = function verify(code) {
18066 var _this2 = this;
18067
18068 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
18069 return _this2.validateToken = validateToken;
18070 }));
18071 };
18072
18073 if (true) {
18074 /**
18075 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
18076 * @param [elements]
18077 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
18078 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
18079 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
18080 * @param [callbacks]
18081 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
18082 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
18083 */
18084 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
18085 var _this3 = this;
18086
18087 var textInput = _ref2.textInput,
18088 image = _ref2.image,
18089 verifyButton = _ref2.verifyButton;
18090 var success = _ref3.success,
18091 error = _ref3.error;
18092
18093 if (typeof textInput === 'string') {
18094 textInput = document.getElementById(textInput);
18095 if (!textInput) throw new Error('textInput with id ' + textInput + ' not found');
18096 }
18097 if (typeof image === 'string') {
18098 image = document.getElementById(image);
18099 if (!image) throw new Error('image with id ' + image + ' not found');
18100 }
18101 if (typeof verifyButton === 'string') {
18102 verifyButton = document.getElementById(verifyButton);
18103 if (!verifyButton) throw new Error('verifyButton with id ' + verifyButton + ' not found');
18104 }
18105
18106 this.__refresh = function () {
18107 return _this3.refresh().then(function (url) {
18108 image.src = url;
18109 if (textInput) {
18110 textInput.value = '';
18111 textInput.focus();
18112 }
18113 }).catch(function (err) {
18114 return console.warn('refresh captcha fail: ' + err.message);
18115 });
18116 };
18117 if (image) {
18118 this.__image = image;
18119 image.src = this.url;
18120 image.addEventListener('click', this.__refresh);
18121 }
18122
18123 this.__verify = function () {
18124 var code = textInput.value;
18125 _this3.verify(code).catch(function (err) {
18126 _this3.__refresh();
18127 throw err;
18128 }).then(success, error).catch(function (err) {
18129 return console.warn('verify captcha fail: ' + err.message);
18130 });
18131 };
18132 if (textInput && verifyButton) {
18133 this.__verifyButton = verifyButton;
18134 verifyButton.addEventListener('click', this.__verify);
18135 }
18136 };
18137
18138 /**
18139 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
18140 */
18141 AV.Captcha.prototype.unbind = function unbind() {
18142 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
18143 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
18144 };
18145 }
18146
18147 /**
18148 * Request a captcha
18149 * @param [options]
18150 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
18151 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
18152 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
18153 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
18154 * @return {Promise.<AV.Captcha>}
18155 */
18156 AV.Captcha.request = function (options, authOptions) {
18157 var captcha = new AV.Captcha(options, authOptions);
18158 return captcha.refresh().then(function () {
18159 return captcha;
18160 });
18161 };
18162};
18163
18164/***/ }),
18165/* 329 */
18166/***/ (function(module, exports, __webpack_require__) {
18167
18168"use strict";
18169
18170
18171var _promise = __webpack_require__(3);
18172
18173var _promise2 = _interopRequireDefault(_promise);
18174
18175function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18176
18177var _ = __webpack_require__(0);
18178
18179var _require = __webpack_require__(12),
18180 _request = _require._request,
18181 request = _require.request;
18182
18183module.exports = function (AV) {
18184 /**
18185 * Contains functions for calling and declaring
18186 * <p><strong><em>
18187 * Some functions are only available from Cloud Code.
18188 * </em></strong></p>
18189 *
18190 * @namespace
18191 * @borrows AV.Captcha.request as requestCaptcha
18192 */
18193 AV.Cloud = AV.Cloud || {};
18194
18195 _.extend(AV.Cloud,
18196 /** @lends AV.Cloud */{
18197 /**
18198 * Makes a call to a cloud function.
18199 * @param {String} name The function name.
18200 * @param {Object} [data] The parameters to send to the cloud function.
18201 * @param {AuthOptions} [options]
18202 * @return {Promise} A promise that will be resolved with the result
18203 * of the function.
18204 */
18205 run: function run(name, data, options) {
18206 return request({
18207 service: 'engine',
18208 method: 'POST',
18209 path: '/functions/' + name,
18210 data: AV._encode(data, null, true),
18211 authOptions: options
18212 }).then(function (resp) {
18213 return AV._decode(resp).result;
18214 });
18215 },
18216
18217
18218 /**
18219 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
18220 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
18221 * @param {String} name The function name.
18222 * @param {Object} [data] The parameters to send to the cloud function.
18223 * @param {AuthOptions} [options]
18224 * @return {Promise} A promise that will be resolved with the result of the function.
18225 */
18226 rpc: function rpc(name, data, options) {
18227 if (_.isArray(data)) {
18228 return _promise2.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
18229 }
18230
18231 return request({
18232 service: 'engine',
18233 method: 'POST',
18234 path: '/call/' + name,
18235 data: AV._encodeObjectOrArray(data),
18236 authOptions: options
18237 }).then(function (resp) {
18238 return AV._decode(resp).result;
18239 });
18240 },
18241
18242
18243 /**
18244 * Make a call to request server date time.
18245 * @return {Promise.<Date>} A promise that will be resolved with the result
18246 * of the function.
18247 * @since 0.5.9
18248 */
18249 getServerDate: function getServerDate() {
18250 return _request('date', null, null, 'GET').then(function (resp) {
18251 return AV._decode(resp);
18252 });
18253 },
18254
18255
18256 /**
18257 * Makes a call to request an sms code for operation verification.
18258 * @param {String|Object} data The mobile phone number string or a JSON
18259 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
18260 * @param {String} data.mobilePhoneNumber
18261 * @param {String} [data.template] sms template name
18262 * @param {String} [data.sign] sms signature name
18263 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
18264 * @param {SMSAuthOptions} [options]
18265 * @return {Promise} A promise that will be resolved if the request succeed
18266 */
18267 requestSmsCode: function requestSmsCode(data) {
18268 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18269
18270 if (_.isString(data)) {
18271 data = { mobilePhoneNumber: data };
18272 }
18273 if (!data.mobilePhoneNumber) {
18274 throw new Error('Missing mobilePhoneNumber.');
18275 }
18276 if (options.validateToken) {
18277 data = _.extend({}, data, {
18278 validate_token: options.validateToken
18279 });
18280 }
18281 return _request('requestSmsCode', null, null, 'POST', data, options);
18282 },
18283
18284
18285 /**
18286 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
18287 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
18288 * @param {phone} phone The mobile phoner number.
18289 * @return {Promise} A promise that will be resolved with the result
18290 * of the function.
18291 */
18292 verifySmsCode: function verifySmsCode(code, phone) {
18293 if (!code) throw new Error('Missing sms code.');
18294 var params = {};
18295 if (_.isString(phone)) {
18296 params['mobilePhoneNumber'] = phone;
18297 }
18298
18299 return _request('verifySmsCode', code, null, 'POST', params);
18300 },
18301 _requestCaptcha: function _requestCaptcha(options, authOptions) {
18302 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
18303 var url = _ref.captcha_url,
18304 captchaToken = _ref.captcha_token;
18305 return {
18306 captchaToken: captchaToken,
18307 url: url
18308 };
18309 });
18310 },
18311
18312
18313 /**
18314 * Request a captcha.
18315 */
18316 requestCaptcha: AV.Captcha.request,
18317
18318 /**
18319 * Verify captcha code. This is the low-level API for captcha.
18320 * Checkout {@link AV.Captcha} for high abstract APIs.
18321 * @param {String} code the code from user input
18322 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
18323 * @return {Promise.<String>} validateToken if the code is valid
18324 */
18325 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
18326 return _request('verifyCaptcha', null, null, 'POST', {
18327 captcha_code: code,
18328 captcha_token: captchaToken
18329 }).then(function (_ref2) {
18330 var validateToken = _ref2.validate_token;
18331 return validateToken;
18332 });
18333 }
18334 });
18335};
18336
18337/***/ }),
18338/* 330 */
18339/***/ (function(module, exports, __webpack_require__) {
18340
18341"use strict";
18342
18343
18344var request = __webpack_require__(12).request;
18345
18346module.exports = function (AV) {
18347 AV.Installation = AV.Object.extend('_Installation');
18348
18349 /**
18350 * @namespace
18351 */
18352 AV.Push = AV.Push || {};
18353
18354 /**
18355 * Sends a push notification.
18356 * @param {Object} data The data of the push notification.
18357 * @param {String[]} [data.channels] An Array of channels to push to.
18358 * @param {Date} [data.push_time] A Date object for when to send the push.
18359 * @param {Date} [data.expiration_time] A Date object for when to expire
18360 * the push.
18361 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
18362 * @param {Number} [data.flow_control] The clients to notify per second
18363 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
18364 * a set of installations to push to.
18365 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
18366 * a set of installations to push to.
18367 * @param {Object} data.data The data to send as part of the push.
18368 More details: https://url.leanapp.cn/pushData
18369 * @param {AuthOptions} [options]
18370 * @return {Promise}
18371 */
18372 AV.Push.send = function (data, options) {
18373 if (data.where) {
18374 data.where = data.where._getParams().where;
18375 }
18376
18377 if (data.where && data.cql) {
18378 throw new Error("Both where and cql can't be set");
18379 }
18380
18381 if (data.push_time) {
18382 data.push_time = data.push_time.toJSON();
18383 }
18384
18385 if (data.expiration_time) {
18386 data.expiration_time = data.expiration_time.toJSON();
18387 }
18388
18389 if (data.expiration_time && data.expiration_interval) {
18390 throw new Error("Both expiration_time and expiration_interval can't be set");
18391 }
18392
18393 return request({
18394 service: 'push',
18395 method: 'POST',
18396 path: '/push',
18397 data: data,
18398 authOptions: options
18399 });
18400 };
18401};
18402
18403/***/ }),
18404/* 331 */
18405/***/ (function(module, exports, __webpack_require__) {
18406
18407"use strict";
18408
18409
18410var _promise = __webpack_require__(3);
18411
18412var _promise2 = _interopRequireDefault(_promise);
18413
18414var _typeof2 = __webpack_require__(30);
18415
18416var _typeof3 = _interopRequireDefault(_typeof2);
18417
18418function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18419
18420var _ = __webpack_require__(0);
18421var AVRequest = __webpack_require__(12)._request;
18422
18423var _require = __webpack_require__(15),
18424 getSessionToken = _require.getSessionToken;
18425
18426module.exports = function (AV) {
18427 var getUser = function getUser() {
18428 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18429
18430 var sessionToken = getSessionToken(options);
18431 if (sessionToken) {
18432 return AV.User._fetchUserBySessionToken(getSessionToken(options));
18433 }
18434 return AV.User.currentAsync();
18435 };
18436
18437 var getUserPointer = function getUserPointer(options) {
18438 return getUser(options).then(function (currUser) {
18439 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
18440 });
18441 };
18442
18443 /**
18444 * Contains functions to deal with Status in LeanCloud.
18445 * @class
18446 */
18447 AV.Status = function (imageUrl, message) {
18448 this.data = {};
18449 this.inboxType = 'default';
18450 this.query = null;
18451 if (imageUrl && (typeof imageUrl === 'undefined' ? 'undefined' : (0, _typeof3.default)(imageUrl)) === 'object') {
18452 this.data = imageUrl;
18453 } else {
18454 if (imageUrl) {
18455 this.data.image = imageUrl;
18456 }
18457 if (message) {
18458 this.data.message = message;
18459 }
18460 }
18461 return this;
18462 };
18463
18464 _.extend(AV.Status.prototype,
18465 /** @lends AV.Status.prototype */{
18466 /**
18467 * Gets the value of an attribute in status data.
18468 * @param {String} attr The string name of an attribute.
18469 */
18470 get: function get(attr) {
18471 return this.data[attr];
18472 },
18473 /**
18474 * Sets a hash of model attributes on the status data.
18475 * @param {String} key The key to set.
18476 * @param {} value The value to give it.
18477 */
18478 set: function set(key, value) {
18479 this.data[key] = value;
18480 return this;
18481 },
18482 /**
18483 * Destroy this status,then it will not be avaiable in other user's inboxes.
18484 * @param {AuthOptions} options
18485 * @return {Promise} A promise that is fulfilled when the destroy
18486 * completes.
18487 */
18488 destroy: function destroy(options) {
18489 if (!this.id) return _promise2.default.reject(new Error('The status id is not exists.'));
18490 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
18491 return request;
18492 },
18493 /**
18494 * Cast the AV.Status object to an AV.Object pointer.
18495 * @return {AV.Object} A AV.Object pointer.
18496 */
18497 toObject: function toObject() {
18498 if (!this.id) return null;
18499 return AV.Object.createWithoutData('_Status', this.id);
18500 },
18501 _getDataJSON: function _getDataJSON() {
18502 var json = _.clone(this.data);
18503 return AV._encode(json);
18504 },
18505 /**
18506 * Send a status by a AV.Query object.
18507 * @since 0.3.0
18508 * @param {AuthOptions} options
18509 * @return {Promise} A promise that is fulfilled when the send
18510 * completes.
18511 * @example
18512 * // send a status to male users
18513 * var status = new AVStatus('image url', 'a message');
18514 * status.query = new AV.Query('_User');
18515 * status.query.equalTo('gender', 'male');
18516 * status.send().then(function(){
18517 * //send status successfully.
18518 * }, function(err){
18519 * //an error threw.
18520 * console.dir(err);
18521 * });
18522 */
18523 send: function send() {
18524 var _this = this;
18525
18526 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18527
18528 if (!getSessionToken(options) && !AV.User.current()) {
18529 throw new Error('Please signin an user.');
18530 }
18531 if (!this.query) {
18532 return AV.Status.sendStatusToFollowers(this, options);
18533 }
18534
18535 return getUserPointer(options).then(function (currUser) {
18536 var query = _this.query._getParams();
18537 query.className = _this.query.className;
18538 var data = {};
18539 data.query = query;
18540 _this.data = _this.data || {};
18541 _this.data.source = _this.data.source || currUser;
18542 data.data = _this._getDataJSON();
18543 data.inboxType = _this.inboxType || 'default';
18544
18545 return AVRequest('statuses', null, null, 'POST', data, options);
18546 }).then(function (response) {
18547 _this.id = response.objectId;
18548 _this.createdAt = AV._parseDate(response.createdAt);
18549 return _this;
18550 });
18551 },
18552
18553 _finishFetch: function _finishFetch(serverData) {
18554 this.id = serverData.objectId;
18555 this.createdAt = AV._parseDate(serverData.createdAt);
18556 this.updatedAt = AV._parseDate(serverData.updatedAt);
18557 this.messageId = serverData.messageId;
18558 delete serverData.messageId;
18559 delete serverData.objectId;
18560 delete serverData.createdAt;
18561 delete serverData.updatedAt;
18562 this.data = AV._decode(serverData);
18563 }
18564 });
18565
18566 /**
18567 * Send a status to current signined user's followers.
18568 * @since 0.3.0
18569 * @param {AV.Status} status A status object to be send to followers.
18570 * @param {AuthOptions} options
18571 * @return {Promise} A promise that is fulfilled when the send
18572 * completes.
18573 * @example
18574 * var status = new AVStatus('image url', 'a message');
18575 * AV.Status.sendStatusToFollowers(status).then(function(){
18576 * //send status successfully.
18577 * }, function(err){
18578 * //an error threw.
18579 * console.dir(err);
18580 * });
18581 */
18582 AV.Status.sendStatusToFollowers = function (status) {
18583 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18584
18585 if (!getSessionToken(options) && !AV.User.current()) {
18586 throw new Error('Please signin an user.');
18587 }
18588 return getUserPointer(options).then(function (currUser) {
18589 var query = {};
18590 query.className = '_Follower';
18591 query.keys = 'follower';
18592 query.where = { user: currUser };
18593 var data = {};
18594 data.query = query;
18595 status.data = status.data || {};
18596 status.data.source = status.data.source || currUser;
18597 data.data = status._getDataJSON();
18598 data.inboxType = status.inboxType || 'default';
18599
18600 var request = AVRequest('statuses', null, null, 'POST', data, options);
18601 return request.then(function (response) {
18602 status.id = response.objectId;
18603 status.createdAt = AV._parseDate(response.createdAt);
18604 return status;
18605 });
18606 });
18607 };
18608
18609 /**
18610 * <p>Send a status from current signined user to other user's private status inbox.</p>
18611 * @since 0.3.0
18612 * @param {AV.Status} status A status object to be send to followers.
18613 * @param {String} target The target user or user's objectId.
18614 * @param {AuthOptions} options
18615 * @return {Promise} A promise that is fulfilled when the send
18616 * completes.
18617 * @example
18618 * // send a private status to user '52e84e47e4b0f8de283b079b'
18619 * var status = new AVStatus('image url', 'a message');
18620 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
18621 * //send status successfully.
18622 * }, function(err){
18623 * //an error threw.
18624 * console.dir(err);
18625 * });
18626 */
18627 AV.Status.sendPrivateStatus = function (status, target) {
18628 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18629
18630 if (!getSessionToken(options) && !AV.User.current()) {
18631 throw new Error('Please signin an user.');
18632 }
18633 if (!target) {
18634 throw new Error('Invalid target user.');
18635 }
18636 var userObjectId = _.isString(target) ? target : target.id;
18637 if (!userObjectId) {
18638 throw new Error('Invalid target user.');
18639 }
18640 return getUserPointer(options).then(function (currUser) {
18641 var query = {};
18642 query.className = '_User';
18643 query.where = { objectId: userObjectId };
18644 var data = {};
18645 data.query = query;
18646 status.data = status.data || {};
18647 status.data.source = status.data.source || currUser;
18648 data.data = status._getDataJSON();
18649 data.inboxType = 'private';
18650 status.inboxType = 'private';
18651
18652 var request = AVRequest('statuses', null, null, 'POST', data, options);
18653 return request.then(function (response) {
18654 status.id = response.objectId;
18655 status.createdAt = AV._parseDate(response.createdAt);
18656 return status;
18657 });
18658 });
18659 };
18660
18661 /**
18662 * Count unread statuses in someone's inbox.
18663 * @since 0.3.0
18664 * @param {AV.User} owner The status owner.
18665 * @param {String} inboxType The inbox type, 'default' by default.
18666 * @param {AuthOptions} options
18667 * @return {Promise} A promise that is fulfilled when the count
18668 * completes.
18669 * @example
18670 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
18671 * console.log(response.unread); //unread statuses number.
18672 * console.log(response.total); //total statuses number.
18673 * });
18674 */
18675 AV.Status.countUnreadStatuses = function (owner) {
18676 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
18677 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18678
18679 if (!_.isString(inboxType)) options = inboxType;
18680 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
18681 throw new Error('Please signin an user or pass the owner objectId.');
18682 }
18683 return _promise2.default.resolve(owner || getUser(options)).then(function (owner) {
18684 var params = {};
18685 params.inboxType = AV._encode(inboxType);
18686 params.owner = AV._encode(owner);
18687 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
18688 });
18689 };
18690
18691 /**
18692 * reset unread statuses count in someone's inbox.
18693 * @since 2.1.0
18694 * @param {AV.User} owner The status owner.
18695 * @param {String} inboxType The inbox type, 'default' by default.
18696 * @param {AuthOptions} options
18697 * @return {Promise} A promise that is fulfilled when the reset
18698 * completes.
18699 * @example
18700 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
18701 * console.log(response.unread); //unread statuses number.
18702 * console.log(response.total); //total statuses number.
18703 * });
18704 */
18705 AV.Status.resetUnreadCount = function (owner) {
18706 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
18707 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18708
18709 if (!_.isString(inboxType)) options = inboxType;
18710 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
18711 throw new Error('Please signin an user or pass the owner objectId.');
18712 }
18713 return _promise2.default.resolve(owner || getUser(options)).then(function (owner) {
18714 var params = {};
18715 params.inboxType = AV._encode(inboxType);
18716 params.owner = AV._encode(owner);
18717 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
18718 });
18719 };
18720
18721 /**
18722 * Create a status query to find someone's published statuses.
18723 * @since 0.3.0
18724 * @param {AV.User} source The status source, typically the publisher.
18725 * @return {AV.Query} The query object for status.
18726 * @example
18727 * //Find current user's published statuses.
18728 * var query = AV.Status.statusQuery(AV.User.current());
18729 * query.find().then(function(statuses){
18730 * //process statuses
18731 * });
18732 */
18733 AV.Status.statusQuery = function (source) {
18734 var query = new AV.Query('_Status');
18735 if (source) {
18736 query.equalTo('source', source);
18737 }
18738 return query;
18739 };
18740
18741 /**
18742 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
18743 * @class
18744 */
18745 AV.InboxQuery = AV.Query._extend(
18746 /** @lends AV.InboxQuery.prototype */{
18747 _objectClass: AV.Status,
18748 _sinceId: 0,
18749 _maxId: 0,
18750 _inboxType: 'default',
18751 _owner: null,
18752 _newObject: function _newObject() {
18753 return new AV.Status();
18754 },
18755 _createRequest: function _createRequest(params, options) {
18756 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
18757 },
18758
18759 /**
18760 * Sets the messageId of results to skip before returning any results.
18761 * This is useful for pagination.
18762 * Default is zero.
18763 * @param {Number} n the mesage id.
18764 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18765 */
18766 sinceId: function sinceId(id) {
18767 this._sinceId = id;
18768 return this;
18769 },
18770 /**
18771 * Sets the maximal messageId of results。
18772 * This is useful for pagination.
18773 * Default is zero that is no limition.
18774 * @param {Number} n the mesage id.
18775 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18776 */
18777 maxId: function maxId(id) {
18778 this._maxId = id;
18779 return this;
18780 },
18781 /**
18782 * Sets the owner of the querying inbox.
18783 * @param {AV.User} owner The inbox owner.
18784 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18785 */
18786 owner: function owner(_owner) {
18787 this._owner = _owner;
18788 return this;
18789 },
18790 /**
18791 * Sets the querying inbox type.default is 'default'.
18792 * @param {Object} type The inbox type.
18793 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18794 */
18795 inboxType: function inboxType(type) {
18796 this._inboxType = type;
18797 return this;
18798 },
18799 _getParams: function _getParams() {
18800 var params = AV.InboxQuery.__super__._getParams.call(this);
18801 params.owner = AV._encode(this._owner);
18802 params.inboxType = AV._encode(this._inboxType);
18803 params.sinceId = AV._encode(this._sinceId);
18804 params.maxId = AV._encode(this._maxId);
18805 return params;
18806 }
18807 });
18808
18809 /**
18810 * Create a inbox status query to find someone's inbox statuses.
18811 * @since 0.3.0
18812 * @param {AV.User} owner The inbox's owner
18813 * @param {String} inboxType The inbox type,'default' by default.
18814 * @return {AV.InboxQuery} The inbox query object.
18815 * @see AV.InboxQuery
18816 * @example
18817 * //Find current user's default inbox statuses.
18818 * var query = AV.Status.inboxQuery(AV.User.current());
18819 * //find the statuses after the last message id
18820 * query.sinceId(lastMessageId);
18821 * query.find().then(function(statuses){
18822 * //process statuses
18823 * });
18824 */
18825 AV.Status.inboxQuery = function (owner, inboxType) {
18826 var query = new AV.InboxQuery(AV.Status);
18827 if (owner) {
18828 query._owner = owner;
18829 }
18830 if (inboxType) {
18831 query._inboxType = inboxType;
18832 }
18833 return query;
18834 };
18835};
18836
18837/***/ }),
18838/* 332 */
18839/***/ (function(module, exports, __webpack_require__) {
18840
18841"use strict";
18842
18843
18844var _stringify = __webpack_require__(19);
18845
18846var _stringify2 = _interopRequireDefault(_stringify);
18847
18848function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18849
18850var _ = __webpack_require__(0);
18851var AVRequest = __webpack_require__(12)._request;
18852
18853module.exports = function (AV) {
18854 /**
18855 * A builder to generate sort string for app searching.For example:
18856 * @class
18857 * @since 0.5.1
18858 * @example
18859 * var builder = new AV.SearchSortBuilder();
18860 * builder.ascending('key1').descending('key2','max');
18861 * var query = new AV.SearchQuery('Player');
18862 * query.sortBy(builder);
18863 * query.find().then();
18864 */
18865 AV.SearchSortBuilder = function () {
18866 this._sortFields = [];
18867 };
18868
18869 _.extend(AV.SearchSortBuilder.prototype,
18870 /** @lends AV.SearchSortBuilder.prototype */{
18871 _addField: function _addField(key, order, mode, missing) {
18872 var field = {};
18873 field[key] = {
18874 order: order || 'asc',
18875 mode: mode || 'avg',
18876 missing: '_' + (missing || 'last')
18877 };
18878 this._sortFields.push(field);
18879 return this;
18880 },
18881
18882 /**
18883 * Sorts the results in ascending order by the given key and options.
18884 *
18885 * @param {String} key The key to order by.
18886 * @param {String} mode The sort mode, default is 'avg', you can choose
18887 * 'max' or 'min' too.
18888 * @param {String} missing The missing key behaviour, default is 'last',
18889 * you can choose 'first' too.
18890 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
18891 */
18892 ascending: function ascending(key, mode, missing) {
18893 return this._addField(key, 'asc', mode, missing);
18894 },
18895
18896 /**
18897 * Sorts the results in descending order by the given key and options.
18898 *
18899 * @param {String} key The key to order by.
18900 * @param {String} mode The sort mode, default is 'avg', you can choose
18901 * 'max' or 'min' too.
18902 * @param {String} missing The missing key behaviour, default is 'last',
18903 * you can choose 'first' too.
18904 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
18905 */
18906 descending: function descending(key, mode, missing) {
18907 return this._addField(key, 'desc', mode, missing);
18908 },
18909
18910 /**
18911 * Add a proximity based constraint for finding objects with key point
18912 * values near the point given.
18913 * @param {String} key The key that the AV.GeoPoint is stored in.
18914 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
18915 * @param {Object} options The other options such as mode,order, unit etc.
18916 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
18917 */
18918 whereNear: function whereNear(key, point, options) {
18919 options = options || {};
18920 var field = {};
18921 var geo = {
18922 lat: point.latitude,
18923 lon: point.longitude
18924 };
18925 var m = {
18926 order: options.order || 'asc',
18927 mode: options.mode || 'avg',
18928 unit: options.unit || 'km'
18929 };
18930 m[key] = geo;
18931 field['_geo_distance'] = m;
18932
18933 this._sortFields.push(field);
18934 return this;
18935 },
18936
18937 /**
18938 * Build a sort string by configuration.
18939 * @return {String} the sort string.
18940 */
18941 build: function build() {
18942 return (0, _stringify2.default)(AV._encode(this._sortFields));
18943 }
18944 });
18945
18946 /**
18947 * App searching query.Use just like AV.Query:
18948 *
18949 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
18950 * for more details.
18951 * @class
18952 * @since 0.5.1
18953 * @example
18954 * var query = new AV.SearchQuery('Player');
18955 * query.queryString('*');
18956 * query.find().then(function(results) {
18957 * console.log('Found %d objects', query.hits());
18958 * //Process results
18959 * });
18960 */
18961 AV.SearchQuery = AV.Query._extend(
18962 /** @lends AV.SearchQuery.prototype */{
18963 _sid: null,
18964 _hits: 0,
18965 _queryString: null,
18966 _highlights: null,
18967 _sortBuilder: null,
18968 _clazz: null,
18969
18970 constructor: function constructor(className) {
18971 if (className) {
18972 this._clazz = className;
18973 } else {
18974 className = '__INVALID_CLASS';
18975 }
18976 AV.Query.call(this, className);
18977 },
18978
18979 _createRequest: function _createRequest(params, options) {
18980 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
18981 },
18982
18983 /**
18984 * Sets the sid of app searching query.Default is null.
18985 * @param {String} sid Scroll id for searching.
18986 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18987 */
18988 sid: function sid(_sid) {
18989 this._sid = _sid;
18990 return this;
18991 },
18992
18993 /**
18994 * Sets the query string of app searching.
18995 * @param {String} q The query string.
18996 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18997 */
18998 queryString: function queryString(q) {
18999 this._queryString = q;
19000 return this;
19001 },
19002
19003 /**
19004 * Sets the highlight fields. Such as
19005 * <pre><code>
19006 * query.highlights('title');
19007 * //or pass an array.
19008 * query.highlights(['title', 'content'])
19009 * </code></pre>
19010 * @param {String|String[]} highlights a list of fields.
19011 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19012 */
19013 highlights: function highlights(_highlights) {
19014 var objects;
19015 if (_highlights && _.isString(_highlights)) {
19016 objects = _.toArray(arguments);
19017 } else {
19018 objects = _highlights;
19019 }
19020 this._highlights = objects;
19021 return this;
19022 },
19023
19024 /**
19025 * Sets the sort builder for this query.
19026 * @see AV.SearchSortBuilder
19027 * @param { AV.SearchSortBuilder} builder The sort builder.
19028 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19029 *
19030 */
19031 sortBy: function sortBy(builder) {
19032 this._sortBuilder = builder;
19033 return this;
19034 },
19035
19036 /**
19037 * Returns the number of objects that match this query.
19038 * @return {Number}
19039 */
19040 hits: function hits() {
19041 if (!this._hits) {
19042 this._hits = 0;
19043 }
19044 return this._hits;
19045 },
19046
19047 _processResult: function _processResult(json) {
19048 delete json['className'];
19049 delete json['_app_url'];
19050 delete json['_deeplink'];
19051 return json;
19052 },
19053
19054 /**
19055 * Returns true when there are more documents can be retrieved by this
19056 * query instance, you can call find function to get more results.
19057 * @see AV.SearchQuery#find
19058 * @return {Boolean}
19059 */
19060 hasMore: function hasMore() {
19061 return !this._hitEnd;
19062 },
19063
19064 /**
19065 * Reset current query instance state(such as sid, hits etc) except params
19066 * for a new searching. After resetting, hasMore() will return true.
19067 */
19068 reset: function reset() {
19069 this._hitEnd = false;
19070 this._sid = null;
19071 this._hits = 0;
19072 },
19073
19074 /**
19075 * Retrieves a list of AVObjects that satisfy this query.
19076 * Either options.success or options.error is called when the find
19077 * completes.
19078 *
19079 * @see AV.Query#find
19080 * @param {AuthOptions} options
19081 * @return {Promise} A promise that is resolved with the results when
19082 * the query completes.
19083 */
19084 find: function find(options) {
19085 var self = this;
19086
19087 var request = this._createRequest(undefined, options);
19088
19089 return request.then(function (response) {
19090 //update sid for next querying.
19091 if (response.sid) {
19092 self._oldSid = self._sid;
19093 self._sid = response.sid;
19094 } else {
19095 self._sid = null;
19096 self._hitEnd = true;
19097 }
19098 self._hits = response.hits || 0;
19099
19100 return _.map(response.results, function (json) {
19101 if (json.className) {
19102 response.className = json.className;
19103 }
19104 var obj = self._newObject(response);
19105 obj.appURL = json['_app_url'];
19106 obj._finishFetch(self._processResult(json), true);
19107 return obj;
19108 });
19109 });
19110 },
19111
19112 _getParams: function _getParams() {
19113 var params = AV.SearchQuery.__super__._getParams.call(this);
19114 delete params.where;
19115 if (this._clazz) {
19116 params.clazz = this.className;
19117 }
19118 if (this._sid) {
19119 params.sid = this._sid;
19120 }
19121 if (!this._queryString) {
19122 throw new Error('Please set query string.');
19123 } else {
19124 params.q = this._queryString;
19125 }
19126 if (this._highlights) {
19127 params.highlights = this._highlights.join(',');
19128 }
19129 if (this._sortBuilder && params.order) {
19130 throw new Error('sort and order can not be set at same time.');
19131 }
19132 if (this._sortBuilder) {
19133 params.sort = this._sortBuilder.build();
19134 }
19135
19136 return params;
19137 }
19138 });
19139};
19140
19141/**
19142 * Sorts the results in ascending order by the given key.
19143 *
19144 * @method AV.SearchQuery#ascending
19145 * @param {String} key The key to order by.
19146 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19147 */
19148/**
19149 * Also sorts the results in ascending order by the given key. The previous sort keys have
19150 * precedence over this key.
19151 *
19152 * @method AV.SearchQuery#addAscending
19153 * @param {String} key The key to order by
19154 * @return {AV.SearchQuery} Returns the query so you can chain this call.
19155 */
19156/**
19157 * Sorts the results in descending order by the given key.
19158 *
19159 * @method AV.SearchQuery#descending
19160 * @param {String} key The key to order by.
19161 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19162 */
19163/**
19164 * Also sorts the results in descending order by the given key. The previous sort keys have
19165 * precedence over this key.
19166 *
19167 * @method AV.SearchQuery#addDescending
19168 * @param {String} key The key to order by
19169 * @return {AV.SearchQuery} Returns the query so you can chain this call.
19170 */
19171/**
19172 * Include nested AV.Objects for the provided key. You can use dot
19173 * notation to specify which fields in the included object are also fetch.
19174 * @method AV.SearchQuery#include
19175 * @param {String[]} keys The name of the key to include.
19176 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19177 */
19178/**
19179 * Sets the number of results to skip before returning any results.
19180 * This is useful for pagination.
19181 * Default is to skip zero results.
19182 * @method AV.SearchQuery#skip
19183 * @param {Number} n the number of results to skip.
19184 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19185 */
19186/**
19187 * Sets the limit of the number of results to return. The default limit is
19188 * 100, with a maximum of 1000 results being returned at a time.
19189 * @method AV.SearchQuery#limit
19190 * @param {Number} n the number of results to limit to.
19191 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19192 */
19193
19194/***/ }),
19195/* 333 */
19196/***/ (function(module, exports, __webpack_require__) {
19197
19198"use strict";
19199
19200
19201var _promise = __webpack_require__(3);
19202
19203var _promise2 = _interopRequireDefault(_promise);
19204
19205function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19206
19207var _ = __webpack_require__(0);
19208var AVError = __webpack_require__(29);
19209
19210var _require = __webpack_require__(12),
19211 request = _require.request;
19212
19213module.exports = function (AV) {
19214 /**
19215 * 包含了使用了 LeanCloud
19216 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
19217 * <p><strong><em>
19218 * 仅在云引擎运行环境下有效。
19219 * </em></strong></p>
19220 * @namespace
19221 */
19222 AV.Insight = AV.Insight || {};
19223
19224 _.extend(AV.Insight,
19225 /** @lends AV.Insight */{
19226 /**
19227 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
19228 * AV.Insight.JobQuery 查询任务状态和结果。
19229 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
19230 * { "sql" : "select count(*) as c,gender from _User group by gender",
19231 * "saveAs": {
19232 * "className" : "UserGender",
19233 * "limit": 1
19234 * }
19235 * }
19236 * </pre></code>
19237 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
19238 * @param {AuthOptions} [options]
19239 * @return {Promise} A promise that will be resolved with the result
19240 * of the function.
19241 */
19242 startJob: function startJob(jobConfig, options) {
19243 if (!jobConfig || !jobConfig.sql) {
19244 throw new Error('Please provide the sql to run the job.');
19245 }
19246 var data = {
19247 jobConfig: jobConfig,
19248 appId: AV.applicationId
19249 };
19250 return request({
19251 path: '/bigquery/jobs',
19252 method: 'POST',
19253 data: AV._encode(data, null, true),
19254 authOptions: options,
19255 signKey: false
19256 }).then(function (resp) {
19257 return AV._decode(resp).id;
19258 });
19259 },
19260
19261 /**
19262 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
19263 * <p><strong><em>
19264 * 仅在云引擎运行环境下有效。
19265 * </em></strong></p>
19266 * @param {String} event 监听的事件,目前尚不支持。
19267 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
19268 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
19269 *
19270 */
19271 on: function on(event, cb) {}
19272 });
19273
19274 /**
19275 * 创建一个对象,用于查询 Insight 任务状态和结果。
19276 * @class
19277 * @param {String} id 任务 id
19278 * @since 0.5.5
19279 */
19280 AV.Insight.JobQuery = function (id, className) {
19281 if (!id) {
19282 throw new Error('Please provide the job id.');
19283 }
19284 this.id = id;
19285 this.className = className;
19286 this._skip = 0;
19287 this._limit = 100;
19288 };
19289
19290 _.extend(AV.Insight.JobQuery.prototype,
19291 /** @lends AV.Insight.JobQuery.prototype */{
19292 /**
19293 * Sets the number of results to skip before returning any results.
19294 * This is useful for pagination.
19295 * Default is to skip zero results.
19296 * @param {Number} n the number of results to skip.
19297 * @return {AV.Query} Returns the query, so you can chain this call.
19298 */
19299 skip: function skip(n) {
19300 this._skip = n;
19301 return this;
19302 },
19303
19304 /**
19305 * Sets the limit of the number of results to return. The default limit is
19306 * 100, with a maximum of 1000 results being returned at a time.
19307 * @param {Number} n the number of results to limit to.
19308 * @return {AV.Query} Returns the query, so you can chain this call.
19309 */
19310 limit: function limit(n) {
19311 this._limit = n;
19312 return this;
19313 },
19314
19315 /**
19316 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
19317 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
19318 * startTime、endTime 等信息。
19319 *
19320 * @param {AuthOptions} [options]
19321 * @return {Promise} A promise that will be resolved with the result
19322 * of the function.
19323 *
19324 */
19325 find: function find(options) {
19326 var params = {
19327 skip: this._skip,
19328 limit: this._limit
19329 };
19330
19331 return request({
19332 path: '/bigquery/jobs/' + this.id,
19333 method: 'GET',
19334 query: params,
19335 authOptions: options,
19336 signKey: false
19337 }).then(function (response) {
19338 if (response.error) {
19339 return _promise2.default.reject(new AVError(response.code, response.error));
19340 }
19341 return _promise2.default.resolve(response);
19342 });
19343 }
19344 });
19345};
19346
19347/***/ }),
19348/* 334 */
19349/***/ (function(module, exports, __webpack_require__) {
19350
19351"use strict";
19352
19353
19354var _ = __webpack_require__(0);
19355
19356var _require = __webpack_require__(12),
19357 LCRequest = _require.request;
19358
19359var _require2 = __webpack_require__(15),
19360 getSessionToken = _require2.getSessionToken;
19361
19362module.exports = function (AV) {
19363 /**
19364 * Contains functions to deal with Friendship in LeanCloud.
19365 * @class
19366 */
19367 AV.Friendship = {
19368 /**
19369 * Request friendship.
19370 * @since 4.8.0
19371 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
19372 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
19373 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
19374 * @param {*} [authOptions]
19375 * @return {Promise<void>}
19376 */
19377 request: function request(options, authOptions) {
19378 if (!AV.User.current()) {
19379 throw new Error('Please signin an user.');
19380 }
19381 var friend = void 0;
19382 var attributes = void 0;
19383 if (options.friend) {
19384 friend = options.friend;
19385 attributes = options.attributes;
19386 } else {
19387 friend = options;
19388 }
19389 var friendObject = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
19390 return LCRequest({
19391 method: 'POST',
19392 path: '/users/friendshipRequests',
19393 data: AV._encode({
19394 user: AV.User.current(),
19395 friend: friendObject,
19396 friendship: attributes
19397 }),
19398 authOptions: authOptions
19399 });
19400 },
19401
19402 /**
19403 * Accept a friendship request.
19404 * @since 4.8.0
19405 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
19406 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
19407 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
19408 * @param {AuthOptions} [authOptions]
19409 * @return {Promise<void>}
19410 */
19411 acceptRequest: function acceptRequest(options) {
19412 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19413
19414 if (!getSessionToken(authOptions) && !AV.User.current()) {
19415 throw new Error('Please signin an user.');
19416 }
19417 var request = void 0;
19418 var attributes = void 0;
19419 if (options.request) {
19420 request = options.request;
19421 attributes = options.attributes;
19422 } else {
19423 request = options;
19424 }
19425 var requestId = _.isString(request) ? request : request.id;
19426 return LCRequest({
19427 method: 'PUT',
19428 path: '/users/friendshipRequests/' + requestId + '/accept',
19429 data: {
19430 friendship: AV._encode(attributes)
19431 },
19432 authOptions: authOptions
19433 });
19434 },
19435
19436 /**
19437 * Decline a friendship request.
19438 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
19439 * @param {AuthOptions} [authOptions]
19440 * @return {Promise<void>}
19441 */
19442 declineRequest: function declineRequest(request) {
19443 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19444
19445 if (!getSessionToken(authOptions) && !AV.User.current()) {
19446 throw new Error('Please signin an user.');
19447 }
19448 var requestId = _.isString(request) ? request : request.id;
19449 return LCRequest({
19450 method: 'PUT',
19451 path: '/users/friendshipRequests/' + requestId + '/decline',
19452 authOptions: authOptions
19453 });
19454 }
19455 };
19456};
19457
19458/***/ }),
19459/* 335 */
19460/***/ (function(module, exports, __webpack_require__) {
19461
19462"use strict";
19463
19464
19465var _stringify = __webpack_require__(19);
19466
19467var _stringify2 = _interopRequireDefault(_stringify);
19468
19469function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19470
19471var _ = __webpack_require__(0);
19472
19473var _require = __webpack_require__(12),
19474 _request = _require._request;
19475
19476var AV = __webpack_require__(36);
19477
19478var serializeMessage = function serializeMessage(message) {
19479 if (typeof message === 'string') {
19480 return message;
19481 }
19482 if (typeof message.getPayload === 'function') {
19483 return (0, _stringify2.default)(message.getPayload());
19484 }
19485 return (0, _stringify2.default)(message);
19486};
19487
19488/**
19489 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
19490 * conversation. This class is a subclass of AV.Object, and retains the
19491 * same functionality of an AV.Object, but also extends it with various
19492 * conversation specific methods, like get members, creators of this conversation.
19493 * </p>
19494 *
19495 * @class AV.Conversation
19496 * @param {String} name The name of the Role to create.
19497 * @param {Object} [options]
19498 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
19499 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
19500 */
19501module.exports = AV.Object.extend('_Conversation',
19502/** @lends AV.Conversation.prototype */{
19503 constructor: function constructor(name) {
19504 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19505
19506 AV.Object.prototype.constructor.call(this, null, null);
19507 this.set('name', name);
19508 if (options.isSystem !== undefined) {
19509 this.set('sys', options.isSystem ? true : false);
19510 }
19511 if (options.isTransient !== undefined) {
19512 this.set('tr', options.isTransient ? true : false);
19513 }
19514 },
19515
19516 /**
19517 * Get current conversation's creator.
19518 *
19519 * @return {String}
19520 */
19521 getCreator: function getCreator() {
19522 return this.get('c');
19523 },
19524
19525
19526 /**
19527 * Get the last message's time.
19528 *
19529 * @return {Date}
19530 */
19531 getLastMessageAt: function getLastMessageAt() {
19532 return this.get('lm');
19533 },
19534
19535
19536 /**
19537 * Get this conversation's members
19538 *
19539 * @return {String[]}
19540 */
19541 getMembers: function getMembers() {
19542 return this.get('m');
19543 },
19544
19545
19546 /**
19547 * Add a member to this conversation
19548 *
19549 * @param {String} member
19550 */
19551 addMember: function addMember(member) {
19552 return this.add('m', member);
19553 },
19554
19555
19556 /**
19557 * Get this conversation's members who set this conversation as muted.
19558 *
19559 * @return {String[]}
19560 */
19561 getMutedMembers: function getMutedMembers() {
19562 return this.get('mu');
19563 },
19564
19565
19566 /**
19567 * Get this conversation's name field.
19568 *
19569 * @return String
19570 */
19571 getName: function getName() {
19572 return this.get('name');
19573 },
19574
19575
19576 /**
19577 * Returns true if this conversation is transient conversation.
19578 *
19579 * @return {Boolean}
19580 */
19581 isTransient: function isTransient() {
19582 return this.get('tr');
19583 },
19584
19585
19586 /**
19587 * Returns true if this conversation is system conversation.
19588 *
19589 * @return {Boolean}
19590 */
19591 isSystem: function isSystem() {
19592 return this.get('sys');
19593 },
19594
19595
19596 /**
19597 * Send realtime message to this conversation, using HTTP request.
19598 *
19599 * @param {String} fromClient Sender's client id.
19600 * @param {String|Object} message The message which will send to conversation.
19601 * It could be a raw string, or an object with a `toJSON` method, like a
19602 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
19603 * @param {Object} [options]
19604 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
19605 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
19606 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
19607 * @param {AuthOptions} [authOptions]
19608 * @return {Promise}
19609 */
19610 send: function send(fromClient, message) {
19611 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19612 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
19613
19614 var data = {
19615 from_peer: fromClient,
19616 conv_id: this.id,
19617 transient: false,
19618 message: serializeMessage(message)
19619 };
19620 if (options.toClients !== undefined) {
19621 data.to_peers = options.toClients;
19622 }
19623 if (options.transient !== undefined) {
19624 data.transient = options.transient ? true : false;
19625 }
19626 if (options.pushData !== undefined) {
19627 data.push_data = options.pushData;
19628 }
19629 return _request('rtm', 'messages', null, 'POST', data, authOptions);
19630 },
19631
19632
19633 /**
19634 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
19635 *
19636 * @param {String} fromClient Sender's client id.
19637 * @param {String|Object} message The message which will send to conversation.
19638 * It could be a raw string, or an object with a `toJSON` method, like a
19639 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
19640 * @param {Object} [options]
19641 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
19642 * @param {Object} [options.validTill] The message will valid till this time.
19643 * @param {AuthOptions} [authOptions]
19644 * @return {Promise}
19645 */
19646 broadcast: function broadcast(fromClient, message) {
19647 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19648 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
19649
19650 var data = {
19651 from_peer: fromClient,
19652 conv_id: this.id,
19653 message: serializeMessage(message)
19654 };
19655 if (options.pushData !== undefined) {
19656 data.push = options.pushData;
19657 }
19658 if (options.validTill !== undefined) {
19659 var ts = options.validTill;
19660 if (_.isDate(ts)) {
19661 ts = ts.getTime();
19662 }
19663 options.valid_till = ts;
19664 }
19665 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
19666 }
19667});
19668
19669/***/ }),
19670/* 336 */
19671/***/ (function(module, exports, __webpack_require__) {
19672
19673"use strict";
19674
19675
19676var _promise = __webpack_require__(3);
19677
19678var _promise2 = _interopRequireDefault(_promise);
19679
19680function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19681
19682var _ = __webpack_require__(0);
19683
19684var _require = __webpack_require__(12),
19685 request = _require.request;
19686
19687var _require2 = __webpack_require__(15),
19688 ensureArray = _require2.ensureArray,
19689 parseDate = _require2.parseDate;
19690
19691var AV = __webpack_require__(36);
19692
19693/**
19694 * The version change interval for Leaderboard
19695 * @enum
19696 */
19697AV.LeaderboardVersionChangeInterval = {
19698 NEVER: 'never',
19699 DAY: 'day',
19700 WEEK: 'week',
19701 MONTH: 'month'
19702};
19703
19704/**
19705 * The order of the leaderboard results
19706 * @enum
19707 */
19708AV.LeaderboardOrder = {
19709 ASCENDING: 'ascending',
19710 DESCENDING: 'descending'
19711};
19712
19713/**
19714 * The update strategy for Leaderboard
19715 * @enum
19716 */
19717AV.LeaderboardUpdateStrategy = {
19718 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
19719 BETTER: 'better',
19720 /** Keep the last updated statistic */
19721 LAST: 'last',
19722 /** Keep the sum of all updated statistics */
19723 SUM: 'sum'
19724};
19725
19726/**
19727 * @typedef {Object} Ranking
19728 * @property {number} rank Starts at 0
19729 * @property {number} value the statistic value of this ranking
19730 * @property {AV.User} user The user of this ranking
19731 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
19732 */
19733
19734/**
19735 * @typedef {Object} LeaderboardArchive
19736 * @property {string} statisticName
19737 * @property {number} version version of the leaderboard
19738 * @property {string} status
19739 * @property {string} url URL for the downloadable archive
19740 * @property {Date} activatedAt time when this version became active
19741 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
19742 */
19743
19744/**
19745 * @class
19746 */
19747function Statistic(_ref) {
19748 var name = _ref.name,
19749 value = _ref.value,
19750 version = _ref.version;
19751
19752 /**
19753 * @type {string}
19754 */
19755 this.name = name;
19756 /**
19757 * @type {number}
19758 */
19759 this.value = value;
19760 /**
19761 * @type {number?}
19762 */
19763 this.version = version;
19764}
19765
19766var parseStatisticData = function parseStatisticData(statisticData) {
19767 var _AV$_decode = AV._decode(statisticData),
19768 name = _AV$_decode.statisticName,
19769 value = _AV$_decode.statisticValue,
19770 version = _AV$_decode.version;
19771
19772 return new Statistic({ name: name, value: value, version: version });
19773};
19774
19775/**
19776 * @class
19777 */
19778AV.Leaderboard = function Leaderboard(statisticName) {
19779 /**
19780 * @type {string}
19781 */
19782 this.statisticName = statisticName;
19783 /**
19784 * @type {AV.LeaderboardOrder}
19785 */
19786 this.order = undefined;
19787 /**
19788 * @type {AV.LeaderboardUpdateStrategy}
19789 */
19790 this.updateStrategy = undefined;
19791 /**
19792 * @type {AV.LeaderboardVersionChangeInterval}
19793 */
19794 this.versionChangeInterval = undefined;
19795 /**
19796 * @type {number}
19797 */
19798 this.version = undefined;
19799 /**
19800 * @type {Date?}
19801 */
19802 this.nextResetAt = undefined;
19803 /**
19804 * @type {Date?}
19805 */
19806 this.createdAt = undefined;
19807};
19808var Leaderboard = AV.Leaderboard;
19809
19810/**
19811 * Create an instance of Leaderboard for the give statistic name.
19812 * @param {string} statisticName
19813 * @return {AV.Leaderboard}
19814 */
19815AV.Leaderboard.createWithoutData = function (statisticName) {
19816 return new Leaderboard(statisticName);
19817};
19818/**
19819 * (masterKey required) Create a new Leaderboard.
19820 * @param {Object} options
19821 * @param {string} options.statisticName
19822 * @param {AV.LeaderboardOrder} options.order
19823 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
19824 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
19825 * @param {AuthOptions} [authOptions]
19826 * @return {Promise<AV.Leaderboard>}
19827 */
19828AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
19829 var statisticName = _ref2.statisticName,
19830 order = _ref2.order,
19831 versionChangeInterval = _ref2.versionChangeInterval,
19832 updateStrategy = _ref2.updateStrategy;
19833 return request({
19834 method: 'POST',
19835 path: '/leaderboard/leaderboards',
19836 data: {
19837 statisticName: statisticName,
19838 order: order,
19839 versionChangeInterval: versionChangeInterval,
19840 updateStrategy: updateStrategy
19841 },
19842 authOptions: authOptions
19843 }).then(function (data) {
19844 var leaderboard = new Leaderboard(statisticName);
19845 return leaderboard._finishFetch(data);
19846 });
19847};
19848/**
19849 * Get the Leaderboard with the specified statistic name.
19850 * @param {string} statisticName
19851 * @param {AuthOptions} [authOptions]
19852 * @return {Promise<AV.Leaderboard>}
19853 */
19854AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
19855 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
19856};
19857/**
19858 * Get Statistics for the specified user.
19859 * @param {AV.User} user The specified AV.User pointer.
19860 * @param {Object} [options]
19861 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
19862 * @param {AuthOptions} [authOptions]
19863 * @return {Promise<Statistic[]>}
19864 */
19865AV.Leaderboard.getStatistics = function (user) {
19866 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
19867 statisticNames = _ref3.statisticNames;
19868
19869 var authOptions = arguments[2];
19870 return _promise2.default.resolve().then(function () {
19871 if (!(user && user.id)) throw new Error('user must be an AV.User');
19872 return request({
19873 method: 'GET',
19874 path: '/leaderboard/users/' + user.id + '/statistics',
19875 query: {
19876 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
19877 },
19878 authOptions: authOptions
19879 }).then(function (_ref4) {
19880 var results = _ref4.results;
19881 return results.map(parseStatisticData);
19882 });
19883 });
19884};
19885
19886/**
19887 * Update Statistics for the specified user.
19888 * @param {AV.User} user The specified AV.User pointer.
19889 * @param {Object} statistics A name-value pair representing the statistics to update.
19890 * @param {AuthOptions} [options] AuthOptions plus:
19891 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
19892 * @return {Promise<Statistic[]>}
19893 */
19894AV.Leaderboard.updateStatistics = function (user, statistics) {
19895 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19896 return _promise2.default.resolve().then(function () {
19897 if (!(user && user.id)) throw new Error('user must be an AV.User');
19898 var data = _.map(statistics, function (value, key) {
19899 return {
19900 statisticName: key,
19901 statisticValue: value
19902 };
19903 });
19904 var overwrite = options.overwrite;
19905
19906 return request({
19907 method: 'POST',
19908 path: '/leaderboard/users/' + user.id + '/statistics',
19909 query: {
19910 overwrite: overwrite ? 1 : undefined
19911 },
19912 data: data,
19913 authOptions: options
19914 }).then(function (_ref5) {
19915 var results = _ref5.results;
19916 return results.map(parseStatisticData);
19917 });
19918 });
19919};
19920
19921/**
19922 * Delete Statistics for the specified user.
19923 * @param {AV.User} user The specified AV.User pointer.
19924 * @param {Object} statistics A name-value pair representing the statistics to delete.
19925 * @param {AuthOptions} [options]
19926 * @return {Promise<void>}
19927 */
19928AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
19929 return _promise2.default.resolve().then(function () {
19930 if (!(user && user.id)) throw new Error('user must be an AV.User');
19931 return request({
19932 method: 'DELETE',
19933 path: '/leaderboard/users/' + user.id + '/statistics',
19934 query: {
19935 statistics: ensureArray(statisticNames).join(',')
19936 },
19937 authOptions: authOptions
19938 }).then(function () {
19939 return undefined;
19940 });
19941 });
19942};
19943
19944_.extend(Leaderboard.prototype,
19945/** @lends AV.Leaderboard.prototype */{
19946 _finishFetch: function _finishFetch(data) {
19947 var _this = this;
19948
19949 _.forEach(data, function (value, key) {
19950 if (key === 'updatedAt' || key === 'objectId') return;
19951 if (key === 'expiredAt') {
19952 key = 'nextResetAt';
19953 }
19954 if (key === 'createdAt') {
19955 value = parseDate(value);
19956 }
19957 if (value && value.__type === 'Date') {
19958 value = parseDate(value.iso);
19959 }
19960 _this[key] = value;
19961 });
19962 return this;
19963 },
19964
19965 /**
19966 * Fetch data from the srever.
19967 * @param {AuthOptions} [authOptions]
19968 * @return {Promise<AV.Leaderboard>}
19969 */
19970 fetch: function fetch(authOptions) {
19971 var _this2 = this;
19972
19973 return request({
19974 method: 'GET',
19975 path: '/leaderboard/leaderboards/' + this.statisticName,
19976 authOptions: authOptions
19977 }).then(function (data) {
19978 return _this2._finishFetch(data);
19979 });
19980 },
19981
19982 /**
19983 * Counts the number of users participated in this leaderboard
19984 * @param {Object} [options]
19985 * @param {number} [options.version] Specify the version of the leaderboard
19986 * @param {AuthOptions} [authOptions]
19987 * @return {Promise<number>}
19988 */
19989 count: function count() {
19990 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
19991 version = _ref6.version;
19992
19993 var authOptions = arguments[1];
19994
19995 return request({
19996 method: 'GET',
19997 path: '/leaderboard/leaderboards/' + this.statisticName + '/ranks',
19998 query: {
19999 count: 1,
20000 limit: 0,
20001 version: version
20002 },
20003 authOptions: authOptions
20004 }).then(function (_ref7) {
20005 var count = _ref7.count;
20006 return count;
20007 });
20008 },
20009 _getResults: function _getResults(_ref8, authOptions, userId) {
20010 var skip = _ref8.skip,
20011 limit = _ref8.limit,
20012 selectUserKeys = _ref8.selectUserKeys,
20013 includeUserKeys = _ref8.includeUserKeys,
20014 includeStatistics = _ref8.includeStatistics,
20015 version = _ref8.version;
20016
20017 return request({
20018 method: 'GET',
20019 path: '/leaderboard/leaderboards/' + this.statisticName + '/ranks' + (userId ? '/' + userId : ''),
20020 query: {
20021 skip: skip,
20022 limit: limit,
20023 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
20024 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
20025 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
20026 version: version
20027 },
20028 authOptions: authOptions
20029 }).then(function (_ref9) {
20030 var rankings = _ref9.results;
20031 return rankings.map(function (rankingData) {
20032 var _AV$_decode2 = AV._decode(rankingData),
20033 user = _AV$_decode2.user,
20034 value = _AV$_decode2.statisticValue,
20035 rank = _AV$_decode2.rank,
20036 _AV$_decode2$statisti = _AV$_decode2.statistics,
20037 statistics = _AV$_decode2$statisti === undefined ? [] : _AV$_decode2$statisti;
20038
20039 return {
20040 user: user,
20041 value: value,
20042 rank: rank,
20043 includedStatistics: statistics.map(parseStatisticData)
20044 };
20045 });
20046 });
20047 },
20048
20049 /**
20050 * Retrieve a list of ranked users for this Leaderboard.
20051 * @param {Object} [options]
20052 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
20053 * @param {number} [options.limit] The limit of the number of results.
20054 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
20055 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
20056 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
20057 * @param {number} [options.version] Specify the version of the leaderboard
20058 * @param {AuthOptions} [authOptions]
20059 * @return {Promise<Ranking[]>}
20060 */
20061 getResults: function getResults() {
20062 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20063 skip = _ref10.skip,
20064 limit = _ref10.limit,
20065 selectUserKeys = _ref10.selectUserKeys,
20066 includeUserKeys = _ref10.includeUserKeys,
20067 includeStatistics = _ref10.includeStatistics,
20068 version = _ref10.version;
20069
20070 var authOptions = arguments[1];
20071
20072 return this._getResults({
20073 skip: skip,
20074 limit: limit,
20075 selectUserKeys: selectUserKeys,
20076 includeUserKeys: includeUserKeys,
20077 includeStatistics: includeStatistics,
20078 version: version
20079 }, authOptions);
20080 },
20081
20082 /**
20083 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
20084 * @param {AV.User} user The specified AV.User pointer.
20085 * @param {Object} [options]
20086 * @param {number} [options.limit] The limit of the number of results.
20087 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
20088 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
20089 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
20090 * @param {number} [options.version] Specify the version of the leaderboard
20091 * @param {AuthOptions} [authOptions]
20092 * @return {Promise<Ranking[]>}
20093 */
20094 getResultsAroundUser: function getResultsAroundUser(user) {
20095 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20096 var authOptions = arguments[2];
20097
20098 // getResultsAroundUser(options, authOptions)
20099 if (user && typeof user.id !== 'string') {
20100 return this.getResultsAroundUser(undefined, user, options);
20101 }
20102 var limit = options.limit,
20103 selectUserKeys = options.selectUserKeys,
20104 includeUserKeys = options.includeUserKeys,
20105 includeStatistics = options.includeStatistics,
20106 version = options.version;
20107
20108 return this._getResults({ limit: limit, selectUserKeys: selectUserKeys, includeUserKeys: includeUserKeys, includeStatistics: includeStatistics, version: version }, authOptions, user ? user.id : 'self');
20109 },
20110 _update: function _update(data, authOptions) {
20111 var _this3 = this;
20112
20113 return request({
20114 method: 'PUT',
20115 path: '/leaderboard/leaderboards/' + this.statisticName,
20116 data: data,
20117 authOptions: authOptions
20118 }).then(function (result) {
20119 return _this3._finishFetch(result);
20120 });
20121 },
20122
20123 /**
20124 * (masterKey required) Update the version change interval of the Leaderboard.
20125 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
20126 * @param {AuthOptions} [authOptions]
20127 * @return {Promise<AV.Leaderboard>}
20128 */
20129 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
20130 return this._update({ versionChangeInterval: versionChangeInterval }, authOptions);
20131 },
20132
20133 /**
20134 * (masterKey required) Update the version change interval of the Leaderboard.
20135 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
20136 * @param {AuthOptions} [authOptions]
20137 * @return {Promise<AV.Leaderboard>}
20138 */
20139 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
20140 return this._update({ updateStrategy: updateStrategy }, authOptions);
20141 },
20142
20143 /**
20144 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
20145 * @param {AuthOptions} [authOptions]
20146 * @return {Promise<AV.Leaderboard>}
20147 */
20148 reset: function reset(authOptions) {
20149 var _this4 = this;
20150
20151 return request({
20152 method: 'PUT',
20153 path: '/leaderboard/leaderboards/' + this.statisticName + '/incrementVersion',
20154 authOptions: authOptions
20155 }).then(function (data) {
20156 return _this4._finishFetch(data);
20157 });
20158 },
20159
20160 /**
20161 * (masterKey required) Delete the Leaderboard and its all archived versions.
20162 * @param {AuthOptions} [authOptions]
20163 * @return {void}
20164 */
20165 destroy: function destroy(authOptions) {
20166 return AV.request({
20167 method: 'DELETE',
20168 path: '/leaderboard/leaderboards/' + this.statisticName,
20169 authOptions: authOptions
20170 }).then(function () {
20171 return undefined;
20172 });
20173 },
20174
20175 /**
20176 * (masterKey required) Get archived versions.
20177 * @param {Object} [options]
20178 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
20179 * @param {number} [options.limit] The limit of the number of results.
20180 * @param {AuthOptions} [authOptions]
20181 * @return {Promise<LeaderboardArchive[]>}
20182 */
20183 getArchives: function getArchives() {
20184 var _this5 = this;
20185
20186 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20187 skip = _ref11.skip,
20188 limit = _ref11.limit;
20189
20190 var authOptions = arguments[1];
20191
20192 return request({
20193 method: 'GET',
20194 path: '/leaderboard/leaderboards/' + this.statisticName + '/archives',
20195 query: {
20196 skip: skip,
20197 limit: limit
20198 },
20199 authOptions: authOptions
20200 }).then(function (_ref12) {
20201 var results = _ref12.results;
20202 return results.map(function (_ref13) {
20203 var version = _ref13.version,
20204 status = _ref13.status,
20205 url = _ref13.url,
20206 activatedAt = _ref13.activatedAt,
20207 deactivatedAt = _ref13.deactivatedAt;
20208 return {
20209 statisticName: _this5.statisticName,
20210 version: version,
20211 status: status,
20212 url: url,
20213 activatedAt: parseDate(activatedAt.iso),
20214 deactivatedAt: parseDate(deactivatedAt.iso)
20215 };
20216 });
20217 });
20218 }
20219});
20220
20221/***/ }),
20222/* 337 */
20223/***/ (function(module, exports, __webpack_require__) {
20224
20225"use strict";
20226
20227
20228var adapters = __webpack_require__(338);
20229
20230module.exports = function (AV) {
20231 AV.setAdapters(adapters);
20232 return AV;
20233};
20234
20235/***/ }),
20236/* 338 */
20237/***/ (function(module, exports, __webpack_require__) {
20238
20239"use strict";
20240
20241
20242Object.defineProperty(exports, "__esModule", {
20243 value: true
20244});
20245
20246var _adaptersSuperagent = __webpack_require__(339);
20247
20248Object.defineProperty(exports, "request", {
20249 enumerable: true,
20250 get: function get() {
20251 return _adaptersSuperagent.request;
20252 }
20253});
20254Object.defineProperty(exports, "upload", {
20255 enumerable: true,
20256 get: function get() {
20257 return _adaptersSuperagent.upload;
20258 }
20259});
20260
20261
20262var storage = window.localStorage;
20263var WebSocket = window.WebSocket;
20264var platformInfo = {
20265 name: "Browser"
20266};
20267
20268exports.WebSocket = WebSocket;
20269exports.platformInfo = platformInfo;
20270exports.storage = storage;
20271//# sourceMappingURL=index.es.js.map
20272
20273/***/ }),
20274/* 339 */
20275/***/ (function(module, exports, __webpack_require__) {
20276
20277"use strict";
20278
20279Object.defineProperty(exports, "__esModule", { value: true });
20280exports.upload = exports.request = void 0;
20281var adapter_utils_1 = __webpack_require__(340);
20282var superagent = __webpack_require__(341);
20283function convertResponse(res) {
20284 return {
20285 ok: res.ok,
20286 status: res.status,
20287 headers: res.header,
20288 data: res.body,
20289 };
20290}
20291exports.request = function (url, options) {
20292 if (options === void 0) { options = {}; }
20293 var _a = options.method, method = _a === void 0 ? "GET" : _a, data = options.data, headers = options.headers, onprogress = options.onprogress, signal = options.signal;
20294 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
20295 return Promise.reject(new adapter_utils_1.AbortError("Request aborted"));
20296 }
20297 var req = superagent(method, url);
20298 if (headers) {
20299 req.set(headers);
20300 }
20301 if (onprogress) {
20302 req.on("progress", onprogress);
20303 }
20304 return new Promise(function (resolve, reject) {
20305 var abortListener = function () {
20306 reject(new adapter_utils_1.AbortError("Request aborted"));
20307 req.abort();
20308 };
20309 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
20310 req
20311 .send(data)
20312 .then(function (res) { return resolve(convertResponse(res)); })
20313 .catch(function (err) {
20314 if (err.response) {
20315 resolve(convertResponse(err.response));
20316 }
20317 else {
20318 reject(err);
20319 }
20320 })
20321 .finally(function () { return signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener); });
20322 });
20323};
20324exports.upload = function (url, file, options) {
20325 if (options === void 0) { options = {}; }
20326 var _a = options.method, method = _a === void 0 ? "POST" : _a, data = options.data, headers = options.headers, onprogress = options.onprogress, signal = options.signal;
20327 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
20328 return Promise.reject(new adapter_utils_1.AbortError("Request aborted"));
20329 }
20330 var req = superagent(method, url).attach(file.field, file.data, file.name);
20331 if (data) {
20332 req.field(data);
20333 }
20334 if (headers) {
20335 req.set(headers);
20336 }
20337 if (onprogress) {
20338 req.on("progress", onprogress);
20339 }
20340 return new Promise(function (resolve, reject) {
20341 var abortListener = function () {
20342 reject(new adapter_utils_1.AbortError("Request aborted"));
20343 req.abort();
20344 };
20345 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
20346 req
20347 .then(function (res) { return resolve(convertResponse(res)); })
20348 .catch(function (err) {
20349 if (err.response) {
20350 resolve(convertResponse(err.response));
20351 }
20352 else {
20353 reject(err);
20354 }
20355 })
20356 .finally(function () { return signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener); });
20357 });
20358};
20359//# sourceMappingURL=index.js.map
20360
20361/***/ }),
20362/* 340 */
20363/***/ (function(module, __webpack_exports__, __webpack_require__) {
20364
20365"use strict";
20366Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
20367/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbortError", function() { return AbortError; });
20368/*! *****************************************************************************
20369Copyright (c) Microsoft Corporation.
20370
20371Permission to use, copy, modify, and/or distribute this software for any
20372purpose with or without fee is hereby granted.
20373
20374THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20375REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20376AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20377INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20378LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20379OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20380PERFORMANCE OF THIS SOFTWARE.
20381***************************************************************************** */
20382/* global Reflect, Promise */
20383
20384var extendStatics = function(d, b) {
20385 extendStatics = Object.setPrototypeOf ||
20386 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20387 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
20388 return extendStatics(d, b);
20389};
20390
20391function __extends(d, b) {
20392 extendStatics(d, b);
20393 function __() { this.constructor = d; }
20394 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
20395}
20396
20397var AbortError = /** @class */ (function (_super) {
20398 __extends(AbortError, _super);
20399 function AbortError() {
20400 var _this = _super !== null && _super.apply(this, arguments) || this;
20401 _this.name = "AbortError";
20402 return _this;
20403 }
20404 return AbortError;
20405}(Error));
20406
20407
20408//# sourceMappingURL=index.es.js.map
20409
20410
20411/***/ }),
20412/* 341 */
20413/***/ (function(module, exports, __webpack_require__) {
20414
20415"use strict";
20416
20417
20418var _iterator = __webpack_require__(61);
20419
20420var _iterator2 = _interopRequireDefault(_iterator);
20421
20422var _typeof3 = __webpack_require__(30);
20423
20424var _typeof4 = _interopRequireDefault(_typeof3);
20425
20426var _symbol = __webpack_require__(51);
20427
20428var _symbol2 = _interopRequireDefault(_symbol);
20429
20430function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20431
20432function _typeof(obj) {
20433 "@babel/helpers - typeof";
20434 if (typeof _symbol2.default === "function" && (0, _typeof4.default)(_iterator2.default) === "symbol") {
20435 _typeof = function _typeof(obj) {
20436 return typeof obj === "undefined" ? "undefined" : (0, _typeof4.default)(obj);
20437 };
20438 } else {
20439 _typeof = function _typeof(obj) {
20440 return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : (0, _typeof4.default)(obj);
20441 };
20442 }return _typeof(obj);
20443}
20444
20445/**
20446 * Root reference for iframes.
20447 */
20448var root;
20449
20450if (typeof window !== 'undefined') {
20451 // Browser window
20452 root = window;
20453} else if (typeof self === 'undefined') {
20454 // Other environments
20455 console.warn('Using browser-only version of superagent in non-browser environment');
20456 root = void 0;
20457} else {
20458 // Web Worker
20459 root = self;
20460}
20461
20462var Emitter = __webpack_require__(342);
20463
20464var safeStringify = __webpack_require__(343);
20465
20466var RequestBase = __webpack_require__(344);
20467
20468var isObject = __webpack_require__(170);
20469
20470var ResponseBase = __webpack_require__(345);
20471
20472var Agent = __webpack_require__(347);
20473/**
20474 * Noop.
20475 */
20476
20477function noop() {}
20478/**
20479 * Expose `request`.
20480 */
20481
20482module.exports = function (method, url) {
20483 // callback
20484 if (typeof url === 'function') {
20485 return new exports.Request('GET', method).end(url);
20486 } // url first
20487
20488
20489 if (arguments.length === 1) {
20490 return new exports.Request('GET', method);
20491 }
20492
20493 return new exports.Request(method, url);
20494};
20495
20496exports = module.exports;
20497var request = exports;
20498exports.Request = Request;
20499/**
20500 * Determine XHR.
20501 */
20502
20503request.getXHR = function () {
20504 if (root.XMLHttpRequest && (!root.location || root.location.protocol !== 'file:' || !root.ActiveXObject)) {
20505 return new XMLHttpRequest();
20506 }
20507
20508 try {
20509 return new ActiveXObject('Microsoft.XMLHTTP');
20510 } catch (_unused) {}
20511
20512 try {
20513 return new ActiveXObject('Msxml2.XMLHTTP.6.0');
20514 } catch (_unused2) {}
20515
20516 try {
20517 return new ActiveXObject('Msxml2.XMLHTTP.3.0');
20518 } catch (_unused3) {}
20519
20520 try {
20521 return new ActiveXObject('Msxml2.XMLHTTP');
20522 } catch (_unused4) {}
20523
20524 throw new Error('Browser-only version of superagent could not find XHR');
20525};
20526/**
20527 * Removes leading and trailing whitespace, added to support IE.
20528 *
20529 * @param {String} s
20530 * @return {String}
20531 * @api private
20532 */
20533
20534var trim = ''.trim ? function (s) {
20535 return s.trim();
20536} : function (s) {
20537 return s.replace(/(^\s*|\s*$)/g, '');
20538};
20539/**
20540 * Serialize the given `obj`.
20541 *
20542 * @param {Object} obj
20543 * @return {String}
20544 * @api private
20545 */
20546
20547function serialize(obj) {
20548 if (!isObject(obj)) return obj;
20549 var pairs = [];
20550
20551 for (var key in obj) {
20552 if (Object.prototype.hasOwnProperty.call(obj, key)) pushEncodedKeyValuePair(pairs, key, obj[key]);
20553 }
20554
20555 return pairs.join('&');
20556}
20557/**
20558 * Helps 'serialize' with serializing arrays.
20559 * Mutates the pairs array.
20560 *
20561 * @param {Array} pairs
20562 * @param {String} key
20563 * @param {Mixed} val
20564 */
20565
20566function pushEncodedKeyValuePair(pairs, key, val) {
20567 if (val === undefined) return;
20568
20569 if (val === null) {
20570 pairs.push(encodeURI(key));
20571 return;
20572 }
20573
20574 if (Array.isArray(val)) {
20575 val.forEach(function (v) {
20576 pushEncodedKeyValuePair(pairs, key, v);
20577 });
20578 } else if (isObject(val)) {
20579 for (var subkey in val) {
20580 if (Object.prototype.hasOwnProperty.call(val, subkey)) pushEncodedKeyValuePair(pairs, "".concat(key, "[").concat(subkey, "]"), val[subkey]);
20581 }
20582 } else {
20583 pairs.push(encodeURI(key) + '=' + encodeURIComponent(val));
20584 }
20585}
20586/**
20587 * Expose serialization method.
20588 */
20589
20590request.serializeObject = serialize;
20591/**
20592 * Parse the given x-www-form-urlencoded `str`.
20593 *
20594 * @param {String} str
20595 * @return {Object}
20596 * @api private
20597 */
20598
20599function parseString(str) {
20600 var obj = {};
20601 var pairs = str.split('&');
20602 var pair;
20603 var pos;
20604
20605 for (var i = 0, len = pairs.length; i < len; ++i) {
20606 pair = pairs[i];
20607 pos = pair.indexOf('=');
20608
20609 if (pos === -1) {
20610 obj[decodeURIComponent(pair)] = '';
20611 } else {
20612 obj[decodeURIComponent(pair.slice(0, pos))] = decodeURIComponent(pair.slice(pos + 1));
20613 }
20614 }
20615
20616 return obj;
20617}
20618/**
20619 * Expose parser.
20620 */
20621
20622request.parseString = parseString;
20623/**
20624 * Default MIME type map.
20625 *
20626 * superagent.types.xml = 'application/xml';
20627 *
20628 */
20629
20630request.types = {
20631 html: 'text/html',
20632 json: 'application/json',
20633 xml: 'text/xml',
20634 urlencoded: 'application/x-www-form-urlencoded',
20635 form: 'application/x-www-form-urlencoded',
20636 'form-data': 'application/x-www-form-urlencoded'
20637};
20638/**
20639 * Default serialization map.
20640 *
20641 * superagent.serialize['application/xml'] = function(obj){
20642 * return 'generated xml here';
20643 * };
20644 *
20645 */
20646
20647request.serialize = {
20648 'application/x-www-form-urlencoded': serialize,
20649 'application/json': safeStringify
20650};
20651/**
20652 * Default parsers.
20653 *
20654 * superagent.parse['application/xml'] = function(str){
20655 * return { object parsed from str };
20656 * };
20657 *
20658 */
20659
20660request.parse = {
20661 'application/x-www-form-urlencoded': parseString,
20662 'application/json': JSON.parse
20663};
20664/**
20665 * Parse the given header `str` into
20666 * an object containing the mapped fields.
20667 *
20668 * @param {String} str
20669 * @return {Object}
20670 * @api private
20671 */
20672
20673function parseHeader(str) {
20674 var lines = str.split(/\r?\n/);
20675 var fields = {};
20676 var index;
20677 var line;
20678 var field;
20679 var val;
20680
20681 for (var i = 0, len = lines.length; i < len; ++i) {
20682 line = lines[i];
20683 index = line.indexOf(':');
20684
20685 if (index === -1) {
20686 // could be empty line, just skip it
20687 continue;
20688 }
20689
20690 field = line.slice(0, index).toLowerCase();
20691 val = trim(line.slice(index + 1));
20692 fields[field] = val;
20693 }
20694
20695 return fields;
20696}
20697/**
20698 * Check if `mime` is json or has +json structured syntax suffix.
20699 *
20700 * @param {String} mime
20701 * @return {Boolean}
20702 * @api private
20703 */
20704
20705function isJSON(mime) {
20706 // should match /json or +json
20707 // but not /json-seq
20708 return (/[/+]json($|[^-\w])/.test(mime)
20709 );
20710}
20711/**
20712 * Initialize a new `Response` with the given `xhr`.
20713 *
20714 * - set flags (.ok, .error, etc)
20715 * - parse header
20716 *
20717 * Examples:
20718 *
20719 * Aliasing `superagent` as `request` is nice:
20720 *
20721 * request = superagent;
20722 *
20723 * We can use the promise-like API, or pass callbacks:
20724 *
20725 * request.get('/').end(function(res){});
20726 * request.get('/', function(res){});
20727 *
20728 * Sending data can be chained:
20729 *
20730 * request
20731 * .post('/user')
20732 * .send({ name: 'tj' })
20733 * .end(function(res){});
20734 *
20735 * Or passed to `.send()`:
20736 *
20737 * request
20738 * .post('/user')
20739 * .send({ name: 'tj' }, function(res){});
20740 *
20741 * Or passed to `.post()`:
20742 *
20743 * request
20744 * .post('/user', { name: 'tj' })
20745 * .end(function(res){});
20746 *
20747 * Or further reduced to a single call for simple cases:
20748 *
20749 * request
20750 * .post('/user', { name: 'tj' }, function(res){});
20751 *
20752 * @param {XMLHTTPRequest} xhr
20753 * @param {Object} options
20754 * @api private
20755 */
20756
20757function Response(req) {
20758 this.req = req;
20759 this.xhr = this.req.xhr; // responseText is accessible only if responseType is '' or 'text' and on older browsers
20760
20761 this.text = this.req.method !== 'HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text') || typeof this.xhr.responseType === 'undefined' ? this.xhr.responseText : null;
20762 this.statusText = this.req.xhr.statusText;
20763 var status = this.xhr.status; // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
20764
20765 if (status === 1223) {
20766 status = 204;
20767 }
20768
20769 this._setStatusProperties(status);
20770
20771 this.headers = parseHeader(this.xhr.getAllResponseHeaders());
20772 this.header = this.headers; // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
20773 // getResponseHeader still works. so we get content-type even if getting
20774 // other headers fails.
20775
20776 this.header['content-type'] = this.xhr.getResponseHeader('content-type');
20777
20778 this._setHeaderProperties(this.header);
20779
20780 if (this.text === null && req._responseType) {
20781 this.body = this.xhr.response;
20782 } else {
20783 this.body = this.req.method === 'HEAD' ? null : this._parseBody(this.text ? this.text : this.xhr.response);
20784 }
20785} // eslint-disable-next-line new-cap
20786
20787
20788ResponseBase(Response.prototype);
20789/**
20790 * Parse the given body `str`.
20791 *
20792 * Used for auto-parsing of bodies. Parsers
20793 * are defined on the `superagent.parse` object.
20794 *
20795 * @param {String} str
20796 * @return {Mixed}
20797 * @api private
20798 */
20799
20800Response.prototype._parseBody = function (str) {
20801 var parse = request.parse[this.type];
20802
20803 if (this.req._parser) {
20804 return this.req._parser(this, str);
20805 }
20806
20807 if (!parse && isJSON(this.type)) {
20808 parse = request.parse['application/json'];
20809 }
20810
20811 return parse && str && (str.length > 0 || str instanceof Object) ? parse(str) : null;
20812};
20813/**
20814 * Return an `Error` representative of this response.
20815 *
20816 * @return {Error}
20817 * @api public
20818 */
20819
20820Response.prototype.toError = function () {
20821 var req = this.req;
20822 var method = req.method;
20823 var url = req.url;
20824 var msg = "cannot ".concat(method, " ").concat(url, " (").concat(this.status, ")");
20825 var err = new Error(msg);
20826 err.status = this.status;
20827 err.method = method;
20828 err.url = url;
20829 return err;
20830};
20831/**
20832 * Expose `Response`.
20833 */
20834
20835request.Response = Response;
20836/**
20837 * Initialize a new `Request` with the given `method` and `url`.
20838 *
20839 * @param {String} method
20840 * @param {String} url
20841 * @api public
20842 */
20843
20844function Request(method, url) {
20845 var self = this;
20846 this._query = this._query || [];
20847 this.method = method;
20848 this.url = url;
20849 this.header = {}; // preserves header name case
20850
20851 this._header = {}; // coerces header names to lowercase
20852
20853 this.on('end', function () {
20854 var err = null;
20855 var res = null;
20856
20857 try {
20858 res = new Response(self);
20859 } catch (err_) {
20860 err = new Error('Parser is unable to parse the response');
20861 err.parse = true;
20862 err.original = err_; // issue #675: return the raw response if the response parsing fails
20863
20864 if (self.xhr) {
20865 // ie9 doesn't have 'response' property
20866 err.rawResponse = typeof self.xhr.responseType === 'undefined' ? self.xhr.responseText : self.xhr.response; // issue #876: return the http status code if the response parsing fails
20867
20868 err.status = self.xhr.status ? self.xhr.status : null;
20869 err.statusCode = err.status; // backwards-compat only
20870 } else {
20871 err.rawResponse = null;
20872 err.status = null;
20873 }
20874
20875 return self.callback(err);
20876 }
20877
20878 self.emit('response', res);
20879 var new_err;
20880
20881 try {
20882 if (!self._isResponseOK(res)) {
20883 new_err = new Error(res.statusText || res.text || 'Unsuccessful HTTP response');
20884 }
20885 } catch (err_) {
20886 new_err = err_; // ok() callback can throw
20887 } // #1000 don't catch errors from the callback to avoid double calling it
20888
20889
20890 if (new_err) {
20891 new_err.original = err;
20892 new_err.response = res;
20893 new_err.status = res.status;
20894 self.callback(new_err, res);
20895 } else {
20896 self.callback(null, res);
20897 }
20898 });
20899}
20900/**
20901 * Mixin `Emitter` and `RequestBase`.
20902 */
20903// eslint-disable-next-line new-cap
20904
20905
20906Emitter(Request.prototype); // eslint-disable-next-line new-cap
20907
20908RequestBase(Request.prototype);
20909/**
20910 * Set Content-Type to `type`, mapping values from `request.types`.
20911 *
20912 * Examples:
20913 *
20914 * superagent.types.xml = 'application/xml';
20915 *
20916 * request.post('/')
20917 * .type('xml')
20918 * .send(xmlstring)
20919 * .end(callback);
20920 *
20921 * request.post('/')
20922 * .type('application/xml')
20923 * .send(xmlstring)
20924 * .end(callback);
20925 *
20926 * @param {String} type
20927 * @return {Request} for chaining
20928 * @api public
20929 */
20930
20931Request.prototype.type = function (type) {
20932 this.set('Content-Type', request.types[type] || type);
20933 return this;
20934};
20935/**
20936 * Set Accept to `type`, mapping values from `request.types`.
20937 *
20938 * Examples:
20939 *
20940 * superagent.types.json = 'application/json';
20941 *
20942 * request.get('/agent')
20943 * .accept('json')
20944 * .end(callback);
20945 *
20946 * request.get('/agent')
20947 * .accept('application/json')
20948 * .end(callback);
20949 *
20950 * @param {String} accept
20951 * @return {Request} for chaining
20952 * @api public
20953 */
20954
20955Request.prototype.accept = function (type) {
20956 this.set('Accept', request.types[type] || type);
20957 return this;
20958};
20959/**
20960 * Set Authorization field value with `user` and `pass`.
20961 *
20962 * @param {String} user
20963 * @param {String} [pass] optional in case of using 'bearer' as type
20964 * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
20965 * @return {Request} for chaining
20966 * @api public
20967 */
20968
20969Request.prototype.auth = function (user, pass, options) {
20970 if (arguments.length === 1) pass = '';
20971
20972 if (_typeof(pass) === 'object' && pass !== null) {
20973 // pass is optional and can be replaced with options
20974 options = pass;
20975 pass = '';
20976 }
20977
20978 if (!options) {
20979 options = {
20980 type: typeof btoa === 'function' ? 'basic' : 'auto'
20981 };
20982 }
20983
20984 var encoder = function encoder(string) {
20985 if (typeof btoa === 'function') {
20986 return btoa(string);
20987 }
20988
20989 throw new Error('Cannot use basic auth, btoa is not a function');
20990 };
20991
20992 return this._auth(user, pass, options, encoder);
20993};
20994/**
20995 * Add query-string `val`.
20996 *
20997 * Examples:
20998 *
20999 * request.get('/shoes')
21000 * .query('size=10')
21001 * .query({ color: 'blue' })
21002 *
21003 * @param {Object|String} val
21004 * @return {Request} for chaining
21005 * @api public
21006 */
21007
21008Request.prototype.query = function (val) {
21009 if (typeof val !== 'string') val = serialize(val);
21010 if (val) this._query.push(val);
21011 return this;
21012};
21013/**
21014 * Queue the given `file` as an attachment to the specified `field`,
21015 * with optional `options` (or filename).
21016 *
21017 * ``` js
21018 * request.post('/upload')
21019 * .attach('content', new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
21020 * .end(callback);
21021 * ```
21022 *
21023 * @param {String} field
21024 * @param {Blob|File} file
21025 * @param {String|Object} options
21026 * @return {Request} for chaining
21027 * @api public
21028 */
21029
21030Request.prototype.attach = function (field, file, options) {
21031 if (file) {
21032 if (this._data) {
21033 throw new Error("superagent can't mix .send() and .attach()");
21034 }
21035
21036 this._getFormData().append(field, file, options || file.name);
21037 }
21038
21039 return this;
21040};
21041
21042Request.prototype._getFormData = function () {
21043 if (!this._formData) {
21044 this._formData = new root.FormData();
21045 }
21046
21047 return this._formData;
21048};
21049/**
21050 * Invoke the callback with `err` and `res`
21051 * and handle arity check.
21052 *
21053 * @param {Error} err
21054 * @param {Response} res
21055 * @api private
21056 */
21057
21058Request.prototype.callback = function (err, res) {
21059 if (this._shouldRetry(err, res)) {
21060 return this._retry();
21061 }
21062
21063 var fn = this._callback;
21064 this.clearTimeout();
21065
21066 if (err) {
21067 if (this._maxRetries) err.retries = this._retries - 1;
21068 this.emit('error', err);
21069 }
21070
21071 fn(err, res);
21072};
21073/**
21074 * Invoke callback with x-domain error.
21075 *
21076 * @api private
21077 */
21078
21079Request.prototype.crossDomainError = function () {
21080 var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
21081 err.crossDomain = true;
21082 err.status = this.status;
21083 err.method = this.method;
21084 err.url = this.url;
21085 this.callback(err);
21086}; // This only warns, because the request is still likely to work
21087
21088
21089Request.prototype.agent = function () {
21090 console.warn('This is not supported in browser version of superagent');
21091 return this;
21092};
21093
21094Request.prototype.ca = Request.prototype.agent;
21095Request.prototype.buffer = Request.prototype.ca; // This throws, because it can't send/receive data as expected
21096
21097Request.prototype.write = function () {
21098 throw new Error('Streaming is not supported in browser version of superagent');
21099};
21100
21101Request.prototype.pipe = Request.prototype.write;
21102/**
21103 * Check if `obj` is a host object,
21104 * we don't want to serialize these :)
21105 *
21106 * @param {Object} obj host object
21107 * @return {Boolean} is a host object
21108 * @api private
21109 */
21110
21111Request.prototype._isHost = function (obj) {
21112 // Native objects stringify to [object File], [object Blob], [object FormData], etc.
21113 return obj && _typeof(obj) === 'object' && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]';
21114};
21115/**
21116 * Initiate request, invoking callback `fn(res)`
21117 * with an instanceof `Response`.
21118 *
21119 * @param {Function} fn
21120 * @return {Request} for chaining
21121 * @api public
21122 */
21123
21124Request.prototype.end = function (fn) {
21125 if (this._endCalled) {
21126 console.warn('Warning: .end() was called twice. This is not supported in superagent');
21127 }
21128
21129 this._endCalled = true; // store callback
21130
21131 this._callback = fn || noop; // querystring
21132
21133 this._finalizeQueryString();
21134
21135 this._end();
21136};
21137
21138Request.prototype._setUploadTimeout = function () {
21139 var self = this; // upload timeout it's wokrs only if deadline timeout is off
21140
21141 if (this._uploadTimeout && !this._uploadTimeoutTimer) {
21142 this._uploadTimeoutTimer = setTimeout(function () {
21143 self._timeoutError('Upload timeout of ', self._uploadTimeout, 'ETIMEDOUT');
21144 }, this._uploadTimeout);
21145 }
21146}; // eslint-disable-next-line complexity
21147
21148
21149Request.prototype._end = function () {
21150 if (this._aborted) return this.callback(new Error('The request has been aborted even before .end() was called'));
21151 var self = this;
21152 this.xhr = request.getXHR();
21153 var xhr = this.xhr;
21154 var data = this._formData || this._data;
21155
21156 this._setTimeouts(); // state change
21157
21158
21159 xhr.onreadystatechange = function () {
21160 var readyState = xhr.readyState;
21161
21162 if (readyState >= 2 && self._responseTimeoutTimer) {
21163 clearTimeout(self._responseTimeoutTimer);
21164 }
21165
21166 if (readyState !== 4) {
21167 return;
21168 } // In IE9, reads to any property (e.g. status) off of an aborted XHR will
21169 // result in the error "Could not complete the operation due to error c00c023f"
21170
21171
21172 var status;
21173
21174 try {
21175 status = xhr.status;
21176 } catch (_unused5) {
21177 status = 0;
21178 }
21179
21180 if (!status) {
21181 if (self.timedout || self._aborted) return;
21182 return self.crossDomainError();
21183 }
21184
21185 self.emit('end');
21186 }; // progress
21187
21188
21189 var handleProgress = function handleProgress(direction, e) {
21190 if (e.total > 0) {
21191 e.percent = e.loaded / e.total * 100;
21192
21193 if (e.percent === 100) {
21194 clearTimeout(self._uploadTimeoutTimer);
21195 }
21196 }
21197
21198 e.direction = direction;
21199 self.emit('progress', e);
21200 };
21201
21202 if (this.hasListeners('progress')) {
21203 try {
21204 xhr.addEventListener('progress', handleProgress.bind(null, 'download'));
21205
21206 if (xhr.upload) {
21207 xhr.upload.addEventListener('progress', handleProgress.bind(null, 'upload'));
21208 }
21209 } catch (_unused6) {// Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
21210 // Reported here:
21211 // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
21212 }
21213 }
21214
21215 if (xhr.upload) {
21216 this._setUploadTimeout();
21217 } // initiate request
21218
21219
21220 try {
21221 if (this.username && this.password) {
21222 xhr.open(this.method, this.url, true, this.username, this.password);
21223 } else {
21224 xhr.open(this.method, this.url, true);
21225 }
21226 } catch (err) {
21227 // see #1149
21228 return this.callback(err);
21229 } // CORS
21230
21231
21232 if (this._withCredentials) xhr.withCredentials = true; // body
21233
21234 if (!this._formData && this.method !== 'GET' && this.method !== 'HEAD' && typeof data !== 'string' && !this._isHost(data)) {
21235 // serialize stuff
21236 var contentType = this._header['content-type'];
21237
21238 var _serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
21239
21240 if (!_serialize && isJSON(contentType)) {
21241 _serialize = request.serialize['application/json'];
21242 }
21243
21244 if (_serialize) data = _serialize(data);
21245 } // set header fields
21246
21247
21248 for (var field in this.header) {
21249 if (this.header[field] === null) continue;
21250 if (Object.prototype.hasOwnProperty.call(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
21251 }
21252
21253 if (this._responseType) {
21254 xhr.responseType = this._responseType;
21255 } // send stuff
21256
21257
21258 this.emit('request', this); // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
21259 // We need null here if data is undefined
21260
21261 xhr.send(typeof data === 'undefined' ? null : data);
21262};
21263
21264request.agent = function () {
21265 return new Agent();
21266};
21267
21268['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE'].forEach(function (method) {
21269 Agent.prototype[method.toLowerCase()] = function (url, fn) {
21270 var req = new request.Request(method, url);
21271
21272 this._setDefaults(req);
21273
21274 if (fn) {
21275 req.end(fn);
21276 }
21277
21278 return req;
21279 };
21280});
21281Agent.prototype.del = Agent.prototype.delete;
21282/**
21283 * GET `url` with optional callback `fn(res)`.
21284 *
21285 * @param {String} url
21286 * @param {Mixed|Function} [data] or fn
21287 * @param {Function} [fn]
21288 * @return {Request}
21289 * @api public
21290 */
21291
21292request.get = function (url, data, fn) {
21293 var req = request('GET', url);
21294
21295 if (typeof data === 'function') {
21296 fn = data;
21297 data = null;
21298 }
21299
21300 if (data) req.query(data);
21301 if (fn) req.end(fn);
21302 return req;
21303};
21304/**
21305 * HEAD `url` with optional callback `fn(res)`.
21306 *
21307 * @param {String} url
21308 * @param {Mixed|Function} [data] or fn
21309 * @param {Function} [fn]
21310 * @return {Request}
21311 * @api public
21312 */
21313
21314request.head = function (url, data, fn) {
21315 var req = request('HEAD', url);
21316
21317 if (typeof data === 'function') {
21318 fn = data;
21319 data = null;
21320 }
21321
21322 if (data) req.query(data);
21323 if (fn) req.end(fn);
21324 return req;
21325};
21326/**
21327 * OPTIONS query to `url` with optional callback `fn(res)`.
21328 *
21329 * @param {String} url
21330 * @param {Mixed|Function} [data] or fn
21331 * @param {Function} [fn]
21332 * @return {Request}
21333 * @api public
21334 */
21335
21336request.options = function (url, data, fn) {
21337 var req = request('OPTIONS', url);
21338
21339 if (typeof data === 'function') {
21340 fn = data;
21341 data = null;
21342 }
21343
21344 if (data) req.send(data);
21345 if (fn) req.end(fn);
21346 return req;
21347};
21348/**
21349 * DELETE `url` with optional `data` and callback `fn(res)`.
21350 *
21351 * @param {String} url
21352 * @param {Mixed} [data]
21353 * @param {Function} [fn]
21354 * @return {Request}
21355 * @api public
21356 */
21357
21358function del(url, data, fn) {
21359 var req = request('DELETE', url);
21360
21361 if (typeof data === 'function') {
21362 fn = data;
21363 data = null;
21364 }
21365
21366 if (data) req.send(data);
21367 if (fn) req.end(fn);
21368 return req;
21369}
21370
21371request.del = del;
21372request.delete = del;
21373/**
21374 * PATCH `url` with optional `data` and callback `fn(res)`.
21375 *
21376 * @param {String} url
21377 * @param {Mixed} [data]
21378 * @param {Function} [fn]
21379 * @return {Request}
21380 * @api public
21381 */
21382
21383request.patch = function (url, data, fn) {
21384 var req = request('PATCH', url);
21385
21386 if (typeof data === 'function') {
21387 fn = data;
21388 data = null;
21389 }
21390
21391 if (data) req.send(data);
21392 if (fn) req.end(fn);
21393 return req;
21394};
21395/**
21396 * POST `url` with optional `data` and callback `fn(res)`.
21397 *
21398 * @param {String} url
21399 * @param {Mixed} [data]
21400 * @param {Function} [fn]
21401 * @return {Request}
21402 * @api public
21403 */
21404
21405request.post = function (url, data, fn) {
21406 var req = request('POST', url);
21407
21408 if (typeof data === 'function') {
21409 fn = data;
21410 data = null;
21411 }
21412
21413 if (data) req.send(data);
21414 if (fn) req.end(fn);
21415 return req;
21416};
21417/**
21418 * PUT `url` with optional `data` and callback `fn(res)`.
21419 *
21420 * @param {String} url
21421 * @param {Mixed|Function} [data] or fn
21422 * @param {Function} [fn]
21423 * @return {Request}
21424 * @api public
21425 */
21426
21427request.put = function (url, data, fn) {
21428 var req = request('PUT', url);
21429
21430 if (typeof data === 'function') {
21431 fn = data;
21432 data = null;
21433 }
21434
21435 if (data) req.send(data);
21436 if (fn) req.end(fn);
21437 return req;
21438};
21439
21440/***/ }),
21441/* 342 */
21442/***/ (function(module, exports, __webpack_require__) {
21443
21444
21445/**
21446 * Expose `Emitter`.
21447 */
21448
21449if (true) {
21450 module.exports = Emitter;
21451}
21452
21453/**
21454 * Initialize a new `Emitter`.
21455 *
21456 * @api public
21457 */
21458
21459function Emitter(obj) {
21460 if (obj) return mixin(obj);
21461};
21462
21463/**
21464 * Mixin the emitter properties.
21465 *
21466 * @param {Object} obj
21467 * @return {Object}
21468 * @api private
21469 */
21470
21471function mixin(obj) {
21472 for (var key in Emitter.prototype) {
21473 obj[key] = Emitter.prototype[key];
21474 }
21475 return obj;
21476}
21477
21478/**
21479 * Listen on the given `event` with `fn`.
21480 *
21481 * @param {String} event
21482 * @param {Function} fn
21483 * @return {Emitter}
21484 * @api public
21485 */
21486
21487Emitter.prototype.on =
21488Emitter.prototype.addEventListener = function(event, fn){
21489 this._callbacks = this._callbacks || {};
21490 (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
21491 .push(fn);
21492 return this;
21493};
21494
21495/**
21496 * Adds an `event` listener that will be invoked a single
21497 * time then automatically removed.
21498 *
21499 * @param {String} event
21500 * @param {Function} fn
21501 * @return {Emitter}
21502 * @api public
21503 */
21504
21505Emitter.prototype.once = function(event, fn){
21506 function on() {
21507 this.off(event, on);
21508 fn.apply(this, arguments);
21509 }
21510
21511 on.fn = fn;
21512 this.on(event, on);
21513 return this;
21514};
21515
21516/**
21517 * Remove the given callback for `event` or all
21518 * registered callbacks.
21519 *
21520 * @param {String} event
21521 * @param {Function} fn
21522 * @return {Emitter}
21523 * @api public
21524 */
21525
21526Emitter.prototype.off =
21527Emitter.prototype.removeListener =
21528Emitter.prototype.removeAllListeners =
21529Emitter.prototype.removeEventListener = function(event, fn){
21530 this._callbacks = this._callbacks || {};
21531
21532 // all
21533 if (0 == arguments.length) {
21534 this._callbacks = {};
21535 return this;
21536 }
21537
21538 // specific event
21539 var callbacks = this._callbacks['$' + event];
21540 if (!callbacks) return this;
21541
21542 // remove all handlers
21543 if (1 == arguments.length) {
21544 delete this._callbacks['$' + event];
21545 return this;
21546 }
21547
21548 // remove specific handler
21549 var cb;
21550 for (var i = 0; i < callbacks.length; i++) {
21551 cb = callbacks[i];
21552 if (cb === fn || cb.fn === fn) {
21553 callbacks.splice(i, 1);
21554 break;
21555 }
21556 }
21557
21558 // Remove event specific arrays for event types that no
21559 // one is subscribed for to avoid memory leak.
21560 if (callbacks.length === 0) {
21561 delete this._callbacks['$' + event];
21562 }
21563
21564 return this;
21565};
21566
21567/**
21568 * Emit `event` with the given args.
21569 *
21570 * @param {String} event
21571 * @param {Mixed} ...
21572 * @return {Emitter}
21573 */
21574
21575Emitter.prototype.emit = function(event){
21576 this._callbacks = this._callbacks || {};
21577
21578 var args = new Array(arguments.length - 1)
21579 , callbacks = this._callbacks['$' + event];
21580
21581 for (var i = 1; i < arguments.length; i++) {
21582 args[i - 1] = arguments[i];
21583 }
21584
21585 if (callbacks) {
21586 callbacks = callbacks.slice(0);
21587 for (var i = 0, len = callbacks.length; i < len; ++i) {
21588 callbacks[i].apply(this, args);
21589 }
21590 }
21591
21592 return this;
21593};
21594
21595/**
21596 * Return array of callbacks for `event`.
21597 *
21598 * @param {String} event
21599 * @return {Array}
21600 * @api public
21601 */
21602
21603Emitter.prototype.listeners = function(event){
21604 this._callbacks = this._callbacks || {};
21605 return this._callbacks['$' + event] || [];
21606};
21607
21608/**
21609 * Check if this emitter has `event` handlers.
21610 *
21611 * @param {String} event
21612 * @return {Boolean}
21613 * @api public
21614 */
21615
21616Emitter.prototype.hasListeners = function(event){
21617 return !! this.listeners(event).length;
21618};
21619
21620
21621/***/ }),
21622/* 343 */
21623/***/ (function(module, exports) {
21624
21625module.exports = stringify
21626stringify.default = stringify
21627stringify.stable = deterministicStringify
21628stringify.stableStringify = deterministicStringify
21629
21630var arr = []
21631var replacerStack = []
21632
21633// Regular stringify
21634function stringify (obj, replacer, spacer) {
21635 decirc(obj, '', [], undefined)
21636 var res
21637 if (replacerStack.length === 0) {
21638 res = JSON.stringify(obj, replacer, spacer)
21639 } else {
21640 res = JSON.stringify(obj, replaceGetterValues(replacer), spacer)
21641 }
21642 while (arr.length !== 0) {
21643 var part = arr.pop()
21644 if (part.length === 4) {
21645 Object.defineProperty(part[0], part[1], part[3])
21646 } else {
21647 part[0][part[1]] = part[2]
21648 }
21649 }
21650 return res
21651}
21652function decirc (val, k, stack, parent) {
21653 var i
21654 if (typeof val === 'object' && val !== null) {
21655 for (i = 0; i < stack.length; i++) {
21656 if (stack[i] === val) {
21657 var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k)
21658 if (propertyDescriptor.get !== undefined) {
21659 if (propertyDescriptor.configurable) {
21660 Object.defineProperty(parent, k, { value: '[Circular]' })
21661 arr.push([parent, k, val, propertyDescriptor])
21662 } else {
21663 replacerStack.push([val, k])
21664 }
21665 } else {
21666 parent[k] = '[Circular]'
21667 arr.push([parent, k, val])
21668 }
21669 return
21670 }
21671 }
21672 stack.push(val)
21673 // Optimize for Arrays. Big arrays could kill the performance otherwise!
21674 if (Array.isArray(val)) {
21675 for (i = 0; i < val.length; i++) {
21676 decirc(val[i], i, stack, val)
21677 }
21678 } else {
21679 var keys = Object.keys(val)
21680 for (i = 0; i < keys.length; i++) {
21681 var key = keys[i]
21682 decirc(val[key], key, stack, val)
21683 }
21684 }
21685 stack.pop()
21686 }
21687}
21688
21689// Stable-stringify
21690function compareFunction (a, b) {
21691 if (a < b) {
21692 return -1
21693 }
21694 if (a > b) {
21695 return 1
21696 }
21697 return 0
21698}
21699
21700function deterministicStringify (obj, replacer, spacer) {
21701 var tmp = deterministicDecirc(obj, '', [], undefined) || obj
21702 var res
21703 if (replacerStack.length === 0) {
21704 res = JSON.stringify(tmp, replacer, spacer)
21705 } else {
21706 res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer)
21707 }
21708 while (arr.length !== 0) {
21709 var part = arr.pop()
21710 if (part.length === 4) {
21711 Object.defineProperty(part[0], part[1], part[3])
21712 } else {
21713 part[0][part[1]] = part[2]
21714 }
21715 }
21716 return res
21717}
21718
21719function deterministicDecirc (val, k, stack, parent) {
21720 var i
21721 if (typeof val === 'object' && val !== null) {
21722 for (i = 0; i < stack.length; i++) {
21723 if (stack[i] === val) {
21724 var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k)
21725 if (propertyDescriptor.get !== undefined) {
21726 if (propertyDescriptor.configurable) {
21727 Object.defineProperty(parent, k, { value: '[Circular]' })
21728 arr.push([parent, k, val, propertyDescriptor])
21729 } else {
21730 replacerStack.push([val, k])
21731 }
21732 } else {
21733 parent[k] = '[Circular]'
21734 arr.push([parent, k, val])
21735 }
21736 return
21737 }
21738 }
21739 if (typeof val.toJSON === 'function') {
21740 return
21741 }
21742 stack.push(val)
21743 // Optimize for Arrays. Big arrays could kill the performance otherwise!
21744 if (Array.isArray(val)) {
21745 for (i = 0; i < val.length; i++) {
21746 deterministicDecirc(val[i], i, stack, val)
21747 }
21748 } else {
21749 // Create a temporary object in the required way
21750 var tmp = {}
21751 var keys = Object.keys(val).sort(compareFunction)
21752 for (i = 0; i < keys.length; i++) {
21753 var key = keys[i]
21754 deterministicDecirc(val[key], key, stack, val)
21755 tmp[key] = val[key]
21756 }
21757 if (parent !== undefined) {
21758 arr.push([parent, k, val])
21759 parent[k] = tmp
21760 } else {
21761 return tmp
21762 }
21763 }
21764 stack.pop()
21765 }
21766}
21767
21768// wraps replacer function to handle values we couldn't replace
21769// and mark them as [Circular]
21770function replaceGetterValues (replacer) {
21771 replacer = replacer !== undefined ? replacer : function (k, v) { return v }
21772 return function (key, val) {
21773 if (replacerStack.length > 0) {
21774 for (var i = 0; i < replacerStack.length; i++) {
21775 var part = replacerStack[i]
21776 if (part[1] === key && part[0] === val) {
21777 val = '[Circular]'
21778 replacerStack.splice(i, 1)
21779 break
21780 }
21781 }
21782 }
21783 return replacer.call(this, key, val)
21784 }
21785}
21786
21787
21788/***/ }),
21789/* 344 */
21790/***/ (function(module, exports, __webpack_require__) {
21791
21792"use strict";
21793
21794
21795var _promise = __webpack_require__(3);
21796
21797var _promise2 = _interopRequireDefault(_promise);
21798
21799var _iterator = __webpack_require__(61);
21800
21801var _iterator2 = _interopRequireDefault(_iterator);
21802
21803var _typeof3 = __webpack_require__(30);
21804
21805var _typeof4 = _interopRequireDefault(_typeof3);
21806
21807var _symbol = __webpack_require__(51);
21808
21809var _symbol2 = _interopRequireDefault(_symbol);
21810
21811function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21812
21813function _typeof(obj) {
21814 "@babel/helpers - typeof";
21815 if (typeof _symbol2.default === "function" && (0, _typeof4.default)(_iterator2.default) === "symbol") {
21816 _typeof = function _typeof(obj) {
21817 return typeof obj === "undefined" ? "undefined" : (0, _typeof4.default)(obj);
21818 };
21819 } else {
21820 _typeof = function _typeof(obj) {
21821 return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : (0, _typeof4.default)(obj);
21822 };
21823 }return _typeof(obj);
21824}
21825
21826/**
21827 * Module of mixed-in functions shared between node and client code
21828 */
21829var isObject = __webpack_require__(170);
21830/**
21831 * Expose `RequestBase`.
21832 */
21833
21834module.exports = RequestBase;
21835/**
21836 * Initialize a new `RequestBase`.
21837 *
21838 * @api public
21839 */
21840
21841function RequestBase(obj) {
21842 if (obj) return mixin(obj);
21843}
21844/**
21845 * Mixin the prototype properties.
21846 *
21847 * @param {Object} obj
21848 * @return {Object}
21849 * @api private
21850 */
21851
21852function mixin(obj) {
21853 for (var key in RequestBase.prototype) {
21854 if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) obj[key] = RequestBase.prototype[key];
21855 }
21856
21857 return obj;
21858}
21859/**
21860 * Clear previous timeout.
21861 *
21862 * @return {Request} for chaining
21863 * @api public
21864 */
21865
21866RequestBase.prototype.clearTimeout = function () {
21867 clearTimeout(this._timer);
21868 clearTimeout(this._responseTimeoutTimer);
21869 clearTimeout(this._uploadTimeoutTimer);
21870 delete this._timer;
21871 delete this._responseTimeoutTimer;
21872 delete this._uploadTimeoutTimer;
21873 return this;
21874};
21875/**
21876 * Override default response body parser
21877 *
21878 * This function will be called to convert incoming data into request.body
21879 *
21880 * @param {Function}
21881 * @api public
21882 */
21883
21884RequestBase.prototype.parse = function (fn) {
21885 this._parser = fn;
21886 return this;
21887};
21888/**
21889 * Set format of binary response body.
21890 * In browser valid formats are 'blob' and 'arraybuffer',
21891 * which return Blob and ArrayBuffer, respectively.
21892 *
21893 * In Node all values result in Buffer.
21894 *
21895 * Examples:
21896 *
21897 * req.get('/')
21898 * .responseType('blob')
21899 * .end(callback);
21900 *
21901 * @param {String} val
21902 * @return {Request} for chaining
21903 * @api public
21904 */
21905
21906RequestBase.prototype.responseType = function (val) {
21907 this._responseType = val;
21908 return this;
21909};
21910/**
21911 * Override default request body serializer
21912 *
21913 * This function will be called to convert data set via .send or .attach into payload to send
21914 *
21915 * @param {Function}
21916 * @api public
21917 */
21918
21919RequestBase.prototype.serialize = function (fn) {
21920 this._serializer = fn;
21921 return this;
21922};
21923/**
21924 * Set timeouts.
21925 *
21926 * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.
21927 * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.
21928 * - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off
21929 *
21930 * Value of 0 or false means no timeout.
21931 *
21932 * @param {Number|Object} ms or {response, deadline}
21933 * @return {Request} for chaining
21934 * @api public
21935 */
21936
21937RequestBase.prototype.timeout = function (options) {
21938 if (!options || _typeof(options) !== 'object') {
21939 this._timeout = options;
21940 this._responseTimeout = 0;
21941 this._uploadTimeout = 0;
21942 return this;
21943 }
21944
21945 for (var option in options) {
21946 if (Object.prototype.hasOwnProperty.call(options, option)) {
21947 switch (option) {
21948 case 'deadline':
21949 this._timeout = options.deadline;
21950 break;
21951
21952 case 'response':
21953 this._responseTimeout = options.response;
21954 break;
21955
21956 case 'upload':
21957 this._uploadTimeout = options.upload;
21958 break;
21959
21960 default:
21961 console.warn('Unknown timeout option', option);
21962 }
21963 }
21964 }
21965
21966 return this;
21967};
21968/**
21969 * Set number of retry attempts on error.
21970 *
21971 * Failed requests will be retried 'count' times if timeout or err.code >= 500.
21972 *
21973 * @param {Number} count
21974 * @param {Function} [fn]
21975 * @return {Request} for chaining
21976 * @api public
21977 */
21978
21979RequestBase.prototype.retry = function (count, fn) {
21980 // Default to 1 if no count passed or true
21981 if (arguments.length === 0 || count === true) count = 1;
21982 if (count <= 0) count = 0;
21983 this._maxRetries = count;
21984 this._retries = 0;
21985 this._retryCallback = fn;
21986 return this;
21987};
21988
21989var ERROR_CODES = ['ECONNRESET', 'ETIMEDOUT', 'EADDRINFO', 'ESOCKETTIMEDOUT'];
21990/**
21991 * Determine if a request should be retried.
21992 * (Borrowed from segmentio/superagent-retry)
21993 *
21994 * @param {Error} err an error
21995 * @param {Response} [res] response
21996 * @returns {Boolean} if segment should be retried
21997 */
21998
21999RequestBase.prototype._shouldRetry = function (err, res) {
22000 if (!this._maxRetries || this._retries++ >= this._maxRetries) {
22001 return false;
22002 }
22003
22004 if (this._retryCallback) {
22005 try {
22006 var override = this._retryCallback(err, res);
22007
22008 if (override === true) return true;
22009 if (override === false) return false; // undefined falls back to defaults
22010 } catch (err_) {
22011 console.error(err_);
22012 }
22013 }
22014
22015 if (res && res.status && res.status >= 500 && res.status !== 501) return true;
22016
22017 if (err) {
22018 if (err.code && ERROR_CODES.includes(err.code)) return true; // Superagent timeout
22019
22020 if (err.timeout && err.code === 'ECONNABORTED') return true;
22021 if (err.crossDomain) return true;
22022 }
22023
22024 return false;
22025};
22026/**
22027 * Retry request
22028 *
22029 * @return {Request} for chaining
22030 * @api private
22031 */
22032
22033RequestBase.prototype._retry = function () {
22034 this.clearTimeout(); // node
22035
22036 if (this.req) {
22037 this.req = null;
22038 this.req = this.request();
22039 }
22040
22041 this._aborted = false;
22042 this.timedout = false;
22043 this.timedoutError = null;
22044 return this._end();
22045};
22046/**
22047 * Promise support
22048 *
22049 * @param {Function} resolve
22050 * @param {Function} [reject]
22051 * @return {Request}
22052 */
22053
22054RequestBase.prototype.then = function (resolve, reject) {
22055 var _this = this;
22056
22057 if (!this._fullfilledPromise) {
22058 var self = this;
22059
22060 if (this._endCalled) {
22061 console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
22062 }
22063
22064 this._fullfilledPromise = new _promise2.default(function (resolve, reject) {
22065 self.on('abort', function () {
22066 if (_this._maxRetries && _this._maxRetries > _this._retries) {
22067 return;
22068 }
22069
22070 if (_this.timedout && _this.timedoutError) {
22071 reject(_this.timedoutError);
22072 return;
22073 }
22074
22075 var err = new Error('Aborted');
22076 err.code = 'ABORTED';
22077 err.status = _this.status;
22078 err.method = _this.method;
22079 err.url = _this.url;
22080 reject(err);
22081 });
22082 self.end(function (err, res) {
22083 if (err) reject(err);else resolve(res);
22084 });
22085 });
22086 }
22087
22088 return this._fullfilledPromise.then(resolve, reject);
22089};
22090
22091RequestBase.prototype.catch = function (cb) {
22092 return this.then(undefined, cb);
22093};
22094/**
22095 * Allow for extension
22096 */
22097
22098RequestBase.prototype.use = function (fn) {
22099 fn(this);
22100 return this;
22101};
22102
22103RequestBase.prototype.ok = function (cb) {
22104 if (typeof cb !== 'function') throw new Error('Callback required');
22105 this._okCallback = cb;
22106 return this;
22107};
22108
22109RequestBase.prototype._isResponseOK = function (res) {
22110 if (!res) {
22111 return false;
22112 }
22113
22114 if (this._okCallback) {
22115 return this._okCallback(res);
22116 }
22117
22118 return res.status >= 200 && res.status < 300;
22119};
22120/**
22121 * Get request header `field`.
22122 * Case-insensitive.
22123 *
22124 * @param {String} field
22125 * @return {String}
22126 * @api public
22127 */
22128
22129RequestBase.prototype.get = function (field) {
22130 return this._header[field.toLowerCase()];
22131};
22132/**
22133 * Get case-insensitive header `field` value.
22134 * This is a deprecated internal API. Use `.get(field)` instead.
22135 *
22136 * (getHeader is no longer used internally by the superagent code base)
22137 *
22138 * @param {String} field
22139 * @return {String}
22140 * @api private
22141 * @deprecated
22142 */
22143
22144RequestBase.prototype.getHeader = RequestBase.prototype.get;
22145/**
22146 * Set header `field` to `val`, or multiple fields with one object.
22147 * Case-insensitive.
22148 *
22149 * Examples:
22150 *
22151 * req.get('/')
22152 * .set('Accept', 'application/json')
22153 * .set('X-API-Key', 'foobar')
22154 * .end(callback);
22155 *
22156 * req.get('/')
22157 * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
22158 * .end(callback);
22159 *
22160 * @param {String|Object} field
22161 * @param {String} val
22162 * @return {Request} for chaining
22163 * @api public
22164 */
22165
22166RequestBase.prototype.set = function (field, val) {
22167 if (isObject(field)) {
22168 for (var key in field) {
22169 if (Object.prototype.hasOwnProperty.call(field, key)) this.set(key, field[key]);
22170 }
22171
22172 return this;
22173 }
22174
22175 this._header[field.toLowerCase()] = val;
22176 this.header[field] = val;
22177 return this;
22178};
22179/**
22180 * Remove header `field`.
22181 * Case-insensitive.
22182 *
22183 * Example:
22184 *
22185 * req.get('/')
22186 * .unset('User-Agent')
22187 * .end(callback);
22188 *
22189 * @param {String} field field name
22190 */
22191
22192RequestBase.prototype.unset = function (field) {
22193 delete this._header[field.toLowerCase()];
22194 delete this.header[field];
22195 return this;
22196};
22197/**
22198 * Write the field `name` and `val`, or multiple fields with one object
22199 * for "multipart/form-data" request bodies.
22200 *
22201 * ``` js
22202 * request.post('/upload')
22203 * .field('foo', 'bar')
22204 * .end(callback);
22205 *
22206 * request.post('/upload')
22207 * .field({ foo: 'bar', baz: 'qux' })
22208 * .end(callback);
22209 * ```
22210 *
22211 * @param {String|Object} name name of field
22212 * @param {String|Blob|File|Buffer|fs.ReadStream} val value of field
22213 * @return {Request} for chaining
22214 * @api public
22215 */
22216
22217RequestBase.prototype.field = function (name, val) {
22218 // name should be either a string or an object.
22219 if (name === null || undefined === name) {
22220 throw new Error('.field(name, val) name can not be empty');
22221 }
22222
22223 if (this._data) {
22224 throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");
22225 }
22226
22227 if (isObject(name)) {
22228 for (var key in name) {
22229 if (Object.prototype.hasOwnProperty.call(name, key)) this.field(key, name[key]);
22230 }
22231
22232 return this;
22233 }
22234
22235 if (Array.isArray(val)) {
22236 for (var i in val) {
22237 if (Object.prototype.hasOwnProperty.call(val, i)) this.field(name, val[i]);
22238 }
22239
22240 return this;
22241 } // val should be defined now
22242
22243
22244 if (val === null || undefined === val) {
22245 throw new Error('.field(name, val) val can not be empty');
22246 }
22247
22248 if (typeof val === 'boolean') {
22249 val = String(val);
22250 }
22251
22252 this._getFormData().append(name, val);
22253
22254 return this;
22255};
22256/**
22257 * Abort the request, and clear potential timeout.
22258 *
22259 * @return {Request} request
22260 * @api public
22261 */
22262
22263RequestBase.prototype.abort = function () {
22264 if (this._aborted) {
22265 return this;
22266 }
22267
22268 this._aborted = true;
22269 if (this.xhr) this.xhr.abort(); // browser
22270
22271 if (this.req) this.req.abort(); // node
22272
22273 this.clearTimeout();
22274 this.emit('abort');
22275 return this;
22276};
22277
22278RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
22279 switch (options.type) {
22280 case 'basic':
22281 this.set('Authorization', "Basic ".concat(base64Encoder("".concat(user, ":").concat(pass))));
22282 break;
22283
22284 case 'auto':
22285 this.username = user;
22286 this.password = pass;
22287 break;
22288
22289 case 'bearer':
22290 // usage would be .auth(accessToken, { type: 'bearer' })
22291 this.set('Authorization', "Bearer ".concat(user));
22292 break;
22293
22294 default:
22295 break;
22296 }
22297
22298 return this;
22299};
22300/**
22301 * Enable transmission of cookies with x-domain requests.
22302 *
22303 * Note that for this to work the origin must not be
22304 * using "Access-Control-Allow-Origin" with a wildcard,
22305 * and also must set "Access-Control-Allow-Credentials"
22306 * to "true".
22307 *
22308 * @api public
22309 */
22310
22311RequestBase.prototype.withCredentials = function (on) {
22312 // This is browser-only functionality. Node side is no-op.
22313 if (on === undefined) on = true;
22314 this._withCredentials = on;
22315 return this;
22316};
22317/**
22318 * Set the max redirects to `n`. Does nothing in browser XHR implementation.
22319 *
22320 * @param {Number} n
22321 * @return {Request} for chaining
22322 * @api public
22323 */
22324
22325RequestBase.prototype.redirects = function (n) {
22326 this._maxRedirects = n;
22327 return this;
22328};
22329/**
22330 * Maximum size of buffered response body, in bytes. Counts uncompressed size.
22331 * Default 200MB.
22332 *
22333 * @param {Number} n number of bytes
22334 * @return {Request} for chaining
22335 */
22336
22337RequestBase.prototype.maxResponseSize = function (n) {
22338 if (typeof n !== 'number') {
22339 throw new TypeError('Invalid argument');
22340 }
22341
22342 this._maxResponseSize = n;
22343 return this;
22344};
22345/**
22346 * Convert to a plain javascript object (not JSON string) of scalar properties.
22347 * Note as this method is designed to return a useful non-this value,
22348 * it cannot be chained.
22349 *
22350 * @return {Object} describing method, url, and data of this request
22351 * @api public
22352 */
22353
22354RequestBase.prototype.toJSON = function () {
22355 return {
22356 method: this.method,
22357 url: this.url,
22358 data: this._data,
22359 headers: this._header
22360 };
22361};
22362/**
22363 * Send `data` as the request body, defaulting the `.type()` to "json" when
22364 * an object is given.
22365 *
22366 * Examples:
22367 *
22368 * // manual json
22369 * request.post('/user')
22370 * .type('json')
22371 * .send('{"name":"tj"}')
22372 * .end(callback)
22373 *
22374 * // auto json
22375 * request.post('/user')
22376 * .send({ name: 'tj' })
22377 * .end(callback)
22378 *
22379 * // manual x-www-form-urlencoded
22380 * request.post('/user')
22381 * .type('form')
22382 * .send('name=tj')
22383 * .end(callback)
22384 *
22385 * // auto x-www-form-urlencoded
22386 * request.post('/user')
22387 * .type('form')
22388 * .send({ name: 'tj' })
22389 * .end(callback)
22390 *
22391 * // defaults to x-www-form-urlencoded
22392 * request.post('/user')
22393 * .send('name=tobi')
22394 * .send('species=ferret')
22395 * .end(callback)
22396 *
22397 * @param {String|Object} data
22398 * @return {Request} for chaining
22399 * @api public
22400 */
22401// eslint-disable-next-line complexity
22402
22403
22404RequestBase.prototype.send = function (data) {
22405 var isObj = isObject(data);
22406 var type = this._header['content-type'];
22407
22408 if (this._formData) {
22409 throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");
22410 }
22411
22412 if (isObj && !this._data) {
22413 if (Array.isArray(data)) {
22414 this._data = [];
22415 } else if (!this._isHost(data)) {
22416 this._data = {};
22417 }
22418 } else if (data && this._data && this._isHost(this._data)) {
22419 throw new Error("Can't merge these send calls");
22420 } // merge
22421
22422
22423 if (isObj && isObject(this._data)) {
22424 for (var key in data) {
22425 if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key];
22426 }
22427 } else if (typeof data === 'string') {
22428 // default to x-www-form-urlencoded
22429 if (!type) this.type('form');
22430 type = this._header['content-type'];
22431
22432 if (type === 'application/x-www-form-urlencoded') {
22433 this._data = this._data ? "".concat(this._data, "&").concat(data) : data;
22434 } else {
22435 this._data = (this._data || '') + data;
22436 }
22437 } else {
22438 this._data = data;
22439 }
22440
22441 if (!isObj || this._isHost(data)) {
22442 return this;
22443 } // default to json
22444
22445
22446 if (!type) this.type('json');
22447 return this;
22448};
22449/**
22450 * Sort `querystring` by the sort function
22451 *
22452 *
22453 * Examples:
22454 *
22455 * // default order
22456 * request.get('/user')
22457 * .query('name=Nick')
22458 * .query('search=Manny')
22459 * .sortQuery()
22460 * .end(callback)
22461 *
22462 * // customized sort function
22463 * request.get('/user')
22464 * .query('name=Nick')
22465 * .query('search=Manny')
22466 * .sortQuery(function(a, b){
22467 * return a.length - b.length;
22468 * })
22469 * .end(callback)
22470 *
22471 *
22472 * @param {Function} sort
22473 * @return {Request} for chaining
22474 * @api public
22475 */
22476
22477RequestBase.prototype.sortQuery = function (sort) {
22478 // _sort default to true but otherwise can be a function or boolean
22479 this._sort = typeof sort === 'undefined' ? true : sort;
22480 return this;
22481};
22482/**
22483 * Compose querystring to append to req.url
22484 *
22485 * @api private
22486 */
22487
22488RequestBase.prototype._finalizeQueryString = function () {
22489 var query = this._query.join('&');
22490
22491 if (query) {
22492 this.url += (this.url.includes('?') ? '&' : '?') + query;
22493 }
22494
22495 this._query.length = 0; // Makes the call idempotent
22496
22497 if (this._sort) {
22498 var index = this.url.indexOf('?');
22499
22500 if (index >= 0) {
22501 var queryArr = this.url.slice(index + 1).split('&');
22502
22503 if (typeof this._sort === 'function') {
22504 queryArr.sort(this._sort);
22505 } else {
22506 queryArr.sort();
22507 }
22508
22509 this.url = this.url.slice(0, index) + '?' + queryArr.join('&');
22510 }
22511 }
22512}; // For backwards compat only
22513
22514
22515RequestBase.prototype._appendQueryString = function () {
22516 console.warn('Unsupported');
22517};
22518/**
22519 * Invoke callback with timeout error.
22520 *
22521 * @api private
22522 */
22523
22524RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
22525 if (this._aborted) {
22526 return;
22527 }
22528
22529 var err = new Error("".concat(reason + timeout, "ms exceeded"));
22530 err.timeout = timeout;
22531 err.code = 'ECONNABORTED';
22532 err.errno = errno;
22533 this.timedout = true;
22534 this.timedoutError = err;
22535 this.abort();
22536 this.callback(err);
22537};
22538
22539RequestBase.prototype._setTimeouts = function () {
22540 var self = this; // deadline
22541
22542 if (this._timeout && !this._timer) {
22543 this._timer = setTimeout(function () {
22544 self._timeoutError('Timeout of ', self._timeout, 'ETIME');
22545 }, this._timeout);
22546 } // response timeout
22547
22548
22549 if (this._responseTimeout && !this._responseTimeoutTimer) {
22550 this._responseTimeoutTimer = setTimeout(function () {
22551 self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');
22552 }, this._responseTimeout);
22553 }
22554};
22555
22556/***/ }),
22557/* 345 */
22558/***/ (function(module, exports, __webpack_require__) {
22559
22560"use strict";
22561
22562
22563/**
22564 * Module dependencies.
22565 */
22566
22567var utils = __webpack_require__(346);
22568/**
22569 * Expose `ResponseBase`.
22570 */
22571
22572module.exports = ResponseBase;
22573/**
22574 * Initialize a new `ResponseBase`.
22575 *
22576 * @api public
22577 */
22578
22579function ResponseBase(obj) {
22580 if (obj) return mixin(obj);
22581}
22582/**
22583 * Mixin the prototype properties.
22584 *
22585 * @param {Object} obj
22586 * @return {Object}
22587 * @api private
22588 */
22589
22590function mixin(obj) {
22591 for (var key in ResponseBase.prototype) {
22592 if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) obj[key] = ResponseBase.prototype[key];
22593 }
22594
22595 return obj;
22596}
22597/**
22598 * Get case-insensitive `field` value.
22599 *
22600 * @param {String} field
22601 * @return {String}
22602 * @api public
22603 */
22604
22605ResponseBase.prototype.get = function (field) {
22606 return this.header[field.toLowerCase()];
22607};
22608/**
22609 * Set header related properties:
22610 *
22611 * - `.type` the content type without params
22612 *
22613 * A response of "Content-Type: text/plain; charset=utf-8"
22614 * will provide you with a `.type` of "text/plain".
22615 *
22616 * @param {Object} header
22617 * @api private
22618 */
22619
22620ResponseBase.prototype._setHeaderProperties = function (header) {
22621 // TODO: moar!
22622 // TODO: make this a util
22623 // content-type
22624 var ct = header['content-type'] || '';
22625 this.type = utils.type(ct); // params
22626
22627 var params = utils.params(ct);
22628
22629 for (var key in params) {
22630 if (Object.prototype.hasOwnProperty.call(params, key)) this[key] = params[key];
22631 }
22632
22633 this.links = {}; // links
22634
22635 try {
22636 if (header.link) {
22637 this.links = utils.parseLinks(header.link);
22638 }
22639 } catch (_unused) {// ignore
22640 }
22641};
22642/**
22643 * Set flags such as `.ok` based on `status`.
22644 *
22645 * For example a 2xx response will give you a `.ok` of __true__
22646 * whereas 5xx will be __false__ and `.error` will be __true__. The
22647 * `.clientError` and `.serverError` are also available to be more
22648 * specific, and `.statusType` is the class of error ranging from 1..5
22649 * sometimes useful for mapping respond colors etc.
22650 *
22651 * "sugar" properties are also defined for common cases. Currently providing:
22652 *
22653 * - .noContent
22654 * - .badRequest
22655 * - .unauthorized
22656 * - .notAcceptable
22657 * - .notFound
22658 *
22659 * @param {Number} status
22660 * @api private
22661 */
22662
22663ResponseBase.prototype._setStatusProperties = function (status) {
22664 var type = status / 100 | 0; // status / class
22665
22666 this.statusCode = status;
22667 this.status = this.statusCode;
22668 this.statusType = type; // basics
22669
22670 this.info = type === 1;
22671 this.ok = type === 2;
22672 this.redirect = type === 3;
22673 this.clientError = type === 4;
22674 this.serverError = type === 5;
22675 this.error = type === 4 || type === 5 ? this.toError() : false; // sugar
22676
22677 this.created = status === 201;
22678 this.accepted = status === 202;
22679 this.noContent = status === 204;
22680 this.badRequest = status === 400;
22681 this.unauthorized = status === 401;
22682 this.notAcceptable = status === 406;
22683 this.forbidden = status === 403;
22684 this.notFound = status === 404;
22685 this.unprocessableEntity = status === 422;
22686};
22687
22688/***/ }),
22689/* 346 */
22690/***/ (function(module, exports, __webpack_require__) {
22691
22692"use strict";
22693
22694
22695/**
22696 * Return the mime type for the given `str`.
22697 *
22698 * @param {String} str
22699 * @return {String}
22700 * @api private
22701 */
22702
22703exports.type = function (str) {
22704 return str.split(/ *; */).shift();
22705};
22706/**
22707 * Return header field parameters.
22708 *
22709 * @param {String} str
22710 * @return {Object}
22711 * @api private
22712 */
22713
22714exports.params = function (str) {
22715 return str.split(/ *; */).reduce(function (obj, str) {
22716 var parts = str.split(/ *= */);
22717 var key = parts.shift();
22718 var val = parts.shift();
22719 if (key && val) obj[key] = val;
22720 return obj;
22721 }, {});
22722};
22723/**
22724 * Parse Link header fields.
22725 *
22726 * @param {String} str
22727 * @return {Object}
22728 * @api private
22729 */
22730
22731exports.parseLinks = function (str) {
22732 return str.split(/ *, */).reduce(function (obj, str) {
22733 var parts = str.split(/ *; */);
22734 var url = parts[0].slice(1, -1);
22735 var rel = parts[1].split(/ *= */)[1].slice(1, -1);
22736 obj[rel] = url;
22737 return obj;
22738 }, {});
22739};
22740/**
22741 * Strip content related fields from `header`.
22742 *
22743 * @param {Object} header
22744 * @return {Object} header
22745 * @api private
22746 */
22747
22748exports.cleanHeader = function (header, changesOrigin) {
22749 delete header['content-type'];
22750 delete header['content-length'];
22751 delete header['transfer-encoding'];
22752 delete header.host; // secuirty
22753
22754 if (changesOrigin) {
22755 delete header.authorization;
22756 delete header.cookie;
22757 }
22758
22759 return header;
22760};
22761
22762/***/ }),
22763/* 347 */
22764/***/ (function(module, exports, __webpack_require__) {
22765
22766"use strict";
22767
22768
22769var _isIterable2 = __webpack_require__(169);
22770
22771var _isIterable3 = _interopRequireDefault(_isIterable2);
22772
22773var _symbol = __webpack_require__(51);
22774
22775var _symbol2 = _interopRequireDefault(_symbol);
22776
22777var _from = __webpack_require__(348);
22778
22779var _from2 = _interopRequireDefault(_from);
22780
22781function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22782
22783function _toConsumableArray(arr) {
22784 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
22785}
22786
22787function _nonIterableSpread() {
22788 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
22789}
22790
22791function _unsupportedIterableToArray(o, minLen) {
22792 if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return (0, _from2.default)(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
22793}
22794
22795function _iterableToArray(iter) {
22796 if (typeof _symbol2.default !== "undefined" && (0, _isIterable3.default)(Object(iter))) return (0, _from2.default)(iter);
22797}
22798
22799function _arrayWithoutHoles(arr) {
22800 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
22801}
22802
22803function _arrayLikeToArray(arr, len) {
22804 if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {
22805 arr2[i] = arr[i];
22806 }return arr2;
22807}
22808
22809function Agent() {
22810 this._defaults = [];
22811}
22812
22813['use', 'on', 'once', 'set', 'query', 'type', 'accept', 'auth', 'withCredentials', 'sortQuery', 'retry', 'ok', 'redirects', 'timeout', 'buffer', 'serialize', 'parse', 'ca', 'key', 'pfx', 'cert', 'disableTLSCerts'].forEach(function (fn) {
22814 // Default setting for all requests from this agent
22815 Agent.prototype[fn] = function () {
22816 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22817 args[_key] = arguments[_key];
22818 }
22819
22820 this._defaults.push({
22821 fn: fn,
22822 args: args
22823 });
22824
22825 return this;
22826 };
22827});
22828
22829Agent.prototype._setDefaults = function (req) {
22830 this._defaults.forEach(function (def) {
22831 req[def.fn].apply(req, _toConsumableArray(def.args));
22832 });
22833};
22834
22835module.exports = Agent;
22836
22837/***/ }),
22838/* 348 */
22839/***/ (function(module, exports, __webpack_require__) {
22840
22841module.exports = { "default": __webpack_require__(349), __esModule: true };
22842
22843/***/ }),
22844/* 349 */
22845/***/ (function(module, exports, __webpack_require__) {
22846
22847__webpack_require__(39);
22848__webpack_require__(350);
22849module.exports = __webpack_require__(2).Array.from;
22850
22851
22852/***/ }),
22853/* 350 */
22854/***/ (function(module, exports, __webpack_require__) {
22855
22856"use strict";
22857
22858var ctx = __webpack_require__(31);
22859var $export = __webpack_require__(16);
22860var toObject = __webpack_require__(44);
22861var call = __webpack_require__(102);
22862var isArrayIter = __webpack_require__(103);
22863var toLength = __webpack_require__(67);
22864var createProperty = __webpack_require__(351);
22865var getIterFn = __webpack_require__(72);
22866
22867$export($export.S + $export.F * !__webpack_require__(108)(function (iter) { Array.from(iter); }), 'Array', {
22868 // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
22869 from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
22870 var O = toObject(arrayLike);
22871 var C = typeof this == 'function' ? this : Array;
22872 var aLen = arguments.length;
22873 var mapfn = aLen > 1 ? arguments[1] : undefined;
22874 var mapping = mapfn !== undefined;
22875 var index = 0;
22876 var iterFn = getIterFn(O);
22877 var length, result, step, iterator;
22878 if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
22879 // if object isn't iterable or it's array with default iterator - use simple case
22880 if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
22881 for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
22882 createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
22883 }
22884 } else {
22885 length = toLength(O.length);
22886 for (result = new C(length); length > index; index++) {
22887 createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
22888 }
22889 }
22890 result.length = index;
22891 return result;
22892 }
22893});
22894
22895
22896/***/ }),
22897/* 351 */
22898/***/ (function(module, exports, __webpack_require__) {
22899
22900"use strict";
22901
22902var $defineProperty = __webpack_require__(18);
22903var createDesc = __webpack_require__(42);
22904
22905module.exports = function (object, index, value) {
22906 if (index in object) $defineProperty.f(object, index, createDesc(0, value));
22907 else object[index] = value;
22908};
22909
22910
22911/***/ })
22912/******/ ]);
22913});
22914//# sourceMappingURL=av.js.map
\No newline at end of file