UNPKG

698 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 = 164);
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__(189);
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__(70);
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__(104)))
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, __webpack_exports__, __webpack_require__) {
332
333"use strict";
334/* harmony export (immutable) */ __webpack_exports__["a"] = keys;
335/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(27);
336/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
337/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(22);
338/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(115);
339
340
341
342
343
344// Retrieve the names of an object's own properties.
345// Delegates to **ECMAScript 5**'s native `Object.keys`.
346function keys(obj) {
347 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
348 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj);
349 var keys = [];
350 for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key);
351 // Ahem, IE < 9.
352 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys);
353 return keys;
354}
355
356
357/***/ }),
358/* 4 */
359/***/ (function(module, exports, __webpack_require__) {
360
361module.exports = { "default": __webpack_require__(166), __esModule: true };
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__(66)('wks');
398var uid = __webpack_require__(51);
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__(125);
418/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(126);
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__(113);
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__(4);
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__(309);
532
533var _require = __webpack_require__(0),
534 extend = _require.extend;
535
536var AV = __webpack_require__(34);
537var AVError = __webpack_require__(23);
538
539var _require2 = __webpack_require__(15),
540 getSessionToken = _require2.getSessionToken;
541
542var ajax = __webpack_require__(58);
543
544// 计算 X-LC-Sign 的签名方法
545var sign = function sign(key, isMasterKey) {
546 var now = new Date().getTime();
547 var signature = md5(now + key);
548 if (isMasterKey) {
549 return signature + ',' + now + ',master';
550 }
551 return signature + ',' + now;
552};
553
554var setAppKey = function setAppKey(headers, signKey) {
555 if (signKey) {
556 headers['X-LC-Sign'] = sign(AV.applicationKey);
557 } else {
558 headers['X-LC-Key'] = AV.applicationKey;
559 }
560};
561
562var setHeaders = function setHeaders() {
563 var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
564 var signKey = arguments[1];
565
566 var headers = {
567 'X-LC-Id': AV.applicationId,
568 'Content-Type': 'application/json;charset=UTF-8'
569 };
570 var useMasterKey = false;
571 if (typeof authOptions.useMasterKey === 'boolean') {
572 useMasterKey = authOptions.useMasterKey;
573 } else if (typeof AV._config.useMasterKey === 'boolean') {
574 useMasterKey = AV._config.useMasterKey;
575 }
576 if (useMasterKey) {
577 if (AV.masterKey) {
578 if (signKey) {
579 headers['X-LC-Sign'] = sign(AV.masterKey, true);
580 } else {
581 headers['X-LC-Key'] = AV.masterKey + ',master';
582 }
583 } else {
584 console.warn('masterKey is not set, fall back to use appKey');
585 setAppKey(headers, signKey);
586 }
587 } else {
588 setAppKey(headers, signKey);
589 }
590 if (AV.hookKey) {
591 headers['X-LC-Hook-Key'] = AV.hookKey;
592 }
593 if (AV._config.production !== null) {
594 headers['X-LC-Prod'] = String(AV._config.production);
595 }
596 headers[undefined === 'NODE_JS' ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
597
598 return _promise2.default.resolve().then(function () {
599 // Pass the session token
600 var sessionToken = getSessionToken(authOptions);
601 if (sessionToken) {
602 headers['X-LC-Session'] = sessionToken;
603 } else if (!AV._config.disableCurrentUser) {
604 return AV.User.currentAsync().then(function (currentUser) {
605 if (currentUser && currentUser._sessionToken) {
606 headers['X-LC-Session'] = currentUser._sessionToken;
607 }
608 return headers;
609 });
610 }
611 return headers;
612 });
613};
614
615var createApiUrl = function createApiUrl(_ref) {
616 var _ref$service = _ref.service,
617 service = _ref$service === undefined ? 'api' : _ref$service,
618 _ref$version = _ref.version,
619 version = _ref$version === undefined ? '1.1' : _ref$version,
620 path = _ref.path;
621
622 var apiURL = AV._config.serverURLs[service];
623
624 if (!apiURL) throw new Error('undefined server URL for ' + service);
625
626 if (apiURL.charAt(apiURL.length - 1) !== '/') {
627 apiURL += '/';
628 }
629 apiURL += version;
630 if (path) {
631 apiURL += path;
632 }
633
634 return apiURL;
635};
636
637/**
638 * Low level REST API client. Call REST endpoints with authorization headers.
639 * @function AV.request
640 * @since 3.0.0
641 * @param {Object} options
642 * @param {String} options.method HTTP method
643 * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
644 * @param {Object} [options.query] query string dict
645 * @param {Object} [options.data] HTTP body
646 * @param {AuthOptions} [options.authOptions]
647 * @param {String} [options.service = 'api']
648 * @param {String} [options.version = '1.1']
649 */
650var request = function request(_ref2) {
651 var service = _ref2.service,
652 version = _ref2.version,
653 method = _ref2.method,
654 path = _ref2.path,
655 query = _ref2.query,
656 data = _ref2.data,
657 authOptions = _ref2.authOptions,
658 _ref2$signKey = _ref2.signKey,
659 signKey = _ref2$signKey === undefined ? true : _ref2$signKey;
660
661 if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
662 throw new Error('Not initialized');
663 }
664 if (AV._appRouter) {
665 AV._appRouter.refresh();
666 }
667 var timeout = AV._config.requestTimeout;
668
669 var url = createApiUrl({ service: service, path: path, version: version });
670 return setHeaders(authOptions, signKey).then(function (headers) {
671 return ajax({ method: method, url: url, query: query, data: data, headers: headers, timeout: timeout }).catch(function (error) {
672 var errorJSON = {
673 code: error.code || -1,
674 error: error.message || error.responseText
675 };
676 if (error.response && error.response.code) {
677 errorJSON = error.response;
678 } else if (error.responseText) {
679 try {
680 errorJSON = JSON.parse(error.responseText);
681 } catch (e) {
682 // If we fail to parse the error text, that's okay.
683 }
684 }
685 errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
686 if (!AV._sharedConfig.keepErrorRawMessage) {
687 errorJSON.error += ' [' + (error.statusCode || 'N/A') + ' ' + method + ' ' + url + ']';
688 }
689 // Transform the error into an instance of AVError by trying to parse
690 // the error string as JSON.
691 var err = new AVError(errorJSON.code, errorJSON.error);
692 delete errorJSON.error;
693 throw _.extend(err, errorJSON);
694 });
695 });
696};
697
698// lagecy request
699var _request = function _request(route, className, objectId, method, data, authOptions, query) {
700 var path = '';
701 if (route) path += '/' + route;
702 if (className) path += '/' + className;
703 if (objectId) path += '/' + objectId;
704 // for migeration
705 if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
706 if (data && data._where) throw new Error('_where should be in the query');
707 if (method && method.toLowerCase() === 'get') {
708 query = extend({}, query, data);
709 data = null;
710 }
711 return request({
712 method: method,
713 path: path,
714 query: query,
715 data: data,
716 authOptions: authOptions
717 });
718};
719
720AV.request = request;
721
722module.exports = {
723 _request: _request,
724 request: request
725};
726
727/***/ }),
728/* 13 */
729/***/ (function(module, __webpack_exports__, __webpack_require__) {
730
731"use strict";
732/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
733/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
734
735
736
737var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
738
739// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
740// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
741var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
742if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
743 isFunction = function(obj) {
744 return typeof obj == 'function' || false;
745 };
746}
747
748/* harmony default export */ __webpack_exports__["a"] = (isFunction);
749
750
751/***/ }),
752/* 14 */
753/***/ (function(module, __webpack_exports__, __webpack_require__) {
754
755"use strict";
756/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(114);
757
758
759// Internal helper to obtain the `length` property of an object.
760/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
761
762
763/***/ }),
764/* 15 */
765/***/ (function(module, exports, __webpack_require__) {
766
767"use strict";
768
769
770var _promise = __webpack_require__(4);
771
772var _promise2 = _interopRequireDefault(_promise);
773
774var _getPrototypeOf = __webpack_require__(155);
775
776var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
777
778function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
779
780var _ = __webpack_require__(0);
781
782// Helper function to check null or undefined.
783var isNullOrUndefined = function isNullOrUndefined(x) {
784 return _.isNull(x) || _.isUndefined(x);
785};
786
787var ensureArray = function ensureArray(target) {
788 if (_.isArray(target)) {
789 return target;
790 }
791 if (target === undefined || target === null) {
792 return [];
793 }
794 return [target];
795};
796
797var transformFetchOptions = function transformFetchOptions() {
798 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
799 keys = _ref.keys,
800 include = _ref.include,
801 includeACL = _ref.includeACL;
802
803 var fetchOptions = {};
804 if (keys) {
805 fetchOptions.keys = ensureArray(keys).join(',');
806 }
807 if (include) {
808 fetchOptions.include = ensureArray(include).join(',');
809 }
810 if (includeACL) {
811 fetchOptions.returnACL = includeACL;
812 }
813 return fetchOptions;
814};
815
816var getSessionToken = function getSessionToken(authOptions) {
817 if (authOptions.sessionToken) {
818 return authOptions.sessionToken;
819 }
820 if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
821 return authOptions.user.getSessionToken();
822 }
823};
824
825var tap = function tap(interceptor) {
826 return function (value) {
827 return interceptor(value), value;
828 };
829};
830
831// Shared empty constructor function to aid in prototype-chain creation.
832var EmptyConstructor = function EmptyConstructor() {};
833
834// Helper function to correctly set up the prototype chain, for subclasses.
835// Similar to `goog.inherits`, but uses a hash of prototype properties and
836// class properties to be extended.
837var inherits = function inherits(parent, protoProps, staticProps) {
838 var child;
839
840 // The constructor function for the new subclass is either defined by you
841 // (the "constructor" property in your `extend` definition), or defaulted
842 // by us to simply call the parent's constructor.
843 if (protoProps && protoProps.hasOwnProperty('constructor')) {
844 child = protoProps.constructor;
845 } else {
846 /** @ignore */
847 child = function child() {
848 parent.apply(this, arguments);
849 };
850 }
851
852 // Inherit class (static) properties from parent.
853 _.extend(child, parent);
854
855 // Set the prototype chain to inherit from `parent`, without calling
856 // `parent`'s constructor function.
857 EmptyConstructor.prototype = parent.prototype;
858 child.prototype = new EmptyConstructor();
859
860 // Add prototype properties (instance properties) to the subclass,
861 // if supplied.
862 if (protoProps) {
863 _.extend(child.prototype, protoProps);
864 }
865
866 // Add static properties to the constructor function, if supplied.
867 if (staticProps) {
868 _.extend(child, staticProps);
869 }
870
871 // Correctly set child's `prototype.constructor`.
872 child.prototype.constructor = child;
873
874 // Set a convenience property in case the parent's prototype is
875 // needed later.
876 child.__super__ = parent.prototype;
877
878 return child;
879};
880
881var parseDate = function parseDate(iso8601) {
882 return new Date(iso8601);
883};
884
885var setValue = function setValue(target, key, value) {
886 // '.' is not allowed in Class keys, escaping is not in concern now.
887 var segs = key.split('.');
888 var lastSeg = segs.pop();
889 var currentTarget = target;
890 segs.forEach(function (seg) {
891 if (currentTarget[seg] === undefined) currentTarget[seg] = {};
892 currentTarget = currentTarget[seg];
893 });
894 currentTarget[lastSeg] = value;
895 return target;
896};
897
898var findValue = function findValue(target, key) {
899 var segs = key.split('.');
900 var firstSeg = segs[0];
901 var lastSeg = segs.pop();
902 var currentTarget = target;
903 for (var i = 0; i < segs.length; i++) {
904 currentTarget = currentTarget[segs[i]];
905 if (currentTarget === undefined) {
906 return [undefined, undefined, lastSeg];
907 }
908 }
909 var value = currentTarget[lastSeg];
910 return [value, currentTarget, lastSeg, firstSeg];
911};
912
913var isPlainObject = function isPlainObject(obj) {
914 return _.isObject(obj) && (0, _getPrototypeOf2.default)(obj) === Object.prototype;
915};
916
917var continueWhile = function continueWhile(predicate, asyncFunction) {
918 if (predicate()) {
919 return asyncFunction().then(function () {
920 return continueWhile(predicate, asyncFunction);
921 });
922 }
923 return _promise2.default.resolve();
924};
925
926module.exports = {
927 isNullOrUndefined: isNullOrUndefined,
928 ensureArray: ensureArray,
929 transformFetchOptions: transformFetchOptions,
930 getSessionToken: getSessionToken,
931 tap: tap,
932 inherits: inherits,
933 parseDate: parseDate,
934 setValue: setValue,
935 findValue: findValue,
936 isPlainObject: isPlainObject,
937 continueWhile: continueWhile
938};
939
940/***/ }),
941/* 16 */
942/***/ (function(module, exports, __webpack_require__) {
943
944var isObject = __webpack_require__(20);
945module.exports = function (it) {
946 if (!isObject(it)) throw TypeError(it + ' is not an object!');
947 return it;
948};
949
950
951/***/ }),
952/* 17 */
953/***/ (function(module, exports, __webpack_require__) {
954
955var global = __webpack_require__(6);
956var core = __webpack_require__(2);
957var ctx = __webpack_require__(38);
958var hide = __webpack_require__(24);
959var has = __webpack_require__(25);
960var PROTOTYPE = 'prototype';
961
962var $export = function (type, name, source) {
963 var IS_FORCED = type & $export.F;
964 var IS_GLOBAL = type & $export.G;
965 var IS_STATIC = type & $export.S;
966 var IS_PROTO = type & $export.P;
967 var IS_BIND = type & $export.B;
968 var IS_WRAP = type & $export.W;
969 var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
970 var expProto = exports[PROTOTYPE];
971 var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
972 var key, own, out;
973 if (IS_GLOBAL) source = name;
974 for (key in source) {
975 // contains in native
976 own = !IS_FORCED && target && target[key] !== undefined;
977 if (own && has(exports, key)) continue;
978 // export native or passed
979 out = own ? target[key] : source[key];
980 // prevent global pollution for namespaces
981 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
982 // bind timers to global for call from export context
983 : IS_BIND && own ? ctx(out, global)
984 // wrap global constructors for prevent change them in library
985 : IS_WRAP && target[key] == out ? (function (C) {
986 var F = function (a, b, c) {
987 if (this instanceof C) {
988 switch (arguments.length) {
989 case 0: return new C();
990 case 1: return new C(a);
991 case 2: return new C(a, b);
992 } return new C(a, b, c);
993 } return C.apply(this, arguments);
994 };
995 F[PROTOTYPE] = C[PROTOTYPE];
996 return F;
997 // make static versions for prototype methods
998 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
999 // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
1000 if (IS_PROTO) {
1001 (exports.virtual || (exports.virtual = {}))[key] = out;
1002 // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
1003 if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
1004 }
1005 }
1006};
1007// type bitmap
1008$export.F = 1; // forced
1009$export.G = 2; // global
1010$export.S = 4; // static
1011$export.P = 8; // proto
1012$export.B = 16; // bind
1013$export.W = 32; // wrap
1014$export.U = 64; // safe
1015$export.R = 128; // real proto method for `library`
1016module.exports = $export;
1017
1018
1019/***/ }),
1020/* 18 */
1021/***/ (function(module, exports, __webpack_require__) {
1022
1023module.exports = { "default": __webpack_require__(261), __esModule: true };
1024
1025/***/ }),
1026/* 19 */
1027/***/ (function(module, exports, __webpack_require__) {
1028
1029var anObject = __webpack_require__(16);
1030var IE8_DOM_DEFINE = __webpack_require__(93);
1031var toPrimitive = __webpack_require__(63);
1032var dP = Object.defineProperty;
1033
1034exports.f = __webpack_require__(21) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
1035 anObject(O);
1036 P = toPrimitive(P, true);
1037 anObject(Attributes);
1038 if (IE8_DOM_DEFINE) try {
1039 return dP(O, P, Attributes);
1040 } catch (e) { /* empty */ }
1041 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
1042 if ('value' in Attributes) O[P] = Attributes.value;
1043 return O;
1044};
1045
1046
1047/***/ }),
1048/* 20 */
1049/***/ (function(module, exports) {
1050
1051module.exports = function (it) {
1052 return typeof it === 'object' ? it !== null : typeof it === 'function';
1053};
1054
1055
1056/***/ }),
1057/* 21 */
1058/***/ (function(module, exports, __webpack_require__) {
1059
1060// Thank's IE8 for his funny defineProperty
1061module.exports = !__webpack_require__(39)(function () {
1062 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
1063});
1064
1065
1066/***/ }),
1067/* 22 */
1068/***/ (function(module, __webpack_exports__, __webpack_require__) {
1069
1070"use strict";
1071/* harmony export (immutable) */ __webpack_exports__["a"] = has;
1072/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
1073
1074
1075// Internal function to check whether `key` is an own property name of `obj`.
1076function has(obj, key) {
1077 return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
1078}
1079
1080
1081/***/ }),
1082/* 23 */
1083/***/ (function(module, exports, __webpack_require__) {
1084
1085"use strict";
1086
1087
1088var _ = __webpack_require__(0);
1089
1090/**
1091 * @class AV.Error
1092 */
1093
1094function AVError(code, message) {
1095 var error = new Error(message);
1096 error.code = code;
1097 return error;
1098}
1099
1100_.extend(AVError,
1101/** @lends AV.Error */{
1102 /**
1103 * Error code indicating some error other than those enumerated here.
1104 * @constant
1105 */
1106 OTHER_CAUSE: -1,
1107
1108 /**
1109 * Error code indicating that something has gone wrong with the server.
1110 * If you get this error code, it is AV's fault.
1111 * @constant
1112 */
1113 INTERNAL_SERVER_ERROR: 1,
1114
1115 /**
1116 * Error code indicating the connection to the AV servers failed.
1117 * @constant
1118 */
1119 CONNECTION_FAILED: 100,
1120
1121 /**
1122 * Error code indicating the specified object doesn't exist.
1123 * @constant
1124 */
1125 OBJECT_NOT_FOUND: 101,
1126
1127 /**
1128 * Error code indicating you tried to query with a datatype that doesn't
1129 * support it, like exact matching an array or object.
1130 * @constant
1131 */
1132 INVALID_QUERY: 102,
1133
1134 /**
1135 * Error code indicating a missing or invalid classname. Classnames are
1136 * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1137 * only valid characters.
1138 * @constant
1139 */
1140 INVALID_CLASS_NAME: 103,
1141
1142 /**
1143 * Error code indicating an unspecified object id.
1144 * @constant
1145 */
1146 MISSING_OBJECT_ID: 104,
1147
1148 /**
1149 * Error code indicating an invalid key name. Keys are case-sensitive. They
1150 * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1151 * @constant
1152 */
1153 INVALID_KEY_NAME: 105,
1154
1155 /**
1156 * Error code indicating a malformed pointer. You should not see this unless
1157 * you have been mucking about changing internal AV code.
1158 * @constant
1159 */
1160 INVALID_POINTER: 106,
1161
1162 /**
1163 * Error code indicating that badly formed JSON was received upstream. This
1164 * either indicates you have done something unusual with modifying how
1165 * things encode to JSON, or the network is failing badly.
1166 * @constant
1167 */
1168 INVALID_JSON: 107,
1169
1170 /**
1171 * Error code indicating that the feature you tried to access is only
1172 * available internally for testing purposes.
1173 * @constant
1174 */
1175 COMMAND_UNAVAILABLE: 108,
1176
1177 /**
1178 * You must call AV.initialize before using the AV library.
1179 * @constant
1180 */
1181 NOT_INITIALIZED: 109,
1182
1183 /**
1184 * Error code indicating that a field was set to an inconsistent type.
1185 * @constant
1186 */
1187 INCORRECT_TYPE: 111,
1188
1189 /**
1190 * Error code indicating an invalid channel name. A channel name is either
1191 * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1192 * characters.
1193 * @constant
1194 */
1195 INVALID_CHANNEL_NAME: 112,
1196
1197 /**
1198 * Error code indicating that push is misconfigured.
1199 * @constant
1200 */
1201 PUSH_MISCONFIGURED: 115,
1202
1203 /**
1204 * Error code indicating that the object is too large.
1205 * @constant
1206 */
1207 OBJECT_TOO_LARGE: 116,
1208
1209 /**
1210 * Error code indicating that the operation isn't allowed for clients.
1211 * @constant
1212 */
1213 OPERATION_FORBIDDEN: 119,
1214
1215 /**
1216 * Error code indicating the result was not found in the cache.
1217 * @constant
1218 */
1219 CACHE_MISS: 120,
1220
1221 /**
1222 * Error code indicating that an invalid key was used in a nested
1223 * JSONObject.
1224 * @constant
1225 */
1226 INVALID_NESTED_KEY: 121,
1227
1228 /**
1229 * Error code indicating that an invalid filename was used for AVFile.
1230 * A valid file name contains only a-zA-Z0-9_. characters and is between 1
1231 * and 128 characters.
1232 * @constant
1233 */
1234 INVALID_FILE_NAME: 122,
1235
1236 /**
1237 * Error code indicating an invalid ACL was provided.
1238 * @constant
1239 */
1240 INVALID_ACL: 123,
1241
1242 /**
1243 * Error code indicating that the request timed out on the server. Typically
1244 * this indicates that the request is too expensive to run.
1245 * @constant
1246 */
1247 TIMEOUT: 124,
1248
1249 /**
1250 * Error code indicating that the email address was invalid.
1251 * @constant
1252 */
1253 INVALID_EMAIL_ADDRESS: 125,
1254
1255 /**
1256 * Error code indicating a missing content type.
1257 * @constant
1258 */
1259 MISSING_CONTENT_TYPE: 126,
1260
1261 /**
1262 * Error code indicating a missing content length.
1263 * @constant
1264 */
1265 MISSING_CONTENT_LENGTH: 127,
1266
1267 /**
1268 * Error code indicating an invalid content length.
1269 * @constant
1270 */
1271 INVALID_CONTENT_LENGTH: 128,
1272
1273 /**
1274 * Error code indicating a file that was too large.
1275 * @constant
1276 */
1277 FILE_TOO_LARGE: 129,
1278
1279 /**
1280 * Error code indicating an error saving a file.
1281 * @constant
1282 */
1283 FILE_SAVE_ERROR: 130,
1284
1285 /**
1286 * Error code indicating an error deleting a file.
1287 * @constant
1288 */
1289 FILE_DELETE_ERROR: 153,
1290
1291 /**
1292 * Error code indicating that a unique field was given a value that is
1293 * already taken.
1294 * @constant
1295 */
1296 DUPLICATE_VALUE: 137,
1297
1298 /**
1299 * Error code indicating that a role's name is invalid.
1300 * @constant
1301 */
1302 INVALID_ROLE_NAME: 139,
1303
1304 /**
1305 * Error code indicating that an application quota was exceeded. Upgrade to
1306 * resolve.
1307 * @constant
1308 */
1309 EXCEEDED_QUOTA: 140,
1310
1311 /**
1312 * Error code indicating that a Cloud Code script failed.
1313 * @constant
1314 */
1315 SCRIPT_FAILED: 141,
1316
1317 /**
1318 * Error code indicating that a Cloud Code validation failed.
1319 * @constant
1320 */
1321 VALIDATION_ERROR: 142,
1322
1323 /**
1324 * Error code indicating that invalid image data was provided.
1325 * @constant
1326 */
1327 INVALID_IMAGE_DATA: 150,
1328
1329 /**
1330 * Error code indicating an unsaved file.
1331 * @constant
1332 */
1333 UNSAVED_FILE_ERROR: 151,
1334
1335 /**
1336 * Error code indicating an invalid push time.
1337 * @constant
1338 */
1339 INVALID_PUSH_TIME_ERROR: 152,
1340
1341 /**
1342 * Error code indicating that the username is missing or empty.
1343 * @constant
1344 */
1345 USERNAME_MISSING: 200,
1346
1347 /**
1348 * Error code indicating that the password is missing or empty.
1349 * @constant
1350 */
1351 PASSWORD_MISSING: 201,
1352
1353 /**
1354 * Error code indicating that the username has already been taken.
1355 * @constant
1356 */
1357 USERNAME_TAKEN: 202,
1358
1359 /**
1360 * Error code indicating that the email has already been taken.
1361 * @constant
1362 */
1363 EMAIL_TAKEN: 203,
1364
1365 /**
1366 * Error code indicating that the email is missing, but must be specified.
1367 * @constant
1368 */
1369 EMAIL_MISSING: 204,
1370
1371 /**
1372 * Error code indicating that a user with the specified email was not found.
1373 * @constant
1374 */
1375 EMAIL_NOT_FOUND: 205,
1376
1377 /**
1378 * Error code indicating that a user object without a valid session could
1379 * not be altered.
1380 * @constant
1381 */
1382 SESSION_MISSING: 206,
1383
1384 /**
1385 * Error code indicating that a user can only be created through signup.
1386 * @constant
1387 */
1388 MUST_CREATE_USER_THROUGH_SIGNUP: 207,
1389
1390 /**
1391 * Error code indicating that an an account being linked is already linked
1392 * to another user.
1393 * @constant
1394 */
1395 ACCOUNT_ALREADY_LINKED: 208,
1396
1397 /**
1398 * Error code indicating that a user cannot be linked to an account because
1399 * that account's id could not be found.
1400 * @constant
1401 */
1402 LINKED_ID_MISSING: 250,
1403
1404 /**
1405 * Error code indicating that a user with a linked (e.g. Facebook) account
1406 * has an invalid session.
1407 * @constant
1408 */
1409 INVALID_LINKED_SESSION: 251,
1410
1411 /**
1412 * Error code indicating that a service being linked (e.g. Facebook or
1413 * Twitter) is unsupported.
1414 * @constant
1415 */
1416 UNSUPPORTED_SERVICE: 252,
1417 /**
1418 * Error code indicating a real error code is unavailable because
1419 * we had to use an XDomainRequest object to allow CORS requests in
1420 * Internet Explorer, which strips the body from HTTP responses that have
1421 * a non-2XX status code.
1422 * @constant
1423 */
1424 X_DOMAIN_REQUEST: 602
1425});
1426
1427module.exports = AVError;
1428
1429/***/ }),
1430/* 24 */
1431/***/ (function(module, exports, __webpack_require__) {
1432
1433var dP = __webpack_require__(19);
1434var createDesc = __webpack_require__(49);
1435module.exports = __webpack_require__(21) ? function (object, key, value) {
1436 return dP.f(object, key, createDesc(1, value));
1437} : function (object, key, value) {
1438 object[key] = value;
1439 return object;
1440};
1441
1442
1443/***/ }),
1444/* 25 */
1445/***/ (function(module, exports) {
1446
1447var hasOwnProperty = {}.hasOwnProperty;
1448module.exports = function (it, key) {
1449 return hasOwnProperty.call(it, key);
1450};
1451
1452
1453/***/ }),
1454/* 26 */
1455/***/ (function(module, exports, __webpack_require__) {
1456
1457// to indexed object, toObject with fallback for non-array-like ES3 strings
1458var IObject = __webpack_require__(170);
1459var defined = __webpack_require__(61);
1460module.exports = function (it) {
1461 return IObject(defined(it));
1462};
1463
1464
1465/***/ }),
1466/* 27 */
1467/***/ (function(module, __webpack_exports__, __webpack_require__) {
1468
1469"use strict";
1470/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
1471// Is a given variable an object?
1472function isObject(obj) {
1473 var type = typeof obj;
1474 return type === 'function' || type === 'object' && !!obj;
1475}
1476
1477
1478/***/ }),
1479/* 28 */
1480/***/ (function(module, __webpack_exports__, __webpack_require__) {
1481
1482"use strict";
1483/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
1484/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(5);
1485
1486
1487
1488// Is a given value an array?
1489// Delegates to ECMA5's native `Array.isArray`.
1490/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
1491
1492
1493/***/ }),
1494/* 29 */
1495/***/ (function(module, __webpack_exports__, __webpack_require__) {
1496
1497"use strict";
1498/* harmony export (immutable) */ __webpack_exports__["a"] = each;
1499/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(44);
1500/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
1501/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(3);
1502
1503
1504
1505
1506// The cornerstone for collection functions, an `each`
1507// implementation, aka `forEach`.
1508// Handles raw objects in addition to array-likes. Treats all
1509// sparse array-likes as if they were dense.
1510function each(obj, iteratee, context) {
1511 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
1512 var i, length;
1513 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
1514 for (i = 0, length = obj.length; i < length; i++) {
1515 iteratee(obj[i], i, obj);
1516 }
1517 } else {
1518 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
1519 for (i = 0, length = _keys.length; i < length; i++) {
1520 iteratee(obj[_keys[i]], _keys[i], obj);
1521 }
1522 }
1523 return obj;
1524}
1525
1526
1527/***/ }),
1528/* 30 */
1529/***/ (function(module, exports) {
1530
1531module.exports = {};
1532
1533
1534/***/ }),
1535/* 31 */
1536/***/ (function(module, __webpack_exports__, __webpack_require__) {
1537
1538"use strict";
1539/* harmony export (immutable) */ __webpack_exports__["a"] = values;
1540/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
1541
1542
1543// Retrieve the values of an object's properties.
1544function values(obj) {
1545 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
1546 var length = _keys.length;
1547 var values = Array(length);
1548 for (var i = 0; i < length; i++) {
1549 values[i] = obj[_keys[i]];
1550 }
1551 return values;
1552}
1553
1554
1555/***/ }),
1556/* 32 */
1557/***/ (function(module, __webpack_exports__, __webpack_require__) {
1558
1559"use strict";
1560/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
1561/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
1562/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
1563/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(28);
1564/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(73);
1565
1566
1567
1568
1569
1570// Internal implementation of a recursive `flatten` function.
1571function flatten(input, depth, strict, output) {
1572 output = output || [];
1573 if (!depth && depth !== 0) {
1574 depth = Infinity;
1575 } else if (depth <= 0) {
1576 return output.concat(input);
1577 }
1578 var idx = output.length;
1579 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
1580 var value = input[i];
1581 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))) {
1582 // Flatten current level of array or arguments object.
1583 if (depth > 1) {
1584 flatten(value, depth - 1, strict, output);
1585 idx = output.length;
1586 } else {
1587 var j = 0, len = value.length;
1588 while (j < len) output[idx++] = value[j++];
1589 }
1590 } else if (!strict) {
1591 output[idx++] = value;
1592 }
1593 }
1594 return output;
1595}
1596
1597
1598/***/ }),
1599/* 33 */
1600/***/ (function(module, __webpack_exports__, __webpack_require__) {
1601
1602"use strict";
1603/* harmony export (immutable) */ __webpack_exports__["a"] = map;
1604/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
1605/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
1606/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(3);
1607
1608
1609
1610
1611// Return the results of applying the iteratee to each element.
1612function map(obj, iteratee, context) {
1613 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
1614 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
1615 length = (_keys || obj).length,
1616 results = Array(length);
1617 for (var index = 0; index < length; index++) {
1618 var currentKey = _keys ? _keys[index] : index;
1619 results[index] = iteratee(obj[currentKey], currentKey, obj);
1620 }
1621 return results;
1622}
1623
1624
1625/***/ }),
1626/* 34 */
1627/***/ (function(module, exports, __webpack_require__) {
1628
1629"use strict";
1630/* WEBPACK VAR INJECTION */(function(global) {
1631
1632var _stringify = __webpack_require__(18);
1633
1634var _stringify2 = _interopRequireDefault(_stringify);
1635
1636var _keys = __webpack_require__(153);
1637
1638var _keys2 = _interopRequireDefault(_keys);
1639
1640var _promise = __webpack_require__(4);
1641
1642var _promise2 = _interopRequireDefault(_promise);
1643
1644function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1645
1646var _ = __webpack_require__(0);
1647var uuid = __webpack_require__(154);
1648var debug = __webpack_require__(35);
1649
1650var _require = __webpack_require__(15),
1651 inherits = _require.inherits,
1652 parseDate = _require.parseDate;
1653
1654var version = __webpack_require__(156);
1655
1656var _require2 = __webpack_require__(36),
1657 setAdapters = _require2.setAdapters,
1658 adapterManager = _require2.adapterManager;
1659
1660var AV = global.AV || {};
1661
1662// All internal configuration items
1663AV._config = {
1664 serverURLs: {},
1665 useMasterKey: false,
1666 production: null,
1667 realtime: null,
1668 requestTimeout: null
1669};
1670
1671var initialUserAgent = 'LeanCloud-JS-SDK/' + version;
1672
1673// configs shared by all AV instances
1674AV._sharedConfig = {
1675 userAgent: initialUserAgent,
1676 liveQueryRealtime: null
1677};
1678
1679adapterManager.on('platformInfo', function (platformInfo) {
1680 var ua = initialUserAgent;
1681 if (platformInfo) {
1682 if (platformInfo.userAgent) {
1683 ua = platformInfo.userAgent;
1684 } else {
1685 var comments = platformInfo.name;
1686 if (platformInfo.version) {
1687 comments += '/' + platformInfo.version;
1688 }
1689 if (platformInfo.extra) {
1690 comments += '; ' + platformInfo.extra;
1691 }
1692 ua += ' (' + comments + ')';
1693 }
1694 }
1695 AV._sharedConfig.userAgent = ua;
1696});
1697
1698/**
1699 * Contains all AV API classes and functions.
1700 * @namespace AV
1701 */
1702
1703/**
1704 * Returns prefix for localStorage keys used by this instance of AV.
1705 * @param {String} path The relative suffix to append to it.
1706 * null or undefined is treated as the empty string.
1707 * @return {String} The full key name.
1708 * @private
1709 */
1710AV._getAVPath = function (path) {
1711 if (!AV.applicationId) {
1712 throw new Error('You need to call AV.initialize before using AV.');
1713 }
1714 if (!path) {
1715 path = '';
1716 }
1717 if (!_.isString(path)) {
1718 throw new Error("Tried to get a localStorage path that wasn't a String.");
1719 }
1720 if (path[0] === '/') {
1721 path = path.substring(1);
1722 }
1723 return 'AV/' + AV.applicationId + '/' + path;
1724};
1725
1726/**
1727 * Returns the unique string for this app on this machine.
1728 * Gets reset when localStorage is cleared.
1729 * @private
1730 */
1731AV._installationId = null;
1732AV._getInstallationId = function () {
1733 // See if it's cached in RAM.
1734 if (AV._installationId) {
1735 return _promise2.default.resolve(AV._installationId);
1736 }
1737
1738 // Try to get it from localStorage.
1739 var path = AV._getAVPath('installationId');
1740 return AV.localStorage.getItemAsync(path).then(function (_installationId) {
1741 AV._installationId = _installationId;
1742 if (!AV._installationId) {
1743 // It wasn't in localStorage, so create a new one.
1744 AV._installationId = _installationId = uuid();
1745 return AV.localStorage.setItemAsync(path, _installationId).then(function () {
1746 return _installationId;
1747 });
1748 }
1749 return _installationId;
1750 });
1751};
1752
1753AV._subscriptionId = null;
1754AV._refreshSubscriptionId = function () {
1755 var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
1756
1757 var subscriptionId = AV._subscriptionId = uuid();
1758 return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
1759 return subscriptionId;
1760 });
1761};
1762AV._getSubscriptionId = function () {
1763 // See if it's cached in RAM.
1764 if (AV._subscriptionId) {
1765 return _promise2.default.resolve(AV._subscriptionId);
1766 }
1767
1768 // Try to get it from localStorage.
1769 var path = AV._getAVPath('subscriptionId');
1770 return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
1771 AV._subscriptionId = _subscriptionId;
1772 if (!AV._subscriptionId) {
1773 // It wasn't in localStorage, so create a new one.
1774 _subscriptionId = AV._refreshSubscriptionId(path);
1775 }
1776 return _subscriptionId;
1777 });
1778};
1779
1780AV._parseDate = parseDate;
1781
1782// A self-propagating extend function.
1783AV._extend = function (protoProps, classProps) {
1784 var child = inherits(this, protoProps, classProps);
1785 child.extend = this.extend;
1786 return child;
1787};
1788
1789/**
1790 * Converts a value in a AV Object into the appropriate representation.
1791 * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
1792 * if seenObjects is falsey. Otherwise any AV.Objects not in
1793 * seenObjects will be fully embedded rather than encoded
1794 * as a pointer. This array will be used to prevent going into an infinite
1795 * loop because we have circular references. If <seenObjects>
1796 * is set, then none of the AV Objects that are serialized can be dirty.
1797 * @private
1798 */
1799AV._encode = function (value, seenObjects, disallowObjects) {
1800 var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1801
1802 if (value instanceof AV.Object) {
1803 if (disallowObjects) {
1804 throw new Error('AV.Objects not allowed here');
1805 }
1806 if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
1807 return value._toPointer();
1808 }
1809 return value._toFullJSON(seenObjects.concat(value), full);
1810 }
1811 if (value instanceof AV.ACL) {
1812 return value.toJSON();
1813 }
1814 if (_.isDate(value)) {
1815 return full ? { __type: 'Date', iso: value.toJSON() } : value.toJSON();
1816 }
1817 if (value instanceof AV.GeoPoint) {
1818 return value.toJSON();
1819 }
1820 if (_.isArray(value)) {
1821 return _.map(value, function (x) {
1822 return AV._encode(x, seenObjects, disallowObjects, full);
1823 });
1824 }
1825 if (_.isRegExp(value)) {
1826 return value.source;
1827 }
1828 if (value instanceof AV.Relation) {
1829 return value.toJSON();
1830 }
1831 if (value instanceof AV.Op) {
1832 return value.toJSON();
1833 }
1834 if (value instanceof AV.File) {
1835 if (!value.url() && !value.id) {
1836 throw new Error('Tried to save an object containing an unsaved file.');
1837 }
1838 return value._toFullJSON(seenObjects, full);
1839 }
1840 if (_.isObject(value)) {
1841 return _.mapObject(value, function (v, k) {
1842 return AV._encode(v, seenObjects, disallowObjects, full);
1843 });
1844 }
1845 return value;
1846};
1847
1848/**
1849 * The inverse function of AV._encode.
1850 * @private
1851 */
1852AV._decode = function (value, key) {
1853 if (!_.isObject(value) || _.isDate(value)) {
1854 return value;
1855 }
1856 if (_.isArray(value)) {
1857 return _.map(value, function (v) {
1858 return AV._decode(v);
1859 });
1860 }
1861 if (value instanceof AV.Object) {
1862 return value;
1863 }
1864 if (value instanceof AV.File) {
1865 return value;
1866 }
1867 if (value instanceof AV.Op) {
1868 return value;
1869 }
1870 if (value instanceof AV.GeoPoint) {
1871 return value;
1872 }
1873 if (value instanceof AV.ACL) {
1874 return value;
1875 }
1876 if (key === 'ACL') {
1877 return new AV.ACL(value);
1878 }
1879 if (value.__op) {
1880 return AV.Op._decode(value);
1881 }
1882 var className;
1883 if (value.__type === 'Pointer') {
1884 className = value.className;
1885 var pointer = AV.Object._create(className);
1886 if ((0, _keys2.default)(value).length > 3) {
1887 var v = _.clone(value);
1888 delete v.__type;
1889 delete v.className;
1890 pointer._finishFetch(v, true);
1891 } else {
1892 pointer._finishFetch({ objectId: value.objectId }, false);
1893 }
1894 return pointer;
1895 }
1896 if (value.__type === 'Object') {
1897 // It's an Object included in a query result.
1898 className = value.className;
1899 var _v = _.clone(value);
1900 delete _v.__type;
1901 delete _v.className;
1902 var object = AV.Object._create(className);
1903 object._finishFetch(_v, true);
1904 return object;
1905 }
1906 if (value.__type === 'Date') {
1907 return AV._parseDate(value.iso);
1908 }
1909 if (value.__type === 'GeoPoint') {
1910 return new AV.GeoPoint({
1911 latitude: value.latitude,
1912 longitude: value.longitude
1913 });
1914 }
1915 if (value.__type === 'Relation') {
1916 if (!key) throw new Error('key missing decoding a Relation');
1917 var relation = new AV.Relation(null, key);
1918 relation.targetClassName = value.className;
1919 return relation;
1920 }
1921 if (value.__type === 'File') {
1922 var file = new AV.File(value.name);
1923 var _v2 = _.clone(value);
1924 delete _v2.__type;
1925 file._finishFetch(_v2);
1926 return file;
1927 }
1928 return _.mapObject(value, AV._decode);
1929};
1930
1931/**
1932 * The inverse function of {@link AV.Object#toFullJSON}.
1933 * @since 3.0.0
1934 * @method
1935 * @param {Object}
1936 * return {AV.Object|AV.File|any}
1937 */
1938AV.parseJSON = AV._decode;
1939
1940/**
1941 * Similar to JSON.parse, except that AV internal types will be used if possible.
1942 * Inverse to {@link AV.stringify}
1943 * @since 3.14.0
1944 * @param {string} text the string to parse.
1945 * @return {AV.Object|AV.File|any}
1946 */
1947AV.parse = function (text) {
1948 return AV.parseJSON(JSON.parse(text));
1949};
1950/**
1951 * Serialize a target containing AV.Object, similar to JSON.stringify.
1952 * Inverse to {@link AV.parse}
1953 * @since 3.14.0
1954 * @return {string}
1955 */
1956AV.stringify = function (target) {
1957 return (0, _stringify2.default)(AV._encode(target, [], false, true));
1958};
1959
1960AV._encodeObjectOrArray = function (value) {
1961 var encodeAVObject = function encodeAVObject(object) {
1962 if (object && object._toFullJSON) {
1963 object = object._toFullJSON([]);
1964 }
1965
1966 return _.mapObject(object, function (value) {
1967 return AV._encode(value, []);
1968 });
1969 };
1970
1971 if (_.isArray(value)) {
1972 return value.map(function (object) {
1973 return encodeAVObject(object);
1974 });
1975 } else {
1976 return encodeAVObject(value);
1977 }
1978};
1979
1980AV._arrayEach = _.each;
1981
1982/**
1983 * Does a deep traversal of every item in object, calling func on every one.
1984 * @param {Object} object The object or array to traverse deeply.
1985 * @param {Function} func The function to call for every item. It will
1986 * be passed the item as an argument. If it returns a truthy value, that
1987 * value will replace the item in its parent container.
1988 * @returns {} the result of calling func on the top-level object itself.
1989 * @private
1990 */
1991AV._traverse = function (object, func, seen) {
1992 if (object instanceof AV.Object) {
1993 seen = seen || [];
1994 if (_.indexOf(seen, object) >= 0) {
1995 // We've already visited this object in this call.
1996 return;
1997 }
1998 seen.push(object);
1999 AV._traverse(object.attributes, func, seen);
2000 return func(object);
2001 }
2002 if (object instanceof AV.Relation || object instanceof AV.File) {
2003 // Nothing needs to be done, but we don't want to recurse into the
2004 // object's parent infinitely, so we catch this case.
2005 return func(object);
2006 }
2007 if (_.isArray(object)) {
2008 _.each(object, function (child, index) {
2009 var newChild = AV._traverse(child, func, seen);
2010 if (newChild) {
2011 object[index] = newChild;
2012 }
2013 });
2014 return func(object);
2015 }
2016 if (_.isObject(object)) {
2017 AV._each(object, function (child, key) {
2018 var newChild = AV._traverse(child, func, seen);
2019 if (newChild) {
2020 object[key] = newChild;
2021 }
2022 });
2023 return func(object);
2024 }
2025 return func(object);
2026};
2027
2028/**
2029 * This is like _.each, except:
2030 * * it doesn't work for so-called array-like objects,
2031 * * it does work for dictionaries with a "length" attribute.
2032 * @private
2033 */
2034AV._objectEach = AV._each = function (obj, callback) {
2035 if (_.isObject(obj)) {
2036 _.each(_.keys(obj), function (key) {
2037 callback(obj[key], key);
2038 });
2039 } else {
2040 _.each(obj, callback);
2041 }
2042};
2043
2044/**
2045 * @namespace
2046 * @since 3.14.0
2047 */
2048AV.debug = {
2049 /**
2050 * Enable debug
2051 */
2052 enable: function enable() {
2053 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
2054 return debug.enable(namespaces);
2055 },
2056 /**
2057 * Disable debug
2058 */
2059 disable: debug.disable
2060};
2061
2062/**
2063 * Specify Adapters
2064 * @since 4.4.0
2065 * @function
2066 * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
2067 */
2068AV.setAdapters = setAdapters;
2069
2070module.exports = AV;
2071/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(104)))
2072
2073/***/ }),
2074/* 35 */
2075/***/ (function(module, exports, __webpack_require__) {
2076
2077"use strict";
2078
2079
2080function _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); }
2081
2082/* eslint-env browser */
2083
2084/**
2085 * This is the web browser implementation of `debug()`.
2086 */
2087exports.log = log;
2088exports.formatArgs = formatArgs;
2089exports.save = save;
2090exports.load = load;
2091exports.useColors = useColors;
2092exports.storage = localstorage();
2093/**
2094 * Colors.
2095 */
2096
2097exports.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'];
2098/**
2099 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2100 * and the Firebug extension (any Firefox version) are known
2101 * to support "%c" CSS customizations.
2102 *
2103 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2104 */
2105// eslint-disable-next-line complexity
2106
2107function useColors() {
2108 // NB: In an Electron preload script, document will be defined but not fully
2109 // initialized. Since we know we're in Chrome, we'll just detect this case
2110 // explicitly
2111 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2112 return true;
2113 } // Internet Explorer and Edge do not support colors.
2114
2115
2116 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2117 return false;
2118 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2119 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2120
2121
2122 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2123 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2124 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2125 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
2126 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2127}
2128/**
2129 * Colorize log arguments if enabled.
2130 *
2131 * @api public
2132 */
2133
2134
2135function formatArgs(args) {
2136 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2137
2138 if (!this.useColors) {
2139 return;
2140 }
2141
2142 var c = 'color: ' + this.color;
2143 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2144 // arguments passed either before or after the %c, so we need to
2145 // figure out the correct index to insert the CSS into
2146
2147 var index = 0;
2148 var lastC = 0;
2149 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2150 if (match === '%%') {
2151 return;
2152 }
2153
2154 index++;
2155
2156 if (match === '%c') {
2157 // We only are interested in the *last* %c
2158 // (the user may have provided their own)
2159 lastC = index;
2160 }
2161 });
2162 args.splice(lastC, 0, c);
2163}
2164/**
2165 * Invokes `console.log()` when available.
2166 * No-op when `console.log` is not a "function".
2167 *
2168 * @api public
2169 */
2170
2171
2172function log() {
2173 var _console;
2174
2175 // This hackery is required for IE8/9, where
2176 // the `console.log` function doesn't have 'apply'
2177 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2178}
2179/**
2180 * Save `namespaces`.
2181 *
2182 * @param {String} namespaces
2183 * @api private
2184 */
2185
2186
2187function save(namespaces) {
2188 try {
2189 if (namespaces) {
2190 exports.storage.setItem('debug', namespaces);
2191 } else {
2192 exports.storage.removeItem('debug');
2193 }
2194 } catch (error) {// Swallow
2195 // XXX (@Qix-) should we be logging these?
2196 }
2197}
2198/**
2199 * Load `namespaces`.
2200 *
2201 * @return {String} returns the previously persisted debug modes
2202 * @api private
2203 */
2204
2205
2206function load() {
2207 var r;
2208
2209 try {
2210 r = exports.storage.getItem('debug');
2211 } catch (error) {} // Swallow
2212 // XXX (@Qix-) should we be logging these?
2213 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2214
2215
2216 if (!r && typeof process !== 'undefined' && 'env' in process) {
2217 r = process.env.DEBUG;
2218 }
2219
2220 return r;
2221}
2222/**
2223 * Localstorage attempts to return the localstorage.
2224 *
2225 * This is necessary because safari throws
2226 * when a user disables cookies/localstorage
2227 * and you attempt to access it.
2228 *
2229 * @return {LocalStorage}
2230 * @api private
2231 */
2232
2233
2234function localstorage() {
2235 try {
2236 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2237 // The Browser also has localStorage in the global context.
2238 return localStorage;
2239 } catch (error) {// Swallow
2240 // XXX (@Qix-) should we be logging these?
2241 }
2242}
2243
2244module.exports = __webpack_require__(266)(exports);
2245var formatters = module.exports.formatters;
2246/**
2247 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2248 */
2249
2250formatters.j = function (v) {
2251 try {
2252 return JSON.stringify(v);
2253 } catch (error) {
2254 return '[UnexpectedJSONParseError]: ' + error.message;
2255 }
2256};
2257
2258
2259
2260/***/ }),
2261/* 36 */
2262/***/ (function(module, exports, __webpack_require__) {
2263
2264"use strict";
2265
2266
2267var _ = __webpack_require__(0);
2268var EventEmitter = __webpack_require__(157);
2269
2270var _require = __webpack_require__(15),
2271 inherits = _require.inherits;
2272
2273var AdapterManager = inherits(EventEmitter, {
2274 constructor: function constructor() {
2275 EventEmitter.apply(this);
2276 this._adapters = {};
2277 },
2278 getAdapter: function getAdapter(name) {
2279 var adapter = this._adapters[name];
2280 if (adapter === undefined) {
2281 throw new Error(name + ' adapter is not configured');
2282 }
2283 return adapter;
2284 },
2285 setAdapters: function setAdapters(newAdapters) {
2286 var _this = this;
2287
2288 _.extend(this._adapters, newAdapters);
2289 _.keys(newAdapters).forEach(function (name) {
2290 return _this.emit(name, newAdapters[name]);
2291 });
2292 }
2293});
2294
2295var adapterManager = new AdapterManager();
2296
2297module.exports = {
2298 getAdapter: adapterManager.getAdapter.bind(adapterManager),
2299 setAdapters: adapterManager.setAdapters.bind(adapterManager),
2300 adapterManager: adapterManager
2301};
2302
2303/***/ }),
2304/* 37 */
2305/***/ (function(module, exports) {
2306
2307module.exports = true;
2308
2309
2310/***/ }),
2311/* 38 */
2312/***/ (function(module, exports, __webpack_require__) {
2313
2314// optional / simple context binding
2315var aFunction = __webpack_require__(48);
2316module.exports = function (fn, that, length) {
2317 aFunction(fn);
2318 if (that === undefined) return fn;
2319 switch (length) {
2320 case 1: return function (a) {
2321 return fn.call(that, a);
2322 };
2323 case 2: return function (a, b) {
2324 return fn.call(that, a, b);
2325 };
2326 case 3: return function (a, b, c) {
2327 return fn.call(that, a, b, c);
2328 };
2329 }
2330 return function (/* ...args */) {
2331 return fn.apply(that, arguments);
2332 };
2333};
2334
2335
2336/***/ }),
2337/* 39 */
2338/***/ (function(module, exports) {
2339
2340module.exports = function (exec) {
2341 try {
2342 return !!exec();
2343 } catch (e) {
2344 return true;
2345 }
2346};
2347
2348
2349/***/ }),
2350/* 40 */
2351/***/ (function(module, exports) {
2352
2353var toString = {}.toString;
2354
2355module.exports = function (it) {
2356 return toString.call(it).slice(8, -1);
2357};
2358
2359
2360/***/ }),
2361/* 41 */
2362/***/ (function(module, __webpack_exports__, __webpack_require__) {
2363
2364"use strict";
2365/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
2366/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
2367/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
2368/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(195);
2369
2370
2371
2372// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
2373// In IE 11, the most common among them, this problem also applies to
2374// `Map`, `WeakMap` and `Set`.
2375var hasStringTagBug = (
2376 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
2377 ),
2378 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
2379
2380
2381/***/ }),
2382/* 42 */
2383/***/ (function(module, __webpack_exports__, __webpack_require__) {
2384
2385"use strict";
2386/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
2387/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(27);
2388/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
2389/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(115);
2390
2391
2392
2393
2394// Retrieve all the enumerable property names of an object.
2395function allKeys(obj) {
2396 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
2397 var keys = [];
2398 for (var key in obj) keys.push(key);
2399 // Ahem, IE < 9.
2400 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
2401 return keys;
2402}
2403
2404
2405/***/ }),
2406/* 43 */
2407/***/ (function(module, __webpack_exports__, __webpack_require__) {
2408
2409"use strict";
2410/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
2411/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
2412/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(124);
2413
2414
2415
2416// Internal wrapper for `_.toPath` to enable minification.
2417// Similar to `cb` for `_.iteratee`.
2418function toPath(path) {
2419 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
2420}
2421
2422
2423/***/ }),
2424/* 44 */
2425/***/ (function(module, __webpack_exports__, __webpack_require__) {
2426
2427"use strict";
2428/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
2429// Internal function that returns an efficient (for current engines) version
2430// of the passed-in callback, to be repeatedly applied in other Underscore
2431// functions.
2432function optimizeCb(func, context, argCount) {
2433 if (context === void 0) return func;
2434 switch (argCount == null ? 3 : argCount) {
2435 case 1: return function(value) {
2436 return func.call(context, value);
2437 };
2438 // The 2-argument case is omitted because we’re not using it.
2439 case 3: return function(value, index, collection) {
2440 return func.call(context, value, index, collection);
2441 };
2442 case 4: return function(accumulator, value, index, collection) {
2443 return func.call(context, accumulator, value, index, collection);
2444 };
2445 }
2446 return function() {
2447 return func.apply(context, arguments);
2448 };
2449}
2450
2451
2452/***/ }),
2453/* 45 */
2454/***/ (function(module, __webpack_exports__, __webpack_require__) {
2455
2456"use strict";
2457/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
2458/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
2459/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(29);
2460
2461
2462
2463// Return all the elements that pass a truth test.
2464function filter(obj, predicate, context) {
2465 var results = [];
2466 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
2467 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
2468 if (predicate(value, index, list)) results.push(value);
2469 });
2470 return results;
2471}
2472
2473
2474/***/ }),
2475/* 46 */
2476/***/ (function(module, __webpack_exports__, __webpack_require__) {
2477
2478"use strict";
2479/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
2480/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
2481/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(31);
2482/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(140);
2483
2484
2485
2486
2487// Determine if the array or object contains a given item (using `===`).
2488function contains(obj, item, fromIndex, guard) {
2489 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
2490 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
2491 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
2492}
2493
2494
2495/***/ }),
2496/* 47 */
2497/***/ (function(module, exports, __webpack_require__) {
2498
2499"use strict";
2500
2501var $at = __webpack_require__(167)(true);
2502
2503// 21.1.3.27 String.prototype[@@iterator]()
2504__webpack_require__(92)(String, 'String', function (iterated) {
2505 this._t = String(iterated); // target
2506 this._i = 0; // next index
2507// 21.1.5.2.1 %StringIteratorPrototype%.next()
2508}, function () {
2509 var O = this._t;
2510 var index = this._i;
2511 var point;
2512 if (index >= O.length) return { value: undefined, done: true };
2513 point = $at(O, index);
2514 this._i += point.length;
2515 return { value: point, done: false };
2516});
2517
2518
2519/***/ }),
2520/* 48 */
2521/***/ (function(module, exports) {
2522
2523module.exports = function (it) {
2524 if (typeof it != 'function') throw TypeError(it + ' is not a function!');
2525 return it;
2526};
2527
2528
2529/***/ }),
2530/* 49 */
2531/***/ (function(module, exports) {
2532
2533module.exports = function (bitmap, value) {
2534 return {
2535 enumerable: !(bitmap & 1),
2536 configurable: !(bitmap & 2),
2537 writable: !(bitmap & 4),
2538 value: value
2539 };
2540};
2541
2542
2543/***/ }),
2544/* 50 */
2545/***/ (function(module, exports, __webpack_require__) {
2546
2547// 19.1.2.14 / 15.2.3.14 Object.keys(O)
2548var $keys = __webpack_require__(95);
2549var enumBugKeys = __webpack_require__(67);
2550
2551module.exports = Object.keys || function keys(O) {
2552 return $keys(O, enumBugKeys);
2553};
2554
2555
2556/***/ }),
2557/* 51 */
2558/***/ (function(module, exports) {
2559
2560var id = 0;
2561var px = Math.random();
2562module.exports = function (key) {
2563 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
2564};
2565
2566
2567/***/ }),
2568/* 52 */
2569/***/ (function(module, exports, __webpack_require__) {
2570
2571var def = __webpack_require__(19).f;
2572var has = __webpack_require__(25);
2573var TAG = __webpack_require__(7)('toStringTag');
2574
2575module.exports = function (it, tag, stat) {
2576 if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
2577};
2578
2579
2580/***/ }),
2581/* 53 */
2582/***/ (function(module, exports, __webpack_require__) {
2583
2584// 7.1.13 ToObject(argument)
2585var defined = __webpack_require__(61);
2586module.exports = function (it) {
2587 return Object(defined(it));
2588};
2589
2590
2591/***/ }),
2592/* 54 */
2593/***/ (function(module, exports, __webpack_require__) {
2594
2595__webpack_require__(173);
2596var global = __webpack_require__(6);
2597var hide = __webpack_require__(24);
2598var Iterators = __webpack_require__(30);
2599var TO_STRING_TAG = __webpack_require__(7)('toStringTag');
2600
2601var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
2602 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
2603 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
2604 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
2605 'TextTrackList,TouchList').split(',');
2606
2607for (var i = 0; i < DOMIterables.length; i++) {
2608 var NAME = DOMIterables[i];
2609 var Collection = global[NAME];
2610 var proto = Collection && Collection.prototype;
2611 if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
2612 Iterators[NAME] = Iterators.Array;
2613}
2614
2615
2616/***/ }),
2617/* 55 */
2618/***/ (function(module, __webpack_exports__, __webpack_require__) {
2619
2620"use strict";
2621/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
2622/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(77);
2623/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(116);
2624
2625
2626
2627// Returns a predicate for checking whether an object has a given set of
2628// `key:value` pairs.
2629function matcher(attrs) {
2630 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
2631 return function(obj) {
2632 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
2633 };
2634}
2635
2636
2637/***/ }),
2638/* 56 */
2639/***/ (function(module, __webpack_exports__, __webpack_require__) {
2640
2641"use strict";
2642/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
2643/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(132);
2644/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(10);
2645
2646
2647
2648
2649// Partially apply a function by creating a version that has had some of its
2650// arguments pre-filled, without changing its dynamic `this` context. `_` acts
2651// as a placeholder by default, allowing any combination of arguments to be
2652// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
2653var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
2654 var placeholder = partial.placeholder;
2655 var bound = function() {
2656 var position = 0, length = boundArgs.length;
2657 var args = Array(length);
2658 for (var i = 0; i < length; i++) {
2659 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
2660 }
2661 while (position < arguments.length) args.push(arguments[position++]);
2662 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
2663 };
2664 return bound;
2665});
2666
2667partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
2668/* harmony default export */ __webpack_exports__["a"] = (partial);
2669
2670
2671/***/ }),
2672/* 57 */
2673/***/ (function(module, __webpack_exports__, __webpack_require__) {
2674
2675"use strict";
2676/* harmony export (immutable) */ __webpack_exports__["a"] = group;
2677/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
2678/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(29);
2679
2680
2681
2682// An internal function used for aggregate "group by" operations.
2683function group(behavior, partition) {
2684 return function(obj, iteratee, context) {
2685 var result = partition ? [[], []] : {};
2686 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
2687 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
2688 var key = iteratee(value, index, obj);
2689 behavior(result, value, key);
2690 });
2691 return result;
2692 };
2693}
2694
2695
2696/***/ }),
2697/* 58 */
2698/***/ (function(module, exports, __webpack_require__) {
2699
2700"use strict";
2701
2702
2703var _stringify = __webpack_require__(18);
2704
2705var _stringify2 = _interopRequireDefault(_stringify);
2706
2707var _typeof2 = __webpack_require__(59);
2708
2709var _typeof3 = _interopRequireDefault(_typeof2);
2710
2711var _keys = __webpack_require__(153);
2712
2713var _keys2 = _interopRequireDefault(_keys);
2714
2715function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2716
2717var _ = __webpack_require__(0);
2718
2719var _require = __webpack_require__(285),
2720 timeout = _require.timeout;
2721
2722var debug = __webpack_require__(35);
2723var debugRequest = debug('leancloud:request');
2724var debugRequestError = debug('leancloud:request:error');
2725
2726var _require2 = __webpack_require__(36),
2727 getAdapter = _require2.getAdapter;
2728
2729var requestsCount = 0;
2730
2731var ajax = function ajax(_ref) {
2732 var method = _ref.method,
2733 url = _ref.url,
2734 query = _ref.query,
2735 data = _ref.data,
2736 _ref$headers = _ref.headers,
2737 headers = _ref$headers === undefined ? {} : _ref$headers,
2738 time = _ref.timeout,
2739 onprogress = _ref.onprogress;
2740
2741 if (query) {
2742 var queryString = (0, _keys2.default)(query).map(function (key) {
2743 var value = query[key];
2744 if (value === undefined) return undefined;
2745 var v = (typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) === 'object' ? (0, _stringify2.default)(value) : value;
2746 return encodeURIComponent(key) + '=' + encodeURIComponent(v);
2747 }).filter(function (qs) {
2748 return qs;
2749 }).join('&');
2750 url = url + '?' + queryString;
2751 }
2752
2753 var count = requestsCount++;
2754 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
2755
2756 var request = getAdapter('request');
2757 var promise = request(url, { method: method, headers: headers, data: data, onprogress: onprogress }).then(function (response) {
2758 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
2759 if (response.ok === false) {
2760 var error = new Error();
2761 error.response = response;
2762 throw error;
2763 }
2764 return response.data;
2765 }).catch(function (error) {
2766 if (error.response) {
2767 if (!debug.enabled('leancloud:request')) {
2768 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
2769 }
2770 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
2771 error.statusCode = error.response.status;
2772 error.responseText = error.response.text;
2773 error.response = error.response.data;
2774 }
2775 throw error;
2776 });
2777 return time ? timeout(promise, time) : promise;
2778};
2779
2780module.exports = ajax;
2781
2782/***/ }),
2783/* 59 */
2784/***/ (function(module, exports, __webpack_require__) {
2785
2786"use strict";
2787
2788
2789exports.__esModule = true;
2790
2791var _iterator = __webpack_require__(274);
2792
2793var _iterator2 = _interopRequireDefault(_iterator);
2794
2795var _symbol = __webpack_require__(276);
2796
2797var _symbol2 = _interopRequireDefault(_symbol);
2798
2799var _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; };
2800
2801function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2802
2803exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
2804 return typeof obj === "undefined" ? "undefined" : _typeof(obj);
2805} : function (obj) {
2806 return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
2807};
2808
2809/***/ }),
2810/* 60 */
2811/***/ (function(module, exports) {
2812
2813// 7.1.4 ToInteger
2814var ceil = Math.ceil;
2815var floor = Math.floor;
2816module.exports = function (it) {
2817 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
2818};
2819
2820
2821/***/ }),
2822/* 61 */
2823/***/ (function(module, exports) {
2824
2825// 7.2.1 RequireObjectCoercible(argument)
2826module.exports = function (it) {
2827 if (it == undefined) throw TypeError("Can't call method on " + it);
2828 return it;
2829};
2830
2831
2832/***/ }),
2833/* 62 */
2834/***/ (function(module, exports, __webpack_require__) {
2835
2836var isObject = __webpack_require__(20);
2837var document = __webpack_require__(6).document;
2838// typeof document.createElement is 'object' in old IE
2839var is = isObject(document) && isObject(document.createElement);
2840module.exports = function (it) {
2841 return is ? document.createElement(it) : {};
2842};
2843
2844
2845/***/ }),
2846/* 63 */
2847/***/ (function(module, exports, __webpack_require__) {
2848
2849// 7.1.1 ToPrimitive(input [, PreferredType])
2850var isObject = __webpack_require__(20);
2851// instead of the ES6 spec version, we didn't implement @@toPrimitive case
2852// and the second argument - flag - preferred type is a string
2853module.exports = function (it, S) {
2854 if (!isObject(it)) return it;
2855 var fn, val;
2856 if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
2857 if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
2858 if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
2859 throw TypeError("Can't convert object to primitive value");
2860};
2861
2862
2863/***/ }),
2864/* 64 */
2865/***/ (function(module, exports, __webpack_require__) {
2866
2867// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
2868var anObject = __webpack_require__(16);
2869var dPs = __webpack_require__(169);
2870var enumBugKeys = __webpack_require__(67);
2871var IE_PROTO = __webpack_require__(65)('IE_PROTO');
2872var Empty = function () { /* empty */ };
2873var PROTOTYPE = 'prototype';
2874
2875// Create object with fake `null` prototype: use iframe Object with cleared prototype
2876var createDict = function () {
2877 // Thrash, waste and sodomy: IE GC bug
2878 var iframe = __webpack_require__(62)('iframe');
2879 var i = enumBugKeys.length;
2880 var lt = '<';
2881 var gt = '>';
2882 var iframeDocument;
2883 iframe.style.display = 'none';
2884 __webpack_require__(97).appendChild(iframe);
2885 iframe.src = 'javascript:'; // eslint-disable-line no-script-url
2886 // createDict = iframe.contentWindow.Object;
2887 // html.removeChild(iframe);
2888 iframeDocument = iframe.contentWindow.document;
2889 iframeDocument.open();
2890 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
2891 iframeDocument.close();
2892 createDict = iframeDocument.F;
2893 while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
2894 return createDict();
2895};
2896
2897module.exports = Object.create || function create(O, Properties) {
2898 var result;
2899 if (O !== null) {
2900 Empty[PROTOTYPE] = anObject(O);
2901 result = new Empty();
2902 Empty[PROTOTYPE] = null;
2903 // add "__proto__" for Object.getPrototypeOf polyfill
2904 result[IE_PROTO] = O;
2905 } else result = createDict();
2906 return Properties === undefined ? result : dPs(result, Properties);
2907};
2908
2909
2910/***/ }),
2911/* 65 */
2912/***/ (function(module, exports, __webpack_require__) {
2913
2914var shared = __webpack_require__(66)('keys');
2915var uid = __webpack_require__(51);
2916module.exports = function (key) {
2917 return shared[key] || (shared[key] = uid(key));
2918};
2919
2920
2921/***/ }),
2922/* 66 */
2923/***/ (function(module, exports, __webpack_require__) {
2924
2925var core = __webpack_require__(2);
2926var global = __webpack_require__(6);
2927var SHARED = '__core-js_shared__';
2928var store = global[SHARED] || (global[SHARED] = {});
2929
2930(module.exports = function (key, value) {
2931 return store[key] || (store[key] = value !== undefined ? value : {});
2932})('versions', []).push({
2933 version: core.version,
2934 mode: __webpack_require__(37) ? 'pure' : 'global',
2935 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
2936});
2937
2938
2939/***/ }),
2940/* 67 */
2941/***/ (function(module, exports) {
2942
2943// IE 8- don't enum bug keys
2944module.exports = (
2945 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
2946).split(',');
2947
2948
2949/***/ }),
2950/* 68 */
2951/***/ (function(module, exports, __webpack_require__) {
2952
2953// getting tag from 19.1.3.6 Object.prototype.toString()
2954var cof = __webpack_require__(40);
2955var TAG = __webpack_require__(7)('toStringTag');
2956// ES3 wrong here
2957var ARG = cof(function () { return arguments; }()) == 'Arguments';
2958
2959// fallback for IE11 Script Access Denied error
2960var tryGet = function (it, key) {
2961 try {
2962 return it[key];
2963 } catch (e) { /* empty */ }
2964};
2965
2966module.exports = function (it) {
2967 var O, T, B;
2968 return it === undefined ? 'Undefined' : it === null ? 'Null'
2969 // @@toStringTag case
2970 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
2971 // builtinTag case
2972 : ARG ? cof(O)
2973 // ES3 arguments fallback
2974 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
2975};
2976
2977
2978/***/ }),
2979/* 69 */
2980/***/ (function(module, exports, __webpack_require__) {
2981
2982"use strict";
2983
2984// 25.4.1.5 NewPromiseCapability(C)
2985var aFunction = __webpack_require__(48);
2986
2987function PromiseCapability(C) {
2988 var resolve, reject;
2989 this.promise = new C(function ($$resolve, $$reject) {
2990 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2991 resolve = $$resolve;
2992 reject = $$reject;
2993 });
2994 this.resolve = aFunction(resolve);
2995 this.reject = aFunction(reject);
2996}
2997
2998module.exports.f = function (C) {
2999 return new PromiseCapability(C);
3000};
3001
3002
3003/***/ }),
3004/* 70 */
3005/***/ (function(module, __webpack_exports__, __webpack_require__) {
3006
3007"use strict";
3008Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
3009/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
3010/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
3011/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(9);
3012/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
3013/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(27);
3014/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
3015/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(190);
3016/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
3017/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(105);
3018/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
3019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(106);
3020/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
3021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(191);
3022/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
3023/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(71);
3024/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
3025/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(107);
3026/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
3027/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(192);
3028/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
3029/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(193);
3030/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
3031/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(194);
3032/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
3033/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(108);
3034/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
3035/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(109);
3036/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
3037/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(72);
3038/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
3039/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(28);
3040/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
3041/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(13);
3042/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
3043/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(73);
3044/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
3045/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(196);
3046/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
3047/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(110);
3048/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
3049/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(111);
3050/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
3051/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(198);
3052/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
3053/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(116);
3054/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
3055/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(199);
3056/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
3057/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(201);
3058/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
3059/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(202);
3060/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
3061/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(203);
3062/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
3063/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(204);
3064/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
3065/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(3);
3066/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
3067/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(42);
3068/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
3069/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(31);
3070/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
3071/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(205);
3072/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
3073/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(117);
3074/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
3075/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(118);
3076/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
3077/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
3078/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(119);
3079/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
3080/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(77);
3081/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
3082/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
3083/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(120);
3084/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
3085/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(206);
3086/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
3087/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(122);
3088/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
3089/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(207);
3090/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
3091/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(123);
3092/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
3093/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(208);
3094/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
3095/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(209);
3096/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
3097/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(79);
3098/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
3099/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(112);
3100/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
3101/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(127);
3102/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
3103/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(124);
3104/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
3105/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(80);
3106/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
3107/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(210);
3108/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
3109/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(55);
3110/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
3111/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
3112/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(211);
3113/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
3114/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(128);
3115/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
3116/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(81);
3117/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
3118/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(212);
3119/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
3120/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(213);
3121/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
3122/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(131);
3123/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
3124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(215);
3125/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
3126/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(216);
3127/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
3128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(217);
3129/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
3130/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(218);
3131/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
3132/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(126);
3133/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
3134/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(56);
3135/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
3136/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(133);
3137/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
3138/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(219);
3139/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
3140/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(220);
3141/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
3142/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(134);
3143/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
3144/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(221);
3145/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
3146/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(222);
3147/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
3148/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(223);
3149/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
3150/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(224);
3151/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
3152/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(82);
3153/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
3154/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(225);
3155/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
3156/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(226);
3157/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
3158/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(135);
3159/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
3160/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(227);
3161/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
3162/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(136);
3163/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
3164/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(83);
3165/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
3166/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(138);
3167/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
3168/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(139);
3169/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
3170/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(140);
3171/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
3172/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(228);
3173/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
3174/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(142);
3175/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
3176/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
3177/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(229);
3178/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
3179/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(29);
3180/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
3181/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
3182/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(33);
3183/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
3184/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
3185/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(230);
3186/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3187/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3188/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3189/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(231);
3190/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
3191/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
3192/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(45);
3193/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
3194/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
3195/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(232);
3196/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
3197/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(233);
3198/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
3199/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
3200/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(234);
3201/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
3202/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
3203/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(46);
3204/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3205/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3206/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3207/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(235);
3208/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
3209/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(84);
3210/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
3211/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(236);
3212/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
3213/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(144);
3214/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
3215/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(237);
3216/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
3217/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(238);
3218/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
3219/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(145);
3220/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
3221/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(239);
3222/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
3223/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(240);
3224/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
3225/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(241);
3226/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
3227/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(242);
3228/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
3229/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(243);
3230/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
3231/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(244);
3232/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
3233/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(245);
3234/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
3235/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(146);
3236/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
3237/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(247);
3238/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
3239/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(248);
3240/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3241/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3242/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3243/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(147);
3244/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
3245/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(249);
3246/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
3247/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(148);
3248/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3249/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3250/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3251/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(250);
3252/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
3253/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(251);
3254/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
3255/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(252);
3256/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
3257/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(150);
3258/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
3259/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
3260/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(253);
3261/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
3262/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(254);
3263/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
3264/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(149);
3265/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
3266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(151);
3267/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
3268/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
3269/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(255);
3270/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
3271/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(256);
3272/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
3273/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(257);
3274/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
3275/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(258);
3276/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
3277/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(259);
3278/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
3279/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(260);
3280/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
3281// Named Exports
3282// =============
3283
3284// Underscore.js 1.12.1
3285// https://underscorejs.org
3286// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3287// Underscore may be freely distributed under the MIT license.
3288
3289// Baseline setup.
3290
3291
3292
3293// Object Functions
3294// ----------------
3295// Our most fundamental functions operate on any JavaScript object.
3296// Most functions in Underscore depend on at least one function in this section.
3297
3298// A group of functions that check the types of core JavaScript values.
3299// These are often informally referred to as the "isType" functions.
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327// Functions that treat an object as a dictionary of key-value pairs.
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344// Utility Functions
3345// -----------------
3346// A bit of a grab bag: Predicate-generating functions for use with filters and
3347// loops, string escaping and templating, create random numbers and unique ids,
3348// and functions that facilitate Underscore's chaining and iteration conventions.
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368// Function (ahem) Functions
3369// -------------------------
3370// These functions take a function as an argument and return a new function
3371// as the result. Also known as higher-order functions.
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387// Finders
3388// -------
3389// Functions that extract (the position of) a single element from an object
3390// or array based on some criterion.
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400// Collection Functions
3401// --------------------
3402// Functions that work on any collection of elements: either an array, or
3403// an object of key-value pairs.
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428// `_.pick` and `_.omit` are actually object functions, but we put
3429// them here in order to create a more natural reading order in the
3430// monolithic build as they depend on `_.contains`.
3431
3432
3433
3434// Array Functions
3435// ---------------
3436// Functions that operate on arrays (and array-likes) only, because they’re
3437// expressed in terms of operations on an ordered list of values.
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455// OOP
3456// ---
3457// These modules support the "object-oriented" calling style. See also
3458// `underscore.js` and `index-default.js`.
3459
3460
3461
3462
3463/***/ }),
3464/* 71 */
3465/***/ (function(module, __webpack_exports__, __webpack_require__) {
3466
3467"use strict";
3468/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
3469
3470
3471/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
3472
3473
3474/***/ }),
3475/* 72 */
3476/***/ (function(module, __webpack_exports__, __webpack_require__) {
3477
3478"use strict";
3479/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
3480/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
3481/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(109);
3482/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(41);
3483
3484
3485
3486
3487
3488var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
3489
3490// In IE 10 - Edge 13, we need a different heuristic
3491// to determine whether an object is a `DataView`.
3492function ie10IsDataView(obj) {
3493 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);
3494}
3495
3496/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
3497
3498
3499/***/ }),
3500/* 73 */
3501/***/ (function(module, __webpack_exports__, __webpack_require__) {
3502
3503"use strict";
3504/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
3505/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(22);
3506
3507
3508
3509var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
3510
3511// Define a fallback version of the method in browsers (ahem, IE < 9), where
3512// there isn't any inspectable "Arguments" type.
3513(function() {
3514 if (!isArguments(arguments)) {
3515 isArguments = function(obj) {
3516 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
3517 };
3518 }
3519}());
3520
3521/* harmony default export */ __webpack_exports__["a"] = (isArguments);
3522
3523
3524/***/ }),
3525/* 74 */
3526/***/ (function(module, __webpack_exports__, __webpack_require__) {
3527
3528"use strict";
3529/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(114);
3530
3531
3532// Internal helper to obtain the `byteLength` property of an object.
3533/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
3534
3535
3536/***/ }),
3537/* 75 */
3538/***/ (function(module, __webpack_exports__, __webpack_require__) {
3539
3540"use strict";
3541/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
3542/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
3543/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
3544/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
3545/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
3546/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
3547/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(42);
3548
3549
3550
3551
3552// Since the regular `Object.prototype.toString` type tests don't work for
3553// some types in IE 11, we use a fingerprinting heuristic instead, based
3554// on the methods. It's not great, but it's the best we got.
3555// The fingerprint method lists are defined below.
3556function ie11fingerprint(methods) {
3557 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
3558 return function(obj) {
3559 if (obj == null) return false;
3560 // `Map`, `WeakMap` and `Set` have no enumerable keys.
3561 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
3562 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
3563 for (var i = 0; i < length; i++) {
3564 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
3565 }
3566 // If we are testing against `WeakMap`, we need to ensure that
3567 // `obj` doesn't have a `forEach` method in order to distinguish
3568 // it from a regular `Map`.
3569 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
3570 };
3571}
3572
3573// In the interest of compact minification, we write
3574// each string in the fingerprints only once.
3575var forEachName = 'forEach',
3576 hasName = 'has',
3577 commonInit = ['clear', 'delete'],
3578 mapTail = ['get', hasName, 'set'];
3579
3580// `Map`, `WeakMap` and `Set` each have slightly different
3581// combinations of the above sublists.
3582var mapMethods = commonInit.concat(forEachName, mapTail),
3583 weakMapMethods = commonInit.concat(mapTail),
3584 setMethods = ['add'].concat(commonInit, forEachName, hasName);
3585
3586
3587/***/ }),
3588/* 76 */
3589/***/ (function(module, __webpack_exports__, __webpack_require__) {
3590
3591"use strict";
3592/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
3593// An internal function for creating assigner functions.
3594function createAssigner(keysFunc, defaults) {
3595 return function(obj) {
3596 var length = arguments.length;
3597 if (defaults) obj = Object(obj);
3598 if (length < 2 || obj == null) return obj;
3599 for (var index = 1; index < length; index++) {
3600 var source = arguments[index],
3601 keys = keysFunc(source),
3602 l = keys.length;
3603 for (var i = 0; i < l; i++) {
3604 var key = keys[i];
3605 if (!defaults || obj[key] === void 0) obj[key] = source[key];
3606 }
3607 }
3608 return obj;
3609 };
3610}
3611
3612
3613/***/ }),
3614/* 77 */
3615/***/ (function(module, __webpack_exports__, __webpack_require__) {
3616
3617"use strict";
3618/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(76);
3619/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
3620
3621
3622
3623// Assigns a given object with all the own properties in the passed-in
3624// object(s).
3625// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
3626/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
3627
3628
3629/***/ }),
3630/* 78 */
3631/***/ (function(module, __webpack_exports__, __webpack_require__) {
3632
3633"use strict";
3634/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
3635// Internal function to obtain a nested property in `obj` along `path`.
3636function deepGet(obj, path) {
3637 var length = path.length;
3638 for (var i = 0; i < length; i++) {
3639 if (obj == null) return void 0;
3640 obj = obj[path[i]];
3641 }
3642 return length ? obj : void 0;
3643}
3644
3645
3646/***/ }),
3647/* 79 */
3648/***/ (function(module, __webpack_exports__, __webpack_require__) {
3649
3650"use strict";
3651/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
3652// Keep the identity function around for default iteratees.
3653function identity(value) {
3654 return value;
3655}
3656
3657
3658/***/ }),
3659/* 80 */
3660/***/ (function(module, __webpack_exports__, __webpack_require__) {
3661
3662"use strict";
3663/* harmony export (immutable) */ __webpack_exports__["a"] = property;
3664/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(78);
3665/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(43);
3666
3667
3668
3669// Creates a function that, when passed an object, will traverse that object’s
3670// properties down the given `path`, specified as an array of keys or indices.
3671function property(path) {
3672 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
3673 return function(obj) {
3674 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
3675 };
3676}
3677
3678
3679/***/ }),
3680/* 81 */
3681/***/ (function(module, __webpack_exports__, __webpack_require__) {
3682
3683"use strict";
3684// A (possibly faster) way to get the current timestamp as an integer.
3685/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
3686 return new Date().getTime();
3687});
3688
3689
3690/***/ }),
3691/* 82 */
3692/***/ (function(module, __webpack_exports__, __webpack_require__) {
3693
3694"use strict";
3695/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
3696// Returns a negated version of the passed-in predicate.
3697function negate(predicate) {
3698 return function() {
3699 return !predicate.apply(this, arguments);
3700 };
3701}
3702
3703
3704/***/ }),
3705/* 83 */
3706/***/ (function(module, __webpack_exports__, __webpack_require__) {
3707
3708"use strict";
3709/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(137);
3710
3711
3712// Returns the first index on an array-like that passes a truth test.
3713/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
3714
3715
3716/***/ }),
3717/* 84 */
3718/***/ (function(module, __webpack_exports__, __webpack_require__) {
3719
3720"use strict";
3721/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
3722/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(33);
3723/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(80);
3724
3725
3726
3727// Convenience version of a common use case of `_.map`: fetching a property.
3728function pluck(obj, key) {
3729 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
3730}
3731
3732
3733/***/ }),
3734/* 85 */
3735/***/ (function(module, exports, __webpack_require__) {
3736
3737// most Object methods by ES6 should accept primitives
3738var $export = __webpack_require__(17);
3739var core = __webpack_require__(2);
3740var fails = __webpack_require__(39);
3741module.exports = function (KEY, exec) {
3742 var fn = (core.Object || {})[KEY] || Object[KEY];
3743 var exp = {};
3744 exp[KEY] = exec(fn);
3745 $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
3746};
3747
3748
3749/***/ }),
3750/* 86 */
3751/***/ (function(module, exports, __webpack_require__) {
3752
3753module.exports = { "default": __webpack_require__(271), __esModule: true };
3754
3755/***/ }),
3756/* 87 */
3757/***/ (function(module, exports, __webpack_require__) {
3758
3759exports.f = __webpack_require__(7);
3760
3761
3762/***/ }),
3763/* 88 */
3764/***/ (function(module, exports, __webpack_require__) {
3765
3766var global = __webpack_require__(6);
3767var core = __webpack_require__(2);
3768var LIBRARY = __webpack_require__(37);
3769var wksExt = __webpack_require__(87);
3770var defineProperty = __webpack_require__(19).f;
3771module.exports = function (name) {
3772 var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
3773 if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
3774};
3775
3776
3777/***/ }),
3778/* 89 */
3779/***/ (function(module, exports) {
3780
3781exports.f = {}.propertyIsEnumerable;
3782
3783
3784/***/ }),
3785/* 90 */
3786/***/ (function(module, exports, __webpack_require__) {
3787
3788var pIE = __webpack_require__(89);
3789var createDesc = __webpack_require__(49);
3790var toIObject = __webpack_require__(26);
3791var toPrimitive = __webpack_require__(63);
3792var has = __webpack_require__(25);
3793var IE8_DOM_DEFINE = __webpack_require__(93);
3794var gOPD = Object.getOwnPropertyDescriptor;
3795
3796exports.f = __webpack_require__(21) ? gOPD : function getOwnPropertyDescriptor(O, P) {
3797 O = toIObject(O);
3798 P = toPrimitive(P, true);
3799 if (IE8_DOM_DEFINE) try {
3800 return gOPD(O, P);
3801 } catch (e) { /* empty */ }
3802 if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
3803};
3804
3805
3806/***/ }),
3807/* 91 */
3808/***/ (function(module, exports) {
3809
3810
3811
3812/***/ }),
3813/* 92 */
3814/***/ (function(module, exports, __webpack_require__) {
3815
3816"use strict";
3817
3818var LIBRARY = __webpack_require__(37);
3819var $export = __webpack_require__(17);
3820var redefine = __webpack_require__(94);
3821var hide = __webpack_require__(24);
3822var Iterators = __webpack_require__(30);
3823var $iterCreate = __webpack_require__(168);
3824var setToStringTag = __webpack_require__(52);
3825var getPrototypeOf = __webpack_require__(98);
3826var ITERATOR = __webpack_require__(7)('iterator');
3827var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
3828var FF_ITERATOR = '@@iterator';
3829var KEYS = 'keys';
3830var VALUES = 'values';
3831
3832var returnThis = function () { return this; };
3833
3834module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
3835 $iterCreate(Constructor, NAME, next);
3836 var getMethod = function (kind) {
3837 if (!BUGGY && kind in proto) return proto[kind];
3838 switch (kind) {
3839 case KEYS: return function keys() { return new Constructor(this, kind); };
3840 case VALUES: return function values() { return new Constructor(this, kind); };
3841 } return function entries() { return new Constructor(this, kind); };
3842 };
3843 var TAG = NAME + ' Iterator';
3844 var DEF_VALUES = DEFAULT == VALUES;
3845 var VALUES_BUG = false;
3846 var proto = Base.prototype;
3847 var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
3848 var $default = $native || getMethod(DEFAULT);
3849 var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
3850 var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
3851 var methods, key, IteratorPrototype;
3852 // Fix native
3853 if ($anyNative) {
3854 IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
3855 if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
3856 // Set @@toStringTag to native iterators
3857 setToStringTag(IteratorPrototype, TAG, true);
3858 // fix for some old engines
3859 if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
3860 }
3861 }
3862 // fix Array#{values, @@iterator}.name in V8 / FF
3863 if (DEF_VALUES && $native && $native.name !== VALUES) {
3864 VALUES_BUG = true;
3865 $default = function values() { return $native.call(this); };
3866 }
3867 // Define iterator
3868 if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
3869 hide(proto, ITERATOR, $default);
3870 }
3871 // Plug for library
3872 Iterators[NAME] = $default;
3873 Iterators[TAG] = returnThis;
3874 if (DEFAULT) {
3875 methods = {
3876 values: DEF_VALUES ? $default : getMethod(VALUES),
3877 keys: IS_SET ? $default : getMethod(KEYS),
3878 entries: $entries
3879 };
3880 if (FORCED) for (key in methods) {
3881 if (!(key in proto)) redefine(proto, key, methods[key]);
3882 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
3883 }
3884 return methods;
3885};
3886
3887
3888/***/ }),
3889/* 93 */
3890/***/ (function(module, exports, __webpack_require__) {
3891
3892module.exports = !__webpack_require__(21) && !__webpack_require__(39)(function () {
3893 return Object.defineProperty(__webpack_require__(62)('div'), 'a', { get: function () { return 7; } }).a != 7;
3894});
3895
3896
3897/***/ }),
3898/* 94 */
3899/***/ (function(module, exports, __webpack_require__) {
3900
3901module.exports = __webpack_require__(24);
3902
3903
3904/***/ }),
3905/* 95 */
3906/***/ (function(module, exports, __webpack_require__) {
3907
3908var has = __webpack_require__(25);
3909var toIObject = __webpack_require__(26);
3910var arrayIndexOf = __webpack_require__(171)(false);
3911var IE_PROTO = __webpack_require__(65)('IE_PROTO');
3912
3913module.exports = function (object, names) {
3914 var O = toIObject(object);
3915 var i = 0;
3916 var result = [];
3917 var key;
3918 for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
3919 // Don't enum bug & hidden keys
3920 while (names.length > i) if (has(O, key = names[i++])) {
3921 ~arrayIndexOf(result, key) || result.push(key);
3922 }
3923 return result;
3924};
3925
3926
3927/***/ }),
3928/* 96 */
3929/***/ (function(module, exports, __webpack_require__) {
3930
3931// 7.1.15 ToLength
3932var toInteger = __webpack_require__(60);
3933var min = Math.min;
3934module.exports = function (it) {
3935 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
3936};
3937
3938
3939/***/ }),
3940/* 97 */
3941/***/ (function(module, exports, __webpack_require__) {
3942
3943var document = __webpack_require__(6).document;
3944module.exports = document && document.documentElement;
3945
3946
3947/***/ }),
3948/* 98 */
3949/***/ (function(module, exports, __webpack_require__) {
3950
3951// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
3952var has = __webpack_require__(25);
3953var toObject = __webpack_require__(53);
3954var IE_PROTO = __webpack_require__(65)('IE_PROTO');
3955var ObjectProto = Object.prototype;
3956
3957module.exports = Object.getPrototypeOf || function (O) {
3958 O = toObject(O);
3959 if (has(O, IE_PROTO)) return O[IE_PROTO];
3960 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
3961 return O.constructor.prototype;
3962 } return O instanceof Object ? ObjectProto : null;
3963};
3964
3965
3966/***/ }),
3967/* 99 */
3968/***/ (function(module, exports, __webpack_require__) {
3969
3970var classof = __webpack_require__(68);
3971var ITERATOR = __webpack_require__(7)('iterator');
3972var Iterators = __webpack_require__(30);
3973module.exports = __webpack_require__(2).getIteratorMethod = function (it) {
3974 if (it != undefined) return it[ITERATOR]
3975 || it['@@iterator']
3976 || Iterators[classof(it)];
3977};
3978
3979
3980/***/ }),
3981/* 100 */
3982/***/ (function(module, exports, __webpack_require__) {
3983
3984// 7.3.20 SpeciesConstructor(O, defaultConstructor)
3985var anObject = __webpack_require__(16);
3986var aFunction = __webpack_require__(48);
3987var SPECIES = __webpack_require__(7)('species');
3988module.exports = function (O, D) {
3989 var C = anObject(O).constructor;
3990 var S;
3991 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
3992};
3993
3994
3995/***/ }),
3996/* 101 */
3997/***/ (function(module, exports, __webpack_require__) {
3998
3999var ctx = __webpack_require__(38);
4000var invoke = __webpack_require__(181);
4001var html = __webpack_require__(97);
4002var cel = __webpack_require__(62);
4003var global = __webpack_require__(6);
4004var process = global.process;
4005var setTask = global.setImmediate;
4006var clearTask = global.clearImmediate;
4007var MessageChannel = global.MessageChannel;
4008var Dispatch = global.Dispatch;
4009var counter = 0;
4010var queue = {};
4011var ONREADYSTATECHANGE = 'onreadystatechange';
4012var defer, channel, port;
4013var run = function () {
4014 var id = +this;
4015 // eslint-disable-next-line no-prototype-builtins
4016 if (queue.hasOwnProperty(id)) {
4017 var fn = queue[id];
4018 delete queue[id];
4019 fn();
4020 }
4021};
4022var listener = function (event) {
4023 run.call(event.data);
4024};
4025// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
4026if (!setTask || !clearTask) {
4027 setTask = function setImmediate(fn) {
4028 var args = [];
4029 var i = 1;
4030 while (arguments.length > i) args.push(arguments[i++]);
4031 queue[++counter] = function () {
4032 // eslint-disable-next-line no-new-func
4033 invoke(typeof fn == 'function' ? fn : Function(fn), args);
4034 };
4035 defer(counter);
4036 return counter;
4037 };
4038 clearTask = function clearImmediate(id) {
4039 delete queue[id];
4040 };
4041 // Node.js 0.8-
4042 if (__webpack_require__(40)(process) == 'process') {
4043 defer = function (id) {
4044 process.nextTick(ctx(run, id, 1));
4045 };
4046 // Sphere (JS game engine) Dispatch API
4047 } else if (Dispatch && Dispatch.now) {
4048 defer = function (id) {
4049 Dispatch.now(ctx(run, id, 1));
4050 };
4051 // Browsers with MessageChannel, includes WebWorkers
4052 } else if (MessageChannel) {
4053 channel = new MessageChannel();
4054 port = channel.port2;
4055 channel.port1.onmessage = listener;
4056 defer = ctx(port.postMessage, port, 1);
4057 // Browsers with postMessage, skip WebWorkers
4058 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
4059 } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
4060 defer = function (id) {
4061 global.postMessage(id + '', '*');
4062 };
4063 global.addEventListener('message', listener, false);
4064 // IE8-
4065 } else if (ONREADYSTATECHANGE in cel('script')) {
4066 defer = function (id) {
4067 html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
4068 html.removeChild(this);
4069 run.call(id);
4070 };
4071 };
4072 // Rest old browsers
4073 } else {
4074 defer = function (id) {
4075 setTimeout(ctx(run, id, 1), 0);
4076 };
4077 }
4078}
4079module.exports = {
4080 set: setTask,
4081 clear: clearTask
4082};
4083
4084
4085/***/ }),
4086/* 102 */
4087/***/ (function(module, exports) {
4088
4089module.exports = function (exec) {
4090 try {
4091 return { e: false, v: exec() };
4092 } catch (e) {
4093 return { e: true, v: e };
4094 }
4095};
4096
4097
4098/***/ }),
4099/* 103 */
4100/***/ (function(module, exports, __webpack_require__) {
4101
4102var anObject = __webpack_require__(16);
4103var isObject = __webpack_require__(20);
4104var newPromiseCapability = __webpack_require__(69);
4105
4106module.exports = function (C, x) {
4107 anObject(C);
4108 if (isObject(x) && x.constructor === C) return x;
4109 var promiseCapability = newPromiseCapability.f(C);
4110 var resolve = promiseCapability.resolve;
4111 resolve(x);
4112 return promiseCapability.promise;
4113};
4114
4115
4116/***/ }),
4117/* 104 */
4118/***/ (function(module, exports) {
4119
4120var g;
4121
4122// This works in non-strict mode
4123g = (function() {
4124 return this;
4125})();
4126
4127try {
4128 // This works if eval is allowed (see CSP)
4129 g = g || Function("return this")() || (1,eval)("this");
4130} catch(e) {
4131 // This works if the window reference is available
4132 if(typeof window === "object")
4133 g = window;
4134}
4135
4136// g can still be undefined, but nothing to do about it...
4137// We return undefined, instead of nothing here, so it's
4138// easier to handle this case. if(!global) { ...}
4139
4140module.exports = g;
4141
4142
4143/***/ }),
4144/* 105 */
4145/***/ (function(module, __webpack_exports__, __webpack_require__) {
4146
4147"use strict";
4148/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
4149// Is a given variable undefined?
4150function isUndefined(obj) {
4151 return obj === void 0;
4152}
4153
4154
4155/***/ }),
4156/* 106 */
4157/***/ (function(module, __webpack_exports__, __webpack_require__) {
4158
4159"use strict";
4160/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
4161/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4162
4163
4164// Is a given value a boolean?
4165function isBoolean(obj) {
4166 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
4167}
4168
4169
4170/***/ }),
4171/* 107 */
4172/***/ (function(module, __webpack_exports__, __webpack_require__) {
4173
4174"use strict";
4175/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
4176
4177
4178/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
4179
4180
4181/***/ }),
4182/* 108 */
4183/***/ (function(module, __webpack_exports__, __webpack_require__) {
4184
4185"use strict";
4186/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
4187
4188
4189/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
4190
4191
4192/***/ }),
4193/* 109 */
4194/***/ (function(module, __webpack_exports__, __webpack_require__) {
4195
4196"use strict";
4197/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
4198
4199
4200/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
4201
4202
4203/***/ }),
4204/* 110 */
4205/***/ (function(module, __webpack_exports__, __webpack_require__) {
4206
4207"use strict";
4208/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
4209/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4210/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(107);
4211
4212
4213
4214// Is the given value `NaN`?
4215function isNaN(obj) {
4216 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
4217}
4218
4219
4220/***/ }),
4221/* 111 */
4222/***/ (function(module, __webpack_exports__, __webpack_require__) {
4223
4224"use strict";
4225/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4226/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(72);
4227/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(112);
4228/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(197);
4229
4230
4231
4232
4233
4234// Is a given value a typed array?
4235var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
4236function isTypedArray(obj) {
4237 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
4238 // Otherwise, fall back on the above regular expression.
4239 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)) :
4240 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
4241}
4242
4243/* 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));
4244
4245
4246/***/ }),
4247/* 112 */
4248/***/ (function(module, __webpack_exports__, __webpack_require__) {
4249
4250"use strict";
4251/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
4252// Predicate-generating function. Often useful outside of Underscore.
4253function constant(value) {
4254 return function() {
4255 return value;
4256 };
4257}
4258
4259
4260/***/ }),
4261/* 113 */
4262/***/ (function(module, __webpack_exports__, __webpack_require__) {
4263
4264"use strict";
4265/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
4266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4267
4268
4269// Common internal logic for `isArrayLike` and `isBufferLike`.
4270function createSizePropertyCheck(getSizeProperty) {
4271 return function(collection) {
4272 var sizeProperty = getSizeProperty(collection);
4273 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
4274 }
4275}
4276
4277
4278/***/ }),
4279/* 114 */
4280/***/ (function(module, __webpack_exports__, __webpack_require__) {
4281
4282"use strict";
4283/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
4284// Internal helper to generate a function to obtain property `key` from `obj`.
4285function shallowProperty(key) {
4286 return function(obj) {
4287 return obj == null ? void 0 : obj[key];
4288 };
4289}
4290
4291
4292/***/ }),
4293/* 115 */
4294/***/ (function(module, __webpack_exports__, __webpack_require__) {
4295
4296"use strict";
4297/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
4298/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4299/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
4300/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(22);
4301
4302
4303
4304
4305// Internal helper to create a simple lookup structure.
4306// `collectNonEnumProps` used to depend on `_.contains`, but this led to
4307// circular imports. `emulatedSet` is a one-off solution that only works for
4308// arrays of strings.
4309function emulatedSet(keys) {
4310 var hash = {};
4311 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
4312 return {
4313 contains: function(key) { return hash[key]; },
4314 push: function(key) {
4315 hash[key] = true;
4316 return keys.push(key);
4317 }
4318 };
4319}
4320
4321// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
4322// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
4323// needed.
4324function collectNonEnumProps(obj, keys) {
4325 keys = emulatedSet(keys);
4326 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
4327 var constructor = obj.constructor;
4328 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
4329
4330 // Constructor is a special case.
4331 var prop = 'constructor';
4332 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
4333
4334 while (nonEnumIdx--) {
4335 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
4336 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
4337 keys.push(prop);
4338 }
4339 }
4340}
4341
4342
4343/***/ }),
4344/* 116 */
4345/***/ (function(module, __webpack_exports__, __webpack_require__) {
4346
4347"use strict";
4348/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
4349/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
4350
4351
4352// Returns whether an object has a given set of `key:value` pairs.
4353function isMatch(object, attrs) {
4354 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
4355 if (object == null) return !length;
4356 var obj = Object(object);
4357 for (var i = 0; i < length; i++) {
4358 var key = _keys[i];
4359 if (attrs[key] !== obj[key] || !(key in obj)) return false;
4360 }
4361 return true;
4362}
4363
4364
4365/***/ }),
4366/* 117 */
4367/***/ (function(module, __webpack_exports__, __webpack_require__) {
4368
4369"use strict";
4370/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
4371/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
4372
4373
4374// Invert the keys and values of an object. The values must be serializable.
4375function invert(obj) {
4376 var result = {};
4377 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
4378 for (var i = 0, length = _keys.length; i < length; i++) {
4379 result[obj[_keys[i]]] = _keys[i];
4380 }
4381 return result;
4382}
4383
4384
4385/***/ }),
4386/* 118 */
4387/***/ (function(module, __webpack_exports__, __webpack_require__) {
4388
4389"use strict";
4390/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
4391/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(13);
4392
4393
4394// Return a sorted list of the function names available on the object.
4395function functions(obj) {
4396 var names = [];
4397 for (var key in obj) {
4398 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
4399 }
4400 return names.sort();
4401}
4402
4403
4404/***/ }),
4405/* 119 */
4406/***/ (function(module, __webpack_exports__, __webpack_require__) {
4407
4408"use strict";
4409/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(76);
4410/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(42);
4411
4412
4413
4414// Extend a given object with all the properties in passed-in object(s).
4415/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
4416
4417
4418/***/ }),
4419/* 120 */
4420/***/ (function(module, __webpack_exports__, __webpack_require__) {
4421
4422"use strict";
4423/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(76);
4424/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(42);
4425
4426
4427
4428// Fill in a given object with default properties.
4429/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
4430
4431
4432/***/ }),
4433/* 121 */
4434/***/ (function(module, __webpack_exports__, __webpack_require__) {
4435
4436"use strict";
4437/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
4438/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(27);
4439/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
4440
4441
4442
4443// Create a naked function reference for surrogate-prototype-swapping.
4444function ctor() {
4445 return function(){};
4446}
4447
4448// An internal function for creating a new object that inherits from another.
4449function baseCreate(prototype) {
4450 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
4451 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
4452 var Ctor = ctor();
4453 Ctor.prototype = prototype;
4454 var result = new Ctor;
4455 Ctor.prototype = null;
4456 return result;
4457}
4458
4459
4460/***/ }),
4461/* 122 */
4462/***/ (function(module, __webpack_exports__, __webpack_require__) {
4463
4464"use strict";
4465/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
4466/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(27);
4467/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(28);
4468/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(119);
4469
4470
4471
4472
4473// Create a (shallow-cloned) duplicate of an object.
4474function clone(obj) {
4475 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
4476 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
4477}
4478
4479
4480/***/ }),
4481/* 123 */
4482/***/ (function(module, __webpack_exports__, __webpack_require__) {
4483
4484"use strict";
4485/* harmony export (immutable) */ __webpack_exports__["a"] = get;
4486/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(43);
4487/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(78);
4488/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(105);
4489
4490
4491
4492
4493// Get the value of the (deep) property on `path` from `object`.
4494// If any property in `path` does not exist or if the value is
4495// `undefined`, return `defaultValue` instead.
4496// The `path` is normalized through `_.toPath`.
4497function get(object, path, defaultValue) {
4498 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
4499 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
4500}
4501
4502
4503/***/ }),
4504/* 124 */
4505/***/ (function(module, __webpack_exports__, __webpack_require__) {
4506
4507"use strict";
4508/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
4509/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
4510/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(28);
4511
4512
4513
4514// Normalize a (deep) property `path` to array.
4515// Like `_.iteratee`, this function can be customized.
4516function toPath(path) {
4517 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
4518}
4519__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
4520
4521
4522/***/ }),
4523/* 125 */
4524/***/ (function(module, __webpack_exports__, __webpack_require__) {
4525
4526"use strict";
4527/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
4528/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(79);
4529/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
4530/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(27);
4531/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(28);
4532/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(55);
4533/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(80);
4534/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(44);
4535
4536
4537
4538
4539
4540
4541
4542
4543// An internal function to generate callbacks that can be applied to each
4544// element in a collection, returning the desired result — either `_.identity`,
4545// an arbitrary callback, a property matcher, or a property accessor.
4546function baseIteratee(value, context, argCount) {
4547 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
4548 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
4549 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);
4550 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
4551}
4552
4553
4554/***/ }),
4555/* 126 */
4556/***/ (function(module, __webpack_exports__, __webpack_require__) {
4557
4558"use strict";
4559/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
4560/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
4561/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(125);
4562
4563
4564
4565// External wrapper for our callback generator. Users may customize
4566// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
4567// This abstraction hides the internal-only `argCount` argument.
4568function iteratee(value, context) {
4569 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
4570}
4571__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
4572
4573
4574/***/ }),
4575/* 127 */
4576/***/ (function(module, __webpack_exports__, __webpack_require__) {
4577
4578"use strict";
4579/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
4580// Predicate-generating function. Often useful outside of Underscore.
4581function noop(){}
4582
4583
4584/***/ }),
4585/* 128 */
4586/***/ (function(module, __webpack_exports__, __webpack_require__) {
4587
4588"use strict";
4589/* harmony export (immutable) */ __webpack_exports__["a"] = random;
4590// Return a random integer between `min` and `max` (inclusive).
4591function random(min, max) {
4592 if (max == null) {
4593 max = min;
4594 min = 0;
4595 }
4596 return min + Math.floor(Math.random() * (max - min + 1));
4597}
4598
4599
4600/***/ }),
4601/* 129 */
4602/***/ (function(module, __webpack_exports__, __webpack_require__) {
4603
4604"use strict";
4605/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
4606/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
4607
4608
4609// Internal helper to generate functions for escaping and unescaping strings
4610// to/from HTML interpolation.
4611function createEscaper(map) {
4612 var escaper = function(match) {
4613 return map[match];
4614 };
4615 // Regexes for identifying a key that needs to be escaped.
4616 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
4617 var testRegexp = RegExp(source);
4618 var replaceRegexp = RegExp(source, 'g');
4619 return function(string) {
4620 string = string == null ? '' : '' + string;
4621 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
4622 };
4623}
4624
4625
4626/***/ }),
4627/* 130 */
4628/***/ (function(module, __webpack_exports__, __webpack_require__) {
4629
4630"use strict";
4631// Internal list of HTML entities for escaping.
4632/* harmony default export */ __webpack_exports__["a"] = ({
4633 '&': '&amp;',
4634 '<': '&lt;',
4635 '>': '&gt;',
4636 '"': '&quot;',
4637 "'": '&#x27;',
4638 '`': '&#x60;'
4639});
4640
4641
4642/***/ }),
4643/* 131 */
4644/***/ (function(module, __webpack_exports__, __webpack_require__) {
4645
4646"use strict";
4647/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
4648
4649
4650// By default, Underscore uses ERB-style template delimiters. Change the
4651// following template settings to use alternative delimiters.
4652/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
4653 evaluate: /<%([\s\S]+?)%>/g,
4654 interpolate: /<%=([\s\S]+?)%>/g,
4655 escape: /<%-([\s\S]+?)%>/g
4656});
4657
4658
4659/***/ }),
4660/* 132 */
4661/***/ (function(module, __webpack_exports__, __webpack_require__) {
4662
4663"use strict";
4664/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
4665/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(121);
4666/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(27);
4667
4668
4669
4670// Internal function to execute `sourceFunc` bound to `context` with optional
4671// `args`. Determines whether to execute a function as a constructor or as a
4672// normal function.
4673function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
4674 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
4675 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
4676 var result = sourceFunc.apply(self, args);
4677 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
4678 return self;
4679}
4680
4681
4682/***/ }),
4683/* 133 */
4684/***/ (function(module, __webpack_exports__, __webpack_require__) {
4685
4686"use strict";
4687/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
4688/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
4689/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(132);
4690
4691
4692
4693
4694// Create a function bound to a given object (assigning `this`, and arguments,
4695// optionally).
4696/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
4697 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
4698 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
4699 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
4700 });
4701 return bound;
4702}));
4703
4704
4705/***/ }),
4706/* 134 */
4707/***/ (function(module, __webpack_exports__, __webpack_require__) {
4708
4709"use strict";
4710/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
4711
4712
4713// Delays a function for the given number of milliseconds, and then calls
4714// it with the arguments supplied.
4715/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
4716 return setTimeout(function() {
4717 return func.apply(null, args);
4718 }, wait);
4719}));
4720
4721
4722/***/ }),
4723/* 135 */
4724/***/ (function(module, __webpack_exports__, __webpack_require__) {
4725
4726"use strict";
4727/* harmony export (immutable) */ __webpack_exports__["a"] = before;
4728// Returns a function that will only be executed up to (but not including) the
4729// Nth call.
4730function before(times, func) {
4731 var memo;
4732 return function() {
4733 if (--times > 0) {
4734 memo = func.apply(this, arguments);
4735 }
4736 if (times <= 1) func = null;
4737 return memo;
4738 };
4739}
4740
4741
4742/***/ }),
4743/* 136 */
4744/***/ (function(module, __webpack_exports__, __webpack_require__) {
4745
4746"use strict";
4747/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
4748/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
4749/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
4750
4751
4752
4753// Returns the first key on an object that passes a truth test.
4754function findKey(obj, predicate, context) {
4755 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
4756 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
4757 for (var i = 0, length = _keys.length; i < length; i++) {
4758 key = _keys[i];
4759 if (predicate(obj[key], key, obj)) return key;
4760 }
4761}
4762
4763
4764/***/ }),
4765/* 137 */
4766/***/ (function(module, __webpack_exports__, __webpack_require__) {
4767
4768"use strict";
4769/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
4770/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
4771/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
4772
4773
4774
4775// Internal function to generate `_.findIndex` and `_.findLastIndex`.
4776function createPredicateIndexFinder(dir) {
4777 return function(array, predicate, context) {
4778 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
4779 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
4780 var index = dir > 0 ? 0 : length - 1;
4781 for (; index >= 0 && index < length; index += dir) {
4782 if (predicate(array[index], index, array)) return index;
4783 }
4784 return -1;
4785 };
4786}
4787
4788
4789/***/ }),
4790/* 138 */
4791/***/ (function(module, __webpack_exports__, __webpack_require__) {
4792
4793"use strict";
4794/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(137);
4795
4796
4797// Returns the last index on an array-like that passes a truth test.
4798/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
4799
4800
4801/***/ }),
4802/* 139 */
4803/***/ (function(module, __webpack_exports__, __webpack_require__) {
4804
4805"use strict";
4806/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
4807/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
4808/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
4809
4810
4811
4812// Use a comparator function to figure out the smallest index at which
4813// an object should be inserted so as to maintain order. Uses binary search.
4814function sortedIndex(array, obj, iteratee, context) {
4815 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
4816 var value = iteratee(obj);
4817 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
4818 while (low < high) {
4819 var mid = Math.floor((low + high) / 2);
4820 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
4821 }
4822 return low;
4823}
4824
4825
4826/***/ }),
4827/* 140 */
4828/***/ (function(module, __webpack_exports__, __webpack_require__) {
4829
4830"use strict";
4831/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(139);
4832/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(83);
4833/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(141);
4834
4835
4836
4837
4838// Return the position of the first occurrence of an item in an array,
4839// or -1 if the item is not included in the array.
4840// If the array is large and already in sort order, pass `true`
4841// for **isSorted** to use binary search.
4842/* 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 */]));
4843
4844
4845/***/ }),
4846/* 141 */
4847/***/ (function(module, __webpack_exports__, __webpack_require__) {
4848
4849"use strict";
4850/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
4851/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
4852/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
4853/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(110);
4854
4855
4856
4857
4858// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
4859function createIndexFinder(dir, predicateFind, sortedIndex) {
4860 return function(array, item, idx) {
4861 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
4862 if (typeof idx == 'number') {
4863 if (dir > 0) {
4864 i = idx >= 0 ? idx : Math.max(idx + length, i);
4865 } else {
4866 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
4867 }
4868 } else if (sortedIndex && idx && length) {
4869 idx = sortedIndex(array, item);
4870 return array[idx] === item ? idx : -1;
4871 }
4872 if (item !== item) {
4873 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
4874 return idx >= 0 ? idx + i : -1;
4875 }
4876 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
4877 if (array[idx] === item) return idx;
4878 }
4879 return -1;
4880 };
4881}
4882
4883
4884/***/ }),
4885/* 142 */
4886/***/ (function(module, __webpack_exports__, __webpack_require__) {
4887
4888"use strict";
4889/* harmony export (immutable) */ __webpack_exports__["a"] = find;
4890/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4891/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(83);
4892/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(136);
4893
4894
4895
4896
4897// Return the first value which passes a truth test.
4898function find(obj, predicate, context) {
4899 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 */];
4900 var key = keyFinder(obj, predicate, context);
4901 if (key !== void 0 && key !== -1) return obj[key];
4902}
4903
4904
4905/***/ }),
4906/* 143 */
4907/***/ (function(module, __webpack_exports__, __webpack_require__) {
4908
4909"use strict";
4910/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
4911/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4912/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
4913/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(44);
4914
4915
4916
4917
4918// Internal helper to create a reducing function, iterating left or right.
4919function createReduce(dir) {
4920 // Wrap code that reassigns argument variables in a separate function than
4921 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
4922 var reducer = function(obj, iteratee, memo, initial) {
4923 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
4924 length = (_keys || obj).length,
4925 index = dir > 0 ? 0 : length - 1;
4926 if (!initial) {
4927 memo = obj[_keys ? _keys[index] : index];
4928 index += dir;
4929 }
4930 for (; index >= 0 && index < length; index += dir) {
4931 var currentKey = _keys ? _keys[index] : index;
4932 memo = iteratee(memo, obj[currentKey], currentKey, obj);
4933 }
4934 return memo;
4935 };
4936
4937 return function(obj, iteratee, memo, context) {
4938 var initial = arguments.length >= 3;
4939 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
4940 };
4941}
4942
4943
4944/***/ }),
4945/* 144 */
4946/***/ (function(module, __webpack_exports__, __webpack_require__) {
4947
4948"use strict";
4949/* harmony export (immutable) */ __webpack_exports__["a"] = max;
4950/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4951/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(31);
4952/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(8);
4953/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(29);
4954
4955
4956
4957
4958
4959// Return the maximum element (or element-based computation).
4960function max(obj, iteratee, context) {
4961 var result = -Infinity, lastComputed = -Infinity,
4962 value, computed;
4963 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
4964 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
4965 for (var i = 0, length = obj.length; i < length; i++) {
4966 value = obj[i];
4967 if (value != null && value > result) {
4968 result = value;
4969 }
4970 }
4971 } else {
4972 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
4973 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
4974 computed = iteratee(v, index, list);
4975 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
4976 result = v;
4977 lastComputed = computed;
4978 }
4979 });
4980 }
4981 return result;
4982}
4983
4984
4985/***/ }),
4986/* 145 */
4987/***/ (function(module, __webpack_exports__, __webpack_require__) {
4988
4989"use strict";
4990/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
4991/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4992/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(122);
4993/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(31);
4994/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(14);
4995/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(128);
4996
4997
4998
4999
5000
5001
5002// Sample **n** random values from a collection using the modern version of the
5003// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
5004// If **n** is not specified, returns a single random element.
5005// The internal `guard` argument allows it to work with `_.map`.
5006function sample(obj, n, guard) {
5007 if (n == null || guard) {
5008 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
5009 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
5010 }
5011 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);
5012 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
5013 n = Math.max(Math.min(n, length), 0);
5014 var last = length - 1;
5015 for (var index = 0; index < n; index++) {
5016 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
5017 var temp = sample[index];
5018 sample[index] = sample[rand];
5019 sample[rand] = temp;
5020 }
5021 return sample.slice(0, n);
5022}
5023
5024
5025/***/ }),
5026/* 146 */
5027/***/ (function(module, __webpack_exports__, __webpack_require__) {
5028
5029"use strict";
5030/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
5031/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
5032/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(44);
5033/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(42);
5034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(246);
5035/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(32);
5036
5037
5038
5039
5040
5041
5042
5043// Return a copy of the object only containing the allowed properties.
5044/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
5045 var result = {}, iteratee = keys[0];
5046 if (obj == null) return result;
5047 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
5048 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
5049 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
5050 } else {
5051 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
5052 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
5053 obj = Object(obj);
5054 }
5055 for (var i = 0, length = keys.length; i < length; i++) {
5056 var key = keys[i];
5057 var value = obj[key];
5058 if (iteratee(value, key, obj)) result[key] = value;
5059 }
5060 return result;
5061}));
5062
5063
5064/***/ }),
5065/* 147 */
5066/***/ (function(module, __webpack_exports__, __webpack_require__) {
5067
5068"use strict";
5069/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
5070/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
5071
5072
5073// Returns everything but the last entry of the array. Especially useful on
5074// the arguments object. Passing **n** will return all the values in
5075// the array, excluding the last N.
5076function initial(array, n, guard) {
5077 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
5078}
5079
5080
5081/***/ }),
5082/* 148 */
5083/***/ (function(module, __webpack_exports__, __webpack_require__) {
5084
5085"use strict";
5086/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
5087/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
5088
5089
5090// Returns everything but the first entry of the `array`. Especially useful on
5091// the `arguments` object. Passing an **n** will return the rest N values in the
5092// `array`.
5093function rest(array, n, guard) {
5094 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
5095}
5096
5097
5098/***/ }),
5099/* 149 */
5100/***/ (function(module, __webpack_exports__, __webpack_require__) {
5101
5102"use strict";
5103/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
5104/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(32);
5105/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(45);
5106/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(46);
5107
5108
5109
5110
5111
5112// Take the difference between one array and a number of other arrays.
5113// Only the elements present in just the first array will remain.
5114/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
5115 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
5116 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
5117 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
5118 });
5119}));
5120
5121
5122/***/ }),
5123/* 150 */
5124/***/ (function(module, __webpack_exports__, __webpack_require__) {
5125
5126"use strict";
5127/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
5128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(106);
5129/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(8);
5130/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(14);
5131/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(46);
5132
5133
5134
5135
5136
5137// Produce a duplicate-free version of the array. If the array has already
5138// been sorted, you have the option of using a faster algorithm.
5139// The faster algorithm will not work with an iteratee if the iteratee
5140// is not a one-to-one function, so providing an iteratee will disable
5141// the faster algorithm.
5142function uniq(array, isSorted, iteratee, context) {
5143 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
5144 context = iteratee;
5145 iteratee = isSorted;
5146 isSorted = false;
5147 }
5148 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
5149 var result = [];
5150 var seen = [];
5151 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
5152 var value = array[i],
5153 computed = iteratee ? iteratee(value, i, array) : value;
5154 if (isSorted && !iteratee) {
5155 if (!i || seen !== computed) result.push(value);
5156 seen = computed;
5157 } else if (iteratee) {
5158 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
5159 seen.push(computed);
5160 result.push(value);
5161 }
5162 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
5163 result.push(value);
5164 }
5165 }
5166 return result;
5167}
5168
5169
5170/***/ }),
5171/* 151 */
5172/***/ (function(module, __webpack_exports__, __webpack_require__) {
5173
5174"use strict";
5175/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
5176/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(144);
5177/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
5178/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(84);
5179
5180
5181
5182
5183// Complement of zip. Unzip accepts an array of arrays and groups
5184// each array's elements on shared indices.
5185function unzip(array) {
5186 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
5187 var result = Array(length);
5188
5189 for (var index = 0; index < length; index++) {
5190 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
5191 }
5192 return result;
5193}
5194
5195
5196/***/ }),
5197/* 152 */
5198/***/ (function(module, __webpack_exports__, __webpack_require__) {
5199
5200"use strict";
5201/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
5202/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
5203
5204
5205// Helper function to continue chaining intermediate results.
5206function chainResult(instance, obj) {
5207 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
5208}
5209
5210
5211/***/ }),
5212/* 153 */
5213/***/ (function(module, exports, __webpack_require__) {
5214
5215module.exports = { "default": __webpack_require__(262), __esModule: true };
5216
5217/***/ }),
5218/* 154 */
5219/***/ (function(module, exports, __webpack_require__) {
5220
5221var rng = __webpack_require__(264);
5222var bytesToUuid = __webpack_require__(265);
5223
5224function v4(options, buf, offset) {
5225 var i = buf && offset || 0;
5226
5227 if (typeof(options) == 'string') {
5228 buf = options === 'binary' ? new Array(16) : null;
5229 options = null;
5230 }
5231 options = options || {};
5232
5233 var rnds = options.random || (options.rng || rng)();
5234
5235 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
5236 rnds[6] = (rnds[6] & 0x0f) | 0x40;
5237 rnds[8] = (rnds[8] & 0x3f) | 0x80;
5238
5239 // Copy bytes to buffer, if provided
5240 if (buf) {
5241 for (var ii = 0; ii < 16; ++ii) {
5242 buf[i + ii] = rnds[ii];
5243 }
5244 }
5245
5246 return buf || bytesToUuid(rnds);
5247}
5248
5249module.exports = v4;
5250
5251
5252/***/ }),
5253/* 155 */
5254/***/ (function(module, exports, __webpack_require__) {
5255
5256module.exports = { "default": __webpack_require__(268), __esModule: true };
5257
5258/***/ }),
5259/* 156 */
5260/***/ (function(module, exports, __webpack_require__) {
5261
5262"use strict";
5263
5264
5265module.exports = '4.12.3';
5266
5267/***/ }),
5268/* 157 */
5269/***/ (function(module, exports, __webpack_require__) {
5270
5271"use strict";
5272
5273
5274var has = Object.prototype.hasOwnProperty
5275 , prefix = '~';
5276
5277/**
5278 * Constructor to create a storage for our `EE` objects.
5279 * An `Events` instance is a plain object whose properties are event names.
5280 *
5281 * @constructor
5282 * @api private
5283 */
5284function Events() {}
5285
5286//
5287// We try to not inherit from `Object.prototype`. In some engines creating an
5288// instance in this way is faster than calling `Object.create(null)` directly.
5289// If `Object.create(null)` is not supported we prefix the event names with a
5290// character to make sure that the built-in object properties are not
5291// overridden or used as an attack vector.
5292//
5293if (Object.create) {
5294 Events.prototype = Object.create(null);
5295
5296 //
5297 // This hack is needed because the `__proto__` property is still inherited in
5298 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
5299 //
5300 if (!new Events().__proto__) prefix = false;
5301}
5302
5303/**
5304 * Representation of a single event listener.
5305 *
5306 * @param {Function} fn The listener function.
5307 * @param {Mixed} context The context to invoke the listener with.
5308 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
5309 * @constructor
5310 * @api private
5311 */
5312function EE(fn, context, once) {
5313 this.fn = fn;
5314 this.context = context;
5315 this.once = once || false;
5316}
5317
5318/**
5319 * Minimal `EventEmitter` interface that is molded against the Node.js
5320 * `EventEmitter` interface.
5321 *
5322 * @constructor
5323 * @api public
5324 */
5325function EventEmitter() {
5326 this._events = new Events();
5327 this._eventsCount = 0;
5328}
5329
5330/**
5331 * Return an array listing the events for which the emitter has registered
5332 * listeners.
5333 *
5334 * @returns {Array}
5335 * @api public
5336 */
5337EventEmitter.prototype.eventNames = function eventNames() {
5338 var names = []
5339 , events
5340 , name;
5341
5342 if (this._eventsCount === 0) return names;
5343
5344 for (name in (events = this._events)) {
5345 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
5346 }
5347
5348 if (Object.getOwnPropertySymbols) {
5349 return names.concat(Object.getOwnPropertySymbols(events));
5350 }
5351
5352 return names;
5353};
5354
5355/**
5356 * Return the listeners registered for a given event.
5357 *
5358 * @param {String|Symbol} event The event name.
5359 * @param {Boolean} exists Only check if there are listeners.
5360 * @returns {Array|Boolean}
5361 * @api public
5362 */
5363EventEmitter.prototype.listeners = function listeners(event, exists) {
5364 var evt = prefix ? prefix + event : event
5365 , available = this._events[evt];
5366
5367 if (exists) return !!available;
5368 if (!available) return [];
5369 if (available.fn) return [available.fn];
5370
5371 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
5372 ee[i] = available[i].fn;
5373 }
5374
5375 return ee;
5376};
5377
5378/**
5379 * Calls each of the listeners registered for a given event.
5380 *
5381 * @param {String|Symbol} event The event name.
5382 * @returns {Boolean} `true` if the event had listeners, else `false`.
5383 * @api public
5384 */
5385EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
5386 var evt = prefix ? prefix + event : event;
5387
5388 if (!this._events[evt]) return false;
5389
5390 var listeners = this._events[evt]
5391 , len = arguments.length
5392 , args
5393 , i;
5394
5395 if (listeners.fn) {
5396 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
5397
5398 switch (len) {
5399 case 1: return listeners.fn.call(listeners.context), true;
5400 case 2: return listeners.fn.call(listeners.context, a1), true;
5401 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
5402 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
5403 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
5404 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
5405 }
5406
5407 for (i = 1, args = new Array(len -1); i < len; i++) {
5408 args[i - 1] = arguments[i];
5409 }
5410
5411 listeners.fn.apply(listeners.context, args);
5412 } else {
5413 var length = listeners.length
5414 , j;
5415
5416 for (i = 0; i < length; i++) {
5417 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
5418
5419 switch (len) {
5420 case 1: listeners[i].fn.call(listeners[i].context); break;
5421 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
5422 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
5423 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
5424 default:
5425 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
5426 args[j - 1] = arguments[j];
5427 }
5428
5429 listeners[i].fn.apply(listeners[i].context, args);
5430 }
5431 }
5432 }
5433
5434 return true;
5435};
5436
5437/**
5438 * Add a listener for a given event.
5439 *
5440 * @param {String|Symbol} event The event name.
5441 * @param {Function} fn The listener function.
5442 * @param {Mixed} [context=this] The context to invoke the listener with.
5443 * @returns {EventEmitter} `this`.
5444 * @api public
5445 */
5446EventEmitter.prototype.on = function on(event, fn, context) {
5447 var listener = new EE(fn, context || this)
5448 , evt = prefix ? prefix + event : event;
5449
5450 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
5451 else if (!this._events[evt].fn) this._events[evt].push(listener);
5452 else this._events[evt] = [this._events[evt], listener];
5453
5454 return this;
5455};
5456
5457/**
5458 * Add a one-time listener for a given event.
5459 *
5460 * @param {String|Symbol} event The event name.
5461 * @param {Function} fn The listener function.
5462 * @param {Mixed} [context=this] The context to invoke the listener with.
5463 * @returns {EventEmitter} `this`.
5464 * @api public
5465 */
5466EventEmitter.prototype.once = function once(event, fn, context) {
5467 var listener = new EE(fn, context || this, true)
5468 , evt = prefix ? prefix + event : event;
5469
5470 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
5471 else if (!this._events[evt].fn) this._events[evt].push(listener);
5472 else this._events[evt] = [this._events[evt], listener];
5473
5474 return this;
5475};
5476
5477/**
5478 * Remove the listeners of a given event.
5479 *
5480 * @param {String|Symbol} event The event name.
5481 * @param {Function} fn Only remove the listeners that match this function.
5482 * @param {Mixed} context Only remove the listeners that have this context.
5483 * @param {Boolean} once Only remove one-time listeners.
5484 * @returns {EventEmitter} `this`.
5485 * @api public
5486 */
5487EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
5488 var evt = prefix ? prefix + event : event;
5489
5490 if (!this._events[evt]) return this;
5491 if (!fn) {
5492 if (--this._eventsCount === 0) this._events = new Events();
5493 else delete this._events[evt];
5494 return this;
5495 }
5496
5497 var listeners = this._events[evt];
5498
5499 if (listeners.fn) {
5500 if (
5501 listeners.fn === fn
5502 && (!once || listeners.once)
5503 && (!context || listeners.context === context)
5504 ) {
5505 if (--this._eventsCount === 0) this._events = new Events();
5506 else delete this._events[evt];
5507 }
5508 } else {
5509 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
5510 if (
5511 listeners[i].fn !== fn
5512 || (once && !listeners[i].once)
5513 || (context && listeners[i].context !== context)
5514 ) {
5515 events.push(listeners[i]);
5516 }
5517 }
5518
5519 //
5520 // Reset the array, or remove it completely if we have no more listeners.
5521 //
5522 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
5523 else if (--this._eventsCount === 0) this._events = new Events();
5524 else delete this._events[evt];
5525 }
5526
5527 return this;
5528};
5529
5530/**
5531 * Remove all listeners, or those of the specified event.
5532 *
5533 * @param {String|Symbol} [event] The event name.
5534 * @returns {EventEmitter} `this`.
5535 * @api public
5536 */
5537EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
5538 var evt;
5539
5540 if (event) {
5541 evt = prefix ? prefix + event : event;
5542 if (this._events[evt]) {
5543 if (--this._eventsCount === 0) this._events = new Events();
5544 else delete this._events[evt];
5545 }
5546 } else {
5547 this._events = new Events();
5548 this._eventsCount = 0;
5549 }
5550
5551 return this;
5552};
5553
5554//
5555// Alias methods names because people roll like that.
5556//
5557EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
5558EventEmitter.prototype.addListener = EventEmitter.prototype.on;
5559
5560//
5561// This function doesn't apply anymore.
5562//
5563EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
5564 return this;
5565};
5566
5567//
5568// Expose the prefix.
5569//
5570EventEmitter.prefixed = prefix;
5571
5572//
5573// Allow `EventEmitter` to be imported as module namespace.
5574//
5575EventEmitter.EventEmitter = EventEmitter;
5576
5577//
5578// Expose the module.
5579//
5580if (true) {
5581 module.exports = EventEmitter;
5582}
5583
5584
5585/***/ }),
5586/* 158 */
5587/***/ (function(module, exports, __webpack_require__) {
5588
5589"use strict";
5590
5591
5592var _promise = __webpack_require__(4);
5593
5594var _promise2 = _interopRequireDefault(_promise);
5595
5596function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5597
5598var _require = __webpack_require__(36),
5599 getAdapter = _require.getAdapter;
5600
5601var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
5602
5603var localStorage = {
5604 get async() {
5605 return getAdapter('storage').async;
5606 }
5607};
5608
5609// wrap sync apis with async ones.
5610syncApiNames.forEach(function (apiName) {
5611 localStorage[apiName + 'Async'] = function () {
5612 var storage = getAdapter('storage');
5613 return _promise2.default.resolve(storage[apiName].apply(storage, arguments));
5614 };
5615
5616 localStorage[apiName] = function () {
5617 var storage = getAdapter('storage');
5618 if (!storage.async) {
5619 return storage[apiName].apply(storage, arguments);
5620 }
5621 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
5622 error.code = 'SYNC_API_NOT_AVAILABLE';
5623 throw error;
5624 };
5625});
5626
5627module.exports = localStorage;
5628
5629/***/ }),
5630/* 159 */
5631/***/ (function(module, exports, __webpack_require__) {
5632
5633"use strict";
5634
5635
5636var _stringify = __webpack_require__(18);
5637
5638var _stringify2 = _interopRequireDefault(_stringify);
5639
5640function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5641
5642var storage = __webpack_require__(158);
5643var AV = __webpack_require__(34);
5644
5645var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
5646
5647var getCacheData = function getCacheData(cacheData, key) {
5648 try {
5649 cacheData = JSON.parse(cacheData);
5650 } catch (e) {
5651 return null;
5652 }
5653 if (cacheData) {
5654 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
5655 if (!expired) {
5656 return cacheData.value;
5657 }
5658 return removeAsync(key).then(function () {
5659 return null;
5660 });
5661 }
5662 return null;
5663};
5664
5665exports.getAsync = function (key) {
5666 key = 'AV/' + AV.applicationId + '/' + key;
5667 return storage.getItemAsync(key).then(function (cache) {
5668 return getCacheData(cache, key);
5669 });
5670};
5671
5672exports.setAsync = function (key, value, ttl) {
5673 var cache = { value: value };
5674 if (typeof ttl === 'number') {
5675 cache.expiredAt = Date.now() + ttl;
5676 }
5677 return storage.setItemAsync('AV/' + AV.applicationId + '/' + key, (0, _stringify2.default)(cache));
5678};
5679
5680/***/ }),
5681/* 160 */
5682/***/ (function(module, exports) {
5683
5684exports.f = Object.getOwnPropertySymbols;
5685
5686
5687/***/ }),
5688/* 161 */
5689/***/ (function(module, exports, __webpack_require__) {
5690
5691// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
5692var $keys = __webpack_require__(95);
5693var hiddenKeys = __webpack_require__(67).concat('length', 'prototype');
5694
5695exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
5696 return $keys(O, hiddenKeys);
5697};
5698
5699
5700/***/ }),
5701/* 162 */
5702/***/ (function(module, exports, __webpack_require__) {
5703
5704module.exports = { "default": __webpack_require__(305), __esModule: true };
5705
5706/***/ }),
5707/* 163 */
5708/***/ (function(module, exports) {
5709
5710var charenc = {
5711 // UTF-8 encoding
5712 utf8: {
5713 // Convert a string to a byte array
5714 stringToBytes: function(str) {
5715 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
5716 },
5717
5718 // Convert a byte array to a string
5719 bytesToString: function(bytes) {
5720 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
5721 }
5722 },
5723
5724 // Binary encoding
5725 bin: {
5726 // Convert a string to a byte array
5727 stringToBytes: function(str) {
5728 for (var bytes = [], i = 0; i < str.length; i++)
5729 bytes.push(str.charCodeAt(i) & 0xFF);
5730 return bytes;
5731 },
5732
5733 // Convert a byte array to a string
5734 bytesToString: function(bytes) {
5735 for (var str = [], i = 0; i < bytes.length; i++)
5736 str.push(String.fromCharCode(bytes[i]));
5737 return str.join('');
5738 }
5739 }
5740};
5741
5742module.exports = charenc;
5743
5744
5745/***/ }),
5746/* 164 */
5747/***/ (function(module, exports, __webpack_require__) {
5748
5749"use strict";
5750
5751
5752module.exports = __webpack_require__(165);
5753
5754/***/ }),
5755/* 165 */
5756/***/ (function(module, exports, __webpack_require__) {
5757
5758"use strict";
5759
5760
5761var _promise = __webpack_require__(4);
5762
5763var _promise2 = _interopRequireDefault(_promise);
5764
5765function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5766
5767/*!
5768 * LeanCloud JavaScript SDK
5769 * https://leancloud.cn
5770 *
5771 * Copyright 2016 LeanCloud.cn, Inc.
5772 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
5773 */
5774var _ = __webpack_require__(0);
5775
5776var AV = __webpack_require__(34);
5777
5778AV._ = _;
5779AV.version = __webpack_require__(156);
5780AV.Promise = _promise2.default;
5781AV.localStorage = __webpack_require__(158);
5782AV.Cache = __webpack_require__(159);
5783AV.Error = __webpack_require__(23);
5784
5785__webpack_require__(270);
5786__webpack_require__(286)(AV);
5787__webpack_require__(287)(AV);
5788__webpack_require__(288)(AV);
5789__webpack_require__(289)(AV);
5790__webpack_require__(290)(AV);
5791__webpack_require__(291)(AV);
5792__webpack_require__(313)(AV);
5793__webpack_require__(321)(AV);
5794__webpack_require__(322)(AV);
5795__webpack_require__(324)(AV);
5796__webpack_require__(325)(AV);
5797__webpack_require__(326)(AV);
5798__webpack_require__(327)(AV);
5799__webpack_require__(328)(AV);
5800__webpack_require__(329)(AV);
5801__webpack_require__(330)(AV);
5802__webpack_require__(331)(AV);
5803__webpack_require__(332)(AV);
5804
5805AV.Conversation = __webpack_require__(333);
5806__webpack_require__(334);
5807module.exports = AV;
5808
5809/**
5810 * Options to controll the authentication for an operation
5811 * @typedef {Object} AuthOptions
5812 * @property {String} [sessionToken] Specify a user to excute the operation as.
5813 * @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.
5814 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
5815 */
5816
5817/**
5818 * Options to controll the authentication for an SMS operation
5819 * @typedef {Object} SMSAuthOptions
5820 * @property {String} [sessionToken] Specify a user to excute the operation as.
5821 * @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.
5822 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
5823 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
5824 */
5825
5826/***/ }),
5827/* 166 */
5828/***/ (function(module, exports, __webpack_require__) {
5829
5830__webpack_require__(91);
5831__webpack_require__(47);
5832__webpack_require__(54);
5833__webpack_require__(176);
5834__webpack_require__(187);
5835__webpack_require__(188);
5836module.exports = __webpack_require__(2).Promise;
5837
5838
5839/***/ }),
5840/* 167 */
5841/***/ (function(module, exports, __webpack_require__) {
5842
5843var toInteger = __webpack_require__(60);
5844var defined = __webpack_require__(61);
5845// true -> String#at
5846// false -> String#codePointAt
5847module.exports = function (TO_STRING) {
5848 return function (that, pos) {
5849 var s = String(defined(that));
5850 var i = toInteger(pos);
5851 var l = s.length;
5852 var a, b;
5853 if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
5854 a = s.charCodeAt(i);
5855 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
5856 ? TO_STRING ? s.charAt(i) : a
5857 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
5858 };
5859};
5860
5861
5862/***/ }),
5863/* 168 */
5864/***/ (function(module, exports, __webpack_require__) {
5865
5866"use strict";
5867
5868var create = __webpack_require__(64);
5869var descriptor = __webpack_require__(49);
5870var setToStringTag = __webpack_require__(52);
5871var IteratorPrototype = {};
5872
5873// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
5874__webpack_require__(24)(IteratorPrototype, __webpack_require__(7)('iterator'), function () { return this; });
5875
5876module.exports = function (Constructor, NAME, next) {
5877 Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
5878 setToStringTag(Constructor, NAME + ' Iterator');
5879};
5880
5881
5882/***/ }),
5883/* 169 */
5884/***/ (function(module, exports, __webpack_require__) {
5885
5886var dP = __webpack_require__(19);
5887var anObject = __webpack_require__(16);
5888var getKeys = __webpack_require__(50);
5889
5890module.exports = __webpack_require__(21) ? Object.defineProperties : function defineProperties(O, Properties) {
5891 anObject(O);
5892 var keys = getKeys(Properties);
5893 var length = keys.length;
5894 var i = 0;
5895 var P;
5896 while (length > i) dP.f(O, P = keys[i++], Properties[P]);
5897 return O;
5898};
5899
5900
5901/***/ }),
5902/* 170 */
5903/***/ (function(module, exports, __webpack_require__) {
5904
5905// fallback for non-array-like ES3 and non-enumerable old V8 strings
5906var cof = __webpack_require__(40);
5907// eslint-disable-next-line no-prototype-builtins
5908module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
5909 return cof(it) == 'String' ? it.split('') : Object(it);
5910};
5911
5912
5913/***/ }),
5914/* 171 */
5915/***/ (function(module, exports, __webpack_require__) {
5916
5917// false -> Array#indexOf
5918// true -> Array#includes
5919var toIObject = __webpack_require__(26);
5920var toLength = __webpack_require__(96);
5921var toAbsoluteIndex = __webpack_require__(172);
5922module.exports = function (IS_INCLUDES) {
5923 return function ($this, el, fromIndex) {
5924 var O = toIObject($this);
5925 var length = toLength(O.length);
5926 var index = toAbsoluteIndex(fromIndex, length);
5927 var value;
5928 // Array#includes uses SameValueZero equality algorithm
5929 // eslint-disable-next-line no-self-compare
5930 if (IS_INCLUDES && el != el) while (length > index) {
5931 value = O[index++];
5932 // eslint-disable-next-line no-self-compare
5933 if (value != value) return true;
5934 // Array#indexOf ignores holes, Array#includes - not
5935 } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
5936 if (O[index] === el) return IS_INCLUDES || index || 0;
5937 } return !IS_INCLUDES && -1;
5938 };
5939};
5940
5941
5942/***/ }),
5943/* 172 */
5944/***/ (function(module, exports, __webpack_require__) {
5945
5946var toInteger = __webpack_require__(60);
5947var max = Math.max;
5948var min = Math.min;
5949module.exports = function (index, length) {
5950 index = toInteger(index);
5951 return index < 0 ? max(index + length, 0) : min(index, length);
5952};
5953
5954
5955/***/ }),
5956/* 173 */
5957/***/ (function(module, exports, __webpack_require__) {
5958
5959"use strict";
5960
5961var addToUnscopables = __webpack_require__(174);
5962var step = __webpack_require__(175);
5963var Iterators = __webpack_require__(30);
5964var toIObject = __webpack_require__(26);
5965
5966// 22.1.3.4 Array.prototype.entries()
5967// 22.1.3.13 Array.prototype.keys()
5968// 22.1.3.29 Array.prototype.values()
5969// 22.1.3.30 Array.prototype[@@iterator]()
5970module.exports = __webpack_require__(92)(Array, 'Array', function (iterated, kind) {
5971 this._t = toIObject(iterated); // target
5972 this._i = 0; // next index
5973 this._k = kind; // kind
5974// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
5975}, function () {
5976 var O = this._t;
5977 var kind = this._k;
5978 var index = this._i++;
5979 if (!O || index >= O.length) {
5980 this._t = undefined;
5981 return step(1);
5982 }
5983 if (kind == 'keys') return step(0, index);
5984 if (kind == 'values') return step(0, O[index]);
5985 return step(0, [index, O[index]]);
5986}, 'values');
5987
5988// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
5989Iterators.Arguments = Iterators.Array;
5990
5991addToUnscopables('keys');
5992addToUnscopables('values');
5993addToUnscopables('entries');
5994
5995
5996/***/ }),
5997/* 174 */
5998/***/ (function(module, exports) {
5999
6000module.exports = function () { /* empty */ };
6001
6002
6003/***/ }),
6004/* 175 */
6005/***/ (function(module, exports) {
6006
6007module.exports = function (done, value) {
6008 return { value: value, done: !!done };
6009};
6010
6011
6012/***/ }),
6013/* 176 */
6014/***/ (function(module, exports, __webpack_require__) {
6015
6016"use strict";
6017
6018var LIBRARY = __webpack_require__(37);
6019var global = __webpack_require__(6);
6020var ctx = __webpack_require__(38);
6021var classof = __webpack_require__(68);
6022var $export = __webpack_require__(17);
6023var isObject = __webpack_require__(20);
6024var aFunction = __webpack_require__(48);
6025var anInstance = __webpack_require__(177);
6026var forOf = __webpack_require__(178);
6027var speciesConstructor = __webpack_require__(100);
6028var task = __webpack_require__(101).set;
6029var microtask = __webpack_require__(182)();
6030var newPromiseCapabilityModule = __webpack_require__(69);
6031var perform = __webpack_require__(102);
6032var userAgent = __webpack_require__(183);
6033var promiseResolve = __webpack_require__(103);
6034var PROMISE = 'Promise';
6035var TypeError = global.TypeError;
6036var process = global.process;
6037var versions = process && process.versions;
6038var v8 = versions && versions.v8 || '';
6039var $Promise = global[PROMISE];
6040var isNode = classof(process) == 'process';
6041var empty = function () { /* empty */ };
6042var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
6043var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
6044
6045var USE_NATIVE = !!function () {
6046 try {
6047 // correct subclassing with @@species support
6048 var promise = $Promise.resolve(1);
6049 var FakePromise = (promise.constructor = {})[__webpack_require__(7)('species')] = function (exec) {
6050 exec(empty, empty);
6051 };
6052 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
6053 return (isNode || typeof PromiseRejectionEvent == 'function')
6054 && promise.then(empty) instanceof FakePromise
6055 // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
6056 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
6057 // we can't detect it synchronously, so just check versions
6058 && v8.indexOf('6.6') !== 0
6059 && userAgent.indexOf('Chrome/66') === -1;
6060 } catch (e) { /* empty */ }
6061}();
6062
6063// helpers
6064var isThenable = function (it) {
6065 var then;
6066 return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
6067};
6068var notify = function (promise, isReject) {
6069 if (promise._n) return;
6070 promise._n = true;
6071 var chain = promise._c;
6072 microtask(function () {
6073 var value = promise._v;
6074 var ok = promise._s == 1;
6075 var i = 0;
6076 var run = function (reaction) {
6077 var handler = ok ? reaction.ok : reaction.fail;
6078 var resolve = reaction.resolve;
6079 var reject = reaction.reject;
6080 var domain = reaction.domain;
6081 var result, then, exited;
6082 try {
6083 if (handler) {
6084 if (!ok) {
6085 if (promise._h == 2) onHandleUnhandled(promise);
6086 promise._h = 1;
6087 }
6088 if (handler === true) result = value;
6089 else {
6090 if (domain) domain.enter();
6091 result = handler(value); // may throw
6092 if (domain) {
6093 domain.exit();
6094 exited = true;
6095 }
6096 }
6097 if (result === reaction.promise) {
6098 reject(TypeError('Promise-chain cycle'));
6099 } else if (then = isThenable(result)) {
6100 then.call(result, resolve, reject);
6101 } else resolve(result);
6102 } else reject(value);
6103 } catch (e) {
6104 if (domain && !exited) domain.exit();
6105 reject(e);
6106 }
6107 };
6108 while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
6109 promise._c = [];
6110 promise._n = false;
6111 if (isReject && !promise._h) onUnhandled(promise);
6112 });
6113};
6114var onUnhandled = function (promise) {
6115 task.call(global, function () {
6116 var value = promise._v;
6117 var unhandled = isUnhandled(promise);
6118 var result, handler, console;
6119 if (unhandled) {
6120 result = perform(function () {
6121 if (isNode) {
6122 process.emit('unhandledRejection', value, promise);
6123 } else if (handler = global.onunhandledrejection) {
6124 handler({ promise: promise, reason: value });
6125 } else if ((console = global.console) && console.error) {
6126 console.error('Unhandled promise rejection', value);
6127 }
6128 });
6129 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
6130 promise._h = isNode || isUnhandled(promise) ? 2 : 1;
6131 } promise._a = undefined;
6132 if (unhandled && result.e) throw result.v;
6133 });
6134};
6135var isUnhandled = function (promise) {
6136 return promise._h !== 1 && (promise._a || promise._c).length === 0;
6137};
6138var onHandleUnhandled = function (promise) {
6139 task.call(global, function () {
6140 var handler;
6141 if (isNode) {
6142 process.emit('rejectionHandled', promise);
6143 } else if (handler = global.onrejectionhandled) {
6144 handler({ promise: promise, reason: promise._v });
6145 }
6146 });
6147};
6148var $reject = function (value) {
6149 var promise = this;
6150 if (promise._d) return;
6151 promise._d = true;
6152 promise = promise._w || promise; // unwrap
6153 promise._v = value;
6154 promise._s = 2;
6155 if (!promise._a) promise._a = promise._c.slice();
6156 notify(promise, true);
6157};
6158var $resolve = function (value) {
6159 var promise = this;
6160 var then;
6161 if (promise._d) return;
6162 promise._d = true;
6163 promise = promise._w || promise; // unwrap
6164 try {
6165 if (promise === value) throw TypeError("Promise can't be resolved itself");
6166 if (then = isThenable(value)) {
6167 microtask(function () {
6168 var wrapper = { _w: promise, _d: false }; // wrap
6169 try {
6170 then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
6171 } catch (e) {
6172 $reject.call(wrapper, e);
6173 }
6174 });
6175 } else {
6176 promise._v = value;
6177 promise._s = 1;
6178 notify(promise, false);
6179 }
6180 } catch (e) {
6181 $reject.call({ _w: promise, _d: false }, e); // wrap
6182 }
6183};
6184
6185// constructor polyfill
6186if (!USE_NATIVE) {
6187 // 25.4.3.1 Promise(executor)
6188 $Promise = function Promise(executor) {
6189 anInstance(this, $Promise, PROMISE, '_h');
6190 aFunction(executor);
6191 Internal.call(this);
6192 try {
6193 executor(ctx($resolve, this, 1), ctx($reject, this, 1));
6194 } catch (err) {
6195 $reject.call(this, err);
6196 }
6197 };
6198 // eslint-disable-next-line no-unused-vars
6199 Internal = function Promise(executor) {
6200 this._c = []; // <- awaiting reactions
6201 this._a = undefined; // <- checked in isUnhandled reactions
6202 this._s = 0; // <- state
6203 this._d = false; // <- done
6204 this._v = undefined; // <- value
6205 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
6206 this._n = false; // <- notify
6207 };
6208 Internal.prototype = __webpack_require__(184)($Promise.prototype, {
6209 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
6210 then: function then(onFulfilled, onRejected) {
6211 var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
6212 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
6213 reaction.fail = typeof onRejected == 'function' && onRejected;
6214 reaction.domain = isNode ? process.domain : undefined;
6215 this._c.push(reaction);
6216 if (this._a) this._a.push(reaction);
6217 if (this._s) notify(this, false);
6218 return reaction.promise;
6219 },
6220 // 25.4.5.1 Promise.prototype.catch(onRejected)
6221 'catch': function (onRejected) {
6222 return this.then(undefined, onRejected);
6223 }
6224 });
6225 OwnPromiseCapability = function () {
6226 var promise = new Internal();
6227 this.promise = promise;
6228 this.resolve = ctx($resolve, promise, 1);
6229 this.reject = ctx($reject, promise, 1);
6230 };
6231 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
6232 return C === $Promise || C === Wrapper
6233 ? new OwnPromiseCapability(C)
6234 : newGenericPromiseCapability(C);
6235 };
6236}
6237
6238$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
6239__webpack_require__(52)($Promise, PROMISE);
6240__webpack_require__(185)(PROMISE);
6241Wrapper = __webpack_require__(2)[PROMISE];
6242
6243// statics
6244$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
6245 // 25.4.4.5 Promise.reject(r)
6246 reject: function reject(r) {
6247 var capability = newPromiseCapability(this);
6248 var $$reject = capability.reject;
6249 $$reject(r);
6250 return capability.promise;
6251 }
6252});
6253$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
6254 // 25.4.4.6 Promise.resolve(x)
6255 resolve: function resolve(x) {
6256 return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
6257 }
6258});
6259$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(186)(function (iter) {
6260 $Promise.all(iter)['catch'](empty);
6261})), PROMISE, {
6262 // 25.4.4.1 Promise.all(iterable)
6263 all: function all(iterable) {
6264 var C = this;
6265 var capability = newPromiseCapability(C);
6266 var resolve = capability.resolve;
6267 var reject = capability.reject;
6268 var result = perform(function () {
6269 var values = [];
6270 var index = 0;
6271 var remaining = 1;
6272 forOf(iterable, false, function (promise) {
6273 var $index = index++;
6274 var alreadyCalled = false;
6275 values.push(undefined);
6276 remaining++;
6277 C.resolve(promise).then(function (value) {
6278 if (alreadyCalled) return;
6279 alreadyCalled = true;
6280 values[$index] = value;
6281 --remaining || resolve(values);
6282 }, reject);
6283 });
6284 --remaining || resolve(values);
6285 });
6286 if (result.e) reject(result.v);
6287 return capability.promise;
6288 },
6289 // 25.4.4.4 Promise.race(iterable)
6290 race: function race(iterable) {
6291 var C = this;
6292 var capability = newPromiseCapability(C);
6293 var reject = capability.reject;
6294 var result = perform(function () {
6295 forOf(iterable, false, function (promise) {
6296 C.resolve(promise).then(capability.resolve, reject);
6297 });
6298 });
6299 if (result.e) reject(result.v);
6300 return capability.promise;
6301 }
6302});
6303
6304
6305/***/ }),
6306/* 177 */
6307/***/ (function(module, exports) {
6308
6309module.exports = function (it, Constructor, name, forbiddenField) {
6310 if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
6311 throw TypeError(name + ': incorrect invocation!');
6312 } return it;
6313};
6314
6315
6316/***/ }),
6317/* 178 */
6318/***/ (function(module, exports, __webpack_require__) {
6319
6320var ctx = __webpack_require__(38);
6321var call = __webpack_require__(179);
6322var isArrayIter = __webpack_require__(180);
6323var anObject = __webpack_require__(16);
6324var toLength = __webpack_require__(96);
6325var getIterFn = __webpack_require__(99);
6326var BREAK = {};
6327var RETURN = {};
6328var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
6329 var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
6330 var f = ctx(fn, that, entries ? 2 : 1);
6331 var index = 0;
6332 var length, step, iterator, result;
6333 if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
6334 // fast case for arrays with default iterator
6335 if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
6336 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
6337 if (result === BREAK || result === RETURN) return result;
6338 } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
6339 result = call(iterator, f, step.value, entries);
6340 if (result === BREAK || result === RETURN) return result;
6341 }
6342};
6343exports.BREAK = BREAK;
6344exports.RETURN = RETURN;
6345
6346
6347/***/ }),
6348/* 179 */
6349/***/ (function(module, exports, __webpack_require__) {
6350
6351// call something on iterator step with safe closing on error
6352var anObject = __webpack_require__(16);
6353module.exports = function (iterator, fn, value, entries) {
6354 try {
6355 return entries ? fn(anObject(value)[0], value[1]) : fn(value);
6356 // 7.4.6 IteratorClose(iterator, completion)
6357 } catch (e) {
6358 var ret = iterator['return'];
6359 if (ret !== undefined) anObject(ret.call(iterator));
6360 throw e;
6361 }
6362};
6363
6364
6365/***/ }),
6366/* 180 */
6367/***/ (function(module, exports, __webpack_require__) {
6368
6369// check on default Array iterator
6370var Iterators = __webpack_require__(30);
6371var ITERATOR = __webpack_require__(7)('iterator');
6372var ArrayProto = Array.prototype;
6373
6374module.exports = function (it) {
6375 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
6376};
6377
6378
6379/***/ }),
6380/* 181 */
6381/***/ (function(module, exports) {
6382
6383// fast apply, http://jsperf.lnkit.com/fast-apply/5
6384module.exports = function (fn, args, that) {
6385 var un = that === undefined;
6386 switch (args.length) {
6387 case 0: return un ? fn()
6388 : fn.call(that);
6389 case 1: return un ? fn(args[0])
6390 : fn.call(that, args[0]);
6391 case 2: return un ? fn(args[0], args[1])
6392 : fn.call(that, args[0], args[1]);
6393 case 3: return un ? fn(args[0], args[1], args[2])
6394 : fn.call(that, args[0], args[1], args[2]);
6395 case 4: return un ? fn(args[0], args[1], args[2], args[3])
6396 : fn.call(that, args[0], args[1], args[2], args[3]);
6397 } return fn.apply(that, args);
6398};
6399
6400
6401/***/ }),
6402/* 182 */
6403/***/ (function(module, exports, __webpack_require__) {
6404
6405var global = __webpack_require__(6);
6406var macrotask = __webpack_require__(101).set;
6407var Observer = global.MutationObserver || global.WebKitMutationObserver;
6408var process = global.process;
6409var Promise = global.Promise;
6410var isNode = __webpack_require__(40)(process) == 'process';
6411
6412module.exports = function () {
6413 var head, last, notify;
6414
6415 var flush = function () {
6416 var parent, fn;
6417 if (isNode && (parent = process.domain)) parent.exit();
6418 while (head) {
6419 fn = head.fn;
6420 head = head.next;
6421 try {
6422 fn();
6423 } catch (e) {
6424 if (head) notify();
6425 else last = undefined;
6426 throw e;
6427 }
6428 } last = undefined;
6429 if (parent) parent.enter();
6430 };
6431
6432 // Node.js
6433 if (isNode) {
6434 notify = function () {
6435 process.nextTick(flush);
6436 };
6437 // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
6438 } else if (Observer && !(global.navigator && global.navigator.standalone)) {
6439 var toggle = true;
6440 var node = document.createTextNode('');
6441 new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
6442 notify = function () {
6443 node.data = toggle = !toggle;
6444 };
6445 // environments with maybe non-completely correct, but existent Promise
6446 } else if (Promise && Promise.resolve) {
6447 // Promise.resolve without an argument throws an error in LG WebOS 2
6448 var promise = Promise.resolve(undefined);
6449 notify = function () {
6450 promise.then(flush);
6451 };
6452 // for other environments - macrotask based on:
6453 // - setImmediate
6454 // - MessageChannel
6455 // - window.postMessag
6456 // - onreadystatechange
6457 // - setTimeout
6458 } else {
6459 notify = function () {
6460 // strange IE + webpack dev server bug - use .call(global)
6461 macrotask.call(global, flush);
6462 };
6463 }
6464
6465 return function (fn) {
6466 var task = { fn: fn, next: undefined };
6467 if (last) last.next = task;
6468 if (!head) {
6469 head = task;
6470 notify();
6471 } last = task;
6472 };
6473};
6474
6475
6476/***/ }),
6477/* 183 */
6478/***/ (function(module, exports, __webpack_require__) {
6479
6480var global = __webpack_require__(6);
6481var navigator = global.navigator;
6482
6483module.exports = navigator && navigator.userAgent || '';
6484
6485
6486/***/ }),
6487/* 184 */
6488/***/ (function(module, exports, __webpack_require__) {
6489
6490var hide = __webpack_require__(24);
6491module.exports = function (target, src, safe) {
6492 for (var key in src) {
6493 if (safe && target[key]) target[key] = src[key];
6494 else hide(target, key, src[key]);
6495 } return target;
6496};
6497
6498
6499/***/ }),
6500/* 185 */
6501/***/ (function(module, exports, __webpack_require__) {
6502
6503"use strict";
6504
6505var global = __webpack_require__(6);
6506var core = __webpack_require__(2);
6507var dP = __webpack_require__(19);
6508var DESCRIPTORS = __webpack_require__(21);
6509var SPECIES = __webpack_require__(7)('species');
6510
6511module.exports = function (KEY) {
6512 var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
6513 if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
6514 configurable: true,
6515 get: function () { return this; }
6516 });
6517};
6518
6519
6520/***/ }),
6521/* 186 */
6522/***/ (function(module, exports, __webpack_require__) {
6523
6524var ITERATOR = __webpack_require__(7)('iterator');
6525var SAFE_CLOSING = false;
6526
6527try {
6528 var riter = [7][ITERATOR]();
6529 riter['return'] = function () { SAFE_CLOSING = true; };
6530 // eslint-disable-next-line no-throw-literal
6531 Array.from(riter, function () { throw 2; });
6532} catch (e) { /* empty */ }
6533
6534module.exports = function (exec, skipClosing) {
6535 if (!skipClosing && !SAFE_CLOSING) return false;
6536 var safe = false;
6537 try {
6538 var arr = [7];
6539 var iter = arr[ITERATOR]();
6540 iter.next = function () { return { done: safe = true }; };
6541 arr[ITERATOR] = function () { return iter; };
6542 exec(arr);
6543 } catch (e) { /* empty */ }
6544 return safe;
6545};
6546
6547
6548/***/ }),
6549/* 187 */
6550/***/ (function(module, exports, __webpack_require__) {
6551
6552"use strict";
6553// https://github.com/tc39/proposal-promise-finally
6554
6555var $export = __webpack_require__(17);
6556var core = __webpack_require__(2);
6557var global = __webpack_require__(6);
6558var speciesConstructor = __webpack_require__(100);
6559var promiseResolve = __webpack_require__(103);
6560
6561$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
6562 var C = speciesConstructor(this, core.Promise || global.Promise);
6563 var isFunction = typeof onFinally == 'function';
6564 return this.then(
6565 isFunction ? function (x) {
6566 return promiseResolve(C, onFinally()).then(function () { return x; });
6567 } : onFinally,
6568 isFunction ? function (e) {
6569 return promiseResolve(C, onFinally()).then(function () { throw e; });
6570 } : onFinally
6571 );
6572} });
6573
6574
6575/***/ }),
6576/* 188 */
6577/***/ (function(module, exports, __webpack_require__) {
6578
6579"use strict";
6580
6581// https://github.com/tc39/proposal-promise-try
6582var $export = __webpack_require__(17);
6583var newPromiseCapability = __webpack_require__(69);
6584var perform = __webpack_require__(102);
6585
6586$export($export.S, 'Promise', { 'try': function (callbackfn) {
6587 var promiseCapability = newPromiseCapability.f(this);
6588 var result = perform(callbackfn);
6589 (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
6590 return promiseCapability.promise;
6591} });
6592
6593
6594/***/ }),
6595/* 189 */
6596/***/ (function(module, __webpack_exports__, __webpack_require__) {
6597
6598"use strict";
6599/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(70);
6600// Default Export
6601// ==============
6602// In this module, we mix our bundled exports into the `_` object and export
6603// the result. This is analogous to setting `module.exports = _` in CommonJS.
6604// Hence, this module is also the entry point of our UMD bundle and the package
6605// entry point for CommonJS and AMD users. In other words, this is (the source
6606// of) the module you are interfacing with when you do any of the following:
6607//
6608// ```js
6609// // CommonJS
6610// var _ = require('underscore');
6611//
6612// // AMD
6613// define(['underscore'], function(_) {...});
6614//
6615// // UMD in the browser
6616// // _ is available as a global variable
6617// ```
6618
6619
6620
6621// Add all of the Underscore functions to the wrapper object.
6622var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
6623// Legacy Node.js API.
6624_._ = _;
6625// Export the Underscore API.
6626/* harmony default export */ __webpack_exports__["a"] = (_);
6627
6628
6629/***/ }),
6630/* 190 */
6631/***/ (function(module, __webpack_exports__, __webpack_require__) {
6632
6633"use strict";
6634/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
6635// Is a given value equal to null?
6636function isNull(obj) {
6637 return obj === null;
6638}
6639
6640
6641/***/ }),
6642/* 191 */
6643/***/ (function(module, __webpack_exports__, __webpack_require__) {
6644
6645"use strict";
6646/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
6647// Is a given value a DOM element?
6648function isElement(obj) {
6649 return !!(obj && obj.nodeType === 1);
6650}
6651
6652
6653/***/ }),
6654/* 192 */
6655/***/ (function(module, __webpack_exports__, __webpack_require__) {
6656
6657"use strict";
6658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6659
6660
6661/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
6662
6663
6664/***/ }),
6665/* 193 */
6666/***/ (function(module, __webpack_exports__, __webpack_require__) {
6667
6668"use strict";
6669/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6670
6671
6672/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
6673
6674
6675/***/ }),
6676/* 194 */
6677/***/ (function(module, __webpack_exports__, __webpack_require__) {
6678
6679"use strict";
6680/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6681
6682
6683/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
6684
6685
6686/***/ }),
6687/* 195 */
6688/***/ (function(module, __webpack_exports__, __webpack_require__) {
6689
6690"use strict";
6691/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6692
6693
6694/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
6695
6696
6697/***/ }),
6698/* 196 */
6699/***/ (function(module, __webpack_exports__, __webpack_require__) {
6700
6701"use strict";
6702/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
6703/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
6704/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(108);
6705
6706
6707
6708// Is a given object a finite number?
6709function isFinite(obj) {
6710 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
6711}
6712
6713
6714/***/ }),
6715/* 197 */
6716/***/ (function(module, __webpack_exports__, __webpack_require__) {
6717
6718"use strict";
6719/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(113);
6720/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(74);
6721
6722
6723
6724// Internal helper to determine whether we should spend extensive checks against
6725// `ArrayBuffer` et al.
6726/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
6727
6728
6729/***/ }),
6730/* 198 */
6731/***/ (function(module, __webpack_exports__, __webpack_require__) {
6732
6733"use strict";
6734/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
6735/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
6736/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(28);
6737/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(71);
6738/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(73);
6739/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(3);
6740
6741
6742
6743
6744
6745
6746// Is a given array, string, or object empty?
6747// An "empty" object has no enumerable own-properties.
6748function isEmpty(obj) {
6749 if (obj == null) return true;
6750 // Skip the more expensive `toString`-based type checks if `obj` has no
6751 // `.length`.
6752 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
6753 if (typeof length == 'number' && (
6754 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)
6755 )) return length === 0;
6756 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
6757}
6758
6759
6760/***/ }),
6761/* 199 */
6762/***/ (function(module, __webpack_exports__, __webpack_require__) {
6763
6764"use strict";
6765/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
6766/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
6767/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
6768/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(74);
6769/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(111);
6770/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(13);
6771/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(41);
6772/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(72);
6773/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(3);
6774/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(22);
6775/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(200);
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787// We use this string twice, so give it a name for minification.
6788var tagDataView = '[object DataView]';
6789
6790// Internal recursive comparison function for `_.isEqual`.
6791function eq(a, b, aStack, bStack) {
6792 // Identical objects are equal. `0 === -0`, but they aren't identical.
6793 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
6794 if (a === b) return a !== 0 || 1 / a === 1 / b;
6795 // `null` or `undefined` only equal to itself (strict comparison).
6796 if (a == null || b == null) return false;
6797 // `NaN`s are equivalent, but non-reflexive.
6798 if (a !== a) return b !== b;
6799 // Exhaust primitive checks
6800 var type = typeof a;
6801 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
6802 return deepEq(a, b, aStack, bStack);
6803}
6804
6805// Internal recursive comparison function for `_.isEqual`.
6806function deepEq(a, b, aStack, bStack) {
6807 // Unwrap any wrapped objects.
6808 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
6809 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
6810 // Compare `[[Class]]` names.
6811 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
6812 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
6813 // Work around a bug in IE 10 - Edge 13.
6814 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
6815 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
6816 className = tagDataView;
6817 }
6818 switch (className) {
6819 // These types are compared by value.
6820 case '[object RegExp]':
6821 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
6822 case '[object String]':
6823 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
6824 // equivalent to `new String("5")`.
6825 return '' + a === '' + b;
6826 case '[object Number]':
6827 // `NaN`s are equivalent, but non-reflexive.
6828 // Object(NaN) is equivalent to NaN.
6829 if (+a !== +a) return +b !== +b;
6830 // An `egal` comparison is performed for other numeric values.
6831 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
6832 case '[object Date]':
6833 case '[object Boolean]':
6834 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
6835 // millisecond representations. Note that invalid dates with millisecond representations
6836 // of `NaN` are not equivalent.
6837 return +a === +b;
6838 case '[object Symbol]':
6839 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
6840 case '[object ArrayBuffer]':
6841 case tagDataView:
6842 // Coerce to typed array so we can fall through.
6843 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
6844 }
6845
6846 var areArrays = className === '[object Array]';
6847 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
6848 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
6849 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
6850 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
6851 areArrays = true;
6852 }
6853 if (!areArrays) {
6854 if (typeof a != 'object' || typeof b != 'object') return false;
6855
6856 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
6857 // from different frames are.
6858 var aCtor = a.constructor, bCtor = b.constructor;
6859 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
6860 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
6861 && ('constructor' in a && 'constructor' in b)) {
6862 return false;
6863 }
6864 }
6865 // Assume equality for cyclic structures. The algorithm for detecting cyclic
6866 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
6867
6868 // Initializing stack of traversed objects.
6869 // It's done here since we only need them for objects and arrays comparison.
6870 aStack = aStack || [];
6871 bStack = bStack || [];
6872 var length = aStack.length;
6873 while (length--) {
6874 // Linear search. Performance is inversely proportional to the number of
6875 // unique nested structures.
6876 if (aStack[length] === a) return bStack[length] === b;
6877 }
6878
6879 // Add the first object to the stack of traversed objects.
6880 aStack.push(a);
6881 bStack.push(b);
6882
6883 // Recursively compare objects and arrays.
6884 if (areArrays) {
6885 // Compare array lengths to determine if a deep comparison is necessary.
6886 length = a.length;
6887 if (length !== b.length) return false;
6888 // Deep compare the contents, ignoring non-numeric properties.
6889 while (length--) {
6890 if (!eq(a[length], b[length], aStack, bStack)) return false;
6891 }
6892 } else {
6893 // Deep compare objects.
6894 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
6895 length = _keys.length;
6896 // Ensure that both objects contain the same number of properties before comparing deep equality.
6897 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
6898 while (length--) {
6899 // Deep compare each member
6900 key = _keys[length];
6901 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
6902 }
6903 }
6904 // Remove the first object from the stack of traversed objects.
6905 aStack.pop();
6906 bStack.pop();
6907 return true;
6908}
6909
6910// Perform a deep comparison to check if two objects are equal.
6911function isEqual(a, b) {
6912 return eq(a, b);
6913}
6914
6915
6916/***/ }),
6917/* 200 */
6918/***/ (function(module, __webpack_exports__, __webpack_require__) {
6919
6920"use strict";
6921/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
6922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(74);
6923
6924
6925// Internal function to wrap or shallow-copy an ArrayBuffer,
6926// typed array or DataView to a new view, reusing the buffer.
6927function toBufferView(bufferSource) {
6928 return new Uint8Array(
6929 bufferSource.buffer || bufferSource,
6930 bufferSource.byteOffset || 0,
6931 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
6932 );
6933}
6934
6935
6936/***/ }),
6937/* 201 */
6938/***/ (function(module, __webpack_exports__, __webpack_require__) {
6939
6940"use strict";
6941/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(41);
6943/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(75);
6944
6945
6946
6947
6948/* 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'));
6949
6950
6951/***/ }),
6952/* 202 */
6953/***/ (function(module, __webpack_exports__, __webpack_require__) {
6954
6955"use strict";
6956/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6957/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(41);
6958/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(75);
6959
6960
6961
6962
6963/* 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'));
6964
6965
6966/***/ }),
6967/* 203 */
6968/***/ (function(module, __webpack_exports__, __webpack_require__) {
6969
6970"use strict";
6971/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6972/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(41);
6973/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(75);
6974
6975
6976
6977
6978/* 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'));
6979
6980
6981/***/ }),
6982/* 204 */
6983/***/ (function(module, __webpack_exports__, __webpack_require__) {
6984
6985"use strict";
6986/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6987
6988
6989/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
6990
6991
6992/***/ }),
6993/* 205 */
6994/***/ (function(module, __webpack_exports__, __webpack_require__) {
6995
6996"use strict";
6997/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
6998/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
6999
7000
7001// Convert an object into a list of `[key, value]` pairs.
7002// The opposite of `_.object` with one argument.
7003function pairs(obj) {
7004 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
7005 var length = _keys.length;
7006 var pairs = Array(length);
7007 for (var i = 0; i < length; i++) {
7008 pairs[i] = [_keys[i], obj[_keys[i]]];
7009 }
7010 return pairs;
7011}
7012
7013
7014/***/ }),
7015/* 206 */
7016/***/ (function(module, __webpack_exports__, __webpack_require__) {
7017
7018"use strict";
7019/* harmony export (immutable) */ __webpack_exports__["a"] = create;
7020/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(121);
7021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(77);
7022
7023
7024
7025// Creates an object that inherits from the given prototype object.
7026// If additional properties are provided then they will be added to the
7027// created object.
7028function create(prototype, props) {
7029 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
7030 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
7031 return result;
7032}
7033
7034
7035/***/ }),
7036/* 207 */
7037/***/ (function(module, __webpack_exports__, __webpack_require__) {
7038
7039"use strict";
7040/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
7041// Invokes `interceptor` with the `obj` and then returns `obj`.
7042// The primary purpose of this method is to "tap into" a method chain, in
7043// order to perform operations on intermediate results within the chain.
7044function tap(obj, interceptor) {
7045 interceptor(obj);
7046 return obj;
7047}
7048
7049
7050/***/ }),
7051/* 208 */
7052/***/ (function(module, __webpack_exports__, __webpack_require__) {
7053
7054"use strict";
7055/* harmony export (immutable) */ __webpack_exports__["a"] = has;
7056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(22);
7057/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(43);
7058
7059
7060
7061// Shortcut function for checking if an object has a given property directly on
7062// itself (in other words, not on a prototype). Unlike the internal `has`
7063// function, this public version can also traverse nested properties.
7064function has(obj, path) {
7065 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
7066 var length = path.length;
7067 for (var i = 0; i < length; i++) {
7068 var key = path[i];
7069 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
7070 obj = obj[key];
7071 }
7072 return !!length;
7073}
7074
7075
7076/***/ }),
7077/* 209 */
7078/***/ (function(module, __webpack_exports__, __webpack_require__) {
7079
7080"use strict";
7081/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
7082/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7083/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
7084
7085
7086
7087// Returns the results of applying the `iteratee` to each element of `obj`.
7088// In contrast to `_.map` it returns an object.
7089function mapObject(obj, iteratee, context) {
7090 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
7091 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
7092 length = _keys.length,
7093 results = {};
7094 for (var index = 0; index < length; index++) {
7095 var currentKey = _keys[index];
7096 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
7097 }
7098 return results;
7099}
7100
7101
7102/***/ }),
7103/* 210 */
7104/***/ (function(module, __webpack_exports__, __webpack_require__) {
7105
7106"use strict";
7107/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
7108/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(127);
7109/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(123);
7110
7111
7112
7113// Generates a function for a given object that returns a given property.
7114function propertyOf(obj) {
7115 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
7116 return function(path) {
7117 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
7118 };
7119}
7120
7121
7122/***/ }),
7123/* 211 */
7124/***/ (function(module, __webpack_exports__, __webpack_require__) {
7125
7126"use strict";
7127/* harmony export (immutable) */ __webpack_exports__["a"] = times;
7128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(44);
7129
7130
7131// Run a function **n** times.
7132function times(n, iteratee, context) {
7133 var accum = Array(Math.max(0, n));
7134 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
7135 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
7136 return accum;
7137}
7138
7139
7140/***/ }),
7141/* 212 */
7142/***/ (function(module, __webpack_exports__, __webpack_require__) {
7143
7144"use strict";
7145/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(129);
7146/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(130);
7147
7148
7149
7150// Function for escaping strings to HTML interpolation.
7151/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
7152
7153
7154/***/ }),
7155/* 213 */
7156/***/ (function(module, __webpack_exports__, __webpack_require__) {
7157
7158"use strict";
7159/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(129);
7160/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(214);
7161
7162
7163
7164// Function for unescaping strings from HTML interpolation.
7165/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
7166
7167
7168/***/ }),
7169/* 214 */
7170/***/ (function(module, __webpack_exports__, __webpack_require__) {
7171
7172"use strict";
7173/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(117);
7174/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(130);
7175
7176
7177
7178// Internal list of HTML entities for unescaping.
7179/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
7180
7181
7182/***/ }),
7183/* 215 */
7184/***/ (function(module, __webpack_exports__, __webpack_require__) {
7185
7186"use strict";
7187/* harmony export (immutable) */ __webpack_exports__["a"] = template;
7188/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(120);
7189/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(10);
7190/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(131);
7191
7192
7193
7194
7195// When customizing `_.templateSettings`, if you don't want to define an
7196// interpolation, evaluation or escaping regex, we need one that is
7197// guaranteed not to match.
7198var noMatch = /(.)^/;
7199
7200// Certain characters need to be escaped so that they can be put into a
7201// string literal.
7202var escapes = {
7203 "'": "'",
7204 '\\': '\\',
7205 '\r': 'r',
7206 '\n': 'n',
7207 '\u2028': 'u2028',
7208 '\u2029': 'u2029'
7209};
7210
7211var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
7212
7213function escapeChar(match) {
7214 return '\\' + escapes[match];
7215}
7216
7217var bareIdentifier = /^\s*(\w|\$)+\s*$/;
7218
7219// JavaScript micro-templating, similar to John Resig's implementation.
7220// Underscore templating handles arbitrary delimiters, preserves whitespace,
7221// and correctly escapes quotes within interpolated code.
7222// NB: `oldSettings` only exists for backwards compatibility.
7223function template(text, settings, oldSettings) {
7224 if (!settings && oldSettings) settings = oldSettings;
7225 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
7226
7227 // Combine delimiters into one regular expression via alternation.
7228 var matcher = RegExp([
7229 (settings.escape || noMatch).source,
7230 (settings.interpolate || noMatch).source,
7231 (settings.evaluate || noMatch).source
7232 ].join('|') + '|$', 'g');
7233
7234 // Compile the template source, escaping string literals appropriately.
7235 var index = 0;
7236 var source = "__p+='";
7237 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
7238 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
7239 index = offset + match.length;
7240
7241 if (escape) {
7242 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
7243 } else if (interpolate) {
7244 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
7245 } else if (evaluate) {
7246 source += "';\n" + evaluate + "\n__p+='";
7247 }
7248
7249 // Adobe VMs need the match returned to produce the correct offset.
7250 return match;
7251 });
7252 source += "';\n";
7253
7254 var argument = settings.variable;
7255 if (argument) {
7256 if (!bareIdentifier.test(argument)) throw new Error(argument);
7257 } else {
7258 // If a variable is not specified, place data values in local scope.
7259 source = 'with(obj||{}){\n' + source + '}\n';
7260 argument = 'obj';
7261 }
7262
7263 source = "var __t,__p='',__j=Array.prototype.join," +
7264 "print=function(){__p+=__j.call(arguments,'');};\n" +
7265 source + 'return __p;\n';
7266
7267 var render;
7268 try {
7269 render = new Function(argument, '_', source);
7270 } catch (e) {
7271 e.source = source;
7272 throw e;
7273 }
7274
7275 var template = function(data) {
7276 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
7277 };
7278
7279 // Provide the compiled source as a convenience for precompilation.
7280 template.source = 'function(' + argument + '){\n' + source + '}';
7281
7282 return template;
7283}
7284
7285
7286/***/ }),
7287/* 216 */
7288/***/ (function(module, __webpack_exports__, __webpack_require__) {
7289
7290"use strict";
7291/* harmony export (immutable) */ __webpack_exports__["a"] = result;
7292/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(13);
7293/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(43);
7294
7295
7296
7297// Traverses the children of `obj` along `path`. If a child is a function, it
7298// is invoked with its parent as context. Returns the value of the final
7299// child, or `fallback` if any child is undefined.
7300function result(obj, path, fallback) {
7301 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
7302 var length = path.length;
7303 if (!length) {
7304 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
7305 }
7306 for (var i = 0; i < length; i++) {
7307 var prop = obj == null ? void 0 : obj[path[i]];
7308 if (prop === void 0) {
7309 prop = fallback;
7310 i = length; // Ensure we don't continue iterating.
7311 }
7312 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
7313 }
7314 return obj;
7315}
7316
7317
7318/***/ }),
7319/* 217 */
7320/***/ (function(module, __webpack_exports__, __webpack_require__) {
7321
7322"use strict";
7323/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
7324// Generate a unique integer id (unique within the entire client session).
7325// Useful for temporary DOM ids.
7326var idCounter = 0;
7327function uniqueId(prefix) {
7328 var id = ++idCounter + '';
7329 return prefix ? prefix + id : id;
7330}
7331
7332
7333/***/ }),
7334/* 218 */
7335/***/ (function(module, __webpack_exports__, __webpack_require__) {
7336
7337"use strict";
7338/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
7339/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
7340
7341
7342// Start chaining a wrapped Underscore object.
7343function chain(obj) {
7344 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
7345 instance._chain = true;
7346 return instance;
7347}
7348
7349
7350/***/ }),
7351/* 219 */
7352/***/ (function(module, __webpack_exports__, __webpack_require__) {
7353
7354"use strict";
7355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
7356/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(32);
7357/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(133);
7358
7359
7360
7361
7362// Bind a number of an object's methods to that object. Remaining arguments
7363// are the method names to be bound. Useful for ensuring that all callbacks
7364// defined on an object belong to it.
7365/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7366 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
7367 var index = keys.length;
7368 if (index < 1) throw new Error('bindAll must be passed function names');
7369 while (index--) {
7370 var key = keys[index];
7371 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
7372 }
7373 return obj;
7374}));
7375
7376
7377/***/ }),
7378/* 220 */
7379/***/ (function(module, __webpack_exports__, __webpack_require__) {
7380
7381"use strict";
7382/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
7383/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(22);
7384
7385
7386// Memoize an expensive function by storing its results.
7387function memoize(func, hasher) {
7388 var memoize = function(key) {
7389 var cache = memoize.cache;
7390 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
7391 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
7392 return cache[address];
7393 };
7394 memoize.cache = {};
7395 return memoize;
7396}
7397
7398
7399/***/ }),
7400/* 221 */
7401/***/ (function(module, __webpack_exports__, __webpack_require__) {
7402
7403"use strict";
7404/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(56);
7405/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(134);
7406/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(10);
7407
7408
7409
7410
7411// Defers a function, scheduling it to run after the current call stack has
7412// cleared.
7413/* 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));
7414
7415
7416/***/ }),
7417/* 222 */
7418/***/ (function(module, __webpack_exports__, __webpack_require__) {
7419
7420"use strict";
7421/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
7422/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(81);
7423
7424
7425// Returns a function, that, when invoked, will only be triggered at most once
7426// during a given window of time. Normally, the throttled function will run
7427// as much as it can, without ever going more than once per `wait` duration;
7428// but if you'd like to disable the execution on the leading edge, pass
7429// `{leading: false}`. To disable execution on the trailing edge, ditto.
7430function throttle(func, wait, options) {
7431 var timeout, context, args, result;
7432 var previous = 0;
7433 if (!options) options = {};
7434
7435 var later = function() {
7436 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
7437 timeout = null;
7438 result = func.apply(context, args);
7439 if (!timeout) context = args = null;
7440 };
7441
7442 var throttled = function() {
7443 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
7444 if (!previous && options.leading === false) previous = _now;
7445 var remaining = wait - (_now - previous);
7446 context = this;
7447 args = arguments;
7448 if (remaining <= 0 || remaining > wait) {
7449 if (timeout) {
7450 clearTimeout(timeout);
7451 timeout = null;
7452 }
7453 previous = _now;
7454 result = func.apply(context, args);
7455 if (!timeout) context = args = null;
7456 } else if (!timeout && options.trailing !== false) {
7457 timeout = setTimeout(later, remaining);
7458 }
7459 return result;
7460 };
7461
7462 throttled.cancel = function() {
7463 clearTimeout(timeout);
7464 previous = 0;
7465 timeout = context = args = null;
7466 };
7467
7468 return throttled;
7469}
7470
7471
7472/***/ }),
7473/* 223 */
7474/***/ (function(module, __webpack_exports__, __webpack_require__) {
7475
7476"use strict";
7477/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
7478/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
7479/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(81);
7480
7481
7482
7483// When a sequence of calls of the returned function ends, the argument
7484// function is triggered. The end of a sequence is defined by the `wait`
7485// parameter. If `immediate` is passed, the argument function will be
7486// triggered at the beginning of the sequence instead of at the end.
7487function debounce(func, wait, immediate) {
7488 var timeout, previous, args, result, context;
7489
7490 var later = function() {
7491 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
7492 if (wait > passed) {
7493 timeout = setTimeout(later, wait - passed);
7494 } else {
7495 timeout = null;
7496 if (!immediate) result = func.apply(context, args);
7497 // This check is needed because `func` can recursively invoke `debounced`.
7498 if (!timeout) args = context = null;
7499 }
7500 };
7501
7502 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
7503 context = this;
7504 args = _args;
7505 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
7506 if (!timeout) {
7507 timeout = setTimeout(later, wait);
7508 if (immediate) result = func.apply(context, args);
7509 }
7510 return result;
7511 });
7512
7513 debounced.cancel = function() {
7514 clearTimeout(timeout);
7515 timeout = args = context = null;
7516 };
7517
7518 return debounced;
7519}
7520
7521
7522/***/ }),
7523/* 224 */
7524/***/ (function(module, __webpack_exports__, __webpack_require__) {
7525
7526"use strict";
7527/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
7528/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(56);
7529
7530
7531// Returns the first function passed as an argument to the second,
7532// allowing you to adjust arguments, run code before and after, and
7533// conditionally execute the original function.
7534function wrap(func, wrapper) {
7535 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
7536}
7537
7538
7539/***/ }),
7540/* 225 */
7541/***/ (function(module, __webpack_exports__, __webpack_require__) {
7542
7543"use strict";
7544/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
7545// Returns a function that is the composition of a list of functions, each
7546// consuming the return value of the function that follows.
7547function compose() {
7548 var args = arguments;
7549 var start = args.length - 1;
7550 return function() {
7551 var i = start;
7552 var result = args[start].apply(this, arguments);
7553 while (i--) result = args[i].call(this, result);
7554 return result;
7555 };
7556}
7557
7558
7559/***/ }),
7560/* 226 */
7561/***/ (function(module, __webpack_exports__, __webpack_require__) {
7562
7563"use strict";
7564/* harmony export (immutable) */ __webpack_exports__["a"] = after;
7565// Returns a function that will only be executed on and after the Nth call.
7566function after(times, func) {
7567 return function() {
7568 if (--times < 1) {
7569 return func.apply(this, arguments);
7570 }
7571 };
7572}
7573
7574
7575/***/ }),
7576/* 227 */
7577/***/ (function(module, __webpack_exports__, __webpack_require__) {
7578
7579"use strict";
7580/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(56);
7581/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(135);
7582
7583
7584
7585// Returns a function that will be executed at most one time, no matter how
7586// often you call it. Useful for lazy initialization.
7587/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
7588
7589
7590/***/ }),
7591/* 228 */
7592/***/ (function(module, __webpack_exports__, __webpack_require__) {
7593
7594"use strict";
7595/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(138);
7596/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(141);
7597
7598
7599
7600// Return the position of the last occurrence of an item in an array,
7601// or -1 if the item is not included in the array.
7602/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
7603
7604
7605/***/ }),
7606/* 229 */
7607/***/ (function(module, __webpack_exports__, __webpack_require__) {
7608
7609"use strict";
7610/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
7611/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(142);
7612/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(55);
7613
7614
7615
7616// Convenience version of a common use case of `_.find`: getting the first
7617// object containing specific `key:value` pairs.
7618function findWhere(obj, attrs) {
7619 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
7620}
7621
7622
7623/***/ }),
7624/* 230 */
7625/***/ (function(module, __webpack_exports__, __webpack_require__) {
7626
7627"use strict";
7628/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(143);
7629
7630
7631// **Reduce** builds up a single result from a list of values, aka `inject`,
7632// or `foldl`.
7633/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
7634
7635
7636/***/ }),
7637/* 231 */
7638/***/ (function(module, __webpack_exports__, __webpack_require__) {
7639
7640"use strict";
7641/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(143);
7642
7643
7644// The right-associative version of reduce, also known as `foldr`.
7645/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
7646
7647
7648/***/ }),
7649/* 232 */
7650/***/ (function(module, __webpack_exports__, __webpack_require__) {
7651
7652"use strict";
7653/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
7654/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(45);
7655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(82);
7656/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(8);
7657
7658
7659
7660
7661// Return all the elements for which a truth test fails.
7662function reject(obj, predicate, context) {
7663 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);
7664}
7665
7666
7667/***/ }),
7668/* 233 */
7669/***/ (function(module, __webpack_exports__, __webpack_require__) {
7670
7671"use strict";
7672/* harmony export (immutable) */ __webpack_exports__["a"] = every;
7673/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7674/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
7675/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(3);
7676
7677
7678
7679
7680// Determine whether all of the elements pass a truth test.
7681function every(obj, predicate, context) {
7682 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
7683 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
7684 length = (_keys || obj).length;
7685 for (var index = 0; index < length; index++) {
7686 var currentKey = _keys ? _keys[index] : index;
7687 if (!predicate(obj[currentKey], currentKey, obj)) return false;
7688 }
7689 return true;
7690}
7691
7692
7693/***/ }),
7694/* 234 */
7695/***/ (function(module, __webpack_exports__, __webpack_require__) {
7696
7697"use strict";
7698/* harmony export (immutable) */ __webpack_exports__["a"] = some;
7699/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7700/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
7701/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(3);
7702
7703
7704
7705
7706// Determine if at least one element in the object passes a truth test.
7707function some(obj, predicate, context) {
7708 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
7709 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
7710 length = (_keys || obj).length;
7711 for (var index = 0; index < length; index++) {
7712 var currentKey = _keys ? _keys[index] : index;
7713 if (predicate(obj[currentKey], currentKey, obj)) return true;
7714 }
7715 return false;
7716}
7717
7718
7719/***/ }),
7720/* 235 */
7721/***/ (function(module, __webpack_exports__, __webpack_require__) {
7722
7723"use strict";
7724/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
7725/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
7726/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(33);
7727/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(78);
7728/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(43);
7729
7730
7731
7732
7733
7734
7735// Invoke a method (with arguments) on every item in a collection.
7736/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
7737 var contextPath, func;
7738 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
7739 func = path;
7740 } else {
7741 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
7742 contextPath = path.slice(0, -1);
7743 path = path[path.length - 1];
7744 }
7745 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
7746 var method = func;
7747 if (!method) {
7748 if (contextPath && contextPath.length) {
7749 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
7750 }
7751 if (context == null) return void 0;
7752 method = context[path];
7753 }
7754 return method == null ? method : method.apply(context, args);
7755 });
7756}));
7757
7758
7759/***/ }),
7760/* 236 */
7761/***/ (function(module, __webpack_exports__, __webpack_require__) {
7762
7763"use strict";
7764/* harmony export (immutable) */ __webpack_exports__["a"] = where;
7765/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(45);
7766/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(55);
7767
7768
7769
7770// Convenience version of a common use case of `_.filter`: selecting only
7771// objects containing specific `key:value` pairs.
7772function where(obj, attrs) {
7773 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
7774}
7775
7776
7777/***/ }),
7778/* 237 */
7779/***/ (function(module, __webpack_exports__, __webpack_require__) {
7780
7781"use strict";
7782/* harmony export (immutable) */ __webpack_exports__["a"] = min;
7783/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
7784/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(31);
7785/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(8);
7786/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(29);
7787
7788
7789
7790
7791
7792// Return the minimum element (or element-based computation).
7793function min(obj, iteratee, context) {
7794 var result = Infinity, lastComputed = Infinity,
7795 value, computed;
7796 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
7797 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
7798 for (var i = 0, length = obj.length; i < length; i++) {
7799 value = obj[i];
7800 if (value != null && value < result) {
7801 result = value;
7802 }
7803 }
7804 } else {
7805 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
7806 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
7807 computed = iteratee(v, index, list);
7808 if (computed < lastComputed || computed === Infinity && result === Infinity) {
7809 result = v;
7810 lastComputed = computed;
7811 }
7812 });
7813 }
7814 return result;
7815}
7816
7817
7818/***/ }),
7819/* 238 */
7820/***/ (function(module, __webpack_exports__, __webpack_require__) {
7821
7822"use strict";
7823/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
7824/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(145);
7825
7826
7827// Shuffle a collection.
7828function shuffle(obj) {
7829 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
7830}
7831
7832
7833/***/ }),
7834/* 239 */
7835/***/ (function(module, __webpack_exports__, __webpack_require__) {
7836
7837"use strict";
7838/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
7839/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7840/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(84);
7841/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(33);
7842
7843
7844
7845
7846// Sort the object's values by a criterion produced by an iteratee.
7847function sortBy(obj, iteratee, context) {
7848 var index = 0;
7849 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
7850 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
7851 return {
7852 value: value,
7853 index: index++,
7854 criteria: iteratee(value, key, list)
7855 };
7856 }).sort(function(left, right) {
7857 var a = left.criteria;
7858 var b = right.criteria;
7859 if (a !== b) {
7860 if (a > b || a === void 0) return 1;
7861 if (a < b || b === void 0) return -1;
7862 }
7863 return left.index - right.index;
7864 }), 'value');
7865}
7866
7867
7868/***/ }),
7869/* 240 */
7870/***/ (function(module, __webpack_exports__, __webpack_require__) {
7871
7872"use strict";
7873/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(57);
7874/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(22);
7875
7876
7877
7878// Groups the object's values by a criterion. Pass either a string attribute
7879// to group by, or a function that returns the criterion.
7880/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
7881 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
7882}));
7883
7884
7885/***/ }),
7886/* 241 */
7887/***/ (function(module, __webpack_exports__, __webpack_require__) {
7888
7889"use strict";
7890/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(57);
7891
7892
7893// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
7894// when you know that your index values will be unique.
7895/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
7896 result[key] = value;
7897}));
7898
7899
7900/***/ }),
7901/* 242 */
7902/***/ (function(module, __webpack_exports__, __webpack_require__) {
7903
7904"use strict";
7905/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(57);
7906/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(22);
7907
7908
7909
7910// Counts instances of an object that group by a certain criterion. Pass
7911// either a string attribute to count by, or a function that returns the
7912// criterion.
7913/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
7914 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
7915}));
7916
7917
7918/***/ }),
7919/* 243 */
7920/***/ (function(module, __webpack_exports__, __webpack_require__) {
7921
7922"use strict";
7923/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(57);
7924
7925
7926// Split a collection into two arrays: one whose elements all pass the given
7927// truth test, and one whose elements all do not pass the truth test.
7928/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
7929 result[pass ? 0 : 1].push(value);
7930}, true));
7931
7932
7933/***/ }),
7934/* 244 */
7935/***/ (function(module, __webpack_exports__, __webpack_require__) {
7936
7937"use strict";
7938/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
7939/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(28);
7940/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
7941/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(71);
7942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(11);
7943/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(33);
7944/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(79);
7945/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(31);
7946
7947
7948
7949
7950
7951
7952
7953
7954// Safely create a real, live array from anything iterable.
7955var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
7956function toArray(obj) {
7957 if (!obj) return [];
7958 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
7959 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
7960 // Keep surrogate pair characters together.
7961 return obj.match(reStrSymbol);
7962 }
7963 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 */]);
7964 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
7965}
7966
7967
7968/***/ }),
7969/* 245 */
7970/***/ (function(module, __webpack_exports__, __webpack_require__) {
7971
7972"use strict";
7973/* harmony export (immutable) */ __webpack_exports__["a"] = size;
7974/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
7975/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
7976
7977
7978
7979// Return the number of elements in a collection.
7980function size(obj) {
7981 if (obj == null) return 0;
7982 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
7983}
7984
7985
7986/***/ }),
7987/* 246 */
7988/***/ (function(module, __webpack_exports__, __webpack_require__) {
7989
7990"use strict";
7991/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
7992// Internal `_.pick` helper function to determine whether `key` is an enumerable
7993// property name of `obj`.
7994function keyInObj(value, key, obj) {
7995 return key in obj;
7996}
7997
7998
7999/***/ }),
8000/* 247 */
8001/***/ (function(module, __webpack_exports__, __webpack_require__) {
8002
8003"use strict";
8004/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8005/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
8006/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(82);
8007/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(33);
8008/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(32);
8009/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(46);
8010/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(146);
8011
8012
8013
8014
8015
8016
8017
8018
8019// Return a copy of the object without the disallowed properties.
8020/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
8021 var iteratee = keys[0], context;
8022 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
8023 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
8024 if (keys.length > 1) context = keys[1];
8025 } else {
8026 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
8027 iteratee = function(value, key) {
8028 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
8029 };
8030 }
8031 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
8032}));
8033
8034
8035/***/ }),
8036/* 248 */
8037/***/ (function(module, __webpack_exports__, __webpack_require__) {
8038
8039"use strict";
8040/* harmony export (immutable) */ __webpack_exports__["a"] = first;
8041/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(147);
8042
8043
8044// Get the first element of an array. Passing **n** will return the first N
8045// values in the array. The **guard** check allows it to work with `_.map`.
8046function first(array, n, guard) {
8047 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
8048 if (n == null || guard) return array[0];
8049 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
8050}
8051
8052
8053/***/ }),
8054/* 249 */
8055/***/ (function(module, __webpack_exports__, __webpack_require__) {
8056
8057"use strict";
8058/* harmony export (immutable) */ __webpack_exports__["a"] = last;
8059/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(148);
8060
8061
8062// Get the last element of an array. Passing **n** will return the last N
8063// values in the array.
8064function last(array, n, guard) {
8065 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
8066 if (n == null || guard) return array[array.length - 1];
8067 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
8068}
8069
8070
8071/***/ }),
8072/* 250 */
8073/***/ (function(module, __webpack_exports__, __webpack_require__) {
8074
8075"use strict";
8076/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
8077/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(45);
8078
8079
8080// Trim out all falsy values from an array.
8081function compact(array) {
8082 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
8083}
8084
8085
8086/***/ }),
8087/* 251 */
8088/***/ (function(module, __webpack_exports__, __webpack_require__) {
8089
8090"use strict";
8091/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
8092/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(32);
8093
8094
8095// Flatten out an array, either recursively (by default), or up to `depth`.
8096// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
8097function flatten(array, depth) {
8098 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
8099}
8100
8101
8102/***/ }),
8103/* 252 */
8104/***/ (function(module, __webpack_exports__, __webpack_require__) {
8105
8106"use strict";
8107/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8108/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(149);
8109
8110
8111
8112// Return a version of the array that does not contain the specified value(s).
8113/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
8114 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
8115}));
8116
8117
8118/***/ }),
8119/* 253 */
8120/***/ (function(module, __webpack_exports__, __webpack_require__) {
8121
8122"use strict";
8123/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(150);
8125/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(32);
8126
8127
8128
8129
8130// Produce an array that contains the union: each distinct element from all of
8131// the passed-in arrays.
8132/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
8133 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
8134}));
8135
8136
8137/***/ }),
8138/* 254 */
8139/***/ (function(module, __webpack_exports__, __webpack_require__) {
8140
8141"use strict";
8142/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
8143/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
8144/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(46);
8145
8146
8147
8148// Produce an array that contains every item shared between all the
8149// passed-in arrays.
8150function intersection(array) {
8151 var result = [];
8152 var argsLength = arguments.length;
8153 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
8154 var item = array[i];
8155 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
8156 var j;
8157 for (j = 1; j < argsLength; j++) {
8158 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
8159 }
8160 if (j === argsLength) result.push(item);
8161 }
8162 return result;
8163}
8164
8165
8166/***/ }),
8167/* 255 */
8168/***/ (function(module, __webpack_exports__, __webpack_require__) {
8169
8170"use strict";
8171/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8172/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(151);
8173
8174
8175
8176// Zip together multiple lists into a single array -- elements that share
8177// an index go together.
8178/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
8179
8180
8181/***/ }),
8182/* 256 */
8183/***/ (function(module, __webpack_exports__, __webpack_require__) {
8184
8185"use strict";
8186/* harmony export (immutable) */ __webpack_exports__["a"] = object;
8187/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
8188
8189
8190// Converts lists into objects. Pass either a single array of `[key, value]`
8191// pairs, or two parallel arrays of the same length -- one of keys, and one of
8192// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
8193function object(list, values) {
8194 var result = {};
8195 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
8196 if (values) {
8197 result[list[i]] = values[i];
8198 } else {
8199 result[list[i][0]] = list[i][1];
8200 }
8201 }
8202 return result;
8203}
8204
8205
8206/***/ }),
8207/* 257 */
8208/***/ (function(module, __webpack_exports__, __webpack_require__) {
8209
8210"use strict";
8211/* harmony export (immutable) */ __webpack_exports__["a"] = range;
8212// Generate an integer Array containing an arithmetic progression. A port of
8213// the native Python `range()` function. See
8214// [the Python documentation](https://docs.python.org/library/functions.html#range).
8215function range(start, stop, step) {
8216 if (stop == null) {
8217 stop = start || 0;
8218 start = 0;
8219 }
8220 if (!step) {
8221 step = stop < start ? -1 : 1;
8222 }
8223
8224 var length = Math.max(Math.ceil((stop - start) / step), 0);
8225 var range = Array(length);
8226
8227 for (var idx = 0; idx < length; idx++, start += step) {
8228 range[idx] = start;
8229 }
8230
8231 return range;
8232}
8233
8234
8235/***/ }),
8236/* 258 */
8237/***/ (function(module, __webpack_exports__, __webpack_require__) {
8238
8239"use strict";
8240/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
8241/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
8242
8243
8244// Chunk a single array into multiple arrays, each containing `count` or fewer
8245// items.
8246function chunk(array, count) {
8247 if (count == null || count < 1) return [];
8248 var result = [];
8249 var i = 0, length = array.length;
8250 while (i < length) {
8251 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
8252 }
8253 return result;
8254}
8255
8256
8257/***/ }),
8258/* 259 */
8259/***/ (function(module, __webpack_exports__, __webpack_require__) {
8260
8261"use strict";
8262/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
8263/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
8264/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(29);
8265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(118);
8266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(1);
8267/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(152);
8268
8269
8270
8271
8272
8273
8274// Add your own custom functions to the Underscore object.
8275function mixin(obj) {
8276 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
8277 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
8278 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8279 var args = [this._wrapped];
8280 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
8281 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
8282 };
8283 });
8284 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
8285}
8286
8287
8288/***/ }),
8289/* 260 */
8290/***/ (function(module, __webpack_exports__, __webpack_require__) {
8291
8292"use strict";
8293/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
8294/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(29);
8295/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(1);
8296/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(152);
8297
8298
8299
8300
8301
8302// Add all mutator `Array` functions to the wrapper.
8303Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
8304 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
8305 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8306 var obj = this._wrapped;
8307 if (obj != null) {
8308 method.apply(obj, arguments);
8309 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
8310 delete obj[0];
8311 }
8312 }
8313 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
8314 };
8315});
8316
8317// Add all accessor `Array` functions to the wrapper.
8318Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
8319 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
8320 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8321 var obj = this._wrapped;
8322 if (obj != null) obj = method.apply(obj, arguments);
8323 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
8324 };
8325});
8326
8327/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
8328
8329
8330/***/ }),
8331/* 261 */
8332/***/ (function(module, exports, __webpack_require__) {
8333
8334var core = __webpack_require__(2);
8335var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
8336module.exports = function stringify(it) { // eslint-disable-line no-unused-vars
8337 return $JSON.stringify.apply($JSON, arguments);
8338};
8339
8340
8341/***/ }),
8342/* 262 */
8343/***/ (function(module, exports, __webpack_require__) {
8344
8345__webpack_require__(263);
8346module.exports = __webpack_require__(2).Object.keys;
8347
8348
8349/***/ }),
8350/* 263 */
8351/***/ (function(module, exports, __webpack_require__) {
8352
8353// 19.1.2.14 Object.keys(O)
8354var toObject = __webpack_require__(53);
8355var $keys = __webpack_require__(50);
8356
8357__webpack_require__(85)('keys', function () {
8358 return function keys(it) {
8359 return $keys(toObject(it));
8360 };
8361});
8362
8363
8364/***/ }),
8365/* 264 */
8366/***/ (function(module, exports) {
8367
8368// Unique ID creation requires a high quality random # generator. In the
8369// browser this is a little complicated due to unknown quality of Math.random()
8370// and inconsistent support for the `crypto` API. We do the best we can via
8371// feature-detection
8372
8373// getRandomValues needs to be invoked in a context where "this" is a Crypto
8374// implementation. Also, find the complete implementation of crypto on IE11.
8375var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
8376 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
8377
8378if (getRandomValues) {
8379 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
8380 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
8381
8382 module.exports = function whatwgRNG() {
8383 getRandomValues(rnds8);
8384 return rnds8;
8385 };
8386} else {
8387 // Math.random()-based (RNG)
8388 //
8389 // If all else fails, use Math.random(). It's fast, but is of unspecified
8390 // quality.
8391 var rnds = new Array(16);
8392
8393 module.exports = function mathRNG() {
8394 for (var i = 0, r; i < 16; i++) {
8395 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
8396 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
8397 }
8398
8399 return rnds;
8400 };
8401}
8402
8403
8404/***/ }),
8405/* 265 */
8406/***/ (function(module, exports) {
8407
8408/**
8409 * Convert array of 16 byte values to UUID string format of the form:
8410 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
8411 */
8412var byteToHex = [];
8413for (var i = 0; i < 256; ++i) {
8414 byteToHex[i] = (i + 0x100).toString(16).substr(1);
8415}
8416
8417function bytesToUuid(buf, offset) {
8418 var i = offset || 0;
8419 var bth = byteToHex;
8420 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
8421 return ([bth[buf[i++]], bth[buf[i++]],
8422 bth[buf[i++]], bth[buf[i++]], '-',
8423 bth[buf[i++]], bth[buf[i++]], '-',
8424 bth[buf[i++]], bth[buf[i++]], '-',
8425 bth[buf[i++]], bth[buf[i++]], '-',
8426 bth[buf[i++]], bth[buf[i++]],
8427 bth[buf[i++]], bth[buf[i++]],
8428 bth[buf[i++]], bth[buf[i++]]]).join('');
8429}
8430
8431module.exports = bytesToUuid;
8432
8433
8434/***/ }),
8435/* 266 */
8436/***/ (function(module, exports, __webpack_require__) {
8437
8438"use strict";
8439
8440
8441/**
8442 * This is the common logic for both the Node.js and web browser
8443 * implementations of `debug()`.
8444 */
8445function setup(env) {
8446 createDebug.debug = createDebug;
8447 createDebug.default = createDebug;
8448 createDebug.coerce = coerce;
8449 createDebug.disable = disable;
8450 createDebug.enable = enable;
8451 createDebug.enabled = enabled;
8452 createDebug.humanize = __webpack_require__(267);
8453 Object.keys(env).forEach(function (key) {
8454 createDebug[key] = env[key];
8455 });
8456 /**
8457 * Active `debug` instances.
8458 */
8459
8460 createDebug.instances = [];
8461 /**
8462 * The currently active debug mode names, and names to skip.
8463 */
8464
8465 createDebug.names = [];
8466 createDebug.skips = [];
8467 /**
8468 * Map of special "%n" handling functions, for the debug "format" argument.
8469 *
8470 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
8471 */
8472
8473 createDebug.formatters = {};
8474 /**
8475 * Selects a color for a debug namespace
8476 * @param {String} namespace The namespace string for the for the debug instance to be colored
8477 * @return {Number|String} An ANSI color code for the given namespace
8478 * @api private
8479 */
8480
8481 function selectColor(namespace) {
8482 var hash = 0;
8483
8484 for (var i = 0; i < namespace.length; i++) {
8485 hash = (hash << 5) - hash + namespace.charCodeAt(i);
8486 hash |= 0; // Convert to 32bit integer
8487 }
8488
8489 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
8490 }
8491
8492 createDebug.selectColor = selectColor;
8493 /**
8494 * Create a debugger with the given `namespace`.
8495 *
8496 * @param {String} namespace
8497 * @return {Function}
8498 * @api public
8499 */
8500
8501 function createDebug(namespace) {
8502 var prevTime;
8503
8504 function debug() {
8505 // Disabled?
8506 if (!debug.enabled) {
8507 return;
8508 }
8509
8510 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8511 args[_key] = arguments[_key];
8512 }
8513
8514 var self = debug; // Set `diff` timestamp
8515
8516 var curr = Number(new Date());
8517 var ms = curr - (prevTime || curr);
8518 self.diff = ms;
8519 self.prev = prevTime;
8520 self.curr = curr;
8521 prevTime = curr;
8522 args[0] = createDebug.coerce(args[0]);
8523
8524 if (typeof args[0] !== 'string') {
8525 // Anything else let's inspect with %O
8526 args.unshift('%O');
8527 } // Apply any `formatters` transformations
8528
8529
8530 var index = 0;
8531 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
8532 // If we encounter an escaped % then don't increase the array index
8533 if (match === '%%') {
8534 return match;
8535 }
8536
8537 index++;
8538 var formatter = createDebug.formatters[format];
8539
8540 if (typeof formatter === 'function') {
8541 var val = args[index];
8542 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
8543
8544 args.splice(index, 1);
8545 index--;
8546 }
8547
8548 return match;
8549 }); // Apply env-specific formatting (colors, etc.)
8550
8551 createDebug.formatArgs.call(self, args);
8552 var logFn = self.log || createDebug.log;
8553 logFn.apply(self, args);
8554 }
8555
8556 debug.namespace = namespace;
8557 debug.enabled = createDebug.enabled(namespace);
8558 debug.useColors = createDebug.useColors();
8559 debug.color = selectColor(namespace);
8560 debug.destroy = destroy;
8561 debug.extend = extend; // Debug.formatArgs = formatArgs;
8562 // debug.rawLog = rawLog;
8563 // env-specific initialization logic for debug instances
8564
8565 if (typeof createDebug.init === 'function') {
8566 createDebug.init(debug);
8567 }
8568
8569 createDebug.instances.push(debug);
8570 return debug;
8571 }
8572
8573 function destroy() {
8574 var index = createDebug.instances.indexOf(this);
8575
8576 if (index !== -1) {
8577 createDebug.instances.splice(index, 1);
8578 return true;
8579 }
8580
8581 return false;
8582 }
8583
8584 function extend(namespace, delimiter) {
8585 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
8586 }
8587 /**
8588 * Enables a debug mode by namespaces. This can include modes
8589 * separated by a colon and wildcards.
8590 *
8591 * @param {String} namespaces
8592 * @api public
8593 */
8594
8595
8596 function enable(namespaces) {
8597 createDebug.save(namespaces);
8598 createDebug.names = [];
8599 createDebug.skips = [];
8600 var i;
8601 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
8602 var len = split.length;
8603
8604 for (i = 0; i < len; i++) {
8605 if (!split[i]) {
8606 // ignore empty strings
8607 continue;
8608 }
8609
8610 namespaces = split[i].replace(/\*/g, '.*?');
8611
8612 if (namespaces[0] === '-') {
8613 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
8614 } else {
8615 createDebug.names.push(new RegExp('^' + namespaces + '$'));
8616 }
8617 }
8618
8619 for (i = 0; i < createDebug.instances.length; i++) {
8620 var instance = createDebug.instances[i];
8621 instance.enabled = createDebug.enabled(instance.namespace);
8622 }
8623 }
8624 /**
8625 * Disable debug output.
8626 *
8627 * @api public
8628 */
8629
8630
8631 function disable() {
8632 createDebug.enable('');
8633 }
8634 /**
8635 * Returns true if the given mode name is enabled, false otherwise.
8636 *
8637 * @param {String} name
8638 * @return {Boolean}
8639 * @api public
8640 */
8641
8642
8643 function enabled(name) {
8644 if (name[name.length - 1] === '*') {
8645 return true;
8646 }
8647
8648 var i;
8649 var len;
8650
8651 for (i = 0, len = createDebug.skips.length; i < len; i++) {
8652 if (createDebug.skips[i].test(name)) {
8653 return false;
8654 }
8655 }
8656
8657 for (i = 0, len = createDebug.names.length; i < len; i++) {
8658 if (createDebug.names[i].test(name)) {
8659 return true;
8660 }
8661 }
8662
8663 return false;
8664 }
8665 /**
8666 * Coerce `val`.
8667 *
8668 * @param {Mixed} val
8669 * @return {Mixed}
8670 * @api private
8671 */
8672
8673
8674 function coerce(val) {
8675 if (val instanceof Error) {
8676 return val.stack || val.message;
8677 }
8678
8679 return val;
8680 }
8681
8682 createDebug.enable(createDebug.load());
8683 return createDebug;
8684}
8685
8686module.exports = setup;
8687
8688
8689
8690/***/ }),
8691/* 267 */
8692/***/ (function(module, exports) {
8693
8694/**
8695 * Helpers.
8696 */
8697
8698var s = 1000;
8699var m = s * 60;
8700var h = m * 60;
8701var d = h * 24;
8702var w = d * 7;
8703var y = d * 365.25;
8704
8705/**
8706 * Parse or format the given `val`.
8707 *
8708 * Options:
8709 *
8710 * - `long` verbose formatting [false]
8711 *
8712 * @param {String|Number} val
8713 * @param {Object} [options]
8714 * @throws {Error} throw an error if val is not a non-empty string or a number
8715 * @return {String|Number}
8716 * @api public
8717 */
8718
8719module.exports = function(val, options) {
8720 options = options || {};
8721 var type = typeof val;
8722 if (type === 'string' && val.length > 0) {
8723 return parse(val);
8724 } else if (type === 'number' && isFinite(val)) {
8725 return options.long ? fmtLong(val) : fmtShort(val);
8726 }
8727 throw new Error(
8728 'val is not a non-empty string or a valid number. val=' +
8729 JSON.stringify(val)
8730 );
8731};
8732
8733/**
8734 * Parse the given `str` and return milliseconds.
8735 *
8736 * @param {String} str
8737 * @return {Number}
8738 * @api private
8739 */
8740
8741function parse(str) {
8742 str = String(str);
8743 if (str.length > 100) {
8744 return;
8745 }
8746 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(
8747 str
8748 );
8749 if (!match) {
8750 return;
8751 }
8752 var n = parseFloat(match[1]);
8753 var type = (match[2] || 'ms').toLowerCase();
8754 switch (type) {
8755 case 'years':
8756 case 'year':
8757 case 'yrs':
8758 case 'yr':
8759 case 'y':
8760 return n * y;
8761 case 'weeks':
8762 case 'week':
8763 case 'w':
8764 return n * w;
8765 case 'days':
8766 case 'day':
8767 case 'd':
8768 return n * d;
8769 case 'hours':
8770 case 'hour':
8771 case 'hrs':
8772 case 'hr':
8773 case 'h':
8774 return n * h;
8775 case 'minutes':
8776 case 'minute':
8777 case 'mins':
8778 case 'min':
8779 case 'm':
8780 return n * m;
8781 case 'seconds':
8782 case 'second':
8783 case 'secs':
8784 case 'sec':
8785 case 's':
8786 return n * s;
8787 case 'milliseconds':
8788 case 'millisecond':
8789 case 'msecs':
8790 case 'msec':
8791 case 'ms':
8792 return n;
8793 default:
8794 return undefined;
8795 }
8796}
8797
8798/**
8799 * Short format for `ms`.
8800 *
8801 * @param {Number} ms
8802 * @return {String}
8803 * @api private
8804 */
8805
8806function fmtShort(ms) {
8807 var msAbs = Math.abs(ms);
8808 if (msAbs >= d) {
8809 return Math.round(ms / d) + 'd';
8810 }
8811 if (msAbs >= h) {
8812 return Math.round(ms / h) + 'h';
8813 }
8814 if (msAbs >= m) {
8815 return Math.round(ms / m) + 'm';
8816 }
8817 if (msAbs >= s) {
8818 return Math.round(ms / s) + 's';
8819 }
8820 return ms + 'ms';
8821}
8822
8823/**
8824 * Long format for `ms`.
8825 *
8826 * @param {Number} ms
8827 * @return {String}
8828 * @api private
8829 */
8830
8831function fmtLong(ms) {
8832 var msAbs = Math.abs(ms);
8833 if (msAbs >= d) {
8834 return plural(ms, msAbs, d, 'day');
8835 }
8836 if (msAbs >= h) {
8837 return plural(ms, msAbs, h, 'hour');
8838 }
8839 if (msAbs >= m) {
8840 return plural(ms, msAbs, m, 'minute');
8841 }
8842 if (msAbs >= s) {
8843 return plural(ms, msAbs, s, 'second');
8844 }
8845 return ms + ' ms';
8846}
8847
8848/**
8849 * Pluralization helper.
8850 */
8851
8852function plural(ms, msAbs, n, name) {
8853 var isPlural = msAbs >= n * 1.5;
8854 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
8855}
8856
8857
8858/***/ }),
8859/* 268 */
8860/***/ (function(module, exports, __webpack_require__) {
8861
8862__webpack_require__(269);
8863module.exports = __webpack_require__(2).Object.getPrototypeOf;
8864
8865
8866/***/ }),
8867/* 269 */
8868/***/ (function(module, exports, __webpack_require__) {
8869
8870// 19.1.2.9 Object.getPrototypeOf(O)
8871var toObject = __webpack_require__(53);
8872var $getPrototypeOf = __webpack_require__(98);
8873
8874__webpack_require__(85)('getPrototypeOf', function () {
8875 return function getPrototypeOf(it) {
8876 return $getPrototypeOf(toObject(it));
8877 };
8878});
8879
8880
8881/***/ }),
8882/* 270 */
8883/***/ (function(module, exports, __webpack_require__) {
8884
8885"use strict";
8886
8887
8888var _defineProperty = __webpack_require__(86);
8889
8890var _defineProperty2 = _interopRequireDefault(_defineProperty);
8891
8892function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8893
8894var AV = __webpack_require__(34);
8895var AppRouter = __webpack_require__(273);
8896
8897var _require = __webpack_require__(15),
8898 isNullOrUndefined = _require.isNullOrUndefined;
8899
8900var _require2 = __webpack_require__(0),
8901 extend = _require2.extend,
8902 isObject = _require2.isObject,
8903 isEmpty = _require2.isEmpty;
8904
8905var isCNApp = function isCNApp(appId) {
8906 return appId.slice(-9) !== '-MdYXbMMI';
8907};
8908
8909var fillServerURLs = function fillServerURLs(url) {
8910 return {
8911 push: url,
8912 stats: url,
8913 engine: url,
8914 api: url,
8915 rtm: url
8916 };
8917};
8918
8919function getDefaultServerURLs(appId) {
8920 if (isCNApp(appId)) {
8921 return {};
8922 }
8923 var id = appId.slice(0, 8).toLowerCase();
8924 var domain = 'lncldglobal.com';
8925 return {
8926 push: 'https://' + id + '.push.' + domain,
8927 stats: 'https://' + id + '.stats.' + domain,
8928 engine: 'https://' + id + '.engine.' + domain,
8929 api: 'https://' + id + '.api.' + domain,
8930 rtm: 'https://' + id + '.rtm.' + domain
8931 };
8932}
8933
8934var _disableAppRouter = false;
8935var _initialized = false;
8936
8937/**
8938 * URLs for services
8939 * @typedef {Object} ServerURLs
8940 * @property {String} [api] serverURL for API service
8941 * @property {String} [engine] serverURL for engine service
8942 * @property {String} [stats] serverURL for stats service
8943 * @property {String} [push] serverURL for push service
8944 * @property {String} [rtm] serverURL for LiveQuery service
8945 */
8946
8947/**
8948 * Call this method first to set up your authentication tokens for AV.
8949 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
8950 * @function AV.init
8951 * @param {Object} options
8952 * @param {String} options.appId application id
8953 * @param {String} options.appKey application key
8954 * @param {String} [options.masterKey] application master key
8955 * @param {Boolean} [options.production]
8956 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
8957 * @param {Boolean} [options.disableCurrentUser]
8958 */
8959AV.init = function init(options) {
8960 if (!isObject(options)) {
8961 return AV.init({
8962 appId: options,
8963 appKey: arguments.length <= 1 ? undefined : arguments[1],
8964 masterKey: arguments.length <= 2 ? undefined : arguments[2]
8965 });
8966 }
8967 var appId = options.appId,
8968 appKey = options.appKey,
8969 masterKey = options.masterKey,
8970 hookKey = options.hookKey,
8971 serverURL = options.serverURL,
8972 _options$serverURLs = options.serverURLs,
8973 serverURLs = _options$serverURLs === undefined ? serverURL : _options$serverURLs,
8974 disableCurrentUser = options.disableCurrentUser,
8975 production = options.production,
8976 realtime = options.realtime;
8977
8978 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.');
8979 if (!appId) throw new TypeError('appId must be a string');
8980 if (!appKey) throw new TypeError('appKey must be a string');
8981 if (undefined !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
8982 if (isCNApp(appId)) {
8983 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
8984 throw new TypeError('serverURL option is required for apps from CN region');
8985 }
8986 }
8987 if (appId !== AV._config.applicationId) {
8988 // overwrite all keys when reinitializing as a new app
8989 AV._config.masterKey = masterKey;
8990 AV._config.hookKey = hookKey;
8991 } else {
8992 if (masterKey) AV._config.masterKey = masterKey;
8993 if (hookKey) AV._config.hookKey = hookKey;
8994 }
8995 AV._config.applicationId = appId;
8996 AV._config.applicationKey = appKey;
8997 if (!isNullOrUndefined(production)) {
8998 AV.setProduction(production);
8999 }
9000 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
9001 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
9002 if (!disableAppRouter) {
9003 AV._appRouter = new AppRouter(AV);
9004 }
9005 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
9006 if (realtime) {
9007 AV._config.realtime = realtime;
9008 } else if (AV._sharedConfig.liveQueryRealtime) {
9009 var _AV$_config$serverURL = AV._config.serverURLs,
9010 api = _AV$_config$serverURL.api,
9011 rtm = _AV$_config$serverURL.rtm;
9012
9013 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
9014 appId: appId,
9015 appKey: appKey,
9016 server: {
9017 api: api,
9018 RTMRouter: rtm
9019 }
9020 });
9021 }
9022 _initialized = true;
9023};
9024
9025// If we're running in node.js, allow using the master key.
9026if (undefined === 'NODE_JS') {
9027 AV.Cloud = AV.Cloud || {};
9028 /**
9029 * Switches the LeanCloud SDK to using the Master key. The Master key grants
9030 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
9031 * other restrictions that are applied to the client SDKs.
9032 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
9033 * </p>
9034 */
9035 AV.Cloud.useMasterKey = function () {
9036 AV._config.useMasterKey = true;
9037 };
9038}
9039
9040/**
9041 * Call this method to set production environment variable.
9042 * @function AV.setProduction
9043 * @param {Boolean} production True is production environment,and
9044 * it's true by default.
9045 */
9046AV.setProduction = function (production) {
9047 if (!isNullOrUndefined(production)) {
9048 AV._config.production = production ? 1 : 0;
9049 } else {
9050 // change to default value
9051 AV._config.production = null;
9052 }
9053};
9054
9055AV._setServerURLs = function (urls) {
9056 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
9057
9058 if (typeof urls !== 'string') {
9059 extend(AV._config.serverURLs, urls);
9060 } else {
9061 AV._config.serverURLs = fillServerURLs(urls);
9062 }
9063 if (disableAppRouter) {
9064 if (AV._appRouter) {
9065 AV._appRouter.disable();
9066 } else {
9067 _disableAppRouter = true;
9068 }
9069 }
9070};
9071/**
9072 * Set server URLs for services.
9073 * @function AV.setServerURL
9074 * @since 4.3.0
9075 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
9076 * You can also set them when initializing SDK with `options.serverURL`
9077 */
9078AV.setServerURL = function (urls) {
9079 return AV._setServerURLs(urls);
9080};
9081AV.setServerURLs = AV.setServerURL;
9082
9083AV.keepErrorRawMessage = function (value) {
9084 AV._sharedConfig.keepErrorRawMessage = value;
9085};
9086
9087/**
9088 * Set a deadline for requests to complete.
9089 * Note that file upload requests are not affected.
9090 * @function AV.setRequestTimeout
9091 * @since 3.6.0
9092 * @param {number} ms
9093 */
9094AV.setRequestTimeout = function (ms) {
9095 AV._config.requestTimeout = ms;
9096};
9097
9098// backword compatible
9099AV.initialize = AV.init;
9100
9101var defineConfig = function defineConfig(property) {
9102 return (0, _defineProperty2.default)(AV, property, {
9103 get: function get() {
9104 return AV._config[property];
9105 },
9106 set: function set(value) {
9107 AV._config[property] = value;
9108 }
9109 });
9110};
9111
9112['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
9113
9114/***/ }),
9115/* 271 */
9116/***/ (function(module, exports, __webpack_require__) {
9117
9118__webpack_require__(272);
9119var $Object = __webpack_require__(2).Object;
9120module.exports = function defineProperty(it, key, desc) {
9121 return $Object.defineProperty(it, key, desc);
9122};
9123
9124
9125/***/ }),
9126/* 272 */
9127/***/ (function(module, exports, __webpack_require__) {
9128
9129var $export = __webpack_require__(17);
9130// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
9131$export($export.S + $export.F * !__webpack_require__(21), 'Object', { defineProperty: __webpack_require__(19).f });
9132
9133
9134/***/ }),
9135/* 273 */
9136/***/ (function(module, exports, __webpack_require__) {
9137
9138"use strict";
9139
9140
9141var ajax = __webpack_require__(58);
9142var Cache = __webpack_require__(159);
9143
9144function AppRouter(AV) {
9145 var _this = this;
9146
9147 this.AV = AV;
9148 this.lockedUntil = 0;
9149 Cache.getAsync('serverURLs').then(function (data) {
9150 if (_this.disabled) return;
9151 if (!data) return _this.lock(0);
9152 var serverURLs = data.serverURLs,
9153 lockedUntil = data.lockedUntil;
9154
9155 _this.AV._setServerURLs(serverURLs, false);
9156 _this.lockedUntil = lockedUntil;
9157 }).catch(function () {
9158 return _this.lock(0);
9159 });
9160}
9161
9162AppRouter.prototype.disable = function disable() {
9163 this.disabled = true;
9164};
9165AppRouter.prototype.lock = function lock(ttl) {
9166 this.lockedUntil = Date.now() + ttl;
9167};
9168AppRouter.prototype.refresh = function refresh() {
9169 var _this2 = this;
9170
9171 if (this.disabled) return;
9172 if (Date.now() < this.lockedUntil) return;
9173 this.lock(10);
9174 var url = 'https://app-router.com/2/route';
9175 return ajax({
9176 method: 'get',
9177 url: url,
9178 query: {
9179 appId: this.AV.applicationId
9180 }
9181 }).then(function (servers) {
9182 if (_this2.disabled) return;
9183 var ttl = servers.ttl;
9184 if (!ttl) throw new Error('missing ttl');
9185 ttl = ttl * 1000;
9186 var protocal = 'https://';
9187 var serverURLs = {
9188 push: protocal + servers.push_server,
9189 stats: protocal + servers.stats_server,
9190 engine: protocal + servers.engine_server,
9191 api: protocal + servers.api_server
9192 };
9193 _this2.AV._setServerURLs(serverURLs, false);
9194 _this2.lock(ttl);
9195 return Cache.setAsync('serverURLs', {
9196 serverURLs: serverURLs,
9197 lockedUntil: _this2.lockedUntil
9198 }, ttl);
9199 }).catch(function (error) {
9200 // bypass all errors
9201 console.warn('refresh server URLs failed: ' + error.message);
9202 _this2.lock(600);
9203 });
9204};
9205
9206module.exports = AppRouter;
9207
9208/***/ }),
9209/* 274 */
9210/***/ (function(module, exports, __webpack_require__) {
9211
9212module.exports = { "default": __webpack_require__(275), __esModule: true };
9213
9214/***/ }),
9215/* 275 */
9216/***/ (function(module, exports, __webpack_require__) {
9217
9218__webpack_require__(47);
9219__webpack_require__(54);
9220module.exports = __webpack_require__(87).f('iterator');
9221
9222
9223/***/ }),
9224/* 276 */
9225/***/ (function(module, exports, __webpack_require__) {
9226
9227module.exports = { "default": __webpack_require__(277), __esModule: true };
9228
9229/***/ }),
9230/* 277 */
9231/***/ (function(module, exports, __webpack_require__) {
9232
9233__webpack_require__(278);
9234__webpack_require__(91);
9235__webpack_require__(283);
9236__webpack_require__(284);
9237module.exports = __webpack_require__(2).Symbol;
9238
9239
9240/***/ }),
9241/* 278 */
9242/***/ (function(module, exports, __webpack_require__) {
9243
9244"use strict";
9245
9246// ECMAScript 6 symbols shim
9247var global = __webpack_require__(6);
9248var has = __webpack_require__(25);
9249var DESCRIPTORS = __webpack_require__(21);
9250var $export = __webpack_require__(17);
9251var redefine = __webpack_require__(94);
9252var META = __webpack_require__(279).KEY;
9253var $fails = __webpack_require__(39);
9254var shared = __webpack_require__(66);
9255var setToStringTag = __webpack_require__(52);
9256var uid = __webpack_require__(51);
9257var wks = __webpack_require__(7);
9258var wksExt = __webpack_require__(87);
9259var wksDefine = __webpack_require__(88);
9260var enumKeys = __webpack_require__(280);
9261var isArray = __webpack_require__(281);
9262var anObject = __webpack_require__(16);
9263var isObject = __webpack_require__(20);
9264var toObject = __webpack_require__(53);
9265var toIObject = __webpack_require__(26);
9266var toPrimitive = __webpack_require__(63);
9267var createDesc = __webpack_require__(49);
9268var _create = __webpack_require__(64);
9269var gOPNExt = __webpack_require__(282);
9270var $GOPD = __webpack_require__(90);
9271var $GOPS = __webpack_require__(160);
9272var $DP = __webpack_require__(19);
9273var $keys = __webpack_require__(50);
9274var gOPD = $GOPD.f;
9275var dP = $DP.f;
9276var gOPN = gOPNExt.f;
9277var $Symbol = global.Symbol;
9278var $JSON = global.JSON;
9279var _stringify = $JSON && $JSON.stringify;
9280var PROTOTYPE = 'prototype';
9281var HIDDEN = wks('_hidden');
9282var TO_PRIMITIVE = wks('toPrimitive');
9283var isEnum = {}.propertyIsEnumerable;
9284var SymbolRegistry = shared('symbol-registry');
9285var AllSymbols = shared('symbols');
9286var OPSymbols = shared('op-symbols');
9287var ObjectProto = Object[PROTOTYPE];
9288var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f;
9289var QObject = global.QObject;
9290// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
9291var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
9292
9293// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
9294var setSymbolDesc = DESCRIPTORS && $fails(function () {
9295 return _create(dP({}, 'a', {
9296 get: function () { return dP(this, 'a', { value: 7 }).a; }
9297 })).a != 7;
9298}) ? function (it, key, D) {
9299 var protoDesc = gOPD(ObjectProto, key);
9300 if (protoDesc) delete ObjectProto[key];
9301 dP(it, key, D);
9302 if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
9303} : dP;
9304
9305var wrap = function (tag) {
9306 var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
9307 sym._k = tag;
9308 return sym;
9309};
9310
9311var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
9312 return typeof it == 'symbol';
9313} : function (it) {
9314 return it instanceof $Symbol;
9315};
9316
9317var $defineProperty = function defineProperty(it, key, D) {
9318 if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
9319 anObject(it);
9320 key = toPrimitive(key, true);
9321 anObject(D);
9322 if (has(AllSymbols, key)) {
9323 if (!D.enumerable) {
9324 if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
9325 it[HIDDEN][key] = true;
9326 } else {
9327 if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
9328 D = _create(D, { enumerable: createDesc(0, false) });
9329 } return setSymbolDesc(it, key, D);
9330 } return dP(it, key, D);
9331};
9332var $defineProperties = function defineProperties(it, P) {
9333 anObject(it);
9334 var keys = enumKeys(P = toIObject(P));
9335 var i = 0;
9336 var l = keys.length;
9337 var key;
9338 while (l > i) $defineProperty(it, key = keys[i++], P[key]);
9339 return it;
9340};
9341var $create = function create(it, P) {
9342 return P === undefined ? _create(it) : $defineProperties(_create(it), P);
9343};
9344var $propertyIsEnumerable = function propertyIsEnumerable(key) {
9345 var E = isEnum.call(this, key = toPrimitive(key, true));
9346 if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
9347 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
9348};
9349var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
9350 it = toIObject(it);
9351 key = toPrimitive(key, true);
9352 if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
9353 var D = gOPD(it, key);
9354 if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
9355 return D;
9356};
9357var $getOwnPropertyNames = function getOwnPropertyNames(it) {
9358 var names = gOPN(toIObject(it));
9359 var result = [];
9360 var i = 0;
9361 var key;
9362 while (names.length > i) {
9363 if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
9364 } return result;
9365};
9366var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
9367 var IS_OP = it === ObjectProto;
9368 var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
9369 var result = [];
9370 var i = 0;
9371 var key;
9372 while (names.length > i) {
9373 if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
9374 } return result;
9375};
9376
9377// 19.4.1.1 Symbol([description])
9378if (!USE_NATIVE) {
9379 $Symbol = function Symbol() {
9380 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
9381 var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
9382 var $set = function (value) {
9383 if (this === ObjectProto) $set.call(OPSymbols, value);
9384 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
9385 setSymbolDesc(this, tag, createDesc(1, value));
9386 };
9387 if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
9388 return wrap(tag);
9389 };
9390 redefine($Symbol[PROTOTYPE], 'toString', function toString() {
9391 return this._k;
9392 });
9393
9394 $GOPD.f = $getOwnPropertyDescriptor;
9395 $DP.f = $defineProperty;
9396 __webpack_require__(161).f = gOPNExt.f = $getOwnPropertyNames;
9397 __webpack_require__(89).f = $propertyIsEnumerable;
9398 $GOPS.f = $getOwnPropertySymbols;
9399
9400 if (DESCRIPTORS && !__webpack_require__(37)) {
9401 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
9402 }
9403
9404 wksExt.f = function (name) {
9405 return wrap(wks(name));
9406 };
9407}
9408
9409$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
9410
9411for (var es6Symbols = (
9412 // 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
9413 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
9414).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
9415
9416for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
9417
9418$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
9419 // 19.4.2.1 Symbol.for(key)
9420 'for': function (key) {
9421 return has(SymbolRegistry, key += '')
9422 ? SymbolRegistry[key]
9423 : SymbolRegistry[key] = $Symbol(key);
9424 },
9425 // 19.4.2.5 Symbol.keyFor(sym)
9426 keyFor: function keyFor(sym) {
9427 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
9428 for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
9429 },
9430 useSetter: function () { setter = true; },
9431 useSimple: function () { setter = false; }
9432});
9433
9434$export($export.S + $export.F * !USE_NATIVE, 'Object', {
9435 // 19.1.2.2 Object.create(O [, Properties])
9436 create: $create,
9437 // 19.1.2.4 Object.defineProperty(O, P, Attributes)
9438 defineProperty: $defineProperty,
9439 // 19.1.2.3 Object.defineProperties(O, Properties)
9440 defineProperties: $defineProperties,
9441 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
9442 getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
9443 // 19.1.2.7 Object.getOwnPropertyNames(O)
9444 getOwnPropertyNames: $getOwnPropertyNames,
9445 // 19.1.2.8 Object.getOwnPropertySymbols(O)
9446 getOwnPropertySymbols: $getOwnPropertySymbols
9447});
9448
9449// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
9450// https://bugs.chromium.org/p/v8/issues/detail?id=3443
9451var FAILS_ON_PRIMITIVES = $fails(function () { $GOPS.f(1); });
9452
9453$export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', {
9454 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
9455 return $GOPS.f(toObject(it));
9456 }
9457});
9458
9459// 24.3.2 JSON.stringify(value [, replacer [, space]])
9460$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
9461 var S = $Symbol();
9462 // MS Edge converts symbol values to JSON as {}
9463 // WebKit converts symbol values to JSON as null
9464 // V8 throws on boxed symbols
9465 return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
9466})), 'JSON', {
9467 stringify: function stringify(it) {
9468 var args = [it];
9469 var i = 1;
9470 var replacer, $replacer;
9471 while (arguments.length > i) args.push(arguments[i++]);
9472 $replacer = replacer = args[1];
9473 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
9474 if (!isArray(replacer)) replacer = function (key, value) {
9475 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
9476 if (!isSymbol(value)) return value;
9477 };
9478 args[1] = replacer;
9479 return _stringify.apply($JSON, args);
9480 }
9481});
9482
9483// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
9484$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(24)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
9485// 19.4.3.5 Symbol.prototype[@@toStringTag]
9486setToStringTag($Symbol, 'Symbol');
9487// 20.2.1.9 Math[@@toStringTag]
9488setToStringTag(Math, 'Math', true);
9489// 24.3.3 JSON[@@toStringTag]
9490setToStringTag(global.JSON, 'JSON', true);
9491
9492
9493/***/ }),
9494/* 279 */
9495/***/ (function(module, exports, __webpack_require__) {
9496
9497var META = __webpack_require__(51)('meta');
9498var isObject = __webpack_require__(20);
9499var has = __webpack_require__(25);
9500var setDesc = __webpack_require__(19).f;
9501var id = 0;
9502var isExtensible = Object.isExtensible || function () {
9503 return true;
9504};
9505var FREEZE = !__webpack_require__(39)(function () {
9506 return isExtensible(Object.preventExtensions({}));
9507});
9508var setMeta = function (it) {
9509 setDesc(it, META, { value: {
9510 i: 'O' + ++id, // object ID
9511 w: {} // weak collections IDs
9512 } });
9513};
9514var fastKey = function (it, create) {
9515 // return primitive with prefix
9516 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
9517 if (!has(it, META)) {
9518 // can't set metadata to uncaught frozen object
9519 if (!isExtensible(it)) return 'F';
9520 // not necessary to add metadata
9521 if (!create) return 'E';
9522 // add missing metadata
9523 setMeta(it);
9524 // return object ID
9525 } return it[META].i;
9526};
9527var getWeak = function (it, create) {
9528 if (!has(it, META)) {
9529 // can't set metadata to uncaught frozen object
9530 if (!isExtensible(it)) return true;
9531 // not necessary to add metadata
9532 if (!create) return false;
9533 // add missing metadata
9534 setMeta(it);
9535 // return hash weak collections IDs
9536 } return it[META].w;
9537};
9538// add metadata on freeze-family methods calling
9539var onFreeze = function (it) {
9540 if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
9541 return it;
9542};
9543var meta = module.exports = {
9544 KEY: META,
9545 NEED: false,
9546 fastKey: fastKey,
9547 getWeak: getWeak,
9548 onFreeze: onFreeze
9549};
9550
9551
9552/***/ }),
9553/* 280 */
9554/***/ (function(module, exports, __webpack_require__) {
9555
9556// all enumerable object keys, includes symbols
9557var getKeys = __webpack_require__(50);
9558var gOPS = __webpack_require__(160);
9559var pIE = __webpack_require__(89);
9560module.exports = function (it) {
9561 var result = getKeys(it);
9562 var getSymbols = gOPS.f;
9563 if (getSymbols) {
9564 var symbols = getSymbols(it);
9565 var isEnum = pIE.f;
9566 var i = 0;
9567 var key;
9568 while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
9569 } return result;
9570};
9571
9572
9573/***/ }),
9574/* 281 */
9575/***/ (function(module, exports, __webpack_require__) {
9576
9577// 7.2.2 IsArray(argument)
9578var cof = __webpack_require__(40);
9579module.exports = Array.isArray || function isArray(arg) {
9580 return cof(arg) == 'Array';
9581};
9582
9583
9584/***/ }),
9585/* 282 */
9586/***/ (function(module, exports, __webpack_require__) {
9587
9588// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
9589var toIObject = __webpack_require__(26);
9590var gOPN = __webpack_require__(161).f;
9591var toString = {}.toString;
9592
9593var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
9594 ? Object.getOwnPropertyNames(window) : [];
9595
9596var getWindowNames = function (it) {
9597 try {
9598 return gOPN(it);
9599 } catch (e) {
9600 return windowNames.slice();
9601 }
9602};
9603
9604module.exports.f = function getOwnPropertyNames(it) {
9605 return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
9606};
9607
9608
9609/***/ }),
9610/* 283 */
9611/***/ (function(module, exports, __webpack_require__) {
9612
9613__webpack_require__(88)('asyncIterator');
9614
9615
9616/***/ }),
9617/* 284 */
9618/***/ (function(module, exports, __webpack_require__) {
9619
9620__webpack_require__(88)('observable');
9621
9622
9623/***/ }),
9624/* 285 */
9625/***/ (function(module, exports, __webpack_require__) {
9626
9627"use strict";
9628// Copyright (c) 2015-2017 David M. Lee, II
9629
9630
9631/**
9632 * Local reference to TimeoutError
9633 * @private
9634 */
9635var TimeoutError;
9636
9637/**
9638 * Rejects a promise with a {@link TimeoutError} if it does not settle within
9639 * the specified timeout.
9640 *
9641 * @param {Promise} promise The promise.
9642 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
9643 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
9644 * `TimeoutError`, whichever settles first.
9645 */
9646var timeout = module.exports.timeout = function(promise, timeoutMillis) {
9647 var error = new TimeoutError(),
9648 timeout;
9649
9650 return Promise.race([
9651 promise,
9652 new Promise(function(resolve, reject) {
9653 timeout = setTimeout(function() {
9654 reject(error);
9655 }, timeoutMillis);
9656 }),
9657 ]).then(function(v) {
9658 clearTimeout(timeout);
9659 return v;
9660 }, function(err) {
9661 clearTimeout(timeout);
9662 throw err;
9663 });
9664};
9665
9666/**
9667 * Exception indicating that the timeout expired.
9668 */
9669TimeoutError = module.exports.TimeoutError = function() {
9670 Error.call(this)
9671 this.stack = Error().stack
9672 this.message = 'Timeout';
9673};
9674
9675TimeoutError.prototype = Object.create(Error.prototype);
9676TimeoutError.prototype.name = "TimeoutError";
9677
9678
9679/***/ }),
9680/* 286 */
9681/***/ (function(module, exports, __webpack_require__) {
9682
9683"use strict";
9684
9685
9686var _ = __webpack_require__(0);
9687
9688module.exports = function (AV) {
9689 var eventSplitter = /\s+/;
9690 var slice = Array.prototype.slice;
9691
9692 /**
9693 * @class
9694 *
9695 * <p>AV.Events is a fork of Backbone's Events module, provided for your
9696 * convenience.</p>
9697 *
9698 * <p>A module that can be mixed in to any object in order to provide
9699 * it with custom events. You may bind callback functions to an event
9700 * with `on`, or remove these functions with `off`.
9701 * Triggering an event fires all callbacks in the order that `on` was
9702 * called.
9703 *
9704 * @private
9705 * @example
9706 * var object = {};
9707 * _.extend(object, AV.Events);
9708 * object.on('expand', function(){ alert('expanded'); });
9709 * object.trigger('expand');</pre></p>
9710 *
9711 */
9712 AV.Events = {
9713 /**
9714 * Bind one or more space separated events, `events`, to a `callback`
9715 * function. Passing `"all"` will bind the callback to all events fired.
9716 */
9717 on: function on(events, callback, context) {
9718 var calls, event, node, tail, list;
9719 if (!callback) {
9720 return this;
9721 }
9722 events = events.split(eventSplitter);
9723 calls = this._callbacks || (this._callbacks = {});
9724
9725 // Create an immutable callback list, allowing traversal during
9726 // modification. The tail is an empty object that will always be used
9727 // as the next node.
9728 event = events.shift();
9729 while (event) {
9730 list = calls[event];
9731 node = list ? list.tail : {};
9732 node.next = tail = {};
9733 node.context = context;
9734 node.callback = callback;
9735 calls[event] = { tail: tail, next: list ? list.next : node };
9736 event = events.shift();
9737 }
9738
9739 return this;
9740 },
9741
9742 /**
9743 * Remove one or many callbacks. If `context` is null, removes all callbacks
9744 * with that function. If `callback` is null, removes all callbacks for the
9745 * event. If `events` is null, removes all bound callbacks for all events.
9746 */
9747 off: function off(events, callback, context) {
9748 var event, calls, node, tail, cb, ctx;
9749
9750 // No events, or removing *all* events.
9751 if (!(calls = this._callbacks)) {
9752 return;
9753 }
9754 if (!(events || callback || context)) {
9755 delete this._callbacks;
9756 return this;
9757 }
9758
9759 // Loop through the listed events and contexts, splicing them out of the
9760 // linked list of callbacks if appropriate.
9761 events = events ? events.split(eventSplitter) : _.keys(calls);
9762 event = events.shift();
9763 while (event) {
9764 node = calls[event];
9765 delete calls[event];
9766 if (!node || !(callback || context)) {
9767 continue;
9768 }
9769 // Create a new list, omitting the indicated callbacks.
9770 tail = node.tail;
9771 node = node.next;
9772 while (node !== tail) {
9773 cb = node.callback;
9774 ctx = node.context;
9775 if (callback && cb !== callback || context && ctx !== context) {
9776 this.on(event, cb, ctx);
9777 }
9778 node = node.next;
9779 }
9780 event = events.shift();
9781 }
9782
9783 return this;
9784 },
9785
9786 /**
9787 * Trigger one or many events, firing all bound callbacks. Callbacks are
9788 * passed the same arguments as `trigger` is, apart from the event name
9789 * (unless you're listening on `"all"`, which will cause your callback to
9790 * receive the true name of the event as the first argument).
9791 */
9792 trigger: function trigger(events) {
9793 var event, node, calls, tail, args, all, rest;
9794 if (!(calls = this._callbacks)) {
9795 return this;
9796 }
9797 all = calls.all;
9798 events = events.split(eventSplitter);
9799 rest = slice.call(arguments, 1);
9800
9801 // For each event, walk through the linked list of callbacks twice,
9802 // first to trigger the event, then to trigger any `"all"` callbacks.
9803 event = events.shift();
9804 while (event) {
9805 node = calls[event];
9806 if (node) {
9807 tail = node.tail;
9808 while ((node = node.next) !== tail) {
9809 node.callback.apply(node.context || this, rest);
9810 }
9811 }
9812 node = all;
9813 if (node) {
9814 tail = node.tail;
9815 args = [event].concat(rest);
9816 while ((node = node.next) !== tail) {
9817 node.callback.apply(node.context || this, args);
9818 }
9819 }
9820 event = events.shift();
9821 }
9822
9823 return this;
9824 }
9825 };
9826
9827 /**
9828 * @function
9829 */
9830 AV.Events.bind = AV.Events.on;
9831
9832 /**
9833 * @function
9834 */
9835 AV.Events.unbind = AV.Events.off;
9836};
9837
9838/***/ }),
9839/* 287 */
9840/***/ (function(module, exports, __webpack_require__) {
9841
9842"use strict";
9843
9844
9845var _promise = __webpack_require__(4);
9846
9847var _promise2 = _interopRequireDefault(_promise);
9848
9849function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9850
9851var _ = __webpack_require__(0);
9852
9853/*global navigator: false */
9854module.exports = function (AV) {
9855 /**
9856 * Creates a new GeoPoint with any of the following forms:<br>
9857 * @example
9858 * new GeoPoint(otherGeoPoint)
9859 * new GeoPoint(30, 30)
9860 * new GeoPoint([30, 30])
9861 * new GeoPoint({latitude: 30, longitude: 30})
9862 * new GeoPoint() // defaults to (0, 0)
9863 * @class
9864 *
9865 * <p>Represents a latitude / longitude point that may be associated
9866 * with a key in a AVObject or used as a reference point for geo queries.
9867 * This allows proximity-based queries on the key.</p>
9868 *
9869 * <p>Only one key in a class may contain a GeoPoint.</p>
9870 *
9871 * <p>Example:<pre>
9872 * var point = new AV.GeoPoint(30.0, -20.0);
9873 * var object = new AV.Object("PlaceObject");
9874 * object.set("location", point);
9875 * object.save();</pre></p>
9876 */
9877 AV.GeoPoint = function (arg1, arg2) {
9878 if (_.isArray(arg1)) {
9879 AV.GeoPoint._validate(arg1[0], arg1[1]);
9880 this.latitude = arg1[0];
9881 this.longitude = arg1[1];
9882 } else if (_.isObject(arg1)) {
9883 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
9884 this.latitude = arg1.latitude;
9885 this.longitude = arg1.longitude;
9886 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
9887 AV.GeoPoint._validate(arg1, arg2);
9888 this.latitude = arg1;
9889 this.longitude = arg2;
9890 } else {
9891 this.latitude = 0;
9892 this.longitude = 0;
9893 }
9894
9895 // Add properties so that anyone using Webkit or Mozilla will get an error
9896 // if they try to set values that are out of bounds.
9897 var self = this;
9898 if (this.__defineGetter__ && this.__defineSetter__) {
9899 // Use _latitude and _longitude to actually store the values, and add
9900 // getters and setters for latitude and longitude.
9901 this._latitude = this.latitude;
9902 this._longitude = this.longitude;
9903 this.__defineGetter__('latitude', function () {
9904 return self._latitude;
9905 });
9906 this.__defineGetter__('longitude', function () {
9907 return self._longitude;
9908 });
9909 this.__defineSetter__('latitude', function (val) {
9910 AV.GeoPoint._validate(val, self.longitude);
9911 self._latitude = val;
9912 });
9913 this.__defineSetter__('longitude', function (val) {
9914 AV.GeoPoint._validate(self.latitude, val);
9915 self._longitude = val;
9916 });
9917 }
9918 };
9919
9920 /**
9921 * @lends AV.GeoPoint.prototype
9922 * @property {float} latitude North-south portion of the coordinate, in range
9923 * [-90, 90]. Throws an exception if set out of range in a modern browser.
9924 * @property {float} longitude East-west portion of the coordinate, in range
9925 * [-180, 180]. Throws if set out of range in a modern browser.
9926 */
9927
9928 /**
9929 * Throws an exception if the given lat-long is out of bounds.
9930 * @private
9931 */
9932 AV.GeoPoint._validate = function (latitude, longitude) {
9933 if (latitude < -90.0) {
9934 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
9935 }
9936 if (latitude > 90.0) {
9937 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
9938 }
9939 if (longitude < -180.0) {
9940 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
9941 }
9942 if (longitude > 180.0) {
9943 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
9944 }
9945 };
9946
9947 /**
9948 * Creates a GeoPoint with the user's current location, if available.
9949 * @return {Promise.<AV.GeoPoint>}
9950 */
9951 AV.GeoPoint.current = function () {
9952 return new _promise2.default(function (resolve, reject) {
9953 navigator.geolocation.getCurrentPosition(function (location) {
9954 resolve(new AV.GeoPoint({
9955 latitude: location.coords.latitude,
9956 longitude: location.coords.longitude
9957 }));
9958 }, reject);
9959 });
9960 };
9961
9962 _.extend(AV.GeoPoint.prototype,
9963 /** @lends AV.GeoPoint.prototype */{
9964 /**
9965 * Returns a JSON representation of the GeoPoint, suitable for AV.
9966 * @return {Object}
9967 */
9968 toJSON: function toJSON() {
9969 AV.GeoPoint._validate(this.latitude, this.longitude);
9970 return {
9971 __type: 'GeoPoint',
9972 latitude: this.latitude,
9973 longitude: this.longitude
9974 };
9975 },
9976
9977 /**
9978 * Returns the distance from this GeoPoint to another in radians.
9979 * @param {AV.GeoPoint} point the other AV.GeoPoint.
9980 * @return {Number}
9981 */
9982 radiansTo: function radiansTo(point) {
9983 var d2r = Math.PI / 180.0;
9984 var lat1rad = this.latitude * d2r;
9985 var long1rad = this.longitude * d2r;
9986 var lat2rad = point.latitude * d2r;
9987 var long2rad = point.longitude * d2r;
9988 var deltaLat = lat1rad - lat2rad;
9989 var deltaLong = long1rad - long2rad;
9990 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
9991 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2);
9992 // Square of half the straight line chord distance between both points.
9993 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
9994 a = Math.min(1.0, a);
9995 return 2 * Math.asin(Math.sqrt(a));
9996 },
9997
9998 /**
9999 * Returns the distance from this GeoPoint to another in kilometers.
10000 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10001 * @return {Number}
10002 */
10003 kilometersTo: function kilometersTo(point) {
10004 return this.radiansTo(point) * 6371.0;
10005 },
10006
10007 /**
10008 * Returns the distance from this GeoPoint to another in miles.
10009 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10010 * @return {Number}
10011 */
10012 milesTo: function milesTo(point) {
10013 return this.radiansTo(point) * 3958.8;
10014 }
10015 });
10016};
10017
10018/***/ }),
10019/* 288 */
10020/***/ (function(module, exports, __webpack_require__) {
10021
10022"use strict";
10023
10024
10025var _ = __webpack_require__(0);
10026
10027module.exports = function (AV) {
10028 var PUBLIC_KEY = '*';
10029
10030 /**
10031 * Creates a new ACL.
10032 * If no argument is given, the ACL has no permissions for anyone.
10033 * If the argument is a AV.User, the ACL will have read and write
10034 * permission for only that user.
10035 * If the argument is any other JSON object, that object will be interpretted
10036 * as a serialized ACL created with toJSON().
10037 * @see AV.Object#setACL
10038 * @class
10039 *
10040 * <p>An ACL, or Access Control List can be added to any
10041 * <code>AV.Object</code> to restrict access to only a subset of users
10042 * of your application.</p>
10043 */
10044 AV.ACL = function (arg1) {
10045 var self = this;
10046 self.permissionsById = {};
10047 if (_.isObject(arg1)) {
10048 if (arg1 instanceof AV.User) {
10049 self.setReadAccess(arg1, true);
10050 self.setWriteAccess(arg1, true);
10051 } else {
10052 if (_.isFunction(arg1)) {
10053 throw new Error('AV.ACL() called with a function. Did you forget ()?');
10054 }
10055 AV._objectEach(arg1, function (accessList, userId) {
10056 if (!_.isString(userId)) {
10057 throw new Error('Tried to create an ACL with an invalid userId.');
10058 }
10059 self.permissionsById[userId] = {};
10060 AV._objectEach(accessList, function (allowed, permission) {
10061 if (permission !== 'read' && permission !== 'write') {
10062 throw new Error('Tried to create an ACL with an invalid permission type.');
10063 }
10064 if (!_.isBoolean(allowed)) {
10065 throw new Error('Tried to create an ACL with an invalid permission value.');
10066 }
10067 self.permissionsById[userId][permission] = allowed;
10068 });
10069 });
10070 }
10071 }
10072 };
10073
10074 /**
10075 * Returns a JSON-encoded version of the ACL.
10076 * @return {Object}
10077 */
10078 AV.ACL.prototype.toJSON = function () {
10079 return _.clone(this.permissionsById);
10080 };
10081
10082 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
10083 if (userId instanceof AV.User) {
10084 userId = userId.id;
10085 } else if (userId instanceof AV.Role) {
10086 userId = 'role:' + userId.getName();
10087 }
10088 if (!_.isString(userId)) {
10089 throw new Error('userId must be a string.');
10090 }
10091 if (!_.isBoolean(allowed)) {
10092 throw new Error('allowed must be either true or false.');
10093 }
10094 var permissions = this.permissionsById[userId];
10095 if (!permissions) {
10096 if (!allowed) {
10097 // The user already doesn't have this permission, so no action needed.
10098 return;
10099 } else {
10100 permissions = {};
10101 this.permissionsById[userId] = permissions;
10102 }
10103 }
10104
10105 if (allowed) {
10106 this.permissionsById[userId][accessType] = true;
10107 } else {
10108 delete permissions[accessType];
10109 if (_.isEmpty(permissions)) {
10110 delete this.permissionsById[userId];
10111 }
10112 }
10113 };
10114
10115 AV.ACL.prototype._getAccess = function (accessType, userId) {
10116 if (userId instanceof AV.User) {
10117 userId = userId.id;
10118 } else if (userId instanceof AV.Role) {
10119 userId = 'role:' + userId.getName();
10120 }
10121 var permissions = this.permissionsById[userId];
10122 if (!permissions) {
10123 return false;
10124 }
10125 return permissions[accessType] ? true : false;
10126 };
10127
10128 /**
10129 * Set whether the given user is allowed to read this object.
10130 * @param userId An instance of AV.User or its objectId.
10131 * @param {Boolean} allowed Whether that user should have read access.
10132 */
10133 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
10134 this._setAccess('read', userId, allowed);
10135 };
10136
10137 /**
10138 * Get whether the given user id is *explicitly* allowed to read this object.
10139 * Even if this returns false, the user may still be able to access it if
10140 * getPublicReadAccess returns true or a role that the user belongs to has
10141 * write access.
10142 * @param userId An instance of AV.User or its objectId, or a AV.Role.
10143 * @return {Boolean}
10144 */
10145 AV.ACL.prototype.getReadAccess = function (userId) {
10146 return this._getAccess('read', userId);
10147 };
10148
10149 /**
10150 * Set whether the given user id is allowed to write this object.
10151 * @param userId An instance of AV.User or its objectId, or a AV.Role..
10152 * @param {Boolean} allowed Whether that user should have write access.
10153 */
10154 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
10155 this._setAccess('write', userId, allowed);
10156 };
10157
10158 /**
10159 * Get whether the given user id is *explicitly* allowed to write this object.
10160 * Even if this returns false, the user may still be able to write it if
10161 * getPublicWriteAccess returns true or a role that the user belongs to has
10162 * write access.
10163 * @param userId An instance of AV.User or its objectId, or a AV.Role.
10164 * @return {Boolean}
10165 */
10166 AV.ACL.prototype.getWriteAccess = function (userId) {
10167 return this._getAccess('write', userId);
10168 };
10169
10170 /**
10171 * Set whether the public is allowed to read this object.
10172 * @param {Boolean} allowed
10173 */
10174 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
10175 this.setReadAccess(PUBLIC_KEY, allowed);
10176 };
10177
10178 /**
10179 * Get whether the public is allowed to read this object.
10180 * @return {Boolean}
10181 */
10182 AV.ACL.prototype.getPublicReadAccess = function () {
10183 return this.getReadAccess(PUBLIC_KEY);
10184 };
10185
10186 /**
10187 * Set whether the public is allowed to write this object.
10188 * @param {Boolean} allowed
10189 */
10190 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
10191 this.setWriteAccess(PUBLIC_KEY, allowed);
10192 };
10193
10194 /**
10195 * Get whether the public is allowed to write this object.
10196 * @return {Boolean}
10197 */
10198 AV.ACL.prototype.getPublicWriteAccess = function () {
10199 return this.getWriteAccess(PUBLIC_KEY);
10200 };
10201
10202 /**
10203 * Get whether users belonging to the given role are allowed
10204 * to read this object. Even if this returns false, the role may
10205 * still be able to write it if a parent role has read access.
10206 *
10207 * @param role The name of the role, or a AV.Role object.
10208 * @return {Boolean} true if the role has read access. false otherwise.
10209 * @throws {String} If role is neither a AV.Role nor a String.
10210 */
10211 AV.ACL.prototype.getRoleReadAccess = function (role) {
10212 if (role instanceof AV.Role) {
10213 // Normalize to the String name
10214 role = role.getName();
10215 }
10216 if (_.isString(role)) {
10217 return this.getReadAccess('role:' + role);
10218 }
10219 throw new Error('role must be a AV.Role or a String');
10220 };
10221
10222 /**
10223 * Get whether users belonging to the given role are allowed
10224 * to write this object. Even if this returns false, the role may
10225 * still be able to write it if a parent role has write access.
10226 *
10227 * @param role The name of the role, or a AV.Role object.
10228 * @return {Boolean} true if the role has write access. false otherwise.
10229 * @throws {String} If role is neither a AV.Role nor a String.
10230 */
10231 AV.ACL.prototype.getRoleWriteAccess = function (role) {
10232 if (role instanceof AV.Role) {
10233 // Normalize to the String name
10234 role = role.getName();
10235 }
10236 if (_.isString(role)) {
10237 return this.getWriteAccess('role:' + role);
10238 }
10239 throw new Error('role must be a AV.Role or a String');
10240 };
10241
10242 /**
10243 * Set whether users belonging to the given role are allowed
10244 * to read this object.
10245 *
10246 * @param role The name of the role, or a AV.Role object.
10247 * @param {Boolean} allowed Whether the given role can read this object.
10248 * @throws {String} If role is neither a AV.Role nor a String.
10249 */
10250 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
10251 if (role instanceof AV.Role) {
10252 // Normalize to the String name
10253 role = role.getName();
10254 }
10255 if (_.isString(role)) {
10256 this.setReadAccess('role:' + role, allowed);
10257 return;
10258 }
10259 throw new Error('role must be a AV.Role or a String');
10260 };
10261
10262 /**
10263 * Set whether users belonging to the given role are allowed
10264 * to write this object.
10265 *
10266 * @param role The name of the role, or a AV.Role object.
10267 * @param {Boolean} allowed Whether the given role can write this object.
10268 * @throws {String} If role is neither a AV.Role nor a String.
10269 */
10270 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
10271 if (role instanceof AV.Role) {
10272 // Normalize to the String name
10273 role = role.getName();
10274 }
10275 if (_.isString(role)) {
10276 this.setWriteAccess('role:' + role, allowed);
10277 return;
10278 }
10279 throw new Error('role must be a AV.Role or a String');
10280 };
10281};
10282
10283/***/ }),
10284/* 289 */
10285/***/ (function(module, exports, __webpack_require__) {
10286
10287"use strict";
10288
10289
10290var _ = __webpack_require__(0);
10291
10292module.exports = function (AV) {
10293 /**
10294 * @private
10295 * @class
10296 * A AV.Op is an atomic operation that can be applied to a field in a
10297 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
10298 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
10299 * is a AV.Op.Unset. These operations are stored in a AV.Object and
10300 * sent to the server as part of <code>object.save()</code> operations.
10301 * Instances of AV.Op should be immutable.
10302 *
10303 * You should not create subclasses of AV.Op or instantiate AV.Op
10304 * directly.
10305 */
10306 AV.Op = function () {
10307 this._initialize.apply(this, arguments);
10308 };
10309
10310 _.extend(AV.Op.prototype,
10311 /** @lends AV.Op.prototype */{
10312 _initialize: function _initialize() {}
10313 });
10314
10315 _.extend(AV.Op, {
10316 /**
10317 * To create a new Op, call AV.Op._extend();
10318 * @private
10319 */
10320 _extend: AV._extend,
10321
10322 // A map of __op string to decoder function.
10323 _opDecoderMap: {},
10324
10325 /**
10326 * Registers a function to convert a json object with an __op field into an
10327 * instance of a subclass of AV.Op.
10328 * @private
10329 */
10330 _registerDecoder: function _registerDecoder(opName, decoder) {
10331 AV.Op._opDecoderMap[opName] = decoder;
10332 },
10333
10334 /**
10335 * Converts a json object into an instance of a subclass of AV.Op.
10336 * @private
10337 */
10338 _decode: function _decode(json) {
10339 var decoder = AV.Op._opDecoderMap[json.__op];
10340 if (decoder) {
10341 return decoder(json);
10342 } else {
10343 return undefined;
10344 }
10345 }
10346 });
10347
10348 /*
10349 * Add a handler for Batch ops.
10350 */
10351 AV.Op._registerDecoder('Batch', function (json) {
10352 var op = null;
10353 AV._arrayEach(json.ops, function (nextOp) {
10354 nextOp = AV.Op._decode(nextOp);
10355 op = nextOp._mergeWithPrevious(op);
10356 });
10357 return op;
10358 });
10359
10360 /**
10361 * @private
10362 * @class
10363 * A Set operation indicates that either the field was changed using
10364 * AV.Object.set, or it is a mutable container that was detected as being
10365 * changed.
10366 */
10367 AV.Op.Set = AV.Op._extend(
10368 /** @lends AV.Op.Set.prototype */{
10369 _initialize: function _initialize(value) {
10370 this._value = value;
10371 },
10372
10373 /**
10374 * Returns the new value of this field after the set.
10375 */
10376 value: function value() {
10377 return this._value;
10378 },
10379
10380 /**
10381 * Returns a JSON version of the operation suitable for sending to AV.
10382 * @return {Object}
10383 */
10384 toJSON: function toJSON() {
10385 return AV._encode(this.value());
10386 },
10387
10388 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10389 return this;
10390 },
10391
10392 _estimate: function _estimate(oldValue) {
10393 return this.value();
10394 }
10395 });
10396
10397 /**
10398 * A sentinel value that is returned by AV.Op.Unset._estimate to
10399 * indicate the field should be deleted. Basically, if you find _UNSET as a
10400 * value in your object, you should remove that key.
10401 */
10402 AV.Op._UNSET = {};
10403
10404 /**
10405 * @private
10406 * @class
10407 * An Unset operation indicates that this field has been deleted from the
10408 * object.
10409 */
10410 AV.Op.Unset = AV.Op._extend(
10411 /** @lends AV.Op.Unset.prototype */{
10412 /**
10413 * Returns a JSON version of the operation suitable for sending to AV.
10414 * @return {Object}
10415 */
10416 toJSON: function toJSON() {
10417 return { __op: 'Delete' };
10418 },
10419
10420 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10421 return this;
10422 },
10423
10424 _estimate: function _estimate(oldValue) {
10425 return AV.Op._UNSET;
10426 }
10427 });
10428
10429 AV.Op._registerDecoder('Delete', function (json) {
10430 return new AV.Op.Unset();
10431 });
10432
10433 /**
10434 * @private
10435 * @class
10436 * An Increment is an atomic operation where the numeric value for the field
10437 * will be increased by a given amount.
10438 */
10439 AV.Op.Increment = AV.Op._extend(
10440 /** @lends AV.Op.Increment.prototype */{
10441 _initialize: function _initialize(amount) {
10442 this._amount = amount;
10443 },
10444
10445 /**
10446 * Returns the amount to increment by.
10447 * @return {Number} the amount to increment by.
10448 */
10449 amount: function amount() {
10450 return this._amount;
10451 },
10452
10453 /**
10454 * Returns a JSON version of the operation suitable for sending to AV.
10455 * @return {Object}
10456 */
10457 toJSON: function toJSON() {
10458 return { __op: 'Increment', amount: this._amount };
10459 },
10460
10461 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10462 if (!previous) {
10463 return this;
10464 } else if (previous instanceof AV.Op.Unset) {
10465 return new AV.Op.Set(this.amount());
10466 } else if (previous instanceof AV.Op.Set) {
10467 return new AV.Op.Set(previous.value() + this.amount());
10468 } else if (previous instanceof AV.Op.Increment) {
10469 return new AV.Op.Increment(this.amount() + previous.amount());
10470 } else {
10471 throw new Error('Op is invalid after previous op.');
10472 }
10473 },
10474
10475 _estimate: function _estimate(oldValue) {
10476 if (!oldValue) {
10477 return this.amount();
10478 }
10479 return oldValue + this.amount();
10480 }
10481 });
10482
10483 AV.Op._registerDecoder('Increment', function (json) {
10484 return new AV.Op.Increment(json.amount);
10485 });
10486
10487 /**
10488 * @private
10489 * @class
10490 * BitAnd is an atomic operation where the given value will be bit and to the
10491 * value than is stored in this field.
10492 */
10493 AV.Op.BitAnd = AV.Op._extend(
10494 /** @lends AV.Op.BitAnd.prototype */{
10495 _initialize: function _initialize(value) {
10496 this._value = value;
10497 },
10498 value: function value() {
10499 return this._value;
10500 },
10501
10502
10503 /**
10504 * Returns a JSON version of the operation suitable for sending to AV.
10505 * @return {Object}
10506 */
10507 toJSON: function toJSON() {
10508 return { __op: 'BitAnd', value: this.value() };
10509 },
10510 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10511 if (!previous) {
10512 return this;
10513 } else if (previous instanceof AV.Op.Unset) {
10514 return new AV.Op.Set(0);
10515 } else if (previous instanceof AV.Op.Set) {
10516 return new AV.Op.Set(previous.value() & this.value());
10517 } else {
10518 throw new Error('Op is invalid after previous op.');
10519 }
10520 },
10521 _estimate: function _estimate(oldValue) {
10522 return oldValue & this.value();
10523 }
10524 });
10525
10526 AV.Op._registerDecoder('BitAnd', function (json) {
10527 return new AV.Op.BitAnd(json.value);
10528 });
10529
10530 /**
10531 * @private
10532 * @class
10533 * BitOr is an atomic operation where the given value will be bit and to the
10534 * value than is stored in this field.
10535 */
10536 AV.Op.BitOr = AV.Op._extend(
10537 /** @lends AV.Op.BitOr.prototype */{
10538 _initialize: function _initialize(value) {
10539 this._value = value;
10540 },
10541 value: function value() {
10542 return this._value;
10543 },
10544
10545
10546 /**
10547 * Returns a JSON version of the operation suitable for sending to AV.
10548 * @return {Object}
10549 */
10550 toJSON: function toJSON() {
10551 return { __op: 'BitOr', value: this.value() };
10552 },
10553 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10554 if (!previous) {
10555 return this;
10556 } else if (previous instanceof AV.Op.Unset) {
10557 return new AV.Op.Set(this.value());
10558 } else if (previous instanceof AV.Op.Set) {
10559 return new AV.Op.Set(previous.value() | this.value());
10560 } else {
10561 throw new Error('Op is invalid after previous op.');
10562 }
10563 },
10564 _estimate: function _estimate(oldValue) {
10565 return oldValue | this.value();
10566 }
10567 });
10568
10569 AV.Op._registerDecoder('BitOr', function (json) {
10570 return new AV.Op.BitOr(json.value);
10571 });
10572
10573 /**
10574 * @private
10575 * @class
10576 * BitXor is an atomic operation where the given value will be bit and to the
10577 * value than is stored in this field.
10578 */
10579 AV.Op.BitXor = AV.Op._extend(
10580 /** @lends AV.Op.BitXor.prototype */{
10581 _initialize: function _initialize(value) {
10582 this._value = value;
10583 },
10584 value: function value() {
10585 return this._value;
10586 },
10587
10588
10589 /**
10590 * Returns a JSON version of the operation suitable for sending to AV.
10591 * @return {Object}
10592 */
10593 toJSON: function toJSON() {
10594 return { __op: 'BitXor', value: this.value() };
10595 },
10596 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10597 if (!previous) {
10598 return this;
10599 } else if (previous instanceof AV.Op.Unset) {
10600 return new AV.Op.Set(this.value());
10601 } else if (previous instanceof AV.Op.Set) {
10602 return new AV.Op.Set(previous.value() ^ this.value());
10603 } else {
10604 throw new Error('Op is invalid after previous op.');
10605 }
10606 },
10607 _estimate: function _estimate(oldValue) {
10608 return oldValue ^ this.value();
10609 }
10610 });
10611
10612 AV.Op._registerDecoder('BitXor', function (json) {
10613 return new AV.Op.BitXor(json.value);
10614 });
10615
10616 /**
10617 * @private
10618 * @class
10619 * Add is an atomic operation where the given objects will be appended to the
10620 * array that is stored in this field.
10621 */
10622 AV.Op.Add = AV.Op._extend(
10623 /** @lends AV.Op.Add.prototype */{
10624 _initialize: function _initialize(objects) {
10625 this._objects = objects;
10626 },
10627
10628 /**
10629 * Returns the objects to be added to the array.
10630 * @return {Array} The objects to be added to the array.
10631 */
10632 objects: function objects() {
10633 return this._objects;
10634 },
10635
10636 /**
10637 * Returns a JSON version of the operation suitable for sending to AV.
10638 * @return {Object}
10639 */
10640 toJSON: function toJSON() {
10641 return { __op: 'Add', objects: AV._encode(this.objects()) };
10642 },
10643
10644 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10645 if (!previous) {
10646 return this;
10647 } else if (previous instanceof AV.Op.Unset) {
10648 return new AV.Op.Set(this.objects());
10649 } else if (previous instanceof AV.Op.Set) {
10650 return new AV.Op.Set(this._estimate(previous.value()));
10651 } else if (previous instanceof AV.Op.Add) {
10652 return new AV.Op.Add(previous.objects().concat(this.objects()));
10653 } else {
10654 throw new Error('Op is invalid after previous op.');
10655 }
10656 },
10657
10658 _estimate: function _estimate(oldValue) {
10659 if (!oldValue) {
10660 return _.clone(this.objects());
10661 } else {
10662 return oldValue.concat(this.objects());
10663 }
10664 }
10665 });
10666
10667 AV.Op._registerDecoder('Add', function (json) {
10668 return new AV.Op.Add(AV._decode(json.objects));
10669 });
10670
10671 /**
10672 * @private
10673 * @class
10674 * AddUnique is an atomic operation where the given items will be appended to
10675 * the array that is stored in this field only if they were not already
10676 * present in the array.
10677 */
10678 AV.Op.AddUnique = AV.Op._extend(
10679 /** @lends AV.Op.AddUnique.prototype */{
10680 _initialize: function _initialize(objects) {
10681 this._objects = _.uniq(objects);
10682 },
10683
10684 /**
10685 * Returns the objects to be added to the array.
10686 * @return {Array} The objects to be added to the array.
10687 */
10688 objects: function objects() {
10689 return this._objects;
10690 },
10691
10692 /**
10693 * Returns a JSON version of the operation suitable for sending to AV.
10694 * @return {Object}
10695 */
10696 toJSON: function toJSON() {
10697 return { __op: 'AddUnique', objects: AV._encode(this.objects()) };
10698 },
10699
10700 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10701 if (!previous) {
10702 return this;
10703 } else if (previous instanceof AV.Op.Unset) {
10704 return new AV.Op.Set(this.objects());
10705 } else if (previous instanceof AV.Op.Set) {
10706 return new AV.Op.Set(this._estimate(previous.value()));
10707 } else if (previous instanceof AV.Op.AddUnique) {
10708 return new AV.Op.AddUnique(this._estimate(previous.objects()));
10709 } else {
10710 throw new Error('Op is invalid after previous op.');
10711 }
10712 },
10713
10714 _estimate: function _estimate(oldValue) {
10715 if (!oldValue) {
10716 return _.clone(this.objects());
10717 } else {
10718 // We can't just take the _.uniq(_.union(...)) of oldValue and
10719 // this.objects, because the uniqueness may not apply to oldValue
10720 // (especially if the oldValue was set via .set())
10721 var newValue = _.clone(oldValue);
10722 AV._arrayEach(this.objects(), function (obj) {
10723 if (obj instanceof AV.Object && obj.id) {
10724 var matchingObj = _.find(newValue, function (anObj) {
10725 return anObj instanceof AV.Object && anObj.id === obj.id;
10726 });
10727 if (!matchingObj) {
10728 newValue.push(obj);
10729 } else {
10730 var index = _.indexOf(newValue, matchingObj);
10731 newValue[index] = obj;
10732 }
10733 } else if (!_.contains(newValue, obj)) {
10734 newValue.push(obj);
10735 }
10736 });
10737 return newValue;
10738 }
10739 }
10740 });
10741
10742 AV.Op._registerDecoder('AddUnique', function (json) {
10743 return new AV.Op.AddUnique(AV._decode(json.objects));
10744 });
10745
10746 /**
10747 * @private
10748 * @class
10749 * Remove is an atomic operation where the given objects will be removed from
10750 * the array that is stored in this field.
10751 */
10752 AV.Op.Remove = AV.Op._extend(
10753 /** @lends AV.Op.Remove.prototype */{
10754 _initialize: function _initialize(objects) {
10755 this._objects = _.uniq(objects);
10756 },
10757
10758 /**
10759 * Returns the objects to be removed from the array.
10760 * @return {Array} The objects to be removed from the array.
10761 */
10762 objects: function objects() {
10763 return this._objects;
10764 },
10765
10766 /**
10767 * Returns a JSON version of the operation suitable for sending to AV.
10768 * @return {Object}
10769 */
10770 toJSON: function toJSON() {
10771 return { __op: 'Remove', objects: AV._encode(this.objects()) };
10772 },
10773
10774 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10775 if (!previous) {
10776 return this;
10777 } else if (previous instanceof AV.Op.Unset) {
10778 return previous;
10779 } else if (previous instanceof AV.Op.Set) {
10780 return new AV.Op.Set(this._estimate(previous.value()));
10781 } else if (previous instanceof AV.Op.Remove) {
10782 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
10783 } else {
10784 throw new Error('Op is invalid after previous op.');
10785 }
10786 },
10787
10788 _estimate: function _estimate(oldValue) {
10789 if (!oldValue) {
10790 return [];
10791 } else {
10792 var newValue = _.difference(oldValue, this.objects());
10793 // If there are saved AV Objects being removed, also remove them.
10794 AV._arrayEach(this.objects(), function (obj) {
10795 if (obj instanceof AV.Object && obj.id) {
10796 newValue = _.reject(newValue, function (other) {
10797 return other instanceof AV.Object && other.id === obj.id;
10798 });
10799 }
10800 });
10801 return newValue;
10802 }
10803 }
10804 });
10805
10806 AV.Op._registerDecoder('Remove', function (json) {
10807 return new AV.Op.Remove(AV._decode(json.objects));
10808 });
10809
10810 /**
10811 * @private
10812 * @class
10813 * A Relation operation indicates that the field is an instance of
10814 * AV.Relation, and objects are being added to, or removed from, that
10815 * relation.
10816 */
10817 AV.Op.Relation = AV.Op._extend(
10818 /** @lends AV.Op.Relation.prototype */{
10819 _initialize: function _initialize(adds, removes) {
10820 this._targetClassName = null;
10821
10822 var self = this;
10823
10824 var pointerToId = function pointerToId(object) {
10825 if (object instanceof AV.Object) {
10826 if (!object.id) {
10827 throw new Error("You can't add an unsaved AV.Object to a relation.");
10828 }
10829 if (!self._targetClassName) {
10830 self._targetClassName = object.className;
10831 }
10832 if (self._targetClassName !== object.className) {
10833 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
10834 }
10835 return object.id;
10836 }
10837 return object;
10838 };
10839
10840 this.relationsToAdd = _.uniq(_.map(adds, pointerToId));
10841 this.relationsToRemove = _.uniq(_.map(removes, pointerToId));
10842 },
10843
10844 /**
10845 * Returns an array of unfetched AV.Object that are being added to the
10846 * relation.
10847 * @return {Array}
10848 */
10849 added: function added() {
10850 var self = this;
10851 return _.map(this.relationsToAdd, function (objectId) {
10852 var object = AV.Object._create(self._targetClassName);
10853 object.id = objectId;
10854 return object;
10855 });
10856 },
10857
10858 /**
10859 * Returns an array of unfetched AV.Object that are being removed from
10860 * the relation.
10861 * @return {Array}
10862 */
10863 removed: function removed() {
10864 var self = this;
10865 return _.map(this.relationsToRemove, function (objectId) {
10866 var object = AV.Object._create(self._targetClassName);
10867 object.id = objectId;
10868 return object;
10869 });
10870 },
10871
10872 /**
10873 * Returns a JSON version of the operation suitable for sending to AV.
10874 * @return {Object}
10875 */
10876 toJSON: function toJSON() {
10877 var adds = null;
10878 var removes = null;
10879 var self = this;
10880 var idToPointer = function idToPointer(id) {
10881 return {
10882 __type: 'Pointer',
10883 className: self._targetClassName,
10884 objectId: id
10885 };
10886 };
10887 var pointers = null;
10888 if (this.relationsToAdd.length > 0) {
10889 pointers = _.map(this.relationsToAdd, idToPointer);
10890 adds = { __op: 'AddRelation', objects: pointers };
10891 }
10892
10893 if (this.relationsToRemove.length > 0) {
10894 pointers = _.map(this.relationsToRemove, idToPointer);
10895 removes = { __op: 'RemoveRelation', objects: pointers };
10896 }
10897
10898 if (adds && removes) {
10899 return { __op: 'Batch', ops: [adds, removes] };
10900 }
10901
10902 return adds || removes || {};
10903 },
10904
10905 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10906 if (!previous) {
10907 return this;
10908 } else if (previous instanceof AV.Op.Unset) {
10909 throw new Error("You can't modify a relation after deleting it.");
10910 } else if (previous instanceof AV.Op.Relation) {
10911 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
10912 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
10913 }
10914 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
10915 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
10916
10917 var newRelation = new AV.Op.Relation(newAdd, newRemove);
10918 newRelation._targetClassName = this._targetClassName;
10919 return newRelation;
10920 } else {
10921 throw new Error('Op is invalid after previous op.');
10922 }
10923 },
10924
10925 _estimate: function _estimate(oldValue, object, key) {
10926 if (!oldValue) {
10927 var relation = new AV.Relation(object, key);
10928 relation.targetClassName = this._targetClassName;
10929 } else if (oldValue instanceof AV.Relation) {
10930 if (this._targetClassName) {
10931 if (oldValue.targetClassName) {
10932 if (oldValue.targetClassName !== this._targetClassName) {
10933 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
10934 }
10935 } else {
10936 oldValue.targetClassName = this._targetClassName;
10937 }
10938 }
10939 return oldValue;
10940 } else {
10941 throw new Error('Op is invalid after previous op.');
10942 }
10943 }
10944 });
10945
10946 AV.Op._registerDecoder('AddRelation', function (json) {
10947 return new AV.Op.Relation(AV._decode(json.objects), []);
10948 });
10949 AV.Op._registerDecoder('RemoveRelation', function (json) {
10950 return new AV.Op.Relation([], AV._decode(json.objects));
10951 });
10952};
10953
10954/***/ }),
10955/* 290 */
10956/***/ (function(module, exports, __webpack_require__) {
10957
10958"use strict";
10959
10960
10961var _ = __webpack_require__(0);
10962
10963module.exports = function (AV) {
10964 /**
10965 * Creates a new Relation for the given parent object and key. This
10966 * constructor should rarely be used directly, but rather created by
10967 * {@link AV.Object#relation}.
10968 * @param {AV.Object} parent The parent of this relation.
10969 * @param {String} key The key for this relation on the parent.
10970 * @see AV.Object#relation
10971 * @class
10972 *
10973 * <p>
10974 * A class that is used to access all of the children of a many-to-many
10975 * relationship. Each instance of AV.Relation is associated with a
10976 * particular parent object and key.
10977 * </p>
10978 */
10979 AV.Relation = function (parent, key) {
10980 if (!_.isString(key)) {
10981 throw new TypeError('key must be a string');
10982 }
10983 this.parent = parent;
10984 this.key = key;
10985 this.targetClassName = null;
10986 };
10987
10988 /**
10989 * Creates a query that can be used to query the parent objects in this relation.
10990 * @param {String} parentClass The parent class or name.
10991 * @param {String} relationKey The relation field key in parent.
10992 * @param {AV.Object} child The child object.
10993 * @return {AV.Query}
10994 */
10995 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
10996 var query = new AV.Query(parentClass);
10997 query.equalTo(relationKey, child._toPointer());
10998 return query;
10999 };
11000
11001 _.extend(AV.Relation.prototype,
11002 /** @lends AV.Relation.prototype */{
11003 /**
11004 * Makes sure that this relation has the right parent and key.
11005 * @private
11006 */
11007 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
11008 this.parent = this.parent || parent;
11009 this.key = this.key || key;
11010 if (this.parent !== parent) {
11011 throw new Error('Internal Error. Relation retrieved from two different Objects.');
11012 }
11013 if (this.key !== key) {
11014 throw new Error('Internal Error. Relation retrieved from two different keys.');
11015 }
11016 },
11017
11018 /**
11019 * Adds a AV.Object or an array of AV.Objects to the relation.
11020 * @param {AV.Object|AV.Object[]} objects The item or items to add.
11021 */
11022 add: function add(objects) {
11023 if (!_.isArray(objects)) {
11024 objects = [objects];
11025 }
11026
11027 var change = new AV.Op.Relation(objects, []);
11028 this.parent.set(this.key, change);
11029 this.targetClassName = change._targetClassName;
11030 },
11031
11032 /**
11033 * Removes a AV.Object or an array of AV.Objects from this relation.
11034 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
11035 */
11036 remove: function remove(objects) {
11037 if (!_.isArray(objects)) {
11038 objects = [objects];
11039 }
11040
11041 var change = new AV.Op.Relation([], objects);
11042 this.parent.set(this.key, change);
11043 this.targetClassName = change._targetClassName;
11044 },
11045
11046 /**
11047 * Returns a JSON version of the object suitable for saving to disk.
11048 * @return {Object}
11049 */
11050 toJSON: function toJSON() {
11051 return { __type: 'Relation', className: this.targetClassName };
11052 },
11053
11054 /**
11055 * Returns a AV.Query that is limited to objects in this
11056 * relation.
11057 * @return {AV.Query}
11058 */
11059 query: function query() {
11060 var targetClass;
11061 var query;
11062 if (!this.targetClassName) {
11063 targetClass = AV.Object._getSubclass(this.parent.className);
11064 query = new AV.Query(targetClass);
11065 query._defaultParams.redirectClassNameForKey = this.key;
11066 } else {
11067 targetClass = AV.Object._getSubclass(this.targetClassName);
11068 query = new AV.Query(targetClass);
11069 }
11070 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
11071 query._addCondition('$relatedTo', 'key', this.key);
11072
11073 return query;
11074 }
11075 });
11076};
11077
11078/***/ }),
11079/* 291 */
11080/***/ (function(module, exports, __webpack_require__) {
11081
11082"use strict";
11083
11084
11085var _promise = __webpack_require__(4);
11086
11087var _promise2 = _interopRequireDefault(_promise);
11088
11089function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11090
11091var _ = __webpack_require__(0);
11092var cos = __webpack_require__(292);
11093var qiniu = __webpack_require__(293);
11094var s3 = __webpack_require__(308);
11095var AVError = __webpack_require__(23);
11096var AVRequest = __webpack_require__(12)._request;
11097
11098var _require = __webpack_require__(15),
11099 tap = _require.tap,
11100 transformFetchOptions = _require.transformFetchOptions;
11101
11102var debug = __webpack_require__(35)('leancloud:file');
11103var parseBase64 = __webpack_require__(312);
11104
11105module.exports = function (AV) {
11106 // port from browserify path module
11107 // since react-native packager won't shim node modules.
11108 var extname = function extname(path) {
11109 if (!_.isString(path)) return '';
11110 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
11111 };
11112
11113 var b64Digit = function b64Digit(number) {
11114 if (number < 26) {
11115 return String.fromCharCode(65 + number);
11116 }
11117 if (number < 52) {
11118 return String.fromCharCode(97 + (number - 26));
11119 }
11120 if (number < 62) {
11121 return String.fromCharCode(48 + (number - 52));
11122 }
11123 if (number === 62) {
11124 return '+';
11125 }
11126 if (number === 63) {
11127 return '/';
11128 }
11129 throw new Error('Tried to encode large digit ' + number + ' in base64.');
11130 };
11131
11132 var encodeBase64 = function encodeBase64(array) {
11133 var chunks = [];
11134 chunks.length = Math.ceil(array.length / 3);
11135 _.times(chunks.length, function (i) {
11136 var b1 = array[i * 3];
11137 var b2 = array[i * 3 + 1] || 0;
11138 var b3 = array[i * 3 + 2] || 0;
11139
11140 var has2 = i * 3 + 1 < array.length;
11141 var has3 = i * 3 + 2 < array.length;
11142
11143 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('');
11144 });
11145 return chunks.join('');
11146 };
11147
11148 /**
11149 * An AV.File is a local representation of a file that is saved to the AV
11150 * cloud.
11151 * @param name {String} The file's name. This will change to a unique value
11152 * once the file has finished saving.
11153 * @param data {Array} The data for the file, as either:
11154 * 1. an Array of byte value Numbers, or
11155 * 2. an Object like { base64: "..." } with a base64-encoded String.
11156 * 3. a Blob(File) selected with a file upload control in a browser.
11157 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
11158 * in some non-browser environments such as React Native.
11159 * 5. a Buffer in Node.js runtime.
11160 * 6. a Stream in Node.js runtime.
11161 *
11162 * For example:<pre>
11163 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
11164 * if (fileUploadControl.files.length > 0) {
11165 * var file = fileUploadControl.files[0];
11166 * var name = "photo.jpg";
11167 * var file = new AV.File(name, file);
11168 * file.save().then(function() {
11169 * // The file has been saved to AV.
11170 * }, function(error) {
11171 * // The file either could not be read, or could not be saved to AV.
11172 * });
11173 * }</pre>
11174 *
11175 * @class
11176 * @param [mimeType] {String} Content-Type header to use for the file. If
11177 * this is omitted, the content type will be inferred from the name's
11178 * extension.
11179 */
11180 AV.File = function (name, data, mimeType) {
11181 this.attributes = {
11182 name: name,
11183 url: '',
11184 metaData: {},
11185 // 用来存储转换后要上传的 base64 String
11186 base64: ''
11187 };
11188
11189 if (_.isString(data)) {
11190 throw new TypeError('Creating an AV.File from a String is not yet supported.');
11191 }
11192 if (_.isArray(data)) {
11193 this.attributes.metaData.size = data.length;
11194 data = { base64: encodeBase64(data) };
11195 }
11196
11197 this._extName = '';
11198 this._data = data;
11199 this._uploadHeaders = {};
11200
11201 if (data && data.blob && typeof data.blob.uri === 'string') {
11202 this._extName = extname(data.blob.uri);
11203 }
11204
11205 if (typeof Blob !== 'undefined' && data instanceof Blob) {
11206 if (data.size) {
11207 this.attributes.metaData.size = data.size;
11208 }
11209 if (data.name) {
11210 this._extName = extname(data.name);
11211 }
11212 }
11213
11214 var owner = void 0;
11215 if (data && data.owner) {
11216 owner = data.owner;
11217 } else if (!AV._config.disableCurrentUser) {
11218 try {
11219 owner = AV.User.current();
11220 } catch (error) {
11221 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
11222 throw error;
11223 }
11224 }
11225 }
11226
11227 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
11228
11229 this.set('mime_type', mimeType);
11230 };
11231
11232 /**
11233 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
11234 * @param {String} name the file name
11235 * @param {String} url the file url.
11236 * @param {Object} [metaData] the file metadata object.
11237 * @param {String} [type] Content-Type header to use for the file. If
11238 * this is omitted, the content type will be inferred from the name's
11239 * extension.
11240 * @return {AV.File} the file object
11241 */
11242 AV.File.withURL = function (name, url, metaData, type) {
11243 if (!name || !url) {
11244 throw new Error('Please provide file name and url');
11245 }
11246 var file = new AV.File(name, null, type);
11247 //copy metaData properties to file.
11248 if (metaData) {
11249 for (var prop in metaData) {
11250 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
11251 }
11252 }
11253 file.attributes.url = url;
11254 //Mark the file is from external source.
11255 file.attributes.metaData.__source = 'external';
11256 file.attributes.metaData.size = 0;
11257 return file;
11258 };
11259
11260 /**
11261 * Creates a file object with exists objectId.
11262 * @param {String} objectId The objectId string
11263 * @return {AV.File} the file object
11264 */
11265 AV.File.createWithoutData = function (objectId) {
11266 if (!objectId) {
11267 throw new TypeError('The objectId must be provided');
11268 }
11269 var file = new AV.File();
11270 file.id = objectId;
11271 return file;
11272 };
11273
11274 _.extend(AV.File.prototype,
11275 /** @lends AV.File.prototype */{
11276 className: '_File',
11277
11278 _toFullJSON: function _toFullJSON(seenObjects) {
11279 var _this = this;
11280
11281 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
11282
11283 var json = _.clone(this.attributes);
11284 AV._objectEach(json, function (val, key) {
11285 json[key] = AV._encode(val, seenObjects, undefined, full);
11286 });
11287 AV._objectEach(this._operations, function (val, key) {
11288 json[key] = val;
11289 });
11290
11291 if (_.has(this, 'id')) {
11292 json.objectId = this.id;
11293 }
11294 ['createdAt', 'updatedAt'].forEach(function (key) {
11295 if (_.has(_this, key)) {
11296 var val = _this[key];
11297 json[key] = _.isDate(val) ? val.toJSON() : val;
11298 }
11299 });
11300 if (full) {
11301 json.__type = 'File';
11302 }
11303 return json;
11304 },
11305
11306
11307 /**
11308 * Returns a JSON version of the file with meta data.
11309 * Inverse to {@link AV.parseJSON}
11310 * @since 3.0.0
11311 * @return {Object}
11312 */
11313 toFullJSON: function toFullJSON() {
11314 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11315
11316 return this._toFullJSON(seenObjects);
11317 },
11318
11319
11320 /**
11321 * Returns a JSON version of the object.
11322 * @return {Object}
11323 */
11324 toJSON: function toJSON(key, holder) {
11325 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
11326
11327 return this._toFullJSON(seenObjects, false);
11328 },
11329
11330
11331 /**
11332 * Gets a Pointer referencing this file.
11333 * @private
11334 */
11335 _toPointer: function _toPointer() {
11336 return {
11337 __type: 'Pointer',
11338 className: this.className,
11339 objectId: this.id
11340 };
11341 },
11342
11343
11344 /**
11345 * Returns the ACL for this file.
11346 * @returns {AV.ACL} An instance of AV.ACL.
11347 */
11348 getACL: function getACL() {
11349 return this._acl;
11350 },
11351
11352
11353 /**
11354 * Sets the ACL to be used for this file.
11355 * @param {AV.ACL} acl An instance of AV.ACL.
11356 */
11357 setACL: function setACL(acl) {
11358 if (!(acl instanceof AV.ACL)) {
11359 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
11360 }
11361 this._acl = acl;
11362 return this;
11363 },
11364
11365
11366 /**
11367 * Gets the name of the file. Before save is called, this is the filename
11368 * given by the user. After save is called, that name gets prefixed with a
11369 * unique identifier.
11370 */
11371 name: function name() {
11372 return this.get('name');
11373 },
11374
11375
11376 /**
11377 * Gets the url of the file. It is only available after you save the file or
11378 * after you get the file from a AV.Object.
11379 * @return {String}
11380 */
11381 url: function url() {
11382 return this.get('url');
11383 },
11384
11385
11386 /**
11387 * Gets the attributs of the file object.
11388 * @param {String} The attribute name which want to get.
11389 * @returns {Any}
11390 */
11391 get: function get(attrName) {
11392 switch (attrName) {
11393 case 'objectId':
11394 return this.id;
11395 case 'url':
11396 case 'name':
11397 case 'mime_type':
11398 case 'metaData':
11399 case 'createdAt':
11400 case 'updatedAt':
11401 return this.attributes[attrName];
11402 default:
11403 return this.attributes.metaData[attrName];
11404 }
11405 },
11406
11407
11408 /**
11409 * Set the metaData of the file object.
11410 * @param {Object} Object is an key value Object for setting metaData.
11411 * @param {String} attr is an optional metadata key.
11412 * @param {Object} value is an optional metadata value.
11413 * @returns {String|Number|Array|Object}
11414 */
11415 set: function set() {
11416 var _this2 = this;
11417
11418 var set = function set(attrName, value) {
11419 switch (attrName) {
11420 case 'name':
11421 case 'url':
11422 case 'mime_type':
11423 case 'base64':
11424 case 'metaData':
11425 _this2.attributes[attrName] = value;
11426 break;
11427 default:
11428 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
11429 _this2.attributes.metaData[attrName] = value;
11430 break;
11431 }
11432 };
11433
11434 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
11435 args[_key] = arguments[_key];
11436 }
11437
11438 switch (args.length) {
11439 case 1:
11440 // 传入一个 Object
11441 for (var k in args[0]) {
11442 set(k, args[0][k]);
11443 }
11444 break;
11445 case 2:
11446 set(args[0], args[1]);
11447 break;
11448 }
11449 return this;
11450 },
11451
11452
11453 /**
11454 * Set a header for the upload request.
11455 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
11456 *
11457 * @param {String} key header key
11458 * @param {String} value header value
11459 * @return {AV.File} this
11460 */
11461 setUploadHeader: function setUploadHeader(key, value) {
11462 this._uploadHeaders[key] = value;
11463 return this;
11464 },
11465
11466
11467 /**
11468 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
11469 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
11470 * <p><pre>
11471 * var metadata = file.metaData(); //Get metadata JSON object.
11472 * var size = file.metaData('size'); // Get the size metadata value.
11473 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
11474 *</pre></p>
11475 * @return {Object} The file's metadata JSON object.
11476 * @param {String} attr an optional metadata key.
11477 * @param {Object} value an optional metadata value.
11478 **/
11479 metaData: function metaData(attr, value) {
11480 if (attr && value) {
11481 this.attributes.metaData[attr] = value;
11482 return this;
11483 } else if (attr && !value) {
11484 return this.attributes.metaData[attr];
11485 } else {
11486 return this.attributes.metaData;
11487 }
11488 },
11489
11490
11491 /**
11492 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
11493 * @return {String} 缩略图URL
11494 * @param {Number} width 宽度,单位:像素
11495 * @param {Number} heigth 高度,单位:像素
11496 * @param {Number} quality 质量,1-100的数字,默认100
11497 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
11498 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
11499 */
11500
11501 thumbnailURL: function thumbnailURL(width, height) {
11502 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
11503 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
11504 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
11505
11506 var url = this.attributes.url;
11507 if (!url) {
11508 throw new Error('Invalid url.');
11509 }
11510 if (!width || !height || width <= 0 || height <= 0) {
11511 throw new Error('Invalid width or height value.');
11512 }
11513 if (quality <= 0 || quality > 100) {
11514 throw new Error('Invalid quality value.');
11515 }
11516 var mode = scaleToFit ? 2 : 1;
11517 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
11518 },
11519
11520
11521 /**
11522 * Returns the file's size.
11523 * @return {Number} The file's size in bytes.
11524 **/
11525 size: function size() {
11526 return this.metaData().size;
11527 },
11528
11529
11530 /**
11531 * Returns the file's owner.
11532 * @return {String} The file's owner id.
11533 */
11534 ownerId: function ownerId() {
11535 return this.metaData().owner;
11536 },
11537
11538
11539 /**
11540 * Destroy the file.
11541 * @param {AuthOptions} options
11542 * @return {Promise} A promise that is fulfilled when the destroy
11543 * completes.
11544 */
11545 destroy: function destroy(options) {
11546 if (!this.id) {
11547 return _promise2.default.reject(new Error('The file id does not eixst.'));
11548 }
11549 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
11550 return request;
11551 },
11552
11553
11554 /**
11555 * Request Qiniu upload token
11556 * @param {string} type
11557 * @return {Promise} Resolved with the response
11558 * @private
11559 */
11560 _fileToken: function _fileToken(type, authOptions) {
11561 var name = this.attributes.name;
11562
11563 var extName = extname(name);
11564 if (!extName && this._extName) {
11565 name += this._extName;
11566 extName = this._extName;
11567 }
11568 var data = {
11569 name: name,
11570 keep_file_name: authOptions.keepFileName,
11571 key: authOptions.key,
11572 ACL: this._acl,
11573 mime_type: type,
11574 metaData: this.attributes.metaData
11575 };
11576 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
11577 },
11578
11579
11580 /**
11581 * @callback UploadProgressCallback
11582 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
11583 */
11584 /**
11585 * Saves the file to the AV cloud.
11586 * @param {AuthOptions} [options] AuthOptions plus:
11587 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
11588 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
11589 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
11590 * @return {Promise} Promise that is resolved when the save finishes.
11591 */
11592 save: function save() {
11593 var _this3 = this;
11594
11595 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11596
11597 if (this.id) {
11598 throw new Error('File is already saved.');
11599 }
11600 if (!this._previousSave) {
11601 if (this._data) {
11602 var mimeType = this.get('mime_type');
11603 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
11604 if (uploadInfo.mime_type) {
11605 mimeType = uploadInfo.mime_type;
11606 _this3.set('mime_type', mimeType);
11607 }
11608 _this3._token = uploadInfo.token;
11609 return _promise2.default.resolve().then(function () {
11610 var data = _this3._data;
11611 if (data && data.base64) {
11612 return parseBase64(data.base64, mimeType);
11613 }
11614 if (data && data.blob) {
11615 if (!data.blob.type && mimeType) {
11616 data.blob.type = mimeType;
11617 }
11618 if (!data.blob.name) {
11619 data.blob.name = _this3.get('name');
11620 }
11621 return data.blob;
11622 }
11623 if (typeof Blob !== 'undefined' && data instanceof Blob) {
11624 return data;
11625 }
11626 throw new TypeError('malformed file data');
11627 }).then(function (data) {
11628 var _options = _.extend({}, options);
11629 // filter out download progress events
11630 if (options.onprogress) {
11631 _options.onprogress = function (event) {
11632 if (event.direction === 'download') return;
11633 return options.onprogress(event);
11634 };
11635 }
11636 switch (uploadInfo.provider) {
11637 case 's3':
11638 return s3(uploadInfo, data, _this3, _options);
11639 case 'qcloud':
11640 return cos(uploadInfo, data, _this3, _options);
11641 case 'qiniu':
11642 default:
11643 return qiniu(uploadInfo, data, _this3, _options);
11644 }
11645 }).then(tap(function () {
11646 return _this3._callback(true);
11647 }), function (error) {
11648 _this3._callback(false);
11649 throw error;
11650 });
11651 });
11652 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
11653 // external link file.
11654 var data = {
11655 name: this.attributes.name,
11656 ACL: this._acl,
11657 metaData: this.attributes.metaData,
11658 mime_type: this.mimeType,
11659 url: this.attributes.url
11660 };
11661 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
11662 _this3.id = response.objectId;
11663 return _this3;
11664 });
11665 }
11666 }
11667 return this._previousSave;
11668 },
11669 _callback: function _callback(success) {
11670 AVRequest('fileCallback', null, null, 'post', {
11671 token: this._token,
11672 result: success
11673 }).catch(debug);
11674 delete this._token;
11675 delete this._data;
11676 },
11677
11678
11679 /**
11680 * fetch the file from server. If the server's representation of the
11681 * model differs from its current attributes, they will be overriden,
11682 * @param {Object} fetchOptions Optional options to set 'keys',
11683 * 'include' and 'includeACL' option.
11684 * @param {AuthOptions} options
11685 * @return {Promise} A promise that is fulfilled when the fetch
11686 * completes.
11687 */
11688 fetch: function fetch(fetchOptions, options) {
11689 if (!this.id) {
11690 throw new Error('Cannot fetch unsaved file');
11691 }
11692 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
11693 return request.then(this._finishFetch.bind(this));
11694 },
11695 _finishFetch: function _finishFetch(response) {
11696 var value = AV.Object.prototype.parse(response);
11697 value.attributes = {
11698 name: value.name,
11699 url: value.url,
11700 mime_type: value.mime_type,
11701 bucket: value.bucket
11702 };
11703 value.attributes.metaData = value.metaData || {};
11704 value.id = value.objectId;
11705 // clean
11706 delete value.objectId;
11707 delete value.metaData;
11708 delete value.url;
11709 delete value.name;
11710 delete value.mime_type;
11711 delete value.bucket;
11712 _.extend(this, value);
11713 return this;
11714 }
11715 });
11716};
11717
11718/***/ }),
11719/* 292 */
11720/***/ (function(module, exports, __webpack_require__) {
11721
11722"use strict";
11723
11724
11725var _require = __webpack_require__(36),
11726 getAdapter = _require.getAdapter;
11727
11728var debug = __webpack_require__(35)('cos');
11729
11730module.exports = function (uploadInfo, data, file) {
11731 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
11732
11733 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
11734 var fileFormData = {
11735 field: 'fileContent',
11736 data: data,
11737 name: file.attributes.name
11738 };
11739 var options = {
11740 headers: file._uploadHeaders,
11741 data: {
11742 op: 'upload'
11743 },
11744 onprogress: saveOptions.onprogress
11745 };
11746 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
11747 var upload = getAdapter('upload');
11748 return upload(url, fileFormData, options).then(function (response) {
11749 debug(response.status, response.data);
11750 if (response.ok === false) {
11751 var error = new Error(response.status);
11752 error.response = response;
11753 throw error;
11754 }
11755 file.attributes.url = uploadInfo.url;
11756 file._bucket = uploadInfo.bucket;
11757 file.id = uploadInfo.objectId;
11758 return file;
11759 }, function (error) {
11760 var response = error.response;
11761
11762 if (response) {
11763 debug(response.status, response.data);
11764 error.statusCode = response.status;
11765 error.response = response.data;
11766 }
11767 throw error;
11768 });
11769};
11770
11771/***/ }),
11772/* 293 */
11773/***/ (function(module, exports, __webpack_require__) {
11774
11775"use strict";
11776
11777
11778var _getPrototypeOf = __webpack_require__(155);
11779
11780var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
11781
11782var _possibleConstructorReturn2 = __webpack_require__(294);
11783
11784var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
11785
11786var _inherits2 = __webpack_require__(295);
11787
11788var _inherits3 = _interopRequireDefault(_inherits2);
11789
11790var _promise = __webpack_require__(4);
11791
11792var _promise2 = _interopRequireDefault(_promise);
11793
11794var _classCallCheck2 = __webpack_require__(303);
11795
11796var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
11797
11798var _createClass2 = __webpack_require__(304);
11799
11800var _createClass3 = _interopRequireDefault(_createClass2);
11801
11802var _getIterator2 = __webpack_require__(162);
11803
11804var _getIterator3 = _interopRequireDefault(_getIterator2);
11805
11806var _stringify = __webpack_require__(18);
11807
11808var _stringify2 = _interopRequireDefault(_stringify);
11809
11810function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11811
11812var _require = __webpack_require__(36),
11813 getAdapter = _require.getAdapter;
11814
11815var debug = __webpack_require__(35)('leancloud:qiniu');
11816var ajax = __webpack_require__(58);
11817var btoa = __webpack_require__(307);
11818
11819var SHARD_THRESHOLD = 1024 * 1024 * 64;
11820
11821var CHUNK_SIZE = 1024 * 1024 * 16;
11822
11823function upload(uploadInfo, data, file) {
11824 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
11825
11826 // Get the uptoken to upload files to qiniu.
11827 var uptoken = uploadInfo.token;
11828 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
11829 var fileFormData = {
11830 field: 'file',
11831 data: data,
11832 name: file.attributes.name
11833 };
11834 var options = {
11835 headers: file._uploadHeaders,
11836 data: {
11837 name: file.attributes.name,
11838 key: uploadInfo.key,
11839 token: uptoken
11840 },
11841 onprogress: saveOptions.onprogress
11842 };
11843 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
11844 var upload = getAdapter('upload');
11845 return upload(url, fileFormData, options).then(function (response) {
11846 debug(response.status, response.data);
11847 if (response.ok === false) {
11848 var message = response.status;
11849 if (response.data) {
11850 if (response.data.error) {
11851 message = response.data.error;
11852 } else {
11853 message = (0, _stringify2.default)(response.data);
11854 }
11855 }
11856 var error = new Error(message);
11857 error.response = response;
11858 throw error;
11859 }
11860 file.attributes.url = uploadInfo.url;
11861 file._bucket = uploadInfo.bucket;
11862 file.id = uploadInfo.objectId;
11863 return file;
11864 }, function (error) {
11865 var response = error.response;
11866
11867 if (response) {
11868 debug(response.status, response.data);
11869 error.statusCode = response.status;
11870 error.response = response.data;
11871 }
11872 throw error;
11873 });
11874}
11875
11876function urlSafeBase64(string) {
11877 var base64 = btoa(unescape(encodeURIComponent(string)));
11878 var result = '';
11879 var _iteratorNormalCompletion = true;
11880 var _didIteratorError = false;
11881 var _iteratorError = undefined;
11882
11883 try {
11884 for (var _iterator = (0, _getIterator3.default)(base64), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
11885 var ch = _step.value;
11886
11887 switch (ch) {
11888 case '+':
11889 result += '-';
11890 break;
11891 case '/':
11892 result += '_';
11893 break;
11894 default:
11895 result += ch;
11896 }
11897 }
11898 } catch (err) {
11899 _didIteratorError = true;
11900 _iteratorError = err;
11901 } finally {
11902 try {
11903 if (!_iteratorNormalCompletion && _iterator.return) {
11904 _iterator.return();
11905 }
11906 } finally {
11907 if (_didIteratorError) {
11908 throw _iteratorError;
11909 }
11910 }
11911 }
11912
11913 return result;
11914}
11915
11916var ShardUploader = function () {
11917 function ShardUploader(uploadInfo, data, file, saveOptions) {
11918 var _this = this;
11919
11920 (0, _classCallCheck3.default)(this, ShardUploader);
11921
11922 this.uploadInfo = uploadInfo;
11923 this.data = data;
11924 this.file = file;
11925 this.size = undefined;
11926 this.offset = 0;
11927 this.uploadedChunks = 0;
11928
11929 var key = urlSafeBase64(uploadInfo.key);
11930 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
11931 this.baseURL = uploadURL + '/buckets/' + uploadInfo.bucket + '/objects/' + key + '/uploads';
11932 this.upToken = 'UpToken ' + uploadInfo.token;
11933
11934 this.uploaded = 0;
11935 if (saveOptions && saveOptions.onprogress) {
11936 this.onProgress = function (_ref) {
11937 var loaded = _ref.loaded;
11938
11939 loaded += _this.uploadedChunks * CHUNK_SIZE;
11940 if (loaded <= _this.uploaded) {
11941 return;
11942 }
11943 if (_this.size) {
11944 saveOptions.onprogress({
11945 loaded: loaded,
11946 total: _this.size,
11947 percent: loaded / _this.size * 100
11948 });
11949 } else {
11950 saveOptions.onprogress({ loaded: loaded });
11951 }
11952 _this.uploaded = loaded;
11953 };
11954 }
11955 }
11956
11957 /**
11958 * @returns {Promise<string>}
11959 */
11960
11961
11962 (0, _createClass3.default)(ShardUploader, [{
11963 key: 'getUploadId',
11964 value: function getUploadId() {
11965 return ajax({
11966 method: 'POST',
11967 url: this.baseURL,
11968 headers: {
11969 Authorization: this.upToken
11970 }
11971 }).then(function (res) {
11972 return res.uploadId;
11973 });
11974 }
11975 }, {
11976 key: 'getChunk',
11977 value: function getChunk() {
11978 throw new Error('Not implemented');
11979 }
11980
11981 /**
11982 * @param {string} uploadId
11983 * @param {number} partNumber
11984 * @param {any} data
11985 * @returns {Promise<{ partNumber: number, etag: string }>}
11986 */
11987
11988 }, {
11989 key: 'uploadPart',
11990 value: function uploadPart(uploadId, partNumber, data) {
11991 return ajax({
11992 method: 'PUT',
11993 url: this.baseURL + '/' + uploadId + '/' + partNumber,
11994 headers: {
11995 Authorization: this.upToken
11996 },
11997 data: data,
11998 onprogress: this.onProgress
11999 }).then(function (_ref2) {
12000 var etag = _ref2.etag;
12001 return { partNumber: partNumber, etag: etag };
12002 });
12003 }
12004 }, {
12005 key: 'stopUpload',
12006 value: function stopUpload(uploadId) {
12007 return ajax({
12008 method: 'DELETE',
12009 url: this.baseURL + '/' + uploadId,
12010 headers: {
12011 Authorization: this.upToken
12012 }
12013 });
12014 }
12015 }, {
12016 key: 'upload',
12017 value: function upload() {
12018 var _this2 = this;
12019
12020 var parts = [];
12021 return this.getUploadId().then(function (uploadId) {
12022 var uploadPart = function uploadPart() {
12023 return _promise2.default.resolve(_this2.getChunk()).then(function (chunk) {
12024 if (!chunk) {
12025 return;
12026 }
12027 var partNumber = parts.length + 1;
12028 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
12029 parts.push(part);
12030 _this2.uploadedChunks++;
12031 return uploadPart();
12032 });
12033 }).catch(function (error) {
12034 return _this2.stopUpload(uploadId).then(function () {
12035 return _promise2.default.reject(error);
12036 });
12037 });
12038 };
12039
12040 return uploadPart().then(function () {
12041 return ajax({
12042 method: 'POST',
12043 url: _this2.baseURL + '/' + uploadId,
12044 headers: {
12045 Authorization: _this2.upToken
12046 },
12047 data: {
12048 parts: parts,
12049 fname: _this2.file.attributes.name,
12050 mimeType: _this2.file.attributes.mime_type
12051 }
12052 });
12053 });
12054 }).then(function () {
12055 _this2.file.attributes.url = _this2.uploadInfo.url;
12056 _this2.file._bucket = _this2.uploadInfo.bucket;
12057 _this2.file.id = _this2.uploadInfo.objectId;
12058 return _this2.file;
12059 });
12060 }
12061 }]);
12062 return ShardUploader;
12063}();
12064
12065var BlobUploader = function (_ShardUploader) {
12066 (0, _inherits3.default)(BlobUploader, _ShardUploader);
12067
12068 function BlobUploader(uploadInfo, data, file, saveOptions) {
12069 (0, _classCallCheck3.default)(this, BlobUploader);
12070
12071 var _this3 = (0, _possibleConstructorReturn3.default)(this, (BlobUploader.__proto__ || (0, _getPrototypeOf2.default)(BlobUploader)).call(this, uploadInfo, data, file, saveOptions));
12072
12073 _this3.size = data.size;
12074 return _this3;
12075 }
12076
12077 /**
12078 * @returns {Blob | null}
12079 */
12080
12081
12082 (0, _createClass3.default)(BlobUploader, [{
12083 key: 'getChunk',
12084 value: function getChunk() {
12085 if (this.offset >= this.size) {
12086 return null;
12087 }
12088 var chunk = this.data.slice(this.offset, this.offset + CHUNK_SIZE);
12089 this.offset += chunk.size;
12090 return chunk;
12091 }
12092 }]);
12093 return BlobUploader;
12094}(ShardUploader);
12095
12096function isBlob(data) {
12097 return typeof Blob !== 'undefined' && data instanceof Blob;
12098}
12099
12100module.exports = function (uploadInfo, data, file) {
12101 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12102
12103 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
12104 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
12105 }
12106 return upload(uploadInfo, data, file, saveOptions);
12107};
12108
12109/***/ }),
12110/* 294 */
12111/***/ (function(module, exports, __webpack_require__) {
12112
12113"use strict";
12114
12115
12116exports.__esModule = true;
12117
12118var _typeof2 = __webpack_require__(59);
12119
12120var _typeof3 = _interopRequireDefault(_typeof2);
12121
12122function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12123
12124exports.default = function (self, call) {
12125 if (!self) {
12126 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12127 }
12128
12129 return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
12130};
12131
12132/***/ }),
12133/* 295 */
12134/***/ (function(module, exports, __webpack_require__) {
12135
12136"use strict";
12137
12138
12139exports.__esModule = true;
12140
12141var _setPrototypeOf = __webpack_require__(296);
12142
12143var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
12144
12145var _create = __webpack_require__(300);
12146
12147var _create2 = _interopRequireDefault(_create);
12148
12149var _typeof2 = __webpack_require__(59);
12150
12151var _typeof3 = _interopRequireDefault(_typeof2);
12152
12153function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12154
12155exports.default = function (subClass, superClass) {
12156 if (typeof superClass !== "function" && superClass !== null) {
12157 throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
12158 }
12159
12160 subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
12161 constructor: {
12162 value: subClass,
12163 enumerable: false,
12164 writable: true,
12165 configurable: true
12166 }
12167 });
12168 if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
12169};
12170
12171/***/ }),
12172/* 296 */
12173/***/ (function(module, exports, __webpack_require__) {
12174
12175module.exports = { "default": __webpack_require__(297), __esModule: true };
12176
12177/***/ }),
12178/* 297 */
12179/***/ (function(module, exports, __webpack_require__) {
12180
12181__webpack_require__(298);
12182module.exports = __webpack_require__(2).Object.setPrototypeOf;
12183
12184
12185/***/ }),
12186/* 298 */
12187/***/ (function(module, exports, __webpack_require__) {
12188
12189// 19.1.3.19 Object.setPrototypeOf(O, proto)
12190var $export = __webpack_require__(17);
12191$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(299).set });
12192
12193
12194/***/ }),
12195/* 299 */
12196/***/ (function(module, exports, __webpack_require__) {
12197
12198// Works with __proto__ only. Old v8 can't work with null proto objects.
12199/* eslint-disable no-proto */
12200var isObject = __webpack_require__(20);
12201var anObject = __webpack_require__(16);
12202var check = function (O, proto) {
12203 anObject(O);
12204 if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
12205};
12206module.exports = {
12207 set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
12208 function (test, buggy, set) {
12209 try {
12210 set = __webpack_require__(38)(Function.call, __webpack_require__(90).f(Object.prototype, '__proto__').set, 2);
12211 set(test, []);
12212 buggy = !(test instanceof Array);
12213 } catch (e) { buggy = true; }
12214 return function setPrototypeOf(O, proto) {
12215 check(O, proto);
12216 if (buggy) O.__proto__ = proto;
12217 else set(O, proto);
12218 return O;
12219 };
12220 }({}, false) : undefined),
12221 check: check
12222};
12223
12224
12225/***/ }),
12226/* 300 */
12227/***/ (function(module, exports, __webpack_require__) {
12228
12229module.exports = { "default": __webpack_require__(301), __esModule: true };
12230
12231/***/ }),
12232/* 301 */
12233/***/ (function(module, exports, __webpack_require__) {
12234
12235__webpack_require__(302);
12236var $Object = __webpack_require__(2).Object;
12237module.exports = function create(P, D) {
12238 return $Object.create(P, D);
12239};
12240
12241
12242/***/ }),
12243/* 302 */
12244/***/ (function(module, exports, __webpack_require__) {
12245
12246var $export = __webpack_require__(17);
12247// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
12248$export($export.S, 'Object', { create: __webpack_require__(64) });
12249
12250
12251/***/ }),
12252/* 303 */
12253/***/ (function(module, exports, __webpack_require__) {
12254
12255"use strict";
12256
12257
12258exports.__esModule = true;
12259
12260exports.default = function (instance, Constructor) {
12261 if (!(instance instanceof Constructor)) {
12262 throw new TypeError("Cannot call a class as a function");
12263 }
12264};
12265
12266/***/ }),
12267/* 304 */
12268/***/ (function(module, exports, __webpack_require__) {
12269
12270"use strict";
12271
12272
12273exports.__esModule = true;
12274
12275var _defineProperty = __webpack_require__(86);
12276
12277var _defineProperty2 = _interopRequireDefault(_defineProperty);
12278
12279function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12280
12281exports.default = function () {
12282 function defineProperties(target, props) {
12283 for (var i = 0; i < props.length; i++) {
12284 var descriptor = props[i];
12285 descriptor.enumerable = descriptor.enumerable || false;
12286 descriptor.configurable = true;
12287 if ("value" in descriptor) descriptor.writable = true;
12288 (0, _defineProperty2.default)(target, descriptor.key, descriptor);
12289 }
12290 }
12291
12292 return function (Constructor, protoProps, staticProps) {
12293 if (protoProps) defineProperties(Constructor.prototype, protoProps);
12294 if (staticProps) defineProperties(Constructor, staticProps);
12295 return Constructor;
12296 };
12297}();
12298
12299/***/ }),
12300/* 305 */
12301/***/ (function(module, exports, __webpack_require__) {
12302
12303__webpack_require__(54);
12304__webpack_require__(47);
12305module.exports = __webpack_require__(306);
12306
12307
12308/***/ }),
12309/* 306 */
12310/***/ (function(module, exports, __webpack_require__) {
12311
12312var anObject = __webpack_require__(16);
12313var get = __webpack_require__(99);
12314module.exports = __webpack_require__(2).getIterator = function (it) {
12315 var iterFn = get(it);
12316 if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
12317 return anObject(iterFn.call(it));
12318};
12319
12320
12321/***/ }),
12322/* 307 */
12323/***/ (function(module, exports, __webpack_require__) {
12324
12325"use strict";
12326
12327
12328// base64 character set, plus padding character (=)
12329var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
12330
12331module.exports = function (string) {
12332 var result = '';
12333
12334 for (var i = 0; i < string.length;) {
12335 var a = string.charCodeAt(i++);
12336 var b = string.charCodeAt(i++);
12337 var c = string.charCodeAt(i++);
12338 if (a > 255 || b > 255 || c > 255) {
12339 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
12340 }
12341
12342 var bitmap = a << 16 | b << 8 | c;
12343 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
12344 }
12345
12346 // To determine the final padding
12347 var rest = string.length % 3;
12348 // If there's need of padding, replace the last 'A's with equal signs
12349 return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
12350};
12351
12352/***/ }),
12353/* 308 */
12354/***/ (function(module, exports, __webpack_require__) {
12355
12356"use strict";
12357
12358
12359var _ = __webpack_require__(0);
12360var ajax = __webpack_require__(58);
12361
12362module.exports = function upload(uploadInfo, data, file) {
12363 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12364
12365
12366 return ajax({
12367 url: uploadInfo.upload_url,
12368 method: 'PUT',
12369 data: data,
12370 headers: _.extend({
12371 'Content-Type': file.get('mime_type'),
12372 'Cache-Control': 'public, max-age=31536000'
12373 }, file._uploadHeaders),
12374 onprogress: saveOptions.onprogress
12375 }).then(function () {
12376 file.attributes.url = uploadInfo.url;
12377 file._bucket = uploadInfo.bucket;
12378 file.id = uploadInfo.objectId;
12379 return file;
12380 });
12381};
12382
12383/***/ }),
12384/* 309 */
12385/***/ (function(module, exports, __webpack_require__) {
12386
12387(function(){
12388 var crypt = __webpack_require__(310),
12389 utf8 = __webpack_require__(163).utf8,
12390 isBuffer = __webpack_require__(311),
12391 bin = __webpack_require__(163).bin,
12392
12393 // The core
12394 md5 = function (message, options) {
12395 // Convert to byte array
12396 if (message.constructor == String)
12397 if (options && options.encoding === 'binary')
12398 message = bin.stringToBytes(message);
12399 else
12400 message = utf8.stringToBytes(message);
12401 else if (isBuffer(message))
12402 message = Array.prototype.slice.call(message, 0);
12403 else if (!Array.isArray(message))
12404 message = message.toString();
12405 // else, assume byte array already
12406
12407 var m = crypt.bytesToWords(message),
12408 l = message.length * 8,
12409 a = 1732584193,
12410 b = -271733879,
12411 c = -1732584194,
12412 d = 271733878;
12413
12414 // Swap endian
12415 for (var i = 0; i < m.length; i++) {
12416 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
12417 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
12418 }
12419
12420 // Padding
12421 m[l >>> 5] |= 0x80 << (l % 32);
12422 m[(((l + 64) >>> 9) << 4) + 14] = l;
12423
12424 // Method shortcuts
12425 var FF = md5._ff,
12426 GG = md5._gg,
12427 HH = md5._hh,
12428 II = md5._ii;
12429
12430 for (var i = 0; i < m.length; i += 16) {
12431
12432 var aa = a,
12433 bb = b,
12434 cc = c,
12435 dd = d;
12436
12437 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
12438 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
12439 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
12440 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
12441 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
12442 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
12443 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
12444 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
12445 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
12446 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
12447 c = FF(c, d, a, b, m[i+10], 17, -42063);
12448 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
12449 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
12450 d = FF(d, a, b, c, m[i+13], 12, -40341101);
12451 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
12452 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
12453
12454 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
12455 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
12456 c = GG(c, d, a, b, m[i+11], 14, 643717713);
12457 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
12458 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
12459 d = GG(d, a, b, c, m[i+10], 9, 38016083);
12460 c = GG(c, d, a, b, m[i+15], 14, -660478335);
12461 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
12462 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
12463 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
12464 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
12465 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
12466 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
12467 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
12468 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
12469 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
12470
12471 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
12472 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
12473 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
12474 b = HH(b, c, d, a, m[i+14], 23, -35309556);
12475 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
12476 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
12477 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
12478 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
12479 a = HH(a, b, c, d, m[i+13], 4, 681279174);
12480 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
12481 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
12482 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
12483 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
12484 d = HH(d, a, b, c, m[i+12], 11, -421815835);
12485 c = HH(c, d, a, b, m[i+15], 16, 530742520);
12486 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
12487
12488 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
12489 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
12490 c = II(c, d, a, b, m[i+14], 15, -1416354905);
12491 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
12492 a = II(a, b, c, d, m[i+12], 6, 1700485571);
12493 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
12494 c = II(c, d, a, b, m[i+10], 15, -1051523);
12495 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
12496 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
12497 d = II(d, a, b, c, m[i+15], 10, -30611744);
12498 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
12499 b = II(b, c, d, a, m[i+13], 21, 1309151649);
12500 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
12501 d = II(d, a, b, c, m[i+11], 10, -1120210379);
12502 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
12503 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
12504
12505 a = (a + aa) >>> 0;
12506 b = (b + bb) >>> 0;
12507 c = (c + cc) >>> 0;
12508 d = (d + dd) >>> 0;
12509 }
12510
12511 return crypt.endian([a, b, c, d]);
12512 };
12513
12514 // Auxiliary functions
12515 md5._ff = function (a, b, c, d, x, s, t) {
12516 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
12517 return ((n << s) | (n >>> (32 - s))) + b;
12518 };
12519 md5._gg = function (a, b, c, d, x, s, t) {
12520 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
12521 return ((n << s) | (n >>> (32 - s))) + b;
12522 };
12523 md5._hh = function (a, b, c, d, x, s, t) {
12524 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
12525 return ((n << s) | (n >>> (32 - s))) + b;
12526 };
12527 md5._ii = function (a, b, c, d, x, s, t) {
12528 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
12529 return ((n << s) | (n >>> (32 - s))) + b;
12530 };
12531
12532 // Package private blocksize
12533 md5._blocksize = 16;
12534 md5._digestsize = 16;
12535
12536 module.exports = function (message, options) {
12537 if (message === undefined || message === null)
12538 throw new Error('Illegal argument ' + message);
12539
12540 var digestbytes = crypt.wordsToBytes(md5(message, options));
12541 return options && options.asBytes ? digestbytes :
12542 options && options.asString ? bin.bytesToString(digestbytes) :
12543 crypt.bytesToHex(digestbytes);
12544 };
12545
12546})();
12547
12548
12549/***/ }),
12550/* 310 */
12551/***/ (function(module, exports) {
12552
12553(function() {
12554 var base64map
12555 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
12556
12557 crypt = {
12558 // Bit-wise rotation left
12559 rotl: function(n, b) {
12560 return (n << b) | (n >>> (32 - b));
12561 },
12562
12563 // Bit-wise rotation right
12564 rotr: function(n, b) {
12565 return (n << (32 - b)) | (n >>> b);
12566 },
12567
12568 // Swap big-endian to little-endian and vice versa
12569 endian: function(n) {
12570 // If number given, swap endian
12571 if (n.constructor == Number) {
12572 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
12573 }
12574
12575 // Else, assume array and swap all items
12576 for (var i = 0; i < n.length; i++)
12577 n[i] = crypt.endian(n[i]);
12578 return n;
12579 },
12580
12581 // Generate an array of any length of random bytes
12582 randomBytes: function(n) {
12583 for (var bytes = []; n > 0; n--)
12584 bytes.push(Math.floor(Math.random() * 256));
12585 return bytes;
12586 },
12587
12588 // Convert a byte array to big-endian 32-bit words
12589 bytesToWords: function(bytes) {
12590 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
12591 words[b >>> 5] |= bytes[i] << (24 - b % 32);
12592 return words;
12593 },
12594
12595 // Convert big-endian 32-bit words to a byte array
12596 wordsToBytes: function(words) {
12597 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
12598 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
12599 return bytes;
12600 },
12601
12602 // Convert a byte array to a hex string
12603 bytesToHex: function(bytes) {
12604 for (var hex = [], i = 0; i < bytes.length; i++) {
12605 hex.push((bytes[i] >>> 4).toString(16));
12606 hex.push((bytes[i] & 0xF).toString(16));
12607 }
12608 return hex.join('');
12609 },
12610
12611 // Convert a hex string to a byte array
12612 hexToBytes: function(hex) {
12613 for (var bytes = [], c = 0; c < hex.length; c += 2)
12614 bytes.push(parseInt(hex.substr(c, 2), 16));
12615 return bytes;
12616 },
12617
12618 // Convert a byte array to a base-64 string
12619 bytesToBase64: function(bytes) {
12620 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
12621 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
12622 for (var j = 0; j < 4; j++)
12623 if (i * 8 + j * 6 <= bytes.length * 8)
12624 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
12625 else
12626 base64.push('=');
12627 }
12628 return base64.join('');
12629 },
12630
12631 // Convert a base-64 string to a byte array
12632 base64ToBytes: function(base64) {
12633 // Remove non-base-64 characters
12634 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
12635
12636 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
12637 imod4 = ++i % 4) {
12638 if (imod4 == 0) continue;
12639 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
12640 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
12641 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
12642 }
12643 return bytes;
12644 }
12645 };
12646
12647 module.exports = crypt;
12648})();
12649
12650
12651/***/ }),
12652/* 311 */
12653/***/ (function(module, exports) {
12654
12655/*!
12656 * Determine if an object is a Buffer
12657 *
12658 * @author Feross Aboukhadijeh <https://feross.org>
12659 * @license MIT
12660 */
12661
12662// The _isBuffer check is for Safari 5-7 support, because it's missing
12663// Object.prototype.constructor. Remove this eventually
12664module.exports = function (obj) {
12665 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
12666}
12667
12668function isBuffer (obj) {
12669 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
12670}
12671
12672// For Node v0.10 support. Remove this eventually.
12673function isSlowBuffer (obj) {
12674 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
12675}
12676
12677
12678/***/ }),
12679/* 312 */
12680/***/ (function(module, exports, __webpack_require__) {
12681
12682"use strict";
12683
12684
12685var dataURItoBlob = function dataURItoBlob(dataURI, type) {
12686 var byteString;
12687
12688 // 传入的 base64,不是 dataURL
12689 if (dataURI.indexOf('base64') < 0) {
12690 byteString = atob(dataURI);
12691 } else if (dataURI.split(',')[0].indexOf('base64') >= 0) {
12692 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
12693 byteString = atob(dataURI.split(',')[1]);
12694 } else {
12695 byteString = unescape(dataURI.split(',')[1]);
12696 }
12697 var ia = new Uint8Array(byteString.length);
12698 for (var i = 0; i < byteString.length; i++) {
12699 ia[i] = byteString.charCodeAt(i);
12700 }
12701 return new Blob([ia], { type: type });
12702};
12703
12704module.exports = dataURItoBlob;
12705
12706/***/ }),
12707/* 313 */
12708/***/ (function(module, exports, __webpack_require__) {
12709
12710"use strict";
12711
12712
12713var _getOwnPropertyDescriptor = __webpack_require__(314);
12714
12715var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
12716
12717var _stringify = __webpack_require__(18);
12718
12719var _stringify2 = _interopRequireDefault(_stringify);
12720
12721var _slicedToArray2 = __webpack_require__(317);
12722
12723var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
12724
12725var _promise = __webpack_require__(4);
12726
12727var _promise2 = _interopRequireDefault(_promise);
12728
12729function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12730
12731var _ = __webpack_require__(0);
12732var AVError = __webpack_require__(23);
12733
12734var _require = __webpack_require__(12),
12735 _request = _require._request;
12736
12737var _require2 = __webpack_require__(15),
12738 isNullOrUndefined = _require2.isNullOrUndefined,
12739 ensureArray = _require2.ensureArray,
12740 transformFetchOptions = _require2.transformFetchOptions,
12741 setValue = _require2.setValue,
12742 findValue = _require2.findValue,
12743 isPlainObject = _require2.isPlainObject,
12744 continueWhile = _require2.continueWhile;
12745
12746var recursiveToPointer = function recursiveToPointer(value) {
12747 if (_.isArray(value)) return value.map(recursiveToPointer);
12748 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
12749 if (_.isObject(value) && value._toPointer) return value._toPointer();
12750 return value;
12751};
12752
12753var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
12754var checkReservedKey = function checkReservedKey(key) {
12755 if (RESERVED_KEYS.indexOf(key) !== -1) {
12756 throw new Error('key[' + key + '] is reserved');
12757 }
12758};
12759
12760var handleBatchResults = function handleBatchResults(results) {
12761 var firstError = _.find(results, function (result) {
12762 return result instanceof Error;
12763 });
12764 if (!firstError) {
12765 return results;
12766 }
12767 var error = new AVError(firstError.code, firstError.message);
12768 error.results = results;
12769 throw error;
12770};
12771
12772// Helper function to get a value from a Backbone object as a property
12773// or as a function.
12774function getValue(object, prop) {
12775 if (!(object && object[prop])) {
12776 return null;
12777 }
12778 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
12779}
12780
12781// AV.Object is analogous to the Java AVObject.
12782// It also implements the same interface as a Backbone model.
12783
12784module.exports = function (AV) {
12785 /**
12786 * Creates a new model with defined attributes. A client id (cid) is
12787 * automatically generated and assigned for you.
12788 *
12789 * <p>You won't normally call this method directly. It is recommended that
12790 * you use a subclass of <code>AV.Object</code> instead, created by calling
12791 * <code>extend</code>.</p>
12792 *
12793 * <p>However, if you don't want to use a subclass, or aren't sure which
12794 * subclass is appropriate, you can use this form:<pre>
12795 * var object = new AV.Object("ClassName");
12796 * </pre>
12797 * That is basically equivalent to:<pre>
12798 * var MyClass = AV.Object.extend("ClassName");
12799 * var object = new MyClass();
12800 * </pre></p>
12801 *
12802 * @param {Object} attributes The initial set of data to store in the object.
12803 * @param {Object} options A set of Backbone-like options for creating the
12804 * object. The only option currently supported is "collection".
12805 * @see AV.Object.extend
12806 *
12807 * @class
12808 *
12809 * <p>The fundamental unit of AV data, which implements the Backbone Model
12810 * interface.</p>
12811 */
12812 AV.Object = function (attributes, options) {
12813 // Allow new AV.Object("ClassName") as a shortcut to _create.
12814 if (_.isString(attributes)) {
12815 return AV.Object._create.apply(this, arguments);
12816 }
12817
12818 attributes = attributes || {};
12819 if (options && options.parse) {
12820 attributes = this.parse(attributes);
12821 attributes = this._mergeMagicFields(attributes);
12822 }
12823 var defaults = getValue(this, 'defaults');
12824 if (defaults) {
12825 attributes = _.extend({}, defaults, attributes);
12826 }
12827 if (options && options.collection) {
12828 this.collection = options.collection;
12829 }
12830
12831 this._serverData = {}; // The last known data for this object from cloud.
12832 this._opSetQueue = [{}]; // List of sets of changes to the data.
12833 this._flags = {};
12834 this.attributes = {}; // The best estimate of this's current data.
12835
12836 this._hashedJSON = {}; // Hash of values of containers at last save.
12837 this._escapedAttributes = {};
12838 this.cid = _.uniqueId('c');
12839 this.changed = {};
12840 this._silent = {};
12841 this._pending = {};
12842 this.set(attributes, { silent: true });
12843 this.changed = {};
12844 this._silent = {};
12845 this._pending = {};
12846 this._hasData = true;
12847 this._previousAttributes = _.clone(this.attributes);
12848 this.initialize.apply(this, arguments);
12849 };
12850
12851 /**
12852 * @lends AV.Object.prototype
12853 * @property {String} id The objectId of the AV Object.
12854 */
12855
12856 /**
12857 * Saves the given list of AV.Object.
12858 * If any error is encountered, stops and calls the error handler.
12859 *
12860 * @example
12861 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
12862 * // All the objects were saved.
12863 * }, function(error) {
12864 * // An error occurred while saving one of the objects.
12865 * });
12866 *
12867 * @param {Array} list A list of <code>AV.Object</code>.
12868 */
12869 AV.Object.saveAll = function (list, options) {
12870 return AV.Object._deepSaveAsync(list, null, options);
12871 };
12872
12873 /**
12874 * Fetch the given list of AV.Object.
12875 *
12876 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
12877 * @param {AuthOptions} options
12878 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
12879 */
12880
12881 AV.Object.fetchAll = function (objects, options) {
12882 return _promise2.default.resolve().then(function () {
12883 return _request('batch', null, null, 'POST', {
12884 requests: _.map(objects, function (object) {
12885 if (!object.className) throw new Error('object must have className to fetch');
12886 if (!object.id) throw new Error('object must have id to fetch');
12887 if (object.dirty()) throw new Error('object is modified but not saved');
12888 return {
12889 method: 'GET',
12890 path: '/1.1/classes/' + object.className + '/' + object.id
12891 };
12892 })
12893 }, options);
12894 }).then(function (response) {
12895 var results = _.map(objects, function (object, i) {
12896 if (response[i].success) {
12897 var fetchedAttrs = object.parse(response[i].success);
12898 object._cleanupUnsetKeys(fetchedAttrs);
12899 object._finishFetch(fetchedAttrs);
12900 return object;
12901 }
12902 if (response[i].success === null) {
12903 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
12904 }
12905 return new AVError(response[i].error.code, response[i].error.error);
12906 });
12907 return handleBatchResults(results);
12908 });
12909 };
12910
12911 // Attach all inheritable methods to the AV.Object prototype.
12912 _.extend(AV.Object.prototype, AV.Events,
12913 /** @lends AV.Object.prototype */{
12914 _fetchWhenSave: false,
12915
12916 /**
12917 * Initialize is an empty function by default. Override it with your own
12918 * initialization logic.
12919 */
12920 initialize: function initialize() {},
12921
12922 /**
12923 * Set whether to enable fetchWhenSave option when updating object.
12924 * When set true, SDK would fetch the latest object after saving.
12925 * Default is false.
12926 *
12927 * @deprecated use AV.Object#save with options.fetchWhenSave instead
12928 * @param {boolean} enable true to enable fetchWhenSave option.
12929 */
12930 fetchWhenSave: function fetchWhenSave(enable) {
12931 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
12932 if (!_.isBoolean(enable)) {
12933 throw new Error('Expect boolean value for fetchWhenSave');
12934 }
12935 this._fetchWhenSave = enable;
12936 },
12937
12938 /**
12939 * Returns the object's objectId.
12940 * @return {String} the objectId.
12941 */
12942 getObjectId: function getObjectId() {
12943 return this.id;
12944 },
12945
12946 /**
12947 * Returns the object's createdAt attribute.
12948 * @return {Date}
12949 */
12950 getCreatedAt: function getCreatedAt() {
12951 return this.createdAt;
12952 },
12953
12954 /**
12955 * Returns the object's updatedAt attribute.
12956 * @return {Date}
12957 */
12958 getUpdatedAt: function getUpdatedAt() {
12959 return this.updatedAt;
12960 },
12961
12962 /**
12963 * Returns a JSON version of the object.
12964 * @return {Object}
12965 */
12966 toJSON: function toJSON(key, holder) {
12967 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
12968
12969 return this._toFullJSON(seenObjects, false);
12970 },
12971
12972 /**
12973 * Returns a JSON version of the object with meta data.
12974 * Inverse to {@link AV.parseJSON}
12975 * @since 3.0.0
12976 * @return {Object}
12977 */
12978 toFullJSON: function toFullJSON() {
12979 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
12980
12981 return this._toFullJSON(seenObjects);
12982 },
12983
12984
12985 _toFullJSON: function _toFullJSON(seenObjects) {
12986 var _this = this;
12987
12988 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12989
12990 var json = _.clone(this.attributes);
12991 if (_.isArray(seenObjects)) {
12992 var newSeenObjects = seenObjects.concat(this);
12993 }
12994 AV._objectEach(json, function (val, key) {
12995 json[key] = AV._encode(val, newSeenObjects, undefined, full);
12996 });
12997 AV._objectEach(this._operations, function (val, key) {
12998 json[key] = val;
12999 });
13000
13001 if (_.has(this, 'id')) {
13002 json.objectId = this.id;
13003 }
13004 ['createdAt', 'updatedAt'].forEach(function (key) {
13005 if (_.has(_this, key)) {
13006 var val = _this[key];
13007 json[key] = _.isDate(val) ? val.toJSON() : val;
13008 }
13009 });
13010 if (full) {
13011 json.__type = 'Object';
13012 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
13013 json.className = this.className;
13014 }
13015 return json;
13016 },
13017
13018 /**
13019 * Updates _hashedJSON to reflect the current state of this object.
13020 * Adds any changed hash values to the set of pending changes.
13021 * @private
13022 */
13023 _refreshCache: function _refreshCache() {
13024 var self = this;
13025 if (self._refreshingCache) {
13026 return;
13027 }
13028 self._refreshingCache = true;
13029 AV._objectEach(this.attributes, function (value, key) {
13030 if (value instanceof AV.Object) {
13031 value._refreshCache();
13032 } else if (_.isObject(value)) {
13033 if (self._resetCacheForKey(key)) {
13034 self.set(key, new AV.Op.Set(value), { silent: true });
13035 }
13036 }
13037 });
13038 delete self._refreshingCache;
13039 },
13040
13041 /**
13042 * Returns true if this object has been modified since its last
13043 * save/refresh. If an attribute is specified, it returns true only if that
13044 * particular attribute has been modified since the last save/refresh.
13045 * @param {String} attr An attribute name (optional).
13046 * @return {Boolean}
13047 */
13048 dirty: function dirty(attr) {
13049 this._refreshCache();
13050
13051 var currentChanges = _.last(this._opSetQueue);
13052
13053 if (attr) {
13054 return currentChanges[attr] ? true : false;
13055 }
13056 if (!this.id) {
13057 return true;
13058 }
13059 if (_.keys(currentChanges).length > 0) {
13060 return true;
13061 }
13062 return false;
13063 },
13064
13065 /**
13066 * Returns the keys of the modified attribute since its last save/refresh.
13067 * @return {String[]}
13068 */
13069 dirtyKeys: function dirtyKeys() {
13070 this._refreshCache();
13071 var currentChanges = _.last(this._opSetQueue);
13072 return _.keys(currentChanges);
13073 },
13074
13075 /**
13076 * Gets a Pointer referencing this Object.
13077 * @private
13078 */
13079 _toPointer: function _toPointer() {
13080 // if (!this.id) {
13081 // throw new Error("Can't serialize an unsaved AV.Object");
13082 // }
13083 return {
13084 __type: 'Pointer',
13085 className: this.className,
13086 objectId: this.id
13087 };
13088 },
13089
13090 /**
13091 * Gets the value of an attribute.
13092 * @param {String} attr The string name of an attribute.
13093 */
13094 get: function get(attr) {
13095 switch (attr) {
13096 case 'objectId':
13097 return this.id;
13098 case 'createdAt':
13099 case 'updatedAt':
13100 return this[attr];
13101 default:
13102 return this.attributes[attr];
13103 }
13104 },
13105
13106 /**
13107 * Gets a relation on the given class for the attribute.
13108 * @param {String} attr The attribute to get the relation for.
13109 * @return {AV.Relation}
13110 */
13111 relation: function relation(attr) {
13112 var value = this.get(attr);
13113 if (value) {
13114 if (!(value instanceof AV.Relation)) {
13115 throw new Error('Called relation() on non-relation field ' + attr);
13116 }
13117 value._ensureParentAndKey(this, attr);
13118 return value;
13119 } else {
13120 return new AV.Relation(this, attr);
13121 }
13122 },
13123
13124 /**
13125 * Gets the HTML-escaped value of an attribute.
13126 */
13127 escape: function escape(attr) {
13128 var html = this._escapedAttributes[attr];
13129 if (html) {
13130 return html;
13131 }
13132 var val = this.attributes[attr];
13133 var escaped;
13134 if (isNullOrUndefined(val)) {
13135 escaped = '';
13136 } else {
13137 escaped = _.escape(val.toString());
13138 }
13139 this._escapedAttributes[attr] = escaped;
13140 return escaped;
13141 },
13142
13143 /**
13144 * Returns <code>true</code> if the attribute contains a value that is not
13145 * null or undefined.
13146 * @param {String} attr The string name of the attribute.
13147 * @return {Boolean}
13148 */
13149 has: function has(attr) {
13150 return !isNullOrUndefined(this.attributes[attr]);
13151 },
13152
13153 /**
13154 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
13155 * and puts them on "this" directly. Removes them from attrs.
13156 * @param attrs - A dictionary with the data for this AV.Object.
13157 * @private
13158 */
13159 _mergeMagicFields: function _mergeMagicFields(attrs) {
13160 // Check for changes of magic fields.
13161 var model = this;
13162 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
13163 AV._arrayEach(specialFields, function (attr) {
13164 if (attrs[attr]) {
13165 if (attr === 'objectId') {
13166 model.id = attrs[attr];
13167 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
13168 model[attr] = AV._parseDate(attrs[attr]);
13169 } else {
13170 model[attr] = attrs[attr];
13171 }
13172 delete attrs[attr];
13173 }
13174 });
13175 return attrs;
13176 },
13177
13178 /**
13179 * Returns the json to be sent to the server.
13180 * @private
13181 */
13182 _startSave: function _startSave() {
13183 this._opSetQueue.push({});
13184 },
13185
13186 /**
13187 * Called when a save fails because of an error. Any changes that were part
13188 * of the save need to be merged with changes made after the save. This
13189 * might throw an exception is you do conflicting operations. For example,
13190 * if you do:
13191 * object.set("foo", "bar");
13192 * object.set("invalid field name", "baz");
13193 * object.save();
13194 * object.increment("foo");
13195 * then this will throw when the save fails and the client tries to merge
13196 * "bar" with the +1.
13197 * @private
13198 */
13199 _cancelSave: function _cancelSave() {
13200 var failedChanges = _.first(this._opSetQueue);
13201 this._opSetQueue = _.rest(this._opSetQueue);
13202 var nextChanges = _.first(this._opSetQueue);
13203 AV._objectEach(failedChanges, function (op, key) {
13204 var op1 = failedChanges[key];
13205 var op2 = nextChanges[key];
13206 if (op1 && op2) {
13207 nextChanges[key] = op2._mergeWithPrevious(op1);
13208 } else if (op1) {
13209 nextChanges[key] = op1;
13210 }
13211 });
13212 this._saving = this._saving - 1;
13213 },
13214
13215 /**
13216 * Called when a save completes successfully. This merges the changes that
13217 * were saved into the known server data, and overrides it with any data
13218 * sent directly from the server.
13219 * @private
13220 */
13221 _finishSave: function _finishSave(serverData) {
13222 // Grab a copy of any object referenced by this object. These instances
13223 // may have already been fetched, and we don't want to lose their data.
13224 // Note that doing it like this means we will unify separate copies of the
13225 // same object, but that's a risk we have to take.
13226 var fetchedObjects = {};
13227 AV._traverse(this.attributes, function (object) {
13228 if (object instanceof AV.Object && object.id && object._hasData) {
13229 fetchedObjects[object.id] = object;
13230 }
13231 });
13232
13233 var savedChanges = _.first(this._opSetQueue);
13234 this._opSetQueue = _.rest(this._opSetQueue);
13235 this._applyOpSet(savedChanges, this._serverData);
13236 this._mergeMagicFields(serverData);
13237 var self = this;
13238 AV._objectEach(serverData, function (value, key) {
13239 self._serverData[key] = AV._decode(value, key);
13240
13241 // Look for any objects that might have become unfetched and fix them
13242 // by replacing their values with the previously observed values.
13243 var fetched = AV._traverse(self._serverData[key], function (object) {
13244 if (object instanceof AV.Object && fetchedObjects[object.id]) {
13245 return fetchedObjects[object.id];
13246 }
13247 });
13248 if (fetched) {
13249 self._serverData[key] = fetched;
13250 }
13251 });
13252 this._rebuildAllEstimatedData();
13253 var opSetQueue = this._opSetQueue.map(_.clone);
13254 this._refreshCache();
13255 this._opSetQueue = opSetQueue;
13256 this._saving = this._saving - 1;
13257 },
13258
13259 /**
13260 * Called when a fetch or login is complete to set the known server data to
13261 * the given object.
13262 * @private
13263 */
13264 _finishFetch: function _finishFetch(serverData, hasData) {
13265 // Clear out any changes the user might have made previously.
13266 this._opSetQueue = [{}];
13267
13268 // Bring in all the new server data.
13269 this._mergeMagicFields(serverData);
13270 var self = this;
13271 AV._objectEach(serverData, function (value, key) {
13272 self._serverData[key] = AV._decode(value, key);
13273 });
13274
13275 // Refresh the attributes.
13276 this._rebuildAllEstimatedData();
13277
13278 // Clear out the cache of mutable containers.
13279 this._refreshCache();
13280 this._opSetQueue = [{}];
13281
13282 this._hasData = hasData;
13283 },
13284
13285 /**
13286 * Applies the set of AV.Op in opSet to the object target.
13287 * @private
13288 */
13289 _applyOpSet: function _applyOpSet(opSet, target) {
13290 var self = this;
13291 AV._objectEach(opSet, function (change, key) {
13292 var _findValue = findValue(target, key),
13293 _findValue2 = (0, _slicedToArray3.default)(_findValue, 3),
13294 value = _findValue2[0],
13295 actualTarget = _findValue2[1],
13296 actualKey = _findValue2[2];
13297
13298 setValue(target, key, change._estimate(value, self, key));
13299 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
13300 delete actualTarget[actualKey];
13301 }
13302 });
13303 },
13304
13305 /**
13306 * Replaces the cached value for key with the current value.
13307 * Returns true if the new value is different than the old value.
13308 * @private
13309 */
13310 _resetCacheForKey: function _resetCacheForKey(key) {
13311 var value = this.attributes[key];
13312 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
13313 var json = (0, _stringify2.default)(recursiveToPointer(value));
13314 if (this._hashedJSON[key] !== json) {
13315 var wasSet = !!this._hashedJSON[key];
13316 this._hashedJSON[key] = json;
13317 return wasSet;
13318 }
13319 }
13320 return false;
13321 },
13322
13323 /**
13324 * Populates attributes[key] by starting with the last known data from the
13325 * server, and applying all of the local changes that have been made to that
13326 * key since then.
13327 * @private
13328 */
13329 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
13330 var self = this;
13331 delete this.attributes[key];
13332 if (this._serverData[key]) {
13333 this.attributes[key] = this._serverData[key];
13334 }
13335 AV._arrayEach(this._opSetQueue, function (opSet) {
13336 var op = opSet[key];
13337 if (op) {
13338 var _findValue3 = findValue(self.attributes, key),
13339 _findValue4 = (0, _slicedToArray3.default)(_findValue3, 4),
13340 value = _findValue4[0],
13341 actualTarget = _findValue4[1],
13342 actualKey = _findValue4[2],
13343 firstKey = _findValue4[3];
13344
13345 setValue(self.attributes, key, op._estimate(value, self, key));
13346 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
13347 delete actualTarget[actualKey];
13348 }
13349 self._resetCacheForKey(firstKey);
13350 }
13351 });
13352 },
13353
13354 /**
13355 * Populates attributes by starting with the last known data from the
13356 * server, and applying all of the local changes that have been made since
13357 * then.
13358 * @private
13359 */
13360 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
13361 var self = this;
13362
13363 var previousAttributes = _.clone(this.attributes);
13364
13365 this.attributes = _.clone(this._serverData);
13366 AV._arrayEach(this._opSetQueue, function (opSet) {
13367 self._applyOpSet(opSet, self.attributes);
13368 AV._objectEach(opSet, function (op, key) {
13369 self._resetCacheForKey(key);
13370 });
13371 });
13372
13373 // Trigger change events for anything that changed because of the fetch.
13374 AV._objectEach(previousAttributes, function (oldValue, key) {
13375 if (self.attributes[key] !== oldValue) {
13376 self.trigger('change:' + key, self, self.attributes[key], {});
13377 }
13378 });
13379 AV._objectEach(this.attributes, function (newValue, key) {
13380 if (!_.has(previousAttributes, key)) {
13381 self.trigger('change:' + key, self, newValue, {});
13382 }
13383 });
13384 },
13385
13386 /**
13387 * Sets a hash of model attributes on the object, firing
13388 * <code>"change"</code> unless you choose to silence it.
13389 *
13390 * <p>You can call it with an object containing keys and values, or with one
13391 * key and value. For example:</p>
13392 *
13393 * @example
13394 * gameTurn.set({
13395 * player: player1,
13396 * diceRoll: 2
13397 * });
13398 *
13399 * game.set("currentPlayer", player2);
13400 *
13401 * game.set("finished", true);
13402 *
13403 * @param {String} key The key to set.
13404 * @param {Any} value The value to give it.
13405 * @param {Object} [options]
13406 * @param {Boolean} [options.silent]
13407 * @return {AV.Object} self if succeeded, throws if the value is not valid.
13408 * @see AV.Object#validate
13409 */
13410 set: function set(key, value, options) {
13411 var attrs;
13412 if (_.isObject(key) || isNullOrUndefined(key)) {
13413 attrs = _.mapObject(key, function (v, k) {
13414 checkReservedKey(k);
13415 return AV._decode(v, k);
13416 });
13417 options = value;
13418 } else {
13419 attrs = {};
13420 checkReservedKey(key);
13421 attrs[key] = AV._decode(value, key);
13422 }
13423
13424 // Extract attributes and options.
13425 options = options || {};
13426 if (!attrs) {
13427 return this;
13428 }
13429 if (attrs instanceof AV.Object) {
13430 attrs = attrs.attributes;
13431 }
13432
13433 // If the unset option is used, every attribute should be a Unset.
13434 if (options.unset) {
13435 AV._objectEach(attrs, function (unused_value, key) {
13436 attrs[key] = new AV.Op.Unset();
13437 });
13438 }
13439
13440 // Apply all the attributes to get the estimated values.
13441 var dataToValidate = _.clone(attrs);
13442 var self = this;
13443 AV._objectEach(dataToValidate, function (value, key) {
13444 if (value instanceof AV.Op) {
13445 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
13446 if (dataToValidate[key] === AV.Op._UNSET) {
13447 delete dataToValidate[key];
13448 }
13449 }
13450 });
13451
13452 // Run validation.
13453 this._validate(attrs, options);
13454
13455 options.changes = {};
13456 var escaped = this._escapedAttributes;
13457
13458 // Update attributes.
13459 AV._arrayEach(_.keys(attrs), function (attr) {
13460 var val = attrs[attr];
13461
13462 // If this is a relation object we need to set the parent correctly,
13463 // since the location where it was parsed does not have access to
13464 // this object.
13465 if (val instanceof AV.Relation) {
13466 val.parent = self;
13467 }
13468
13469 if (!(val instanceof AV.Op)) {
13470 val = new AV.Op.Set(val);
13471 }
13472
13473 // See if this change will actually have any effect.
13474 var isRealChange = true;
13475 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
13476 isRealChange = false;
13477 }
13478
13479 if (isRealChange) {
13480 delete escaped[attr];
13481 if (options.silent) {
13482 self._silent[attr] = true;
13483 } else {
13484 options.changes[attr] = true;
13485 }
13486 }
13487
13488 var currentChanges = _.last(self._opSetQueue);
13489 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
13490 self._rebuildEstimatedDataForKey(attr);
13491
13492 if (isRealChange) {
13493 self.changed[attr] = self.attributes[attr];
13494 if (!options.silent) {
13495 self._pending[attr] = true;
13496 }
13497 } else {
13498 delete self.changed[attr];
13499 delete self._pending[attr];
13500 }
13501 });
13502
13503 if (!options.silent) {
13504 this.change(options);
13505 }
13506 return this;
13507 },
13508
13509 /**
13510 * Remove an attribute from the model, firing <code>"change"</code> unless
13511 * you choose to silence it. This is a noop if the attribute doesn't
13512 * exist.
13513 * @param key {String} The key.
13514 */
13515 unset: function unset(attr, options) {
13516 options = options || {};
13517 options.unset = true;
13518 return this.set(attr, null, options);
13519 },
13520
13521 /**
13522 * Atomically increments the value of the given attribute the next time the
13523 * object is saved. If no amount is specified, 1 is used by default.
13524 *
13525 * @param key {String} The key.
13526 * @param amount {Number} The amount to increment by.
13527 */
13528 increment: function increment(attr, amount) {
13529 if (_.isUndefined(amount) || _.isNull(amount)) {
13530 amount = 1;
13531 }
13532 return this.set(attr, new AV.Op.Increment(amount));
13533 },
13534
13535 /**
13536 * Atomically add an object to the end of the array associated with a given
13537 * key.
13538 * @param key {String} The key.
13539 * @param item {} The item to add.
13540 */
13541 add: function add(attr, item) {
13542 return this.set(attr, new AV.Op.Add(ensureArray(item)));
13543 },
13544
13545 /**
13546 * Atomically add an object to the array associated with a given key, only
13547 * if it is not already present in the array. The position of the insert is
13548 * not guaranteed.
13549 *
13550 * @param key {String} The key.
13551 * @param item {} The object to add.
13552 */
13553 addUnique: function addUnique(attr, item) {
13554 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
13555 },
13556
13557 /**
13558 * Atomically remove all instances of an object from the array associated
13559 * with a given key.
13560 *
13561 * @param key {String} The key.
13562 * @param item {} The object to remove.
13563 */
13564 remove: function remove(attr, item) {
13565 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
13566 },
13567
13568 /**
13569 * Atomically apply a "bit and" operation on the value associated with a
13570 * given key.
13571 *
13572 * @param key {String} The key.
13573 * @param value {Number} The value to apply.
13574 */
13575 bitAnd: function bitAnd(attr, value) {
13576 return this.set(attr, new AV.Op.BitAnd(value));
13577 },
13578
13579
13580 /**
13581 * Atomically apply a "bit or" operation on the value associated with a
13582 * given key.
13583 *
13584 * @param key {String} The key.
13585 * @param value {Number} The value to apply.
13586 */
13587 bitOr: function bitOr(attr, value) {
13588 return this.set(attr, new AV.Op.BitOr(value));
13589 },
13590
13591
13592 /**
13593 * Atomically apply a "bit xor" operation on the value associated with a
13594 * given key.
13595 *
13596 * @param key {String} The key.
13597 * @param value {Number} The value to apply.
13598 */
13599 bitXor: function bitXor(attr, value) {
13600 return this.set(attr, new AV.Op.BitXor(value));
13601 },
13602
13603
13604 /**
13605 * Returns an instance of a subclass of AV.Op describing what kind of
13606 * modification has been performed on this field since the last time it was
13607 * saved. For example, after calling object.increment("x"), calling
13608 * object.op("x") would return an instance of AV.Op.Increment.
13609 *
13610 * @param key {String} The key.
13611 * @returns {AV.Op} The operation, or undefined if none.
13612 */
13613 op: function op(attr) {
13614 return _.last(this._opSetQueue)[attr];
13615 },
13616
13617 /**
13618 * Clear all attributes on the model, firing <code>"change"</code> unless
13619 * you choose to silence it.
13620 */
13621 clear: function clear(options) {
13622 options = options || {};
13623 options.unset = true;
13624 var keysToClear = _.extend(this.attributes, this._operations);
13625 return this.set(keysToClear, options);
13626 },
13627
13628 /**
13629 * Clears any (or specific) changes to the model made since the last save.
13630 * @param {string|string[]} [keys] specify keys to revert.
13631 */
13632 revert: function revert(keys) {
13633 var lastOp = _.last(this._opSetQueue);
13634 var _keys = ensureArray(keys || _.keys(lastOp));
13635 _keys.forEach(function (key) {
13636 delete lastOp[key];
13637 });
13638 this._rebuildAllEstimatedData();
13639 return this;
13640 },
13641
13642
13643 /**
13644 * Returns a JSON-encoded set of operations to be sent with the next save
13645 * request.
13646 * @private
13647 */
13648 _getSaveJSON: function _getSaveJSON() {
13649 var json = _.clone(_.first(this._opSetQueue));
13650 AV._objectEach(json, function (op, key) {
13651 json[key] = op.toJSON();
13652 });
13653 return json;
13654 },
13655
13656 /**
13657 * Returns true if this object can be serialized for saving.
13658 * @private
13659 */
13660 _canBeSerialized: function _canBeSerialized() {
13661 return AV.Object._canBeSerializedAsValue(this.attributes);
13662 },
13663
13664 /**
13665 * Fetch the model from the server. If the server's representation of the
13666 * model differs from its current attributes, they will be overriden,
13667 * triggering a <code>"change"</code> event.
13668 * @param {Object} fetchOptions Optional options to set 'keys',
13669 * 'include' and 'includeACL' option.
13670 * @param {AuthOptions} options
13671 * @return {Promise} A promise that is fulfilled when the fetch
13672 * completes.
13673 */
13674 fetch: function fetch() {
13675 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13676 var options = arguments[1];
13677
13678 if (!this.id) {
13679 throw new Error('Cannot fetch unsaved object');
13680 }
13681 var self = this;
13682 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
13683 return request.then(function (response) {
13684 var fetchedAttrs = self.parse(response);
13685 self._cleanupUnsetKeys(fetchedAttrs, fetchOptions.keys ? ensureArray(fetchOptions.keys).join(',').split(',') : undefined);
13686 self._finishFetch(fetchedAttrs, true);
13687 return self;
13688 });
13689 },
13690
13691 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
13692 var _this2 = this;
13693
13694 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _.keys(this._serverData);
13695
13696 _.forEach(fetchedKeys, function (key) {
13697 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
13698 });
13699 },
13700
13701
13702 /**
13703 * Set a hash of model attributes, and save the model to the server.
13704 * updatedAt will be updated when the request returns.
13705 * You can either call it as:<pre>
13706 * object.save();</pre>
13707 * or<pre>
13708 * object.save(null, options);</pre>
13709 * or<pre>
13710 * object.save(attrs, options);</pre>
13711 * or<pre>
13712 * object.save(key, value, options);</pre>
13713 *
13714 * @example
13715 * gameTurn.save({
13716 * player: "Jake Cutter",
13717 * diceRoll: 2
13718 * }).then(function(gameTurnAgain) {
13719 * // The save was successful.
13720 * }, function(error) {
13721 * // The save failed. Error is an instance of AVError.
13722 * });
13723 *
13724 * @param {AuthOptions} options AuthOptions plus:
13725 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
13726 * @param {AV.Query} options.query Save object only when it matches the query
13727 * @return {Promise} A promise that is fulfilled when the save
13728 * completes.
13729 * @see AVError
13730 */
13731 save: function save(arg1, arg2, arg3) {
13732 var attrs, current, options;
13733 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
13734 attrs = arg1;
13735 options = arg2;
13736 } else {
13737 attrs = {};
13738 attrs[arg1] = arg2;
13739 options = arg3;
13740 }
13741
13742 options = _.clone(options) || {};
13743 if (options.wait) {
13744 current = _.clone(this.attributes);
13745 }
13746
13747 var setOptions = _.clone(options) || {};
13748 if (setOptions.wait) {
13749 setOptions.silent = true;
13750 }
13751 if (attrs) {
13752 this.set(attrs, setOptions);
13753 }
13754
13755 var model = this;
13756
13757 var unsavedChildren = [];
13758 var unsavedFiles = [];
13759 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
13760 if (unsavedChildren.length + unsavedFiles.length > 1) {
13761 return AV.Object._deepSaveAsync(this, model, options);
13762 }
13763
13764 this._startSave();
13765 this._saving = (this._saving || 0) + 1;
13766
13767 this._allPreviousSaves = this._allPreviousSaves || _promise2.default.resolve();
13768 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
13769 var method = model.id ? 'PUT' : 'POST';
13770
13771 var json = model._getSaveJSON();
13772 var query = {};
13773
13774 if (model._fetchWhenSave || options.fetchWhenSave) {
13775 query['new'] = 'true';
13776 }
13777 // user login option
13778 if (options._failOnNotExist) {
13779 query.failOnNotExist = 'true';
13780 }
13781
13782 if (options.query) {
13783 var queryParams;
13784 if (typeof options.query._getParams === 'function') {
13785 queryParams = options.query._getParams();
13786 if (queryParams) {
13787 query.where = queryParams.where;
13788 }
13789 }
13790 if (!query.where) {
13791 var error = new Error('options.query is not an AV.Query');
13792 throw error;
13793 }
13794 }
13795
13796 _.extend(json, model._flags);
13797
13798 var route = 'classes';
13799 var className = model.className;
13800 if (model.className === '_User' && !model.id) {
13801 // Special-case user sign-up.
13802 route = 'users';
13803 className = null;
13804 }
13805 //hook makeRequest in options.
13806 var makeRequest = options._makeRequest || _request;
13807 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
13808
13809 requestPromise = requestPromise.then(function (resp) {
13810 var serverAttrs = model.parse(resp);
13811 if (options.wait) {
13812 serverAttrs = _.extend(attrs || {}, serverAttrs);
13813 }
13814 model._finishSave(serverAttrs);
13815 if (options.wait) {
13816 model.set(current, setOptions);
13817 }
13818 return model;
13819 }, function (error) {
13820 model._cancelSave();
13821 throw error;
13822 });
13823
13824 return requestPromise;
13825 });
13826 return this._allPreviousSaves;
13827 },
13828
13829 /**
13830 * Destroy this model on the server if it was already persisted.
13831 * Optimistically removes the model from its collection, if it has one.
13832 * @param {AuthOptions} options AuthOptions plus:
13833 * @param {Boolean} [options.wait] wait for the server to respond
13834 * before removal.
13835 *
13836 * @return {Promise} A promise that is fulfilled when the destroy
13837 * completes.
13838 */
13839 destroy: function destroy(options) {
13840 options = options || {};
13841 var model = this;
13842
13843 var triggerDestroy = function triggerDestroy() {
13844 model.trigger('destroy', model, model.collection, options);
13845 };
13846
13847 if (!this.id) {
13848 return triggerDestroy();
13849 }
13850
13851 if (!options.wait) {
13852 triggerDestroy();
13853 }
13854
13855 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
13856 return request.then(function () {
13857 if (options.wait) {
13858 triggerDestroy();
13859 }
13860 return model;
13861 });
13862 },
13863
13864 /**
13865 * Converts a response into the hash of attributes to be set on the model.
13866 * @ignore
13867 */
13868 parse: function parse(resp) {
13869 var output = _.clone(resp);
13870 ['createdAt', 'updatedAt'].forEach(function (key) {
13871 if (output[key]) {
13872 output[key] = AV._parseDate(output[key]);
13873 }
13874 });
13875 if (output.createdAt && !output.updatedAt) {
13876 output.updatedAt = output.createdAt;
13877 }
13878 return output;
13879 },
13880
13881 /**
13882 * Creates a new model with identical attributes to this one.
13883 * @return {AV.Object}
13884 */
13885 clone: function clone() {
13886 return new this.constructor(this.attributes);
13887 },
13888
13889 /**
13890 * Returns true if this object has never been saved to AV.
13891 * @return {Boolean}
13892 */
13893 isNew: function isNew() {
13894 return !this.id;
13895 },
13896
13897 /**
13898 * Call this method to manually fire a `"change"` event for this model and
13899 * a `"change:attribute"` event for each changed attribute.
13900 * Calling this will cause all objects observing the model to update.
13901 */
13902 change: function change(options) {
13903 options = options || {};
13904 var changing = this._changing;
13905 this._changing = true;
13906
13907 // Silent changes become pending changes.
13908 var self = this;
13909 AV._objectEach(this._silent, function (attr) {
13910 self._pending[attr] = true;
13911 });
13912
13913 // Silent changes are triggered.
13914 var changes = _.extend({}, options.changes, this._silent);
13915 this._silent = {};
13916 AV._objectEach(changes, function (unused_value, attr) {
13917 self.trigger('change:' + attr, self, self.get(attr), options);
13918 });
13919 if (changing) {
13920 return this;
13921 }
13922
13923 // This is to get around lint not letting us make a function in a loop.
13924 var deleteChanged = function deleteChanged(value, attr) {
13925 if (!self._pending[attr] && !self._silent[attr]) {
13926 delete self.changed[attr];
13927 }
13928 };
13929
13930 // Continue firing `"change"` events while there are pending changes.
13931 while (!_.isEmpty(this._pending)) {
13932 this._pending = {};
13933 this.trigger('change', this, options);
13934 // Pending and silent changes still remain.
13935 AV._objectEach(this.changed, deleteChanged);
13936 self._previousAttributes = _.clone(this.attributes);
13937 }
13938
13939 this._changing = false;
13940 return this;
13941 },
13942
13943 /**
13944 * Gets the previous value of an attribute, recorded at the time the last
13945 * <code>"change"</code> event was fired.
13946 * @param {String} attr Name of the attribute to get.
13947 */
13948 previous: function previous(attr) {
13949 if (!arguments.length || !this._previousAttributes) {
13950 return null;
13951 }
13952 return this._previousAttributes[attr];
13953 },
13954
13955 /**
13956 * Gets all of the attributes of the model at the time of the previous
13957 * <code>"change"</code> event.
13958 * @return {Object}
13959 */
13960 previousAttributes: function previousAttributes() {
13961 return _.clone(this._previousAttributes);
13962 },
13963
13964 /**
13965 * Checks if the model is currently in a valid state. It's only possible to
13966 * get into an *invalid* state if you're using silent changes.
13967 * @return {Boolean}
13968 */
13969 isValid: function isValid() {
13970 try {
13971 this.validate(this.attributes);
13972 } catch (error) {
13973 return false;
13974 }
13975 return true;
13976 },
13977
13978 /**
13979 * You should not call this function directly unless you subclass
13980 * <code>AV.Object</code>, in which case you can override this method
13981 * to provide additional validation on <code>set</code> and
13982 * <code>save</code>. Your implementation should throw an Error if
13983 * the attrs is invalid
13984 *
13985 * @param {Object} attrs The current data to validate.
13986 * @see AV.Object#set
13987 */
13988 validate: function validate(attrs) {
13989 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
13990 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
13991 }
13992 },
13993
13994 /**
13995 * Run validation against a set of incoming attributes, returning `true`
13996 * if all is well. If a specific `error` callback has been passed,
13997 * call that instead of firing the general `"error"` event.
13998 * @private
13999 */
14000 _validate: function _validate(attrs, options) {
14001 if (options.silent || !this.validate) {
14002 return;
14003 }
14004 attrs = _.extend({}, this.attributes, attrs);
14005 this.validate(attrs);
14006 },
14007
14008 /**
14009 * Returns the ACL for this object.
14010 * @returns {AV.ACL} An instance of AV.ACL.
14011 * @see AV.Object#get
14012 */
14013 getACL: function getACL() {
14014 return this.get('ACL');
14015 },
14016
14017 /**
14018 * Sets the ACL to be used for this object.
14019 * @param {AV.ACL} acl An instance of AV.ACL.
14020 * @param {Object} options Optional Backbone-like options object to be
14021 * passed in to set.
14022 * @return {AV.Object} self
14023 * @see AV.Object#set
14024 */
14025 setACL: function setACL(acl, options) {
14026 return this.set('ACL', acl, options);
14027 },
14028
14029 disableBeforeHook: function disableBeforeHook() {
14030 this.ignoreHook('beforeSave');
14031 this.ignoreHook('beforeUpdate');
14032 this.ignoreHook('beforeDelete');
14033 },
14034
14035 disableAfterHook: function disableAfterHook() {
14036 this.ignoreHook('afterSave');
14037 this.ignoreHook('afterUpdate');
14038 this.ignoreHook('afterDelete');
14039 },
14040
14041 ignoreHook: function ignoreHook(hookName) {
14042 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
14043 throw new Error('Unsupported hookName: ' + hookName);
14044 }
14045
14046 if (!AV.hookKey) {
14047 throw new Error('ignoreHook required hookKey');
14048 }
14049
14050 if (!this._flags.__ignore_hooks) {
14051 this._flags.__ignore_hooks = [];
14052 }
14053
14054 this._flags.__ignore_hooks.push(hookName);
14055 }
14056 });
14057
14058 /**
14059 * Creates an instance of a subclass of AV.Object for the give classname
14060 * and id.
14061 * @param {String|Function} class the className or a subclass of AV.Object.
14062 * @param {String} id The object id of this model.
14063 * @return {AV.Object} A new subclass instance of AV.Object.
14064 */
14065 AV.Object.createWithoutData = function (klass, id, hasData) {
14066 var _klass = void 0;
14067 if (_.isString(klass)) {
14068 _klass = AV.Object._getSubclass(klass);
14069 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
14070 _klass = klass;
14071 } else {
14072 throw new Error('class must be a string or a subclass of AV.Object.');
14073 }
14074 if (!id) {
14075 throw new TypeError('The objectId must be provided');
14076 }
14077 var object = new _klass();
14078 object.id = id;
14079 object._hasData = hasData;
14080 return object;
14081 };
14082 /**
14083 * Delete objects in batch.
14084 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
14085 * @param {AuthOptions} options
14086 * @return {Promise} A promise that is fulfilled when the save
14087 * completes.
14088 */
14089 AV.Object.destroyAll = function (objects) {
14090 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14091
14092 if (!objects || objects.length === 0) {
14093 return _promise2.default.resolve();
14094 }
14095 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
14096 return (0, _stringify2.default)({
14097 className: object.className,
14098 flags: object._flags
14099 });
14100 });
14101 var body = {
14102 requests: _.map(objectsByClassNameAndFlags, function (objects) {
14103 var ids = _.map(objects, 'id').join(',');
14104 return {
14105 method: 'DELETE',
14106 path: '/1.1/classes/' + objects[0].className + '/' + ids,
14107 body: objects[0]._flags
14108 };
14109 })
14110 };
14111 return _request('batch', null, null, 'POST', body, options).then(function (response) {
14112 var firstError = _.find(response, function (result) {
14113 return !result.success;
14114 });
14115 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
14116 return undefined;
14117 });
14118 };
14119
14120 /**
14121 * Returns the appropriate subclass for making new instances of the given
14122 * className string.
14123 * @private
14124 */
14125 AV.Object._getSubclass = function (className) {
14126 if (!_.isString(className)) {
14127 throw new Error('AV.Object._getSubclass requires a string argument.');
14128 }
14129 var ObjectClass = AV.Object._classMap[className];
14130 if (!ObjectClass) {
14131 ObjectClass = AV.Object.extend(className);
14132 AV.Object._classMap[className] = ObjectClass;
14133 }
14134 return ObjectClass;
14135 };
14136
14137 /**
14138 * Creates an instance of a subclass of AV.Object for the given classname.
14139 * @private
14140 */
14141 AV.Object._create = function (className, attributes, options) {
14142 var ObjectClass = AV.Object._getSubclass(className);
14143 return new ObjectClass(attributes, options);
14144 };
14145
14146 // Set up a map of className to class so that we can create new instances of
14147 // AV Objects from JSON automatically.
14148 AV.Object._classMap = {};
14149
14150 AV.Object._extend = AV._extend;
14151
14152 /**
14153 * Creates a new model with defined attributes,
14154 * It's the same with
14155 * <pre>
14156 * new AV.Object(attributes, options);
14157 * </pre>
14158 * @param {Object} attributes The initial set of data to store in the object.
14159 * @param {Object} options A set of Backbone-like options for creating the
14160 * object. The only option currently supported is "collection".
14161 * @return {AV.Object}
14162 * @since v0.4.4
14163 * @see AV.Object
14164 * @see AV.Object.extend
14165 */
14166 AV.Object['new'] = function (attributes, options) {
14167 return new AV.Object(attributes, options);
14168 };
14169
14170 /**
14171 * Creates a new subclass of AV.Object for the given AV class name.
14172 *
14173 * <p>Every extension of a AV class will inherit from the most recent
14174 * previous extension of that class. When a AV.Object is automatically
14175 * created by parsing JSON, it will use the most recent extension of that
14176 * class.</p>
14177 *
14178 * @example
14179 * var MyClass = AV.Object.extend("MyClass", {
14180 * // Instance properties
14181 * }, {
14182 * // Class properties
14183 * });
14184 *
14185 * @param {String} className The name of the AV class backing this model.
14186 * @param {Object} protoProps Instance properties to add to instances of the
14187 * class returned from this method.
14188 * @param {Object} classProps Class properties to add the class returned from
14189 * this method.
14190 * @return {Class} A new subclass of AV.Object.
14191 */
14192 AV.Object.extend = function (className, protoProps, classProps) {
14193 // Handle the case with only two args.
14194 if (!_.isString(className)) {
14195 if (className && _.has(className, 'className')) {
14196 return AV.Object.extend(className.className, className, protoProps);
14197 } else {
14198 throw new Error("AV.Object.extend's first argument should be the className.");
14199 }
14200 }
14201
14202 // If someone tries to subclass "User", coerce it to the right type.
14203 if (className === 'User') {
14204 className = '_User';
14205 }
14206
14207 var NewClassObject = null;
14208 if (_.has(AV.Object._classMap, className)) {
14209 var OldClassObject = AV.Object._classMap[className];
14210 // This new subclass has been told to extend both from "this" and from
14211 // OldClassObject. This is multiple inheritance, which isn't supported.
14212 // For now, let's just pick one.
14213 if (protoProps || classProps) {
14214 NewClassObject = OldClassObject._extend(protoProps, classProps);
14215 } else {
14216 return OldClassObject;
14217 }
14218 } else {
14219 protoProps = protoProps || {};
14220 protoProps._className = className;
14221 NewClassObject = this._extend(protoProps, classProps);
14222 }
14223 // Extending a subclass should reuse the classname automatically.
14224 NewClassObject.extend = function (arg0) {
14225 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
14226 return AV.Object.extend.apply(NewClassObject, arguments);
14227 }
14228 var newArguments = [className].concat(_.toArray(arguments));
14229 return AV.Object.extend.apply(NewClassObject, newArguments);
14230 };
14231 // Add the query property descriptor.
14232 Object.defineProperty(NewClassObject, 'query', (0, _getOwnPropertyDescriptor2.default)(AV.Object, 'query'));
14233 NewClassObject['new'] = function (attributes, options) {
14234 return new NewClassObject(attributes, options);
14235 };
14236 AV.Object._classMap[className] = NewClassObject;
14237 return NewClassObject;
14238 };
14239
14240 // ES6 class syntax support
14241 Object.defineProperty(AV.Object.prototype, 'className', {
14242 get: function get() {
14243 var className = this._className || this.constructor._LCClassName || this.constructor.name;
14244 // If someone tries to subclass "User", coerce it to the right type.
14245 if (className === 'User') {
14246 return '_User';
14247 }
14248 return className;
14249 }
14250 });
14251
14252 /**
14253 * Register a class.
14254 * If a subclass of <code>AV.Object</code> is defined with your own implement
14255 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
14256 * @param {Function} klass A subclass of <code>AV.Object</code>
14257 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
14258 * @example
14259 * class Person extend AV.Object {}
14260 * AV.Object.register(Person);
14261 */
14262 AV.Object.register = function (klass, name) {
14263 if (!(klass.prototype instanceof AV.Object)) {
14264 throw new Error('registered class is not a subclass of AV.Object');
14265 }
14266 var className = name || klass.name;
14267 if (!className.length) {
14268 throw new Error('registered class must be named');
14269 }
14270 if (name) {
14271 klass._LCClassName = name;
14272 }
14273 AV.Object._classMap[className] = klass;
14274 };
14275
14276 /**
14277 * Get a new Query of the current class
14278 * @name query
14279 * @memberof AV.Object
14280 * @type AV.Query
14281 * @readonly
14282 * @since v3.1.0
14283 * @example
14284 * const Post = AV.Object.extend('Post');
14285 * Post.query.equalTo('author', 'leancloud').find().then();
14286 */
14287 Object.defineProperty(AV.Object, 'query', {
14288 get: function get() {
14289 return new AV.Query(this.prototype.className);
14290 }
14291 });
14292
14293 AV.Object._findUnsavedChildren = function (objects, children, files) {
14294 AV._traverse(objects, function (object) {
14295 if (object instanceof AV.Object) {
14296 if (object.dirty()) {
14297 children.push(object);
14298 }
14299 return;
14300 }
14301
14302 if (object instanceof AV.File) {
14303 if (!object.id) {
14304 files.push(object);
14305 }
14306 return;
14307 }
14308 });
14309 };
14310
14311 AV.Object._canBeSerializedAsValue = function (object) {
14312 var canBeSerializedAsValue = true;
14313
14314 if (object instanceof AV.Object || object instanceof AV.File) {
14315 canBeSerializedAsValue = !!object.id;
14316 } else if (_.isArray(object)) {
14317 AV._arrayEach(object, function (child) {
14318 if (!AV.Object._canBeSerializedAsValue(child)) {
14319 canBeSerializedAsValue = false;
14320 }
14321 });
14322 } else if (_.isObject(object)) {
14323 AV._objectEach(object, function (child) {
14324 if (!AV.Object._canBeSerializedAsValue(child)) {
14325 canBeSerializedAsValue = false;
14326 }
14327 });
14328 }
14329
14330 return canBeSerializedAsValue;
14331 };
14332
14333 AV.Object._deepSaveAsync = function (object, model, options) {
14334 var unsavedChildren = [];
14335 var unsavedFiles = [];
14336 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
14337
14338 unsavedFiles = _.uniq(unsavedFiles);
14339
14340 var promise = _promise2.default.resolve();
14341 _.each(unsavedFiles, function (file) {
14342 promise = promise.then(function () {
14343 return file.save();
14344 });
14345 });
14346
14347 var objects = _.uniq(unsavedChildren);
14348 var remaining = _.uniq(objects);
14349
14350 return promise.then(function () {
14351 return continueWhile(function () {
14352 return remaining.length > 0;
14353 }, function () {
14354 // Gather up all the objects that can be saved in this batch.
14355 var batch = [];
14356 var newRemaining = [];
14357 AV._arrayEach(remaining, function (object) {
14358 if (object._canBeSerialized()) {
14359 batch.push(object);
14360 } else {
14361 newRemaining.push(object);
14362 }
14363 });
14364 remaining = newRemaining;
14365
14366 // If we can't save any objects, there must be a circular reference.
14367 if (batch.length === 0) {
14368 return _promise2.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
14369 }
14370
14371 // Reserve a spot in every object's save queue.
14372 var readyToStart = _promise2.default.resolve(_.map(batch, function (object) {
14373 return object._allPreviousSaves || _promise2.default.resolve();
14374 }));
14375
14376 // Save a single batch, whether previous saves succeeded or failed.
14377 var bathSavePromise = readyToStart.then(function () {
14378 return _request('batch', null, null, 'POST', {
14379 requests: _.map(batch, function (object) {
14380 var method = object.id ? 'PUT' : 'POST';
14381
14382 var json = object._getSaveJSON();
14383
14384 _.extend(json, object._flags);
14385
14386 var route = 'classes';
14387 var className = object.className;
14388 var path = '/' + route + '/' + className;
14389 if (object.className === '_User' && !object.id) {
14390 // Special-case user sign-up.
14391 path = '/users';
14392 }
14393
14394 var path = '/1.1' + path;
14395 if (object.id) {
14396 path = path + '/' + object.id;
14397 }
14398
14399 object._startSave();
14400
14401 return {
14402 method: method,
14403 path: path,
14404 body: json,
14405 params: options && options.fetchWhenSave ? { fetchWhenSave: true } : undefined
14406 };
14407 })
14408 }, options).then(function (response) {
14409 var results = _.map(batch, function (object, i) {
14410 if (response[i].success) {
14411 object._finishSave(object.parse(response[i].success));
14412 return object;
14413 }
14414 object._cancelSave();
14415 return new AVError(response[i].error.code, response[i].error.error);
14416 });
14417 return handleBatchResults(results);
14418 });
14419 });
14420 AV._arrayEach(batch, function (object) {
14421 object._allPreviousSaves = bathSavePromise;
14422 });
14423 return bathSavePromise;
14424 });
14425 }).then(function () {
14426 return object;
14427 });
14428 };
14429};
14430
14431/***/ }),
14432/* 314 */
14433/***/ (function(module, exports, __webpack_require__) {
14434
14435module.exports = { "default": __webpack_require__(315), __esModule: true };
14436
14437/***/ }),
14438/* 315 */
14439/***/ (function(module, exports, __webpack_require__) {
14440
14441__webpack_require__(316);
14442var $Object = __webpack_require__(2).Object;
14443module.exports = function getOwnPropertyDescriptor(it, key) {
14444 return $Object.getOwnPropertyDescriptor(it, key);
14445};
14446
14447
14448/***/ }),
14449/* 316 */
14450/***/ (function(module, exports, __webpack_require__) {
14451
14452// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
14453var toIObject = __webpack_require__(26);
14454var $getOwnPropertyDescriptor = __webpack_require__(90).f;
14455
14456__webpack_require__(85)('getOwnPropertyDescriptor', function () {
14457 return function getOwnPropertyDescriptor(it, key) {
14458 return $getOwnPropertyDescriptor(toIObject(it), key);
14459 };
14460});
14461
14462
14463/***/ }),
14464/* 317 */
14465/***/ (function(module, exports, __webpack_require__) {
14466
14467"use strict";
14468
14469
14470exports.__esModule = true;
14471
14472var _isIterable2 = __webpack_require__(318);
14473
14474var _isIterable3 = _interopRequireDefault(_isIterable2);
14475
14476var _getIterator2 = __webpack_require__(162);
14477
14478var _getIterator3 = _interopRequireDefault(_getIterator2);
14479
14480function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14481
14482exports.default = function () {
14483 function sliceIterator(arr, i) {
14484 var _arr = [];
14485 var _n = true;
14486 var _d = false;
14487 var _e = undefined;
14488
14489 try {
14490 for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
14491 _arr.push(_s.value);
14492
14493 if (i && _arr.length === i) break;
14494 }
14495 } catch (err) {
14496 _d = true;
14497 _e = err;
14498 } finally {
14499 try {
14500 if (!_n && _i["return"]) _i["return"]();
14501 } finally {
14502 if (_d) throw _e;
14503 }
14504 }
14505
14506 return _arr;
14507 }
14508
14509 return function (arr, i) {
14510 if (Array.isArray(arr)) {
14511 return arr;
14512 } else if ((0, _isIterable3.default)(Object(arr))) {
14513 return sliceIterator(arr, i);
14514 } else {
14515 throw new TypeError("Invalid attempt to destructure non-iterable instance");
14516 }
14517 };
14518}();
14519
14520/***/ }),
14521/* 318 */
14522/***/ (function(module, exports, __webpack_require__) {
14523
14524module.exports = { "default": __webpack_require__(319), __esModule: true };
14525
14526/***/ }),
14527/* 319 */
14528/***/ (function(module, exports, __webpack_require__) {
14529
14530__webpack_require__(54);
14531__webpack_require__(47);
14532module.exports = __webpack_require__(320);
14533
14534
14535/***/ }),
14536/* 320 */
14537/***/ (function(module, exports, __webpack_require__) {
14538
14539var classof = __webpack_require__(68);
14540var ITERATOR = __webpack_require__(7)('iterator');
14541var Iterators = __webpack_require__(30);
14542module.exports = __webpack_require__(2).isIterable = function (it) {
14543 var O = Object(it);
14544 return O[ITERATOR] !== undefined
14545 || '@@iterator' in O
14546 // eslint-disable-next-line no-prototype-builtins
14547 || Iterators.hasOwnProperty(classof(O));
14548};
14549
14550
14551/***/ }),
14552/* 321 */
14553/***/ (function(module, exports, __webpack_require__) {
14554
14555"use strict";
14556
14557
14558var _ = __webpack_require__(0);
14559var AVError = __webpack_require__(23);
14560
14561module.exports = function (AV) {
14562 AV.Role = AV.Object.extend('_Role',
14563 /** @lends AV.Role.prototype */{
14564 // Instance Methods
14565
14566 /**
14567 * Represents a Role on the AV server. Roles represent groupings of
14568 * Users for the purposes of granting permissions (e.g. specifying an ACL
14569 * for an Object). Roles are specified by their sets of child users and
14570 * child roles, all of which are granted any permissions that the parent
14571 * role has.
14572 *
14573 * <p>Roles must have a name (which cannot be changed after creation of the
14574 * role), and must specify an ACL.</p>
14575 * An AV.Role is a local representation of a role persisted to the AV
14576 * cloud.
14577 * @class AV.Role
14578 * @param {String} name The name of the Role to create.
14579 * @param {AV.ACL} acl The ACL for this role.
14580 */
14581 constructor: function constructor(name, acl) {
14582 if (_.isString(name)) {
14583 AV.Object.prototype.constructor.call(this, null, null);
14584 this.setName(name);
14585 } else {
14586 AV.Object.prototype.constructor.call(this, name, acl);
14587 }
14588 if (acl) {
14589 if (!(acl instanceof AV.ACL)) {
14590 throw new TypeError('acl must be an instance of AV.ACL');
14591 } else {
14592 this.setACL(acl);
14593 }
14594 }
14595 },
14596
14597 /**
14598 * Gets the name of the role. You can alternatively call role.get("name")
14599 *
14600 * @return {String} the name of the role.
14601 */
14602 getName: function getName() {
14603 return this.get('name');
14604 },
14605
14606 /**
14607 * Sets the name for a role. This value must be set before the role has
14608 * been saved to the server, and cannot be set once the role has been
14609 * saved.
14610 *
14611 * <p>
14612 * A role's name can only contain alphanumeric characters, _, -, and
14613 * spaces.
14614 * </p>
14615 *
14616 * <p>This is equivalent to calling role.set("name", name)</p>
14617 *
14618 * @param {String} name The name of the role.
14619 */
14620 setName: function setName(name, options) {
14621 return this.set('name', name, options);
14622 },
14623
14624 /**
14625 * Gets the AV.Relation for the AV.Users that are direct
14626 * children of this role. These users are granted any privileges that this
14627 * role has been granted (e.g. read or write access through ACLs). You can
14628 * add or remove users from the role through this relation.
14629 *
14630 * <p>This is equivalent to calling role.relation("users")</p>
14631 *
14632 * @return {AV.Relation} the relation for the users belonging to this
14633 * role.
14634 */
14635 getUsers: function getUsers() {
14636 return this.relation('users');
14637 },
14638
14639 /**
14640 * Gets the AV.Relation for the AV.Roles that are direct
14641 * children of this role. These roles' users are granted any privileges that
14642 * this role has been granted (e.g. read or write access through ACLs). You
14643 * can add or remove child roles from this role through this relation.
14644 *
14645 * <p>This is equivalent to calling role.relation("roles")</p>
14646 *
14647 * @return {AV.Relation} the relation for the roles belonging to this
14648 * role.
14649 */
14650 getRoles: function getRoles() {
14651 return this.relation('roles');
14652 },
14653
14654 /**
14655 * @ignore
14656 */
14657 validate: function validate(attrs, options) {
14658 if ('name' in attrs && attrs.name !== this.getName()) {
14659 var newName = attrs.name;
14660 if (this.id && this.id !== attrs.objectId) {
14661 // Check to see if the objectId being set matches this.id.
14662 // This happens during a fetch -- the id is set before calling fetch.
14663 // Let the name be set in this case.
14664 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
14665 }
14666 if (!_.isString(newName)) {
14667 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
14668 }
14669 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
14670 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
14671 }
14672 }
14673 if (AV.Object.prototype.validate) {
14674 return AV.Object.prototype.validate.call(this, attrs, options);
14675 }
14676 return false;
14677 }
14678 });
14679};
14680
14681/***/ }),
14682/* 322 */
14683/***/ (function(module, exports, __webpack_require__) {
14684
14685"use strict";
14686
14687
14688var _stringify = __webpack_require__(18);
14689
14690var _stringify2 = _interopRequireDefault(_stringify);
14691
14692var _defineProperty2 = __webpack_require__(323);
14693
14694var _defineProperty3 = _interopRequireDefault(_defineProperty2);
14695
14696var _promise = __webpack_require__(4);
14697
14698var _promise2 = _interopRequireDefault(_promise);
14699
14700function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14701
14702var _ = __webpack_require__(0);
14703var uuid = __webpack_require__(154);
14704var AVError = __webpack_require__(23);
14705
14706var _require = __webpack_require__(12),
14707 AVRequest = _require._request,
14708 request = _require.request;
14709
14710var _require2 = __webpack_require__(36),
14711 getAdapter = _require2.getAdapter;
14712
14713var PLATFORM_ANONYMOUS = 'anonymous';
14714var PLATFORM_QQAPP = 'lc_qqapp';
14715
14716var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
14717 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
14718 return function (authData, unionId) {
14719 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
14720 _ref$unionIdPlatform = _ref.unionIdPlatform,
14721 unionIdPlatform = _ref$unionIdPlatform === undefined ? defaultUnionIdPlatform : _ref$unionIdPlatform,
14722 _ref$asMainAccount = _ref.asMainAccount,
14723 asMainAccount = _ref$asMainAccount === undefined ? false : _ref$asMainAccount;
14724
14725 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
14726 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
14727
14728 return _.extend({}, authData, {
14729 platform: unionIdPlatform,
14730 unionid: unionId,
14731 main_account: Boolean(asMainAccount)
14732 });
14733 };
14734};
14735
14736module.exports = function (AV) {
14737 /**
14738 * @class
14739 *
14740 * <p>An AV.User object is a local representation of a user persisted to the
14741 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
14742 * same functionality of an AV.Object, but also extends it with various
14743 * user specific methods, like authentication, signing up, and validation of
14744 * uniqueness.</p>
14745 */
14746 AV.User = AV.Object.extend('_User',
14747 /** @lends AV.User.prototype */{
14748 // Instance Variables
14749 _isCurrentUser: false,
14750
14751 // Instance Methods
14752
14753 /**
14754 * Internal method to handle special fields in a _User response.
14755 * @private
14756 */
14757 _mergeMagicFields: function _mergeMagicFields(attrs) {
14758 if (attrs.sessionToken) {
14759 this._sessionToken = attrs.sessionToken;
14760 delete attrs.sessionToken;
14761 }
14762 return AV.User.__super__._mergeMagicFields.call(this, attrs);
14763 },
14764
14765 /**
14766 * Removes null values from authData (which exist temporarily for
14767 * unlinking)
14768 * @private
14769 */
14770 _cleanupAuthData: function _cleanupAuthData() {
14771 if (!this.isCurrent()) {
14772 return;
14773 }
14774 var authData = this.get('authData');
14775 if (!authData) {
14776 return;
14777 }
14778 AV._objectEach(this.get('authData'), function (value, key) {
14779 if (!authData[key]) {
14780 delete authData[key];
14781 }
14782 });
14783 },
14784
14785 /**
14786 * Synchronizes authData for all providers.
14787 * @private
14788 */
14789 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
14790 var authData = this.get('authData');
14791 if (!authData) {
14792 return;
14793 }
14794
14795 var self = this;
14796 AV._objectEach(this.get('authData'), function (value, key) {
14797 self._synchronizeAuthData(key);
14798 });
14799 },
14800
14801 /**
14802 * Synchronizes auth data for a provider (e.g. puts the access token in the
14803 * right place to be used by the Facebook SDK).
14804 * @private
14805 */
14806 _synchronizeAuthData: function _synchronizeAuthData(provider) {
14807 if (!this.isCurrent()) {
14808 return;
14809 }
14810 var authType;
14811 if (_.isString(provider)) {
14812 authType = provider;
14813 provider = AV.User._authProviders[authType];
14814 } else {
14815 authType = provider.getAuthType();
14816 }
14817 var authData = this.get('authData');
14818 if (!authData || !provider) {
14819 return;
14820 }
14821 var success = provider.restoreAuthentication(authData[authType]);
14822 if (!success) {
14823 this.dissociateAuthData(provider);
14824 }
14825 },
14826
14827 _handleSaveResult: function _handleSaveResult(makeCurrent) {
14828 // Clean up and synchronize the authData object, removing any unset values
14829 if (makeCurrent && !AV._config.disableCurrentUser) {
14830 this._isCurrentUser = true;
14831 }
14832 this._cleanupAuthData();
14833 this._synchronizeAllAuthData();
14834 // Don't keep the password around.
14835 delete this._serverData.password;
14836 this._rebuildEstimatedDataForKey('password');
14837 this._refreshCache();
14838 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
14839 // Some old version of leanengine-node-sdk will overwrite
14840 // AV.User._saveCurrentUser which returns no Promise.
14841 // So we need a Promise wrapper.
14842 return _promise2.default.resolve(AV.User._saveCurrentUser(this));
14843 } else {
14844 return _promise2.default.resolve();
14845 }
14846 },
14847
14848 /**
14849 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
14850 * call linkWith on the user (even if it doesn't exist yet on the server).
14851 * @private
14852 */
14853 _linkWith: function _linkWith(provider, data) {
14854 var _this = this;
14855
14856 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
14857 _ref2$failOnNotExist = _ref2.failOnNotExist,
14858 failOnNotExist = _ref2$failOnNotExist === undefined ? false : _ref2$failOnNotExist;
14859
14860 var authType;
14861 if (_.isString(provider)) {
14862 authType = provider;
14863 provider = AV.User._authProviders[provider];
14864 } else {
14865 authType = provider.getAuthType();
14866 }
14867 if (data) {
14868 return this.save({ authData: (0, _defineProperty3.default)({}, authType, data) }, {
14869 fetchWhenSave: !!this.get('authData'),
14870 _failOnNotExist: failOnNotExist
14871 }).then(function (model) {
14872 return model._handleSaveResult(true).then(function () {
14873 return model;
14874 });
14875 });
14876 } else {
14877 return provider.authenticate().then(function (result) {
14878 return _this._linkWith(provider, result);
14879 });
14880 }
14881 },
14882
14883 /**
14884 * Associate the user with a third party authData.
14885 * @since 3.3.0
14886 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
14887 * @param {string} platform Available platform for sign up.
14888 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
14889 * @example user.associateWithAuthData({
14890 * openid: 'abc123',
14891 * access_token: '123abc',
14892 * expires_in: 1382686496
14893 * }, 'weixin').then(function(user) {
14894 * //Access user here
14895 * }).catch(function(error) {
14896 * //console.error("error: ", error);
14897 * });
14898 */
14899 associateWithAuthData: function associateWithAuthData(authData, platform) {
14900 return this._linkWith(platform, authData);
14901 },
14902
14903
14904 /**
14905 * Associate the user with a third party authData and unionId.
14906 * @since 3.5.0
14907 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
14908 * @param {string} platform Available platform for sign up.
14909 * @param {string} unionId
14910 * @param {Object} [unionLoginOptions]
14911 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
14912 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
14913 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
14914 * @example user.associateWithAuthDataAndUnionId({
14915 * openid: 'abc123',
14916 * access_token: '123abc',
14917 * expires_in: 1382686496
14918 * }, 'weixin', 'union123', {
14919 * unionIdPlatform: 'weixin',
14920 * asMainAccount: true,
14921 * }).then(function(user) {
14922 * //Access user here
14923 * }).catch(function(error) {
14924 * //console.error("error: ", error);
14925 * });
14926 */
14927 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
14928 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
14929 },
14930
14931
14932 /**
14933 * Associate the user with the identity of the current mini-app.
14934 * @since 4.6.0
14935 * @param {Object} [authInfo]
14936 * @param {Object} [option]
14937 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
14938 * @return {Promise<AV.User>}
14939 */
14940 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
14941 var _this2 = this;
14942
14943 if (authInfo === undefined) {
14944 var getAuthInfo = getAdapter('getAuthInfo');
14945 return getAuthInfo().then(function (authInfo) {
14946 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
14947 });
14948 }
14949 return this._linkWith(authInfo.provider, authInfo.authData, option);
14950 },
14951
14952
14953 /**
14954 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
14955 * 仅在 QQ 小程序中可用。
14956 *
14957 * @deprecated Please use {@link AV.User#associateWithMiniApp}
14958 * @since 4.2.0
14959 * @param {Object} [options]
14960 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
14961 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
14962 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
14963 * @return {Promise<AV.User>}
14964 */
14965 associateWithQQApp: function associateWithQQApp() {
14966 var _this3 = this;
14967
14968 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
14969 _ref3$preferUnionId = _ref3.preferUnionId,
14970 preferUnionId = _ref3$preferUnionId === undefined ? false : _ref3$preferUnionId,
14971 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
14972 unionIdPlatform = _ref3$unionIdPlatform === undefined ? 'qq' : _ref3$unionIdPlatform,
14973 _ref3$asMainAccount = _ref3.asMainAccount,
14974 asMainAccount = _ref3$asMainAccount === undefined ? true : _ref3$asMainAccount;
14975
14976 var getAuthInfo = getAdapter('getAuthInfo');
14977 return getAuthInfo({
14978 preferUnionId: preferUnionId,
14979 asMainAccount: asMainAccount,
14980 platform: unionIdPlatform
14981 }).then(function (authInfo) {
14982 authInfo.provider = PLATFORM_QQAPP;
14983 return _this3.associateWithMiniApp(authInfo);
14984 });
14985 },
14986
14987
14988 /**
14989 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
14990 * 仅在微信小程序中可用。
14991 *
14992 * @deprecated Please use {@link AV.User#associateWithMiniApp}
14993 * @since 3.13.0
14994 * @param {Object} [options]
14995 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
14996 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
14997 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
14998 * @return {Promise<AV.User>}
14999 */
15000 associateWithWeapp: function associateWithWeapp() {
15001 var _this4 = this;
15002
15003 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15004 _ref4$preferUnionId = _ref4.preferUnionId,
15005 preferUnionId = _ref4$preferUnionId === undefined ? false : _ref4$preferUnionId,
15006 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
15007 unionIdPlatform = _ref4$unionIdPlatform === undefined ? 'weixin' : _ref4$unionIdPlatform,
15008 _ref4$asMainAccount = _ref4.asMainAccount,
15009 asMainAccount = _ref4$asMainAccount === undefined ? true : _ref4$asMainAccount;
15010
15011 var getAuthInfo = getAdapter('getAuthInfo');
15012 return getAuthInfo({
15013 preferUnionId: preferUnionId,
15014 asMainAccount: asMainAccount,
15015 platform: unionIdPlatform
15016 }).then(function (authInfo) {
15017 return _this4.associateWithMiniApp(authInfo);
15018 });
15019 },
15020
15021
15022 /**
15023 * @deprecated renamed to {@link AV.User#associateWithWeapp}
15024 * @return {Promise<AV.User>}
15025 */
15026 linkWithWeapp: function linkWithWeapp(options) {
15027 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
15028 return this.associateWithWeapp(options);
15029 },
15030
15031
15032 /**
15033 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
15034 * 仅在 QQ 小程序中可用。
15035 *
15036 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15037 * @since 4.2.0
15038 * @param {string} unionId
15039 * @param {Object} [unionOptions]
15040 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
15041 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15042 * @return {Promise<AV.User>}
15043 */
15044 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
15045 var _this5 = this;
15046
15047 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15048 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
15049 unionIdPlatform = _ref5$unionIdPlatform === undefined ? 'qq' : _ref5$unionIdPlatform,
15050 _ref5$asMainAccount = _ref5.asMainAccount,
15051 asMainAccount = _ref5$asMainAccount === undefined ? false : _ref5$asMainAccount;
15052
15053 var getAuthInfo = getAdapter('getAuthInfo');
15054 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15055 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15056 authInfo.provider = PLATFORM_QQAPP;
15057 return _this5.associateWithMiniApp(authInfo);
15058 });
15059 },
15060
15061
15062 /**
15063 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
15064 * 仅在微信小程序中可用。
15065 *
15066 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15067 * @since 3.13.0
15068 * @param {string} unionId
15069 * @param {Object} [unionOptions]
15070 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
15071 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15072 * @return {Promise<AV.User>}
15073 */
15074 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
15075 var _this6 = this;
15076
15077 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15078 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
15079 unionIdPlatform = _ref6$unionIdPlatform === undefined ? 'weixin' : _ref6$unionIdPlatform,
15080 _ref6$asMainAccount = _ref6.asMainAccount,
15081 asMainAccount = _ref6$asMainAccount === undefined ? false : _ref6$asMainAccount;
15082
15083 var getAuthInfo = getAdapter('getAuthInfo');
15084 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15085 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15086 return _this6.associateWithMiniApp(authInfo);
15087 });
15088 },
15089
15090
15091 /**
15092 * Unlinks a user from a service.
15093 * @param {string} platform
15094 * @return {Promise<AV.User>}
15095 * @since 3.3.0
15096 */
15097 dissociateAuthData: function dissociateAuthData(provider) {
15098 this.unset('authData.' + provider);
15099 return this.save().then(function (model) {
15100 return model._handleSaveResult(true).then(function () {
15101 return model;
15102 });
15103 });
15104 },
15105
15106
15107 /**
15108 * @private
15109 * @deprecated
15110 */
15111 _unlinkFrom: function _unlinkFrom(provider) {
15112 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
15113 return this.dissociateAuthData(provider);
15114 },
15115
15116
15117 /**
15118 * Checks whether a user is linked to a service.
15119 * @private
15120 */
15121 _isLinked: function _isLinked(provider) {
15122 var authType;
15123 if (_.isString(provider)) {
15124 authType = provider;
15125 } else {
15126 authType = provider.getAuthType();
15127 }
15128 var authData = this.get('authData') || {};
15129 return !!authData[authType];
15130 },
15131
15132 /**
15133 * Checks whether a user is anonymous.
15134 * @since 3.9.0
15135 * @return {boolean}
15136 */
15137 isAnonymous: function isAnonymous() {
15138 return this._isLinked(PLATFORM_ANONYMOUS);
15139 },
15140
15141
15142 logOut: function logOut() {
15143 this._logOutWithAll();
15144 this._isCurrentUser = false;
15145 },
15146
15147 /**
15148 * Deauthenticates all providers.
15149 * @private
15150 */
15151 _logOutWithAll: function _logOutWithAll() {
15152 var authData = this.get('authData');
15153 if (!authData) {
15154 return;
15155 }
15156 var self = this;
15157 AV._objectEach(this.get('authData'), function (value, key) {
15158 self._logOutWith(key);
15159 });
15160 },
15161
15162 /**
15163 * Deauthenticates a single provider (e.g. removing access tokens from the
15164 * Facebook SDK).
15165 * @private
15166 */
15167 _logOutWith: function _logOutWith(provider) {
15168 if (!this.isCurrent()) {
15169 return;
15170 }
15171 if (_.isString(provider)) {
15172 provider = AV.User._authProviders[provider];
15173 }
15174 if (provider && provider.deauthenticate) {
15175 provider.deauthenticate();
15176 }
15177 },
15178
15179 /**
15180 * Signs up a new user. You should call this instead of save for
15181 * new AV.Users. This will create a new AV.User on the server, and
15182 * also persist the session on disk so that you can access the user using
15183 * <code>current</code>.
15184 *
15185 * <p>A username and password must be set before calling signUp.</p>
15186 *
15187 * @param {Object} attrs Extra fields to set on the new user, or null.
15188 * @param {AuthOptions} options
15189 * @return {Promise} A promise that is fulfilled when the signup
15190 * finishes.
15191 * @see AV.User.signUp
15192 */
15193 signUp: function signUp(attrs, options) {
15194 var error;
15195
15196 var username = attrs && attrs.username || this.get('username');
15197 if (!username || username === '') {
15198 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
15199 throw error;
15200 }
15201
15202 var password = attrs && attrs.password || this.get('password');
15203 if (!password || password === '') {
15204 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
15205 throw error;
15206 }
15207
15208 return this.save(attrs, options).then(function (model) {
15209 if (model.isAnonymous()) {
15210 model.unset('authData.' + PLATFORM_ANONYMOUS);
15211 model._opSetQueue = [{}];
15212 }
15213 return model._handleSaveResult(true).then(function () {
15214 return model;
15215 });
15216 });
15217 },
15218
15219 /**
15220 * Signs up a new user with mobile phone and sms code.
15221 * You should call this instead of save for
15222 * new AV.Users. This will create a new AV.User on the server, and
15223 * also persist the session on disk so that you can access the user using
15224 * <code>current</code>.
15225 *
15226 * <p>A username and password must be set before calling signUp.</p>
15227 *
15228 * @param {Object} attrs Extra fields to set on the new user, or null.
15229 * @param {AuthOptions} options
15230 * @return {Promise} A promise that is fulfilled when the signup
15231 * finishes.
15232 * @see AV.User.signUpOrlogInWithMobilePhone
15233 * @see AV.Cloud.requestSmsCode
15234 */
15235 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
15236 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15237
15238 var error;
15239
15240 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
15241 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
15242 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
15243 throw error;
15244 }
15245
15246 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
15247 if (!smsCode || smsCode === '') {
15248 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
15249 throw error;
15250 }
15251
15252 options._makeRequest = function (route, className, id, method, json) {
15253 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
15254 };
15255 return this.save(attrs, options).then(function (model) {
15256 delete model.attributes.smsCode;
15257 delete model._serverData.smsCode;
15258 return model._handleSaveResult(true).then(function () {
15259 return model;
15260 });
15261 });
15262 },
15263
15264 /**
15265 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
15266 * @since 3.7.0
15267 */
15268 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
15269 return this._linkWith(platform, authData, options);
15270 },
15271
15272
15273 /**
15274 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
15275 * @since 3.7.0
15276 */
15277 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
15278 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
15279 },
15280
15281
15282 /**
15283 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
15284 * @deprecated please use {@link AV.User#loginWithMiniApp}
15285 * @since 3.7.0
15286 * @param {Object} [options]
15287 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15288 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
15289 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
15290 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15291 * @return {Promise<AV.User>}
15292 */
15293 loginWithWeapp: function loginWithWeapp() {
15294 var _this7 = this;
15295
15296 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15297 _ref7$preferUnionId = _ref7.preferUnionId,
15298 preferUnionId = _ref7$preferUnionId === undefined ? false : _ref7$preferUnionId,
15299 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
15300 unionIdPlatform = _ref7$unionIdPlatform === undefined ? 'weixin' : _ref7$unionIdPlatform,
15301 _ref7$asMainAccount = _ref7.asMainAccount,
15302 asMainAccount = _ref7$asMainAccount === undefined ? true : _ref7$asMainAccount,
15303 _ref7$failOnNotExist = _ref7.failOnNotExist,
15304 failOnNotExist = _ref7$failOnNotExist === undefined ? false : _ref7$failOnNotExist;
15305
15306 var getAuthInfo = getAdapter('getAuthInfo');
15307 return getAuthInfo({
15308 preferUnionId: preferUnionId,
15309 asMainAccount: asMainAccount,
15310 platform: unionIdPlatform
15311 }).then(function (authInfo) {
15312 return _this7.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15313 });
15314 },
15315
15316
15317 /**
15318 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
15319 * @deprecated please use {@link AV.User#loginWithMiniApp}
15320 * @since 3.13.0
15321 */
15322 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
15323 var _this8 = this;
15324
15325 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15326 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
15327 unionIdPlatform = _ref8$unionIdPlatform === undefined ? 'weixin' : _ref8$unionIdPlatform,
15328 _ref8$asMainAccount = _ref8.asMainAccount,
15329 asMainAccount = _ref8$asMainAccount === undefined ? false : _ref8$asMainAccount,
15330 _ref8$failOnNotExist = _ref8.failOnNotExist,
15331 failOnNotExist = _ref8$failOnNotExist === undefined ? false : _ref8$failOnNotExist;
15332
15333 var getAuthInfo = getAdapter('getAuthInfo');
15334 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15335 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15336 return _this8.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15337 });
15338 },
15339
15340
15341 /**
15342 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
15343 * @deprecated please use {@link AV.User#loginWithMiniApp}
15344 * @since 4.2.0
15345 * @param {Object} [options]
15346 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15347 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
15348 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
15349 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15350 */
15351 loginWithQQApp: function loginWithQQApp() {
15352 var _this9 = this;
15353
15354 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15355 _ref9$preferUnionId = _ref9.preferUnionId,
15356 preferUnionId = _ref9$preferUnionId === undefined ? false : _ref9$preferUnionId,
15357 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
15358 unionIdPlatform = _ref9$unionIdPlatform === undefined ? 'qq' : _ref9$unionIdPlatform,
15359 _ref9$asMainAccount = _ref9.asMainAccount,
15360 asMainAccount = _ref9$asMainAccount === undefined ? true : _ref9$asMainAccount,
15361 _ref9$failOnNotExist = _ref9.failOnNotExist,
15362 failOnNotExist = _ref9$failOnNotExist === undefined ? false : _ref9$failOnNotExist;
15363
15364 var getAuthInfo = getAdapter('getAuthInfo');
15365 return getAuthInfo({
15366 preferUnionId: preferUnionId,
15367 asMainAccount: asMainAccount,
15368 platform: unionIdPlatform
15369 }).then(function (authInfo) {
15370 authInfo.provider = PLATFORM_QQAPP;
15371 return _this9.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15372 });
15373 },
15374
15375
15376 /**
15377 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
15378 * @deprecated please use {@link AV.User#loginWithMiniApp}
15379 * @since 4.2.0
15380 */
15381 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
15382 var _this10 = this;
15383
15384 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15385 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
15386 unionIdPlatform = _ref10$unionIdPlatfor === undefined ? 'qq' : _ref10$unionIdPlatfor,
15387 _ref10$asMainAccount = _ref10.asMainAccount,
15388 asMainAccount = _ref10$asMainAccount === undefined ? false : _ref10$asMainAccount,
15389 _ref10$failOnNotExist = _ref10.failOnNotExist,
15390 failOnNotExist = _ref10$failOnNotExist === undefined ? false : _ref10$failOnNotExist;
15391
15392 var getAuthInfo = getAdapter('getAuthInfo');
15393 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15394 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15395 authInfo.provider = PLATFORM_QQAPP;
15396 return _this10.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15397 });
15398 },
15399
15400
15401 /**
15402 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
15403 * @since 4.6.0
15404 */
15405 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
15406 var _this11 = this;
15407
15408 if (authInfo === undefined) {
15409 var getAuthInfo = getAdapter('getAuthInfo');
15410 return getAuthInfo().then(function (authInfo) {
15411 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
15412 });
15413 }
15414 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
15415 },
15416
15417
15418 /**
15419 * Logs in a AV.User. On success, this saves the session to localStorage,
15420 * so you can retrieve the currently logged in user using
15421 * <code>current</code>.
15422 *
15423 * <p>A username and password must be set before calling logIn.</p>
15424 *
15425 * @see AV.User.logIn
15426 * @return {Promise} A promise that is fulfilled with the user when
15427 * the login is complete.
15428 */
15429 logIn: function logIn() {
15430 var model = this;
15431 var request = AVRequest('login', null, null, 'POST', this.toJSON());
15432 return request.then(function (resp) {
15433 var serverAttrs = model.parse(resp);
15434 model._finishFetch(serverAttrs);
15435 return model._handleSaveResult(true).then(function () {
15436 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
15437 return model;
15438 });
15439 });
15440 },
15441 /**
15442 * @see AV.Object#save
15443 */
15444 save: function save(arg1, arg2, arg3) {
15445 var attrs, options;
15446 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
15447 attrs = arg1;
15448 options = arg2;
15449 } else {
15450 attrs = {};
15451 attrs[arg1] = arg2;
15452 options = arg3;
15453 }
15454 options = options || {};
15455
15456 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
15457 return model._handleSaveResult(false).then(function () {
15458 return model;
15459 });
15460 });
15461 },
15462
15463 /**
15464 * Follow a user
15465 * @since 0.3.0
15466 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
15467 * @param {AV.User | String} options.user The target user or user's objectId to follow.
15468 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
15469 * conditions of followerQuery/followeeQuery.
15470 * @param {AuthOptions} [authOptions]
15471 */
15472 follow: function follow(options, authOptions) {
15473 if (!this.id) {
15474 throw new Error('Please signin.');
15475 }
15476 var user = void 0;
15477 var attributes = void 0;
15478 if (options.user) {
15479 user = options.user;
15480 attributes = options.attributes;
15481 } else {
15482 user = options;
15483 }
15484 var userObjectId = _.isString(user) ? user : user.id;
15485 if (!userObjectId) {
15486 throw new Error('Invalid target user.');
15487 }
15488 var route = 'users/' + this.id + '/friendship/' + userObjectId;
15489 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
15490 return request;
15491 },
15492
15493 /**
15494 * Unfollow a user.
15495 * @since 0.3.0
15496 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
15497 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
15498 * @param {AuthOptions} [authOptions]
15499 */
15500 unfollow: function unfollow(options, authOptions) {
15501 if (!this.id) {
15502 throw new Error('Please signin.');
15503 }
15504 var user = void 0;
15505 if (options.user) {
15506 user = options.user;
15507 } else {
15508 user = options;
15509 }
15510 var userObjectId = _.isString(user) ? user : user.id;
15511 if (!userObjectId) {
15512 throw new Error('Invalid target user.');
15513 }
15514 var route = 'users/' + this.id + '/friendship/' + userObjectId;
15515 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
15516 return request;
15517 },
15518
15519 /**
15520 * Get the user's followers and followees.
15521 * @since 4.8.0
15522 * @param {Object} [options]
15523 * @param {Number} [options.skip]
15524 * @param {Number} [options.limit]
15525 * @param {AuthOptions} [authOptions]
15526 */
15527 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
15528 if (!this.id) {
15529 throw new Error('Please signin.');
15530 }
15531 return request({
15532 method: 'GET',
15533 path: '/users/' + this.id + '/followersAndFollowees',
15534 query: {
15535 skip: options && options.skip,
15536 limit: options && options.limit,
15537 include: 'follower,followee',
15538 keys: 'follower,followee'
15539 },
15540 authOptions: authOptions
15541 }).then(function (_ref11) {
15542 var followers = _ref11.followers,
15543 followees = _ref11.followees;
15544 return {
15545 followers: followers.map(function (_ref12) {
15546 var follower = _ref12.follower;
15547 return AV._decode(follower);
15548 }),
15549 followees: followees.map(function (_ref13) {
15550 var followee = _ref13.followee;
15551 return AV._decode(followee);
15552 })
15553 };
15554 });
15555 },
15556
15557 /**
15558 *Create a follower query to query the user's followers.
15559 * @since 0.3.0
15560 * @see AV.User#followerQuery
15561 */
15562 followerQuery: function followerQuery() {
15563 return AV.User.followerQuery(this.id);
15564 },
15565
15566 /**
15567 *Create a followee query to query the user's followees.
15568 * @since 0.3.0
15569 * @see AV.User#followeeQuery
15570 */
15571 followeeQuery: function followeeQuery() {
15572 return AV.User.followeeQuery(this.id);
15573 },
15574
15575 /**
15576 * @see AV.Object#fetch
15577 */
15578 fetch: function fetch(fetchOptions, options) {
15579 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
15580 return model._handleSaveResult(false).then(function () {
15581 return model;
15582 });
15583 });
15584 },
15585
15586 /**
15587 * Update user's new password safely based on old password.
15588 * @param {String} oldPassword the old password.
15589 * @param {String} newPassword the new password.
15590 * @param {AuthOptions} options
15591 */
15592 updatePassword: function updatePassword(oldPassword, newPassword, options) {
15593 var _this12 = this;
15594
15595 var route = 'users/' + this.id + '/updatePassword';
15596 var params = {
15597 old_password: oldPassword,
15598 new_password: newPassword
15599 };
15600 var request = AVRequest(route, null, null, 'PUT', params, options);
15601 return request.then(function (resp) {
15602 _this12._finishFetch(_this12.parse(resp));
15603 return _this12._handleSaveResult(true).then(function () {
15604 return resp;
15605 });
15606 });
15607 },
15608
15609 /**
15610 * Returns true if <code>current</code> would return this user.
15611 * @see AV.User#current
15612 */
15613 isCurrent: function isCurrent() {
15614 return this._isCurrentUser;
15615 },
15616
15617 /**
15618 * Returns get("username").
15619 * @return {String}
15620 * @see AV.Object#get
15621 */
15622 getUsername: function getUsername() {
15623 return this.get('username');
15624 },
15625
15626 /**
15627 * Returns get("mobilePhoneNumber").
15628 * @return {String}
15629 * @see AV.Object#get
15630 */
15631 getMobilePhoneNumber: function getMobilePhoneNumber() {
15632 return this.get('mobilePhoneNumber');
15633 },
15634
15635 /**
15636 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
15637 * @param {String} mobilePhoneNumber
15638 * @return {Boolean}
15639 * @see AV.Object#set
15640 */
15641 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
15642 return this.set('mobilePhoneNumber', phone, options);
15643 },
15644
15645 /**
15646 * Calls set("username", username, options) and returns the result.
15647 * @param {String} username
15648 * @return {Boolean}
15649 * @see AV.Object#set
15650 */
15651 setUsername: function setUsername(username, options) {
15652 return this.set('username', username, options);
15653 },
15654
15655 /**
15656 * Calls set("password", password, options) and returns the result.
15657 * @param {String} password
15658 * @return {Boolean}
15659 * @see AV.Object#set
15660 */
15661 setPassword: function setPassword(password, options) {
15662 return this.set('password', password, options);
15663 },
15664
15665 /**
15666 * Returns get("email").
15667 * @return {String}
15668 * @see AV.Object#get
15669 */
15670 getEmail: function getEmail() {
15671 return this.get('email');
15672 },
15673
15674 /**
15675 * Calls set("email", email, options) and returns the result.
15676 * @param {String} email
15677 * @param {AuthOptions} options
15678 * @return {Boolean}
15679 * @see AV.Object#set
15680 */
15681 setEmail: function setEmail(email, options) {
15682 return this.set('email', email, options);
15683 },
15684
15685 /**
15686 * Checks whether this user is the current user and has been authenticated.
15687 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
15688 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
15689 * @return (Boolean) whether this user is the current user and is logged in.
15690 */
15691 authenticated: function authenticated() {
15692 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
15693 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
15694 },
15695
15696 /**
15697 * Detects if current sessionToken is valid.
15698 *
15699 * @since 2.0.0
15700 * @return Promise.<Boolean>
15701 */
15702 isAuthenticated: function isAuthenticated() {
15703 var _this13 = this;
15704
15705 return _promise2.default.resolve().then(function () {
15706 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
15707 return true;
15708 }, function (error) {
15709 if (error.code === 211) {
15710 return false;
15711 }
15712 throw error;
15713 });
15714 });
15715 },
15716
15717
15718 /**
15719 * Get sessionToken of current user.
15720 * @return {String} sessionToken
15721 */
15722 getSessionToken: function getSessionToken() {
15723 return this._sessionToken;
15724 },
15725
15726
15727 /**
15728 * Refresh sessionToken of current user.
15729 * @since 2.1.0
15730 * @param {AuthOptions} [options]
15731 * @return {Promise.<AV.User>} user with refreshed sessionToken
15732 */
15733 refreshSessionToken: function refreshSessionToken(options) {
15734 var _this14 = this;
15735
15736 return AVRequest('users/' + this.id + '/refreshSessionToken', null, null, 'PUT', null, options).then(function (response) {
15737 _this14._finishFetch(response);
15738 return _this14._handleSaveResult(true).then(function () {
15739 return _this14;
15740 });
15741 });
15742 },
15743
15744
15745 /**
15746 * Get this user's Roles.
15747 * @param {AuthOptions} [options]
15748 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
15749 * the query is complete.
15750 */
15751 getRoles: function getRoles(options) {
15752 return AV.Relation.reverseQuery('_Role', 'users', this).find(options);
15753 }
15754 },
15755 /** @lends AV.User */{
15756 // Class Variables
15757
15758 // The currently logged-in user.
15759 _currentUser: null,
15760
15761 // Whether currentUser is known to match the serialized version on disk.
15762 // This is useful for saving a localstorage check if you try to load
15763 // _currentUser frequently while there is none stored.
15764 _currentUserMatchesDisk: false,
15765
15766 // The localStorage key suffix that the current user is stored under.
15767 _CURRENT_USER_KEY: 'currentUser',
15768
15769 // The mapping of auth provider names to actual providers
15770 _authProviders: {},
15771
15772 // Class Methods
15773
15774 /**
15775 * Signs up a new user with a username (or email) and password.
15776 * This will create a new AV.User on the server, and also persist the
15777 * session in localStorage so that you can access the user using
15778 * {@link #current}.
15779 *
15780 * @param {String} username The username (or email) to sign up with.
15781 * @param {String} password The password to sign up with.
15782 * @param {Object} [attrs] Extra fields to set on the new user.
15783 * @param {AuthOptions} [options]
15784 * @return {Promise} A promise that is fulfilled with the user when
15785 * the signup completes.
15786 * @see AV.User#signUp
15787 */
15788 signUp: function signUp(username, password, attrs, options) {
15789 attrs = attrs || {};
15790 attrs.username = username;
15791 attrs.password = password;
15792 var user = AV.Object._create('_User');
15793 return user.signUp(attrs, options);
15794 },
15795
15796 /**
15797 * Logs in a user with a username (or email) and password. On success, this
15798 * saves the session to disk, so you can retrieve the currently logged in
15799 * user using <code>current</code>.
15800 *
15801 * @param {String} username The username (or email) to log in with.
15802 * @param {String} password The password to log in with.
15803 * @return {Promise} A promise that is fulfilled with the user when
15804 * the login completes.
15805 * @see AV.User#logIn
15806 */
15807 logIn: function logIn(username, password) {
15808 var user = AV.Object._create('_User');
15809 user._finishFetch({ username: username, password: password });
15810 return user.logIn();
15811 },
15812
15813 /**
15814 * Logs in a user with a session token. On success, this saves the session
15815 * to disk, so you can retrieve the currently logged in user using
15816 * <code>current</code>.
15817 *
15818 * @param {String} sessionToken The sessionToken to log in with.
15819 * @return {Promise} A promise that is fulfilled with the user when
15820 * the login completes.
15821 */
15822 become: function become(sessionToken) {
15823 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
15824 return user._handleSaveResult(true).then(function () {
15825 return user;
15826 });
15827 });
15828 },
15829
15830 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
15831 if (sessionToken === undefined) {
15832 return _promise2.default.reject(new Error('The sessionToken cannot be undefined'));
15833 }
15834
15835 var user = AV.Object._create('_User');
15836 return request({
15837 method: 'GET',
15838 path: '/users/me',
15839 authOptions: {
15840 sessionToken: sessionToken
15841 }
15842 }).then(function (resp) {
15843 var serverAttrs = user.parse(resp);
15844 user._finishFetch(serverAttrs);
15845 return user;
15846 });
15847 },
15848
15849 /**
15850 * Logs in a user with a mobile phone number and sms code sent by
15851 * AV.User.requestLoginSmsCode.On success, this
15852 * saves the session to disk, so you can retrieve the currently logged in
15853 * user using <code>current</code>.
15854 *
15855 * @param {String} mobilePhone The user's mobilePhoneNumber
15856 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
15857 * @return {Promise} A promise that is fulfilled with the user when
15858 * the login completes.
15859 * @see AV.User#logIn
15860 */
15861 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
15862 var user = AV.Object._create('_User');
15863 user._finishFetch({ mobilePhoneNumber: mobilePhone, smsCode: smsCode });
15864 return user.logIn();
15865 },
15866
15867 /**
15868 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
15869 * On success, this saves the session to disk, so you can retrieve the currently
15870 * logged in user using <code>current</code>.
15871 *
15872 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
15873 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
15874 * @param {Object} attributes The user's other attributes such as username etc.
15875 * @param {AuthOptions} options
15876 * @return {Promise} A promise that is fulfilled with the user when
15877 * the login completes.
15878 * @see AV.User#signUpOrlogInWithMobilePhone
15879 * @see AV.Cloud.requestSmsCode
15880 */
15881 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
15882 attrs = attrs || {};
15883 attrs.mobilePhoneNumber = mobilePhoneNumber;
15884 attrs.smsCode = smsCode;
15885 var user = AV.Object._create('_User');
15886 return user.signUpOrlogInWithMobilePhone(attrs, options);
15887 },
15888
15889 /**
15890 * Logs in a user with a mobile phone number and password. On success, this
15891 * saves the session to disk, so you can retrieve the currently logged in
15892 * user using <code>current</code>.
15893 *
15894 * @param {String} mobilePhone The user's mobilePhoneNumber
15895 * @param {String} password The password to log in with.
15896 * @return {Promise} A promise that is fulfilled with the user when
15897 * the login completes.
15898 * @see AV.User#logIn
15899 */
15900 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
15901 var user = AV.Object._create('_User');
15902 user._finishFetch({
15903 mobilePhoneNumber: mobilePhone,
15904 password: password
15905 });
15906 return user.logIn();
15907 },
15908
15909 /**
15910 * Logs in a user with email and password.
15911 *
15912 * @since 3.13.0
15913 * @param {String} email The user's email.
15914 * @param {String} password The password to log in with.
15915 * @return {Promise} A promise that is fulfilled with the user when
15916 * the login completes.
15917 */
15918 loginWithEmail: function loginWithEmail(email, password) {
15919 var user = AV.Object._create('_User');
15920 user._finishFetch({
15921 email: email,
15922 password: password
15923 });
15924 return user.logIn();
15925 },
15926
15927
15928 /**
15929 * Signs up or logs in a user with a third party auth data(AccessToken).
15930 * On success, this saves the session to disk, so you can retrieve the currently
15931 * logged in user using <code>current</code>.
15932 *
15933 * @since 3.7.0
15934 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
15935 * @param {string} platform Available platform for sign up.
15936 * @param {Object} [options]
15937 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15938 * @return {Promise} A promise that is fulfilled with the user when
15939 * the login completes.
15940 * @example AV.User.loginWithAuthData({
15941 * openid: 'abc123',
15942 * access_token: '123abc',
15943 * expires_in: 1382686496
15944 * }, 'weixin').then(function(user) {
15945 * //Access user here
15946 * }).catch(function(error) {
15947 * //console.error("error: ", error);
15948 * });
15949 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
15950 */
15951 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
15952 return AV.User._logInWith(platform, authData, options);
15953 },
15954
15955
15956 /**
15957 * @deprecated renamed to {@link AV.User.loginWithAuthData}
15958 */
15959 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
15960 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
15961 return this.loginWithAuthData.apply(this, arguments);
15962 },
15963
15964
15965 /**
15966 * Signs up or logs in a user with a third party authData and unionId.
15967 * @since 3.7.0
15968 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
15969 * @param {string} platform Available platform for sign up.
15970 * @param {string} unionId
15971 * @param {Object} [unionLoginOptions]
15972 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
15973 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15974 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15975 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
15976 * @example AV.User.loginWithAuthDataAndUnionId({
15977 * openid: 'abc123',
15978 * access_token: '123abc',
15979 * expires_in: 1382686496
15980 * }, 'weixin', 'union123', {
15981 * unionIdPlatform: 'weixin',
15982 * asMainAccount: true,
15983 * }).then(function(user) {
15984 * //Access user here
15985 * }).catch(function(error) {
15986 * //console.error("error: ", error);
15987 * });
15988 */
15989 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
15990 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
15991 },
15992
15993
15994 /**
15995 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
15996 * @since 3.5.0
15997 */
15998 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
15999 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
16000 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
16001 },
16002
16003
16004 /**
16005 * Merge unionId into authInfo.
16006 * @since 4.6.0
16007 * @param {Object} authInfo
16008 * @param {String} unionId
16009 * @param {Object} [unionIdOption]
16010 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
16011 */
16012 mergeUnionId: function mergeUnionId(authInfo, unionId) {
16013 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
16014 _ref14$asMainAccount = _ref14.asMainAccount,
16015 asMainAccount = _ref14$asMainAccount === undefined ? false : _ref14$asMainAccount;
16016
16017 authInfo = JSON.parse((0, _stringify2.default)(authInfo));
16018 var _authInfo = authInfo,
16019 authData = _authInfo.authData,
16020 platform = _authInfo.platform;
16021
16022 authData.platform = platform;
16023 authData.main_account = asMainAccount;
16024 authData.unionid = unionId;
16025 return authInfo;
16026 },
16027
16028
16029 /**
16030 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
16031 * 仅在微信小程序中可用。
16032 *
16033 * @deprecated please use {@link AV.User.loginWithMiniApp}
16034 * @since 2.0.0
16035 * @param {Object} [options]
16036 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
16037 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
16038 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
16039 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
16040 * @return {Promise.<AV.User>}
16041 */
16042 loginWithWeapp: function loginWithWeapp() {
16043 var _this15 = this;
16044
16045 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16046 _ref15$preferUnionId = _ref15.preferUnionId,
16047 preferUnionId = _ref15$preferUnionId === undefined ? false : _ref15$preferUnionId,
16048 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
16049 unionIdPlatform = _ref15$unionIdPlatfor === undefined ? 'weixin' : _ref15$unionIdPlatfor,
16050 _ref15$asMainAccount = _ref15.asMainAccount,
16051 asMainAccount = _ref15$asMainAccount === undefined ? true : _ref15$asMainAccount,
16052 _ref15$failOnNotExist = _ref15.failOnNotExist,
16053 failOnNotExist = _ref15$failOnNotExist === undefined ? false : _ref15$failOnNotExist;
16054
16055 var getAuthInfo = getAdapter('getAuthInfo');
16056 return getAuthInfo({
16057 preferUnionId: preferUnionId,
16058 asMainAccount: asMainAccount,
16059 platform: unionIdPlatform
16060 }).then(function (authInfo) {
16061 return _this15.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16062 });
16063 },
16064
16065
16066 /**
16067 * 使用当前使用微信小程序的微信用户身份注册或登录,
16068 * 仅在微信小程序中可用。
16069 *
16070 * @deprecated please use {@link AV.User.loginWithMiniApp}
16071 * @since 3.13.0
16072 * @param {Object} [unionLoginOptions]
16073 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
16074 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16075 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
16076 */
16077 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
16078 var _this16 = this;
16079
16080 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
16081 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
16082 unionIdPlatform = _ref16$unionIdPlatfor === undefined ? 'weixin' : _ref16$unionIdPlatfor,
16083 _ref16$asMainAccount = _ref16.asMainAccount,
16084 asMainAccount = _ref16$asMainAccount === undefined ? false : _ref16$asMainAccount,
16085 _ref16$failOnNotExist = _ref16.failOnNotExist,
16086 failOnNotExist = _ref16$failOnNotExist === undefined ? false : _ref16$failOnNotExist;
16087
16088 var getAuthInfo = getAdapter('getAuthInfo');
16089 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
16090 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
16091 return _this16.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16092 });
16093 },
16094
16095
16096 /**
16097 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
16098 * 仅在 QQ 小程序中可用。
16099 *
16100 * @deprecated please use {@link AV.User.loginWithMiniApp}
16101 * @since 4.2.0
16102 * @param {Object} [options]
16103 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
16104 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
16105 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
16106 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
16107 * @return {Promise.<AV.User>}
16108 */
16109 loginWithQQApp: function loginWithQQApp() {
16110 var _this17 = this;
16111
16112 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16113 _ref17$preferUnionId = _ref17.preferUnionId,
16114 preferUnionId = _ref17$preferUnionId === undefined ? false : _ref17$preferUnionId,
16115 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
16116 unionIdPlatform = _ref17$unionIdPlatfor === undefined ? 'qq' : _ref17$unionIdPlatfor,
16117 _ref17$asMainAccount = _ref17.asMainAccount,
16118 asMainAccount = _ref17$asMainAccount === undefined ? true : _ref17$asMainAccount,
16119 _ref17$failOnNotExist = _ref17.failOnNotExist,
16120 failOnNotExist = _ref17$failOnNotExist === undefined ? false : _ref17$failOnNotExist;
16121
16122 var getAuthInfo = getAdapter('getAuthInfo');
16123 return getAuthInfo({
16124 preferUnionId: preferUnionId,
16125 asMainAccount: asMainAccount,
16126 platform: unionIdPlatform
16127 }).then(function (authInfo) {
16128 authInfo.provider = PLATFORM_QQAPP;
16129 return _this17.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16130 });
16131 },
16132
16133
16134 /**
16135 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
16136 * 仅在 QQ 小程序中可用。
16137 *
16138 * @deprecated please use {@link AV.User.loginWithMiniApp}
16139 * @since 4.2.0
16140 * @param {Object} [unionLoginOptions]
16141 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
16142 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16143 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
16144 * @return {Promise.<AV.User>}
16145 */
16146 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
16147 var _this18 = this;
16148
16149 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
16150 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
16151 unionIdPlatform = _ref18$unionIdPlatfor === undefined ? 'qq' : _ref18$unionIdPlatfor,
16152 _ref18$asMainAccount = _ref18.asMainAccount,
16153 asMainAccount = _ref18$asMainAccount === undefined ? false : _ref18$asMainAccount,
16154 _ref18$failOnNotExist = _ref18.failOnNotExist,
16155 failOnNotExist = _ref18$failOnNotExist === undefined ? false : _ref18$failOnNotExist;
16156
16157 var getAuthInfo = getAdapter('getAuthInfo');
16158 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
16159 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
16160 authInfo.provider = PLATFORM_QQAPP;
16161 return _this18.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16162 });
16163 },
16164
16165
16166 /**
16167 * Register or login using the identity of the current mini-app.
16168 * @param {Object} authInfo
16169 * @param {Object} [option]
16170 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
16171 */
16172 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
16173 var _this19 = this;
16174
16175 if (authInfo === undefined) {
16176 var getAuthInfo = getAdapter('getAuthInfo');
16177 return getAuthInfo().then(function (authInfo) {
16178 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
16179 });
16180 }
16181 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
16182 },
16183
16184
16185 /**
16186 * Only use for DI in tests to produce deterministic IDs.
16187 */
16188 _genId: function _genId() {
16189 return uuid();
16190 },
16191
16192
16193 /**
16194 * Creates an anonymous user.
16195 *
16196 * @since 3.9.0
16197 * @return {Promise.<AV.User>}
16198 */
16199 loginAnonymously: function loginAnonymously() {
16200 return this.loginWithAuthData({
16201 id: AV.User._genId()
16202 }, 'anonymous');
16203 },
16204 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
16205 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
16206 return userObj._linkWith(platform, authData);
16207 },
16208
16209 /**
16210 * Logs out the currently logged in user session. This will remove the
16211 * session from disk, log out of linked services, and future calls to
16212 * <code>current</code> will return <code>null</code>.
16213 * @return {Promise}
16214 */
16215 logOut: function logOut() {
16216 if (AV._config.disableCurrentUser) {
16217 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');
16218 return _promise2.default.resolve(null);
16219 }
16220
16221 if (AV.User._currentUser !== null) {
16222 AV.User._currentUser._logOutWithAll();
16223 AV.User._currentUser._isCurrentUser = false;
16224 }
16225 AV.User._currentUserMatchesDisk = true;
16226 AV.User._currentUser = null;
16227 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
16228 return AV._refreshSubscriptionId();
16229 });
16230 },
16231
16232 /**
16233 *Create a follower query for special user to query the user's followers.
16234 * @param {String} userObjectId The user object id.
16235 * @return {AV.FriendShipQuery}
16236 * @since 0.3.0
16237 */
16238 followerQuery: function followerQuery(userObjectId) {
16239 if (!userObjectId || !_.isString(userObjectId)) {
16240 throw new Error('Invalid user object id.');
16241 }
16242 var query = new AV.FriendShipQuery('_Follower');
16243 query._friendshipTag = 'follower';
16244 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
16245 return query;
16246 },
16247
16248 /**
16249 *Create a followee query for special user to query the user's followees.
16250 * @param {String} userObjectId The user object id.
16251 * @return {AV.FriendShipQuery}
16252 * @since 0.3.0
16253 */
16254 followeeQuery: function followeeQuery(userObjectId) {
16255 if (!userObjectId || !_.isString(userObjectId)) {
16256 throw new Error('Invalid user object id.');
16257 }
16258 var query = new AV.FriendShipQuery('_Followee');
16259 query._friendshipTag = 'followee';
16260 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
16261 return query;
16262 },
16263
16264 /**
16265 * Requests a password reset email to be sent to the specified email address
16266 * associated with the user account. This email allows the user to securely
16267 * reset their password on the AV site.
16268 *
16269 * @param {String} email The email address associated with the user that
16270 * forgot their password.
16271 * @return {Promise}
16272 */
16273 requestPasswordReset: function requestPasswordReset(email) {
16274 var json = { email: email };
16275 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
16276 return request;
16277 },
16278
16279 /**
16280 * Requests a verify email to be sent to the specified email address
16281 * associated with the user account. This email allows the user to securely
16282 * verify their email address on the AV site.
16283 *
16284 * @param {String} email The email address associated with the user that
16285 * doesn't verify their email address.
16286 * @return {Promise}
16287 */
16288 requestEmailVerify: function requestEmailVerify(email) {
16289 var json = { email: email };
16290 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
16291 return request;
16292 },
16293
16294 /**
16295 * Requests a verify sms code to be sent to the specified mobile phone
16296 * number associated with the user account. This sms code allows the user to
16297 * verify their mobile phone number by calling AV.User.verifyMobilePhone
16298 *
16299 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16300 * user that doesn't verify their mobile phone number.
16301 * @param {SMSAuthOptions} [options]
16302 * @return {Promise}
16303 */
16304 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
16305 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16306
16307 var data = {
16308 mobilePhoneNumber: mobilePhoneNumber
16309 };
16310 if (options.validateToken) {
16311 data.validate_token = options.validateToken;
16312 }
16313 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
16314 return request;
16315 },
16316
16317 /**
16318 * Requests a reset password sms code to be sent to the specified mobile phone
16319 * number associated with the user account. This sms code allows the user to
16320 * reset their account's password by calling AV.User.resetPasswordBySmsCode
16321 *
16322 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16323 * user that doesn't verify their mobile phone number.
16324 * @param {SMSAuthOptions} [options]
16325 * @return {Promise}
16326 */
16327 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
16328 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16329
16330 var data = {
16331 mobilePhoneNumber: mobilePhoneNumber
16332 };
16333 if (options.validateToken) {
16334 data.validate_token = options.validateToken;
16335 }
16336 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
16337 return request;
16338 },
16339
16340 /**
16341 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
16342 * This sms code allows current user to reset it's mobilePhoneNumber by
16343 * calling {@link AV.User.changePhoneNumber}
16344 * @since 4.7.0
16345 * @param {String} mobilePhoneNumber
16346 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
16347 * @param {SMSAuthOptions} [options]
16348 * @return {Promise}
16349 */
16350 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
16351 var data = { mobilePhoneNumber: mobilePhoneNumber };
16352 if (ttl) {
16353 data.ttl = options.ttl;
16354 }
16355 if (options && options.validateToken) {
16356 data.validate_token = options.validateToken;
16357 }
16358 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
16359 },
16360
16361
16362 /**
16363 * Makes a call to reset user's account mobilePhoneNumber by sms code.
16364 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
16365 * @since 4.7.0
16366 * @param {String} mobilePhoneNumber
16367 * @param {String} code The sms code.
16368 * @return {Promise}
16369 */
16370 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
16371 var data = { mobilePhoneNumber: mobilePhoneNumber, code: code };
16372 return AVRequest('changePhoneNumber', null, null, 'POST', data);
16373 },
16374
16375
16376 /**
16377 * Makes a call to reset user's account password by sms code and new password.
16378 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
16379 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
16380 * @param {String} password The new password.
16381 * @return {Promise} A promise that will be resolved with the result
16382 * of the function.
16383 */
16384 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
16385 var json = { password: password };
16386 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
16387 return request;
16388 },
16389
16390 /**
16391 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
16392 * If verify successfully,the user mobilePhoneVerified attribute will be true.
16393 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
16394 * @return {Promise} A promise that will be resolved with the result
16395 * of the function.
16396 */
16397 verifyMobilePhone: function verifyMobilePhone(code) {
16398 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
16399 return request;
16400 },
16401
16402 /**
16403 * Requests a logIn sms code to be sent to the specified mobile phone
16404 * number associated with the user account. This sms code allows the user to
16405 * login by AV.User.logInWithMobilePhoneSmsCode function.
16406 *
16407 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16408 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
16409 * @param {SMSAuthOptions} [options]
16410 * @return {Promise}
16411 */
16412 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
16413 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16414
16415 var data = {
16416 mobilePhoneNumber: mobilePhoneNumber
16417 };
16418 if (options.validateToken) {
16419 data.validate_token = options.validateToken;
16420 }
16421 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
16422 return request;
16423 },
16424
16425 /**
16426 * Retrieves the currently logged in AVUser with a valid session,
16427 * either from memory or localStorage, if necessary.
16428 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
16429 */
16430 currentAsync: function currentAsync() {
16431 if (AV._config.disableCurrentUser) {
16432 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');
16433 return _promise2.default.resolve(null);
16434 }
16435
16436 if (AV.User._currentUser) {
16437 return _promise2.default.resolve(AV.User._currentUser);
16438 }
16439
16440 if (AV.User._currentUserMatchesDisk) {
16441 return _promise2.default.resolve(AV.User._currentUser);
16442 }
16443
16444 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
16445 if (!userData) {
16446 return null;
16447 }
16448
16449 // Load the user from local storage.
16450 AV.User._currentUserMatchesDisk = true;
16451
16452 AV.User._currentUser = AV.Object._create('_User');
16453 AV.User._currentUser._isCurrentUser = true;
16454
16455 var json = JSON.parse(userData);
16456 AV.User._currentUser.id = json._id;
16457 delete json._id;
16458 AV.User._currentUser._sessionToken = json._sessionToken;
16459 delete json._sessionToken;
16460 AV.User._currentUser._finishFetch(json);
16461 //AV.User._currentUser.set(json);
16462
16463 AV.User._currentUser._synchronizeAllAuthData();
16464 AV.User._currentUser._refreshCache();
16465 AV.User._currentUser._opSetQueue = [{}];
16466 return AV.User._currentUser;
16467 });
16468 },
16469
16470 /**
16471 * Retrieves the currently logged in AVUser with a valid session,
16472 * either from memory or localStorage, if necessary.
16473 * @return {AV.User} The currently logged in AV.User.
16474 */
16475 current: function current() {
16476 if (AV._config.disableCurrentUser) {
16477 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');
16478 return null;
16479 }
16480
16481 if (AV.localStorage.async) {
16482 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
16483 error.code = 'SYNC_API_NOT_AVAILABLE';
16484 throw error;
16485 }
16486
16487 if (AV.User._currentUser) {
16488 return AV.User._currentUser;
16489 }
16490
16491 if (AV.User._currentUserMatchesDisk) {
16492 return AV.User._currentUser;
16493 }
16494
16495 // Load the user from local storage.
16496 AV.User._currentUserMatchesDisk = true;
16497
16498 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
16499 if (!userData) {
16500 return null;
16501 }
16502 AV.User._currentUser = AV.Object._create('_User');
16503 AV.User._currentUser._isCurrentUser = true;
16504
16505 var json = JSON.parse(userData);
16506 AV.User._currentUser.id = json._id;
16507 delete json._id;
16508 AV.User._currentUser._sessionToken = json._sessionToken;
16509 delete json._sessionToken;
16510 AV.User._currentUser._finishFetch(json);
16511 //AV.User._currentUser.set(json);
16512
16513 AV.User._currentUser._synchronizeAllAuthData();
16514 AV.User._currentUser._refreshCache();
16515 AV.User._currentUser._opSetQueue = [{}];
16516 return AV.User._currentUser;
16517 },
16518
16519 /**
16520 * Persists a user as currentUser to localStorage, and into the singleton.
16521 * @private
16522 */
16523 _saveCurrentUser: function _saveCurrentUser(user) {
16524 var promise;
16525 if (AV.User._currentUser !== user) {
16526 promise = AV.User.logOut();
16527 } else {
16528 promise = _promise2.default.resolve();
16529 }
16530 return promise.then(function () {
16531 user._isCurrentUser = true;
16532 AV.User._currentUser = user;
16533
16534 var json = user._toFullJSON();
16535 json._id = user.id;
16536 json._sessionToken = user._sessionToken;
16537 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify2.default)(json)).then(function () {
16538 AV.User._currentUserMatchesDisk = true;
16539 return AV._refreshSubscriptionId();
16540 });
16541 });
16542 },
16543
16544 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
16545 AV.User._authProviders[provider.getAuthType()] = provider;
16546 // Synchronize the current user with the auth provider.
16547 if (!AV._config.disableCurrentUser && AV.User.current()) {
16548 AV.User.current()._synchronizeAuthData(provider.getAuthType());
16549 }
16550 },
16551
16552 _logInWith: function _logInWith(provider, authData, options) {
16553 var user = AV.Object._create('_User');
16554 return user._linkWith(provider, authData, options);
16555 }
16556 });
16557};
16558
16559/***/ }),
16560/* 323 */
16561/***/ (function(module, exports, __webpack_require__) {
16562
16563"use strict";
16564
16565
16566exports.__esModule = true;
16567
16568var _defineProperty = __webpack_require__(86);
16569
16570var _defineProperty2 = _interopRequireDefault(_defineProperty);
16571
16572function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16573
16574exports.default = function (obj, key, value) {
16575 if (key in obj) {
16576 (0, _defineProperty2.default)(obj, key, {
16577 value: value,
16578 enumerable: true,
16579 configurable: true,
16580 writable: true
16581 });
16582 } else {
16583 obj[key] = value;
16584 }
16585
16586 return obj;
16587};
16588
16589/***/ }),
16590/* 324 */
16591/***/ (function(module, exports, __webpack_require__) {
16592
16593"use strict";
16594
16595
16596var _stringify = __webpack_require__(18);
16597
16598var _stringify2 = _interopRequireDefault(_stringify);
16599
16600var _promise = __webpack_require__(4);
16601
16602var _promise2 = _interopRequireDefault(_promise);
16603
16604function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16605
16606var _ = __webpack_require__(0);
16607var debug = __webpack_require__(35)('leancloud:query');
16608var AVError = __webpack_require__(23);
16609
16610var _require = __webpack_require__(12),
16611 _request = _require._request,
16612 request = _require.request;
16613
16614var _require2 = __webpack_require__(15),
16615 ensureArray = _require2.ensureArray,
16616 transformFetchOptions = _require2.transformFetchOptions,
16617 continueWhile = _require2.continueWhile;
16618
16619var requires = function requires(value, message) {
16620 if (value === undefined) {
16621 throw new Error(message);
16622 }
16623};
16624
16625// AV.Query is a way to create a list of AV.Objects.
16626module.exports = function (AV) {
16627 /**
16628 * Creates a new AV.Query for the given AV.Object subclass.
16629 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
16630 * @class
16631 *
16632 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
16633 * most common use case is finding all objects that match a query through the
16634 * <code>find</code> method. For example, this sample code fetches all objects
16635 * of class <code>MyClass</code>. It calls a different function depending on
16636 * whether the fetch succeeded or not.
16637 *
16638 * <pre>
16639 * var query = new AV.Query(MyClass);
16640 * query.find().then(function(results) {
16641 * // results is an array of AV.Object.
16642 * }, function(error) {
16643 * // error is an instance of AVError.
16644 * });</pre></p>
16645 *
16646 * <p>An AV.Query can also be used to retrieve a single object whose id is
16647 * known, through the get method. For example, this sample code fetches an
16648 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
16649 * different function depending on whether the fetch succeeded or not.
16650 *
16651 * <pre>
16652 * var query = new AV.Query(MyClass);
16653 * query.get(myId).then(function(object) {
16654 * // object is an instance of AV.Object.
16655 * }, function(error) {
16656 * // error is an instance of AVError.
16657 * });</pre></p>
16658 *
16659 * <p>An AV.Query can also be used to count the number of objects that match
16660 * the query without retrieving all of those objects. For example, this
16661 * sample code counts the number of objects of the class <code>MyClass</code>
16662 * <pre>
16663 * var query = new AV.Query(MyClass);
16664 * query.count().then(function(number) {
16665 * // There are number instances of MyClass.
16666 * }, function(error) {
16667 * // error is an instance of AVError.
16668 * });</pre></p>
16669 */
16670 AV.Query = function (objectClass) {
16671 if (_.isString(objectClass)) {
16672 objectClass = AV.Object._getSubclass(objectClass);
16673 }
16674
16675 this.objectClass = objectClass;
16676
16677 this.className = objectClass.prototype.className;
16678
16679 this._where = {};
16680 this._include = [];
16681 this._select = [];
16682 this._limit = -1; // negative limit means, do not send a limit
16683 this._skip = 0;
16684 this._defaultParams = {};
16685 };
16686
16687 /**
16688 * Constructs a AV.Query that is the OR of the passed in queries. For
16689 * example:
16690 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
16691 *
16692 * will create a compoundQuery that is an or of the query1, query2, and
16693 * query3.
16694 * @param {...AV.Query} var_args The list of queries to OR.
16695 * @return {AV.Query} The query that is the OR of the passed in queries.
16696 */
16697 AV.Query.or = function () {
16698 var queries = _.toArray(arguments);
16699 var className = null;
16700 AV._arrayEach(queries, function (q) {
16701 if (_.isNull(className)) {
16702 className = q.className;
16703 }
16704
16705 if (className !== q.className) {
16706 throw new Error('All queries must be for the same class');
16707 }
16708 });
16709 var query = new AV.Query(className);
16710 query._orQuery(queries);
16711 return query;
16712 };
16713
16714 /**
16715 * Constructs a AV.Query that is the AND of the passed in queries. For
16716 * example:
16717 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
16718 *
16719 * will create a compoundQuery that is an 'and' of the query1, query2, and
16720 * query3.
16721 * @param {...AV.Query} var_args The list of queries to AND.
16722 * @return {AV.Query} The query that is the AND of the passed in queries.
16723 */
16724 AV.Query.and = function () {
16725 var queries = _.toArray(arguments);
16726 var className = null;
16727 AV._arrayEach(queries, function (q) {
16728 if (_.isNull(className)) {
16729 className = q.className;
16730 }
16731
16732 if (className !== q.className) {
16733 throw new Error('All queries must be for the same class');
16734 }
16735 });
16736 var query = new AV.Query(className);
16737 query._andQuery(queries);
16738 return query;
16739 };
16740
16741 /**
16742 * Retrieves a list of AVObjects that satisfy the CQL.
16743 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
16744 *
16745 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
16746 * @param {Array} pvalues An array contains placeholder values.
16747 * @param {AuthOptions} options
16748 * @return {Promise} A promise that is resolved with the results when
16749 * the query completes.
16750 */
16751 AV.Query.doCloudQuery = function (cql, pvalues, options) {
16752 var params = { cql: cql };
16753 if (_.isArray(pvalues)) {
16754 params.pvalues = pvalues;
16755 } else {
16756 options = pvalues;
16757 }
16758
16759 var request = _request('cloudQuery', null, null, 'GET', params, options);
16760 return request.then(function (response) {
16761 //query to process results.
16762 var query = new AV.Query(response.className);
16763 var results = _.map(response.results, function (json) {
16764 var obj = query._newObject(response);
16765 if (obj._finishFetch) {
16766 obj._finishFetch(query._processResult(json), true);
16767 }
16768 return obj;
16769 });
16770 return {
16771 results: results,
16772 count: response.count,
16773 className: response.className
16774 };
16775 });
16776 };
16777
16778 /**
16779 * Return a query with conditions from json.
16780 * This can be useful to send a query from server side to client side.
16781 * @since 4.0.0
16782 * @param {Object} json from {@link AV.Query#toJSON}
16783 * @return {AV.Query}
16784 */
16785 AV.Query.fromJSON = function (_ref) {
16786 var className = _ref.className,
16787 where = _ref.where,
16788 include = _ref.include,
16789 select = _ref.select,
16790 includeACL = _ref.includeACL,
16791 limit = _ref.limit,
16792 skip = _ref.skip,
16793 order = _ref.order;
16794
16795 if (typeof className !== 'string') {
16796 throw new TypeError('Invalid Query JSON, className must be a String.');
16797 }
16798 var query = new AV.Query(className);
16799 _.extend(query, {
16800 _where: where,
16801 _include: include,
16802 _select: select,
16803 _includeACL: includeACL,
16804 _limit: limit,
16805 _skip: skip,
16806 _order: order
16807 });
16808 return query;
16809 };
16810
16811 AV.Query._extend = AV._extend;
16812
16813 _.extend(AV.Query.prototype,
16814 /** @lends AV.Query.prototype */{
16815 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
16816 _processResult: function _processResult(obj) {
16817 return obj;
16818 },
16819
16820 /**
16821 * Constructs an AV.Object whose id is already known by fetching data from
16822 * the server.
16823 *
16824 * @param {String} objectId The id of the object to be fetched.
16825 * @param {AuthOptions} options
16826 * @return {Promise.<AV.Object>}
16827 */
16828 get: function get(objectId, options) {
16829 if (!_.isString(objectId)) {
16830 throw new Error('objectId must be a string');
16831 }
16832 if (objectId === '') {
16833 return _promise2.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
16834 }
16835
16836 var obj = this._newObject();
16837 obj.id = objectId;
16838
16839 var queryJSON = this._getParams();
16840 var fetchOptions = {};
16841
16842 if (queryJSON.keys) fetchOptions.keys = queryJSON.keys;
16843 if (queryJSON.include) fetchOptions.include = queryJSON.include;
16844 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
16845
16846 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
16847 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
16848 obj._finishFetch(obj.parse(response), true);
16849 return obj;
16850 });
16851 },
16852
16853 /**
16854 * Returns a JSON representation of this query.
16855 * @return {Object}
16856 */
16857 toJSON: function toJSON() {
16858 var className = this.className,
16859 where = this._where,
16860 include = this._include,
16861 select = this._select,
16862 includeACL = this._includeACL,
16863 limit = this._limit,
16864 skip = this._skip,
16865 order = this._order;
16866
16867 return {
16868 className: className,
16869 where: where,
16870 include: include,
16871 select: select,
16872 includeACL: includeACL,
16873 limit: limit,
16874 skip: skip,
16875 order: order
16876 };
16877 },
16878
16879
16880 _getParams: function _getParams() {
16881 var params = _.extend({}, this._defaultParams, {
16882 where: this._where
16883 });
16884
16885 if (this._include.length > 0) {
16886 params.include = this._include.join(',');
16887 }
16888 if (this._select.length > 0) {
16889 params.keys = this._select.join(',');
16890 }
16891 if (this._includeACL !== undefined) {
16892 params.returnACL = this._includeACL;
16893 }
16894 if (this._limit >= 0) {
16895 params.limit = this._limit;
16896 }
16897 if (this._skip > 0) {
16898 params.skip = this._skip;
16899 }
16900 if (this._order !== undefined) {
16901 params.order = this._order;
16902 }
16903
16904 return params;
16905 },
16906
16907 _newObject: function _newObject(response) {
16908 var obj;
16909 if (response && response.className) {
16910 obj = new AV.Object(response.className);
16911 } else {
16912 obj = new this.objectClass();
16913 }
16914 return obj;
16915 },
16916 _createRequest: function _createRequest() {
16917 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
16918 var options = arguments[1];
16919 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '/classes/' + this.className;
16920
16921 if (encodeURIComponent((0, _stringify2.default)(params)).length > 2000) {
16922 var body = {
16923 requests: [{
16924 method: 'GET',
16925 path: '/1.1' + path,
16926 params: params
16927 }]
16928 };
16929 return request({
16930 path: '/batch',
16931 method: 'POST',
16932 data: body,
16933 authOptions: options
16934 }).then(function (response) {
16935 var result = response[0];
16936 if (result.success) {
16937 return result.success;
16938 }
16939 var error = new AVError(result.error.code, result.error.error || 'Unknown batch error');
16940 throw error;
16941 });
16942 }
16943 return request({
16944 method: 'GET',
16945 path: path,
16946 query: params,
16947 authOptions: options
16948 });
16949 },
16950 _parseResponse: function _parseResponse(response) {
16951 var _this = this;
16952
16953 return _.map(response.results, function (json) {
16954 var obj = _this._newObject(response);
16955 if (obj._finishFetch) {
16956 obj._finishFetch(_this._processResult(json), true);
16957 }
16958 return obj;
16959 });
16960 },
16961
16962
16963 /**
16964 * Retrieves a list of AVObjects that satisfy this query.
16965 *
16966 * @param {AuthOptions} options
16967 * @return {Promise} A promise that is resolved with the results when
16968 * the query completes.
16969 */
16970 find: function find(options) {
16971 var request = this._createRequest(undefined, options);
16972 return request.then(this._parseResponse.bind(this));
16973 },
16974
16975
16976 /**
16977 * Retrieves both AVObjects and total count.
16978 *
16979 * @since 4.12.0
16980 * @param {AuthOptions} options
16981 * @return {Promise} A tuple contains results and count.
16982 */
16983 findAndCount: function findAndCount(options) {
16984 var _this2 = this;
16985
16986 var params = this._getParams();
16987 params.count = 1;
16988 var request = this._createRequest(params, options);
16989
16990 return request.then(function (response) {
16991 return [_this2._parseResponse(response), response.count];
16992 });
16993 },
16994
16995
16996 /**
16997 * scan a Query. masterKey required.
16998 *
16999 * @since 2.1.0
17000 * @param {object} [options]
17001 * @param {string} [options.orderedBy] specify the key to sort
17002 * @param {number} [options.batchSize] specify the batch size for each request
17003 * @param {AuthOptions} [authOptions]
17004 * @return {AsyncIterator.<AV.Object>}
17005 * @example const testIterator = {
17006 * [Symbol.asyncIterator]() {
17007 * return new Query('Test').scan(undefined, { useMasterKey: true });
17008 * },
17009 * };
17010 * for await (const test of testIterator) {
17011 * console.log(test.id);
17012 * }
17013 */
17014 scan: function scan() {
17015 var _this3 = this;
17016
17017 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
17018 orderedBy = _ref2.orderedBy,
17019 batchSize = _ref2.batchSize;
17020
17021 var authOptions = arguments[1];
17022
17023 var condition = this._getParams();
17024 debug('scan %O', condition);
17025 if (condition.order) {
17026 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
17027 delete condition.order;
17028 }
17029 if (condition.skip) {
17030 console.warn('The skip option of the query is ignored for Query#scan.');
17031 delete condition.skip;
17032 }
17033 if (condition.limit) {
17034 console.warn('The limit option of the query is ignored for Query#scan.');
17035 delete condition.limit;
17036 }
17037 if (orderedBy) condition.scan_key = orderedBy;
17038 if (batchSize) condition.limit = batchSize;
17039 var promise = _promise2.default.resolve([]);
17040 var cursor = void 0;
17041 var endReached = false;
17042 return {
17043 next: function next() {
17044 promise = promise.then(function (remainResults) {
17045 if (endReached) return [];
17046 if (remainResults.length > 1) return remainResults;
17047 // no cursor means we have reached the end
17048 // except for the first time
17049 if (!cursor && remainResults.length !== 0) {
17050 endReached = true;
17051 return remainResults;
17052 }
17053 // when only 1 item left in queue
17054 // start the next request to see if it is the last one
17055 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, { cursor: cursor }) : condition, authOptions).then(function (response) {
17056 cursor = response.cursor;
17057 return _this3._parseResponse(response);
17058 }).then(function (results) {
17059 if (!results.length) endReached = true;
17060 return remainResults.concat(results);
17061 });
17062 });
17063 return promise.then(function (remainResults) {
17064 return remainResults.shift();
17065 }).then(function (result) {
17066 return {
17067 value: result,
17068 done: result === undefined
17069 };
17070 });
17071 }
17072 };
17073 },
17074
17075
17076 /**
17077 * Delete objects retrieved by this query.
17078 * @param {AuthOptions} options
17079 * @return {Promise} A promise that is fulfilled when the save
17080 * completes.
17081 */
17082 destroyAll: function destroyAll(options) {
17083 var self = this;
17084 return self.find(options).then(function (objects) {
17085 return AV.Object.destroyAll(objects, options);
17086 });
17087 },
17088
17089 /**
17090 * Counts the number of objects that match this query.
17091 *
17092 * @param {AuthOptions} options
17093 * @return {Promise} A promise that is resolved with the count when
17094 * the query completes.
17095 */
17096 count: function count(options) {
17097 var params = this._getParams();
17098 params.limit = 0;
17099 params.count = 1;
17100 var request = this._createRequest(params, options);
17101
17102 return request.then(function (response) {
17103 return response.count;
17104 });
17105 },
17106
17107 /**
17108 * Retrieves at most one AV.Object that satisfies this query.
17109 *
17110 * @param {AuthOptions} options
17111 * @return {Promise} A promise that is resolved with the object when
17112 * the query completes.
17113 */
17114 first: function first(options) {
17115 var self = this;
17116
17117 var params = this._getParams();
17118 params.limit = 1;
17119 var request = this._createRequest(params, options);
17120
17121 return request.then(function (response) {
17122 return _.map(response.results, function (json) {
17123 var obj = self._newObject();
17124 if (obj._finishFetch) {
17125 obj._finishFetch(self._processResult(json), true);
17126 }
17127 return obj;
17128 })[0];
17129 });
17130 },
17131
17132 /**
17133 * Sets the number of results to skip before returning any results.
17134 * This is useful for pagination.
17135 * Default is to skip zero results.
17136 * @param {Number} n the number of results to skip.
17137 * @return {AV.Query} Returns the query, so you can chain this call.
17138 */
17139 skip: function skip(n) {
17140 requires(n, 'undefined is not a valid skip value');
17141 this._skip = n;
17142 return this;
17143 },
17144
17145 /**
17146 * Sets the limit of the number of results to return. The default limit is
17147 * 100, with a maximum of 1000 results being returned at a time.
17148 * @param {Number} n the number of results to limit to.
17149 * @return {AV.Query} Returns the query, so you can chain this call.
17150 */
17151 limit: function limit(n) {
17152 requires(n, 'undefined is not a valid limit value');
17153 this._limit = n;
17154 return this;
17155 },
17156
17157 /**
17158 * Add a constraint to the query that requires a particular key's value to
17159 * be equal to the provided value.
17160 * @param {String} key The key to check.
17161 * @param value The value that the AV.Object must contain.
17162 * @return {AV.Query} Returns the query, so you can chain this call.
17163 */
17164 equalTo: function equalTo(key, value) {
17165 requires(key, 'undefined is not a valid key');
17166 requires(value, 'undefined is not a valid value');
17167 this._where[key] = AV._encode(value);
17168 return this;
17169 },
17170
17171 /**
17172 * Helper for condition queries
17173 * @private
17174 */
17175 _addCondition: function _addCondition(key, condition, value) {
17176 requires(key, 'undefined is not a valid condition key');
17177 requires(condition, 'undefined is not a valid condition');
17178 requires(value, 'undefined is not a valid condition value');
17179
17180 // Check if we already have a condition
17181 if (!this._where[key]) {
17182 this._where[key] = {};
17183 }
17184 this._where[key][condition] = AV._encode(value);
17185 return this;
17186 },
17187
17188 /**
17189 * Add a constraint to the query that requires a particular
17190 * <strong>array</strong> key's length to be equal to the provided value.
17191 * @param {String} key The array key to check.
17192 * @param {number} value The length value.
17193 * @return {AV.Query} Returns the query, so you can chain this call.
17194 */
17195 sizeEqualTo: function sizeEqualTo(key, value) {
17196 this._addCondition(key, '$size', value);
17197 return this;
17198 },
17199
17200 /**
17201 * Add a constraint to the query that requires a particular key's value to
17202 * be not equal to the provided value.
17203 * @param {String} key The key to check.
17204 * @param value The value that must not be equalled.
17205 * @return {AV.Query} Returns the query, so you can chain this call.
17206 */
17207 notEqualTo: function notEqualTo(key, value) {
17208 this._addCondition(key, '$ne', value);
17209 return this;
17210 },
17211
17212 /**
17213 * Add a constraint to the query that requires a particular key's value to
17214 * be less than the provided value.
17215 * @param {String} key The key to check.
17216 * @param value The value that provides an upper bound.
17217 * @return {AV.Query} Returns the query, so you can chain this call.
17218 */
17219 lessThan: function lessThan(key, value) {
17220 this._addCondition(key, '$lt', value);
17221 return this;
17222 },
17223
17224 /**
17225 * Add a constraint to the query that requires a particular key's value to
17226 * be greater than the provided value.
17227 * @param {String} key The key to check.
17228 * @param value The value that provides an lower bound.
17229 * @return {AV.Query} Returns the query, so you can chain this call.
17230 */
17231 greaterThan: function greaterThan(key, value) {
17232 this._addCondition(key, '$gt', value);
17233 return this;
17234 },
17235
17236 /**
17237 * Add a constraint to the query that requires a particular key's value to
17238 * be less than or equal to the provided value.
17239 * @param {String} key The key to check.
17240 * @param value The value that provides an upper bound.
17241 * @return {AV.Query} Returns the query, so you can chain this call.
17242 */
17243 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
17244 this._addCondition(key, '$lte', value);
17245 return this;
17246 },
17247
17248 /**
17249 * Add a constraint to the query that requires a particular key's value to
17250 * be greater than or equal to the provided value.
17251 * @param {String} key The key to check.
17252 * @param value The value that provides an lower bound.
17253 * @return {AV.Query} Returns the query, so you can chain this call.
17254 */
17255 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
17256 this._addCondition(key, '$gte', value);
17257 return this;
17258 },
17259
17260 /**
17261 * Add a constraint to the query that requires a particular key's value to
17262 * be contained in the provided list of values.
17263 * @param {String} key The key to check.
17264 * @param {Array} values The values that will match.
17265 * @return {AV.Query} Returns the query, so you can chain this call.
17266 */
17267 containedIn: function containedIn(key, values) {
17268 this._addCondition(key, '$in', values);
17269 return this;
17270 },
17271
17272 /**
17273 * Add a constraint to the query that requires a particular key's value to
17274 * not be contained in the provided list of values.
17275 * @param {String} key The key to check.
17276 * @param {Array} values The values that will not match.
17277 * @return {AV.Query} Returns the query, so you can chain this call.
17278 */
17279 notContainedIn: function notContainedIn(key, values) {
17280 this._addCondition(key, '$nin', values);
17281 return this;
17282 },
17283
17284 /**
17285 * Add a constraint to the query that requires a particular key's value to
17286 * contain each one of the provided list of values.
17287 * @param {String} key The key to check. This key's value must be an array.
17288 * @param {Array} values The values that will match.
17289 * @return {AV.Query} Returns the query, so you can chain this call.
17290 */
17291 containsAll: function containsAll(key, values) {
17292 this._addCondition(key, '$all', values);
17293 return this;
17294 },
17295
17296 /**
17297 * Add a constraint for finding objects that contain the given key.
17298 * @param {String} key The key that should exist.
17299 * @return {AV.Query} Returns the query, so you can chain this call.
17300 */
17301 exists: function exists(key) {
17302 this._addCondition(key, '$exists', true);
17303 return this;
17304 },
17305
17306 /**
17307 * Add a constraint for finding objects that do not contain a given key.
17308 * @param {String} key The key that should not exist
17309 * @return {AV.Query} Returns the query, so you can chain this call.
17310 */
17311 doesNotExist: function doesNotExist(key) {
17312 this._addCondition(key, '$exists', false);
17313 return this;
17314 },
17315
17316 /**
17317 * Add a regular expression constraint for finding string values that match
17318 * the provided regular expression.
17319 * This may be slow for large datasets.
17320 * @param {String} key The key that the string to match is stored in.
17321 * @param {RegExp} regex The regular expression pattern to match.
17322 * @return {AV.Query} Returns the query, so you can chain this call.
17323 */
17324 matches: function matches(key, regex, modifiers) {
17325 this._addCondition(key, '$regex', regex);
17326 if (!modifiers) {
17327 modifiers = '';
17328 }
17329 // Javascript regex options support mig as inline options but store them
17330 // as properties of the object. We support mi & should migrate them to
17331 // modifiers
17332 if (regex.ignoreCase) {
17333 modifiers += 'i';
17334 }
17335 if (regex.multiline) {
17336 modifiers += 'm';
17337 }
17338
17339 if (modifiers && modifiers.length) {
17340 this._addCondition(key, '$options', modifiers);
17341 }
17342 return this;
17343 },
17344
17345 /**
17346 * Add a constraint that requires that a key's value matches a AV.Query
17347 * constraint.
17348 * @param {String} key The key that the contains the object to match the
17349 * query.
17350 * @param {AV.Query} query The query that should match.
17351 * @return {AV.Query} Returns the query, so you can chain this call.
17352 */
17353 matchesQuery: function matchesQuery(key, query) {
17354 var queryJSON = query._getParams();
17355 queryJSON.className = query.className;
17356 this._addCondition(key, '$inQuery', queryJSON);
17357 return this;
17358 },
17359
17360 /**
17361 * Add a constraint that requires that a key's value not matches a
17362 * AV.Query constraint.
17363 * @param {String} key The key that the contains the object to match the
17364 * query.
17365 * @param {AV.Query} query The query that should not match.
17366 * @return {AV.Query} Returns the query, so you can chain this call.
17367 */
17368 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
17369 var queryJSON = query._getParams();
17370 queryJSON.className = query.className;
17371 this._addCondition(key, '$notInQuery', queryJSON);
17372 return this;
17373 },
17374
17375 /**
17376 * Add a constraint that requires that a key's value matches a value in
17377 * an object returned by a different AV.Query.
17378 * @param {String} key The key that contains the value that is being
17379 * matched.
17380 * @param {String} queryKey The key in the objects returned by the query to
17381 * match against.
17382 * @param {AV.Query} query The query to run.
17383 * @return {AV.Query} Returns the query, so you can chain this call.
17384 */
17385 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
17386 var queryJSON = query._getParams();
17387 queryJSON.className = query.className;
17388 this._addCondition(key, '$select', { key: queryKey, query: queryJSON });
17389 return this;
17390 },
17391
17392 /**
17393 * Add a constraint that requires that a key's value not match a value in
17394 * an object returned by a different AV.Query.
17395 * @param {String} key The key that contains the value that is being
17396 * excluded.
17397 * @param {String} queryKey The key in the objects returned by the query to
17398 * match against.
17399 * @param {AV.Query} query The query to run.
17400 * @return {AV.Query} Returns the query, so you can chain this call.
17401 */
17402 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
17403 var queryJSON = query._getParams();
17404 queryJSON.className = query.className;
17405 this._addCondition(key, '$dontSelect', {
17406 key: queryKey,
17407 query: queryJSON
17408 });
17409 return this;
17410 },
17411
17412 /**
17413 * Add constraint that at least one of the passed in queries matches.
17414 * @param {Array} queries
17415 * @return {AV.Query} Returns the query, so you can chain this call.
17416 * @private
17417 */
17418 _orQuery: function _orQuery(queries) {
17419 var queryJSON = _.map(queries, function (q) {
17420 return q._getParams().where;
17421 });
17422
17423 this._where.$or = queryJSON;
17424 return this;
17425 },
17426
17427 /**
17428 * Add constraint that both of the passed in queries matches.
17429 * @param {Array} queries
17430 * @return {AV.Query} Returns the query, so you can chain this call.
17431 * @private
17432 */
17433 _andQuery: function _andQuery(queries) {
17434 var queryJSON = _.map(queries, function (q) {
17435 return q._getParams().where;
17436 });
17437
17438 this._where.$and = queryJSON;
17439 return this;
17440 },
17441
17442 /**
17443 * Converts a string into a regex that matches it.
17444 * Surrounding with \Q .. \E does this, we just need to escape \E's in
17445 * the text separately.
17446 * @private
17447 */
17448 _quote: function _quote(s) {
17449 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
17450 },
17451
17452 /**
17453 * Add a constraint for finding string values that contain a provided
17454 * string. This may be slow for large datasets.
17455 * @param {String} key The key that the string to match is stored in.
17456 * @param {String} substring The substring that the value must contain.
17457 * @return {AV.Query} Returns the query, so you can chain this call.
17458 */
17459 contains: function contains(key, value) {
17460 this._addCondition(key, '$regex', this._quote(value));
17461 return this;
17462 },
17463
17464 /**
17465 * Add a constraint for finding string values that start with a provided
17466 * string. This query will use the backend index, so it will be fast even
17467 * for large datasets.
17468 * @param {String} key The key that the string to match is stored in.
17469 * @param {String} prefix The substring that the value must start with.
17470 * @return {AV.Query} Returns the query, so you can chain this call.
17471 */
17472 startsWith: function startsWith(key, value) {
17473 this._addCondition(key, '$regex', '^' + this._quote(value));
17474 return this;
17475 },
17476
17477 /**
17478 * Add a constraint for finding string values that end with a provided
17479 * string. This will be slow for large datasets.
17480 * @param {String} key The key that the string to match is stored in.
17481 * @param {String} suffix The substring that the value must end with.
17482 * @return {AV.Query} Returns the query, so you can chain this call.
17483 */
17484 endsWith: function endsWith(key, value) {
17485 this._addCondition(key, '$regex', this._quote(value) + '$');
17486 return this;
17487 },
17488
17489 /**
17490 * Sorts the results in ascending order by the given key.
17491 *
17492 * @param {String} key The key to order by.
17493 * @return {AV.Query} Returns the query, so you can chain this call.
17494 */
17495 ascending: function ascending(key) {
17496 requires(key, 'undefined is not a valid key');
17497 this._order = key;
17498 return this;
17499 },
17500
17501 /**
17502 * Also sorts the results in ascending order by the given key. The previous sort keys have
17503 * precedence over this key.
17504 *
17505 * @param {String} key The key to order by
17506 * @return {AV.Query} Returns the query so you can chain this call.
17507 */
17508 addAscending: function addAscending(key) {
17509 requires(key, 'undefined is not a valid key');
17510 if (this._order) this._order += ',' + key;else this._order = key;
17511 return this;
17512 },
17513
17514 /**
17515 * Sorts the results in descending order by the given key.
17516 *
17517 * @param {String} key The key to order by.
17518 * @return {AV.Query} Returns the query, so you can chain this call.
17519 */
17520 descending: function descending(key) {
17521 requires(key, 'undefined is not a valid key');
17522 this._order = '-' + key;
17523 return this;
17524 },
17525
17526 /**
17527 * Also sorts the results in descending order by the given key. The previous sort keys have
17528 * precedence over this key.
17529 *
17530 * @param {String} key The key to order by
17531 * @return {AV.Query} Returns the query so you can chain this call.
17532 */
17533 addDescending: function addDescending(key) {
17534 requires(key, 'undefined is not a valid key');
17535 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
17536 return this;
17537 },
17538
17539 /**
17540 * Add a proximity based constraint for finding objects with key point
17541 * values near the point given.
17542 * @param {String} key The key that the AV.GeoPoint is stored in.
17543 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17544 * @return {AV.Query} Returns the query, so you can chain this call.
17545 */
17546 near: function near(key, point) {
17547 if (!(point instanceof AV.GeoPoint)) {
17548 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
17549 point = new AV.GeoPoint(point);
17550 }
17551 this._addCondition(key, '$nearSphere', point);
17552 return this;
17553 },
17554
17555 /**
17556 * Add a proximity based constraint for finding objects with key point
17557 * values near the point given and within the maximum distance given.
17558 * @param {String} key The key that the AV.GeoPoint is stored in.
17559 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17560 * @param maxDistance Maximum distance (in radians) of results to return.
17561 * @return {AV.Query} Returns the query, so you can chain this call.
17562 */
17563 withinRadians: function withinRadians(key, point, distance) {
17564 this.near(key, point);
17565 this._addCondition(key, '$maxDistance', distance);
17566 return this;
17567 },
17568
17569 /**
17570 * Add a proximity based constraint for finding objects with key point
17571 * values near the point given and within the maximum distance given.
17572 * Radius of earth used is 3958.8 miles.
17573 * @param {String} key The key that the AV.GeoPoint is stored in.
17574 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17575 * @param {Number} maxDistance Maximum distance (in miles) of results to
17576 * return.
17577 * @return {AV.Query} Returns the query, so you can chain this call.
17578 */
17579 withinMiles: function withinMiles(key, point, distance) {
17580 return this.withinRadians(key, point, distance / 3958.8);
17581 },
17582
17583 /**
17584 * Add a proximity based constraint for finding objects with key point
17585 * values near the point given and within the maximum distance given.
17586 * Radius of earth used is 6371.0 kilometers.
17587 * @param {String} key The key that the AV.GeoPoint is stored in.
17588 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17589 * @param {Number} maxDistance Maximum distance (in kilometers) of results
17590 * to return.
17591 * @return {AV.Query} Returns the query, so you can chain this call.
17592 */
17593 withinKilometers: function withinKilometers(key, point, distance) {
17594 return this.withinRadians(key, point, distance / 6371.0);
17595 },
17596
17597 /**
17598 * Add a constraint to the query that requires a particular key's
17599 * coordinates be contained within a given rectangular geographic bounding
17600 * box.
17601 * @param {String} key The key to be constrained.
17602 * @param {AV.GeoPoint} southwest
17603 * The lower-left inclusive corner of the box.
17604 * @param {AV.GeoPoint} northeast
17605 * The upper-right inclusive corner of the box.
17606 * @return {AV.Query} Returns the query, so you can chain this call.
17607 */
17608 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
17609 if (!(southwest instanceof AV.GeoPoint)) {
17610 southwest = new AV.GeoPoint(southwest);
17611 }
17612 if (!(northeast instanceof AV.GeoPoint)) {
17613 northeast = new AV.GeoPoint(northeast);
17614 }
17615 this._addCondition(key, '$within', { $box: [southwest, northeast] });
17616 return this;
17617 },
17618
17619 /**
17620 * Include nested AV.Objects for the provided key. You can use dot
17621 * notation to specify which fields in the included object are also fetch.
17622 * @param {String[]} keys The name of the key to include.
17623 * @return {AV.Query} Returns the query, so you can chain this call.
17624 */
17625 include: function include(keys) {
17626 var _this4 = this;
17627
17628 requires(keys, 'undefined is not a valid key');
17629 _.forEach(arguments, function (keys) {
17630 _this4._include = _this4._include.concat(ensureArray(keys));
17631 });
17632 return this;
17633 },
17634
17635 /**
17636 * Include the ACL.
17637 * @param {Boolean} [value=true] Whether to include the ACL
17638 * @return {AV.Query} Returns the query, so you can chain this call.
17639 */
17640 includeACL: function includeACL() {
17641 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
17642
17643 this._includeACL = value;
17644 return this;
17645 },
17646
17647 /**
17648 * Restrict the fields of the returned AV.Objects to include only the
17649 * provided keys. If this is called multiple times, then all of the keys
17650 * specified in each of the calls will be included.
17651 * @param {String[]} keys The names of the keys to include.
17652 * @return {AV.Query} Returns the query, so you can chain this call.
17653 */
17654 select: function select(keys) {
17655 var _this5 = this;
17656
17657 requires(keys, 'undefined is not a valid key');
17658 _.forEach(arguments, function (keys) {
17659 _this5._select = _this5._select.concat(ensureArray(keys));
17660 });
17661 return this;
17662 },
17663
17664 /**
17665 * Iterates over each result of a query, calling a callback for each one. If
17666 * the callback returns a promise, the iteration will not continue until
17667 * that promise has been fulfilled. If the callback returns a rejected
17668 * promise, then iteration will stop with that error. The items are
17669 * processed in an unspecified order. The query may not have any sort order,
17670 * and may not use limit or skip.
17671 * @param callback {Function} Callback that will be called with each result
17672 * of the query.
17673 * @return {Promise} A promise that will be fulfilled once the
17674 * iteration has completed.
17675 */
17676 each: function each(callback) {
17677 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17678
17679 if (this._order || this._skip || this._limit >= 0) {
17680 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
17681 return _promise2.default.reject(error);
17682 }
17683
17684 var query = new AV.Query(this.objectClass);
17685 // We can override the batch size from the options.
17686 // This is undocumented, but useful for testing.
17687 query._limit = options.batchSize || 100;
17688 query._where = _.clone(this._where);
17689 query._include = _.clone(this._include);
17690
17691 query.ascending('objectId');
17692
17693 var finished = false;
17694 return continueWhile(function () {
17695 return !finished;
17696 }, function () {
17697 return query.find(options).then(function (results) {
17698 var callbacksDone = _promise2.default.resolve();
17699 _.each(results, function (result) {
17700 callbacksDone = callbacksDone.then(function () {
17701 return callback(result);
17702 });
17703 });
17704
17705 return callbacksDone.then(function () {
17706 if (results.length >= query._limit) {
17707 query.greaterThan('objectId', results[results.length - 1].id);
17708 } else {
17709 finished = true;
17710 }
17711 });
17712 });
17713 });
17714 },
17715
17716 /**
17717 * Subscribe the changes of this query.
17718 *
17719 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
17720 *
17721 * @since 3.0.0
17722 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
17723 */
17724 subscribe: function subscribe(options) {
17725 return AV.LiveQuery.init(this, options);
17726 }
17727 });
17728
17729 AV.FriendShipQuery = AV.Query._extend({
17730 _newObject: function _newObject() {
17731 var UserClass = AV.Object._getSubclass('_User');
17732 return new UserClass();
17733 },
17734 _processResult: function _processResult(json) {
17735 if (json && json[this._friendshipTag]) {
17736 var user = json[this._friendshipTag];
17737 if (user.__type === 'Pointer' && user.className === '_User') {
17738 delete user.__type;
17739 delete user.className;
17740 }
17741 return user;
17742 } else {
17743 return null;
17744 }
17745 }
17746 });
17747};
17748
17749/***/ }),
17750/* 325 */
17751/***/ (function(module, exports, __webpack_require__) {
17752
17753"use strict";
17754
17755
17756var _promise = __webpack_require__(4);
17757
17758var _promise2 = _interopRequireDefault(_promise);
17759
17760function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17761
17762var _ = __webpack_require__(0);
17763var EventEmitter = __webpack_require__(157);
17764
17765var _require = __webpack_require__(15),
17766 inherits = _require.inherits;
17767
17768var _require2 = __webpack_require__(12),
17769 request = _require2.request;
17770
17771var subscribe = function subscribe(queryJSON, subscriptionId) {
17772 return request({
17773 method: 'POST',
17774 path: '/LiveQuery/subscribe',
17775 data: {
17776 query: queryJSON,
17777 id: subscriptionId
17778 }
17779 });
17780};
17781
17782module.exports = function (AV) {
17783 var requireRealtime = function requireRealtime() {
17784 if (!AV._config.realtime) {
17785 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
17786 }
17787 };
17788 /**
17789 * @class
17790 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
17791 * @since 3.0.0
17792 */
17793 AV.LiveQuery = inherits(EventEmitter,
17794 /** @lends AV.LiveQuery.prototype */{
17795 constructor: function constructor(id, client, queryJSON, subscriptionId) {
17796 var _this = this;
17797
17798 EventEmitter.apply(this);
17799 this.id = id;
17800 this._client = client;
17801 this._client.register(this);
17802 this._queryJSON = queryJSON;
17803 this._subscriptionId = subscriptionId;
17804 this._onMessage = this._dispatch.bind(this);
17805 this._onReconnect = function () {
17806 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
17807 return console.error('LiveQuery resubscribe error: ' + error.message);
17808 });
17809 };
17810 client.on('message', this._onMessage);
17811 client.on('reconnect', this._onReconnect);
17812 },
17813 _dispatch: function _dispatch(message) {
17814 var _this2 = this;
17815
17816 message.forEach(function (_ref) {
17817 var op = _ref.op,
17818 object = _ref.object,
17819 queryId = _ref.query_id,
17820 updatedKeys = _ref.updatedKeys;
17821
17822 if (queryId !== _this2.id) return;
17823 var target = AV.parseJSON(_.extend({
17824 __type: object.className === '_File' ? 'File' : 'Object'
17825 }, object));
17826 if (updatedKeys) {
17827 /**
17828 * An existing AV.Object which fulfills the Query you subscribe is updated.
17829 * @event AV.LiveQuery#update
17830 * @param {AV.Object|AV.File} target updated object
17831 * @param {String[]} updatedKeys updated keys
17832 */
17833 /**
17834 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
17835 * @event AV.LiveQuery#enter
17836 * @param {AV.Object|AV.File} target updated object
17837 * @param {String[]} updatedKeys updated keys
17838 */
17839 /**
17840 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
17841 * @event AV.LiveQuery#leave
17842 * @param {AV.Object|AV.File} target updated object
17843 * @param {String[]} updatedKeys updated keys
17844 */
17845 _this2.emit(op, target, updatedKeys);
17846 } else {
17847 /**
17848 * A new AV.Object which fulfills the Query you subscribe is created.
17849 * @event AV.LiveQuery#create
17850 * @param {AV.Object|AV.File} target updated object
17851 */
17852 /**
17853 * An existing AV.Object which fulfills the Query you subscribe is deleted.
17854 * @event AV.LiveQuery#delete
17855 * @param {AV.Object|AV.File} target updated object
17856 */
17857 _this2.emit(op, target);
17858 }
17859 });
17860 },
17861
17862 /**
17863 * unsubscribe the query
17864 *
17865 * @return {Promise}
17866 */
17867 unsubscribe: function unsubscribe() {
17868 var client = this._client;
17869 client.off('message', this._onMessage);
17870 client.off('reconnect', this._onReconnect);
17871 client.deregister(this);
17872 return request({
17873 method: 'POST',
17874 path: '/LiveQuery/unsubscribe',
17875 data: {
17876 id: client.id,
17877 query_id: this.id
17878 }
17879 });
17880 }
17881 },
17882 /** @lends AV.LiveQuery */
17883 {
17884 init: function init(query) {
17885 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
17886 _ref2$subscriptionId = _ref2.subscriptionId,
17887 userDefinedSubscriptionId = _ref2$subscriptionId === undefined ? AV._getSubscriptionId() : _ref2$subscriptionId;
17888
17889 requireRealtime();
17890 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
17891 return _promise2.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
17892 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
17893 var _query$_getParams = query._getParams(),
17894 where = _query$_getParams.where,
17895 keys = _query$_getParams.keys,
17896 returnACL = _query$_getParams.returnACL;
17897
17898 var queryJSON = {
17899 where: where,
17900 keys: keys,
17901 returnACL: returnACL,
17902 className: query.className
17903 };
17904 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
17905 var queryId = _ref3.query_id;
17906 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
17907 }).finally(function () {
17908 liveQueryClient.deregister(promise);
17909 });
17910 liveQueryClient.register(promise);
17911 return promise;
17912 });
17913 });
17914 },
17915
17916 /**
17917 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
17918 * @static
17919 * @return void
17920 */
17921 pause: function pause() {
17922 requireRealtime();
17923 return AV._config.realtime.pause();
17924 },
17925
17926 /**
17927 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
17928 * @static
17929 * @return void
17930 */
17931 resume: function resume() {
17932 requireRealtime();
17933 return AV._config.realtime.resume();
17934 }
17935 });
17936};
17937
17938/***/ }),
17939/* 326 */
17940/***/ (function(module, exports, __webpack_require__) {
17941
17942"use strict";
17943
17944
17945var _ = __webpack_require__(0);
17946
17947var _require = __webpack_require__(15),
17948 tap = _require.tap;
17949
17950module.exports = function (AV) {
17951 /**
17952 * @class
17953 * @example
17954 * AV.Captcha.request().then(captcha => {
17955 * captcha.bind({
17956 * textInput: 'code', // the id for textInput
17957 * image: 'captcha',
17958 * verifyButton: 'verify',
17959 * }, {
17960 * success: (validateCode) => {}, // next step
17961 * error: (error) => {}, // present error.message to user
17962 * });
17963 * });
17964 */
17965 AV.Captcha = function Captcha(options, authOptions) {
17966 this._options = options;
17967 this._authOptions = authOptions;
17968 /**
17969 * The image url of the captcha
17970 * @type string
17971 */
17972 this.url = undefined;
17973 /**
17974 * The captchaToken of the captcha.
17975 * @type string
17976 */
17977 this.captchaToken = undefined;
17978 /**
17979 * The validateToken of the captcha.
17980 * @type string
17981 */
17982 this.validateToken = undefined;
17983 };
17984
17985 /**
17986 * Refresh the captcha
17987 * @return {Promise.<string>} a new capcha url
17988 */
17989 AV.Captcha.prototype.refresh = function refresh() {
17990 var _this = this;
17991
17992 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
17993 var captchaToken = _ref.captchaToken,
17994 url = _ref.url;
17995
17996 _.extend(_this, { captchaToken: captchaToken, url: url });
17997 return url;
17998 });
17999 };
18000
18001 /**
18002 * Verify the captcha
18003 * @param {String} code The code from user input
18004 * @return {Promise.<string>} validateToken if the code is valid
18005 */
18006 AV.Captcha.prototype.verify = function verify(code) {
18007 var _this2 = this;
18008
18009 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
18010 return _this2.validateToken = validateToken;
18011 }));
18012 };
18013
18014 if (undefined === 'Browser') {
18015 /**
18016 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
18017 * @param [elements]
18018 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
18019 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
18020 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
18021 * @param [callbacks]
18022 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
18023 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
18024 */
18025 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
18026 var _this3 = this;
18027
18028 var textInput = _ref2.textInput,
18029 image = _ref2.image,
18030 verifyButton = _ref2.verifyButton;
18031 var success = _ref3.success,
18032 error = _ref3.error;
18033
18034 if (typeof textInput === 'string') {
18035 textInput = document.getElementById(textInput);
18036 if (!textInput) throw new Error('textInput with id ' + textInput + ' not found');
18037 }
18038 if (typeof image === 'string') {
18039 image = document.getElementById(image);
18040 if (!image) throw new Error('image with id ' + image + ' not found');
18041 }
18042 if (typeof verifyButton === 'string') {
18043 verifyButton = document.getElementById(verifyButton);
18044 if (!verifyButton) throw new Error('verifyButton with id ' + verifyButton + ' not found');
18045 }
18046
18047 this.__refresh = function () {
18048 return _this3.refresh().then(function (url) {
18049 image.src = url;
18050 if (textInput) {
18051 textInput.value = '';
18052 textInput.focus();
18053 }
18054 }).catch(function (err) {
18055 return console.warn('refresh captcha fail: ' + err.message);
18056 });
18057 };
18058 if (image) {
18059 this.__image = image;
18060 image.src = this.url;
18061 image.addEventListener('click', this.__refresh);
18062 }
18063
18064 this.__verify = function () {
18065 var code = textInput.value;
18066 _this3.verify(code).catch(function (err) {
18067 _this3.__refresh();
18068 throw err;
18069 }).then(success, error).catch(function (err) {
18070 return console.warn('verify captcha fail: ' + err.message);
18071 });
18072 };
18073 if (textInput && verifyButton) {
18074 this.__verifyButton = verifyButton;
18075 verifyButton.addEventListener('click', this.__verify);
18076 }
18077 };
18078
18079 /**
18080 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
18081 */
18082 AV.Captcha.prototype.unbind = function unbind() {
18083 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
18084 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
18085 };
18086 }
18087
18088 /**
18089 * Request a captcha
18090 * @param [options]
18091 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
18092 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
18093 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
18094 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
18095 * @return {Promise.<AV.Captcha>}
18096 */
18097 AV.Captcha.request = function (options, authOptions) {
18098 var captcha = new AV.Captcha(options, authOptions);
18099 return captcha.refresh().then(function () {
18100 return captcha;
18101 });
18102 };
18103};
18104
18105/***/ }),
18106/* 327 */
18107/***/ (function(module, exports, __webpack_require__) {
18108
18109"use strict";
18110
18111
18112var _promise = __webpack_require__(4);
18113
18114var _promise2 = _interopRequireDefault(_promise);
18115
18116function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18117
18118var _ = __webpack_require__(0);
18119
18120var _require = __webpack_require__(12),
18121 _request = _require._request,
18122 request = _require.request;
18123
18124module.exports = function (AV) {
18125 /**
18126 * Contains functions for calling and declaring
18127 * <p><strong><em>
18128 * Some functions are only available from Cloud Code.
18129 * </em></strong></p>
18130 *
18131 * @namespace
18132 * @borrows AV.Captcha.request as requestCaptcha
18133 */
18134 AV.Cloud = AV.Cloud || {};
18135
18136 _.extend(AV.Cloud,
18137 /** @lends AV.Cloud */{
18138 /**
18139 * Makes a call to a cloud function.
18140 * @param {String} name The function name.
18141 * @param {Object} [data] The parameters to send to the cloud function.
18142 * @param {AuthOptions} [options]
18143 * @return {Promise} A promise that will be resolved with the result
18144 * of the function.
18145 */
18146 run: function run(name, data, options) {
18147 return request({
18148 service: 'engine',
18149 method: 'POST',
18150 path: '/functions/' + name,
18151 data: AV._encode(data, null, true),
18152 authOptions: options
18153 }).then(function (resp) {
18154 return AV._decode(resp).result;
18155 });
18156 },
18157
18158
18159 /**
18160 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
18161 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
18162 * @param {String} name The function name.
18163 * @param {Object} [data] The parameters to send to the cloud function.
18164 * @param {AuthOptions} [options]
18165 * @return {Promise} A promise that will be resolved with the result of the function.
18166 */
18167 rpc: function rpc(name, data, options) {
18168 if (_.isArray(data)) {
18169 return _promise2.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
18170 }
18171
18172 return request({
18173 service: 'engine',
18174 method: 'POST',
18175 path: '/call/' + name,
18176 data: AV._encodeObjectOrArray(data),
18177 authOptions: options
18178 }).then(function (resp) {
18179 return AV._decode(resp).result;
18180 });
18181 },
18182
18183
18184 /**
18185 * Make a call to request server date time.
18186 * @return {Promise.<Date>} A promise that will be resolved with the result
18187 * of the function.
18188 * @since 0.5.9
18189 */
18190 getServerDate: function getServerDate() {
18191 return _request('date', null, null, 'GET').then(function (resp) {
18192 return AV._decode(resp);
18193 });
18194 },
18195
18196
18197 /**
18198 * Makes a call to request an sms code for operation verification.
18199 * @param {String|Object} data The mobile phone number string or a JSON
18200 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
18201 * @param {String} data.mobilePhoneNumber
18202 * @param {String} [data.template] sms template name
18203 * @param {String} [data.sign] sms signature name
18204 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
18205 * @param {SMSAuthOptions} [options]
18206 * @return {Promise} A promise that will be resolved if the request succeed
18207 */
18208 requestSmsCode: function requestSmsCode(data) {
18209 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18210
18211 if (_.isString(data)) {
18212 data = { mobilePhoneNumber: data };
18213 }
18214 if (!data.mobilePhoneNumber) {
18215 throw new Error('Missing mobilePhoneNumber.');
18216 }
18217 if (options.validateToken) {
18218 data = _.extend({}, data, {
18219 validate_token: options.validateToken
18220 });
18221 }
18222 return _request('requestSmsCode', null, null, 'POST', data, options);
18223 },
18224
18225
18226 /**
18227 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
18228 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
18229 * @param {phone} phone The mobile phoner number.
18230 * @return {Promise} A promise that will be resolved with the result
18231 * of the function.
18232 */
18233 verifySmsCode: function verifySmsCode(code, phone) {
18234 if (!code) throw new Error('Missing sms code.');
18235 var params = {};
18236 if (_.isString(phone)) {
18237 params['mobilePhoneNumber'] = phone;
18238 }
18239
18240 return _request('verifySmsCode', code, null, 'POST', params);
18241 },
18242 _requestCaptcha: function _requestCaptcha(options, authOptions) {
18243 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
18244 var url = _ref.captcha_url,
18245 captchaToken = _ref.captcha_token;
18246 return {
18247 captchaToken: captchaToken,
18248 url: url
18249 };
18250 });
18251 },
18252
18253
18254 /**
18255 * Request a captcha.
18256 */
18257 requestCaptcha: AV.Captcha.request,
18258
18259 /**
18260 * Verify captcha code. This is the low-level API for captcha.
18261 * Checkout {@link AV.Captcha} for high abstract APIs.
18262 * @param {String} code the code from user input
18263 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
18264 * @return {Promise.<String>} validateToken if the code is valid
18265 */
18266 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
18267 return _request('verifyCaptcha', null, null, 'POST', {
18268 captcha_code: code,
18269 captcha_token: captchaToken
18270 }).then(function (_ref2) {
18271 var validateToken = _ref2.validate_token;
18272 return validateToken;
18273 });
18274 }
18275 });
18276};
18277
18278/***/ }),
18279/* 328 */
18280/***/ (function(module, exports, __webpack_require__) {
18281
18282"use strict";
18283
18284
18285var request = __webpack_require__(12).request;
18286
18287module.exports = function (AV) {
18288 AV.Installation = AV.Object.extend('_Installation');
18289
18290 /**
18291 * @namespace
18292 */
18293 AV.Push = AV.Push || {};
18294
18295 /**
18296 * Sends a push notification.
18297 * @param {Object} data The data of the push notification.
18298 * @param {String[]} [data.channels] An Array of channels to push to.
18299 * @param {Date} [data.push_time] A Date object for when to send the push.
18300 * @param {Date} [data.expiration_time] A Date object for when to expire
18301 * the push.
18302 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
18303 * @param {Number} [data.flow_control] The clients to notify per second
18304 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
18305 * a set of installations to push to.
18306 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
18307 * a set of installations to push to.
18308 * @param {Object} data.data The data to send as part of the push.
18309 More details: https://url.leanapp.cn/pushData
18310 * @param {AuthOptions} [options]
18311 * @return {Promise}
18312 */
18313 AV.Push.send = function (data, options) {
18314 if (data.where) {
18315 data.where = data.where._getParams().where;
18316 }
18317
18318 if (data.where && data.cql) {
18319 throw new Error("Both where and cql can't be set");
18320 }
18321
18322 if (data.push_time) {
18323 data.push_time = data.push_time.toJSON();
18324 }
18325
18326 if (data.expiration_time) {
18327 data.expiration_time = data.expiration_time.toJSON();
18328 }
18329
18330 if (data.expiration_time && data.expiration_interval) {
18331 throw new Error("Both expiration_time and expiration_interval can't be set");
18332 }
18333
18334 return request({
18335 service: 'push',
18336 method: 'POST',
18337 path: '/push',
18338 data: data,
18339 authOptions: options
18340 });
18341 };
18342};
18343
18344/***/ }),
18345/* 329 */
18346/***/ (function(module, exports, __webpack_require__) {
18347
18348"use strict";
18349
18350
18351var _promise = __webpack_require__(4);
18352
18353var _promise2 = _interopRequireDefault(_promise);
18354
18355var _typeof2 = __webpack_require__(59);
18356
18357var _typeof3 = _interopRequireDefault(_typeof2);
18358
18359function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18360
18361var _ = __webpack_require__(0);
18362var AVRequest = __webpack_require__(12)._request;
18363
18364var _require = __webpack_require__(15),
18365 getSessionToken = _require.getSessionToken;
18366
18367module.exports = function (AV) {
18368 var getUser = function getUser() {
18369 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18370
18371 var sessionToken = getSessionToken(options);
18372 if (sessionToken) {
18373 return AV.User._fetchUserBySessionToken(getSessionToken(options));
18374 }
18375 return AV.User.currentAsync();
18376 };
18377
18378 var getUserPointer = function getUserPointer(options) {
18379 return getUser(options).then(function (currUser) {
18380 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
18381 });
18382 };
18383
18384 /**
18385 * Contains functions to deal with Status in LeanCloud.
18386 * @class
18387 */
18388 AV.Status = function (imageUrl, message) {
18389 this.data = {};
18390 this.inboxType = 'default';
18391 this.query = null;
18392 if (imageUrl && (typeof imageUrl === 'undefined' ? 'undefined' : (0, _typeof3.default)(imageUrl)) === 'object') {
18393 this.data = imageUrl;
18394 } else {
18395 if (imageUrl) {
18396 this.data.image = imageUrl;
18397 }
18398 if (message) {
18399 this.data.message = message;
18400 }
18401 }
18402 return this;
18403 };
18404
18405 _.extend(AV.Status.prototype,
18406 /** @lends AV.Status.prototype */{
18407 /**
18408 * Gets the value of an attribute in status data.
18409 * @param {String} attr The string name of an attribute.
18410 */
18411 get: function get(attr) {
18412 return this.data[attr];
18413 },
18414 /**
18415 * Sets a hash of model attributes on the status data.
18416 * @param {String} key The key to set.
18417 * @param {} value The value to give it.
18418 */
18419 set: function set(key, value) {
18420 this.data[key] = value;
18421 return this;
18422 },
18423 /**
18424 * Destroy this status,then it will not be avaiable in other user's inboxes.
18425 * @param {AuthOptions} options
18426 * @return {Promise} A promise that is fulfilled when the destroy
18427 * completes.
18428 */
18429 destroy: function destroy(options) {
18430 if (!this.id) return _promise2.default.reject(new Error('The status id is not exists.'));
18431 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
18432 return request;
18433 },
18434 /**
18435 * Cast the AV.Status object to an AV.Object pointer.
18436 * @return {AV.Object} A AV.Object pointer.
18437 */
18438 toObject: function toObject() {
18439 if (!this.id) return null;
18440 return AV.Object.createWithoutData('_Status', this.id);
18441 },
18442 _getDataJSON: function _getDataJSON() {
18443 var json = _.clone(this.data);
18444 return AV._encode(json);
18445 },
18446 /**
18447 * Send a status by a AV.Query object.
18448 * @since 0.3.0
18449 * @param {AuthOptions} options
18450 * @return {Promise} A promise that is fulfilled when the send
18451 * completes.
18452 * @example
18453 * // send a status to male users
18454 * var status = new AVStatus('image url', 'a message');
18455 * status.query = new AV.Query('_User');
18456 * status.query.equalTo('gender', 'male');
18457 * status.send().then(function(){
18458 * //send status successfully.
18459 * }, function(err){
18460 * //an error threw.
18461 * console.dir(err);
18462 * });
18463 */
18464 send: function send() {
18465 var _this = this;
18466
18467 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18468
18469 if (!getSessionToken(options) && !AV.User.current()) {
18470 throw new Error('Please signin an user.');
18471 }
18472 if (!this.query) {
18473 return AV.Status.sendStatusToFollowers(this, options);
18474 }
18475
18476 return getUserPointer(options).then(function (currUser) {
18477 var query = _this.query._getParams();
18478 query.className = _this.query.className;
18479 var data = {};
18480 data.query = query;
18481 _this.data = _this.data || {};
18482 _this.data.source = _this.data.source || currUser;
18483 data.data = _this._getDataJSON();
18484 data.inboxType = _this.inboxType || 'default';
18485
18486 return AVRequest('statuses', null, null, 'POST', data, options);
18487 }).then(function (response) {
18488 _this.id = response.objectId;
18489 _this.createdAt = AV._parseDate(response.createdAt);
18490 return _this;
18491 });
18492 },
18493
18494 _finishFetch: function _finishFetch(serverData) {
18495 this.id = serverData.objectId;
18496 this.createdAt = AV._parseDate(serverData.createdAt);
18497 this.updatedAt = AV._parseDate(serverData.updatedAt);
18498 this.messageId = serverData.messageId;
18499 delete serverData.messageId;
18500 delete serverData.objectId;
18501 delete serverData.createdAt;
18502 delete serverData.updatedAt;
18503 this.data = AV._decode(serverData);
18504 }
18505 });
18506
18507 /**
18508 * Send a status to current signined user's followers.
18509 * @since 0.3.0
18510 * @param {AV.Status} status A status object to be send to followers.
18511 * @param {AuthOptions} options
18512 * @return {Promise} A promise that is fulfilled when the send
18513 * completes.
18514 * @example
18515 * var status = new AVStatus('image url', 'a message');
18516 * AV.Status.sendStatusToFollowers(status).then(function(){
18517 * //send status successfully.
18518 * }, function(err){
18519 * //an error threw.
18520 * console.dir(err);
18521 * });
18522 */
18523 AV.Status.sendStatusToFollowers = function (status) {
18524 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18525
18526 if (!getSessionToken(options) && !AV.User.current()) {
18527 throw new Error('Please signin an user.');
18528 }
18529 return getUserPointer(options).then(function (currUser) {
18530 var query = {};
18531 query.className = '_Follower';
18532 query.keys = 'follower';
18533 query.where = { user: currUser };
18534 var data = {};
18535 data.query = query;
18536 status.data = status.data || {};
18537 status.data.source = status.data.source || currUser;
18538 data.data = status._getDataJSON();
18539 data.inboxType = status.inboxType || 'default';
18540
18541 var request = AVRequest('statuses', null, null, 'POST', data, options);
18542 return request.then(function (response) {
18543 status.id = response.objectId;
18544 status.createdAt = AV._parseDate(response.createdAt);
18545 return status;
18546 });
18547 });
18548 };
18549
18550 /**
18551 * <p>Send a status from current signined user to other user's private status inbox.</p>
18552 * @since 0.3.0
18553 * @param {AV.Status} status A status object to be send to followers.
18554 * @param {String} target The target user or user's objectId.
18555 * @param {AuthOptions} options
18556 * @return {Promise} A promise that is fulfilled when the send
18557 * completes.
18558 * @example
18559 * // send a private status to user '52e84e47e4b0f8de283b079b'
18560 * var status = new AVStatus('image url', 'a message');
18561 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
18562 * //send status successfully.
18563 * }, function(err){
18564 * //an error threw.
18565 * console.dir(err);
18566 * });
18567 */
18568 AV.Status.sendPrivateStatus = function (status, target) {
18569 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18570
18571 if (!getSessionToken(options) && !AV.User.current()) {
18572 throw new Error('Please signin an user.');
18573 }
18574 if (!target) {
18575 throw new Error('Invalid target user.');
18576 }
18577 var userObjectId = _.isString(target) ? target : target.id;
18578 if (!userObjectId) {
18579 throw new Error('Invalid target user.');
18580 }
18581 return getUserPointer(options).then(function (currUser) {
18582 var query = {};
18583 query.className = '_User';
18584 query.where = { objectId: userObjectId };
18585 var data = {};
18586 data.query = query;
18587 status.data = status.data || {};
18588 status.data.source = status.data.source || currUser;
18589 data.data = status._getDataJSON();
18590 data.inboxType = 'private';
18591 status.inboxType = 'private';
18592
18593 var request = AVRequest('statuses', null, null, 'POST', data, options);
18594 return request.then(function (response) {
18595 status.id = response.objectId;
18596 status.createdAt = AV._parseDate(response.createdAt);
18597 return status;
18598 });
18599 });
18600 };
18601
18602 /**
18603 * Count unread statuses in someone's inbox.
18604 * @since 0.3.0
18605 * @param {AV.User} owner The status owner.
18606 * @param {String} inboxType The inbox type, 'default' by default.
18607 * @param {AuthOptions} options
18608 * @return {Promise} A promise that is fulfilled when the count
18609 * completes.
18610 * @example
18611 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
18612 * console.log(response.unread); //unread statuses number.
18613 * console.log(response.total); //total statuses number.
18614 * });
18615 */
18616 AV.Status.countUnreadStatuses = function (owner) {
18617 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
18618 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18619
18620 if (!_.isString(inboxType)) options = inboxType;
18621 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
18622 throw new Error('Please signin an user or pass the owner objectId.');
18623 }
18624 return _promise2.default.resolve(owner || getUser(options)).then(function (owner) {
18625 var params = {};
18626 params.inboxType = AV._encode(inboxType);
18627 params.owner = AV._encode(owner);
18628 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
18629 });
18630 };
18631
18632 /**
18633 * reset unread statuses count in someone's inbox.
18634 * @since 2.1.0
18635 * @param {AV.User} owner The status owner.
18636 * @param {String} inboxType The inbox type, 'default' by default.
18637 * @param {AuthOptions} options
18638 * @return {Promise} A promise that is fulfilled when the reset
18639 * completes.
18640 * @example
18641 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
18642 * console.log(response.unread); //unread statuses number.
18643 * console.log(response.total); //total statuses number.
18644 * });
18645 */
18646 AV.Status.resetUnreadCount = function (owner) {
18647 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
18648 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18649
18650 if (!_.isString(inboxType)) options = inboxType;
18651 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
18652 throw new Error('Please signin an user or pass the owner objectId.');
18653 }
18654 return _promise2.default.resolve(owner || getUser(options)).then(function (owner) {
18655 var params = {};
18656 params.inboxType = AV._encode(inboxType);
18657 params.owner = AV._encode(owner);
18658 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
18659 });
18660 };
18661
18662 /**
18663 * Create a status query to find someone's published statuses.
18664 * @since 0.3.0
18665 * @param {AV.User} source The status source, typically the publisher.
18666 * @return {AV.Query} The query object for status.
18667 * @example
18668 * //Find current user's published statuses.
18669 * var query = AV.Status.statusQuery(AV.User.current());
18670 * query.find().then(function(statuses){
18671 * //process statuses
18672 * });
18673 */
18674 AV.Status.statusQuery = function (source) {
18675 var query = new AV.Query('_Status');
18676 if (source) {
18677 query.equalTo('source', source);
18678 }
18679 return query;
18680 };
18681
18682 /**
18683 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
18684 * @class
18685 */
18686 AV.InboxQuery = AV.Query._extend(
18687 /** @lends AV.InboxQuery.prototype */{
18688 _objectClass: AV.Status,
18689 _sinceId: 0,
18690 _maxId: 0,
18691 _inboxType: 'default',
18692 _owner: null,
18693 _newObject: function _newObject() {
18694 return new AV.Status();
18695 },
18696 _createRequest: function _createRequest(params, options) {
18697 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
18698 },
18699
18700 /**
18701 * Sets the messageId of results to skip before returning any results.
18702 * This is useful for pagination.
18703 * Default is zero.
18704 * @param {Number} n the mesage id.
18705 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18706 */
18707 sinceId: function sinceId(id) {
18708 this._sinceId = id;
18709 return this;
18710 },
18711 /**
18712 * Sets the maximal messageId of results。
18713 * This is useful for pagination.
18714 * Default is zero that is no limition.
18715 * @param {Number} n the mesage id.
18716 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18717 */
18718 maxId: function maxId(id) {
18719 this._maxId = id;
18720 return this;
18721 },
18722 /**
18723 * Sets the owner of the querying inbox.
18724 * @param {AV.User} owner The inbox owner.
18725 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18726 */
18727 owner: function owner(_owner) {
18728 this._owner = _owner;
18729 return this;
18730 },
18731 /**
18732 * Sets the querying inbox type.default is 'default'.
18733 * @param {Object} type The inbox type.
18734 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18735 */
18736 inboxType: function inboxType(type) {
18737 this._inboxType = type;
18738 return this;
18739 },
18740 _getParams: function _getParams() {
18741 var params = AV.InboxQuery.__super__._getParams.call(this);
18742 params.owner = AV._encode(this._owner);
18743 params.inboxType = AV._encode(this._inboxType);
18744 params.sinceId = AV._encode(this._sinceId);
18745 params.maxId = AV._encode(this._maxId);
18746 return params;
18747 }
18748 });
18749
18750 /**
18751 * Create a inbox status query to find someone's inbox statuses.
18752 * @since 0.3.0
18753 * @param {AV.User} owner The inbox's owner
18754 * @param {String} inboxType The inbox type,'default' by default.
18755 * @return {AV.InboxQuery} The inbox query object.
18756 * @see AV.InboxQuery
18757 * @example
18758 * //Find current user's default inbox statuses.
18759 * var query = AV.Status.inboxQuery(AV.User.current());
18760 * //find the statuses after the last message id
18761 * query.sinceId(lastMessageId);
18762 * query.find().then(function(statuses){
18763 * //process statuses
18764 * });
18765 */
18766 AV.Status.inboxQuery = function (owner, inboxType) {
18767 var query = new AV.InboxQuery(AV.Status);
18768 if (owner) {
18769 query._owner = owner;
18770 }
18771 if (inboxType) {
18772 query._inboxType = inboxType;
18773 }
18774 return query;
18775 };
18776};
18777
18778/***/ }),
18779/* 330 */
18780/***/ (function(module, exports, __webpack_require__) {
18781
18782"use strict";
18783
18784
18785var _stringify = __webpack_require__(18);
18786
18787var _stringify2 = _interopRequireDefault(_stringify);
18788
18789function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18790
18791var _ = __webpack_require__(0);
18792var AVRequest = __webpack_require__(12)._request;
18793
18794module.exports = function (AV) {
18795 /**
18796 * A builder to generate sort string for app searching.For example:
18797 * @class
18798 * @since 0.5.1
18799 * @example
18800 * var builder = new AV.SearchSortBuilder();
18801 * builder.ascending('key1').descending('key2','max');
18802 * var query = new AV.SearchQuery('Player');
18803 * query.sortBy(builder);
18804 * query.find().then();
18805 */
18806 AV.SearchSortBuilder = function () {
18807 this._sortFields = [];
18808 };
18809
18810 _.extend(AV.SearchSortBuilder.prototype,
18811 /** @lends AV.SearchSortBuilder.prototype */{
18812 _addField: function _addField(key, order, mode, missing) {
18813 var field = {};
18814 field[key] = {
18815 order: order || 'asc',
18816 mode: mode || 'avg',
18817 missing: '_' + (missing || 'last')
18818 };
18819 this._sortFields.push(field);
18820 return this;
18821 },
18822
18823 /**
18824 * Sorts the results in ascending order by the given key and options.
18825 *
18826 * @param {String} key The key to order by.
18827 * @param {String} mode The sort mode, default is 'avg', you can choose
18828 * 'max' or 'min' too.
18829 * @param {String} missing The missing key behaviour, default is 'last',
18830 * you can choose 'first' too.
18831 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
18832 */
18833 ascending: function ascending(key, mode, missing) {
18834 return this._addField(key, 'asc', mode, missing);
18835 },
18836
18837 /**
18838 * Sorts the results in descending order by the given key and options.
18839 *
18840 * @param {String} key The key to order by.
18841 * @param {String} mode The sort mode, default is 'avg', you can choose
18842 * 'max' or 'min' too.
18843 * @param {String} missing The missing key behaviour, default is 'last',
18844 * you can choose 'first' too.
18845 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
18846 */
18847 descending: function descending(key, mode, missing) {
18848 return this._addField(key, 'desc', mode, missing);
18849 },
18850
18851 /**
18852 * Add a proximity based constraint for finding objects with key point
18853 * values near the point given.
18854 * @param {String} key The key that the AV.GeoPoint is stored in.
18855 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
18856 * @param {Object} options The other options such as mode,order, unit etc.
18857 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
18858 */
18859 whereNear: function whereNear(key, point, options) {
18860 options = options || {};
18861 var field = {};
18862 var geo = {
18863 lat: point.latitude,
18864 lon: point.longitude
18865 };
18866 var m = {
18867 order: options.order || 'asc',
18868 mode: options.mode || 'avg',
18869 unit: options.unit || 'km'
18870 };
18871 m[key] = geo;
18872 field['_geo_distance'] = m;
18873
18874 this._sortFields.push(field);
18875 return this;
18876 },
18877
18878 /**
18879 * Build a sort string by configuration.
18880 * @return {String} the sort string.
18881 */
18882 build: function build() {
18883 return (0, _stringify2.default)(AV._encode(this._sortFields));
18884 }
18885 });
18886
18887 /**
18888 * App searching query.Use just like AV.Query:
18889 *
18890 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
18891 * for more details.
18892 * @class
18893 * @since 0.5.1
18894 * @example
18895 * var query = new AV.SearchQuery('Player');
18896 * query.queryString('*');
18897 * query.find().then(function(results) {
18898 * console.log('Found %d objects', query.hits());
18899 * //Process results
18900 * });
18901 */
18902 AV.SearchQuery = AV.Query._extend(
18903 /** @lends AV.SearchQuery.prototype */{
18904 _sid: null,
18905 _hits: 0,
18906 _queryString: null,
18907 _highlights: null,
18908 _sortBuilder: null,
18909 _clazz: null,
18910
18911 constructor: function constructor(className) {
18912 if (className) {
18913 this._clazz = className;
18914 } else {
18915 className = '__INVALID_CLASS';
18916 }
18917 AV.Query.call(this, className);
18918 },
18919
18920 _createRequest: function _createRequest(params, options) {
18921 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
18922 },
18923
18924 /**
18925 * Sets the sid of app searching query.Default is null.
18926 * @param {String} sid Scroll id for searching.
18927 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18928 */
18929 sid: function sid(_sid) {
18930 this._sid = _sid;
18931 return this;
18932 },
18933
18934 /**
18935 * Sets the query string of app searching.
18936 * @param {String} q The query string.
18937 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18938 */
18939 queryString: function queryString(q) {
18940 this._queryString = q;
18941 return this;
18942 },
18943
18944 /**
18945 * Sets the highlight fields. Such as
18946 * <pre><code>
18947 * query.highlights('title');
18948 * //or pass an array.
18949 * query.highlights(['title', 'content'])
18950 * </code></pre>
18951 * @param {String|String[]} highlights a list of fields.
18952 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18953 */
18954 highlights: function highlights(_highlights) {
18955 var objects;
18956 if (_highlights && _.isString(_highlights)) {
18957 objects = _.toArray(arguments);
18958 } else {
18959 objects = _highlights;
18960 }
18961 this._highlights = objects;
18962 return this;
18963 },
18964
18965 /**
18966 * Sets the sort builder for this query.
18967 * @see AV.SearchSortBuilder
18968 * @param { AV.SearchSortBuilder} builder The sort builder.
18969 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18970 *
18971 */
18972 sortBy: function sortBy(builder) {
18973 this._sortBuilder = builder;
18974 return this;
18975 },
18976
18977 /**
18978 * Returns the number of objects that match this query.
18979 * @return {Number}
18980 */
18981 hits: function hits() {
18982 if (!this._hits) {
18983 this._hits = 0;
18984 }
18985 return this._hits;
18986 },
18987
18988 _processResult: function _processResult(json) {
18989 delete json['className'];
18990 delete json['_app_url'];
18991 delete json['_deeplink'];
18992 return json;
18993 },
18994
18995 /**
18996 * Returns true when there are more documents can be retrieved by this
18997 * query instance, you can call find function to get more results.
18998 * @see AV.SearchQuery#find
18999 * @return {Boolean}
19000 */
19001 hasMore: function hasMore() {
19002 return !this._hitEnd;
19003 },
19004
19005 /**
19006 * Reset current query instance state(such as sid, hits etc) except params
19007 * for a new searching. After resetting, hasMore() will return true.
19008 */
19009 reset: function reset() {
19010 this._hitEnd = false;
19011 this._sid = null;
19012 this._hits = 0;
19013 },
19014
19015 /**
19016 * Retrieves a list of AVObjects that satisfy this query.
19017 * Either options.success or options.error is called when the find
19018 * completes.
19019 *
19020 * @see AV.Query#find
19021 * @param {AuthOptions} options
19022 * @return {Promise} A promise that is resolved with the results when
19023 * the query completes.
19024 */
19025 find: function find(options) {
19026 var self = this;
19027
19028 var request = this._createRequest(undefined, options);
19029
19030 return request.then(function (response) {
19031 //update sid for next querying.
19032 if (response.sid) {
19033 self._oldSid = self._sid;
19034 self._sid = response.sid;
19035 } else {
19036 self._sid = null;
19037 self._hitEnd = true;
19038 }
19039 self._hits = response.hits || 0;
19040
19041 return _.map(response.results, function (json) {
19042 if (json.className) {
19043 response.className = json.className;
19044 }
19045 var obj = self._newObject(response);
19046 obj.appURL = json['_app_url'];
19047 obj._finishFetch(self._processResult(json), true);
19048 return obj;
19049 });
19050 });
19051 },
19052
19053 _getParams: function _getParams() {
19054 var params = AV.SearchQuery.__super__._getParams.call(this);
19055 delete params.where;
19056 if (this._clazz) {
19057 params.clazz = this.className;
19058 }
19059 if (this._sid) {
19060 params.sid = this._sid;
19061 }
19062 if (!this._queryString) {
19063 throw new Error('Please set query string.');
19064 } else {
19065 params.q = this._queryString;
19066 }
19067 if (this._highlights) {
19068 params.highlights = this._highlights.join(',');
19069 }
19070 if (this._sortBuilder && params.order) {
19071 throw new Error('sort and order can not be set at same time.');
19072 }
19073 if (this._sortBuilder) {
19074 params.sort = this._sortBuilder.build();
19075 }
19076
19077 return params;
19078 }
19079 });
19080};
19081
19082/**
19083 * Sorts the results in ascending order by the given key.
19084 *
19085 * @method AV.SearchQuery#ascending
19086 * @param {String} key The key to order by.
19087 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19088 */
19089/**
19090 * Also sorts the results in ascending order by the given key. The previous sort keys have
19091 * precedence over this key.
19092 *
19093 * @method AV.SearchQuery#addAscending
19094 * @param {String} key The key to order by
19095 * @return {AV.SearchQuery} Returns the query so you can chain this call.
19096 */
19097/**
19098 * Sorts the results in descending order by the given key.
19099 *
19100 * @method AV.SearchQuery#descending
19101 * @param {String} key The key to order by.
19102 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19103 */
19104/**
19105 * Also sorts the results in descending order by the given key. The previous sort keys have
19106 * precedence over this key.
19107 *
19108 * @method AV.SearchQuery#addDescending
19109 * @param {String} key The key to order by
19110 * @return {AV.SearchQuery} Returns the query so you can chain this call.
19111 */
19112/**
19113 * Include nested AV.Objects for the provided key. You can use dot
19114 * notation to specify which fields in the included object are also fetch.
19115 * @method AV.SearchQuery#include
19116 * @param {String[]} keys The name of the key to include.
19117 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19118 */
19119/**
19120 * Sets the number of results to skip before returning any results.
19121 * This is useful for pagination.
19122 * Default is to skip zero results.
19123 * @method AV.SearchQuery#skip
19124 * @param {Number} n the number of results to skip.
19125 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19126 */
19127/**
19128 * Sets the limit of the number of results to return. The default limit is
19129 * 100, with a maximum of 1000 results being returned at a time.
19130 * @method AV.SearchQuery#limit
19131 * @param {Number} n the number of results to limit to.
19132 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19133 */
19134
19135/***/ }),
19136/* 331 */
19137/***/ (function(module, exports, __webpack_require__) {
19138
19139"use strict";
19140
19141
19142var _promise = __webpack_require__(4);
19143
19144var _promise2 = _interopRequireDefault(_promise);
19145
19146function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19147
19148var _ = __webpack_require__(0);
19149var AVError = __webpack_require__(23);
19150
19151var _require = __webpack_require__(12),
19152 request = _require.request;
19153
19154module.exports = function (AV) {
19155 /**
19156 * 包含了使用了 LeanCloud
19157 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
19158 * <p><strong><em>
19159 * 仅在云引擎运行环境下有效。
19160 * </em></strong></p>
19161 * @namespace
19162 */
19163 AV.Insight = AV.Insight || {};
19164
19165 _.extend(AV.Insight,
19166 /** @lends AV.Insight */{
19167 /**
19168 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
19169 * AV.Insight.JobQuery 查询任务状态和结果。
19170 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
19171 * { "sql" : "select count(*) as c,gender from _User group by gender",
19172 * "saveAs": {
19173 * "className" : "UserGender",
19174 * "limit": 1
19175 * }
19176 * }
19177 * </pre></code>
19178 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
19179 * @param {AuthOptions} [options]
19180 * @return {Promise} A promise that will be resolved with the result
19181 * of the function.
19182 */
19183 startJob: function startJob(jobConfig, options) {
19184 if (!jobConfig || !jobConfig.sql) {
19185 throw new Error('Please provide the sql to run the job.');
19186 }
19187 var data = {
19188 jobConfig: jobConfig,
19189 appId: AV.applicationId
19190 };
19191 return request({
19192 path: '/bigquery/jobs',
19193 method: 'POST',
19194 data: AV._encode(data, null, true),
19195 authOptions: options,
19196 signKey: false
19197 }).then(function (resp) {
19198 return AV._decode(resp).id;
19199 });
19200 },
19201
19202 /**
19203 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
19204 * <p><strong><em>
19205 * 仅在云引擎运行环境下有效。
19206 * </em></strong></p>
19207 * @param {String} event 监听的事件,目前尚不支持。
19208 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
19209 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
19210 *
19211 */
19212 on: function on(event, cb) {}
19213 });
19214
19215 /**
19216 * 创建一个对象,用于查询 Insight 任务状态和结果。
19217 * @class
19218 * @param {String} id 任务 id
19219 * @since 0.5.5
19220 */
19221 AV.Insight.JobQuery = function (id, className) {
19222 if (!id) {
19223 throw new Error('Please provide the job id.');
19224 }
19225 this.id = id;
19226 this.className = className;
19227 this._skip = 0;
19228 this._limit = 100;
19229 };
19230
19231 _.extend(AV.Insight.JobQuery.prototype,
19232 /** @lends AV.Insight.JobQuery.prototype */{
19233 /**
19234 * Sets the number of results to skip before returning any results.
19235 * This is useful for pagination.
19236 * Default is to skip zero results.
19237 * @param {Number} n the number of results to skip.
19238 * @return {AV.Query} Returns the query, so you can chain this call.
19239 */
19240 skip: function skip(n) {
19241 this._skip = n;
19242 return this;
19243 },
19244
19245 /**
19246 * Sets the limit of the number of results to return. The default limit is
19247 * 100, with a maximum of 1000 results being returned at a time.
19248 * @param {Number} n the number of results to limit to.
19249 * @return {AV.Query} Returns the query, so you can chain this call.
19250 */
19251 limit: function limit(n) {
19252 this._limit = n;
19253 return this;
19254 },
19255
19256 /**
19257 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
19258 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
19259 * startTime、endTime 等信息。
19260 *
19261 * @param {AuthOptions} [options]
19262 * @return {Promise} A promise that will be resolved with the result
19263 * of the function.
19264 *
19265 */
19266 find: function find(options) {
19267 var params = {
19268 skip: this._skip,
19269 limit: this._limit
19270 };
19271
19272 return request({
19273 path: '/bigquery/jobs/' + this.id,
19274 method: 'GET',
19275 query: params,
19276 authOptions: options,
19277 signKey: false
19278 }).then(function (response) {
19279 if (response.error) {
19280 return _promise2.default.reject(new AVError(response.code, response.error));
19281 }
19282 return _promise2.default.resolve(response);
19283 });
19284 }
19285 });
19286};
19287
19288/***/ }),
19289/* 332 */
19290/***/ (function(module, exports, __webpack_require__) {
19291
19292"use strict";
19293
19294
19295var _ = __webpack_require__(0);
19296
19297var _require = __webpack_require__(12),
19298 LCRequest = _require.request;
19299
19300var _require2 = __webpack_require__(15),
19301 getSessionToken = _require2.getSessionToken;
19302
19303module.exports = function (AV) {
19304 /**
19305 * Contains functions to deal with Friendship in LeanCloud.
19306 * @class
19307 */
19308 AV.Friendship = {
19309 /**
19310 * Request friendship.
19311 * @since 4.8.0
19312 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
19313 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
19314 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
19315 * @param {*} [authOptions]
19316 * @return {Promise<void>}
19317 */
19318 request: function request(options, authOptions) {
19319 if (!AV.User.current()) {
19320 throw new Error('Please signin an user.');
19321 }
19322 var friend = void 0;
19323 var attributes = void 0;
19324 if (options.friend) {
19325 friend = options.friend;
19326 attributes = options.attributes;
19327 } else {
19328 friend = options;
19329 }
19330 var friendObject = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
19331 return LCRequest({
19332 method: 'POST',
19333 path: '/users/friendshipRequests',
19334 data: AV._encode({
19335 user: AV.User.current(),
19336 friend: friendObject,
19337 friendship: attributes
19338 }),
19339 authOptions: authOptions
19340 });
19341 },
19342
19343 /**
19344 * Accept a friendship request.
19345 * @since 4.8.0
19346 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
19347 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
19348 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
19349 * @param {AuthOptions} [authOptions]
19350 * @return {Promise<void>}
19351 */
19352 acceptRequest: function acceptRequest(options) {
19353 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19354
19355 if (!getSessionToken(authOptions) && !AV.User.current()) {
19356 throw new Error('Please signin an user.');
19357 }
19358 var request = void 0;
19359 var attributes = void 0;
19360 if (options.request) {
19361 request = options.request;
19362 attributes = options.attributes;
19363 } else {
19364 request = options;
19365 }
19366 var requestId = _.isString(request) ? request : request.id;
19367 return LCRequest({
19368 method: 'PUT',
19369 path: '/users/friendshipRequests/' + requestId + '/accept',
19370 data: {
19371 friendship: AV._encode(attributes)
19372 },
19373 authOptions: authOptions
19374 });
19375 },
19376
19377 /**
19378 * Decline a friendship request.
19379 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
19380 * @param {AuthOptions} [authOptions]
19381 * @return {Promise<void>}
19382 */
19383 declineRequest: function declineRequest(request) {
19384 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19385
19386 if (!getSessionToken(authOptions) && !AV.User.current()) {
19387 throw new Error('Please signin an user.');
19388 }
19389 var requestId = _.isString(request) ? request : request.id;
19390 return LCRequest({
19391 method: 'PUT',
19392 path: '/users/friendshipRequests/' + requestId + '/decline',
19393 authOptions: authOptions
19394 });
19395 }
19396 };
19397};
19398
19399/***/ }),
19400/* 333 */
19401/***/ (function(module, exports, __webpack_require__) {
19402
19403"use strict";
19404
19405
19406var _stringify = __webpack_require__(18);
19407
19408var _stringify2 = _interopRequireDefault(_stringify);
19409
19410function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19411
19412var _ = __webpack_require__(0);
19413
19414var _require = __webpack_require__(12),
19415 _request = _require._request;
19416
19417var AV = __webpack_require__(34);
19418
19419var serializeMessage = function serializeMessage(message) {
19420 if (typeof message === 'string') {
19421 return message;
19422 }
19423 if (typeof message.getPayload === 'function') {
19424 return (0, _stringify2.default)(message.getPayload());
19425 }
19426 return (0, _stringify2.default)(message);
19427};
19428
19429/**
19430 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
19431 * conversation. This class is a subclass of AV.Object, and retains the
19432 * same functionality of an AV.Object, but also extends it with various
19433 * conversation specific methods, like get members, creators of this conversation.
19434 * </p>
19435 *
19436 * @class AV.Conversation
19437 * @param {String} name The name of the Role to create.
19438 * @param {Object} [options]
19439 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
19440 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
19441 */
19442module.exports = AV.Object.extend('_Conversation',
19443/** @lends AV.Conversation.prototype */{
19444 constructor: function constructor(name) {
19445 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19446
19447 AV.Object.prototype.constructor.call(this, null, null);
19448 this.set('name', name);
19449 if (options.isSystem !== undefined) {
19450 this.set('sys', options.isSystem ? true : false);
19451 }
19452 if (options.isTransient !== undefined) {
19453 this.set('tr', options.isTransient ? true : false);
19454 }
19455 },
19456
19457 /**
19458 * Get current conversation's creator.
19459 *
19460 * @return {String}
19461 */
19462 getCreator: function getCreator() {
19463 return this.get('c');
19464 },
19465
19466
19467 /**
19468 * Get the last message's time.
19469 *
19470 * @return {Date}
19471 */
19472 getLastMessageAt: function getLastMessageAt() {
19473 return this.get('lm');
19474 },
19475
19476
19477 /**
19478 * Get this conversation's members
19479 *
19480 * @return {String[]}
19481 */
19482 getMembers: function getMembers() {
19483 return this.get('m');
19484 },
19485
19486
19487 /**
19488 * Add a member to this conversation
19489 *
19490 * @param {String} member
19491 */
19492 addMember: function addMember(member) {
19493 return this.add('m', member);
19494 },
19495
19496
19497 /**
19498 * Get this conversation's members who set this conversation as muted.
19499 *
19500 * @return {String[]}
19501 */
19502 getMutedMembers: function getMutedMembers() {
19503 return this.get('mu');
19504 },
19505
19506
19507 /**
19508 * Get this conversation's name field.
19509 *
19510 * @return String
19511 */
19512 getName: function getName() {
19513 return this.get('name');
19514 },
19515
19516
19517 /**
19518 * Returns true if this conversation is transient conversation.
19519 *
19520 * @return {Boolean}
19521 */
19522 isTransient: function isTransient() {
19523 return this.get('tr');
19524 },
19525
19526
19527 /**
19528 * Returns true if this conversation is system conversation.
19529 *
19530 * @return {Boolean}
19531 */
19532 isSystem: function isSystem() {
19533 return this.get('sys');
19534 },
19535
19536
19537 /**
19538 * Send realtime message to this conversation, using HTTP request.
19539 *
19540 * @param {String} fromClient Sender's client id.
19541 * @param {String|Object} message The message which will send to conversation.
19542 * It could be a raw string, or an object with a `toJSON` method, like a
19543 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
19544 * @param {Object} [options]
19545 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
19546 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
19547 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
19548 * @param {AuthOptions} [authOptions]
19549 * @return {Promise}
19550 */
19551 send: function send(fromClient, message) {
19552 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19553 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
19554
19555 var data = {
19556 from_peer: fromClient,
19557 conv_id: this.id,
19558 transient: false,
19559 message: serializeMessage(message)
19560 };
19561 if (options.toClients !== undefined) {
19562 data.to_peers = options.toClients;
19563 }
19564 if (options.transient !== undefined) {
19565 data.transient = options.transient ? true : false;
19566 }
19567 if (options.pushData !== undefined) {
19568 data.push_data = options.pushData;
19569 }
19570 return _request('rtm', 'messages', null, 'POST', data, authOptions);
19571 },
19572
19573
19574 /**
19575 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
19576 *
19577 * @param {String} fromClient Sender's client id.
19578 * @param {String|Object} message The message which will send to conversation.
19579 * It could be a raw string, or an object with a `toJSON` method, like a
19580 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
19581 * @param {Object} [options]
19582 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
19583 * @param {Object} [options.validTill] The message will valid till this time.
19584 * @param {AuthOptions} [authOptions]
19585 * @return {Promise}
19586 */
19587 broadcast: function broadcast(fromClient, message) {
19588 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19589 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
19590
19591 var data = {
19592 from_peer: fromClient,
19593 conv_id: this.id,
19594 message: serializeMessage(message)
19595 };
19596 if (options.pushData !== undefined) {
19597 data.push = options.pushData;
19598 }
19599 if (options.validTill !== undefined) {
19600 var ts = options.validTill;
19601 if (_.isDate(ts)) {
19602 ts = ts.getTime();
19603 }
19604 options.valid_till = ts;
19605 }
19606 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
19607 }
19608});
19609
19610/***/ }),
19611/* 334 */
19612/***/ (function(module, exports, __webpack_require__) {
19613
19614"use strict";
19615
19616
19617var _promise = __webpack_require__(4);
19618
19619var _promise2 = _interopRequireDefault(_promise);
19620
19621function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19622
19623var _ = __webpack_require__(0);
19624
19625var _require = __webpack_require__(12),
19626 request = _require.request;
19627
19628var _require2 = __webpack_require__(15),
19629 ensureArray = _require2.ensureArray,
19630 parseDate = _require2.parseDate;
19631
19632var AV = __webpack_require__(34);
19633
19634/**
19635 * The version change interval for Leaderboard
19636 * @enum
19637 */
19638AV.LeaderboardVersionChangeInterval = {
19639 NEVER: 'never',
19640 DAY: 'day',
19641 WEEK: 'week',
19642 MONTH: 'month'
19643};
19644
19645/**
19646 * The order of the leaderboard results
19647 * @enum
19648 */
19649AV.LeaderboardOrder = {
19650 ASCENDING: 'ascending',
19651 DESCENDING: 'descending'
19652};
19653
19654/**
19655 * The update strategy for Leaderboard
19656 * @enum
19657 */
19658AV.LeaderboardUpdateStrategy = {
19659 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
19660 BETTER: 'better',
19661 /** Keep the last updated statistic */
19662 LAST: 'last',
19663 /** Keep the sum of all updated statistics */
19664 SUM: 'sum'
19665};
19666
19667/**
19668 * @typedef {Object} Ranking
19669 * @property {number} rank Starts at 0
19670 * @property {number} value the statistic value of this ranking
19671 * @property {AV.User} user The user of this ranking
19672 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
19673 */
19674
19675/**
19676 * @typedef {Object} LeaderboardArchive
19677 * @property {string} statisticName
19678 * @property {number} version version of the leaderboard
19679 * @property {string} status
19680 * @property {string} url URL for the downloadable archive
19681 * @property {Date} activatedAt time when this version became active
19682 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
19683 */
19684
19685/**
19686 * @class
19687 */
19688function Statistic(_ref) {
19689 var name = _ref.name,
19690 value = _ref.value,
19691 version = _ref.version;
19692
19693 /**
19694 * @type {string}
19695 */
19696 this.name = name;
19697 /**
19698 * @type {number}
19699 */
19700 this.value = value;
19701 /**
19702 * @type {number?}
19703 */
19704 this.version = version;
19705}
19706
19707var parseStatisticData = function parseStatisticData(statisticData) {
19708 var _AV$_decode = AV._decode(statisticData),
19709 name = _AV$_decode.statisticName,
19710 value = _AV$_decode.statisticValue,
19711 version = _AV$_decode.version;
19712
19713 return new Statistic({ name: name, value: value, version: version });
19714};
19715
19716/**
19717 * @class
19718 */
19719AV.Leaderboard = function Leaderboard(statisticName) {
19720 /**
19721 * @type {string}
19722 */
19723 this.statisticName = statisticName;
19724 /**
19725 * @type {AV.LeaderboardOrder}
19726 */
19727 this.order = undefined;
19728 /**
19729 * @type {AV.LeaderboardUpdateStrategy}
19730 */
19731 this.updateStrategy = undefined;
19732 /**
19733 * @type {AV.LeaderboardVersionChangeInterval}
19734 */
19735 this.versionChangeInterval = undefined;
19736 /**
19737 * @type {number}
19738 */
19739 this.version = undefined;
19740 /**
19741 * @type {Date?}
19742 */
19743 this.nextResetAt = undefined;
19744 /**
19745 * @type {Date?}
19746 */
19747 this.createdAt = undefined;
19748};
19749var Leaderboard = AV.Leaderboard;
19750
19751/**
19752 * Create an instance of Leaderboard for the give statistic name.
19753 * @param {string} statisticName
19754 * @return {AV.Leaderboard}
19755 */
19756AV.Leaderboard.createWithoutData = function (statisticName) {
19757 return new Leaderboard(statisticName);
19758};
19759/**
19760 * (masterKey required) Create a new Leaderboard.
19761 * @param {Object} options
19762 * @param {string} options.statisticName
19763 * @param {AV.LeaderboardOrder} options.order
19764 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
19765 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
19766 * @param {AuthOptions} [authOptions]
19767 * @return {Promise<AV.Leaderboard>}
19768 */
19769AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
19770 var statisticName = _ref2.statisticName,
19771 order = _ref2.order,
19772 versionChangeInterval = _ref2.versionChangeInterval,
19773 updateStrategy = _ref2.updateStrategy;
19774 return request({
19775 method: 'POST',
19776 path: '/leaderboard/leaderboards',
19777 data: {
19778 statisticName: statisticName,
19779 order: order,
19780 versionChangeInterval: versionChangeInterval,
19781 updateStrategy: updateStrategy
19782 },
19783 authOptions: authOptions
19784 }).then(function (data) {
19785 var leaderboard = new Leaderboard(statisticName);
19786 return leaderboard._finishFetch(data);
19787 });
19788};
19789/**
19790 * Get the Leaderboard with the specified statistic name.
19791 * @param {string} statisticName
19792 * @param {AuthOptions} [authOptions]
19793 * @return {Promise<AV.Leaderboard>}
19794 */
19795AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
19796 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
19797};
19798/**
19799 * Get Statistics for the specified user.
19800 * @param {AV.User} user The specified AV.User pointer.
19801 * @param {Object} [options]
19802 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
19803 * @param {AuthOptions} [authOptions]
19804 * @return {Promise<Statistic[]>}
19805 */
19806AV.Leaderboard.getStatistics = function (user) {
19807 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
19808 statisticNames = _ref3.statisticNames;
19809
19810 var authOptions = arguments[2];
19811 return _promise2.default.resolve().then(function () {
19812 if (!(user && user.id)) throw new Error('user must be an AV.User');
19813 return request({
19814 method: 'GET',
19815 path: '/leaderboard/users/' + user.id + '/statistics',
19816 query: {
19817 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
19818 },
19819 authOptions: authOptions
19820 }).then(function (_ref4) {
19821 var results = _ref4.results;
19822 return results.map(parseStatisticData);
19823 });
19824 });
19825};
19826
19827/**
19828 * Update Statistics for the specified user.
19829 * @param {AV.User} user The specified AV.User pointer.
19830 * @param {Object} statistics A name-value pair representing the statistics to update.
19831 * @param {AuthOptions} [options] AuthOptions plus:
19832 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
19833 * @return {Promise<Statistic[]>}
19834 */
19835AV.Leaderboard.updateStatistics = function (user, statistics) {
19836 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19837 return _promise2.default.resolve().then(function () {
19838 if (!(user && user.id)) throw new Error('user must be an AV.User');
19839 var data = _.map(statistics, function (value, key) {
19840 return {
19841 statisticName: key,
19842 statisticValue: value
19843 };
19844 });
19845 var overwrite = options.overwrite;
19846
19847 return request({
19848 method: 'POST',
19849 path: '/leaderboard/users/' + user.id + '/statistics',
19850 query: {
19851 overwrite: overwrite ? 1 : undefined
19852 },
19853 data: data,
19854 authOptions: options
19855 }).then(function (_ref5) {
19856 var results = _ref5.results;
19857 return results.map(parseStatisticData);
19858 });
19859 });
19860};
19861
19862/**
19863 * Delete Statistics for the specified user.
19864 * @param {AV.User} user The specified AV.User pointer.
19865 * @param {Object} statistics A name-value pair representing the statistics to delete.
19866 * @param {AuthOptions} [options]
19867 * @return {Promise<void>}
19868 */
19869AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
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: 'DELETE',
19874 path: '/leaderboard/users/' + user.id + '/statistics',
19875 query: {
19876 statistics: ensureArray(statisticNames).join(',')
19877 },
19878 authOptions: authOptions
19879 }).then(function () {
19880 return undefined;
19881 });
19882 });
19883};
19884
19885_.extend(Leaderboard.prototype,
19886/** @lends AV.Leaderboard.prototype */{
19887 _finishFetch: function _finishFetch(data) {
19888 var _this = this;
19889
19890 _.forEach(data, function (value, key) {
19891 if (key === 'updatedAt' || key === 'objectId') return;
19892 if (key === 'expiredAt') {
19893 key = 'nextResetAt';
19894 }
19895 if (key === 'createdAt') {
19896 value = parseDate(value);
19897 }
19898 if (value && value.__type === 'Date') {
19899 value = parseDate(value.iso);
19900 }
19901 _this[key] = value;
19902 });
19903 return this;
19904 },
19905
19906 /**
19907 * Fetch data from the srever.
19908 * @param {AuthOptions} [authOptions]
19909 * @return {Promise<AV.Leaderboard>}
19910 */
19911 fetch: function fetch(authOptions) {
19912 var _this2 = this;
19913
19914 return request({
19915 method: 'GET',
19916 path: '/leaderboard/leaderboards/' + this.statisticName,
19917 authOptions: authOptions
19918 }).then(function (data) {
19919 return _this2._finishFetch(data);
19920 });
19921 },
19922
19923 /**
19924 * Counts the number of users participated in this leaderboard
19925 * @param {Object} [options]
19926 * @param {number} [options.version] Specify the version of the leaderboard
19927 * @param {AuthOptions} [authOptions]
19928 * @return {Promise<number>}
19929 */
19930 count: function count() {
19931 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
19932 version = _ref6.version;
19933
19934 var authOptions = arguments[1];
19935
19936 return request({
19937 method: 'GET',
19938 path: '/leaderboard/leaderboards/' + this.statisticName + '/ranks',
19939 query: {
19940 count: 1,
19941 limit: 0,
19942 version: version
19943 },
19944 authOptions: authOptions
19945 }).then(function (_ref7) {
19946 var count = _ref7.count;
19947 return count;
19948 });
19949 },
19950 _getResults: function _getResults(_ref8, authOptions, userId) {
19951 var skip = _ref8.skip,
19952 limit = _ref8.limit,
19953 selectUserKeys = _ref8.selectUserKeys,
19954 includeUserKeys = _ref8.includeUserKeys,
19955 includeStatistics = _ref8.includeStatistics,
19956 version = _ref8.version;
19957
19958 return request({
19959 method: 'GET',
19960 path: '/leaderboard/leaderboards/' + this.statisticName + '/ranks' + (userId ? '/' + userId : ''),
19961 query: {
19962 skip: skip,
19963 limit: limit,
19964 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
19965 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
19966 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
19967 version: version
19968 },
19969 authOptions: authOptions
19970 }).then(function (_ref9) {
19971 var rankings = _ref9.results;
19972 return rankings.map(function (rankingData) {
19973 var _AV$_decode2 = AV._decode(rankingData),
19974 user = _AV$_decode2.user,
19975 value = _AV$_decode2.statisticValue,
19976 rank = _AV$_decode2.rank,
19977 _AV$_decode2$statisti = _AV$_decode2.statistics,
19978 statistics = _AV$_decode2$statisti === undefined ? [] : _AV$_decode2$statisti;
19979
19980 return {
19981 user: user,
19982 value: value,
19983 rank: rank,
19984 includedStatistics: statistics.map(parseStatisticData)
19985 };
19986 });
19987 });
19988 },
19989
19990 /**
19991 * Retrieve a list of ranked users for this Leaderboard.
19992 * @param {Object} [options]
19993 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
19994 * @param {number} [options.limit] The limit of the number of results.
19995 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
19996 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
19997 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
19998 * @param {number} [options.version] Specify the version of the leaderboard
19999 * @param {AuthOptions} [authOptions]
20000 * @return {Promise<Ranking[]>}
20001 */
20002 getResults: function getResults() {
20003 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20004 skip = _ref10.skip,
20005 limit = _ref10.limit,
20006 selectUserKeys = _ref10.selectUserKeys,
20007 includeUserKeys = _ref10.includeUserKeys,
20008 includeStatistics = _ref10.includeStatistics,
20009 version = _ref10.version;
20010
20011 var authOptions = arguments[1];
20012
20013 return this._getResults({
20014 skip: skip,
20015 limit: limit,
20016 selectUserKeys: selectUserKeys,
20017 includeUserKeys: includeUserKeys,
20018 includeStatistics: includeStatistics,
20019 version: version
20020 }, authOptions);
20021 },
20022
20023 /**
20024 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
20025 * @param {AV.User} user The specified AV.User pointer.
20026 * @param {Object} [options]
20027 * @param {number} [options.limit] The limit of the number of results.
20028 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
20029 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
20030 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
20031 * @param {number} [options.version] Specify the version of the leaderboard
20032 * @param {AuthOptions} [authOptions]
20033 * @return {Promise<Ranking[]>}
20034 */
20035 getResultsAroundUser: function getResultsAroundUser(user) {
20036 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20037 var authOptions = arguments[2];
20038
20039 // getResultsAroundUser(options, authOptions)
20040 if (user && typeof user.id !== 'string') {
20041 return this.getResultsAroundUser(undefined, user, options);
20042 }
20043 var limit = options.limit,
20044 selectUserKeys = options.selectUserKeys,
20045 includeUserKeys = options.includeUserKeys,
20046 includeStatistics = options.includeStatistics,
20047 version = options.version;
20048
20049 return this._getResults({ limit: limit, selectUserKeys: selectUserKeys, includeUserKeys: includeUserKeys, includeStatistics: includeStatistics, version: version }, authOptions, user ? user.id : 'self');
20050 },
20051 _update: function _update(data, authOptions) {
20052 var _this3 = this;
20053
20054 return request({
20055 method: 'PUT',
20056 path: '/leaderboard/leaderboards/' + this.statisticName,
20057 data: data,
20058 authOptions: authOptions
20059 }).then(function (result) {
20060 return _this3._finishFetch(result);
20061 });
20062 },
20063
20064 /**
20065 * (masterKey required) Update the version change interval of the Leaderboard.
20066 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
20067 * @param {AuthOptions} [authOptions]
20068 * @return {Promise<AV.Leaderboard>}
20069 */
20070 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
20071 return this._update({ versionChangeInterval: versionChangeInterval }, authOptions);
20072 },
20073
20074 /**
20075 * (masterKey required) Update the version change interval of the Leaderboard.
20076 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
20077 * @param {AuthOptions} [authOptions]
20078 * @return {Promise<AV.Leaderboard>}
20079 */
20080 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
20081 return this._update({ updateStrategy: updateStrategy }, authOptions);
20082 },
20083
20084 /**
20085 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
20086 * @param {AuthOptions} [authOptions]
20087 * @return {Promise<AV.Leaderboard>}
20088 */
20089 reset: function reset(authOptions) {
20090 var _this4 = this;
20091
20092 return request({
20093 method: 'PUT',
20094 path: '/leaderboard/leaderboards/' + this.statisticName + '/incrementVersion',
20095 authOptions: authOptions
20096 }).then(function (data) {
20097 return _this4._finishFetch(data);
20098 });
20099 },
20100
20101 /**
20102 * (masterKey required) Delete the Leaderboard and its all archived versions.
20103 * @param {AuthOptions} [authOptions]
20104 * @return {void}
20105 */
20106 destroy: function destroy(authOptions) {
20107 return AV.request({
20108 method: 'DELETE',
20109 path: '/leaderboard/leaderboards/' + this.statisticName,
20110 authOptions: authOptions
20111 }).then(function () {
20112 return undefined;
20113 });
20114 },
20115
20116 /**
20117 * (masterKey required) Get archived versions.
20118 * @param {Object} [options]
20119 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
20120 * @param {number} [options.limit] The limit of the number of results.
20121 * @param {AuthOptions} [authOptions]
20122 * @return {Promise<LeaderboardArchive[]>}
20123 */
20124 getArchives: function getArchives() {
20125 var _this5 = this;
20126
20127 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20128 skip = _ref11.skip,
20129 limit = _ref11.limit;
20130
20131 var authOptions = arguments[1];
20132
20133 return request({
20134 method: 'GET',
20135 path: '/leaderboard/leaderboards/' + this.statisticName + '/archives',
20136 query: {
20137 skip: skip,
20138 limit: limit
20139 },
20140 authOptions: authOptions
20141 }).then(function (_ref12) {
20142 var results = _ref12.results;
20143 return results.map(function (_ref13) {
20144 var version = _ref13.version,
20145 status = _ref13.status,
20146 url = _ref13.url,
20147 activatedAt = _ref13.activatedAt,
20148 deactivatedAt = _ref13.deactivatedAt;
20149 return {
20150 statisticName: _this5.statisticName,
20151 version: version,
20152 status: status,
20153 url: url,
20154 activatedAt: parseDate(activatedAt.iso),
20155 deactivatedAt: parseDate(deactivatedAt.iso)
20156 };
20157 });
20158 });
20159 }
20160});
20161
20162/***/ })
20163/******/ ]);
20164});
20165//# sourceMappingURL=av-core.js.map
\No newline at end of file