(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["AV"] = factory(); else root["AV"] = factory(); })(typeof self !== 'undefined' ? self : this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 277); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(7); var apply = __webpack_require__(75); var uncurryThis = __webpack_require__(4); var isCallable = __webpack_require__(8); var getOwnPropertyDescriptor = __webpack_require__(62).f; var isForced = __webpack_require__(159); var path = __webpack_require__(5); var bind = __webpack_require__(48); var createNonEnumerableProperty = __webpack_require__(37); var hasOwn = __webpack_require__(13); var wrapConstructor = function (NativeConstructor) { var Wrapper = function (a, b, c) { if (this instanceof Wrapper) { switch (arguments.length) { case 0: return new NativeConstructor(); case 1: return new NativeConstructor(a); case 2: return new NativeConstructor(a, b); } return new NativeConstructor(a, b, c); } return apply(NativeConstructor, this, arguments); }; Wrapper.prototype = NativeConstructor.prototype; return Wrapper; }; /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.dontCallGetSet - prevent calling a getter on target options.name - the .name of the function if it does not match the key */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var PROTO = options.proto; var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype; var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET]; var targetPrototype = target.prototype; var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE; var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor; for (key in source) { FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key); targetProperty = target[key]; if (USE_NATIVE) if (options.dontCallGetSet) { descriptor = getOwnPropertyDescriptor(nativeSource, key); nativeProperty = descriptor && descriptor.value; } else nativeProperty = nativeSource[key]; // export native or implementation sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key]; if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue; // bind timers to global for call from export context if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global); // wrap global constructors for prevent changs in this version else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); // make static versions for prototype methods else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty); // default case else resultProperty = sourceProperty; // add a flag to not completely full polyfills if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(resultProperty, 'sham', true); } createNonEnumerableProperty(target, key, resultProperty); if (PROTO) { VIRTUAL_PROTOTYPE = TARGET + 'Prototype'; if (!hasOwn(path, VIRTUAL_PROTOTYPE)) { createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {}); } // export virtual prototype methods createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty); // export real prototype methods if (options.real && targetPrototype && !targetPrototype[key]) { createNonEnumerableProperty(targetPrototype, key, sourceProperty); } } } }; /***/ }), /* 1 */ /***/ (function(module, exports) { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 2 */ /***/ (function(module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (error) { return true; } }; /***/ }), /* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_default_js__ = __webpack_require__(318); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__index_default_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index_js__ = __webpack_require__(132); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["VERSION"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["restArguments"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isObject"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNull"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isUndefined"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isBoolean"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isElement"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isString"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNumber"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDate"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isRegExp"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isError"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSymbol"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArrayBuffer"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDataView"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArray"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFunction"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArguments"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFinite"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNaN"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isTypedArray"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEmpty"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMatch"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEqual"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMap"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakMap"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSet"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakSet"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["keys"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["allKeys"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["values"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pairs"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invert"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["functions"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["methods"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extend"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extendOwn"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["assign"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defaults"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["create"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["clone"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tap"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["get"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["has"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mapObject"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["identity"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["constant"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["noop"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toPath"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["property"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["propertyOf"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matcher"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matches"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["times"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["random"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["now"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["escape"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unescape"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["templateSettings"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["template"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["result"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniqueId"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chain"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["iteratee"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partial"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bind"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bindAll"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["memoize"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["delay"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defer"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["throttle"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["debounce"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["wrap"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["negate"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compose"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["after"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["before"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["once"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findKey"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findIndex"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findLastIndex"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortedIndex"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexOf"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["lastIndexOf"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["find"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["detect"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findWhere"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["each"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["forEach"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["map"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["collect"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduce"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldl"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["inject"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduceRight"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldr"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["filter"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["select"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reject"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["every"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["all"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["some"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["any"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["contains"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["includes"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["include"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invoke"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pluck"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["where"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["max"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["min"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["shuffle"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sample"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortBy"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["groupBy"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexBy"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["countBy"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partition"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toArray"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["size"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pick"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["omit"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["first"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["head"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["take"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["initial"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["last"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["rest"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tail"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["drop"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compact"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["flatten"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["without"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniq"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unique"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["union"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["intersection"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["difference"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unzip"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["transpose"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["zip"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["object"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["range"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chunk"]; }); /* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mixin"]; }); // ESM Exports // =========== // This module is the package entry point for ES module users. In other words, // it is the module they are interfacing with when they import from the whole // package instead of from a submodule, like this: // // ```js // import { map } from 'underscore'; // ``` // // The difference with `./index-default`, which is the package entry point for // CommonJS, AMD and UMD users, is purely technical. In ES modules, named and // default exports are considered to be siblings, so when you have a default // export, its properties are not automatically available as named exports. For // this reason, we re-export the named exports in addition to providing the same // default export as in `./index-default`. /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { var NATIVE_BIND = __webpack_require__(76); var FunctionPrototype = Function.prototype; var bind = FunctionPrototype.bind; var call = FunctionPrototype.call; var uncurryThis = NATIVE_BIND && bind.bind(call, call); module.exports = NATIVE_BIND ? function (fn) { return fn && uncurryThis(fn); } : function (fn) { return fn && function () { return call.apply(fn, arguments); }; }; /***/ }), /* 5 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 6 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; }); // Current version. var VERSION = '1.12.1'; // Establish the root object, `window` (`self`) in the browser, `global` // on the server, or `this` in some virtual machines. We use `self` // instead of `window` for `WebWorker` support. var root = typeof self == 'object' && self.self === self && self || typeof global == 'object' && global.global === global && global || Function('return this')() || {}; // Save bytes in the minified (but not gzipped) version: var ArrayProto = Array.prototype, ObjProto = Object.prototype; var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null; // Create quick reference variables for speed access to core prototypes. var push = ArrayProto.push, slice = ArrayProto.slice, toString = ObjProto.toString, hasOwnProperty = ObjProto.hasOwnProperty; // Modern feature detection. var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined', supportsDataView = typeof DataView !== 'undefined'; // All **ECMAScript 5+** native function implementations that we hope to use // are declared here. var nativeIsArray = Array.isArray, nativeKeys = Object.keys, nativeCreate = Object.create, nativeIsView = supportsArrayBuffer && ArrayBuffer.isView; // Create references to these builtin functions because we override them. var _isNaN = isNaN, _isFinite = isFinite; // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // The largest integer that can be represented exactly. var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(74))) /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line es-x/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74))) /***/ }), /* 8 */ /***/ (function(module, exports) { // `IsCallable` abstract operation // https://tc39.es/ecma262/#sec-iscallable module.exports = function (argument) { return typeof argument == 'function'; }; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var shared = __webpack_require__(79); var hasOwn = __webpack_require__(13); var uid = __webpack_require__(99); var NATIVE_SYMBOL = __webpack_require__(64); var USE_SYMBOL_AS_UID = __webpack_require__(157); var WellKnownSymbolsStore = shared('wks'); var Symbol = global.Symbol; var symbolFor = Symbol && Symbol['for']; var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; module.exports = function (name) { if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) { var description = 'Symbol.' + name; if (NATIVE_SYMBOL && hasOwn(Symbol, name)) { WellKnownSymbolsStore[name] = Symbol[name]; } else if (USE_SYMBOL_AS_UID && symbolFor) { WellKnownSymbolsStore[name] = symbolFor(description); } else { WellKnownSymbolsStore[name] = createWellKnownSymbol(description); } } return WellKnownSymbolsStore[name]; }; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { var path = __webpack_require__(5); var hasOwn = __webpack_require__(13); var wrappedWellKnownSymbolModule = __webpack_require__(148); var defineProperty = __webpack_require__(23).f; module.exports = function (NAME) { var Symbol = path.Symbol || (path.Symbol = {}); if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) }); }; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { var isCallable = __webpack_require__(8); module.exports = function (it) { return typeof it == 'object' ? it !== null : isCallable(it); }; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(281); /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var toObject = __webpack_require__(34); var hasOwnProperty = uncurryThis({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty // eslint-disable-next-line es-x/no-object-hasown -- safe module.exports = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty(toObject(it), key); }; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(2); // Detect IE8's incomplete defineProperty implementation module.exports = !fails(function () { // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { var NATIVE_BIND = __webpack_require__(76); var call = Function.prototype.call; module.exports = NATIVE_BIND ? call.bind(call) : function () { return call.apply(call, arguments); }; /***/ }), /* 16 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = keys; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(190); // Retrieve the names of an object's own properties. // Delegates to **ECMAScript 5**'s native `Object.keys`. function keys(obj) { if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return []; if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj); var keys = []; for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key); // Ahem, IE < 9. if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys); return keys; } /***/ }), /* 17 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = tagTester; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); // Internal function for creating a `toString`-based type tester. function tagTester(name) { var tag = '[object ' + name + ']'; return function(obj) { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag; }; } /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { var path = __webpack_require__(5); var global = __webpack_require__(7); var isCallable = __webpack_require__(8); var aFunction = function (variable) { return isCallable(variable) ? variable : undefined; }; module.exports = function (namespace, method) { return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method]; }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); module.exports = uncurryThis({}.isPrototypeOf); /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(11); var $String = String; var $TypeError = TypeError; // `Assert: Type(argument) is Object` module.exports = function (argument) { if (isObject(argument)) return argument; throw $TypeError($String(argument) + ' is not an object'); }; /***/ }), /* 21 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = cb; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(200); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(201); // The function we call internally to generate a callback. It invokes // `_.iteratee` if overridden, otherwise `baseIteratee`. function cb(value, context, argCount) { 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); return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount); } /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(390); /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(14); var IE8_DOM_DEFINE = __webpack_require__(158); var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160); var anObject = __webpack_require__(20); var toPropertyKey = __webpack_require__(96); var $TypeError = TypeError; // eslint-disable-next-line es-x/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var ENUMERABLE = 'enumerable'; var CONFIGURABLE = 'configurable'; var WRITABLE = 'writable'; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) { anObject(O); P = toPropertyKey(P); anObject(Attributes); if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { var current = $getOwnPropertyDescriptor(O, P); if (current && current[WRITABLE]) { O[P] = Attributes.value; Attributes = { configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], writable: false }; } } return $defineProperty(O, P, Attributes); } : $defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPropertyKey(P); anObject(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /* 24 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = restArguments; // Some functions take a variable number of arguments, or a few expected // arguments at the beginning and then a variable number of values to operate // on. This helper accumulates all remaining arguments past the function’s // argument length (or an explicit `startIndex`), into an array that becomes // the last argument. Similar to ES6’s "rest parameter". function restArguments(func, startIndex) { startIndex = startIndex == null ? func.length - 1 : +startIndex; return function() { var length = Math.max(arguments.length - startIndex, 0), rest = Array(length), index = 0; for (; index < length; index++) { rest[index] = arguments[index + startIndex]; } switch (startIndex) { case 0: return func.call(this, rest); case 1: return func.call(this, arguments[0], rest); case 2: return func.call(this, arguments[0], arguments[1], rest); } var args = Array(startIndex + 1); for (index = 0; index < startIndex; index++) { args[index] = arguments[index]; } args[startIndex] = rest; return func.apply(this, args); }; } /***/ }), /* 25 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = _; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); // If Underscore is called as a function, it returns a wrapped object that can // be used OO-style. This wrapper holds altered versions of all functions added // through `_.mixin`. Wrapped objects may be chained. function _(obj) { if (obj instanceof _) return obj; if (!(this instanceof _)) return new _(obj); this._wrapped = obj; } _.VERSION = __WEBPACK_IMPORTED_MODULE_0__setup_js__["e" /* VERSION */]; // Extracts the result from a wrapped and chained object. _.prototype.value = function() { return this._wrapped; }; // Provide unwrapping proxies for some methods used in engine operations // such as arithmetic and JSON stringification. _.prototype.valueOf = _.prototype.toJSON = _.prototype.value; _.prototype.toString = function() { return String(this._wrapped); }; /***/ }), /* 26 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29); // Internal helper for collection methods to determine whether a collection // should be iterated as an array or as an object. // Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094 /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])); /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _concat = _interopRequireDefault(__webpack_require__(22)); var _promise = _interopRequireDefault(__webpack_require__(12)); var _ = __webpack_require__(3); var md5 = __webpack_require__(526); var _require = __webpack_require__(3), extend = _require.extend; var AV = __webpack_require__(69); var AVError = __webpack_require__(46); var _require2 = __webpack_require__(30), getSessionToken = _require2.getSessionToken; var ajax = __webpack_require__(116); // 计算 X-LC-Sign 的签名方法 var sign = function sign(key, isMasterKey) { var _context2; var now = new Date().getTime(); var signature = md5(now + key); if (isMasterKey) { var _context; return (0, _concat.default)(_context = "".concat(signature, ",")).call(_context, now, ",master"); } return (0, _concat.default)(_context2 = "".concat(signature, ",")).call(_context2, now); }; var setAppKey = function setAppKey(headers, signKey) { if (signKey) { headers['X-LC-Sign'] = sign(AV.applicationKey); } else { headers['X-LC-Key'] = AV.applicationKey; } }; var setHeaders = function setHeaders() { var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var signKey = arguments.length > 1 ? arguments[1] : undefined; var headers = { 'X-LC-Id': AV.applicationId, 'Content-Type': 'application/json;charset=UTF-8' }; var useMasterKey = false; if (typeof authOptions.useMasterKey === 'boolean') { useMasterKey = authOptions.useMasterKey; } else if (typeof AV._config.useMasterKey === 'boolean') { useMasterKey = AV._config.useMasterKey; } if (useMasterKey) { if (AV.masterKey) { if (signKey) { headers['X-LC-Sign'] = sign(AV.masterKey, true); } else { headers['X-LC-Key'] = "".concat(AV.masterKey, ",master"); } } else { console.warn('masterKey is not set, fall back to use appKey'); setAppKey(headers, signKey); } } else { setAppKey(headers, signKey); } if (AV.hookKey) { headers['X-LC-Hook-Key'] = AV.hookKey; } if (AV._config.production !== null) { headers['X-LC-Prod'] = String(AV._config.production); } headers[ false ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent; return _promise.default.resolve().then(function () { // Pass the session token var sessionToken = getSessionToken(authOptions); if (sessionToken) { headers['X-LC-Session'] = sessionToken; } else if (!AV._config.disableCurrentUser) { return AV.User.currentAsync().then(function (currentUser) { if (currentUser && currentUser._sessionToken) { headers['X-LC-Session'] = currentUser._sessionToken; } return headers; }); } return headers; }); }; var createApiUrl = function createApiUrl(_ref) { var _ref$service = _ref.service, service = _ref$service === void 0 ? 'api' : _ref$service, _ref$version = _ref.version, version = _ref$version === void 0 ? '1.1' : _ref$version, path = _ref.path; var apiURL = AV._config.serverURLs[service]; if (!apiURL) throw new Error("undefined server URL for ".concat(service)); if (apiURL.charAt(apiURL.length - 1) !== '/') { apiURL += '/'; } apiURL += version; if (path) { apiURL += path; } return apiURL; }; /** * Low level REST API client. Call REST endpoints with authorization headers. * @function AV.request * @since 3.0.0 * @param {Object} options * @param {String} options.method HTTP method * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20` * @param {Object} [options.query] query string dict * @param {Object} [options.data] HTTP body * @param {AuthOptions} [options.authOptions] * @param {String} [options.service = 'api'] * @param {String} [options.version = '1.1'] */ var request = function request(_ref2) { var service = _ref2.service, version = _ref2.version, method = _ref2.method, path = _ref2.path, query = _ref2.query, data = _ref2.data, authOptions = _ref2.authOptions, _ref2$signKey = _ref2.signKey, signKey = _ref2$signKey === void 0 ? true : _ref2$signKey; if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) { throw new Error('Not initialized'); } if (AV._appRouter) { AV._appRouter.refresh(); } var timeout = AV._config.requestTimeout; var url = createApiUrl({ service: service, path: path, version: version }); return setHeaders(authOptions, signKey).then(function (headers) { return ajax({ method: method, url: url, query: query, data: data, headers: headers, timeout: timeout }).catch(function (error) { var errorJSON = { code: error.code || -1, error: error.message || error.responseText }; if (error.response && error.response.code) { errorJSON = error.response; } else if (error.responseText) { try { errorJSON = JSON.parse(error.responseText); } catch (e) {// If we fail to parse the error text, that's okay. } } errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error; if (!AV._sharedConfig.keepErrorRawMessage) { var _context3, _context4; errorJSON.error += (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = " [".concat(error.statusCode || 'N/A', " ")).call(_context4, method, " ")).call(_context3, url, "]"); } // Transform the error into an instance of AVError by trying to parse // the error string as JSON. var err = new AVError(errorJSON.code, errorJSON.error); delete errorJSON.error; throw _.extend(err, errorJSON); }); }); }; // lagecy request var _request = function _request(route, className, objectId, method, data, authOptions, query) { var path = ''; if (route) path += "/".concat(route); if (className) path += "/".concat(className); if (objectId) path += "/".concat(objectId); // for migeration if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query'); if (data && data._where) throw new Error('_where should be in the query'); if (method && method.toLowerCase() === 'get') { query = extend({}, query, data); data = null; } return request({ method: method, path: path, query: query, data: data, authOptions: authOptions }); }; AV.request = request; module.exports = { _request: _request, request: request }; /***/ }), /* 28 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6); var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function'); // Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old // v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236). var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes; if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') { isFunction = function(obj) { return typeof obj == 'function' || false; }; } /* harmony default export */ __webpack_exports__["a"] = (isFunction); /***/ }), /* 29 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(189); // Internal helper to obtain the `length` property of an object. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length')); /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _keys = _interopRequireDefault(__webpack_require__(59)); var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147)); var _promise = _interopRequireDefault(__webpack_require__(12)); var _ = __webpack_require__(3); // Helper function to check null or undefined. var isNullOrUndefined = function isNullOrUndefined(x) { return _.isNull(x) || _.isUndefined(x); }; var ensureArray = function ensureArray(target) { if (_.isArray(target)) { return target; } if (target === undefined || target === null) { return []; } return [target]; }; var transformFetchOptions = function transformFetchOptions() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, keys = (0, _keys.default)(_ref), include = _ref.include, includeACL = _ref.includeACL; var fetchOptions = {}; if (keys) { fetchOptions.keys = ensureArray(keys).join(','); } if (include) { fetchOptions.include = ensureArray(include).join(','); } if (includeACL) { fetchOptions.returnACL = includeACL; } return fetchOptions; }; var getSessionToken = function getSessionToken(authOptions) { if (authOptions.sessionToken) { return authOptions.sessionToken; } if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') { return authOptions.user.getSessionToken(); } }; var tap = function tap(interceptor) { return function (value) { return interceptor(value), value; }; }; // Shared empty constructor function to aid in prototype-chain creation. var EmptyConstructor = function EmptyConstructor() {}; // Helper function to correctly set up the prototype chain, for subclasses. // Similar to `goog.inherits`, but uses a hash of prototype properties and // class properties to be extended. var inherits = function inherits(parent, protoProps, staticProps) { var child; // The constructor function for the new subclass is either defined by you // (the "constructor" property in your `extend` definition), or defaulted // by us to simply call the parent's constructor. if (protoProps && protoProps.hasOwnProperty('constructor')) { child = protoProps.constructor; } else { /** @ignore */ child = function child() { parent.apply(this, arguments); }; } // Inherit class (static) properties from parent. _.extend(child, parent); // Set the prototype chain to inherit from `parent`, without calling // `parent`'s constructor function. EmptyConstructor.prototype = parent.prototype; child.prototype = new EmptyConstructor(); // Add prototype properties (instance properties) to the subclass, // if supplied. if (protoProps) { _.extend(child.prototype, protoProps); } // Add static properties to the constructor function, if supplied. if (staticProps) { _.extend(child, staticProps); } // Correctly set child's `prototype.constructor`. child.prototype.constructor = child; // Set a convenience property in case the parent's prototype is // needed later. child.__super__ = parent.prototype; return child; }; var parseDate = function parseDate(iso8601) { return new Date(iso8601); }; var setValue = function setValue(target, key, value) { // '.' is not allowed in Class keys, escaping is not in concern now. var segs = key.split('.'); var lastSeg = segs.pop(); var currentTarget = target; segs.forEach(function (seg) { if (currentTarget[seg] === undefined) currentTarget[seg] = {}; currentTarget = currentTarget[seg]; }); currentTarget[lastSeg] = value; return target; }; var findValue = function findValue(target, key) { var segs = key.split('.'); var firstSeg = segs[0]; var lastSeg = segs.pop(); var currentTarget = target; for (var i = 0; i < segs.length; i++) { currentTarget = currentTarget[segs[i]]; if (currentTarget === undefined) { return [undefined, undefined, lastSeg]; } } var value = currentTarget[lastSeg]; return [value, currentTarget, lastSeg, firstSeg]; }; var isPlainObject = function isPlainObject(obj) { return _.isObject(obj) && (0, _getPrototypeOf.default)(obj) === Object.prototype; }; var continueWhile = function continueWhile(predicate, asyncFunction) { if (predicate()) { return asyncFunction().then(function () { return continueWhile(predicate, asyncFunction); }); } return _promise.default.resolve(); }; module.exports = { isNullOrUndefined: isNullOrUndefined, ensureArray: ensureArray, transformFetchOptions: transformFetchOptions, getSessionToken: getSessionToken, tap: tap, inherits: inherits, parseDate: parseDate, setValue: setValue, findValue: findValue, isPlainObject: isPlainObject, continueWhile: continueWhile }; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { var isCallable = __webpack_require__(8); var tryToString = __webpack_require__(78); var $TypeError = TypeError; // `Assert: IsCallable(argument) is true` module.exports = function (argument) { if (isCallable(argument)) return argument; throw $TypeError(tryToString(argument) + ' is not a function'); }; /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { // toObject with fallback for non-array-like ES3 strings var IndexedObject = __webpack_require__(95); var requireObjectCoercible = __webpack_require__(121); module.exports = function (it) { return IndexedObject(requireObjectCoercible(it)); }; /***/ }), /* 33 */ /***/ (function(module, exports) { module.exports = true; /***/ }), /* 34 */ /***/ (function(module, exports, __webpack_require__) { var requireObjectCoercible = __webpack_require__(121); var $Object = Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject module.exports = function (argument) { return $Object(requireObjectCoercible(argument)); }; /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(395); /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(402); /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(14); var definePropertyModule = __webpack_require__(23); var createPropertyDescriptor = __webpack_require__(47); module.exports = DESCRIPTORS ? function (object, key, value) { return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toIndexedObject = __webpack_require__(32); var addToUnscopables = __webpack_require__(169); var Iterators = __webpack_require__(50); var InternalStateModule = __webpack_require__(43); var defineProperty = __webpack_require__(23).f; var defineIterator = __webpack_require__(131); var IS_PURE = __webpack_require__(33); var DESCRIPTORS = __webpack_require__(14); var ARRAY_ITERATOR = 'Array Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method // https://tc39.es/ecma262/#sec-array.prototype.entries // `Array.prototype.keys` method // https://tc39.es/ecma262/#sec-array.prototype.keys // `Array.prototype.values` method // https://tc39.es/ecma262/#sec-array.prototype.values // `Array.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-array.prototype-@@iterator // `CreateArrayIterator` internal method // https://tc39.es/ecma262/#sec-createarrayiterator module.exports = defineIterator(Array, 'Array', function (iterated, kind) { setInternalState(this, { type: ARRAY_ITERATOR, target: toIndexedObject(iterated), // target index: 0, // next index kind: kind // kind }); // `%ArrayIteratorPrototype%.next` method // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next }, function () { var state = getInternalState(this); var target = state.target; var kind = state.kind; var index = state.index++; if (!target || index >= target.length) { state.target = undefined; return { value: undefined, done: true }; } if (kind == 'keys') return { value: index, done: false }; if (kind == 'values') return { value: target[index], done: false }; return { value: [index, target[index]], done: false }; }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% // https://tc39.es/ecma262/#sec-createunmappedargumentsobject // https://tc39.es/ecma262/#sec-createmappedargumentsobject var values = Iterators.Arguments = Iterators.Array; // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); // V8 ~ Chrome 45- bug if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try { defineProperty(values, 'name', { value: 'values' }); } catch (error) { /* empty */ } /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(38); var DOMIterables = __webpack_require__(317); var global = __webpack_require__(7); var classof = __webpack_require__(51); var createNonEnumerableProperty = __webpack_require__(37); var Iterators = __webpack_require__(50); var wellKnownSymbol = __webpack_require__(9); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); for (var COLLECTION_NAME in DOMIterables) { var Collection = global[COLLECTION_NAME]; var CollectionPrototype = Collection && Collection.prototype; if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) { createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME); } Iterators[COLLECTION_NAME] = Iterators.Array; } /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { var path = __webpack_require__(5); module.exports = function (CONSTRUCTOR) { return path[CONSTRUCTOR + 'Prototype']; }; /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { var toLength = __webpack_require__(291); // `LengthOfArrayLike` abstract operation // https://tc39.es/ecma262/#sec-lengthofarraylike module.exports = function (obj) { return toLength(obj.length); }; /***/ }), /* 42 */ /***/ (function(module, exports, __webpack_require__) { var bind = __webpack_require__(48); var call = __webpack_require__(15); var anObject = __webpack_require__(20); var tryToString = __webpack_require__(78); var isArrayIteratorMethod = __webpack_require__(166); var lengthOfArrayLike = __webpack_require__(41); var isPrototypeOf = __webpack_require__(19); var getIterator = __webpack_require__(167); var getIteratorMethod = __webpack_require__(106); var iteratorClose = __webpack_require__(168); var $TypeError = TypeError; var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; var ResultPrototype = Result.prototype; module.exports = function (iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); var fn = bind(unboundFunction, that); var iterator, iterFn, index, length, result, next, step; var stop = function (condition) { if (iterator) iteratorClose(iterator, 'normal', condition); return new Result(true, condition); }; var callFn = function (value) { if (AS_ENTRIES) { anObject(value); return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); } return INTERRUPTED ? fn(value, stop) : fn(value); }; if (IS_ITERATOR) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable'); // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { result = callFn(iterable[index]); if (result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); } iterator = getIterator(iterable, iterFn); } next = iterator.next; while (!(step = call(next, iterator)).done) { try { result = callFn(step.value); } catch (error) { iteratorClose(iterator, 'throw', error); } if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); }; /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { var NATIVE_WEAK_MAP = __webpack_require__(170); var global = __webpack_require__(7); var uncurryThis = __webpack_require__(4); var isObject = __webpack_require__(11); var createNonEnumerableProperty = __webpack_require__(37); var hasOwn = __webpack_require__(13); var shared = __webpack_require__(123); var sharedKey = __webpack_require__(101); var hiddenKeys = __webpack_require__(80); var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; var TypeError = global.TypeError; var WeakMap = global.WeakMap; var set, get, has; var enforce = function (it) { return has(it) ? get(it) : set(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get(it)).type !== TYPE) { throw TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP || shared.state) { var store = shared.state || (shared.state = new WeakMap()); var wmget = uncurryThis(store.get); var wmhas = uncurryThis(store.has); var wmset = uncurryThis(store.set); set = function (it, metadata) { if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; wmset(store, it, metadata); return metadata; }; get = function (it) { return wmget(store, it) || {}; }; has = function (it) { return wmhas(store, it); }; } else { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { return hasOwn(it, STATE) ? it[STATE] : {}; }; has = function (it) { return hasOwn(it, STATE); }; } module.exports = { set: set, get: get, has: has, enforce: enforce, getterFor: getterFor }; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { var createNonEnumerableProperty = __webpack_require__(37); module.exports = function (target, key, value, options) { if (options && options.enumerable) target[key] = value; else createNonEnumerableProperty(target, key, value); return target; }; /***/ }), /* 45 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = has; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); // Internal function to check whether `key` is an own property name of `obj`. function has(obj, key) { return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key); } /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _setPrototypeOf = _interopRequireDefault(__webpack_require__(238)); var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147)); var _ = __webpack_require__(3); /** * @class AV.Error */ function AVError(code, message) { if (this instanceof AVError ? this.constructor : void 0) { var error = new Error(message); (0, _setPrototypeOf.default)(error, (0, _getPrototypeOf.default)(this)); error.code = code; return error; } return new AVError(code, message); } AVError.prototype = Object.create(Error.prototype, { constructor: { value: Error, enumerable: false, writable: true, configurable: true } }); (0, _setPrototypeOf.default)(AVError, Error); _.extend(AVError, /** @lends AV.Error */ { /** * Error code indicating some error other than those enumerated here. * @constant */ OTHER_CAUSE: -1, /** * Error code indicating that something has gone wrong with the server. * If you get this error code, it is AV's fault. * @constant */ INTERNAL_SERVER_ERROR: 1, /** * Error code indicating the connection to the AV servers failed. * @constant */ CONNECTION_FAILED: 100, /** * Error code indicating the specified object doesn't exist. * @constant */ OBJECT_NOT_FOUND: 101, /** * Error code indicating you tried to query with a datatype that doesn't * support it, like exact matching an array or object. * @constant */ INVALID_QUERY: 102, /** * Error code indicating a missing or invalid classname. Classnames are * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the * only valid characters. * @constant */ INVALID_CLASS_NAME: 103, /** * Error code indicating an unspecified object id. * @constant */ MISSING_OBJECT_ID: 104, /** * Error code indicating an invalid key name. Keys are case-sensitive. They * must start with a letter, and a-zA-Z0-9_ are the only valid characters. * @constant */ INVALID_KEY_NAME: 105, /** * Error code indicating a malformed pointer. You should not see this unless * you have been mucking about changing internal AV code. * @constant */ INVALID_POINTER: 106, /** * Error code indicating that badly formed JSON was received upstream. This * either indicates you have done something unusual with modifying how * things encode to JSON, or the network is failing badly. * @constant */ INVALID_JSON: 107, /** * Error code indicating that the feature you tried to access is only * available internally for testing purposes. * @constant */ COMMAND_UNAVAILABLE: 108, /** * You must call AV.initialize before using the AV library. * @constant */ NOT_INITIALIZED: 109, /** * Error code indicating that a field was set to an inconsistent type. * @constant */ INCORRECT_TYPE: 111, /** * Error code indicating an invalid channel name. A channel name is either * an empty string (the broadcast channel) or contains only a-zA-Z0-9_ * characters. * @constant */ INVALID_CHANNEL_NAME: 112, /** * Error code indicating that push is misconfigured. * @constant */ PUSH_MISCONFIGURED: 115, /** * Error code indicating that the object is too large. * @constant */ OBJECT_TOO_LARGE: 116, /** * Error code indicating that the operation isn't allowed for clients. * @constant */ OPERATION_FORBIDDEN: 119, /** * Error code indicating the result was not found in the cache. * @constant */ CACHE_MISS: 120, /** * Error code indicating that an invalid key was used in a nested * JSONObject. * @constant */ INVALID_NESTED_KEY: 121, /** * Error code indicating that an invalid filename was used for AVFile. * A valid file name contains only a-zA-Z0-9_. characters and is between 1 * and 128 characters. * @constant */ INVALID_FILE_NAME: 122, /** * Error code indicating an invalid ACL was provided. * @constant */ INVALID_ACL: 123, /** * Error code indicating that the request timed out on the server. Typically * this indicates that the request is too expensive to run. * @constant */ TIMEOUT: 124, /** * Error code indicating that the email address was invalid. * @constant */ INVALID_EMAIL_ADDRESS: 125, /** * Error code indicating a missing content type. * @constant */ MISSING_CONTENT_TYPE: 126, /** * Error code indicating a missing content length. * @constant */ MISSING_CONTENT_LENGTH: 127, /** * Error code indicating an invalid content length. * @constant */ INVALID_CONTENT_LENGTH: 128, /** * Error code indicating a file that was too large. * @constant */ FILE_TOO_LARGE: 129, /** * Error code indicating an error saving a file. * @constant */ FILE_SAVE_ERROR: 130, /** * Error code indicating an error deleting a file. * @constant */ FILE_DELETE_ERROR: 153, /** * Error code indicating that a unique field was given a value that is * already taken. * @constant */ DUPLICATE_VALUE: 137, /** * Error code indicating that a role's name is invalid. * @constant */ INVALID_ROLE_NAME: 139, /** * Error code indicating that an application quota was exceeded. Upgrade to * resolve. * @constant */ EXCEEDED_QUOTA: 140, /** * Error code indicating that a Cloud Code script failed. * @constant */ SCRIPT_FAILED: 141, /** * Error code indicating that a Cloud Code validation failed. * @constant */ VALIDATION_ERROR: 142, /** * Error code indicating that invalid image data was provided. * @constant */ INVALID_IMAGE_DATA: 150, /** * Error code indicating an unsaved file. * @constant */ UNSAVED_FILE_ERROR: 151, /** * Error code indicating an invalid push time. * @constant */ INVALID_PUSH_TIME_ERROR: 152, /** * Error code indicating that the username is missing or empty. * @constant */ USERNAME_MISSING: 200, /** * Error code indicating that the password is missing or empty. * @constant */ PASSWORD_MISSING: 201, /** * Error code indicating that the username has already been taken. * @constant */ USERNAME_TAKEN: 202, /** * Error code indicating that the email has already been taken. * @constant */ EMAIL_TAKEN: 203, /** * Error code indicating that the email is missing, but must be specified. * @constant */ EMAIL_MISSING: 204, /** * Error code indicating that a user with the specified email was not found. * @constant */ EMAIL_NOT_FOUND: 205, /** * Error code indicating that a user object without a valid session could * not be altered. * @constant */ SESSION_MISSING: 206, /** * Error code indicating that a user can only be created through signup. * @constant */ MUST_CREATE_USER_THROUGH_SIGNUP: 207, /** * Error code indicating that an an account being linked is already linked * to another user. * @constant */ ACCOUNT_ALREADY_LINKED: 208, /** * Error code indicating that a user cannot be linked to an account because * that account's id could not be found. * @constant */ LINKED_ID_MISSING: 250, /** * Error code indicating that a user with a linked (e.g. Facebook) account * has an invalid session. * @constant */ INVALID_LINKED_SESSION: 251, /** * Error code indicating that a service being linked (e.g. Facebook or * Twitter) is unsupported. * @constant */ UNSUPPORTED_SERVICE: 252, /** * Error code indicating a real error code is unavailable because * we had to use an XDomainRequest object to allow CORS requests in * Internet Explorer, which strips the body from HTTP responses that have * a non-2XX status code. * @constant */ X_DOMAIN_REQUEST: 602 }); module.exports = AVError; /***/ }), /* 47 */ /***/ (function(module, exports) { module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; /***/ }), /* 48 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var aCallable = __webpack_require__(31); var NATIVE_BIND = __webpack_require__(76); var bind = uncurryThis(uncurryThis.bind); // optional / simple context binding module.exports = function (fn, that) { aCallable(fn); return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) { return fn.apply(that, arguments); }; }; /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { /* global ActiveXObject -- old IE, WSH */ var anObject = __webpack_require__(20); var definePropertiesModule = __webpack_require__(128); var enumBugKeys = __webpack_require__(127); var hiddenKeys = __webpack_require__(80); var html = __webpack_require__(165); var documentCreateElement = __webpack_require__(124); var sharedKey = __webpack_require__(101); var GT = '>'; var LT = '<'; var PROTOTYPE = 'prototype'; var SCRIPT = 'script'; var IE_PROTO = sharedKey('IE_PROTO'); var EmptyConstructor = function () { /* empty */ }; var scriptTag = function (content) { return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX = function (activeXDocument) { activeXDocument.write(scriptTag('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; activeXDocument = null; // avoid memory leak return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var JS = 'java' + SCRIPT + ':'; var iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument; var NullProtoObject = function () { try { activeXDocument = new ActiveXObject('htmlfile'); } catch (error) { /* ignore */ } NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) // old IE : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); // WSH var length = enumBugKeys.length; while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; return NullProtoObject(); }; hiddenKeys[IE_PROTO] = true; // `Object.create` method // https://tc39.es/ecma262/#sec-object.create // eslint-disable-next-line es-x/no-object-create -- safe module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === undefined ? result : definePropertiesModule.f(result, Properties); }; /***/ }), /* 50 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { var TO_STRING_TAG_SUPPORT = __webpack_require__(129); var isCallable = __webpack_require__(8); var classofRaw = __webpack_require__(63); var wellKnownSymbol = __webpack_require__(9); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $Object = Object; // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (error) { /* empty */ } }; // getting tag from ES6+ `Object.prototype.toString` module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result; }; /***/ }), /* 52 */ /***/ (function(module, exports, __webpack_require__) { var TO_STRING_TAG_SUPPORT = __webpack_require__(129); var defineProperty = __webpack_require__(23).f; var createNonEnumerableProperty = __webpack_require__(37); var hasOwn = __webpack_require__(13); var toString = __webpack_require__(298); var wellKnownSymbol = __webpack_require__(9); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); module.exports = function (it, TAG, STATIC, SET_METHOD) { if (it) { var target = STATIC ? it : it.prototype; if (!hasOwn(target, TO_STRING_TAG)) { defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG }); } if (SET_METHOD && !TO_STRING_TAG_SUPPORT) { createNonEnumerableProperty(target, 'toString', toString); } } }; /***/ }), /* 53 */ /***/ (function(module, exports) { // empty /***/ }), /* 54 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aCallable = __webpack_require__(31); var PromiseCapability = function (C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aCallable(resolve); this.reject = aCallable(reject); }; // `NewPromiseCapability` abstract operation // https://tc39.es/ecma262/#sec-newpromisecapability module.exports.f = function (C) { return new PromiseCapability(C); }; /***/ }), /* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var charAt = __webpack_require__(316).charAt; var toString = __webpack_require__(81); var InternalStateModule = __webpack_require__(43); var defineIterator = __webpack_require__(131); var STRING_ITERATOR = 'String Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-string.prototype-@@iterator defineIterator(String, 'String', function (iterated) { setInternalState(this, { type: STRING_ITERATOR, string: toString(iterated), index: 0 }); // `%StringIteratorPrototype%.next` method // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next }, function next() { var state = getInternalState(this); var string = state.string; var index = state.index; var point; if (index >= string.length) return { value: undefined, done: true }; point = charAt(string, index); state.index += point.length; return { value: point, done: false }; }); /***/ }), /* 56 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isObject; // Is a given variable an object? function isObject(obj) { var type = typeof obj; return type === 'function' || type === 'object' && !!obj; } /***/ }), /* 57 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(17); // Is a given value an array? // Delegates to ECMA5's native `Array.isArray`. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array')); /***/ }), /* 58 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = each; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16); // The cornerstone for collection functions, an `each` // implementation, aka `forEach`. // Handles raw objects in addition to array-likes. Treats all // sparse array-likes as if they were dense. function each(obj, iteratee, context) { iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context); var i, length; if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) { for (i = 0, length = obj.length; i < length; i++) { iteratee(obj[i], i, obj); } } else { var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj); for (i = 0, length = _keys.length; i < length; i++) { iteratee(obj[_keys[i]], _keys[i], obj); } } return obj; } /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(408); /***/ }), /* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; function _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); } /* eslint-env browser */ /** * This is the web browser implementation of `debug()`. */ exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = localstorage(); /** * Colors. */ exports.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']; /** * Currently only WebKit-based Web Inspectors, Firefox >= v31, * and the Firebug extension (any Firefox version) are known * to support "%c" CSS customizations. * * TODO: add a `localStorage` variable to explicitly enable/disable colors */ // eslint-disable-next-line complexity function useColors() { // NB: In an Electron preload script, document will be defined but not fully // initialized. Since we know we're in Chrome, we'll just detect this case // explicitly if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { return true; } // Internet Explorer and Edge do not support colors. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { return false; } // Is webkit? http://stackoverflow.com/a/16459606/376773 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages 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 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } /** * Colorize log arguments if enabled. * * @api public */ function formatArgs(args) { args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); if (!this.useColors) { return; } var c = 'color: ' + this.color; args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other // arguments passed either before or after the %c, so we need to // figure out the correct index to insert the CSS into var index = 0; var lastC = 0; args[0].replace(/%[a-zA-Z%]/g, function (match) { if (match === '%%') { return; } index++; if (match === '%c') { // We only are interested in the *last* %c // (the user may have provided their own) lastC = index; } }); args.splice(lastC, 0, c); } /** * Invokes `console.log()` when available. * No-op when `console.log` is not a "function". * * @api public */ function log() { var _console; // This hackery is required for IE8/9, where // the `console.log` function doesn't have 'apply' return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments); } /** * Save `namespaces`. * * @param {String} namespaces * @api private */ function save(namespaces) { try { if (namespaces) { exports.storage.setItem('debug', namespaces); } else { exports.storage.removeItem('debug'); } } catch (error) {// Swallow // XXX (@Qix-) should we be logging these? } } /** * Load `namespaces`. * * @return {String} returns the previously persisted debug modes * @api private */ function load() { var r; try { r = exports.storage.getItem('debug'); } catch (error) {} // Swallow // XXX (@Qix-) should we be logging these? // If debug isn't set in LS, and we're in Electron, try to load $DEBUG if (!r && typeof process !== 'undefined' && 'env' in process) { r = process.env.DEBUG; } return r; } /** * Localstorage attempts to return the localstorage. * * This is necessary because safari throws * when a user disables cookies/localstorage * and you attempt to access it. * * @return {LocalStorage} * @api private */ function localstorage() { try { // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context // The Browser also has localStorage in the global context. return localStorage; } catch (error) {// Swallow // XXX (@Qix-) should we be logging these? } } module.exports = __webpack_require__(413)(exports); var formatters = module.exports.formatters; /** * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. */ formatters.j = function (v) { try { return JSON.stringify(v); } catch (error) { return '[UnexpectedJSONParseError]: ' + error.message; } }; /***/ }), /* 61 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(240); /***/ }), /* 62 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(14); var call = __webpack_require__(15); var propertyIsEnumerableModule = __webpack_require__(120); var createPropertyDescriptor = __webpack_require__(47); var toIndexedObject = __webpack_require__(32); var toPropertyKey = __webpack_require__(96); var hasOwn = __webpack_require__(13); var IE8_DOM_DEFINE = __webpack_require__(158); // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPropertyKey(P); if (IE8_DOM_DEFINE) try { return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); }; /***/ }), /* 63 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var toString = uncurryThis({}.toString); var stringSlice = uncurryThis(''.slice); module.exports = function (it) { return stringSlice(toString(it), 8, -1); }; /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable es-x/no-symbol -- required for testing */ var V8_VERSION = __webpack_require__(77); var fails = __webpack_require__(2); // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing module.exports = !!Object.getOwnPropertySymbols && !fails(function () { var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances return !String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); module.exports = global.Promise; /***/ }), /* 66 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = values; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16); // Retrieve the values of an object's properties. function values(obj) { var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj); var length = _keys.length; var values = Array(length); for (var i = 0; i < length; i++) { values[i] = obj[_keys[i]]; } return values; } /***/ }), /* 67 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = flatten; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(57); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(135); // Internal implementation of a recursive `flatten` function. function flatten(input, depth, strict, output) { output = output || []; if (!depth && depth !== 0) { depth = Infinity; } else if (depth <= 0) { return output.concat(input); } var idx = output.length; for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) { var value = input[i]; 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))) { // Flatten current level of array or arguments object. if (depth > 1) { flatten(value, depth - 1, strict, output); idx = output.length; } else { var j = 0, len = value.length; while (j < len) output[idx++] = value[j++]; } } else if (!strict) { output[idx++] = value; } } return output; } /***/ }), /* 68 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = map; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16); // Return the results of applying the iteratee to each element. function map(obj, iteratee, context) { iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context); var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj), length = (_keys || obj).length, results = Array(length); for (var index = 0; index < length; index++) { var currentKey = _keys ? _keys[index] : index; results[index] = iteratee(obj[currentKey], currentKey, obj); } return results; } /***/ }), /* 69 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _map = _interopRequireDefault(__webpack_require__(35)); var _keys = _interopRequireDefault(__webpack_require__(115)); var _stringify = _interopRequireDefault(__webpack_require__(36)); var _indexOf = _interopRequireDefault(__webpack_require__(71)); var _keys2 = _interopRequireDefault(__webpack_require__(59)); var _ = __webpack_require__(3); var uuid = __webpack_require__(232); var debug = __webpack_require__(60); var _require = __webpack_require__(30), inherits = _require.inherits, parseDate = _require.parseDate; var version = __webpack_require__(234); var _require2 = __webpack_require__(72), setAdapters = _require2.setAdapters, adapterManager = _require2.adapterManager; var AV = global.AV || {}; // All internal configuration items AV._config = { serverURLs: {}, useMasterKey: false, production: null, realtime: null, requestTimeout: null }; var initialUserAgent = "LeanCloud-JS-SDK/".concat(version); // configs shared by all AV instances AV._sharedConfig = { userAgent: initialUserAgent, liveQueryRealtime: null }; adapterManager.on('platformInfo', function (platformInfo) { var ua = initialUserAgent; if (platformInfo) { if (platformInfo.userAgent) { ua = platformInfo.userAgent; } else { var comments = platformInfo.name; if (platformInfo.version) { comments += "/".concat(platformInfo.version); } if (platformInfo.extra) { comments += "; ".concat(platformInfo.extra); } ua += " (".concat(comments, ")"); } } AV._sharedConfig.userAgent = ua; }); /** * Contains all AV API classes and functions. * @namespace AV */ /** * Returns prefix for localStorage keys used by this instance of AV. * @param {String} path The relative suffix to append to it. * null or undefined is treated as the empty string. * @return {String} The full key name. * @private */ AV._getAVPath = function (path) { if (!AV.applicationId) { throw new Error('You need to call AV.initialize before using AV.'); } if (!path) { path = ''; } if (!_.isString(path)) { throw new Error("Tried to get a localStorage path that wasn't a String."); } if (path[0] === '/') { path = path.substring(1); } return 'AV/' + AV.applicationId + '/' + path; }; /** * Returns the unique string for this app on this machine. * Gets reset when localStorage is cleared. * @private */ AV._installationId = null; AV._getInstallationId = function () { // See if it's cached in RAM. if (AV._installationId) { return _promise.default.resolve(AV._installationId); } // Try to get it from localStorage. var path = AV._getAVPath('installationId'); return AV.localStorage.getItemAsync(path).then(function (_installationId) { AV._installationId = _installationId; if (!AV._installationId) { // It wasn't in localStorage, so create a new one. AV._installationId = _installationId = uuid(); return AV.localStorage.setItemAsync(path, _installationId).then(function () { return _installationId; }); } return _installationId; }); }; AV._subscriptionId = null; AV._refreshSubscriptionId = function () { var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId'); var subscriptionId = AV._subscriptionId = uuid(); return AV.localStorage.setItemAsync(path, subscriptionId).then(function () { return subscriptionId; }); }; AV._getSubscriptionId = function () { // See if it's cached in RAM. if (AV._subscriptionId) { return _promise.default.resolve(AV._subscriptionId); } // Try to get it from localStorage. var path = AV._getAVPath('subscriptionId'); return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) { AV._subscriptionId = _subscriptionId; if (!AV._subscriptionId) { // It wasn't in localStorage, so create a new one. _subscriptionId = AV._refreshSubscriptionId(path); } return _subscriptionId; }); }; AV._parseDate = parseDate; // A self-propagating extend function. AV._extend = function (protoProps, classProps) { var child = inherits(this, protoProps, classProps); child.extend = this.extend; return child; }; /** * Converts a value in a AV Object into the appropriate representation. * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object) * if seenObjects is falsey. Otherwise any AV.Objects not in * seenObjects will be fully embedded rather than encoded * as a pointer. This array will be used to prevent going into an infinite * loop because we have circular references. If * is set, then none of the AV Objects that are serialized can be dirty. * @private */ AV._encode = function (value, seenObjects, disallowObjects) { var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; if (value instanceof AV.Object) { if (disallowObjects) { throw new Error('AV.Objects not allowed here'); } if (!seenObjects || _.include(seenObjects, value) || !value._hasData) { return value._toPointer(); } return value._toFullJSON((0, _concat.default)(seenObjects).call(seenObjects, value), full); } if (value instanceof AV.ACL) { return value.toJSON(); } if (_.isDate(value)) { return full ? { __type: 'Date', iso: value.toJSON() } : value.toJSON(); } if (value instanceof AV.GeoPoint) { return value.toJSON(); } if (_.isArray(value)) { return (0, _map.default)(_).call(_, value, function (x) { return AV._encode(x, seenObjects, disallowObjects, full); }); } if (_.isRegExp(value)) { return value.source; } if (value instanceof AV.Relation) { return value.toJSON(); } if (value instanceof AV.Op) { return value.toJSON(); } if (value instanceof AV.File) { if (!value.url() && !value.id) { throw new Error('Tried to save an object containing an unsaved file.'); } return value._toFullJSON(seenObjects, full); } if (_.isObject(value)) { return _.mapObject(value, function (v, k) { return AV._encode(v, seenObjects, disallowObjects, full); }); } return value; }; /** * The inverse function of AV._encode. * @private */ AV._decode = function (value, key) { if (!_.isObject(value) || _.isDate(value)) { return value; } if (_.isArray(value)) { return (0, _map.default)(_).call(_, value, function (v) { return AV._decode(v); }); } if (value instanceof AV.Object) { return value; } if (value instanceof AV.File) { return value; } if (value instanceof AV.Op) { return value; } if (value instanceof AV.GeoPoint) { return value; } if (value instanceof AV.ACL) { return value; } if (key === 'ACL') { return new AV.ACL(value); } if (value.__op) { return AV.Op._decode(value); } var className; if (value.__type === 'Pointer') { className = value.className; var pointer = AV.Object._create(className); if ((0, _keys.default)(value).length > 3) { var v = _.clone(value); delete v.__type; delete v.className; pointer._finishFetch(v, true); } else { pointer._finishFetch({ objectId: value.objectId }, false); } return pointer; } if (value.__type === 'Object') { // It's an Object included in a query result. className = value.className; var _v = _.clone(value); delete _v.__type; delete _v.className; var object = AV.Object._create(className); object._finishFetch(_v, true); return object; } if (value.__type === 'Date') { return AV._parseDate(value.iso); } if (value.__type === 'GeoPoint') { return new AV.GeoPoint({ latitude: value.latitude, longitude: value.longitude }); } if (value.__type === 'Relation') { if (!key) throw new Error('key missing decoding a Relation'); var relation = new AV.Relation(null, key); relation.targetClassName = value.className; return relation; } if (value.__type === 'File') { var file = new AV.File(value.name); var _v2 = _.clone(value); delete _v2.__type; file._finishFetch(_v2); return file; } return _.mapObject(value, AV._decode); }; /** * The inverse function of {@link AV.Object#toFullJSON}. * @since 3.0.0 * @method * @param {Object} * return {AV.Object|AV.File|any} */ AV.parseJSON = AV._decode; /** * Similar to JSON.parse, except that AV internal types will be used if possible. * Inverse to {@link AV.stringify} * @since 3.14.0 * @param {string} text the string to parse. * @return {AV.Object|AV.File|any} */ AV.parse = function (text) { return AV.parseJSON(JSON.parse(text)); }; /** * Serialize a target containing AV.Object, similar to JSON.stringify. * Inverse to {@link AV.parse} * @since 3.14.0 * @return {string} */ AV.stringify = function (target) { return (0, _stringify.default)(AV._encode(target, [], false, true)); }; AV._encodeObjectOrArray = function (value) { var encodeAVObject = function encodeAVObject(object) { if (object && object._toFullJSON) { object = object._toFullJSON([]); } return _.mapObject(object, function (value) { return AV._encode(value, []); }); }; if (_.isArray(value)) { return (0, _map.default)(value).call(value, function (object) { return encodeAVObject(object); }); } else { return encodeAVObject(value); } }; AV._arrayEach = _.each; /** * Does a deep traversal of every item in object, calling func on every one. * @param {Object} object The object or array to traverse deeply. * @param {Function} func The function to call for every item. It will * be passed the item as an argument. If it returns a truthy value, that * value will replace the item in its parent container. * @returns {} the result of calling func on the top-level object itself. * @private */ AV._traverse = function (object, func, seen) { if (object instanceof AV.Object) { seen = seen || []; if ((0, _indexOf.default)(_).call(_, seen, object) >= 0) { // We've already visited this object in this call. return; } seen.push(object); AV._traverse(object.attributes, func, seen); return func(object); } if (object instanceof AV.Relation || object instanceof AV.File) { // Nothing needs to be done, but we don't want to recurse into the // object's parent infinitely, so we catch this case. return func(object); } if (_.isArray(object)) { _.each(object, function (child, index) { var newChild = AV._traverse(child, func, seen); if (newChild) { object[index] = newChild; } }); return func(object); } if (_.isObject(object)) { AV._each(object, function (child, key) { var newChild = AV._traverse(child, func, seen); if (newChild) { object[key] = newChild; } }); return func(object); } return func(object); }; /** * This is like _.each, except: * * it doesn't work for so-called array-like objects, * * it does work for dictionaries with a "length" attribute. * @private */ AV._objectEach = AV._each = function (obj, callback) { if (_.isObject(obj)) { _.each((0, _keys2.default)(_).call(_, obj), function (key) { callback(obj[key], key); }); } else { _.each(obj, callback); } }; /** * @namespace * @since 3.14.0 */ AV.debug = { /** * Enable debug */ enable: function enable() { var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*'; return debug.enable(namespaces); }, /** * Disable debug */ disable: debug.disable }; /** * Specify Adapters * @since 4.4.0 * @function * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions. */ AV.setAdapters = setAdapters; module.exports = AV; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74))) /***/ }), /* 70 */ /***/ (function(module, exports, __webpack_require__) { var bind = __webpack_require__(48); var uncurryThis = __webpack_require__(4); var IndexedObject = __webpack_require__(95); var toObject = __webpack_require__(34); var lengthOfArrayLike = __webpack_require__(41); var arraySpeciesCreate = __webpack_require__(229); var push = uncurryThis([].push); // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation var createMethod = function (TYPE) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; var IS_FILTER_REJECT = TYPE == 7; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { var O = toObject($this); var self = IndexedObject(O); var boundFunction = bind(callbackfn, that); var length = lengthOfArrayLike(self); var index = 0; var create = specificCreate || arraySpeciesCreate; var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined; var value, result; for (;length > index; index++) if (NO_HOLES || index in self) { value = self[index]; result = boundFunction(value, index, O); if (TYPE) { if (IS_MAP) target[index] = result; // map else if (result) switch (TYPE) { case 3: return true; // some case 5: return value; // find case 6: return index; // findIndex case 2: push(target, value); // filter } else switch (TYPE) { case 4: return false; // every case 7: push(target, value); // filterReject } } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; }; module.exports = { // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach forEach: createMethod(0), // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map map: createMethod(1), // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter filter: createMethod(2), // `Array.prototype.some` method // https://tc39.es/ecma262/#sec-array.prototype.some some: createMethod(3), // `Array.prototype.every` method // https://tc39.es/ecma262/#sec-array.prototype.every every: createMethod(4), // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find find: createMethod(5), // `Array.prototype.findIndex` method // https://tc39.es/ecma262/#sec-array.prototype.findIndex findIndex: createMethod(6), // `Array.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering filterReject: createMethod(7) }; /***/ }), /* 71 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(404); /***/ }), /* 72 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _keys = _interopRequireDefault(__webpack_require__(59)); var _ = __webpack_require__(3); var EventEmitter = __webpack_require__(235); var _require = __webpack_require__(30), inherits = _require.inherits; var AdapterManager = inherits(EventEmitter, { constructor: function constructor() { EventEmitter.apply(this); this._adapters = {}; }, getAdapter: function getAdapter(name) { var adapter = this._adapters[name]; if (adapter === undefined) { throw new Error("".concat(name, " adapter is not configured")); } return adapter; }, setAdapters: function setAdapters(newAdapters) { var _this = this; _.extend(this._adapters, newAdapters); (0, _keys.default)(_).call(_, newAdapters).forEach(function (name) { return _this.emit(name, newAdapters[name]); }); } }); var adapterManager = new AdapterManager(); module.exports = { getAdapter: adapterManager.getAdapter.bind(adapterManager), setAdapters: adapterManager.setAdapters.bind(adapterManager), adapterManager: adapterManager }; /***/ }), /* 73 */ /***/ (function(module, exports, __webpack_require__) { var _Symbol = __webpack_require__(242); var _Symbol$iterator = __webpack_require__(459); function _typeof(obj) { "@babel/helpers - typeof"; return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj; }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj); } module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 74 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || Function("return this")() || (1,eval)("this"); } catch(e) { // This works if the window reference is available if(typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 75 */ /***/ (function(module, exports, __webpack_require__) { var NATIVE_BIND = __webpack_require__(76); var FunctionPrototype = Function.prototype; var apply = FunctionPrototype.apply; var call = FunctionPrototype.call; // eslint-disable-next-line es-x/no-reflect -- safe module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () { return call.apply(apply, arguments); }); /***/ }), /* 76 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(2); module.exports = !fails(function () { // eslint-disable-next-line es-x/no-function-prototype-bind -- safe var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe return typeof test != 'function' || test.hasOwnProperty('prototype'); }); /***/ }), /* 77 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var userAgent = __webpack_require__(98); var process = global.process; var Deno = global.Deno; var versions = process && process.versions || Deno && Deno.version; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 // but their correct versions are not interesting for us version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` // so check `userAgent` even if `.v8` exists, but 0 if (!version && userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); if (match) version = +match[1]; } } module.exports = version; /***/ }), /* 78 */ /***/ (function(module, exports) { var $String = String; module.exports = function (argument) { try { return $String(argument); } catch (error) { return 'Object'; } }; /***/ }), /* 79 */ /***/ (function(module, exports, __webpack_require__) { var IS_PURE = __webpack_require__(33); var store = __webpack_require__(123); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.23.3', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)', license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE', source: 'https://github.com/zloirock/core-js' }); /***/ }), /* 80 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 81 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(51); var $String = String; module.exports = function (argument) { if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string'); return $String(argument); }; /***/ }), /* 82 */ /***/ (function(module, exports) { module.exports = function (exec) { try { return { error: false, value: exec() }; } catch (error) { return { error: true, value: error }; } }; /***/ }), /* 83 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var NativePromiseConstructor = __webpack_require__(65); var isCallable = __webpack_require__(8); var isForced = __webpack_require__(159); var inspectSource = __webpack_require__(130); var wellKnownSymbol = __webpack_require__(9); var IS_BROWSER = __webpack_require__(307); var IS_PURE = __webpack_require__(33); var V8_VERSION = __webpack_require__(77); var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; var SPECIES = wellKnownSymbol('species'); var SUBCLASSING = false; var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent); var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () { var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor); var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor); // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 // We can't detect it synchronously, so just check versions if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true; // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true; // We can't use @@species feature detection in V8 since it causes // deoptimization and performance degradation // https://github.com/zloirock/core-js/issues/679 if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false; // Detect correctness of subclassing with @@species support var promise = new NativePromiseConstructor(function (resolve) { resolve(1); }); var FakePromise = function (exec) { exec(function () { /* empty */ }, function () { /* empty */ }); }; var constructor = promise.constructor = {}; constructor[SPECIES] = FakePromise; SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; if (!SUBCLASSING) return true; // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT; }); module.exports = { CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR, REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT, SUBCLASSING: SUBCLASSING }; /***/ }), /* 84 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(324); // In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`. // In IE 11, the most common among them, this problem also applies to // `Map`, `WeakMap` and `Set`. var hasStringTagBug = ( __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8))) ), isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map)); /***/ }), /* 85 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = allKeys; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(190); // Retrieve all the enumerable property names of an object. function allKeys(obj) { if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return []; var keys = []; for (var key in obj) keys.push(key); // Ahem, IE < 9. if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys); return keys; } /***/ }), /* 86 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = toPath; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(199); // Internal wrapper for `_.toPath` to enable minification. // Similar to `cb` for `_.iteratee`. function toPath(path) { return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path); } /***/ }), /* 87 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb; // Internal function that returns an efficient (for current engines) version // of the passed-in callback, to be repeatedly applied in other Underscore // functions. function optimizeCb(func, context, argCount) { if (context === void 0) return func; switch (argCount == null ? 3 : argCount) { case 1: return function(value) { return func.call(context, value); }; // The 2-argument case is omitted because we’re not using it. case 3: return function(value, index, collection) { return func.call(context, value, index, collection); }; case 4: return function(accumulator, value, index, collection) { return func.call(context, accumulator, value, index, collection); }; } return function() { return func.apply(context, arguments); }; } /***/ }), /* 88 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = filter; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58); // Return all the elements that pass a truth test. function filter(obj, predicate, context) { var results = []; predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context); Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) { if (predicate(value, index, list)) results.push(value); }); return results; } /***/ }), /* 89 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = contains; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(215); // Determine if the array or object contains a given item (using `===`). function contains(obj, item, fromIndex, guard) { if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj); if (typeof fromIndex != 'number' || guard) fromIndex = 0; return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0; } /***/ }), /* 90 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(63); // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray // eslint-disable-next-line es-x/no-array-isarray -- safe module.exports = Array.isArray || function isArray(argument) { return classof(argument) == 'Array'; }; /***/ }), /* 91 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toPropertyKey = __webpack_require__(96); var definePropertyModule = __webpack_require__(23); var createPropertyDescriptor = __webpack_require__(47); module.exports = function (object, key, value) { var propertyKey = toPropertyKey(key); if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value)); else object[propertyKey] = value; }; /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(241); /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(472); /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var uncurryThis = __webpack_require__(4); var hiddenKeys = __webpack_require__(80); var isObject = __webpack_require__(11); var hasOwn = __webpack_require__(13); var defineProperty = __webpack_require__(23).f; var getOwnPropertyNamesModule = __webpack_require__(103); var getOwnPropertyNamesExternalModule = __webpack_require__(245); var isExtensible = __webpack_require__(261); var uid = __webpack_require__(99); var FREEZING = __webpack_require__(262); var REQUIRED = false; var METADATA = uid('meta'); var id = 0; var setMetadata = function (it) { defineProperty(it, METADATA, { value: { objectID: 'O' + id++, // object ID weakData: {} // weak collections IDs } }); }; var fastKey = function (it, create) { // return a primitive with prefix if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return 'F'; // not necessary to add metadata if (!create) return 'E'; // add missing metadata setMetadata(it); // return object ID } return it[METADATA].objectID; }; var getWeakData = function (it, create) { if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return true; // not necessary to add metadata if (!create) return false; // add missing metadata setMetadata(it); // return the store of weak collections IDs } return it[METADATA].weakData; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it); return it; }; var enable = function () { meta.enable = function () { /* empty */ }; REQUIRED = true; var getOwnPropertyNames = getOwnPropertyNamesModule.f; var splice = uncurryThis([].splice); var test = {}; test[METADATA] = 1; // prevent exposing of metadata key if (getOwnPropertyNames(test).length) { getOwnPropertyNamesModule.f = function (it) { var result = getOwnPropertyNames(it); for (var i = 0, length = result.length; i < length; i++) { if (result[i] === METADATA) { splice(result, i, 1); break; } } return result; }; $({ target: 'Object', stat: true, forced: true }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f }); } }; var meta = module.exports = { enable: enable, fastKey: fastKey, getWeakData: getWeakData, onFreeze: onFreeze }; hiddenKeys[METADATA] = true; /***/ }), /* 95 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var fails = __webpack_require__(2); var classof = __webpack_require__(63); var $Object = Object; var split = uncurryThis(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings module.exports = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !$Object('z').propertyIsEnumerable(0); }) ? function (it) { return classof(it) == 'String' ? split(it, '') : $Object(it); } : $Object; /***/ }), /* 96 */ /***/ (function(module, exports, __webpack_require__) { var toPrimitive = __webpack_require__(285); var isSymbol = __webpack_require__(97); // `ToPropertyKey` abstract operation // https://tc39.es/ecma262/#sec-topropertykey module.exports = function (argument) { var key = toPrimitive(argument, 'string'); return isSymbol(key) ? key : key + ''; }; /***/ }), /* 97 */ /***/ (function(module, exports, __webpack_require__) { var getBuiltIn = __webpack_require__(18); var isCallable = __webpack_require__(8); var isPrototypeOf = __webpack_require__(19); var USE_SYMBOL_AS_UID = __webpack_require__(157); var $Object = Object; module.exports = USE_SYMBOL_AS_UID ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn('Symbol'); return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it)); }; /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { var getBuiltIn = __webpack_require__(18); module.exports = getBuiltIn('navigator', 'userAgent') || ''; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var id = 0; var postfix = Math.random(); var toString = uncurryThis(1.0.toString); module.exports = function (key) { return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36); }; /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { var hasOwn = __webpack_require__(13); var isCallable = __webpack_require__(8); var toObject = __webpack_require__(34); var sharedKey = __webpack_require__(101); var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161); var IE_PROTO = sharedKey('IE_PROTO'); var $Object = Object; var ObjectPrototype = $Object.prototype; // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof // eslint-disable-next-line es-x/no-object-getprototypeof -- safe module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) { var object = toObject(O); if (hasOwn(object, IE_PROTO)) return object[IE_PROTO]; var constructor = object.constructor; if (isCallable(constructor) && object instanceof constructor) { return constructor.prototype; } return object instanceof $Object ? ObjectPrototype : null; }; /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { var shared = __webpack_require__(79); var uid = __webpack_require__(99); var keys = shared('keys'); module.exports = function (key) { return keys[key] || (keys[key] = uid(key)); }; /***/ }), /* 102 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable no-proto -- safe */ var uncurryThis = __webpack_require__(4); var anObject = __webpack_require__(20); var aPossiblePrototype = __webpack_require__(288); // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. // eslint-disable-next-line es-x/no-object-setprototypeof -- safe module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set); setter(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ } return function setPrototypeOf(O, proto) { anObject(O); aPossiblePrototype(proto); if (CORRECT_SETTER) setter(O, proto); else O.__proto__ = proto; return O; }; }() : undefined); /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { var internalObjectKeys = __webpack_require__(163); var enumBugKeys = __webpack_require__(127); var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys(O, hiddenKeys); }; /***/ }), /* 104 */ /***/ (function(module, exports) { // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe exports.f = Object.getOwnPropertySymbols; /***/ }), /* 105 */ /***/ (function(module, exports, __webpack_require__) { var internalObjectKeys = __webpack_require__(163); var enumBugKeys = __webpack_require__(127); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys // eslint-disable-next-line es-x/no-object-keys -- safe module.exports = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys); }; /***/ }), /* 106 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(51); var getMethod = __webpack_require__(122); var Iterators = __webpack_require__(50); var wellKnownSymbol = __webpack_require__(9); var ITERATOR = wellKnownSymbol('iterator'); module.exports = function (it) { if (it != undefined) return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)]; }; /***/ }), /* 107 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(63); var global = __webpack_require__(7); module.exports = classof(global.process) == 'process'; /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { var isPrototypeOf = __webpack_require__(19); var $TypeError = TypeError; module.exports = function (it, Prototype) { if (isPrototypeOf(Prototype, it)) return it; throw $TypeError('Incorrect invocation'); }; /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var fails = __webpack_require__(2); var isCallable = __webpack_require__(8); var classof = __webpack_require__(51); var getBuiltIn = __webpack_require__(18); var inspectSource = __webpack_require__(130); var noop = function () { /* empty */ }; var empty = []; var construct = getBuiltIn('Reflect', 'construct'); var constructorRegExp = /^\s*(?:class|function)\b/; var exec = uncurryThis(constructorRegExp.exec); var INCORRECT_TO_STRING = !constructorRegExp.exec(noop); var isConstructorModern = function isConstructor(argument) { if (!isCallable(argument)) return false; try { construct(noop, empty, argument); return true; } catch (error) { return false; } }; var isConstructorLegacy = function isConstructor(argument) { if (!isCallable(argument)) return false; switch (classof(argument)) { case 'AsyncFunction': case 'GeneratorFunction': case 'AsyncGeneratorFunction': return false; } try { // we can't check .prototype since constructors produced by .bind haven't it // `Function#toString` throws on some built-it function in some legacy engines // (for example, `DOMQuad` and similar in FF41-) return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument)); } catch (error) { return true; } }; isConstructorLegacy.sham = true; // `IsConstructor` abstract operation // https://tc39.es/ecma262/#sec-isconstructor module.exports = !construct || fails(function () { var called; return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () { called = true; }) || called; }) ? isConstructorLegacy : isConstructorModern; /***/ }), /* 110 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); module.exports = uncurryThis([].slice); /***/ }), /* 111 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = matcher; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(139); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(191); // Returns a predicate for checking whether an object has a given set of // `key:value` pairs. function matcher(attrs) { attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs); return function(obj) { return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs); }; } /***/ }), /* 112 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(207); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25); // Partially apply a function by creating a version that has had some of its // arguments pre-filled, without changing its dynamic `this` context. `_` acts // as a placeholder by default, allowing any combination of arguments to be // pre-filled. Set `_.partial.placeholder` for a custom placeholder argument. var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) { var placeholder = partial.placeholder; var bound = function() { var position = 0, length = boundArgs.length; var args = Array(length); for (var i = 0; i < length; i++) { args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i]; } while (position < arguments.length) args.push(arguments[position++]); return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args); }; return bound; }); partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */]; /* harmony default export */ __webpack_exports__["a"] = (partial); /***/ }), /* 113 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = group; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58); // An internal function used for aggregate "group by" operations. function group(behavior, partition) { return function(obj, iteratee, context) { var result = partition ? [[], []] : {}; iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context); Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) { var key = iteratee(value, index, obj); behavior(result, value, key); }); return result; }; } /***/ }), /* 114 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(2); var wellKnownSymbol = __webpack_require__(9); var V8_VERSION = __webpack_require__(77); var SPECIES = wellKnownSymbol('species'); module.exports = function (METHOD_NAME) { // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/677 return V8_VERSION >= 51 || !fails(function () { var array = []; var constructor = array.constructor = {}; constructor[SPECIES] = function () { return { foo: 1 }; }; return array[METHOD_NAME](Boolean).foo !== 1; }); }; /***/ }), /* 115 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(399); /***/ }), /* 116 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _typeof2 = _interopRequireDefault(__webpack_require__(73)); var _filter = _interopRequireDefault(__webpack_require__(250)); var _map = _interopRequireDefault(__webpack_require__(35)); var _keys = _interopRequireDefault(__webpack_require__(115)); var _stringify = _interopRequireDefault(__webpack_require__(36)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _ = __webpack_require__(3); var _require = __webpack_require__(251), timeout = _require.timeout; var debug = __webpack_require__(60); var debugRequest = debug('leancloud:request'); var debugRequestError = debug('leancloud:request:error'); var _require2 = __webpack_require__(72), getAdapter = _require2.getAdapter; var requestsCount = 0; var ajax = function ajax(_ref) { var method = _ref.method, url = _ref.url, query = _ref.query, data = _ref.data, _ref$headers = _ref.headers, headers = _ref$headers === void 0 ? {} : _ref$headers, time = _ref.timeout, onprogress = _ref.onprogress; if (query) { var _context, _context2, _context4; var queryString = (0, _filter.default)(_context = (0, _map.default)(_context2 = (0, _keys.default)(query)).call(_context2, function (key) { var _context3; var value = query[key]; if (value === undefined) return undefined; var v = (0, _typeof2.default)(value) === 'object' ? (0, _stringify.default)(value) : value; return (0, _concat.default)(_context3 = "".concat(encodeURIComponent(key), "=")).call(_context3, encodeURIComponent(v)); })).call(_context, function (qs) { return qs; }).join('&'); url = (0, _concat.default)(_context4 = "".concat(url, "?")).call(_context4, queryString); } var count = requestsCount++; debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers); var request = getAdapter('request'); var promise = request(url, { method: method, headers: headers, data: data, onprogress: onprogress }).then(function (response) { debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header); if (response.ok === false) { var error = new Error(); error.response = response; throw error; } return response.data; }).catch(function (error) { if (error.response) { if (!debug.enabled('leancloud:request')) { debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers); } debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header); error.statusCode = error.response.status; error.responseText = error.response.text; error.response = error.response.data; } throw error; }); return time ? timeout(promise, time) : promise; }; module.exports = ajax; /***/ }), /* 117 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), /* 118 */ /***/ (function(module, exports, __webpack_require__) { var Symbol = __webpack_require__(270), getRawTag = __webpack_require__(640), objectToString = __webpack_require__(641); /** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]'; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } module.exports = baseGetTag; /***/ }), /* 119 */ /***/ (function(module, exports) { /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } module.exports = isObjectLike; /***/ }), /* 120 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $propertyIsEnumerable = {}.propertyIsEnumerable; // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable; /***/ }), /* 121 */ /***/ (function(module, exports) { var $TypeError = TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible module.exports = function (it) { if (it == undefined) throw $TypeError("Can't call method on " + it); return it; }; /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { var aCallable = __webpack_require__(31); // `GetMethod` abstract operation // https://tc39.es/ecma262/#sec-getmethod module.exports = function (V, P) { var func = V[P]; return func == null ? undefined : aCallable(func); }; /***/ }), /* 123 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var defineGlobalProperty = __webpack_require__(287); var SHARED = '__core-js_shared__'; var store = global[SHARED] || defineGlobalProperty(SHARED, {}); module.exports = store; /***/ }), /* 124 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isObject = __webpack_require__(11); var document = global.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; /***/ }), /* 125 */ /***/ (function(module, exports, __webpack_require__) { var toIntegerOrInfinity = __webpack_require__(126); var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). module.exports = function (index, length) { var integer = toIntegerOrInfinity(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; /***/ }), /* 126 */ /***/ (function(module, exports, __webpack_require__) { var trunc = __webpack_require__(290); // `ToIntegerOrInfinity` abstract operation // https://tc39.es/ecma262/#sec-tointegerorinfinity module.exports = function (argument) { var number = +argument; // eslint-disable-next-line no-self-compare -- NaN check return number !== number || number === 0 ? 0 : trunc(number); }; /***/ }), /* 127 */ /***/ (function(module, exports) { // IE8- don't enum bug keys module.exports = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; /***/ }), /* 128 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(14); var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160); var definePropertyModule = __webpack_require__(23); var anObject = __webpack_require__(20); var toIndexedObject = __webpack_require__(32); var objectKeys = __webpack_require__(105); // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es-x/no-object-defineproperties -- safe exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var props = toIndexedObject(Properties); var keys = objectKeys(Properties); var length = keys.length; var index = 0; var key; while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]); return O; }; /***/ }), /* 129 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(9); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var test = {}; test[TO_STRING_TAG] = 'z'; module.exports = String(test) === '[object z]'; /***/ }), /* 130 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var isCallable = __webpack_require__(8); var store = __webpack_require__(123); var functionToString = uncurryThis(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper if (!isCallable(store.inspectSource)) { store.inspectSource = function (it) { return functionToString(it); }; } module.exports = store.inspectSource; /***/ }), /* 131 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var call = __webpack_require__(15); var IS_PURE = __webpack_require__(33); var FunctionName = __webpack_require__(296); var isCallable = __webpack_require__(8); var createIteratorConstructor = __webpack_require__(297); var getPrototypeOf = __webpack_require__(100); var setPrototypeOf = __webpack_require__(102); var setToStringTag = __webpack_require__(52); var createNonEnumerableProperty = __webpack_require__(37); var defineBuiltIn = __webpack_require__(44); var wellKnownSymbol = __webpack_require__(9); var Iterators = __webpack_require__(50); var IteratorsCore = __webpack_require__(171); var PROPER_FUNCTION_NAME = FunctionName.PROPER; var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE; var IteratorPrototype = IteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; var ITERATOR = wellKnownSymbol('iterator'); var KEYS = 'keys'; var VALUES = 'values'; var ENTRIES = 'entries'; var returnThis = function () { return this; }; module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { createIteratorConstructor(IteratorConstructor, NAME, next); var getIterationMethod = function (KIND) { if (KIND === DEFAULT && defaultIterator) return defaultIterator; if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; switch (KIND) { case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; } return function () { return new IteratorConstructor(this); }; }; var TO_STRING_TAG = NAME + ' Iterator'; var INCORRECT_VALUES_NAME = false; var IterablePrototype = Iterable.prototype; var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT]; var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; var CurrentIteratorPrototype, methods, KEY; // fix native if (anyNativeIterator) { CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { if (setPrototypeOf) { setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) { defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis); } } // Set @@toStringTag to native iterators setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true); if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis; } } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) { createNonEnumerableProperty(IterablePrototype, 'name', VALUES); } else { INCORRECT_VALUES_NAME = true; defaultIterator = function values() { return call(nativeIterator, this); }; } } // export additional methods if (DEFAULT) { methods = { values: getIterationMethod(VALUES), keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), entries: getIterationMethod(ENTRIES) }; if (FORCED) for (KEY in methods) { if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { defineBuiltIn(IterablePrototype, KEY, methods[KEY]); } } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } // define iterator if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT }); } Iterators[NAME] = defaultIterator; return methods; }; /***/ }), /* 132 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(24); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(319); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(180); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(181); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(320); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(133); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(182); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(321); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(322); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(323); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(183); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(184); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(134); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(57); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(28); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(135); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(325); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(185); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(186); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(327); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(191); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(328); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(330); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(331); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(332); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(333); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(16); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(85); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(66); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(334); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(192); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(193); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(194); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(139); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(195); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(335); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(197); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(336); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(198); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(337); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(338); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(141); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(187); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(202); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(199); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(142); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(339); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(111); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(340); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(203); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(143); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(341); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(342); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(206); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(344); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(345); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(346); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(347); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(201); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(112); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(208); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(348); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(349); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(209); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(350); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(351); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(352); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(353); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(144); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(354); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(355); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(210); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(356); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(211); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(145); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(213); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(214); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(215); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(357); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(217); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(358); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(58); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(68); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(359); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(360); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(88); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(361); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(362); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(363); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(89); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(364); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(146); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(365); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(219); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(366); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(367); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(220); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(368); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(369); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(370); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(371); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(372); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(373); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(374); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(221); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(376); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(377); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(222); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(378); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(223); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(379); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(380); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(381); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(225); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(382); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(383); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(224); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(226); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(384); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(385); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(386); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(387); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(388); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(389); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; }); // Named Exports // ============= // Underscore.js 1.12.1 // https://underscorejs.org // (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // Underscore may be freely distributed under the MIT license. // Baseline setup. // Object Functions // ---------------- // Our most fundamental functions operate on any JavaScript object. // Most functions in Underscore depend on at least one function in this section. // A group of functions that check the types of core JavaScript values. // These are often informally referred to as the "isType" functions. // Functions that treat an object as a dictionary of key-value pairs. // Utility Functions // ----------------- // A bit of a grab bag: Predicate-generating functions for use with filters and // loops, string escaping and templating, create random numbers and unique ids, // and functions that facilitate Underscore's chaining and iteration conventions. // Function (ahem) Functions // ------------------------- // These functions take a function as an argument and return a new function // as the result. Also known as higher-order functions. // Finders // ------- // Functions that extract (the position of) a single element from an object // or array based on some criterion. // Collection Functions // -------------------- // Functions that work on any collection of elements: either an array, or // an object of key-value pairs. // `_.pick` and `_.omit` are actually object functions, but we put // them here in order to create a more natural reading order in the // monolithic build as they depend on `_.contains`. // Array Functions // --------------- // Functions that operate on arrays (and array-likes) only, because they’re // expressed in terms of operations on an ordered list of values. // OOP // --- // These modules support the "object-oriented" calling style. See also // `underscore.js` and `index-default.js`. /***/ }), /* 133 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String')); /***/ }), /* 134 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(184); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(84); var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView'); // In IE 10 - Edge 13, we need a different heuristic // to determine whether an object is a `DataView`. function ie10IsDataView(obj) { 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); } /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView); /***/ }), /* 135 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45); var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments'); // Define a fallback version of the method in browsers (ahem, IE < 9), where // there isn't any inspectable "Arguments" type. (function() { if (!isArguments(arguments)) { isArguments = function(obj) { return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee'); }; } }()); /* harmony default export */ __webpack_exports__["a"] = (isArguments); /***/ }), /* 136 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(189); // Internal helper to obtain the `byteLength` property of an object. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength')); /***/ }), /* 137 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(85); // Since the regular `Object.prototype.toString` type tests don't work for // some types in IE 11, we use a fingerprinting heuristic instead, based // on the methods. It's not great, but it's the best we got. // The fingerprint method lists are defined below. function ie11fingerprint(methods) { var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods); return function(obj) { if (obj == null) return false; // `Map`, `WeakMap` and `Set` have no enumerable keys. var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj); if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false; for (var i = 0; i < length; i++) { if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false; } // If we are testing against `WeakMap`, we need to ensure that // `obj` doesn't have a `forEach` method in order to distinguish // it from a regular `Map`. return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]); }; } // In the interest of compact minification, we write // each string in the fingerprints only once. var forEachName = 'forEach', hasName = 'has', commonInit = ['clear', 'delete'], mapTail = ['get', hasName, 'set']; // `Map`, `WeakMap` and `Set` each have slightly different // combinations of the above sublists. var mapMethods = commonInit.concat(forEachName, mapTail), weakMapMethods = commonInit.concat(mapTail), setMethods = ['add'].concat(commonInit, forEachName, hasName); /***/ }), /* 138 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner; // An internal function for creating assigner functions. function createAssigner(keysFunc, defaults) { return function(obj) { var length = arguments.length; if (defaults) obj = Object(obj); if (length < 2 || obj == null) return obj; for (var index = 1; index < length; index++) { var source = arguments[index], keys = keysFunc(source), l = keys.length; for (var i = 0; i < l; i++) { var key = keys[i]; if (!defaults || obj[key] === void 0) obj[key] = source[key]; } } return obj; }; } /***/ }), /* 139 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16); // Assigns a given object with all the own properties in the passed-in // object(s). // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])); /***/ }), /* 140 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = deepGet; // Internal function to obtain a nested property in `obj` along `path`. function deepGet(obj, path) { var length = path.length; for (var i = 0; i < length; i++) { if (obj == null) return void 0; obj = obj[path[i]]; } return length ? obj : void 0; } /***/ }), /* 141 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = identity; // Keep the identity function around for default iteratees. function identity(value) { return value; } /***/ }), /* 142 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = property; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(140); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86); // Creates a function that, when passed an object, will traverse that object’s // properties down the given `path`, specified as an array of keys or indices. function property(path) { path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path); return function(obj) { return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path); }; } /***/ }), /* 143 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // A (possibly faster) way to get the current timestamp as an integer. /* harmony default export */ __webpack_exports__["a"] = (Date.now || function() { return new Date().getTime(); }); /***/ }), /* 144 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = negate; // Returns a negated version of the passed-in predicate. function negate(predicate) { return function() { return !predicate.apply(this, arguments); }; } /***/ }), /* 145 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212); // Returns the first index on an array-like that passes a truth test. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1)); /***/ }), /* 146 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = pluck; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(68); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(142); // Convenience version of a common use case of `_.map`: fetching a property. function pluck(obj, key) { return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key)); } /***/ }), /* 147 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(233); /***/ }), /* 148 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(9); exports.f = wellKnownSymbol; /***/ }), /* 149 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(243); /***/ }), /* 150 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(501); /***/ }), /* 151 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(552); /***/ }), /* 152 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(570); /***/ }), /* 153 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(574); /***/ }), /* 154 */ /***/ (function(module, exports, __webpack_require__) { var defineBuiltIn = __webpack_require__(44); module.exports = function (target, src, options) { for (var key in src) { if (options && options.unsafe && target[key]) target[key] = src[key]; else defineBuiltIn(target, key, src[key], options); } return target; }; /***/ }), /* 155 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var global = __webpack_require__(7); var InternalMetadataModule = __webpack_require__(94); var fails = __webpack_require__(2); var createNonEnumerableProperty = __webpack_require__(37); var iterate = __webpack_require__(42); var anInstance = __webpack_require__(108); var isCallable = __webpack_require__(8); var isObject = __webpack_require__(11); var setToStringTag = __webpack_require__(52); var defineProperty = __webpack_require__(23).f; var forEach = __webpack_require__(70).forEach; var DESCRIPTORS = __webpack_require__(14); var InternalStateModule = __webpack_require__(43); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; var ADDER = IS_MAP ? 'set' : 'add'; var NativeConstructor = global[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var exported = {}; var Constructor; if (!DESCRIPTORS || !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); })) ) { // create collection constructor Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); InternalMetadataModule.enable(); } else { Constructor = wrapper(function (target, iterable) { setInternalState(anInstance(target, Prototype), { type: CONSTRUCTOR_NAME, collection: new NativeConstructor() }); if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) { var IS_ADDER = KEY == 'add' || KEY == 'set'; if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) { createNonEnumerableProperty(Prototype, KEY, function (a, b) { var collection = getInternalState(this).collection; if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false; var result = collection[KEY](a === 0 ? 0 : a, b); return IS_ADDER ? this : result; }); } }); IS_WEAK || defineProperty(Prototype, 'size', { configurable: true, get: function () { return getInternalState(this).collection.size; } }); } setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true); exported[CONSTRUCTOR_NAME] = Constructor; $({ global: true, forced: true }, exported); if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); return Constructor; }; /***/ }), /* 156 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = __webpack_require__(589); /***/ }), /* 157 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable es-x/no-symbol -- required for testing */ var NATIVE_SYMBOL = __webpack_require__(64); module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol'; /***/ }), /* 158 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(14); var fails = __webpack_require__(2); var createElement = __webpack_require__(124); // Thanks to IE8 for its funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /* 159 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(2); var isCallable = __webpack_require__(8); var replacement = /#|\.prototype\./; var isForced = function (feature, detection) { var value = data[normalize(feature)]; return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection; }; var normalize = isForced.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced.data = {}; var NATIVE = isForced.NATIVE = 'N'; var POLYFILL = isForced.POLYFILL = 'P'; module.exports = isForced; /***/ }), /* 160 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(14); var fails = __webpack_require__(2); // V8 ~ Chrome 36- // https://bugs.chromium.org/p/v8/issues/detail?id=3334 module.exports = DESCRIPTORS && fails(function () { // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing return Object.defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false }).prototype != 42; }); /***/ }), /* 161 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(2); module.exports = !fails(function () { function F() { /* empty */ } F.prototype.constructor = null; // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing return Object.getPrototypeOf(new F()) !== F.prototype; }); /***/ }), /* 162 */ /***/ (function(module, exports, __webpack_require__) { var getBuiltIn = __webpack_require__(18); var uncurryThis = __webpack_require__(4); var getOwnPropertyNamesModule = __webpack_require__(103); var getOwnPropertySymbolsModule = __webpack_require__(104); var anObject = __webpack_require__(20); var concat = uncurryThis([].concat); // all object keys, includes non-enumerable and symbols module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule.f(anObject(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys; }; /***/ }), /* 163 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var hasOwn = __webpack_require__(13); var toIndexedObject = __webpack_require__(32); var indexOf = __webpack_require__(164).indexOf; var hiddenKeys = __webpack_require__(80); var push = uncurryThis([].push); module.exports = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key); // Don't enum bug & hidden keys while (names.length > i) if (hasOwn(O, key = names[i++])) { ~indexOf(result, key) || push(result, key); } return result; }; /***/ }), /* 164 */ /***/ (function(module, exports, __webpack_require__) { var toIndexedObject = __webpack_require__(32); var toAbsoluteIndex = __webpack_require__(125); var lengthOfArrayLike = __webpack_require__(41); // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject($this); var length = lengthOfArrayLike(O); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare -- NaN check if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare -- NaN check if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; module.exports = { // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; /***/ }), /* 165 */ /***/ (function(module, exports, __webpack_require__) { var getBuiltIn = __webpack_require__(18); module.exports = getBuiltIn('document', 'documentElement'); /***/ }), /* 166 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(9); var Iterators = __webpack_require__(50); var ITERATOR = wellKnownSymbol('iterator'); var ArrayPrototype = Array.prototype; // check on default Array iterator module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); }; /***/ }), /* 167 */ /***/ (function(module, exports, __webpack_require__) { var call = __webpack_require__(15); var aCallable = __webpack_require__(31); var anObject = __webpack_require__(20); var tryToString = __webpack_require__(78); var getIteratorMethod = __webpack_require__(106); var $TypeError = TypeError; module.exports = function (argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); throw $TypeError(tryToString(argument) + ' is not iterable'); }; /***/ }), /* 168 */ /***/ (function(module, exports, __webpack_require__) { var call = __webpack_require__(15); var anObject = __webpack_require__(20); var getMethod = __webpack_require__(122); module.exports = function (iterator, kind, value) { var innerResult, innerError; anObject(iterator); try { innerResult = getMethod(iterator, 'return'); if (!innerResult) { if (kind === 'throw') throw value; return value; } innerResult = call(innerResult, iterator); } catch (error) { innerError = true; innerResult = error; } if (kind === 'throw') throw value; if (innerError) throw innerResult; anObject(innerResult); return value; }; /***/ }), /* 169 */ /***/ (function(module, exports) { module.exports = function () { /* empty */ }; /***/ }), /* 170 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var isCallable = __webpack_require__(8); var inspectSource = __webpack_require__(130); var WeakMap = global.WeakMap; module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap)); /***/ }), /* 171 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(2); var isCallable = __webpack_require__(8); var create = __webpack_require__(49); var getPrototypeOf = __webpack_require__(100); var defineBuiltIn = __webpack_require__(44); var wellKnownSymbol = __webpack_require__(9); var IS_PURE = __webpack_require__(33); var ITERATOR = wellKnownSymbol('iterator'); var BUGGY_SAFARI_ITERATORS = false; // `%IteratorPrototype%` object // https://tc39.es/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; /* eslint-disable es-x/no-array-prototype-keys -- safe */ if ([].keys) { arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next` if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; else { PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; } } var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () { var test = {}; // FF44- legacy iterators case return IteratorPrototype[ITERATOR].call(test) !== test; }); if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {}; else if (IS_PURE) IteratorPrototype = create(IteratorPrototype); // `%IteratorPrototype%[@@iterator]()` method // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator if (!isCallable(IteratorPrototype[ITERATOR])) { defineBuiltIn(IteratorPrototype, ITERATOR, function () { return this; }); } module.exports = { IteratorPrototype: IteratorPrototype, BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS }; /***/ }), /* 172 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var getBuiltIn = __webpack_require__(18); var definePropertyModule = __webpack_require__(23); var wellKnownSymbol = __webpack_require__(9); var DESCRIPTORS = __webpack_require__(14); var SPECIES = wellKnownSymbol('species'); module.exports = function (CONSTRUCTOR_NAME) { var Constructor = getBuiltIn(CONSTRUCTOR_NAME); var defineProperty = definePropertyModule.f; if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) { defineProperty(Constructor, SPECIES, { configurable: true, get: function () { return this; } }); } }; /***/ }), /* 173 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(20); var aConstructor = __webpack_require__(174); var wellKnownSymbol = __webpack_require__(9); var SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation // https://tc39.es/ecma262/#sec-speciesconstructor module.exports = function (O, defaultConstructor) { var C = anObject(O).constructor; var S; return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S); }; /***/ }), /* 174 */ /***/ (function(module, exports, __webpack_require__) { var isConstructor = __webpack_require__(109); var tryToString = __webpack_require__(78); var $TypeError = TypeError; // `Assert: IsConstructor(argument) is true` module.exports = function (argument) { if (isConstructor(argument)) return argument; throw $TypeError(tryToString(argument) + ' is not a constructor'); }; /***/ }), /* 175 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var apply = __webpack_require__(75); var bind = __webpack_require__(48); var isCallable = __webpack_require__(8); var hasOwn = __webpack_require__(13); var fails = __webpack_require__(2); var html = __webpack_require__(165); var arraySlice = __webpack_require__(110); var createElement = __webpack_require__(124); var validateArgumentsLength = __webpack_require__(301); var IS_IOS = __webpack_require__(176); var IS_NODE = __webpack_require__(107); var set = global.setImmediate; var clear = global.clearImmediate; var process = global.process; var Dispatch = global.Dispatch; var Function = global.Function; var MessageChannel = global.MessageChannel; var String = global.String; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var location, defer, channel, port; try { // Deno throws a ReferenceError on `location` access without `--location` flag location = global.location; } catch (error) { /* empty */ } var run = function (id) { if (hasOwn(queue, id)) { var fn = queue[id]; delete queue[id]; fn(); } }; var runner = function (id) { return function () { run(id); }; }; var listener = function (event) { run(event.data); }; var post = function (id) { // old engines have not location.origin global.postMessage(String(id), location.protocol + '//' + location.host); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!set || !clear) { set = function setImmediate(handler) { validateArgumentsLength(arguments.length, 1); var fn = isCallable(handler) ? handler : Function(handler); var args = arraySlice(arguments, 1); queue[++counter] = function () { apply(fn, undefined, args); }; defer(counter); return counter; }; clear = function clearImmediate(id) { delete queue[id]; }; // Node.js 0.8- if (IS_NODE) { defer = function (id) { process.nextTick(runner(id)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { Dispatch.now(runner(id)); }; // Browsers with MessageChannel, includes WebWorkers // except iOS - https://github.com/zloirock/core-js/issues/624 } else if (MessageChannel && !IS_IOS) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; defer = bind(port.postMessage, port); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if ( global.addEventListener && isCallable(global.postMessage) && !global.importScripts && location && location.protocol !== 'file:' && !fails(post) ) { defer = post; global.addEventListener('message', listener, false); // IE8- } else if (ONREADYSTATECHANGE in createElement('script')) { defer = function (id) { html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); run(id); }; }; // Rest old browsers } else { defer = function (id) { setTimeout(runner(id), 0); }; } } module.exports = { set: set, clear: clear }; /***/ }), /* 176 */ /***/ (function(module, exports, __webpack_require__) { var userAgent = __webpack_require__(98); module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent); /***/ }), /* 177 */ /***/ (function(module, exports, __webpack_require__) { var NativePromiseConstructor = __webpack_require__(65); var checkCorrectnessOfIteration = __webpack_require__(178); var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR; module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) { NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ }); }); /***/ }), /* 178 */ /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__(9); var ITERATOR = wellKnownSymbol('iterator'); var SAFE_CLOSING = false; try { var called = 0; var iteratorWithReturn = { next: function () { return { done: !!called++ }; }, 'return': function () { SAFE_CLOSING = true; } }; iteratorWithReturn[ITERATOR] = function () { return this; }; // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing Array.from(iteratorWithReturn, function () { throw 2; }); } catch (error) { /* empty */ } module.exports = function (exec, SKIP_CLOSING) { if (!SKIP_CLOSING && !SAFE_CLOSING) return false; var ITERATION_SUPPORT = false; try { var object = {}; object[ITERATOR] = function () { return { next: function () { return { done: ITERATION_SUPPORT = true }; } }; }; exec(object); } catch (error) { /* empty */ } return ITERATION_SUPPORT; }; /***/ }), /* 179 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(20); var isObject = __webpack_require__(11); var newPromiseCapability = __webpack_require__(54); module.exports = function (C, x) { anObject(C); if (isObject(x) && x.constructor === C) return x; var promiseCapability = newPromiseCapability.f(C); var resolve = promiseCapability.resolve; resolve(x); return promiseCapability.promise; }; /***/ }), /* 180 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined; // Is a given variable undefined? function isUndefined(obj) { return obj === void 0; } /***/ }), /* 181 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); // Is a given value a boolean? function isBoolean(obj) { return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]'; } /***/ }), /* 182 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number')); /***/ }), /* 183 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol')); /***/ }), /* 184 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer')); /***/ }), /* 185 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isNaN; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(182); // Is the given value `NaN`? function isNaN(obj) { return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj); } /***/ }), /* 186 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(134); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(187); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(326); // Is a given value a typed array? var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/; function isTypedArray(obj) { // `ArrayBuffer.isView` is the most future-proof, so use it when available. // Otherwise, fall back on the above regular expression. 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)) : Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj)); } /* 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)); /***/ }), /* 187 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = constant; // Predicate-generating function. Often useful outside of Underscore. function constant(value) { return function() { return value; }; } /***/ }), /* 188 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); // Common internal logic for `isArrayLike` and `isBufferLike`. function createSizePropertyCheck(getSizeProperty) { return function(collection) { var sizeProperty = getSizeProperty(collection); return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */]; } } /***/ }), /* 189 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty; // Internal helper to generate a function to obtain property `key` from `obj`. function shallowProperty(key) { return function(obj) { return obj == null ? void 0 : obj[key]; }; } /***/ }), /* 190 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45); // Internal helper to create a simple lookup structure. // `collectNonEnumProps` used to depend on `_.contains`, but this led to // circular imports. `emulatedSet` is a one-off solution that only works for // arrays of strings. function emulatedSet(keys) { var hash = {}; for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true; return { contains: function(key) { return hash[key]; }, push: function(key) { hash[key] = true; return keys.push(key); } }; } // Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't // be iterated by `for key in ...` and thus missed. Extends `keys` in place if // needed. function collectNonEnumProps(obj, keys) { keys = emulatedSet(keys); var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length; var constructor = obj.constructor; var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */]; // Constructor is a special case. var prop = 'constructor'; if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop); while (nonEnumIdx--) { prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx]; if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) { keys.push(prop); } } } /***/ }), /* 191 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isMatch; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16); // Returns whether an object has a given set of `key:value` pairs. function isMatch(object, attrs) { var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length; if (object == null) return !length; var obj = Object(object); for (var i = 0; i < length; i++) { var key = _keys[i]; if (attrs[key] !== obj[key] || !(key in obj)) return false; } return true; } /***/ }), /* 192 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = invert; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16); // Invert the keys and values of an object. The values must be serializable. function invert(obj) { var result = {}; var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj); for (var i = 0, length = _keys.length; i < length; i++) { result[obj[_keys[i]]] = _keys[i]; } return result; } /***/ }), /* 193 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = functions; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28); // Return a sorted list of the function names available on the object. function functions(obj) { var names = []; for (var key in obj) { if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key); } return names.sort(); } /***/ }), /* 194 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85); // Extend a given object with all the properties in passed-in object(s). /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */])); /***/ }), /* 195 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(138); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85); // Fill in a given object with default properties. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true)); /***/ }), /* 196 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6); // Create a naked function reference for surrogate-prototype-swapping. function ctor() { return function(){}; } // An internal function for creating a new object that inherits from another. function baseCreate(prototype) { if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {}; if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype); var Ctor = ctor(); Ctor.prototype = prototype; var result = new Ctor; Ctor.prototype = null; return result; } /***/ }), /* 197 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = clone; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(194); // Create a (shallow-cloned) duplicate of an object. function clone(obj) { if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj; return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj); } /***/ }), /* 198 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = get; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(86); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(140); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(180); // Get the value of the (deep) property on `path` from `object`. // If any property in `path` does not exist or if the value is // `undefined`, return `defaultValue` instead. // The `path` is normalized through `_.toPath`. function get(object, path, defaultValue) { var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path)); return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value; } /***/ }), /* 199 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = toPath; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57); // Normalize a (deep) property `path` to array. // Like `_.iteratee`, this function can be customized. function toPath(path) { return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path]; } __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath; /***/ }), /* 200 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(141); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(57); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(111); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(142); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(87); // An internal function to generate callbacks that can be applied to each // element in a collection, returning the desired result — either `_.identity`, // an arbitrary callback, a property matcher, or a property accessor. function baseIteratee(value, context, argCount) { if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */]; if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount); 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); return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value); } /***/ }), /* 201 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = iteratee; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(200); // External wrapper for our callback generator. Users may customize // `_.iteratee` if they want additional predicate/iteratee shorthand styles. // This abstraction hides the internal-only `argCount` argument. function iteratee(value, context) { return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity); } __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee; /***/ }), /* 202 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = noop; // Predicate-generating function. Often useful outside of Underscore. function noop(){} /***/ }), /* 203 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = random; // Return a random integer between `min` and `max` (inclusive). function random(min, max) { if (max == null) { max = min; min = 0; } return min + Math.floor(Math.random() * (max - min + 1)); } /***/ }), /* 204 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16); // Internal helper to generate functions for escaping and unescaping strings // to/from HTML interpolation. function createEscaper(map) { var escaper = function(match) { return map[match]; }; // Regexes for identifying a key that needs to be escaped. var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')'; var testRegexp = RegExp(source); var replaceRegexp = RegExp(source, 'g'); return function(string) { string = string == null ? '' : '' + string; return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; }; } /***/ }), /* 205 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // Internal list of HTML entities for escaping. /* harmony default export */ __webpack_exports__["a"] = ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '`': '`' }); /***/ }), /* 206 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); // By default, Underscore uses ERB-style template delimiters. Change the // following template settings to use alternative delimiters. /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = { evaluate: /<%([\s\S]+?)%>/g, interpolate: /<%=([\s\S]+?)%>/g, escape: /<%-([\s\S]+?)%>/g }); /***/ }), /* 207 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = executeBound; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(56); // Internal function to execute `sourceFunc` bound to `context` with optional // `args`. Determines whether to execute a function as a constructor or as a // normal function. function executeBound(sourceFunc, boundFunc, context, callingContext, args) { if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype); var result = sourceFunc.apply(self, args); if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result; return self; } /***/ }), /* 208 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(207); // Create a function bound to a given object (assigning `this`, and arguments, // optionally). /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) { if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function'); var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) { return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs)); }); return bound; })); /***/ }), /* 209 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); // Delays a function for the given number of milliseconds, and then calls // it with the arguments supplied. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) { return setTimeout(function() { return func.apply(null, args); }, wait); })); /***/ }), /* 210 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = before; // Returns a function that will only be executed up to (but not including) the // Nth call. function before(times, func) { var memo; return function() { if (--times > 0) { memo = func.apply(this, arguments); } if (times <= 1) func = null; return memo; }; } /***/ }), /* 211 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = findKey; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16); // Returns the first key on an object that passes a truth test. function findKey(obj, predicate, context) { predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context); var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key; for (var i = 0, length = _keys.length; i < length; i++) { key = _keys[i]; if (predicate(obj[key], key, obj)) return key; } } /***/ }), /* 212 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29); // Internal function to generate `_.findIndex` and `_.findLastIndex`. function createPredicateIndexFinder(dir) { return function(array, predicate, context) { predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context); var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array); var index = dir > 0 ? 0 : length - 1; for (; index >= 0 && index < length; index += dir) { if (predicate(array[index], index, array)) return index; } return -1; }; } /***/ }), /* 213 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(212); // Returns the last index on an array-like that passes a truth test. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1)); /***/ }), /* 214 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29); // Use a comparator function to figure out the smallest index at which // an object should be inserted so as to maintain order. Uses binary search. function sortedIndex(array, obj, iteratee, context) { iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1); var value = iteratee(obj); var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array); while (low < high) { var mid = Math.floor((low + high) / 2); if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; } return low; } /***/ }), /* 215 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(214); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(145); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(216); // Return the position of the first occurrence of an item in an array, // or -1 if the item is not included in the array. // If the array is large and already in sort order, pass `true` // for **isSorted** to use binary search. /* 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 */])); /***/ }), /* 216 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(185); // Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions. function createIndexFinder(dir, predicateFind, sortedIndex) { return function(array, item, idx) { var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); if (typeof idx == 'number') { if (dir > 0) { i = idx >= 0 ? idx : Math.max(idx + length, i); } else { length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1; } } else if (sortedIndex && idx && length) { idx = sortedIndex(array, item); return array[idx] === item ? idx : -1; } if (item !== item) { idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]); return idx >= 0 ? idx + i : -1; } for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) { if (array[idx] === item) return idx; } return -1; }; } /***/ }), /* 217 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = find; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(145); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(211); // Return the first value which passes a truth test. function find(obj, predicate, context) { 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 */]; var key = keyFinder(obj, predicate, context); if (key !== void 0 && key !== -1) return obj[key]; } /***/ }), /* 218 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = createReduce; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87); // Internal helper to create a reducing function, iterating left or right. function createReduce(dir) { // Wrap code that reassigns argument variables in a separate function than // the one that accesses `arguments.length` to avoid a perf hit. (#1991) var reducer = function(obj, iteratee, memo, initial) { var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), length = (_keys || obj).length, index = dir > 0 ? 0 : length - 1; if (!initial) { memo = obj[_keys ? _keys[index] : index]; index += dir; } for (; index >= 0 && index < length; index += dir) { var currentKey = _keys ? _keys[index] : index; memo = iteratee(memo, obj[currentKey], currentKey, obj); } return memo; }; return function(obj, iteratee, memo, context) { var initial = arguments.length >= 3; return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial); }; } /***/ }), /* 219 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = max; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58); // Return the maximum element (or element-based computation). function max(obj, iteratee, context) { var result = -Infinity, lastComputed = -Infinity, value, computed; if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) { obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj); for (var i = 0, length = obj.length; i < length; i++) { value = obj[i]; if (value != null && value > result) { result = value; } } } else { iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context); Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) { computed = iteratee(v, index, list); if (computed > lastComputed || computed === -Infinity && result === -Infinity) { result = v; lastComputed = computed; } }); } return result; } /***/ }), /* 220 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = sample; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(197); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(66); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(29); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(203); // Sample **n** random values from a collection using the modern version of the // [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle). // If **n** is not specified, returns a single random element. // The internal `guard` argument allows it to work with `_.map`. function sample(obj, n, guard) { if (n == null || guard) { if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj); return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)]; } 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); var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample); n = Math.max(Math.min(n, length), 0); var last = length - 1; for (var index = 0; index < n; index++) { var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last); var temp = sample[index]; sample[index] = sample[rand]; sample[rand] = temp; } return sample.slice(0, n); } /***/ }), /* 221 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(85); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(375); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(67); // Return a copy of the object only containing the allowed properties. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) { var result = {}, iteratee = keys[0]; if (obj == null) return result; if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) { if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]); keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj); } else { iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */]; keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false); obj = Object(obj); } for (var i = 0, length = keys.length; i < length; i++) { var key = keys[i]; var value = obj[key]; if (iteratee(value, key, obj)) result[key] = value; } return result; })); /***/ }), /* 222 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = initial; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); // Returns everything but the last entry of the array. Especially useful on // the arguments object. Passing **n** will return all the values in // the array, excluding the last N. function initial(array, n, guard) { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); } /***/ }), /* 223 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = rest; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); // Returns everything but the first entry of the `array`. Especially useful on // the `arguments` object. Passing an **n** will return the rest N values in the // `array`. function rest(array, n, guard) { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n); } /***/ }), /* 224 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(88); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89); // Take the difference between one array and a number of other arrays. // Only the elements present in just the first array will remain. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) { rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true); return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){ return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value); }); })); /***/ }), /* 225 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = uniq; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(181); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(29); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89); // Produce a duplicate-free version of the array. If the array has already // been sorted, you have the option of using a faster algorithm. // The faster algorithm will not work with an iteratee if the iteratee // is not a one-to-one function, so providing an iteratee will disable // the faster algorithm. function uniq(array, isSorted, iteratee, context) { if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) { context = iteratee; iteratee = isSorted; isSorted = false; } if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context); var result = []; var seen = []; for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) { var value = array[i], computed = iteratee ? iteratee(value, i, array) : value; if (isSorted && !iteratee) { if (!i || seen !== computed) result.push(value); seen = computed; } else if (iteratee) { if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) { seen.push(computed); result.push(value); } } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) { result.push(value); } } return result; } /***/ }), /* 226 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = unzip; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(219); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(146); // Complement of zip. Unzip accepts an array of arrays and groups // each array's elements on shared indices. function unzip(array) { var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0; var result = Array(length); for (var index = 0; index < length; index++) { result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index); } return result; } /***/ }), /* 227 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = chainResult; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); // Helper function to continue chaining intermediate results. function chainResult(instance, obj) { return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj; } /***/ }), /* 228 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var fails = __webpack_require__(2); var isArray = __webpack_require__(90); var isObject = __webpack_require__(11); var toObject = __webpack_require__(34); var lengthOfArrayLike = __webpack_require__(41); var doesNotExceedSafeInteger = __webpack_require__(393); var createProperty = __webpack_require__(91); var arraySpeciesCreate = __webpack_require__(229); var arrayMethodHasSpeciesSupport = __webpack_require__(114); var wellKnownSymbol = __webpack_require__(9); var V8_VERSION = __webpack_require__(77); var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/679 var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () { var array = []; array[IS_CONCAT_SPREADABLE] = false; return array.concat()[0] !== array; }); var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat'); var isConcatSpreadable = function (O) { if (!isObject(O)) return false; var spreadable = O[IS_CONCAT_SPREADABLE]; return spreadable !== undefined ? !!spreadable : isArray(O); }; var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method // https://tc39.es/ecma262/#sec-array.prototype.concat // with adding support of @@isConcatSpreadable and @@species $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, { // eslint-disable-next-line no-unused-vars -- required for `.length` concat: function concat(arg) { var O = toObject(this); var A = arraySpeciesCreate(O, 0); var n = 0; var i, k, length, len, E; for (i = -1, length = arguments.length; i < length; i++) { E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { len = lengthOfArrayLike(E); doesNotExceedSafeInteger(n + len); for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); } else { doesNotExceedSafeInteger(n + 1); createProperty(A, n++, E); } } A.length = n; return A; } }); /***/ }), /* 229 */ /***/ (function(module, exports, __webpack_require__) { var arraySpeciesConstructor = __webpack_require__(394); // `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray, length) { return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); }; /***/ }), /* 230 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var getBuiltIn = __webpack_require__(18); var apply = __webpack_require__(75); var call = __webpack_require__(15); var uncurryThis = __webpack_require__(4); var fails = __webpack_require__(2); var isArray = __webpack_require__(90); var isCallable = __webpack_require__(8); var isObject = __webpack_require__(11); var isSymbol = __webpack_require__(97); var arraySlice = __webpack_require__(110); var NATIVE_SYMBOL = __webpack_require__(64); var $stringify = getBuiltIn('JSON', 'stringify'); var exec = uncurryThis(/./.exec); var charAt = uncurryThis(''.charAt); var charCodeAt = uncurryThis(''.charCodeAt); var replace = uncurryThis(''.replace); var numberToString = uncurryThis(1.0.toString); var tester = /[\uD800-\uDFFF]/g; var low = /^[\uD800-\uDBFF]$/; var hi = /^[\uDC00-\uDFFF]$/; var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () { var symbol = getBuiltIn('Symbol')(); // MS Edge converts symbol values to JSON as {} return $stringify([symbol]) != '[null]' // WebKit converts symbol values to JSON as null || $stringify({ a: symbol }) != '{}' // V8 throws on boxed symbols || $stringify(Object(symbol)) != '{}'; }); // https://github.com/tc39/proposal-well-formed-stringify var ILL_FORMED_UNICODE = fails(function () { return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' || $stringify('\uDEAD') !== '"\\udead"'; }); var stringifyWithSymbolsFix = function (it, replacer) { var args = arraySlice(arguments); var $replacer = replacer; if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined if (!isArray(replacer)) replacer = function (key, value) { if (isCallable($replacer)) value = call($replacer, this, key, value); if (!isSymbol(value)) return value; }; args[1] = replacer; return apply($stringify, null, args); }; var fixIllFormed = function (match, offset, string) { var prev = charAt(string, offset - 1); var next = charAt(string, offset + 1); if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) { return '\\u' + numberToString(charCodeAt(match, 0), 16); } return match; }; if ($stringify) { // `JSON.stringify` method // https://tc39.es/ecma262/#sec-json.stringify $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, { // eslint-disable-next-line no-unused-vars -- required for `.length` stringify: function stringify(it, replacer, space) { var args = arraySlice(arguments); var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args); return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result; } }); } /***/ }), /* 231 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(2); module.exports = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; return !!method && fails(function () { // eslint-disable-next-line no-useless-call -- required for testing method.call(null, argument || function () { return 1; }, 1); }); }; /***/ }), /* 232 */ /***/ (function(module, exports, __webpack_require__) { var rng = __webpack_require__(411); var bytesToUuid = __webpack_require__(412); function v4(options, buf, offset) { var i = buf && offset || 0; if (typeof(options) == 'string') { buf = options === 'binary' ? new Array(16) : null; options = null; } options = options || {}; var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = (rnds[6] & 0x0f) | 0x40; rnds[8] = (rnds[8] & 0x3f) | 0x80; // Copy bytes to buffer, if provided if (buf) { for (var ii = 0; ii < 16; ++ii) { buf[i + ii] = rnds[ii]; } } return buf || bytesToUuid(rnds); } module.exports = v4; /***/ }), /* 233 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(415); module.exports = parent; /***/ }), /* 234 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = '4.13.4'; /***/ }), /* 235 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var has = Object.prototype.hasOwnProperty , prefix = '~'; /** * Constructor to create a storage for our `EE` objects. * An `Events` instance is a plain object whose properties are event names. * * @constructor * @api private */ function Events() {} // // We try to not inherit from `Object.prototype`. In some engines creating an // instance in this way is faster than calling `Object.create(null)` directly. // If `Object.create(null)` is not supported we prefix the event names with a // character to make sure that the built-in object properties are not // overridden or used as an attack vector. // if (Object.create) { Events.prototype = Object.create(null); // // This hack is needed because the `__proto__` property is still inherited in // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. // if (!new Events().__proto__) prefix = false; } /** * Representation of a single event listener. * * @param {Function} fn The listener function. * @param {Mixed} context The context to invoke the listener with. * @param {Boolean} [once=false] Specify if the listener is a one-time listener. * @constructor * @api private */ function EE(fn, context, once) { this.fn = fn; this.context = context; this.once = once || false; } /** * Minimal `EventEmitter` interface that is molded against the Node.js * `EventEmitter` interface. * * @constructor * @api public */ function EventEmitter() { this._events = new Events(); this._eventsCount = 0; } /** * Return an array listing the events for which the emitter has registered * listeners. * * @returns {Array} * @api public */ EventEmitter.prototype.eventNames = function eventNames() { var names = [] , events , name; if (this._eventsCount === 0) return names; for (name in (events = this._events)) { if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); } if (Object.getOwnPropertySymbols) { return names.concat(Object.getOwnPropertySymbols(events)); } return names; }; /** * Return the listeners registered for a given event. * * @param {String|Symbol} event The event name. * @param {Boolean} exists Only check if there are listeners. * @returns {Array|Boolean} * @api public */ EventEmitter.prototype.listeners = function listeners(event, exists) { var evt = prefix ? prefix + event : event , available = this._events[evt]; if (exists) return !!available; if (!available) return []; if (available.fn) return [available.fn]; for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) { ee[i] = available[i].fn; } return ee; }; /** * Calls each of the listeners registered for a given event. * * @param {String|Symbol} event The event name. * @returns {Boolean} `true` if the event had listeners, else `false`. * @api public */ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return false; var listeners = this._events[evt] , len = arguments.length , args , i; if (listeners.fn) { if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); switch (len) { case 1: return listeners.fn.call(listeners.context), true; case 2: return listeners.fn.call(listeners.context, a1), true; case 3: return listeners.fn.call(listeners.context, a1, a2), true; case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; } for (i = 1, args = new Array(len -1); i < len; i++) { args[i - 1] = arguments[i]; } listeners.fn.apply(listeners.context, args); } else { var length = listeners.length , j; for (i = 0; i < length; i++) { if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); switch (len) { case 1: listeners[i].fn.call(listeners[i].context); break; case 2: listeners[i].fn.call(listeners[i].context, a1); break; case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; default: if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { args[j - 1] = arguments[j]; } listeners[i].fn.apply(listeners[i].context, args); } } } return true; }; /** * Add a listener for a given event. * * @param {String|Symbol} event The event name. * @param {Function} fn The listener function. * @param {Mixed} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @api public */ EventEmitter.prototype.on = function on(event, fn, context) { var listener = new EE(fn, context || this) , evt = prefix ? prefix + event : event; if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++; else if (!this._events[evt].fn) this._events[evt].push(listener); else this._events[evt] = [this._events[evt], listener]; return this; }; /** * Add a one-time listener for a given event. * * @param {String|Symbol} event The event name. * @param {Function} fn The listener function. * @param {Mixed} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @api public */ EventEmitter.prototype.once = function once(event, fn, context) { var listener = new EE(fn, context || this, true) , evt = prefix ? prefix + event : event; if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++; else if (!this._events[evt].fn) this._events[evt].push(listener); else this._events[evt] = [this._events[evt], listener]; return this; }; /** * Remove the listeners of a given event. * * @param {String|Symbol} event The event name. * @param {Function} fn Only remove the listeners that match this function. * @param {Mixed} context Only remove the listeners that have this context. * @param {Boolean} once Only remove one-time listeners. * @returns {EventEmitter} `this`. * @api public */ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return this; if (!fn) { if (--this._eventsCount === 0) this._events = new Events(); else delete this._events[evt]; return this; } var listeners = this._events[evt]; if (listeners.fn) { if ( listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context) ) { if (--this._eventsCount === 0) this._events = new Events(); else delete this._events[evt]; } } else { for (var i = 0, events = [], length = listeners.length; i < length; i++) { if ( listeners[i].fn !== fn || (once && !listeners[i].once) || (context && listeners[i].context !== context) ) { events.push(listeners[i]); } } // // Reset the array, or remove it completely if we have no more listeners. // if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; else if (--this._eventsCount === 0) this._events = new Events(); else delete this._events[evt]; } return this; }; /** * Remove all listeners, or those of the specified event. * * @param {String|Symbol} [event] The event name. * @returns {EventEmitter} `this`. * @api public */ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { var evt; if (event) { evt = prefix ? prefix + event : event; if (this._events[evt]) { if (--this._eventsCount === 0) this._events = new Events(); else delete this._events[evt]; } } else { this._events = new Events(); this._eventsCount = 0; } return this; }; // // Alias methods names because people roll like that. // EventEmitter.prototype.off = EventEmitter.prototype.removeListener; EventEmitter.prototype.addListener = EventEmitter.prototype.on; // // This function doesn't apply anymore. // EventEmitter.prototype.setMaxListeners = function setMaxListeners() { return this; }; // // Expose the prefix. // EventEmitter.prefixed = prefix; // // Allow `EventEmitter` to be imported as module namespace. // EventEmitter.EventEmitter = EventEmitter; // // Expose the module. // if (true) { module.exports = EventEmitter; } /***/ }), /* 236 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _require = __webpack_require__(72), getAdapter = _require.getAdapter; var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear']; var localStorage = { get async() { return getAdapter('storage').async; } }; // wrap sync apis with async ones. syncApiNames.forEach(function (apiName) { localStorage[apiName + 'Async'] = function () { var storage = getAdapter('storage'); return _promise.default.resolve(storage[apiName].apply(storage, arguments)); }; localStorage[apiName] = function () { var storage = getAdapter('storage'); if (!storage.async) { return storage[apiName].apply(storage, arguments); } var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.'); error.code = 'SYNC_API_NOT_AVAILABLE'; throw error; }; }); module.exports = localStorage; /***/ }), /* 237 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _concat = _interopRequireDefault(__webpack_require__(22)); var _stringify = _interopRequireDefault(__webpack_require__(36)); var storage = __webpack_require__(236); var AV = __webpack_require__(69); var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage); var getCacheData = function getCacheData(cacheData, key) { try { cacheData = JSON.parse(cacheData); } catch (e) { return null; } if (cacheData) { var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now(); if (!expired) { return cacheData.value; } return removeAsync(key).then(function () { return null; }); } return null; }; exports.getAsync = function (key) { var _context; key = (0, _concat.default)(_context = "AV/".concat(AV.applicationId, "/")).call(_context, key); return storage.getItemAsync(key).then(function (cache) { return getCacheData(cache, key); }); }; exports.setAsync = function (key, value, ttl) { var _context2; var cache = { value: value }; if (typeof ttl === 'number') { cache.expiredAt = Date.now() + ttl; } return storage.setItemAsync((0, _concat.default)(_context2 = "AV/".concat(AV.applicationId, "/")).call(_context2, key), (0, _stringify.default)(cache)); }; /***/ }), /* 238 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(239); /***/ }), /* 239 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(417); module.exports = parent; /***/ }), /* 240 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(420); module.exports = parent; /***/ }), /* 241 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(423); module.exports = parent; /***/ }), /* 242 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(426); /***/ }), /* 243 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(429); __webpack_require__(39); module.exports = parent; /***/ }), /* 244 */ /***/ (function(module, exports, __webpack_require__) { // TODO: Remove this module from `core-js@4` since it's split to modules listed below __webpack_require__(430); __webpack_require__(432); __webpack_require__(433); __webpack_require__(230); __webpack_require__(434); /***/ }), /* 245 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable es-x/no-object-getownpropertynames -- safe */ var classof = __webpack_require__(63); var toIndexedObject = __webpack_require__(32); var $getOwnPropertyNames = __webpack_require__(103).f; var arraySlice = __webpack_require__(431); var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return $getOwnPropertyNames(it); } catch (error) { return arraySlice(windowNames); } }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window module.exports.f = function getOwnPropertyNames(it) { return windowNames && classof(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it)); }; /***/ }), /* 246 */ /***/ (function(module, exports, __webpack_require__) { var call = __webpack_require__(15); var getBuiltIn = __webpack_require__(18); var wellKnownSymbol = __webpack_require__(9); var defineBuiltIn = __webpack_require__(44); module.exports = function () { var Symbol = getBuiltIn('Symbol'); var SymbolPrototype = Symbol && Symbol.prototype; var valueOf = SymbolPrototype && SymbolPrototype.valueOf; var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) { // `Symbol.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive // eslint-disable-next-line no-unused-vars -- required for .length defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) { return call(valueOf, this); }, { arity: 1 }); } }; /***/ }), /* 247 */ /***/ (function(module, exports, __webpack_require__) { var NATIVE_SYMBOL = __webpack_require__(64); /* eslint-disable es-x/no-symbol -- safe */ module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor; /***/ }), /* 248 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.iterator` well-known symbol // https://tc39.es/ecma262/#sec-symbol.iterator defineWellKnownSymbol('iterator'); /***/ }), /* 249 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(463); __webpack_require__(39); module.exports = parent; /***/ }), /* 250 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(464); /***/ }), /* 251 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright (c) 2015-2017 David M. Lee, II /** * Local reference to TimeoutError * @private */ var TimeoutError; /** * Rejects a promise with a {@link TimeoutError} if it does not settle within * the specified timeout. * * @param {Promise} promise The promise. * @param {number} timeoutMillis Number of milliseconds to wait on settling. * @returns {Promise} Either resolves/rejects with `promise`, or rejects with * `TimeoutError`, whichever settles first. */ var timeout = module.exports.timeout = function(promise, timeoutMillis) { var error = new TimeoutError(), timeout; return Promise.race([ promise, new Promise(function(resolve, reject) { timeout = setTimeout(function() { reject(error); }, timeoutMillis); }), ]).then(function(v) { clearTimeout(timeout); return v; }, function(err) { clearTimeout(timeout); throw err; }); }; /** * Exception indicating that the timeout expired. */ TimeoutError = module.exports.TimeoutError = function() { Error.call(this) this.stack = Error().stack this.message = 'Timeout'; }; TimeoutError.prototype = Object.create(Error.prototype); TimeoutError.prototype.name = "TimeoutError"; /***/ }), /* 252 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(253); /***/ }), /* 253 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(480); module.exports = parent; /***/ }), /* 254 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(484); /***/ }), /* 255 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(4); var aCallable = __webpack_require__(31); var isObject = __webpack_require__(11); var hasOwn = __webpack_require__(13); var arraySlice = __webpack_require__(110); var NATIVE_BIND = __webpack_require__(76); var $Function = Function; var concat = uncurryThis([].concat); var join = uncurryThis([].join); var factories = {}; var construct = function (C, argsLength, args) { if (!hasOwn(factories, argsLength)) { for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')'); } return factories[argsLength](C, args); }; // `Function.prototype.bind` method implementation // https://tc39.es/ecma262/#sec-function.prototype.bind module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) { var F = aCallable(this); var Prototype = F.prototype; var partArgs = arraySlice(arguments, 1); var boundFunction = function bound(/* args... */) { var args = concat(partArgs, arraySlice(arguments)); return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args); }; if (isObject(Prototype)) boundFunction.prototype = Prototype; return boundFunction; }; /***/ }), /* 256 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(505); /***/ }), /* 257 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(508); /***/ }), /* 258 */ /***/ (function(module, exports) { var charenc = { // UTF-8 encoding utf8: { // Convert a string to a byte array stringToBytes: function(str) { return charenc.bin.stringToBytes(unescape(encodeURIComponent(str))); }, // Convert a byte array to a string bytesToString: function(bytes) { return decodeURIComponent(escape(charenc.bin.bytesToString(bytes))); } }, // Binary encoding bin: { // Convert a string to a byte array stringToBytes: function(str) { for (var bytes = [], i = 0; i < str.length; i++) bytes.push(str.charCodeAt(i) & 0xFF); return bytes; }, // Convert a byte array to a string bytesToString: function(bytes) { for (var str = [], i = 0; i < bytes.length; i++) str.push(String.fromCharCode(bytes[i])); return str.join(''); } } }; module.exports = charenc; /***/ }), /* 259 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var adapters = __webpack_require__(569); module.exports = function (AV) { AV.setAdapters(adapters); return AV; }; /***/ }), /* 260 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(577); /***/ }), /* 261 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(2); var isObject = __webpack_require__(11); var classof = __webpack_require__(63); var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(581); // eslint-disable-next-line es-x/no-object-isextensible -- safe var $isExtensible = Object.isExtensible; var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); }); // `Object.isExtensible` method // https://tc39.es/ecma262/#sec-object.isextensible module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) { if (!isObject(it)) return false; if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false; return $isExtensible ? $isExtensible(it) : true; } : $isExtensible; /***/ }), /* 262 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(2); module.exports = !fails(function () { // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing return Object.isExtensible(Object.preventExtensions({})); }); /***/ }), /* 263 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defineProperty = __webpack_require__(23).f; var create = __webpack_require__(49); var defineBuiltIns = __webpack_require__(154); var bind = __webpack_require__(48); var anInstance = __webpack_require__(108); var iterate = __webpack_require__(42); var defineIterator = __webpack_require__(131); var setSpecies = __webpack_require__(172); var DESCRIPTORS = __webpack_require__(14); var fastKey = __webpack_require__(94).fastKey; var InternalStateModule = __webpack_require__(43); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; module.exports = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, index: create(null), first: undefined, last: undefined, size: 0 }); if (!DESCRIPTORS) that.size = 0; if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { var state = getInternalState(that); var entry = getEntry(that, key); var previous, index; // change existing entry if (entry) { entry.value = value; // create new entry } else { state.last = entry = { index: index = fastKey(key, true), key: key, value: value, previous: previous = state.last, next: undefined, removed: false }; if (!state.first) state.first = entry; if (previous) previous.next = entry; if (DESCRIPTORS) state.size++; else that.size++; // add to index if (index !== 'F') state.index[index] = entry; } return that; }; var getEntry = function (that, key) { var state = getInternalState(that); // fast case var index = fastKey(key); var entry; if (index !== 'F') return state.index[index]; // frozen object case for (entry = state.first; entry; entry = entry.next) { if (entry.key == key) return entry; } }; defineBuiltIns(Prototype, { // `{ Map, Set }.prototype.clear()` methods // https://tc39.es/ecma262/#sec-map.prototype.clear // https://tc39.es/ecma262/#sec-set.prototype.clear clear: function clear() { var that = this; var state = getInternalState(that); var data = state.index; var entry = state.first; while (entry) { entry.removed = true; if (entry.previous) entry.previous = entry.previous.next = undefined; delete data[entry.index]; entry = entry.next; } state.first = state.last = undefined; if (DESCRIPTORS) state.size = 0; else that.size = 0; }, // `{ Map, Set }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-map.prototype.delete // https://tc39.es/ecma262/#sec-set.prototype.delete 'delete': function (key) { var that = this; var state = getInternalState(that); var entry = getEntry(that, key); if (entry) { var next = entry.next; var prev = entry.previous; delete state.index[entry.index]; entry.removed = true; if (prev) prev.next = next; if (next) next.previous = prev; if (state.first == entry) state.first = next; if (state.last == entry) state.last = prev; if (DESCRIPTORS) state.size--; else that.size--; } return !!entry; }, // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods // https://tc39.es/ecma262/#sec-map.prototype.foreach // https://tc39.es/ecma262/#sec-set.prototype.foreach forEach: function forEach(callbackfn /* , that = undefined */) { var state = getInternalState(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var entry; while (entry = entry ? entry.next : state.first) { boundFunction(entry.value, entry.key, this); // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; } }, // `{ Map, Set}.prototype.has(key)` methods // https://tc39.es/ecma262/#sec-map.prototype.has // https://tc39.es/ecma262/#sec-set.prototype.has has: function has(key) { return !!getEntry(this, key); } }); defineBuiltIns(Prototype, IS_MAP ? { // `Map.prototype.get(key)` method // https://tc39.es/ecma262/#sec-map.prototype.get get: function get(key) { var entry = getEntry(this, key); return entry && entry.value; }, // `Map.prototype.set(key, value)` method // https://tc39.es/ecma262/#sec-map.prototype.set set: function set(key, value) { return define(this, key === 0 ? 0 : key, value); } } : { // `Set.prototype.add(value)` method // https://tc39.es/ecma262/#sec-set.prototype.add add: function add(value) { return define(this, value = value === 0 ? 0 : value, value); } }); if (DESCRIPTORS) defineProperty(Prototype, 'size', { get: function () { return getInternalState(this).size; } }); return Constructor; }, setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) { var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods // https://tc39.es/ecma262/#sec-map.prototype.entries // https://tc39.es/ecma262/#sec-map.prototype.keys // https://tc39.es/ecma262/#sec-map.prototype.values // https://tc39.es/ecma262/#sec-map.prototype-@@iterator // https://tc39.es/ecma262/#sec-set.prototype.entries // https://tc39.es/ecma262/#sec-set.prototype.keys // https://tc39.es/ecma262/#sec-set.prototype.values // https://tc39.es/ecma262/#sec-set.prototype-@@iterator defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { setInternalState(this, { type: ITERATOR_NAME, target: iterated, state: getInternalCollectionState(iterated), kind: kind, last: undefined }); }, function () { var state = getInternalIteratorState(this); var kind = state.kind; var entry = state.last; // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; // get next entry if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { // or finish the iteration state.target = undefined; return { value: undefined, done: true }; } // return step by kind if (kind == 'keys') return { value: entry.key, done: false }; if (kind == 'values') return { value: entry.value, done: false }; return { value: [entry.key, entry.value], done: false }; }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); // `{ Map, Set }.prototype[@@species]` accessors // https://tc39.es/ecma262/#sec-get-map-@@species // https://tc39.es/ecma262/#sec-get-set-@@species setSpecies(CONSTRUCTOR_NAME); } }; /***/ }), /* 264 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(608); /***/ }), /* 265 */ /***/ (function(module, exports) { function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } module.exports = _arrayLikeToArray; /***/ }), /* 266 */ /***/ (function(module, exports) { function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } module.exports = _iterableToArray; /***/ }), /* 267 */ /***/ (function(module, exports, __webpack_require__) { var arrayLikeToArray = __webpack_require__(265); function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); } module.exports = _unsupportedIterableToArray; /***/ }), /* 268 */ /***/ (function(module, exports, __webpack_require__) { var baseRandom = __webpack_require__(631); /** * A specialized version of `_.shuffle` which mutates and sets the size of `array`. * * @private * @param {Array} array The array to shuffle. * @param {number} [size=array.length] The size of `array`. * @returns {Array} Returns `array`. */ function shuffleSelf(array, size) { var index = -1, length = array.length, lastIndex = length - 1; size = size === undefined ? length : size; while (++index < size) { var rand = baseRandom(index, lastIndex), value = array[rand]; array[rand] = array[index]; array[index] = value; } array.length = size; return array; } module.exports = shuffleSelf; /***/ }), /* 269 */ /***/ (function(module, exports, __webpack_require__) { var baseValues = __webpack_require__(633), keys = __webpack_require__(635); /** * Creates an array of the own enumerable string keyed property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.values(new Foo); * // => [1, 2] (iteration order is not guaranteed) * * _.values('hi'); * // => ['h', 'i'] */ function values(object) { return object == null ? [] : baseValues(object, keys(object)); } module.exports = values; /***/ }), /* 270 */ /***/ (function(module, exports, __webpack_require__) { var root = __webpack_require__(271); /** Built-in value references. */ var Symbol = root.Symbol; module.exports = Symbol; /***/ }), /* 271 */ /***/ (function(module, exports, __webpack_require__) { var freeGlobal = __webpack_require__(272); /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); module.exports = root; /***/ }), /* 272 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; module.exports = freeGlobal; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74))) /***/ }), /* 273 */ /***/ (function(module, exports) { /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; module.exports = isArray; /***/ }), /* 274 */ /***/ (function(module, exports) { module.exports = function(module) { if(!module.webpackPolyfill) { module.deprecate = function() {}; module.paths = []; // module.parent = undefined by default if(!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function() { return module.i; } }); module.webpackPolyfill = 1; } return module; }; /***/ }), /* 275 */ /***/ (function(module, exports) { /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } module.exports = isLength; /***/ }), /* 276 */ /***/ (function(module, exports) { /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } module.exports = overArg; /***/ }), /* 277 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var AV = __webpack_require__(278); var useLiveQuery = __webpack_require__(588); var useAdatpers = __webpack_require__(259); module.exports = useAdatpers(useLiveQuery(AV)); /***/ }), /* 278 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var AV = __webpack_require__(279); var useAdatpers = __webpack_require__(259); module.exports = useAdatpers(AV); /***/ }), /* 279 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = __webpack_require__(280); /***/ }), /* 280 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); /*! * LeanCloud JavaScript SDK * https://leancloud.cn * * Copyright 2016 LeanCloud.cn, Inc. * The LeanCloud JavaScript SDK is freely distributable under the MIT license. */ var _ = __webpack_require__(3); var AV = __webpack_require__(69); AV._ = _; AV.version = __webpack_require__(234); AV.Promise = _promise.default; AV.localStorage = __webpack_require__(236); AV.Cache = __webpack_require__(237); AV.Error = __webpack_require__(46); __webpack_require__(419); __webpack_require__(468)(AV); __webpack_require__(469)(AV); __webpack_require__(470)(AV); __webpack_require__(471)(AV); __webpack_require__(476)(AV); __webpack_require__(477)(AV); __webpack_require__(530)(AV); __webpack_require__(555)(AV); __webpack_require__(556)(AV); __webpack_require__(558)(AV); __webpack_require__(559)(AV); __webpack_require__(560)(AV); __webpack_require__(561)(AV); __webpack_require__(562)(AV); __webpack_require__(563)(AV); __webpack_require__(564)(AV); __webpack_require__(565)(AV); __webpack_require__(566)(AV); AV.Conversation = __webpack_require__(567); __webpack_require__(568); module.exports = AV; /** * Options to controll the authentication for an operation * @typedef {Object} AuthOptions * @property {String} [sessionToken] Specify a user to excute the operation as. * @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. * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set. */ /** * Options to controll the authentication for an SMS operation * @typedef {Object} SMSAuthOptions * @property {String} [sessionToken] Specify a user to excute the operation as. * @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. * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set. * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha} */ /***/ }), /* 281 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(282); __webpack_require__(39); module.exports = parent; /***/ }), /* 282 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(283); __webpack_require__(38); __webpack_require__(53); __webpack_require__(299); __webpack_require__(313); __webpack_require__(314); __webpack_require__(315); __webpack_require__(55); var path = __webpack_require__(5); module.exports = path.Promise; /***/ }), /* 283 */ /***/ (function(module, exports, __webpack_require__) { // TODO: Remove this module from `core-js@4` since it's replaced to module below __webpack_require__(284); /***/ }), /* 284 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var isPrototypeOf = __webpack_require__(19); var getPrototypeOf = __webpack_require__(100); var setPrototypeOf = __webpack_require__(102); var copyConstructorProperties = __webpack_require__(289); var create = __webpack_require__(49); var createNonEnumerableProperty = __webpack_require__(37); var createPropertyDescriptor = __webpack_require__(47); var clearErrorStack = __webpack_require__(292); var installErrorCause = __webpack_require__(293); var iterate = __webpack_require__(42); var normalizeStringArgument = __webpack_require__(294); var wellKnownSymbol = __webpack_require__(9); var ERROR_STACK_INSTALLABLE = __webpack_require__(295); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var $Error = Error; var push = [].push; var $AggregateError = function AggregateError(errors, message /* , options */) { var options = arguments.length > 2 ? arguments[2] : undefined; var isInstance = isPrototypeOf(AggregateErrorPrototype, this); var that; if (setPrototypeOf) { that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype); } else { that = isInstance ? this : create(AggregateErrorPrototype); createNonEnumerableProperty(that, TO_STRING_TAG, 'Error'); } if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message)); if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1)); installErrorCause(that, options); var errorsArray = []; iterate(errors, push, { that: errorsArray }); createNonEnumerableProperty(that, 'errors', errorsArray); return that; }; if (setPrototypeOf) setPrototypeOf($AggregateError, $Error); else copyConstructorProperties($AggregateError, $Error, { name: true }); var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, { constructor: createPropertyDescriptor(1, $AggregateError), message: createPropertyDescriptor(1, ''), name: createPropertyDescriptor(1, 'AggregateError') }); // `AggregateError` constructor // https://tc39.es/ecma262/#sec-aggregate-error-constructor $({ global: true, constructor: true, arity: 2 }, { AggregateError: $AggregateError }); /***/ }), /* 285 */ /***/ (function(module, exports, __webpack_require__) { var call = __webpack_require__(15); var isObject = __webpack_require__(11); var isSymbol = __webpack_require__(97); var getMethod = __webpack_require__(122); var ordinaryToPrimitive = __webpack_require__(286); var wellKnownSymbol = __webpack_require__(9); var $TypeError = TypeError; var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive module.exports = function (input, pref) { if (!isObject(input) || isSymbol(input)) return input; var exoticToPrim = getMethod(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === undefined) pref = 'default'; result = call(exoticToPrim, input, pref); if (!isObject(result) || isSymbol(result)) return result; throw $TypeError("Can't convert object to primitive value"); } if (pref === undefined) pref = 'number'; return ordinaryToPrimitive(input, pref); }; /***/ }), /* 286 */ /***/ (function(module, exports, __webpack_require__) { var call = __webpack_require__(15); var isCallable = __webpack_require__(8); var isObject = __webpack_require__(11); var $TypeError = TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive module.exports = function (input, pref) { var fn, val; if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val; if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; throw $TypeError("Can't convert object to primitive value"); }; /***/ }), /* 287 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); // eslint-disable-next-line es-x/no-object-defineproperty -- safe var defineProperty = Object.defineProperty; module.exports = function (key, value) { try { defineProperty(global, key, { value: value, configurable: true, writable: true }); } catch (error) { global[key] = value; } return value; }; /***/ }), /* 288 */ /***/ (function(module, exports, __webpack_require__) { var isCallable = __webpack_require__(8); var $String = String; var $TypeError = TypeError; module.exports = function (argument) { if (typeof argument == 'object' || isCallable(argument)) return argument; throw $TypeError("Can't set " + $String(argument) + ' as a prototype'); }; /***/ }), /* 289 */ /***/ (function(module, exports, __webpack_require__) { var hasOwn = __webpack_require__(13); var ownKeys = __webpack_require__(162); var getOwnPropertyDescriptorModule = __webpack_require__(62); var definePropertyModule = __webpack_require__(23); module.exports = function (target, source, exceptions) { var keys = ownKeys(source); var defineProperty = definePropertyModule.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) { defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } } }; /***/ }), /* 290 */ /***/ (function(module, exports) { var ceil = Math.ceil; var floor = Math.floor; // `Math.trunc` method // https://tc39.es/ecma262/#sec-math.trunc // eslint-disable-next-line es-x/no-math-trunc -- safe module.exports = Math.trunc || function trunc(x) { var n = +x; return (n > 0 ? floor : ceil)(n); }; /***/ }), /* 291 */ /***/ (function(module, exports, __webpack_require__) { var toIntegerOrInfinity = __webpack_require__(126); var min = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength module.exports = function (argument) { return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; /***/ }), /* 292 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var $Error = Error; var replace = uncurryThis(''.replace); var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd'); var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); module.exports = function (stack, dropEntries) { if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) { while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); } return stack; }; /***/ }), /* 293 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(11); var createNonEnumerableProperty = __webpack_require__(37); // `InstallErrorCause` abstract operation // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause module.exports = function (O, options) { if (isObject(options) && 'cause' in options) { createNonEnumerableProperty(O, 'cause', options.cause); } }; /***/ }), /* 294 */ /***/ (function(module, exports, __webpack_require__) { var toString = __webpack_require__(81); module.exports = function (argument, $default) { return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument); }; /***/ }), /* 295 */ /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__(2); var createPropertyDescriptor = __webpack_require__(47); module.exports = !fails(function () { var error = Error('a'); if (!('stack' in error)) return true; // eslint-disable-next-line es-x/no-object-defineproperty -- safe Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7)); return error.stack !== 7; }); /***/ }), /* 296 */ /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__(14); var hasOwn = __webpack_require__(13); var FunctionPrototype = Function.prototype; // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; var EXISTS = hasOwn(FunctionPrototype, 'name'); // additional protection from minified / mangled / dropped function names var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable)); module.exports = { EXISTS: EXISTS, PROPER: PROPER, CONFIGURABLE: CONFIGURABLE }; /***/ }), /* 297 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IteratorPrototype = __webpack_require__(171).IteratorPrototype; var create = __webpack_require__(49); var createPropertyDescriptor = __webpack_require__(47); var setToStringTag = __webpack_require__(52); var Iterators = __webpack_require__(50); var returnThis = function () { return this; }; module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) { var TO_STRING_TAG = NAME + ' Iterator'; IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) }); setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true); Iterators[TO_STRING_TAG] = returnThis; return IteratorConstructor; }; /***/ }), /* 298 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var TO_STRING_TAG_SUPPORT = __webpack_require__(129); var classof = __webpack_require__(51); // `Object.prototype.toString` method implementation // https://tc39.es/ecma262/#sec-object.prototype.tostring module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() { return '[object ' + classof(this) + ']'; }; /***/ }), /* 299 */ /***/ (function(module, exports, __webpack_require__) { // TODO: Remove this module from `core-js@4` since it's split to modules listed below __webpack_require__(300); __webpack_require__(308); __webpack_require__(309); __webpack_require__(310); __webpack_require__(311); __webpack_require__(312); /***/ }), /* 300 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var IS_PURE = __webpack_require__(33); var IS_NODE = __webpack_require__(107); var global = __webpack_require__(7); var call = __webpack_require__(15); var defineBuiltIn = __webpack_require__(44); var setPrototypeOf = __webpack_require__(102); var setToStringTag = __webpack_require__(52); var setSpecies = __webpack_require__(172); var aCallable = __webpack_require__(31); var isCallable = __webpack_require__(8); var isObject = __webpack_require__(11); var anInstance = __webpack_require__(108); var speciesConstructor = __webpack_require__(173); var task = __webpack_require__(175).set; var microtask = __webpack_require__(302); var hostReportErrors = __webpack_require__(305); var perform = __webpack_require__(82); var Queue = __webpack_require__(306); var InternalStateModule = __webpack_require__(43); var NativePromiseConstructor = __webpack_require__(65); var PromiseConstructorDetection = __webpack_require__(83); var newPromiseCapabilityModule = __webpack_require__(54); var PROMISE = 'Promise'; var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR; var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT; var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING; var getInternalPromiseState = InternalStateModule.getterFor(PROMISE); var setInternalState = InternalStateModule.set; var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; var PromiseConstructor = NativePromiseConstructor; var PromisePrototype = NativePromisePrototype; var TypeError = global.TypeError; var document = global.document; var process = global.process; var newPromiseCapability = newPromiseCapabilityModule.f; var newGenericPromiseCapability = newPromiseCapability; var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; var FULFILLED = 1; var REJECTED = 2; var HANDLED = 1; var UNHANDLED = 2; var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; // helpers var isThenable = function (it) { var then; return isObject(it) && isCallable(then = it.then) ? then : false; }; var callReaction = function (reaction, state) { var value = state.value; var ok = state.state == FULFILLED; var handler = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; var reject = reaction.reject; var domain = reaction.domain; var result, then, exited; try { if (handler) { if (!ok) { if (state.rejection === UNHANDLED) onHandleUnhandled(state); state.rejection = HANDLED; } if (handler === true) result = value; else { if (domain) domain.enter(); result = handler(value); // can throw if (domain) { domain.exit(); exited = true; } } if (result === reaction.promise) { reject(TypeError('Promise-chain cycle')); } else if (then = isThenable(result)) { call(then, result, resolve, reject); } else resolve(result); } else reject(value); } catch (error) { if (domain && !exited) domain.exit(); reject(error); } }; var notify = function (state, isReject) { if (state.notified) return; state.notified = true; microtask(function () { var reactions = state.reactions; var reaction; while (reaction = reactions.get()) { callReaction(reaction, state); } state.notified = false; if (isReject && !state.rejection) onUnhandled(state); }); }; var dispatchEvent = function (name, promise, reason) { var event, handler; if (DISPATCH_EVENT) { event = document.createEvent('Event'); event.promise = promise; event.reason = reason; event.initEvent(name, false, true); global.dispatchEvent(event); } else event = { promise: promise, reason: reason }; if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); }; var onUnhandled = function (state) { call(task, global, function () { var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); var result; if (IS_UNHANDLED) { result = perform(function () { if (IS_NODE) { process.emit('unhandledRejection', value, promise); } else dispatchEvent(UNHANDLED_REJECTION, promise, value); }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED; if (result.error) throw result.value; } }); }; var isUnhandled = function (state) { return state.rejection !== HANDLED && !state.parent; }; var onHandleUnhandled = function (state) { call(task, global, function () { var promise = state.facade; if (IS_NODE) { process.emit('rejectionHandled', promise); } else dispatchEvent(REJECTION_HANDLED, promise, state.value); }); }; var bind = function (fn, state, unwrap) { return function (value) { fn(state, value, unwrap); }; }; var internalReject = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; state.value = value; state.state = REJECTED; notify(state, true); }; var internalResolve = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; try { if (state.facade === value) throw TypeError("Promise can't be resolved itself"); var then = isThenable(value); if (then) { microtask(function () { var wrapper = { done: false }; try { call(then, value, bind(internalResolve, wrapper, state), bind(internalReject, wrapper, state) ); } catch (error) { internalReject(wrapper, error, state); } }); } else { state.value = value; state.state = FULFILLED; notify(state, false); } } catch (error) { internalReject({ done: false }, error, state); } }; // constructor polyfill if (FORCED_PROMISE_CONSTRUCTOR) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { anInstance(this, PromisePrototype); aCallable(executor); call(Internal, this); var state = getInternalPromiseState(this); try { executor(bind(internalResolve, state), bind(internalReject, state)); } catch (error) { internalReject(state, error); } }; PromisePrototype = PromiseConstructor.prototype; // eslint-disable-next-line no-unused-vars -- required for `.length` Internal = function Promise(executor) { setInternalState(this, { type: PROMISE, done: false, notified: false, parent: false, reactions: new Queue(), rejection: false, state: PENDING, value: undefined }); }; // `Promise.prototype.then` method // https://tc39.es/ecma262/#sec-promise.prototype.then Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) { var state = getInternalPromiseState(this); var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); state.parent = true; reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; reaction.fail = isCallable(onRejected) && onRejected; reaction.domain = IS_NODE ? process.domain : undefined; if (state.state == PENDING) state.reactions.add(reaction); else microtask(function () { callReaction(reaction, state); }); return reaction.promise; }); OwnPromiseCapability = function () { var promise = new Internal(); var state = getInternalPromiseState(promise); this.promise = promise; this.resolve = bind(internalResolve, state); this.reject = bind(internalReject, state); }; newPromiseCapabilityModule.f = newPromiseCapability = function (C) { return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) { nativeThen = NativePromisePrototype.then; if (!NATIVE_PROMISE_SUBCLASSING) { // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) { var that = this; return new PromiseConstructor(function (resolve, reject) { call(nativeThen, that, resolve, reject); }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640 }, { unsafe: true }); } // make `.constructor === Promise` work for native promise-based APIs try { delete NativePromisePrototype.constructor; } catch (error) { /* empty */ } // make `instanceof Promise` work for native promise-based APIs if (setPrototypeOf) { setPrototypeOf(NativePromisePrototype, PromisePrototype); } } } $({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, { Promise: PromiseConstructor }); setToStringTag(PromiseConstructor, PROMISE, false, true); setSpecies(PROMISE); /***/ }), /* 301 */ /***/ (function(module, exports) { var $TypeError = TypeError; module.exports = function (passed, required) { if (passed < required) throw $TypeError('Not enough arguments'); return passed; }; /***/ }), /* 302 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var bind = __webpack_require__(48); var getOwnPropertyDescriptor = __webpack_require__(62).f; var macrotask = __webpack_require__(175).set; var IS_IOS = __webpack_require__(176); var IS_IOS_PEBBLE = __webpack_require__(303); var IS_WEBOS_WEBKIT = __webpack_require__(304); var IS_NODE = __webpack_require__(107); var MutationObserver = global.MutationObserver || global.WebKitMutationObserver; var document = global.document; var process = global.process; var Promise = global.Promise; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask'); var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; var flush, head, last, notify, toggle, node, promise, then; // modern engines have queueMicrotask method if (!queueMicrotask) { flush = function () { var parent, fn; if (IS_NODE && (parent = process.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; try { fn(); } catch (error) { if (head) notify(); else last = undefined; throw error; } } last = undefined; if (parent) parent.enter(); }; // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) { toggle = true; node = document.createTextNode(''); new MutationObserver(flush).observe(node, { characterData: true }); notify = function () { node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) { // Promise.resolve without an argument throws an error in LG WebOS 2 promise = Promise.resolve(undefined); // workaround of WebKit ~ iOS Safari 10.1 bug promise.constructor = Promise; then = bind(promise.then, promise); notify = function () { then(flush); }; // Node.js without promises } else if (IS_NODE) { notify = function () { process.nextTick(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessage // - onreadystatechange // - setTimeout } else { // strange IE + webpack dev server bug - use .bind(global) macrotask = bind(macrotask, global); notify = function () { macrotask(flush); }; } } module.exports = queueMicrotask || function (fn) { var task = { fn: fn, next: undefined }; if (last) last.next = task; if (!head) { head = task; notify(); } last = task; }; /***/ }), /* 303 */ /***/ (function(module, exports, __webpack_require__) { var userAgent = __webpack_require__(98); var global = __webpack_require__(7); module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined; /***/ }), /* 304 */ /***/ (function(module, exports, __webpack_require__) { var userAgent = __webpack_require__(98); module.exports = /web0s(?!.*chrome)/i.test(userAgent); /***/ }), /* 305 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); module.exports = function (a, b) { var console = global.console; if (console && console.error) { arguments.length == 1 ? console.error(a) : console.error(a, b); } }; /***/ }), /* 306 */ /***/ (function(module, exports) { var Queue = function () { this.head = null; this.tail = null; }; Queue.prototype = { add: function (item) { var entry = { item: item, next: null }; if (this.head) this.tail.next = entry; else this.head = entry; this.tail = entry; }, get: function () { var entry = this.head; if (entry) { this.head = entry.next; if (this.tail === entry) this.tail = null; return entry.item; } } }; module.exports = Queue; /***/ }), /* 307 */ /***/ (function(module, exports) { module.exports = typeof window == 'object' && typeof Deno != 'object'; /***/ }), /* 308 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var call = __webpack_require__(15); var aCallable = __webpack_require__(31); var newPromiseCapabilityModule = __webpack_require__(54); var perform = __webpack_require__(82); var iterate = __webpack_require__(42); var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177); // `Promise.all` method // https://tc39.es/ecma262/#sec-promise.all $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { all: function all(iterable) { var C = this; var capability = newPromiseCapabilityModule.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var $promiseResolve = aCallable(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; remaining++; call($promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if (result.error) reject(result.value); return capability.promise; } }); /***/ }), /* 309 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var IS_PURE = __webpack_require__(33); var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR; var NativePromiseConstructor = __webpack_require__(65); var getBuiltIn = __webpack_require__(18); var isCallable = __webpack_require__(8); var defineBuiltIn = __webpack_require__(44); var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; // `Promise.prototype.catch` method // https://tc39.es/ecma262/#sec-promise.prototype.catch $({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, { 'catch': function (onRejected) { return this.then(undefined, onRejected); } }); // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` if (!IS_PURE && isCallable(NativePromiseConstructor)) { var method = getBuiltIn('Promise').prototype['catch']; if (NativePromisePrototype['catch'] !== method) { defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true }); } } /***/ }), /* 310 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var call = __webpack_require__(15); var aCallable = __webpack_require__(31); var newPromiseCapabilityModule = __webpack_require__(54); var perform = __webpack_require__(82); var iterate = __webpack_require__(42); var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(177); // `Promise.race` method // https://tc39.es/ecma262/#sec-promise.race $({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { race: function race(iterable) { var C = this; var capability = newPromiseCapabilityModule.f(C); var reject = capability.reject; var result = perform(function () { var $promiseResolve = aCallable(C.resolve); iterate(iterable, function (promise) { call($promiseResolve, C, promise).then(capability.resolve, reject); }); }); if (result.error) reject(result.value); return capability.promise; } }); /***/ }), /* 311 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var call = __webpack_require__(15); var newPromiseCapabilityModule = __webpack_require__(54); var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR; // `Promise.reject` method // https://tc39.es/ecma262/#sec-promise.reject $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, { reject: function reject(r) { var capability = newPromiseCapabilityModule.f(this); call(capability.reject, undefined, r); return capability.promise; } }); /***/ }), /* 312 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var getBuiltIn = __webpack_require__(18); var IS_PURE = __webpack_require__(33); var NativePromiseConstructor = __webpack_require__(65); var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR; var promiseResolve = __webpack_require__(179); var PromiseConstructorWrapper = getBuiltIn('Promise'); var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR; // `Promise.resolve` method // https://tc39.es/ecma262/#sec-promise.resolve $({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, { resolve: function resolve(x) { return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x); } }); /***/ }), /* 313 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var call = __webpack_require__(15); var aCallable = __webpack_require__(31); var newPromiseCapabilityModule = __webpack_require__(54); var perform = __webpack_require__(82); var iterate = __webpack_require__(42); // `Promise.allSettled` method // https://tc39.es/ecma262/#sec-promise.allsettled $({ target: 'Promise', stat: true }, { allSettled: function allSettled(iterable) { var C = this; var capability = newPromiseCapabilityModule.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var promiseResolve = aCallable(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; remaining++; call(promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = { status: 'fulfilled', value: value }; --remaining || resolve(values); }, function (error) { if (alreadyCalled) return; alreadyCalled = true; values[index] = { status: 'rejected', reason: error }; --remaining || resolve(values); }); }); --remaining || resolve(values); }); if (result.error) reject(result.value); return capability.promise; } }); /***/ }), /* 314 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var call = __webpack_require__(15); var aCallable = __webpack_require__(31); var getBuiltIn = __webpack_require__(18); var newPromiseCapabilityModule = __webpack_require__(54); var perform = __webpack_require__(82); var iterate = __webpack_require__(42); var PROMISE_ANY_ERROR = 'No one promise resolved'; // `Promise.any` method // https://tc39.es/ecma262/#sec-promise.any $({ target: 'Promise', stat: true }, { any: function any(iterable) { var C = this; var AggregateError = getBuiltIn('AggregateError'); var capability = newPromiseCapabilityModule.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var promiseResolve = aCallable(C.resolve); var errors = []; var counter = 0; var remaining = 1; var alreadyResolved = false; iterate(iterable, function (promise) { var index = counter++; var alreadyRejected = false; remaining++; call(promiseResolve, C, promise).then(function (value) { if (alreadyRejected || alreadyResolved) return; alreadyResolved = true; resolve(value); }, function (error) { if (alreadyRejected || alreadyResolved) return; alreadyRejected = true; errors[index] = error; --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); }); }); --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); }); if (result.error) reject(result.value); return capability.promise; } }); /***/ }), /* 315 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var IS_PURE = __webpack_require__(33); var NativePromiseConstructor = __webpack_require__(65); var fails = __webpack_require__(2); var getBuiltIn = __webpack_require__(18); var isCallable = __webpack_require__(8); var speciesConstructor = __webpack_require__(173); var promiseResolve = __webpack_require__(179); var defineBuiltIn = __webpack_require__(44); var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 var NON_GENERIC = !!NativePromiseConstructor && fails(function () { // eslint-disable-next-line unicorn/no-thenable -- required for testing NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); }); // `Promise.prototype.finally` method // https://tc39.es/ecma262/#sec-promise.prototype.finally $({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, { 'finally': function (onFinally) { var C = speciesConstructor(this, getBuiltIn('Promise')); var isFunction = isCallable(onFinally); return this.then( isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally, isFunction ? function (e) { return promiseResolve(C, onFinally()).then(function () { throw e; }); } : onFinally ); } }); // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then` if (!IS_PURE && isCallable(NativePromiseConstructor)) { var method = getBuiltIn('Promise').prototype['finally']; if (NativePromisePrototype['finally'] !== method) { defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true }); } } /***/ }), /* 316 */ /***/ (function(module, exports, __webpack_require__) { var uncurryThis = __webpack_require__(4); var toIntegerOrInfinity = __webpack_require__(126); var toString = __webpack_require__(81); var requireObjectCoercible = __webpack_require__(121); var charAt = uncurryThis(''.charAt); var charCodeAt = uncurryThis(''.charCodeAt); var stringSlice = uncurryThis(''.slice); var createMethod = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = toString(requireObjectCoercible($this)); var position = toIntegerOrInfinity(pos); var size = S.length; var first, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; first = charCodeAt(S, position); return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? charAt(S, position) : first : CONVERT_TO_STRING ? stringSlice(S, position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; }; }; module.exports = { // `String.prototype.codePointAt` method // https://tc39.es/ecma262/#sec-string.prototype.codepointat codeAt: createMethod(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at charAt: createMethod(true) }; /***/ }), /* 317 */ /***/ (function(module, exports) { // iterable DOM collections // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods module.exports = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }; /***/ }), /* 318 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(132); // Default Export // ============== // In this module, we mix our bundled exports into the `_` object and export // the result. This is analogous to setting `module.exports = _` in CommonJS. // Hence, this module is also the entry point of our UMD bundle and the package // entry point for CommonJS and AMD users. In other words, this is (the source // of) the module you are interfacing with when you do any of the following: // // ```js // // CommonJS // var _ = require('underscore'); // // // AMD // define(['underscore'], function(_) {...}); // // // UMD in the browser // // _ is available as a global variable // ``` // Add all of the Underscore functions to the wrapper object. var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__); // Legacy Node.js API. _._ = _; // Export the Underscore API. /* harmony default export */ __webpack_exports__["a"] = (_); /***/ }), /* 319 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isNull; // Is a given value equal to null? function isNull(obj) { return obj === null; } /***/ }), /* 320 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isElement; // Is a given value a DOM element? function isElement(obj) { return !!(obj && obj.nodeType === 1); } /***/ }), /* 321 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date')); /***/ }), /* 322 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp')); /***/ }), /* 323 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error')); /***/ }), /* 324 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object')); /***/ }), /* 325 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isFinite; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(183); // Is a given object a finite number? function isFinite(obj) { return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj)); } /***/ }), /* 326 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(188); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(136); // Internal helper to determine whether we should spend extensive checks against // `ArrayBuffer` et al. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */])); /***/ }), /* 327 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(133); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(135); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(16); // Is a given array, string, or object empty? // An "empty" object has no enumerable own-properties. function isEmpty(obj) { if (obj == null) return true; // Skip the more expensive `toString`-based type checks if `obj` has no // `.length`. var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj); if (typeof length == 'number' && ( 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) )) return length === 0; return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0; } /***/ }), /* 328 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isEqual; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(136); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(186); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(84); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(134); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(329); // We use this string twice, so give it a name for minification. var tagDataView = '[object DataView]'; // Internal recursive comparison function for `_.isEqual`. function eq(a, b, aStack, bStack) { // Identical objects are equal. `0 === -0`, but they aren't identical. // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal). if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison). if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive. if (a !== a) return b !== b; // Exhaust primitive checks var type = typeof a; if (type !== 'function' && type !== 'object' && typeof b != 'object') return false; return deepEq(a, b, aStack, bStack); } // Internal recursive comparison function for `_.isEqual`. function deepEq(a, b, aStack, bStack) { // Unwrap any wrapped objects. if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped; if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped; // Compare `[[Class]]` names. var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a); if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false; // Work around a bug in IE 10 - Edge 13. if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) { if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false; className = tagDataView; } switch (className) { // These types are compared by value. case '[object RegExp]': // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') case '[object String]': // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. return '' + a === '' + b; case '[object Number]': // `NaN`s are equivalent, but non-reflexive. // Object(NaN) is equivalent to NaN. if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values. return +a === 0 ? 1 / +a === 1 / b : +a === +b; case '[object Date]': case '[object Boolean]': // Coerce dates and booleans to numeric primitive values. Dates are compared by their // millisecond representations. Note that invalid dates with millisecond representations // of `NaN` are not equivalent. return +a === +b; case '[object Symbol]': return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b); case '[object ArrayBuffer]': case tagDataView: // Coerce to typed array so we can fall through. return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack); } var areArrays = className === '[object Array]'; if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) { var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a); if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false; if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true; areArrays = true; } if (!areArrays) { if (typeof a != 'object' || typeof b != 'object') return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s // from different frames are. var aCtor = a.constructor, bCtor = b.constructor; if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor && Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor) && ('constructor' in a && 'constructor' in b)) { return false; } } // Assume equality for cyclic structures. The algorithm for detecting cyclic // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. // Initializing stack of traversed objects. // It's done here since we only need them for objects and arrays comparison. aStack = aStack || []; bStack = bStack || []; var length = aStack.length; while (length--) { // Linear search. Performance is inversely proportional to the number of // unique nested structures. if (aStack[length] === a) return bStack[length] === b; } // Add the first object to the stack of traversed objects. aStack.push(a); bStack.push(b); // Recursively compare objects and arrays. if (areArrays) { // Compare array lengths to determine if a deep comparison is necessary. length = a.length; if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties. while (length--) { if (!eq(a[length], b[length], aStack, bStack)) return false; } } else { // Deep compare objects. var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key; length = _keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality. if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false; while (length--) { // Deep compare each member key = _keys[length]; if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false; } } // Remove the first object from the stack of traversed objects. aStack.pop(); bStack.pop(); return true; } // Perform a deep comparison to check if two objects are equal. function isEqual(a, b) { return eq(a, b); } /***/ }), /* 329 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(136); // Internal function to wrap or shallow-copy an ArrayBuffer, // typed array or DataView to a new view, reusing the buffer. function toBufferView(bufferSource) { return new Uint8Array( bufferSource.buffer || bufferSource, bufferSource.byteOffset || 0, Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource) ); } /***/ }), /* 330 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137); /* 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')); /***/ }), /* 331 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137); /* 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')); /***/ }), /* 332 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(137); /* 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')); /***/ }), /* 333 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17); /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet')); /***/ }), /* 334 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = pairs; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16); // Convert an object into a list of `[key, value]` pairs. // The opposite of `_.object` with one argument. function pairs(obj) { var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj); var length = _keys.length; var pairs = Array(length); for (var i = 0; i < length; i++) { pairs[i] = [_keys[i], obj[_keys[i]]]; } return pairs; } /***/ }), /* 335 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = create; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(196); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(139); // Creates an object that inherits from the given prototype object. // If additional properties are provided then they will be added to the // created object. function create(prototype, props) { var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype); if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props); return result; } /***/ }), /* 336 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = tap; // Invokes `interceptor` with the `obj` and then returns `obj`. // The primary purpose of this method is to "tap into" a method chain, in // order to perform operations on intermediate results within the chain. function tap(obj, interceptor) { interceptor(obj); return obj; } /***/ }), /* 337 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = has; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86); // Shortcut function for checking if an object has a given property directly on // itself (in other words, not on a prototype). Unlike the internal `has` // function, this public version can also traverse nested properties. function has(obj, path) { path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path); var length = path.length; for (var i = 0; i < length; i++) { var key = path[i]; if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false; obj = obj[key]; } return !!length; } /***/ }), /* 338 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = mapObject; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16); // Returns the results of applying the `iteratee` to each element of `obj`. // In contrast to `_.map` it returns an object. function mapObject(obj, iteratee, context) { iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context); var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), length = _keys.length, results = {}; for (var index = 0; index < length; index++) { var currentKey = _keys[index]; results[currentKey] = iteratee(obj[currentKey], currentKey, obj); } return results; } /***/ }), /* 339 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(202); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(198); // Generates a function for a given object that returns a given property. function propertyOf(obj) { if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */]; return function(path) { return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path); }; } /***/ }), /* 340 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = times; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87); // Run a function **n** times. function times(n, iteratee, context) { var accum = Array(Math.max(0, n)); iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1); for (var i = 0; i < n; i++) accum[i] = iteratee(i); return accum; } /***/ }), /* 341 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205); // Function for escaping strings to HTML interpolation. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */])); /***/ }), /* 342 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(204); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(343); // Function for unescaping strings from HTML interpolation. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */])); /***/ }), /* 343 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(192); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(205); // Internal list of HTML entities for unescaping. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */])); /***/ }), /* 344 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = template; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(195); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(206); // When customizing `_.templateSettings`, if you don't want to define an // interpolation, evaluation or escaping regex, we need one that is // guaranteed not to match. var noMatch = /(.)^/; // Certain characters need to be escaped so that they can be put into a // string literal. var escapes = { "'": "'", '\\': '\\', '\r': 'r', '\n': 'n', '\u2028': 'u2028', '\u2029': 'u2029' }; var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g; function escapeChar(match) { return '\\' + escapes[match]; } var bareIdentifier = /^\s*(\w|\$)+\s*$/; // JavaScript micro-templating, similar to John Resig's implementation. // Underscore templating handles arbitrary delimiters, preserves whitespace, // and correctly escapes quotes within interpolated code. // NB: `oldSettings` only exists for backwards compatibility. function template(text, settings, oldSettings) { if (!settings && oldSettings) settings = oldSettings; settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings); // Combine delimiters into one regular expression via alternation. var matcher = RegExp([ (settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source ].join('|') + '|$', 'g'); // Compile the template source, escaping string literals appropriately. var index = 0; var source = "__p+='"; text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { source += text.slice(index, offset).replace(escapeRegExp, escapeChar); index = offset + match.length; if (escape) { source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; } else if (interpolate) { source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; } else if (evaluate) { source += "';\n" + evaluate + "\n__p+='"; } // Adobe VMs need the match returned to produce the correct offset. return match; }); source += "';\n"; var argument = settings.variable; if (argument) { if (!bareIdentifier.test(argument)) throw new Error(argument); } else { // If a variable is not specified, place data values in local scope. source = 'with(obj||{}){\n' + source + '}\n'; argument = 'obj'; } source = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + source + 'return __p;\n'; var render; try { render = new Function(argument, '_', source); } catch (e) { e.source = source; throw e; } var template = function(data) { return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]); }; // Provide the compiled source as a convenience for precompilation. template.source = 'function(' + argument + '){\n' + source + '}'; return template; } /***/ }), /* 345 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = result; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86); // Traverses the children of `obj` along `path`. If a child is a function, it // is invoked with its parent as context. Returns the value of the final // child, or `fallback` if any child is undefined. function result(obj, path, fallback) { path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path); var length = path.length; if (!length) { return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback; } for (var i = 0; i < length; i++) { var prop = obj == null ? void 0 : obj[path[i]]; if (prop === void 0) { prop = fallback; i = length; // Ensure we don't continue iterating. } obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop; } return obj; } /***/ }), /* 346 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId; // Generate a unique integer id (unique within the entire client session). // Useful for temporary DOM ids. var idCounter = 0; function uniqueId(prefix) { var id = ++idCounter + ''; return prefix ? prefix + id : id; } /***/ }), /* 347 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = chain; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); // Start chaining a wrapped Underscore object. function chain(obj) { var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj); instance._chain = true; return instance; } /***/ }), /* 348 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(208); // Bind a number of an object's methods to that object. Remaining arguments // are the method names to be bound. Useful for ensuring that all callbacks // defined on an object belong to it. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) { keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false); var index = keys.length; if (index < 1) throw new Error('bindAll must be passed function names'); while (index--) { var key = keys[index]; obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj); } return obj; })); /***/ }), /* 349 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = memoize; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45); // Memoize an expensive function by storing its results. function memoize(func, hasher) { var memoize = function(key) { var cache = memoize.cache; var address = '' + (hasher ? hasher.apply(this, arguments) : key); if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments); return cache[address]; }; memoize.cache = {}; return memoize; } /***/ }), /* 350 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(209); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25); // Defers a function, scheduling it to run after the current call stack has // cleared. /* 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)); /***/ }), /* 351 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = throttle; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(143); // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. Normally, the throttled function will run // as much as it can, without ever going more than once per `wait` duration; // but if you'd like to disable the execution on the leading edge, pass // `{leading: false}`. To disable execution on the trailing edge, ditto. function throttle(func, wait, options) { var timeout, context, args, result; var previous = 0; if (!options) options = {}; var later = function() { previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])(); timeout = null; result = func.apply(context, args); if (!timeout) context = args = null; }; var throttled = function() { var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])(); if (!previous && options.leading === false) previous = _now; var remaining = wait - (_now - previous); context = this; args = arguments; if (remaining <= 0 || remaining > wait) { if (timeout) { clearTimeout(timeout); timeout = null; } previous = _now; result = func.apply(context, args); if (!timeout) context = args = null; } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; throttled.cancel = function() { clearTimeout(timeout); previous = 0; timeout = context = args = null; }; return throttled; } /***/ }), /* 352 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = debounce; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(143); // When a sequence of calls of the returned function ends, the argument // function is triggered. The end of a sequence is defined by the `wait` // parameter. If `immediate` is passed, the argument function will be // triggered at the beginning of the sequence instead of at the end. function debounce(func, wait, immediate) { var timeout, previous, args, result, context; var later = function() { var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous; if (wait > passed) { timeout = setTimeout(later, wait - passed); } else { timeout = null; if (!immediate) result = func.apply(context, args); // This check is needed because `func` can recursively invoke `debounced`. if (!timeout) args = context = null; } }; var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) { context = this; args = _args; previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])(); if (!timeout) { timeout = setTimeout(later, wait); if (immediate) result = func.apply(context, args); } return result; }); debounced.cancel = function() { clearTimeout(timeout); timeout = args = context = null; }; return debounced; } /***/ }), /* 353 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = wrap; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112); // Returns the first function passed as an argument to the second, // allowing you to adjust arguments, run code before and after, and // conditionally execute the original function. function wrap(func, wrapper) { return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func); } /***/ }), /* 354 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = compose; // Returns a function that is the composition of a list of functions, each // consuming the return value of the function that follows. function compose() { var args = arguments; var start = args.length - 1; return function() { var i = start; var result = args[start].apply(this, arguments); while (i--) result = args[i].call(this, result); return result; }; } /***/ }), /* 355 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = after; // Returns a function that will only be executed on and after the Nth call. function after(times, func) { return function() { if (--times < 1) { return func.apply(this, arguments); } }; } /***/ }), /* 356 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(210); // Returns a function that will be executed at most one time, no matter how // often you call it. Useful for lazy initialization. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2)); /***/ }), /* 357 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(213); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(216); // Return the position of the last occurrence of an item in an array, // or -1 if the item is not included in the array. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */])); /***/ }), /* 358 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = findWhere; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(217); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111); // Convenience version of a common use case of `_.find`: getting the first // object containing specific `key:value` pairs. function findWhere(obj, attrs) { return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs)); } /***/ }), /* 359 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218); // **Reduce** builds up a single result from a list of values, aka `inject`, // or `foldl`. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1)); /***/ }), /* 360 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(218); // The right-associative version of reduce, also known as `foldr`. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1)); /***/ }), /* 361 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = reject; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(144); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21); // Return all the elements for which a truth test fails. function reject(obj, predicate, context) { 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); } /***/ }), /* 362 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = every; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16); // Determine whether all of the elements pass a truth test. function every(obj, predicate, context) { predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context); var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj), length = (_keys || obj).length; for (var index = 0; index < length; index++) { var currentKey = _keys ? _keys[index] : index; if (!predicate(obj[currentKey], currentKey, obj)) return false; } return true; } /***/ }), /* 363 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = some; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16); // Determine if at least one element in the object passes a truth test. function some(obj, predicate, context) { predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context); var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj), length = (_keys || obj).length; for (var index = 0; index < length; index++) { var currentKey = _keys ? _keys[index] : index; if (predicate(obj[currentKey], currentKey, obj)) return true; } return false; } /***/ }), /* 364 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(140); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(86); // Invoke a method (with arguments) on every item in a collection. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) { var contextPath, func; if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) { func = path; } else { path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path); contextPath = path.slice(0, -1); path = path[path.length - 1]; } return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) { var method = func; if (!method) { if (contextPath && contextPath.length) { context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath); } if (context == null) return void 0; method = context[path]; } return method == null ? method : method.apply(context, args); }); })); /***/ }), /* 365 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = where; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111); // Convenience version of a common use case of `_.filter`: selecting only // objects containing specific `key:value` pairs. function where(obj, attrs) { return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs)); } /***/ }), /* 366 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = min; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58); // Return the minimum element (or element-based computation). function min(obj, iteratee, context) { var result = Infinity, lastComputed = Infinity, value, computed; if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) { obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj); for (var i = 0, length = obj.length; i < length; i++) { value = obj[i]; if (value != null && value < result) { result = value; } } } else { iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context); Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) { computed = iteratee(v, index, list); if (computed < lastComputed || computed === Infinity && result === Infinity) { result = v; lastComputed = computed; } }); } return result; } /***/ }), /* 367 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = shuffle; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(220); // Shuffle a collection. function shuffle(obj) { return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity); } /***/ }), /* 368 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = sortBy; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(146); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68); // Sort the object's values by a criterion produced by an iteratee. function sortBy(obj, iteratee, context) { var index = 0; iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context); return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) { return { value: value, index: index++, criteria: iteratee(value, key, list) }; }).sort(function(left, right) { var a = left.criteria; var b = right.criteria; if (a !== b) { if (a > b || a === void 0) return 1; if (a < b || b === void 0) return -1; } return left.index - right.index; }), 'value'); } /***/ }), /* 369 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45); // Groups the object's values by a criterion. Pass either a string attribute // to group by, or a function that returns the criterion. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) { if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value]; })); /***/ }), /* 370 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113); // Indexes the object's values by a criterion, similar to `_.groupBy`, but for // when you know that your index values will be unique. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) { result[key] = value; })); /***/ }), /* 371 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45); // Counts instances of an object that group by a certain criterion. Pass // either a string attribute to count by, or a function that returns the // criterion. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) { if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1; })); /***/ }), /* 372 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113); // Split a collection into two arrays: one whose elements all pass the given // truth test, and one whose elements all do not pass the truth test. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) { result[pass ? 0 : 1].push(value); }, true)); /***/ }), /* 373 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = toArray; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(57); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(133); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(68); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(141); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(66); // Safely create a real, live array from anything iterable. var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g; function toArray(obj) { if (!obj) return []; if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj); if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) { // Keep surrogate pair characters together. return obj.match(reStrSymbol); } 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 */]); return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj); } /***/ }), /* 374 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = size; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16); // Return the number of elements in a collection. function size(obj) { if (obj == null) return 0; return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length; } /***/ }), /* 375 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj; // Internal `_.pick` helper function to determine whether `key` is an enumerable // property name of `obj`. function keyInObj(value, key, obj) { return key in obj; } /***/ }), /* 376 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(144); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(68); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(67); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(89); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(221); // Return a copy of the object without the disallowed properties. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) { var iteratee = keys[0], context; if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) { iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee); if (keys.length > 1) context = keys[1]; } else { keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String); iteratee = function(value, key) { return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key); }; } return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context); })); /***/ }), /* 377 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = first; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(222); // Get the first element of an array. Passing **n** will return the first N // values in the array. The **guard** check allows it to work with `_.map`. function first(array, n, guard) { if (array == null || array.length < 1) return n == null || guard ? void 0 : []; if (n == null || guard) return array[0]; return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n); } /***/ }), /* 378 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = last; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(223); // Get the last element of an array. Passing **n** will return the last N // values in the array. function last(array, n, guard) { if (array == null || array.length < 1) return n == null || guard ? void 0 : []; if (n == null || guard) return array[array.length - 1]; return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n)); } /***/ }), /* 379 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = compact; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88); // Trim out all falsy values from an array. function compact(array) { return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean); } /***/ }), /* 380 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = flatten; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(67); // Flatten out an array, either recursively (by default), or up to `depth`. // Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively. function flatten(array, depth) { return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false); } /***/ }), /* 381 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(224); // Return a version of the array that does not contain the specified value(s). /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) { return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays); })); /***/ }), /* 382 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(225); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(67); // Produce an array that contains the union: each distinct element from all of // the passed-in arrays. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) { return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true)); })); /***/ }), /* 383 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = intersection; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(89); // Produce an array that contains every item shared between all the // passed-in arrays. function intersection(array) { var result = []; var argsLength = arguments.length; for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) { var item = array[i]; if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue; var j; for (j = 1; j < argsLength; j++) { if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break; } if (j === argsLength) result.push(item); } return result; } /***/ }), /* 384 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(226); // Zip together multiple lists into a single array -- elements that share // an index go together. /* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */])); /***/ }), /* 385 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = object; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29); // Converts lists into objects. Pass either a single array of `[key, value]` // pairs, or two parallel arrays of the same length -- one of keys, and one of // the corresponding values. Passing by pairs is the reverse of `_.pairs`. function object(list, values) { var result = {}; for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) { if (values) { result[list[i]] = values[i]; } else { result[list[i][0]] = list[i][1]; } } return result; } /***/ }), /* 386 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = range; // Generate an integer Array containing an arithmetic progression. A port of // the native Python `range()` function. See // [the Python documentation](https://docs.python.org/library/functions.html#range). function range(start, stop, step) { if (stop == null) { stop = start || 0; start = 0; } if (!step) { step = stop < start ? -1 : 1; } var length = Math.max(Math.ceil((stop - start) / step), 0); var range = Array(length); for (var idx = 0; idx < length; idx++, start += step) { range[idx] = start; } return range; } /***/ }), /* 387 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = chunk; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6); // Chunk a single array into multiple arrays, each containing `count` or fewer // items. function chunk(array, count) { if (count == null || count < 1) return []; var result = []; var i = 0, length = array.length; while (i < length) { result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count)); } return result; } /***/ }), /* 388 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = mixin; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(193); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(227); // Add your own custom functions to the Underscore object. function mixin(obj) { Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) { var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name]; __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() { var args = [this._wrapped]; __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments); return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args)); }; }); return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]; } /***/ }), /* 389 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(227); // Add all mutator `Array` functions to the wrapper. Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name]; __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() { var obj = this._wrapped; if (obj != null) { method.apply(obj, arguments); if ((name === 'shift' || name === 'splice') && obj.length === 0) { delete obj[0]; } } return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj); }; }); // Add all accessor `Array` functions to the wrapper. Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) { var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name]; __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() { var obj = this._wrapped; if (obj != null) obj = method.apply(obj, arguments); return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj); }; }); /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]); /***/ }), /* 390 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(391); module.exports = parent; /***/ }), /* 391 */ /***/ (function(module, exports, __webpack_require__) { var isPrototypeOf = __webpack_require__(19); var method = __webpack_require__(392); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.concat; return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own; }; /***/ }), /* 392 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(228); var entryVirtual = __webpack_require__(40); module.exports = entryVirtual('Array').concat; /***/ }), /* 393 */ /***/ (function(module, exports) { var $TypeError = TypeError; var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991 module.exports = function (it) { if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded'); return it; }; /***/ }), /* 394 */ /***/ (function(module, exports, __webpack_require__) { var isArray = __webpack_require__(90); var isConstructor = __webpack_require__(109); var isObject = __webpack_require__(11); var wellKnownSymbol = __webpack_require__(9); var SPECIES = wellKnownSymbol('species'); var $Array = Array; // a part of `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray) { var C; if (isArray(originalArray)) { C = originalArray.constructor; // cross-realm fallback if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined; else if (isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return C === undefined ? $Array : C; }; /***/ }), /* 395 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(396); module.exports = parent; /***/ }), /* 396 */ /***/ (function(module, exports, __webpack_require__) { var isPrototypeOf = __webpack_require__(19); var method = __webpack_require__(397); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.map; return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own; }; /***/ }), /* 397 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(398); var entryVirtual = __webpack_require__(40); module.exports = entryVirtual('Array').map; /***/ }), /* 398 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var $map = __webpack_require__(70).map; var arrayMethodHasSpeciesSupport = __webpack_require__(114); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map'); // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map // with adding support of @@species $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { map: function map(callbackfn /* , thisArg */) { return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), /* 399 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(400); module.exports = parent; /***/ }), /* 400 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(401); var path = __webpack_require__(5); module.exports = path.Object.keys; /***/ }), /* 401 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var toObject = __webpack_require__(34); var nativeKeys = __webpack_require__(105); var fails = __webpack_require__(2); var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); }); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, { keys: function keys(it) { return nativeKeys(toObject(it)); } }); /***/ }), /* 402 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(403); module.exports = parent; /***/ }), /* 403 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(230); var path = __webpack_require__(5); var apply = __webpack_require__(75); // eslint-disable-next-line es-x/no-json -- safe if (!path.JSON) path.JSON = { stringify: JSON.stringify }; // eslint-disable-next-line no-unused-vars -- required for `.length` module.exports = function stringify(it, replacer, space) { return apply(path.JSON.stringify, null, arguments); }; /***/ }), /* 404 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(405); module.exports = parent; /***/ }), /* 405 */ /***/ (function(module, exports, __webpack_require__) { var isPrototypeOf = __webpack_require__(19); var method = __webpack_require__(406); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.indexOf; return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own; }; /***/ }), /* 406 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(407); var entryVirtual = __webpack_require__(40); module.exports = entryVirtual('Array').indexOf; /***/ }), /* 407 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */ var $ = __webpack_require__(0); var uncurryThis = __webpack_require__(4); var $IndexOf = __webpack_require__(164).indexOf; var arrayMethodIsStrict = __webpack_require__(231); var un$IndexOf = uncurryThis([].indexOf); var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0; var STRICT_METHOD = arrayMethodIsStrict('indexOf'); // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, { indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { var fromIndex = arguments.length > 1 ? arguments[1] : undefined; return NEGATIVE_ZERO // convert -0 to +0 ? un$IndexOf(this, searchElement, fromIndex) || 0 : $IndexOf(this, searchElement, fromIndex); } }); /***/ }), /* 408 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(39); var classof = __webpack_require__(51); var hasOwn = __webpack_require__(13); var isPrototypeOf = __webpack_require__(19); var method = __webpack_require__(409); var ArrayPrototype = Array.prototype; var DOMIterables = { DOMTokenList: true, NodeList: true }; module.exports = function (it) { var own = it.keys; return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys) || hasOwn(DOMIterables, classof(it)) ? method : own; }; /***/ }), /* 409 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(410); module.exports = parent; /***/ }), /* 410 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(38); __webpack_require__(53); var entryVirtual = __webpack_require__(40); module.exports = entryVirtual('Array').keys; /***/ }), /* 411 */ /***/ (function(module, exports) { // Unique ID creation requires a high quality random # generator. In the // browser this is a little complicated due to unknown quality of Math.random() // and inconsistent support for the `crypto` API. We do the best we can via // feature-detection // getRandomValues needs to be invoked in a context where "this" is a Crypto // implementation. Also, find the complete implementation of crypto on IE11. var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) || (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto)); if (getRandomValues) { // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef module.exports = function whatwgRNG() { getRandomValues(rnds8); return rnds8; }; } else { // Math.random()-based (RNG) // // If all else fails, use Math.random(). It's fast, but is of unspecified // quality. var rnds = new Array(16); module.exports = function mathRNG() { for (var i = 0, r; i < 16; i++) { if ((i & 0x03) === 0) r = Math.random() * 0x100000000; rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; } return rnds; }; } /***/ }), /* 412 */ /***/ (function(module, exports) { /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ var byteToHex = []; for (var i = 0; i < 256; ++i) { byteToHex[i] = (i + 0x100).toString(16).substr(1); } function bytesToUuid(buf, offset) { var i = offset || 0; var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 return ([bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]]).join(''); } module.exports = bytesToUuid; /***/ }), /* 413 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * This is the common logic for both the Node.js and web browser * implementations of `debug()`. */ function setup(env) { createDebug.debug = createDebug; createDebug.default = createDebug; createDebug.coerce = coerce; createDebug.disable = disable; createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = __webpack_require__(414); Object.keys(env).forEach(function (key) { createDebug[key] = env[key]; }); /** * Active `debug` instances. */ createDebug.instances = []; /** * The currently active debug mode names, and names to skip. */ createDebug.names = []; createDebug.skips = []; /** * Map of special "%n" handling functions, for the debug "format" argument. * * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". */ createDebug.formatters = {}; /** * Selects a color for a debug namespace * @param {String} namespace The namespace string for the for the debug instance to be colored * @return {Number|String} An ANSI color code for the given namespace * @api private */ function selectColor(namespace) { var hash = 0; for (var i = 0; i < namespace.length; i++) { hash = (hash << 5) - hash + namespace.charCodeAt(i); hash |= 0; // Convert to 32bit integer } return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; } createDebug.selectColor = selectColor; /** * Create a debugger with the given `namespace`. * * @param {String} namespace * @return {Function} * @api public */ function createDebug(namespace) { var prevTime; function debug() { // Disabled? if (!debug.enabled) { return; } for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var self = debug; // Set `diff` timestamp var curr = Number(new Date()); var ms = curr - (prevTime || curr); self.diff = ms; self.prev = prevTime; self.curr = curr; prevTime = curr; args[0] = createDebug.coerce(args[0]); if (typeof args[0] !== 'string') { // Anything else let's inspect with %O args.unshift('%O'); } // Apply any `formatters` transformations var index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) { // If we encounter an escaped % then don't increase the array index if (match === '%%') { return match; } index++; var formatter = createDebug.formatters[format]; if (typeof formatter === 'function') { var val = args[index]; match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` args.splice(index, 1); index--; } return match; }); // Apply env-specific formatting (colors, etc.) createDebug.formatArgs.call(self, args); var logFn = self.log || createDebug.log; logFn.apply(self, args); } debug.namespace = namespace; debug.enabled = createDebug.enabled(namespace); debug.useColors = createDebug.useColors(); debug.color = selectColor(namespace); debug.destroy = destroy; debug.extend = extend; // Debug.formatArgs = formatArgs; // debug.rawLog = rawLog; // env-specific initialization logic for debug instances if (typeof createDebug.init === 'function') { createDebug.init(debug); } createDebug.instances.push(debug); return debug; } function destroy() { var index = createDebug.instances.indexOf(this); if (index !== -1) { createDebug.instances.splice(index, 1); return true; } return false; } function extend(namespace, delimiter) { return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); } /** * Enables a debug mode by namespaces. This can include modes * separated by a colon and wildcards. * * @param {String} namespaces * @api public */ function enable(namespaces) { createDebug.save(namespaces); createDebug.names = []; createDebug.skips = []; var i; var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); var len = split.length; for (i = 0; i < len; i++) { if (!split[i]) { // ignore empty strings continue; } namespaces = split[i].replace(/\*/g, '.*?'); if (namespaces[0] === '-') { createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); } else { createDebug.names.push(new RegExp('^' + namespaces + '$')); } } for (i = 0; i < createDebug.instances.length; i++) { var instance = createDebug.instances[i]; instance.enabled = createDebug.enabled(instance.namespace); } } /** * Disable debug output. * * @api public */ function disable() { createDebug.enable(''); } /** * Returns true if the given mode name is enabled, false otherwise. * * @param {String} name * @return {Boolean} * @api public */ function enabled(name) { if (name[name.length - 1] === '*') { return true; } var i; var len; for (i = 0, len = createDebug.skips.length; i < len; i++) { if (createDebug.skips[i].test(name)) { return false; } } for (i = 0, len = createDebug.names.length; i < len; i++) { if (createDebug.names[i].test(name)) { return true; } } return false; } /** * Coerce `val`. * * @param {Mixed} val * @return {Mixed} * @api private */ function coerce(val) { if (val instanceof Error) { return val.stack || val.message; } return val; } createDebug.enable(createDebug.load()); return createDebug; } module.exports = setup; /***/ }), /* 414 */ /***/ (function(module, exports) { /** * Helpers. */ var s = 1000; var m = s * 60; var h = m * 60; var d = h * 24; var w = d * 7; var y = d * 365.25; /** * Parse or format the given `val`. * * Options: * * - `long` verbose formatting [false] * * @param {String|Number} val * @param {Object} [options] * @throws {Error} throw an error if val is not a non-empty string or a number * @return {String|Number} * @api public */ module.exports = function(val, options) { options = options || {}; var type = typeof val; if (type === 'string' && val.length > 0) { return parse(val); } else if (type === 'number' && isFinite(val)) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( 'val is not a non-empty string or a valid number. val=' + JSON.stringify(val) ); }; /** * Parse the given `str` and return milliseconds. * * @param {String} str * @return {Number} * @api private */ function parse(str) { str = String(str); if (str.length > 100) { return; } 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( str ); if (!match) { return; } var n = parseFloat(match[1]); var type = (match[2] || 'ms').toLowerCase(); switch (type) { case 'years': case 'year': case 'yrs': case 'yr': case 'y': return n * y; case 'weeks': case 'week': case 'w': return n * w; case 'days': case 'day': case 'd': return n * d; case 'hours': case 'hour': case 'hrs': case 'hr': case 'h': return n * h; case 'minutes': case 'minute': case 'mins': case 'min': case 'm': return n * m; case 'seconds': case 'second': case 'secs': case 'sec': case 's': return n * s; case 'milliseconds': case 'millisecond': case 'msecs': case 'msec': case 'ms': return n; default: return undefined; } } /** * Short format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtShort(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) { return Math.round(ms / d) + 'd'; } if (msAbs >= h) { return Math.round(ms / h) + 'h'; } if (msAbs >= m) { return Math.round(ms / m) + 'm'; } if (msAbs >= s) { return Math.round(ms / s) + 's'; } return ms + 'ms'; } /** * Long format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtLong(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) { return plural(ms, msAbs, d, 'day'); } if (msAbs >= h) { return plural(ms, msAbs, h, 'hour'); } if (msAbs >= m) { return plural(ms, msAbs, m, 'minute'); } if (msAbs >= s) { return plural(ms, msAbs, s, 'second'); } return ms + ' ms'; } /** * Pluralization helper. */ function plural(ms, msAbs, n, name) { var isPlural = msAbs >= n * 1.5; return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); } /***/ }), /* 415 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(416); var path = __webpack_require__(5); module.exports = path.Object.getPrototypeOf; /***/ }), /* 416 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var fails = __webpack_require__(2); var toObject = __webpack_require__(34); var nativeGetPrototypeOf = __webpack_require__(100); var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161); var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); }); // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, { getPrototypeOf: function getPrototypeOf(it) { return nativeGetPrototypeOf(toObject(it)); } }); /***/ }), /* 417 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(418); var path = __webpack_require__(5); module.exports = path.Object.setPrototypeOf; /***/ }), /* 418 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var setPrototypeOf = __webpack_require__(102); // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof $({ target: 'Object', stat: true }, { setPrototypeOf: setPrototypeOf }); /***/ }), /* 419 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _slice = _interopRequireDefault(__webpack_require__(61)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _defineProperty = _interopRequireDefault(__webpack_require__(92)); var AV = __webpack_require__(69); var AppRouter = __webpack_require__(425); var _require = __webpack_require__(30), isNullOrUndefined = _require.isNullOrUndefined; var _require2 = __webpack_require__(3), extend = _require2.extend, isObject = _require2.isObject, isEmpty = _require2.isEmpty; var isCNApp = function isCNApp(appId) { return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI'; }; var fillServerURLs = function fillServerURLs(url) { return { push: url, stats: url, engine: url, api: url, rtm: url }; }; function getDefaultServerURLs(appId) { var _context, _context2, _context3, _context4, _context5; if (isCNApp(appId)) { return {}; } var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase(); var domain = 'lncldglobal.com'; return { push: (0, _concat.default)(_context = "https://".concat(id, ".push.")).call(_context, domain), stats: (0, _concat.default)(_context2 = "https://".concat(id, ".stats.")).call(_context2, domain), engine: (0, _concat.default)(_context3 = "https://".concat(id, ".engine.")).call(_context3, domain), api: (0, _concat.default)(_context4 = "https://".concat(id, ".api.")).call(_context4, domain), rtm: (0, _concat.default)(_context5 = "https://".concat(id, ".rtm.")).call(_context5, domain) }; } var _disableAppRouter = false; var _initialized = false; /** * URLs for services * @typedef {Object} ServerURLs * @property {String} [api] serverURL for API service * @property {String} [engine] serverURL for engine service * @property {String} [stats] serverURL for stats service * @property {String} [push] serverURL for push service * @property {String} [rtm] serverURL for LiveQuery service */ /** * Call this method first to set up your authentication tokens for AV. * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn . * @function AV.init * @param {Object} options * @param {String} options.appId application id * @param {String} options.appKey application key * @param {String} [options.masterKey] application master key * @param {Boolean} [options.production] * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services. * @param {Boolean} [options.disableCurrentUser] */ AV.init = function init(options) { if (!isObject(options)) { return AV.init({ appId: options, appKey: arguments.length <= 1 ? undefined : arguments[1], masterKey: arguments.length <= 2 ? undefined : arguments[2] }); } var appId = options.appId, appKey = options.appKey, masterKey = options.masterKey, hookKey = options.hookKey, serverURL = options.serverURL, _options$serverURLs = options.serverURLs, serverURLs = _options$serverURLs === void 0 ? serverURL : _options$serverURLs, disableCurrentUser = options.disableCurrentUser, production = options.production, realtime = options.realtime; 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.'); if (!appId) throw new TypeError('appId must be a string'); if (!appKey) throw new TypeError('appKey must be a string'); if ("Weapp" !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.'); if (isCNApp(appId)) { if (!serverURLs && isEmpty(AV._config.serverURLs)) { throw new TypeError("serverURL option is required for apps from CN region"); } } if (appId !== AV._config.applicationId) { // overwrite all keys when reinitializing as a new app AV._config.masterKey = masterKey; AV._config.hookKey = hookKey; } else { if (masterKey) AV._config.masterKey = masterKey; if (hookKey) AV._config.hookKey = hookKey; } AV._config.applicationId = appId; AV._config.applicationKey = appKey; if (!isNullOrUndefined(production)) { AV.setProduction(production); } if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser; var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined'; if (!disableAppRouter) { AV._appRouter = new AppRouter(AV); } AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter); if (realtime) { AV._config.realtime = realtime; } else if (AV._sharedConfig.liveQueryRealtime) { var _AV$_config$serverURL = AV._config.serverURLs, api = _AV$_config$serverURL.api, rtm = _AV$_config$serverURL.rtm; AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({ appId: appId, appKey: appKey, server: { api: api, RTMRouter: rtm } }); } _initialized = true; }; // If we're running in node.js, allow using the master key. if (false) { AV.Cloud = AV.Cloud || {}; /** * Switches the LeanCloud SDK to using the Master key. The Master key grants * priveleged access to the data in LeanCloud and can be used to bypass ACLs and * other restrictions that are applied to the client SDKs. *

Available in Cloud Code and Node.js only. *

*/ AV.Cloud.useMasterKey = function () { AV._config.useMasterKey = true; }; } /** * Call this method to set production environment variable. * @function AV.setProduction * @param {Boolean} production True is production environment,and * it's true by default. */ AV.setProduction = function (production) { if (!isNullOrUndefined(production)) { AV._config.production = production ? 1 : 0; } else { // change to default value AV._config.production = null; } }; AV._setServerURLs = function (urls) { var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; if (typeof urls !== 'string') { extend(AV._config.serverURLs, urls); } else { AV._config.serverURLs = fillServerURLs(urls); } if (disableAppRouter) { if (AV._appRouter) { AV._appRouter.disable(); } else { _disableAppRouter = true; } } }; /** * Set server URLs for services. * @function AV.setServerURL * @since 4.3.0 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services. * You can also set them when initializing SDK with `options.serverURL` */ AV.setServerURL = function (urls) { return AV._setServerURLs(urls); }; AV.setServerURLs = AV.setServerURL; AV.keepErrorRawMessage = function (value) { AV._sharedConfig.keepErrorRawMessage = value; }; /** * Set a deadline for requests to complete. * Note that file upload requests are not affected. * @function AV.setRequestTimeout * @since 3.6.0 * @param {number} ms */ AV.setRequestTimeout = function (ms) { AV._config.requestTimeout = ms; }; // backword compatible AV.initialize = AV.init; var defineConfig = function defineConfig(property) { return (0, _defineProperty.default)(AV, property, { get: function get() { return AV._config[property]; }, set: function set(value) { AV._config[property] = value; } }); }; ['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig); /***/ }), /* 420 */ /***/ (function(module, exports, __webpack_require__) { var isPrototypeOf = __webpack_require__(19); var method = __webpack_require__(421); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.slice; return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own; }; /***/ }), /* 421 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(422); var entryVirtual = __webpack_require__(40); module.exports = entryVirtual('Array').slice; /***/ }), /* 422 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var isArray = __webpack_require__(90); var isConstructor = __webpack_require__(109); var isObject = __webpack_require__(11); var toAbsoluteIndex = __webpack_require__(125); var lengthOfArrayLike = __webpack_require__(41); var toIndexedObject = __webpack_require__(32); var createProperty = __webpack_require__(91); var wellKnownSymbol = __webpack_require__(9); var arrayMethodHasSpeciesSupport = __webpack_require__(114); var un$Slice = __webpack_require__(110); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice'); var SPECIES = wellKnownSymbol('species'); var $Array = Array; var max = Math.max; // `Array.prototype.slice` method // https://tc39.es/ecma262/#sec-array.prototype.slice // fallback for not array-like ES3 strings and DOM objects $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { slice: function slice(start, end) { var O = toIndexedObject(this); var length = lengthOfArrayLike(O); var k = toAbsoluteIndex(start, length); var fin = toAbsoluteIndex(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible var Constructor, result, n; if (isArray(O)) { Constructor = O.constructor; // cross-realm fallback if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) { Constructor = undefined; } else if (isObject(Constructor)) { Constructor = Constructor[SPECIES]; if (Constructor === null) Constructor = undefined; } if (Constructor === $Array || Constructor === undefined) { return un$Slice(O, k, fin); } } result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0)); for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]); result.length = n; return result; } }); /***/ }), /* 423 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(424); var path = __webpack_require__(5); var Object = path.Object; var defineProperty = module.exports = function defineProperty(it, key, desc) { return Object.defineProperty(it, key, desc); }; if (Object.defineProperty.sham) defineProperty.sham = true; /***/ }), /* 424 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var DESCRIPTORS = __webpack_require__(14); var defineProperty = __webpack_require__(23).f; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty // eslint-disable-next-line es-x/no-object-defineproperty -- safe $({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, { defineProperty: defineProperty }); /***/ }), /* 425 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ajax = __webpack_require__(116); var Cache = __webpack_require__(237); function AppRouter(AV) { var _this = this; this.AV = AV; this.lockedUntil = 0; Cache.getAsync('serverURLs').then(function (data) { if (_this.disabled) return; if (!data) return _this.lock(0); var serverURLs = data.serverURLs, lockedUntil = data.lockedUntil; _this.AV._setServerURLs(serverURLs, false); _this.lockedUntil = lockedUntil; }).catch(function () { return _this.lock(0); }); } AppRouter.prototype.disable = function disable() { this.disabled = true; }; AppRouter.prototype.lock = function lock(ttl) { this.lockedUntil = Date.now() + ttl; }; AppRouter.prototype.refresh = function refresh() { var _this2 = this; if (this.disabled) return; if (Date.now() < this.lockedUntil) return; this.lock(10); var url = 'https://app-router.com/2/route'; return ajax({ method: 'get', url: url, query: { appId: this.AV.applicationId } }).then(function (servers) { if (_this2.disabled) return; var ttl = servers.ttl; if (!ttl) throw new Error('missing ttl'); ttl = ttl * 1000; var protocal = 'https://'; var serverURLs = { push: protocal + servers.push_server, stats: protocal + servers.stats_server, engine: protocal + servers.engine_server, api: protocal + servers.api_server }; _this2.AV._setServerURLs(serverURLs, false); _this2.lock(ttl); return Cache.setAsync('serverURLs', { serverURLs: serverURLs, lockedUntil: _this2.lockedUntil }, ttl); }).catch(function (error) { // bypass all errors console.warn("refresh server URLs failed: ".concat(error.message)); _this2.lock(600); }); }; module.exports = AppRouter; /***/ }), /* 426 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(427); /***/ }), /* 427 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(428); __webpack_require__(451); __webpack_require__(452); __webpack_require__(453); __webpack_require__(454); __webpack_require__(455); // TODO: Remove from `core-js@4` __webpack_require__(456); __webpack_require__(457); __webpack_require__(458); module.exports = parent; /***/ }), /* 428 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(243); module.exports = parent; /***/ }), /* 429 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(228); __webpack_require__(53); __webpack_require__(244); __webpack_require__(435); __webpack_require__(436); __webpack_require__(437); __webpack_require__(438); __webpack_require__(248); __webpack_require__(439); __webpack_require__(440); __webpack_require__(441); __webpack_require__(442); __webpack_require__(443); __webpack_require__(444); __webpack_require__(445); __webpack_require__(446); __webpack_require__(447); __webpack_require__(448); __webpack_require__(449); __webpack_require__(450); var path = __webpack_require__(5); module.exports = path.Symbol; /***/ }), /* 430 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var global = __webpack_require__(7); var call = __webpack_require__(15); var uncurryThis = __webpack_require__(4); var IS_PURE = __webpack_require__(33); var DESCRIPTORS = __webpack_require__(14); var NATIVE_SYMBOL = __webpack_require__(64); var fails = __webpack_require__(2); var hasOwn = __webpack_require__(13); var isPrototypeOf = __webpack_require__(19); var anObject = __webpack_require__(20); var toIndexedObject = __webpack_require__(32); var toPropertyKey = __webpack_require__(96); var $toString = __webpack_require__(81); var createPropertyDescriptor = __webpack_require__(47); var nativeObjectCreate = __webpack_require__(49); var objectKeys = __webpack_require__(105); var getOwnPropertyNamesModule = __webpack_require__(103); var getOwnPropertyNamesExternal = __webpack_require__(245); var getOwnPropertySymbolsModule = __webpack_require__(104); var getOwnPropertyDescriptorModule = __webpack_require__(62); var definePropertyModule = __webpack_require__(23); var definePropertiesModule = __webpack_require__(128); var propertyIsEnumerableModule = __webpack_require__(120); var defineBuiltIn = __webpack_require__(44); var shared = __webpack_require__(79); var sharedKey = __webpack_require__(101); var hiddenKeys = __webpack_require__(80); var uid = __webpack_require__(99); var wellKnownSymbol = __webpack_require__(9); var wrappedWellKnownSymbolModule = __webpack_require__(148); var defineWellKnownSymbol = __webpack_require__(10); var defineSymbolToPrimitive = __webpack_require__(246); var setToStringTag = __webpack_require__(52); var InternalStateModule = __webpack_require__(43); var $forEach = __webpack_require__(70).forEach; var HIDDEN = sharedKey('hidden'); var SYMBOL = 'Symbol'; var PROTOTYPE = 'prototype'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(SYMBOL); var ObjectPrototype = Object[PROTOTYPE]; var $Symbol = global.Symbol; var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE]; var TypeError = global.TypeError; var QObject = global.QObject; var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; var push = uncurryThis([].push); var AllSymbols = shared('symbols'); var ObjectPrototypeSymbols = shared('op-symbols'); var WellKnownSymbolsStore = shared('wks'); // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDescriptor = DESCRIPTORS && fails(function () { return nativeObjectCreate(nativeDefineProperty({}, 'a', { get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; } })).a != 7; }) ? function (O, P, Attributes) { var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P); if (ObjectPrototypeDescriptor) delete ObjectPrototype[P]; nativeDefineProperty(O, P, Attributes); if (ObjectPrototypeDescriptor && O !== ObjectPrototype) { nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor); } } : nativeDefineProperty; var wrap = function (tag, description) { var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype); setInternalState(symbol, { type: SYMBOL, tag: tag, description: description }); if (!DESCRIPTORS) symbol.description = description; return symbol; }; var $defineProperty = function defineProperty(O, P, Attributes) { if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes); anObject(O); var key = toPropertyKey(P); anObject(Attributes); if (hasOwn(AllSymbols, key)) { if (!Attributes.enumerable) { if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); O[HIDDEN][key] = true; } else { if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); } return setSymbolDescriptor(O, key, Attributes); } return nativeDefineProperty(O, key, Attributes); }; var $defineProperties = function defineProperties(O, Properties) { anObject(O); var properties = toIndexedObject(Properties); var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); $forEach(keys, function (key) { if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]); }); return O; }; var $create = function create(O, Properties) { return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); }; var $propertyIsEnumerable = function propertyIsEnumerable(V) { var P = toPropertyKey(V); var enumerable = call(nativePropertyIsEnumerable, this, P); if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false; return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { var it = toIndexedObject(O); var key = toPropertyKey(P); if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return; var descriptor = nativeGetOwnPropertyDescriptor(it, key); if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) { descriptor.enumerable = true; } return descriptor; }; var $getOwnPropertyNames = function getOwnPropertyNames(O) { var names = nativeGetOwnPropertyNames(toIndexedObject(O)); var result = []; $forEach(names, function (key) { if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key); }); return result; }; var $getOwnPropertySymbols = function (O) { var IS_OBJECT_PROTOTYPE = O === ObjectPrototype; var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); var result = []; $forEach(names, function (key) { if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) { push(result, AllSymbols[key]); } }); return result; }; // `Symbol` constructor // https://tc39.es/ecma262/#sec-symbol-constructor if (!NATIVE_SYMBOL) { $Symbol = function Symbol() { if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor'); var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]); var tag = uid(description); var setter = function (value) { if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false; setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); }; if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); return wrap(tag, description); }; SymbolPrototype = $Symbol[PROTOTYPE]; defineBuiltIn(SymbolPrototype, 'toString', function toString() { return getInternalState(this).tag; }); defineBuiltIn($Symbol, 'withoutSetter', function (description) { return wrap(uid(description), description); }); propertyIsEnumerableModule.f = $propertyIsEnumerable; definePropertyModule.f = $defineProperty; definePropertiesModule.f = $defineProperties; getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor; getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; getOwnPropertySymbolsModule.f = $getOwnPropertySymbols; wrappedWellKnownSymbolModule.f = function (name) { return wrap(wellKnownSymbol(name), name); }; if (DESCRIPTORS) { // https://github.com/tc39/proposal-Symbol-description nativeDefineProperty(SymbolPrototype, 'description', { configurable: true, get: function description() { return getInternalState(this).description; } }); if (!IS_PURE) { defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true }); } } } $({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, { Symbol: $Symbol }); $forEach(objectKeys(WellKnownSymbolsStore), function (name) { defineWellKnownSymbol(name); }); $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, { useSetter: function () { USE_SETTER = true; }, useSimple: function () { USE_SETTER = false; } }); $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, { // `Object.create` method // https://tc39.es/ecma262/#sec-object.create create: $create, // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty defineProperty: $defineProperty, // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties defineProperties: $defineProperties, // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors getOwnPropertyDescriptor: $getOwnPropertyDescriptor }); $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, { // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames getOwnPropertyNames: $getOwnPropertyNames }); // `Symbol.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive defineSymbolToPrimitive(); // `Symbol.prototype[@@toStringTag]` property // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag setToStringTag($Symbol, SYMBOL); hiddenKeys[HIDDEN] = true; /***/ }), /* 431 */ /***/ (function(module, exports, __webpack_require__) { var toAbsoluteIndex = __webpack_require__(125); var lengthOfArrayLike = __webpack_require__(41); var createProperty = __webpack_require__(91); var $Array = Array; var max = Math.max; module.exports = function (O, start, end) { var length = lengthOfArrayLike(O); var k = toAbsoluteIndex(start, length); var fin = toAbsoluteIndex(end === undefined ? length : end, length); var result = $Array(max(fin - k, 0)); for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]); result.length = n; return result; }; /***/ }), /* 432 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var getBuiltIn = __webpack_require__(18); var hasOwn = __webpack_require__(13); var toString = __webpack_require__(81); var shared = __webpack_require__(79); var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247); var StringToSymbolRegistry = shared('string-to-symbol-registry'); var SymbolToStringRegistry = shared('symbol-to-string-registry'); // `Symbol.for` method // https://tc39.es/ecma262/#sec-symbol.for $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, { 'for': function (key) { var string = toString(key); if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; var symbol = getBuiltIn('Symbol')(string); StringToSymbolRegistry[string] = symbol; SymbolToStringRegistry[symbol] = string; return symbol; } }); /***/ }), /* 433 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var hasOwn = __webpack_require__(13); var isSymbol = __webpack_require__(97); var tryToString = __webpack_require__(78); var shared = __webpack_require__(79); var NATIVE_SYMBOL_REGISTRY = __webpack_require__(247); var SymbolToStringRegistry = shared('symbol-to-string-registry'); // `Symbol.keyFor` method // https://tc39.es/ecma262/#sec-symbol.keyfor $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, { keyFor: function keyFor(sym) { if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol'); if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; } }); /***/ }), /* 434 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var NATIVE_SYMBOL = __webpack_require__(64); var fails = __webpack_require__(2); var getOwnPropertySymbolsModule = __webpack_require__(104); var toObject = __webpack_require__(34); // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives // https://bugs.chromium.org/p/v8/issues/detail?id=3443 var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); }); // `Object.getOwnPropertySymbols` method // https://tc39.es/ecma262/#sec-object.getownpropertysymbols $({ target: 'Object', stat: true, forced: FORCED }, { getOwnPropertySymbols: function getOwnPropertySymbols(it) { var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : []; } }); /***/ }), /* 435 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.asyncIterator` well-known symbol // https://tc39.es/ecma262/#sec-symbol.asynciterator defineWellKnownSymbol('asyncIterator'); /***/ }), /* 436 */ /***/ (function(module, exports) { // empty /***/ }), /* 437 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.hasInstance` well-known symbol // https://tc39.es/ecma262/#sec-symbol.hasinstance defineWellKnownSymbol('hasInstance'); /***/ }), /* 438 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.isConcatSpreadable` well-known symbol // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable defineWellKnownSymbol('isConcatSpreadable'); /***/ }), /* 439 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.match` well-known symbol // https://tc39.es/ecma262/#sec-symbol.match defineWellKnownSymbol('match'); /***/ }), /* 440 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.matchAll` well-known symbol // https://tc39.es/ecma262/#sec-symbol.matchall defineWellKnownSymbol('matchAll'); /***/ }), /* 441 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.replace` well-known symbol // https://tc39.es/ecma262/#sec-symbol.replace defineWellKnownSymbol('replace'); /***/ }), /* 442 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.search` well-known symbol // https://tc39.es/ecma262/#sec-symbol.search defineWellKnownSymbol('search'); /***/ }), /* 443 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.species` well-known symbol // https://tc39.es/ecma262/#sec-symbol.species defineWellKnownSymbol('species'); /***/ }), /* 444 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.split` well-known symbol // https://tc39.es/ecma262/#sec-symbol.split defineWellKnownSymbol('split'); /***/ }), /* 445 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); var defineSymbolToPrimitive = __webpack_require__(246); // `Symbol.toPrimitive` well-known symbol // https://tc39.es/ecma262/#sec-symbol.toprimitive defineWellKnownSymbol('toPrimitive'); // `Symbol.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive defineSymbolToPrimitive(); /***/ }), /* 446 */ /***/ (function(module, exports, __webpack_require__) { var getBuiltIn = __webpack_require__(18); var defineWellKnownSymbol = __webpack_require__(10); var setToStringTag = __webpack_require__(52); // `Symbol.toStringTag` well-known symbol // https://tc39.es/ecma262/#sec-symbol.tostringtag defineWellKnownSymbol('toStringTag'); // `Symbol.prototype[@@toStringTag]` property // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag setToStringTag(getBuiltIn('Symbol'), 'Symbol'); /***/ }), /* 447 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.unscopables` well-known symbol // https://tc39.es/ecma262/#sec-symbol.unscopables defineWellKnownSymbol('unscopables'); /***/ }), /* 448 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(7); var setToStringTag = __webpack_require__(52); // JSON[@@toStringTag] property // https://tc39.es/ecma262/#sec-json-@@tostringtag setToStringTag(global.JSON, 'JSON', true); /***/ }), /* 449 */ /***/ (function(module, exports) { // empty /***/ }), /* 450 */ /***/ (function(module, exports) { // empty /***/ }), /* 451 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.asyncDispose` well-known symbol // https://github.com/tc39/proposal-using-statement defineWellKnownSymbol('asyncDispose'); /***/ }), /* 452 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.dispose` well-known symbol // https://github.com/tc39/proposal-using-statement defineWellKnownSymbol('dispose'); /***/ }), /* 453 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.matcher` well-known symbol // https://github.com/tc39/proposal-pattern-matching defineWellKnownSymbol('matcher'); /***/ }), /* 454 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.metadataKey` well-known symbol // https://github.com/tc39/proposal-decorator-metadata defineWellKnownSymbol('metadataKey'); /***/ }), /* 455 */ /***/ (function(module, exports, __webpack_require__) { var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.observable` well-known symbol // https://github.com/tc39/proposal-observable defineWellKnownSymbol('observable'); /***/ }), /* 456 */ /***/ (function(module, exports, __webpack_require__) { // TODO: Remove from `core-js@4` var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.metadata` well-known symbol // https://github.com/tc39/proposal-decorators defineWellKnownSymbol('metadata'); /***/ }), /* 457 */ /***/ (function(module, exports, __webpack_require__) { // TODO: remove from `core-js@4` var defineWellKnownSymbol = __webpack_require__(10); // `Symbol.patternMatch` well-known symbol // https://github.com/tc39/proposal-pattern-matching defineWellKnownSymbol('patternMatch'); /***/ }), /* 458 */ /***/ (function(module, exports, __webpack_require__) { // TODO: remove from `core-js@4` var defineWellKnownSymbol = __webpack_require__(10); defineWellKnownSymbol('replaceAll'); /***/ }), /* 459 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(460); /***/ }), /* 460 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(461); /***/ }), /* 461 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(462); module.exports = parent; /***/ }), /* 462 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(249); module.exports = parent; /***/ }), /* 463 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(38); __webpack_require__(53); __webpack_require__(55); __webpack_require__(248); var WrappedWellKnownSymbolModule = __webpack_require__(148); module.exports = WrappedWellKnownSymbolModule.f('iterator'); /***/ }), /* 464 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(465); module.exports = parent; /***/ }), /* 465 */ /***/ (function(module, exports, __webpack_require__) { var isPrototypeOf = __webpack_require__(19); var method = __webpack_require__(466); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.filter; return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own; }; /***/ }), /* 466 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(467); var entryVirtual = __webpack_require__(40); module.exports = entryVirtual('Array').filter; /***/ }), /* 467 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var $filter = __webpack_require__(70).filter; var arrayMethodHasSpeciesSupport = __webpack_require__(114); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter // with adding support of @@species $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { filter: function filter(callbackfn /* , thisArg */) { return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), /* 468 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _slice = _interopRequireDefault(__webpack_require__(61)); var _keys = _interopRequireDefault(__webpack_require__(59)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _ = __webpack_require__(3); module.exports = function (AV) { var eventSplitter = /\s+/; var slice = (0, _slice.default)(Array.prototype); /** * @class * *

AV.Events is a fork of Backbone's Events module, provided for your * convenience.

* *

A module that can be mixed in to any object in order to provide * it with custom events. You may bind callback functions to an event * with `on`, or remove these functions with `off`. * Triggering an event fires all callbacks in the order that `on` was * called. * * @private * @example * var object = {}; * _.extend(object, AV.Events); * object.on('expand', function(){ alert('expanded'); }); * object.trigger('expand');

* */ AV.Events = { /** * Bind one or more space separated events, `events`, to a `callback` * function. Passing `"all"` will bind the callback to all events fired. */ on: function on(events, callback, context) { var calls, event, node, tail, list; if (!callback) { return this; } events = events.split(eventSplitter); calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during // modification. The tail is an empty object that will always be used // as the next node. event = events.shift(); while (event) { list = calls[event]; node = list ? list.tail : {}; node.next = tail = {}; node.context = context; node.callback = callback; calls[event] = { tail: tail, next: list ? list.next : node }; event = events.shift(); } return this; }, /** * Remove one or many callbacks. If `context` is null, removes all callbacks * with that function. If `callback` is null, removes all callbacks for the * event. If `events` is null, removes all bound callbacks for all events. */ off: function off(events, callback, context) { var event, calls, node, tail, cb, ctx; // No events, or removing *all* events. if (!(calls = this._callbacks)) { return; } if (!(events || callback || context)) { delete this._callbacks; return this; } // Loop through the listed events and contexts, splicing them out of the // linked list of callbacks if appropriate. events = events ? events.split(eventSplitter) : (0, _keys.default)(_).call(_, calls); event = events.shift(); while (event) { node = calls[event]; delete calls[event]; if (!node || !(callback || context)) { continue; } // Create a new list, omitting the indicated callbacks. tail = node.tail; node = node.next; while (node !== tail) { cb = node.callback; ctx = node.context; if (callback && cb !== callback || context && ctx !== context) { this.on(event, cb, ctx); } node = node.next; } event = events.shift(); } return this; }, /** * Trigger one or many events, firing all bound callbacks. Callbacks are * passed the same arguments as `trigger` is, apart from the event name * (unless you're listening on `"all"`, which will cause your callback to * receive the true name of the event as the first argument). */ trigger: function trigger(events) { var event, node, calls, tail, args, all, rest; if (!(calls = this._callbacks)) { return this; } all = calls.all; events = events.split(eventSplitter); rest = slice.call(arguments, 1); // For each event, walk through the linked list of callbacks twice, // first to trigger the event, then to trigger any `"all"` callbacks. event = events.shift(); while (event) { node = calls[event]; if (node) { tail = node.tail; while ((node = node.next) !== tail) { node.callback.apply(node.context || this, rest); } } node = all; if (node) { var _context; tail = node.tail; args = (0, _concat.default)(_context = [event]).call(_context, rest); while ((node = node.next) !== tail) { node.callback.apply(node.context || this, args); } } event = events.shift(); } return this; } }; /** * @function */ AV.Events.bind = AV.Events.on; /** * @function */ AV.Events.unbind = AV.Events.off; }; /***/ }), /* 469 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _ = __webpack_require__(3); /*global navigator: false */ module.exports = function (AV) { /** * Creates a new GeoPoint with any of the following forms:
* @example * new GeoPoint(otherGeoPoint) * new GeoPoint(30, 30) * new GeoPoint([30, 30]) * new GeoPoint({latitude: 30, longitude: 30}) * new GeoPoint() // defaults to (0, 0) * @class * *

Represents a latitude / longitude point that may be associated * with a key in a AVObject or used as a reference point for geo queries. * This allows proximity-based queries on the key.

* *

Only one key in a class may contain a GeoPoint.

* *

Example:

   *   var point = new AV.GeoPoint(30.0, -20.0);
   *   var object = new AV.Object("PlaceObject");
   *   object.set("location", point);
   *   object.save();

*/ AV.GeoPoint = function (arg1, arg2) { if (_.isArray(arg1)) { AV.GeoPoint._validate(arg1[0], arg1[1]); this.latitude = arg1[0]; this.longitude = arg1[1]; } else if (_.isObject(arg1)) { AV.GeoPoint._validate(arg1.latitude, arg1.longitude); this.latitude = arg1.latitude; this.longitude = arg1.longitude; } else if (_.isNumber(arg1) && _.isNumber(arg2)) { AV.GeoPoint._validate(arg1, arg2); this.latitude = arg1; this.longitude = arg2; } else { this.latitude = 0; this.longitude = 0; } // Add properties so that anyone using Webkit or Mozilla will get an error // if they try to set values that are out of bounds. var self = this; if (this.__defineGetter__ && this.__defineSetter__) { // Use _latitude and _longitude to actually store the values, and add // getters and setters for latitude and longitude. this._latitude = this.latitude; this._longitude = this.longitude; this.__defineGetter__('latitude', function () { return self._latitude; }); this.__defineGetter__('longitude', function () { return self._longitude; }); this.__defineSetter__('latitude', function (val) { AV.GeoPoint._validate(val, self.longitude); self._latitude = val; }); this.__defineSetter__('longitude', function (val) { AV.GeoPoint._validate(self.latitude, val); self._longitude = val; }); } }; /** * @lends AV.GeoPoint.prototype * @property {float} latitude North-south portion of the coordinate, in range * [-90, 90]. Throws an exception if set out of range in a modern browser. * @property {float} longitude East-west portion of the coordinate, in range * [-180, 180]. Throws if set out of range in a modern browser. */ /** * Throws an exception if the given lat-long is out of bounds. * @private */ AV.GeoPoint._validate = function (latitude, longitude) { if (latitude < -90.0) { throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.'); } if (latitude > 90.0) { throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.'); } if (longitude < -180.0) { throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.'); } if (longitude > 180.0) { throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.'); } }; /** * Creates a GeoPoint with the user's current location, if available. * @return {Promise.} */ AV.GeoPoint.current = function () { return new _promise.default(function (resolve, reject) { navigator.geolocation.getCurrentPosition(function (location) { resolve(new AV.GeoPoint({ latitude: location.coords.latitude, longitude: location.coords.longitude })); }, reject); }); }; _.extend(AV.GeoPoint.prototype, /** @lends AV.GeoPoint.prototype */ { /** * Returns a JSON representation of the GeoPoint, suitable for AV. * @return {Object} */ toJSON: function toJSON() { AV.GeoPoint._validate(this.latitude, this.longitude); return { __type: 'GeoPoint', latitude: this.latitude, longitude: this.longitude }; }, /** * Returns the distance from this GeoPoint to another in radians. * @param {AV.GeoPoint} point the other AV.GeoPoint. * @return {Number} */ radiansTo: function radiansTo(point) { var d2r = Math.PI / 180.0; var lat1rad = this.latitude * d2r; var long1rad = this.longitude * d2r; var lat2rad = point.latitude * d2r; var long2rad = point.longitude * d2r; var deltaLat = lat1rad - lat2rad; var deltaLong = long1rad - long2rad; var sinDeltaLatDiv2 = Math.sin(deltaLat / 2); var sinDeltaLongDiv2 = Math.sin(deltaLong / 2); // Square of half the straight line chord distance between both points. var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2; a = Math.min(1.0, a); return 2 * Math.asin(Math.sqrt(a)); }, /** * Returns the distance from this GeoPoint to another in kilometers. * @param {AV.GeoPoint} point the other AV.GeoPoint. * @return {Number} */ kilometersTo: function kilometersTo(point) { return this.radiansTo(point) * 6371.0; }, /** * Returns the distance from this GeoPoint to another in miles. * @param {AV.GeoPoint} point the other AV.GeoPoint. * @return {Number} */ milesTo: function milesTo(point) { return this.radiansTo(point) * 3958.8; } }); }; /***/ }), /* 470 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(3); module.exports = function (AV) { var PUBLIC_KEY = '*'; /** * Creates a new ACL. * If no argument is given, the ACL has no permissions for anyone. * If the argument is a AV.User, the ACL will have read and write * permission for only that user. * If the argument is any other JSON object, that object will be interpretted * as a serialized ACL created with toJSON(). * @see AV.Object#setACL * @class * *

An ACL, or Access Control List can be added to any * AV.Object to restrict access to only a subset of users * of your application.

*/ AV.ACL = function (arg1) { var self = this; self.permissionsById = {}; if (_.isObject(arg1)) { if (arg1 instanceof AV.User) { self.setReadAccess(arg1, true); self.setWriteAccess(arg1, true); } else { if (_.isFunction(arg1)) { throw new Error('AV.ACL() called with a function. Did you forget ()?'); } AV._objectEach(arg1, function (accessList, userId) { if (!_.isString(userId)) { throw new Error('Tried to create an ACL with an invalid userId.'); } self.permissionsById[userId] = {}; AV._objectEach(accessList, function (allowed, permission) { if (permission !== 'read' && permission !== 'write') { throw new Error('Tried to create an ACL with an invalid permission type.'); } if (!_.isBoolean(allowed)) { throw new Error('Tried to create an ACL with an invalid permission value.'); } self.permissionsById[userId][permission] = allowed; }); }); } } }; /** * Returns a JSON-encoded version of the ACL. * @return {Object} */ AV.ACL.prototype.toJSON = function () { return _.clone(this.permissionsById); }; AV.ACL.prototype._setAccess = function (accessType, userId, allowed) { if (userId instanceof AV.User) { userId = userId.id; } else if (userId instanceof AV.Role) { userId = 'role:' + userId.getName(); } if (!_.isString(userId)) { throw new Error('userId must be a string.'); } if (!_.isBoolean(allowed)) { throw new Error('allowed must be either true or false.'); } var permissions = this.permissionsById[userId]; if (!permissions) { if (!allowed) { // The user already doesn't have this permission, so no action needed. return; } else { permissions = {}; this.permissionsById[userId] = permissions; } } if (allowed) { this.permissionsById[userId][accessType] = true; } else { delete permissions[accessType]; if (_.isEmpty(permissions)) { delete this.permissionsById[userId]; } } }; AV.ACL.prototype._getAccess = function (accessType, userId) { if (userId instanceof AV.User) { userId = userId.id; } else if (userId instanceof AV.Role) { userId = 'role:' + userId.getName(); } var permissions = this.permissionsById[userId]; if (!permissions) { return false; } return permissions[accessType] ? true : false; }; /** * Set whether the given user is allowed to read this object. * @param userId An instance of AV.User or its objectId. * @param {Boolean} allowed Whether that user should have read access. */ AV.ACL.prototype.setReadAccess = function (userId, allowed) { this._setAccess('read', userId, allowed); }; /** * Get whether the given user id is *explicitly* allowed to read this object. * Even if this returns false, the user may still be able to access it if * getPublicReadAccess returns true or a role that the user belongs to has * write access. * @param userId An instance of AV.User or its objectId, or a AV.Role. * @return {Boolean} */ AV.ACL.prototype.getReadAccess = function (userId) { return this._getAccess('read', userId); }; /** * Set whether the given user id is allowed to write this object. * @param userId An instance of AV.User or its objectId, or a AV.Role.. * @param {Boolean} allowed Whether that user should have write access. */ AV.ACL.prototype.setWriteAccess = function (userId, allowed) { this._setAccess('write', userId, allowed); }; /** * Get whether the given user id is *explicitly* allowed to write this object. * Even if this returns false, the user may still be able to write it if * getPublicWriteAccess returns true or a role that the user belongs to has * write access. * @param userId An instance of AV.User or its objectId, or a AV.Role. * @return {Boolean} */ AV.ACL.prototype.getWriteAccess = function (userId) { return this._getAccess('write', userId); }; /** * Set whether the public is allowed to read this object. * @param {Boolean} allowed */ AV.ACL.prototype.setPublicReadAccess = function (allowed) { this.setReadAccess(PUBLIC_KEY, allowed); }; /** * Get whether the public is allowed to read this object. * @return {Boolean} */ AV.ACL.prototype.getPublicReadAccess = function () { return this.getReadAccess(PUBLIC_KEY); }; /** * Set whether the public is allowed to write this object. * @param {Boolean} allowed */ AV.ACL.prototype.setPublicWriteAccess = function (allowed) { this.setWriteAccess(PUBLIC_KEY, allowed); }; /** * Get whether the public is allowed to write this object. * @return {Boolean} */ AV.ACL.prototype.getPublicWriteAccess = function () { return this.getWriteAccess(PUBLIC_KEY); }; /** * Get whether users belonging to the given role are allowed * to read this object. Even if this returns false, the role may * still be able to write it if a parent role has read access. * * @param role The name of the role, or a AV.Role object. * @return {Boolean} true if the role has read access. false otherwise. * @throws {String} If role is neither a AV.Role nor a String. */ AV.ACL.prototype.getRoleReadAccess = function (role) { if (role instanceof AV.Role) { // Normalize to the String name role = role.getName(); } if (_.isString(role)) { return this.getReadAccess('role:' + role); } throw new Error('role must be a AV.Role or a String'); }; /** * Get whether users belonging to the given role are allowed * to write this object. Even if this returns false, the role may * still be able to write it if a parent role has write access. * * @param role The name of the role, or a AV.Role object. * @return {Boolean} true if the role has write access. false otherwise. * @throws {String} If role is neither a AV.Role nor a String. */ AV.ACL.prototype.getRoleWriteAccess = function (role) { if (role instanceof AV.Role) { // Normalize to the String name role = role.getName(); } if (_.isString(role)) { return this.getWriteAccess('role:' + role); } throw new Error('role must be a AV.Role or a String'); }; /** * Set whether users belonging to the given role are allowed * to read this object. * * @param role The name of the role, or a AV.Role object. * @param {Boolean} allowed Whether the given role can read this object. * @throws {String} If role is neither a AV.Role nor a String. */ AV.ACL.prototype.setRoleReadAccess = function (role, allowed) { if (role instanceof AV.Role) { // Normalize to the String name role = role.getName(); } if (_.isString(role)) { this.setReadAccess('role:' + role, allowed); return; } throw new Error('role must be a AV.Role or a String'); }; /** * Set whether users belonging to the given role are allowed * to write this object. * * @param role The name of the role, or a AV.Role object. * @param {Boolean} allowed Whether the given role can write this object. * @throws {String} If role is neither a AV.Role nor a String. */ AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) { if (role instanceof AV.Role) { // Normalize to the String name role = role.getName(); } if (_.isString(role)) { this.setWriteAccess('role:' + role, allowed); return; } throw new Error('role must be a AV.Role or a String'); }; }; /***/ }), /* 471 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _concat = _interopRequireDefault(__webpack_require__(22)); var _find = _interopRequireDefault(__webpack_require__(93)); var _indexOf = _interopRequireDefault(__webpack_require__(71)); var _map = _interopRequireDefault(__webpack_require__(35)); var _ = __webpack_require__(3); module.exports = function (AV) { /** * @private * @class * A AV.Op is an atomic operation that can be applied to a field in a * AV.Object. For example, calling object.set("foo", "bar") * is an example of a AV.Op.Set. Calling object.unset("foo") * is a AV.Op.Unset. These operations are stored in a AV.Object and * sent to the server as part of object.save() operations. * Instances of AV.Op should be immutable. * * You should not create subclasses of AV.Op or instantiate AV.Op * directly. */ AV.Op = function () { this._initialize.apply(this, arguments); }; _.extend(AV.Op.prototype, /** @lends AV.Op.prototype */ { _initialize: function _initialize() {} }); _.extend(AV.Op, { /** * To create a new Op, call AV.Op._extend(); * @private */ _extend: AV._extend, // A map of __op string to decoder function. _opDecoderMap: {}, /** * Registers a function to convert a json object with an __op field into an * instance of a subclass of AV.Op. * @private */ _registerDecoder: function _registerDecoder(opName, decoder) { AV.Op._opDecoderMap[opName] = decoder; }, /** * Converts a json object into an instance of a subclass of AV.Op. * @private */ _decode: function _decode(json) { var decoder = AV.Op._opDecoderMap[json.__op]; if (decoder) { return decoder(json); } else { return undefined; } } }); /* * Add a handler for Batch ops. */ AV.Op._registerDecoder('Batch', function (json) { var op = null; AV._arrayEach(json.ops, function (nextOp) { nextOp = AV.Op._decode(nextOp); op = nextOp._mergeWithPrevious(op); }); return op; }); /** * @private * @class * A Set operation indicates that either the field was changed using * AV.Object.set, or it is a mutable container that was detected as being * changed. */ AV.Op.Set = AV.Op._extend( /** @lends AV.Op.Set.prototype */ { _initialize: function _initialize(value) { this._value = value; }, /** * Returns the new value of this field after the set. */ value: function value() { return this._value; }, /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { return AV._encode(this.value()); }, _mergeWithPrevious: function _mergeWithPrevious(previous) { return this; }, _estimate: function _estimate(oldValue) { return this.value(); } }); /** * A sentinel value that is returned by AV.Op.Unset._estimate to * indicate the field should be deleted. Basically, if you find _UNSET as a * value in your object, you should remove that key. */ AV.Op._UNSET = {}; /** * @private * @class * An Unset operation indicates that this field has been deleted from the * object. */ AV.Op.Unset = AV.Op._extend( /** @lends AV.Op.Unset.prototype */ { /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { return { __op: 'Delete' }; }, _mergeWithPrevious: function _mergeWithPrevious(previous) { return this; }, _estimate: function _estimate(oldValue) { return AV.Op._UNSET; } }); AV.Op._registerDecoder('Delete', function (json) { return new AV.Op.Unset(); }); /** * @private * @class * An Increment is an atomic operation where the numeric value for the field * will be increased by a given amount. */ AV.Op.Increment = AV.Op._extend( /** @lends AV.Op.Increment.prototype */ { _initialize: function _initialize(amount) { this._amount = amount; }, /** * Returns the amount to increment by. * @return {Number} the amount to increment by. */ amount: function amount() { return this._amount; }, /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { return { __op: 'Increment', amount: this._amount }; }, _mergeWithPrevious: function _mergeWithPrevious(previous) { if (!previous) { return this; } else if (previous instanceof AV.Op.Unset) { return new AV.Op.Set(this.amount()); } else if (previous instanceof AV.Op.Set) { return new AV.Op.Set(previous.value() + this.amount()); } else if (previous instanceof AV.Op.Increment) { return new AV.Op.Increment(this.amount() + previous.amount()); } else { throw new Error('Op is invalid after previous op.'); } }, _estimate: function _estimate(oldValue) { if (!oldValue) { return this.amount(); } return oldValue + this.amount(); } }); AV.Op._registerDecoder('Increment', function (json) { return new AV.Op.Increment(json.amount); }); /** * @private * @class * BitAnd is an atomic operation where the given value will be bit and to the * value than is stored in this field. */ AV.Op.BitAnd = AV.Op._extend( /** @lends AV.Op.BitAnd.prototype */ { _initialize: function _initialize(value) { this._value = value; }, value: function value() { return this._value; }, /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { return { __op: 'BitAnd', value: this.value() }; }, _mergeWithPrevious: function _mergeWithPrevious(previous) { if (!previous) { return this; } else if (previous instanceof AV.Op.Unset) { return new AV.Op.Set(0); } else if (previous instanceof AV.Op.Set) { return new AV.Op.Set(previous.value() & this.value()); } else { throw new Error('Op is invalid after previous op.'); } }, _estimate: function _estimate(oldValue) { return oldValue & this.value(); } }); AV.Op._registerDecoder('BitAnd', function (json) { return new AV.Op.BitAnd(json.value); }); /** * @private * @class * BitOr is an atomic operation where the given value will be bit and to the * value than is stored in this field. */ AV.Op.BitOr = AV.Op._extend( /** @lends AV.Op.BitOr.prototype */ { _initialize: function _initialize(value) { this._value = value; }, value: function value() { return this._value; }, /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { return { __op: 'BitOr', value: this.value() }; }, _mergeWithPrevious: function _mergeWithPrevious(previous) { if (!previous) { return this; } else if (previous instanceof AV.Op.Unset) { return new AV.Op.Set(this.value()); } else if (previous instanceof AV.Op.Set) { return new AV.Op.Set(previous.value() | this.value()); } else { throw new Error('Op is invalid after previous op.'); } }, _estimate: function _estimate(oldValue) { return oldValue | this.value(); } }); AV.Op._registerDecoder('BitOr', function (json) { return new AV.Op.BitOr(json.value); }); /** * @private * @class * BitXor is an atomic operation where the given value will be bit and to the * value than is stored in this field. */ AV.Op.BitXor = AV.Op._extend( /** @lends AV.Op.BitXor.prototype */ { _initialize: function _initialize(value) { this._value = value; }, value: function value() { return this._value; }, /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { return { __op: 'BitXor', value: this.value() }; }, _mergeWithPrevious: function _mergeWithPrevious(previous) { if (!previous) { return this; } else if (previous instanceof AV.Op.Unset) { return new AV.Op.Set(this.value()); } else if (previous instanceof AV.Op.Set) { return new AV.Op.Set(previous.value() ^ this.value()); } else { throw new Error('Op is invalid after previous op.'); } }, _estimate: function _estimate(oldValue) { return oldValue ^ this.value(); } }); AV.Op._registerDecoder('BitXor', function (json) { return new AV.Op.BitXor(json.value); }); /** * @private * @class * Add is an atomic operation where the given objects will be appended to the * array that is stored in this field. */ AV.Op.Add = AV.Op._extend( /** @lends AV.Op.Add.prototype */ { _initialize: function _initialize(objects) { this._objects = objects; }, /** * Returns the objects to be added to the array. * @return {Array} The objects to be added to the array. */ objects: function objects() { return this._objects; }, /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { return { __op: 'Add', objects: AV._encode(this.objects()) }; }, _mergeWithPrevious: function _mergeWithPrevious(previous) { if (!previous) { return this; } else if (previous instanceof AV.Op.Unset) { return new AV.Op.Set(this.objects()); } else if (previous instanceof AV.Op.Set) { return new AV.Op.Set(this._estimate(previous.value())); } else if (previous instanceof AV.Op.Add) { var _context; return new AV.Op.Add((0, _concat.default)(_context = previous.objects()).call(_context, this.objects())); } else { throw new Error('Op is invalid after previous op.'); } }, _estimate: function _estimate(oldValue) { if (!oldValue) { return _.clone(this.objects()); } else { return (0, _concat.default)(oldValue).call(oldValue, this.objects()); } } }); AV.Op._registerDecoder('Add', function (json) { return new AV.Op.Add(AV._decode(json.objects)); }); /** * @private * @class * AddUnique is an atomic operation where the given items will be appended to * the array that is stored in this field only if they were not already * present in the array. */ AV.Op.AddUnique = AV.Op._extend( /** @lends AV.Op.AddUnique.prototype */ { _initialize: function _initialize(objects) { this._objects = _.uniq(objects); }, /** * Returns the objects to be added to the array. * @return {Array} The objects to be added to the array. */ objects: function objects() { return this._objects; }, /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { return { __op: 'AddUnique', objects: AV._encode(this.objects()) }; }, _mergeWithPrevious: function _mergeWithPrevious(previous) { if (!previous) { return this; } else if (previous instanceof AV.Op.Unset) { return new AV.Op.Set(this.objects()); } else if (previous instanceof AV.Op.Set) { return new AV.Op.Set(this._estimate(previous.value())); } else if (previous instanceof AV.Op.AddUnique) { return new AV.Op.AddUnique(this._estimate(previous.objects())); } else { throw new Error('Op is invalid after previous op.'); } }, _estimate: function _estimate(oldValue) { if (!oldValue) { return _.clone(this.objects()); } else { // We can't just take the _.uniq(_.union(...)) of oldValue and // this.objects, because the uniqueness may not apply to oldValue // (especially if the oldValue was set via .set()) var newValue = _.clone(oldValue); AV._arrayEach(this.objects(), function (obj) { if (obj instanceof AV.Object && obj.id) { var matchingObj = (0, _find.default)(_).call(_, newValue, function (anObj) { return anObj instanceof AV.Object && anObj.id === obj.id; }); if (!matchingObj) { newValue.push(obj); } else { var index = (0, _indexOf.default)(_).call(_, newValue, matchingObj); newValue[index] = obj; } } else if (!_.contains(newValue, obj)) { newValue.push(obj); } }); return newValue; } } }); AV.Op._registerDecoder('AddUnique', function (json) { return new AV.Op.AddUnique(AV._decode(json.objects)); }); /** * @private * @class * Remove is an atomic operation where the given objects will be removed from * the array that is stored in this field. */ AV.Op.Remove = AV.Op._extend( /** @lends AV.Op.Remove.prototype */ { _initialize: function _initialize(objects) { this._objects = _.uniq(objects); }, /** * Returns the objects to be removed from the array. * @return {Array} The objects to be removed from the array. */ objects: function objects() { return this._objects; }, /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { return { __op: 'Remove', objects: AV._encode(this.objects()) }; }, _mergeWithPrevious: function _mergeWithPrevious(previous) { if (!previous) { return this; } else if (previous instanceof AV.Op.Unset) { return previous; } else if (previous instanceof AV.Op.Set) { return new AV.Op.Set(this._estimate(previous.value())); } else if (previous instanceof AV.Op.Remove) { return new AV.Op.Remove(_.union(previous.objects(), this.objects())); } else { throw new Error('Op is invalid after previous op.'); } }, _estimate: function _estimate(oldValue) { if (!oldValue) { return []; } else { var newValue = _.difference(oldValue, this.objects()); // If there are saved AV Objects being removed, also remove them. AV._arrayEach(this.objects(), function (obj) { if (obj instanceof AV.Object && obj.id) { newValue = _.reject(newValue, function (other) { return other instanceof AV.Object && other.id === obj.id; }); } }); return newValue; } } }); AV.Op._registerDecoder('Remove', function (json) { return new AV.Op.Remove(AV._decode(json.objects)); }); /** * @private * @class * A Relation operation indicates that the field is an instance of * AV.Relation, and objects are being added to, or removed from, that * relation. */ AV.Op.Relation = AV.Op._extend( /** @lends AV.Op.Relation.prototype */ { _initialize: function _initialize(adds, removes) { this._targetClassName = null; var self = this; var pointerToId = function pointerToId(object) { if (object instanceof AV.Object) { if (!object.id) { throw new Error("You can't add an unsaved AV.Object to a relation."); } if (!self._targetClassName) { self._targetClassName = object.className; } if (self._targetClassName !== object.className) { throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.'); } return object.id; } return object; }; this.relationsToAdd = _.uniq((0, _map.default)(_).call(_, adds, pointerToId)); this.relationsToRemove = _.uniq((0, _map.default)(_).call(_, removes, pointerToId)); }, /** * Returns an array of unfetched AV.Object that are being added to the * relation. * @return {Array} */ added: function added() { var self = this; return (0, _map.default)(_).call(_, this.relationsToAdd, function (objectId) { var object = AV.Object._create(self._targetClassName); object.id = objectId; return object; }); }, /** * Returns an array of unfetched AV.Object that are being removed from * the relation. * @return {Array} */ removed: function removed() { var self = this; return (0, _map.default)(_).call(_, this.relationsToRemove, function (objectId) { var object = AV.Object._create(self._targetClassName); object.id = objectId; return object; }); }, /** * Returns a JSON version of the operation suitable for sending to AV. * @return {Object} */ toJSON: function toJSON() { var adds = null; var removes = null; var self = this; var idToPointer = function idToPointer(id) { return { __type: 'Pointer', className: self._targetClassName, objectId: id }; }; var pointers = null; if (this.relationsToAdd.length > 0) { pointers = (0, _map.default)(_).call(_, this.relationsToAdd, idToPointer); adds = { __op: 'AddRelation', objects: pointers }; } if (this.relationsToRemove.length > 0) { pointers = (0, _map.default)(_).call(_, this.relationsToRemove, idToPointer); removes = { __op: 'RemoveRelation', objects: pointers }; } if (adds && removes) { return { __op: 'Batch', ops: [adds, removes] }; } return adds || removes || {}; }, _mergeWithPrevious: function _mergeWithPrevious(previous) { if (!previous) { return this; } else if (previous instanceof AV.Op.Unset) { throw new Error("You can't modify a relation after deleting it."); } else if (previous instanceof AV.Op.Relation) { if (previous._targetClassName && previous._targetClassName !== this._targetClassName) { throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.'); } var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd); var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove); var newRelation = new AV.Op.Relation(newAdd, newRemove); newRelation._targetClassName = this._targetClassName; return newRelation; } else { throw new Error('Op is invalid after previous op.'); } }, _estimate: function _estimate(oldValue, object, key) { if (!oldValue) { var relation = new AV.Relation(object, key); relation.targetClassName = this._targetClassName; } else if (oldValue instanceof AV.Relation) { if (this._targetClassName) { if (oldValue.targetClassName) { if (oldValue.targetClassName !== this._targetClassName) { throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.'); } } else { oldValue.targetClassName = this._targetClassName; } } return oldValue; } else { throw new Error('Op is invalid after previous op.'); } } }); AV.Op._registerDecoder('AddRelation', function (json) { return new AV.Op.Relation(AV._decode(json.objects), []); }); AV.Op._registerDecoder('RemoveRelation', function (json) { return new AV.Op.Relation([], AV._decode(json.objects)); }); }; /***/ }), /* 472 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(473); module.exports = parent; /***/ }), /* 473 */ /***/ (function(module, exports, __webpack_require__) { var isPrototypeOf = __webpack_require__(19); var method = __webpack_require__(474); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.find; return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own; }; /***/ }), /* 474 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(475); var entryVirtual = __webpack_require__(40); module.exports = entryVirtual('Array').find; /***/ }), /* 475 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var $find = __webpack_require__(70).find; var addToUnscopables = __webpack_require__(169); var FIND = 'find'; var SKIPS_HOLES = true; // Shouldn't skip holes if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { find: function find(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND); /***/ }), /* 476 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(3); module.exports = function (AV) { /** * Creates a new Relation for the given parent object and key. This * constructor should rarely be used directly, but rather created by * {@link AV.Object#relation}. * @param {AV.Object} parent The parent of this relation. * @param {String} key The key for this relation on the parent. * @see AV.Object#relation * @class * *

* A class that is used to access all of the children of a many-to-many * relationship. Each instance of AV.Relation is associated with a * particular parent object and key. *

*/ AV.Relation = function (parent, key) { if (!_.isString(key)) { throw new TypeError('key must be a string'); } this.parent = parent; this.key = key; this.targetClassName = null; }; /** * Creates a query that can be used to query the parent objects in this relation. * @param {String} parentClass The parent class or name. * @param {String} relationKey The relation field key in parent. * @param {AV.Object} child The child object. * @return {AV.Query} */ AV.Relation.reverseQuery = function (parentClass, relationKey, child) { var query = new AV.Query(parentClass); query.equalTo(relationKey, child._toPointer()); return query; }; _.extend(AV.Relation.prototype, /** @lends AV.Relation.prototype */ { /** * Makes sure that this relation has the right parent and key. * @private */ _ensureParentAndKey: function _ensureParentAndKey(parent, key) { this.parent = this.parent || parent; this.key = this.key || key; if (this.parent !== parent) { throw new Error('Internal Error. Relation retrieved from two different Objects.'); } if (this.key !== key) { throw new Error('Internal Error. Relation retrieved from two different keys.'); } }, /** * Adds a AV.Object or an array of AV.Objects to the relation. * @param {AV.Object|AV.Object[]} objects The item or items to add. */ add: function add(objects) { if (!_.isArray(objects)) { objects = [objects]; } var change = new AV.Op.Relation(objects, []); this.parent.set(this.key, change); this.targetClassName = change._targetClassName; }, /** * Removes a AV.Object or an array of AV.Objects from this relation. * @param {AV.Object|AV.Object[]} objects The item or items to remove. */ remove: function remove(objects) { if (!_.isArray(objects)) { objects = [objects]; } var change = new AV.Op.Relation([], objects); this.parent.set(this.key, change); this.targetClassName = change._targetClassName; }, /** * Returns a JSON version of the object suitable for saving to disk. * @return {Object} */ toJSON: function toJSON() { return { __type: 'Relation', className: this.targetClassName }; }, /** * Returns a AV.Query that is limited to objects in this * relation. * @return {AV.Query} */ query: function query() { var targetClass; var query; if (!this.targetClassName) { targetClass = AV.Object._getSubclass(this.parent.className); query = new AV.Query(targetClass); query._defaultParams.redirectClassNameForKey = this.key; } else { targetClass = AV.Object._getSubclass(this.targetClassName); query = new AV.Query(targetClass); } query._addCondition('$relatedTo', 'object', this.parent._toPointer()); query._addCondition('$relatedTo', 'key', this.key); return query; } }); }; /***/ }), /* 477 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _ = __webpack_require__(3); var cos = __webpack_require__(478); var qiniu = __webpack_require__(479); var s3 = __webpack_require__(525); var AVError = __webpack_require__(46); var _require = __webpack_require__(27), request = _require.request, AVRequest = _require._request; var _require2 = __webpack_require__(30), tap = _require2.tap, transformFetchOptions = _require2.transformFetchOptions; var debug = __webpack_require__(60)('leancloud:file'); var parseBase64 = __webpack_require__(529); module.exports = function (AV) { // port from browserify path module // since react-native packager won't shim node modules. var extname = function extname(path) { if (!_.isString(path)) return ''; return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4]; }; var b64Digit = function b64Digit(number) { if (number < 26) { return String.fromCharCode(65 + number); } if (number < 52) { return String.fromCharCode(97 + (number - 26)); } if (number < 62) { return String.fromCharCode(48 + (number - 52)); } if (number === 62) { return '+'; } if (number === 63) { return '/'; } throw new Error('Tried to encode large digit ' + number + ' in base64.'); }; var encodeBase64 = function encodeBase64(array) { var chunks = []; chunks.length = Math.ceil(array.length / 3); _.times(chunks.length, function (i) { var b1 = array[i * 3]; var b2 = array[i * 3 + 1] || 0; var b3 = array[i * 3 + 2] || 0; var has2 = i * 3 + 1 < array.length; var has3 = i * 3 + 2 < array.length; 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(''); }); return chunks.join(''); }; /** * An AV.File is a local representation of a file that is saved to the AV * cloud. * @param name {String} The file's name. This will change to a unique value * once the file has finished saving. * @param data {Array} The data for the file, as either: * 1. an Array of byte value Numbers, or * 2. an Object like { base64: "..." } with a base64-encoded String. * 3. a Blob(File) selected with a file upload control in a browser. * 4. an Object like { blob: {uri: "..."} } that mimics Blob * in some non-browser environments such as React Native. * 5. a Buffer in Node.js runtime. * 6. a Stream in Node.js runtime. * * For example:
   * var fileUploadControl = $("#profilePhotoFileUpload")[0];
   * if (fileUploadControl.files.length > 0) {
   *   var file = fileUploadControl.files[0];
   *   var name = "photo.jpg";
   *   var file = new AV.File(name, file);
   *   file.save().then(function() {
   *     // The file has been saved to AV.
   *   }, function(error) {
   *     // The file either could not be read, or could not be saved to AV.
   *   });
   * }
* * @class * @param [mimeType] {String} Content-Type header to use for the file. If * this is omitted, the content type will be inferred from the name's * extension. */ AV.File = function (name, data, mimeType) { this.attributes = { name: name, url: '', metaData: {}, // 用来存储转换后要上传的 base64 String base64: '' }; if (_.isString(data)) { throw new TypeError('Creating an AV.File from a String is not yet supported.'); } if (_.isArray(data)) { this.attributes.metaData.size = data.length; data = { base64: encodeBase64(data) }; } this._extName = ''; this._data = data; this._uploadHeaders = {}; if (data && data.blob && typeof data.blob.uri === 'string') { this._extName = extname(data.blob.uri); } if (typeof Blob !== 'undefined' && data instanceof Blob) { if (data.size) { this.attributes.metaData.size = data.size; } if (data.name) { this._extName = extname(data.name); } } var owner; if (data && data.owner) { owner = data.owner; } else if (!AV._config.disableCurrentUser) { try { owner = AV.User.current(); } catch (error) { if ('SYNC_API_NOT_AVAILABLE' !== error.code) { throw error; } } } this.attributes.metaData.owner = owner ? owner.id : 'unknown'; this.set('mime_type', mimeType); }; /** * Creates a fresh AV.File object with exists url for saving to AVOS Cloud. * @param {String} name the file name * @param {String} url the file url. * @param {Object} [metaData] the file metadata object. * @param {String} [type] Content-Type header to use for the file. If * this is omitted, the content type will be inferred from the name's * extension. * @return {AV.File} the file object */ AV.File.withURL = function (name, url, metaData, type) { if (!name || !url) { throw new Error('Please provide file name and url'); } var file = new AV.File(name, null, type); //copy metaData properties to file. if (metaData) { for (var prop in metaData) { if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop]; } } file.attributes.url = url; //Mark the file is from external source. file.attributes.metaData.__source = 'external'; file.attributes.metaData.size = 0; return file; }; /** * Creates a file object with exists objectId. * @param {String} objectId The objectId string * @return {AV.File} the file object */ AV.File.createWithoutData = function (objectId) { if (!objectId) { throw new TypeError('The objectId must be provided'); } var file = new AV.File(); file.id = objectId; return file; }; /** * Request file censor. * @since 4.13.0 * @param {String} objectId * @return {Promise.} */ AV.File.censor = function (objectId) { if (!AV._config.masterKey) { throw new Error('Cannot censor a file without masterKey'); } return request({ method: 'POST', path: "/files/".concat(objectId, "/censor"), authOptions: { useMasterKey: true } }).then(function (res) { return res.censorResult; }); }; _.extend(AV.File.prototype, /** @lends AV.File.prototype */ { className: '_File', _toFullJSON: function _toFullJSON(seenObjects) { var _this = this; var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var json = _.clone(this.attributes); AV._objectEach(json, function (val, key) { json[key] = AV._encode(val, seenObjects, undefined, full); }); AV._objectEach(this._operations, function (val, key) { json[key] = val; }); if (_.has(this, 'id')) { json.objectId = this.id; } ['createdAt', 'updatedAt'].forEach(function (key) { if (_.has(_this, key)) { var val = _this[key]; json[key] = _.isDate(val) ? val.toJSON() : val; } }); if (full) { json.__type = 'File'; } return json; }, /** * Returns a JSON version of the file with meta data. * Inverse to {@link AV.parseJSON} * @since 3.0.0 * @return {Object} */ toFullJSON: function toFullJSON() { var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; return this._toFullJSON(seenObjects); }, /** * Returns a JSON version of the object. * @return {Object} */ toJSON: function toJSON(key, holder) { var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this]; return this._toFullJSON(seenObjects, false); }, /** * Gets a Pointer referencing this file. * @private */ _toPointer: function _toPointer() { return { __type: 'Pointer', className: this.className, objectId: this.id }; }, /** * Returns the ACL for this file. * @returns {AV.ACL} An instance of AV.ACL. */ getACL: function getACL() { return this._acl; }, /** * Sets the ACL to be used for this file. * @param {AV.ACL} acl An instance of AV.ACL. */ setACL: function setACL(acl) { if (!(acl instanceof AV.ACL)) { return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.'); } this._acl = acl; return this; }, /** * Gets the name of the file. Before save is called, this is the filename * given by the user. After save is called, that name gets prefixed with a * unique identifier. */ name: function name() { return this.get('name'); }, /** * Gets the url of the file. It is only available after you save the file or * after you get the file from a AV.Object. * @return {String} */ url: function url() { return this.get('url'); }, /** * Gets the attributs of the file object. * @param {String} The attribute name which want to get. * @returns {Any} */ get: function get(attrName) { switch (attrName) { case 'objectId': return this.id; case 'url': case 'name': case 'mime_type': case 'metaData': case 'createdAt': case 'updatedAt': return this.attributes[attrName]; default: return this.attributes.metaData[attrName]; } }, /** * Set the metaData of the file object. * @param {Object} Object is an key value Object for setting metaData. * @param {String} attr is an optional metadata key. * @param {Object} value is an optional metadata value. * @returns {String|Number|Array|Object} */ set: function set() { var _this2 = this; var set = function set(attrName, value) { switch (attrName) { case 'name': case 'url': case 'mime_type': case 'base64': case 'metaData': _this2.attributes[attrName] = value; break; default: // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面 _this2.attributes.metaData[attrName] = value; break; } }; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } switch (args.length) { case 1: // 传入一个 Object for (var k in args[0]) { set(k, args[0][k]); } break; case 2: set(args[0], args[1]); break; } return this; }, /** * Set a header for the upload request. * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers * * @param {String} key header key * @param {String} value header value * @return {AV.File} this */ setUploadHeader: function setUploadHeader(key, value) { this._uploadHeaders[key] = value; return this; }, /** *

Returns the file's metadata JSON object if no arguments is given.Returns the * metadata value if a key is given.Set metadata value if key and value are both given.

*

     *  var metadata = file.metaData(); //Get metadata JSON object.
     *  var size = file.metaData('size');  // Get the size metadata value.
     *  file.metaData('format', 'jpeg'); //set metadata attribute and value.
     *

* @return {Object} The file's metadata JSON object. * @param {String} attr an optional metadata key. * @param {Object} value an optional metadata value. **/ metaData: function metaData(attr, value) { if (attr && value) { this.attributes.metaData[attr] = value; return this; } else if (attr && !value) { return this.attributes.metaData[attr]; } else { return this.attributes.metaData; } }, /** * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。 * @return {String} 缩略图URL * @param {Number} width 宽度,单位:像素 * @param {Number} heigth 高度,单位:像素 * @param {Number} quality 质量,1-100的数字,默认100 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。 */ thumbnailURL: function thumbnailURL(width, height) { var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100; var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png'; var url = this.attributes.url; if (!url) { throw new Error('Invalid url.'); } if (!width || !height || width <= 0 || height <= 0) { throw new Error('Invalid width or height value.'); } if (quality <= 0 || quality > 100) { throw new Error('Invalid quality value.'); } var mode = scaleToFit ? 2 : 1; return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt; }, /** * Returns the file's size. * @return {Number} The file's size in bytes. **/ size: function size() { return this.metaData().size; }, /** * Returns the file's owner. * @return {String} The file's owner id. */ ownerId: function ownerId() { return this.metaData().owner; }, /** * Destroy the file. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the destroy * completes. */ destroy: function destroy(options) { if (!this.id) { return _promise.default.reject(new Error('The file id does not eixst.')); } var request = AVRequest('files', null, this.id, 'DELETE', null, options); return request; }, /** * Request Qiniu upload token * @param {string} type * @return {Promise} Resolved with the response * @private */ _fileToken: function _fileToken(type, authOptions) { var name = this.attributes.name; var extName = extname(name); if (!extName && this._extName) { name += this._extName; extName = this._extName; } var data = { name: name, keep_file_name: authOptions.keepFileName, key: authOptions.key, ACL: this._acl, mime_type: type, metaData: this.attributes.metaData }; return AVRequest('fileTokens', null, null, 'POST', data, authOptions); }, /** * @callback UploadProgressCallback * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes */ /** * Saves the file to the AV cloud. * @param {AuthOptions} [options] AuthOptions plus: * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey * @return {Promise} Promise that is resolved when the save finishes. */ save: function save() { var _this3 = this; var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (this.id) { throw new Error('File is already saved.'); } if (!this._previousSave) { if (this._data) { var mimeType = this.get('mime_type'); this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) { if (uploadInfo.mime_type) { mimeType = uploadInfo.mime_type; _this3.set('mime_type', mimeType); } _this3._token = uploadInfo.token; return _promise.default.resolve().then(function () { var data = _this3._data; if (data && data.base64) { return parseBase64(data.base64, mimeType); } if (data && data.blob) { if (!data.blob.type && mimeType) { data.blob.type = mimeType; } if (!data.blob.name) { data.blob.name = _this3.get('name'); } return data.blob; } if (typeof Blob !== 'undefined' && data instanceof Blob) { return data; } throw new TypeError('malformed file data'); }).then(function (data) { var _options = _.extend({}, options); // filter out download progress events if (options.onprogress) { _options.onprogress = function (event) { if (event.direction === 'download') return; return options.onprogress(event); }; } switch (uploadInfo.provider) { case 's3': return s3(uploadInfo, data, _this3, _options); case 'qcloud': return cos(uploadInfo, data, _this3, _options); case 'qiniu': default: return qiniu(uploadInfo, data, _this3, _options); } }).then(tap(function () { return _this3._callback(true); }), function (error) { _this3._callback(false); throw error; }); }); } else if (this.attributes.url && this.attributes.metaData.__source === 'external') { // external link file. var data = { name: this.attributes.name, ACL: this._acl, metaData: this.attributes.metaData, mime_type: this.mimeType, url: this.attributes.url }; this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) { _this3.id = response.objectId; return _this3; }); } } return this._previousSave; }, _callback: function _callback(success) { AVRequest('fileCallback', null, null, 'post', { token: this._token, result: success }).catch(debug); delete this._token; delete this._data; }, /** * fetch the file from server. If the server's representation of the * model differs from its current attributes, they will be overriden, * @param {Object} fetchOptions Optional options to set 'keys', * 'include' and 'includeACL' option. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the fetch * completes. */ fetch: function fetch(fetchOptions, options) { if (!this.id) { throw new Error('Cannot fetch unsaved file'); } var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options); return request.then(this._finishFetch.bind(this)); }, _finishFetch: function _finishFetch(response) { var value = AV.Object.prototype.parse(response); value.attributes = { name: value.name, url: value.url, mime_type: value.mime_type, bucket: value.bucket }; value.attributes.metaData = value.metaData || {}; value.id = value.objectId; // clean delete value.objectId; delete value.metaData; delete value.url; delete value.name; delete value.mime_type; delete value.bucket; _.extend(this, value); return this; }, /** * Request file censor * @since 4.13.0 * @return {Promise.} */ censor: function censor() { if (!this.id) { throw new Error('Cannot censor an unsaved file'); } return AV.File.censor(this.id); } }); }; /***/ }), /* 478 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _require = __webpack_require__(72), getAdapter = _require.getAdapter; var debug = __webpack_require__(60)('cos'); module.exports = function (uploadInfo, data, file) { var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token); var fileFormData = { field: 'fileContent', data: data, name: file.attributes.name }; var options = { headers: file._uploadHeaders, data: { op: 'upload' }, onprogress: saveOptions.onprogress }; debug('url: %s, file: %o, options: %o', url, fileFormData, options); var upload = getAdapter('upload'); return upload(url, fileFormData, options).then(function (response) { debug(response.status, response.data); if (response.ok === false) { var error = new Error(response.status); error.response = response; throw error; } file.attributes.url = uploadInfo.url; file._bucket = uploadInfo.bucket; file.id = uploadInfo.objectId; return file; }, function (error) { var response = error.response; if (response) { debug(response.status, response.data); error.statusCode = response.status; error.response = response.data; } throw error; }); }; /***/ }), /* 479 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _sliceInstanceProperty2 = __webpack_require__(61); var _Array$from = __webpack_require__(252); var _Symbol = __webpack_require__(149); var _getIteratorMethod = __webpack_require__(254); var _Reflect$construct = __webpack_require__(489); var _interopRequireDefault = __webpack_require__(1); var _inherits2 = _interopRequireDefault(__webpack_require__(493)); var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(515)); var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(517)); var _classCallCheck2 = _interopRequireDefault(__webpack_require__(522)); var _createClass2 = _interopRequireDefault(__webpack_require__(523)); var _stringify = _interopRequireDefault(__webpack_require__(36)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _promise = _interopRequireDefault(__webpack_require__(12)); var _slice = _interopRequireDefault(__webpack_require__(61)); function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { var _context8; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty2(_context8 = Object.prototype.toString.call(o)).call(_context8, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var _require = __webpack_require__(72), getAdapter = _require.getAdapter; var debug = __webpack_require__(60)('leancloud:qiniu'); var ajax = __webpack_require__(116); var btoa = __webpack_require__(524); var SHARD_THRESHOLD = 1024 * 1024 * 64; var CHUNK_SIZE = 1024 * 1024 * 16; function upload(uploadInfo, data, file) { var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; // Get the uptoken to upload files to qiniu. var uptoken = uploadInfo.token; var url = uploadInfo.upload_url || 'https://upload.qiniup.com'; var fileFormData = { field: 'file', data: data, name: file.attributes.name }; var options = { headers: file._uploadHeaders, data: { name: file.attributes.name, key: uploadInfo.key, token: uptoken }, onprogress: saveOptions.onprogress }; debug('url: %s, file: %o, options: %o', url, fileFormData, options); var upload = getAdapter('upload'); return upload(url, fileFormData, options).then(function (response) { debug(response.status, response.data); if (response.ok === false) { var message = response.status; if (response.data) { if (response.data.error) { message = response.data.error; } else { message = (0, _stringify.default)(response.data); } } var error = new Error(message); error.response = response; throw error; } file.attributes.url = uploadInfo.url; file._bucket = uploadInfo.bucket; file.id = uploadInfo.objectId; return file; }, function (error) { var response = error.response; if (response) { debug(response.status, response.data); error.statusCode = response.status; error.response = response.data; } throw error; }); } function urlSafeBase64(string) { var base64 = btoa(unescape(encodeURIComponent(string))); var result = ''; var _iterator = _createForOfIteratorHelper(base64), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var ch = _step.value; switch (ch) { case '+': result += '-'; break; case '/': result += '_'; break; default: result += ch; } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } return result; } var ShardUploader = /*#__PURE__*/function () { function ShardUploader(uploadInfo, data, file, saveOptions) { var _context, _context2, _this = this; (0, _classCallCheck2.default)(this, ShardUploader); this.uploadInfo = uploadInfo; this.data = data; this.file = file; this.size = undefined; this.offset = 0; this.uploadedChunks = 0; var key = urlSafeBase64(uploadInfo.key); var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com'; this.baseURL = (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(uploadURL, "/buckets/")).call(_context2, uploadInfo.bucket, "/objects/")).call(_context, key, "/uploads"); this.upToken = 'UpToken ' + uploadInfo.token; this.uploaded = 0; if (saveOptions && saveOptions.onprogress) { this.onProgress = function (_ref) { var loaded = _ref.loaded; loaded += _this.uploadedChunks * CHUNK_SIZE; if (loaded <= _this.uploaded) { return; } if (_this.size) { saveOptions.onprogress({ loaded: loaded, total: _this.size, percent: loaded / _this.size * 100 }); } else { saveOptions.onprogress({ loaded: loaded }); } _this.uploaded = loaded; }; } } /** * @returns {Promise} */ (0, _createClass2.default)(ShardUploader, [{ key: "getUploadId", value: function getUploadId() { return ajax({ method: 'POST', url: this.baseURL, headers: { Authorization: this.upToken } }).then(function (res) { return res.uploadId; }); } }, { key: "getChunk", value: function getChunk() { throw new Error('Not implemented'); } /** * @param {string} uploadId * @param {number} partNumber * @param {any} data * @returns {Promise<{ partNumber: number, etag: string }>} */ }, { key: "uploadPart", value: function uploadPart(uploadId, partNumber, data) { var _context3, _context4; return ajax({ method: 'PUT', url: (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(this.baseURL, "/")).call(_context4, uploadId, "/")).call(_context3, partNumber), headers: { Authorization: this.upToken }, data: data, onprogress: this.onProgress }).then(function (_ref2) { var etag = _ref2.etag; return { partNumber: partNumber, etag: etag }; }); } }, { key: "stopUpload", value: function stopUpload(uploadId) { var _context5; return ajax({ method: 'DELETE', url: (0, _concat.default)(_context5 = "".concat(this.baseURL, "/")).call(_context5, uploadId), headers: { Authorization: this.upToken } }); } }, { key: "upload", value: function upload() { var _this2 = this; var parts = []; return this.getUploadId().then(function (uploadId) { var uploadPart = function uploadPart() { return _promise.default.resolve(_this2.getChunk()).then(function (chunk) { if (!chunk) { return; } var partNumber = parts.length + 1; return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) { parts.push(part); _this2.uploadedChunks++; return uploadPart(); }); }).catch(function (error) { return _this2.stopUpload(uploadId).then(function () { return _promise.default.reject(error); }); }); }; return uploadPart().then(function () { var _context6; return ajax({ method: 'POST', url: (0, _concat.default)(_context6 = "".concat(_this2.baseURL, "/")).call(_context6, uploadId), headers: { Authorization: _this2.upToken }, data: { parts: parts, fname: _this2.file.attributes.name, mimeType: _this2.file.attributes.mime_type } }); }); }).then(function () { _this2.file.attributes.url = _this2.uploadInfo.url; _this2.file._bucket = _this2.uploadInfo.bucket; _this2.file.id = _this2.uploadInfo.objectId; return _this2.file; }); } }]); return ShardUploader; }(); var BlobUploader = /*#__PURE__*/function (_ShardUploader) { (0, _inherits2.default)(BlobUploader, _ShardUploader); var _super = _createSuper(BlobUploader); function BlobUploader(uploadInfo, data, file, saveOptions) { var _this3; (0, _classCallCheck2.default)(this, BlobUploader); _this3 = _super.call(this, uploadInfo, data, file, saveOptions); _this3.size = data.size; return _this3; } /** * @returns {Blob | null} */ (0, _createClass2.default)(BlobUploader, [{ key: "getChunk", value: function getChunk() { var _context7; if (this.offset >= this.size) { return null; } var chunk = (0, _slice.default)(_context7 = this.data).call(_context7, this.offset, this.offset + CHUNK_SIZE); this.offset += chunk.size; return chunk; } }]); return BlobUploader; }(ShardUploader); function isBlob(data) { return typeof Blob !== 'undefined' && data instanceof Blob; } module.exports = function (uploadInfo, data, file) { var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; if (isBlob(data) && data.size >= SHARD_THRESHOLD) { return new BlobUploader(uploadInfo, data, file, saveOptions).upload(); } return upload(uploadInfo, data, file, saveOptions); }; /***/ }), /* 480 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(55); __webpack_require__(481); var path = __webpack_require__(5); module.exports = path.Array.from; /***/ }), /* 481 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var from = __webpack_require__(482); var checkCorrectnessOfIteration = __webpack_require__(178); var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { // eslint-disable-next-line es-x/no-array-from -- required for testing Array.from(iterable); }); // `Array.from` method // https://tc39.es/ecma262/#sec-array.from $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { from: from }); /***/ }), /* 482 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(48); var call = __webpack_require__(15); var toObject = __webpack_require__(34); var callWithSafeIterationClosing = __webpack_require__(483); var isArrayIteratorMethod = __webpack_require__(166); var isConstructor = __webpack_require__(109); var lengthOfArrayLike = __webpack_require__(41); var createProperty = __webpack_require__(91); var getIterator = __webpack_require__(167); var getIteratorMethod = __webpack_require__(106); var $Array = Array; // `Array.from` method implementation // https://tc39.es/ecma262/#sec-array.from module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { var O = toObject(arrayLike); var IS_CONSTRUCTOR = isConstructor(this); var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined); var iteratorMethod = getIteratorMethod(O); var index = 0; var length, result, step, iterator, next, value; // if the target is not iterable or it's an array with the default iterator - use a simple case if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) { iterator = getIterator(O, iteratorMethod); next = iterator.next; result = IS_CONSTRUCTOR ? new this() : []; for (;!(step = call(next, iterator)).done; index++) { value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; createProperty(result, index, value); } } else { length = lengthOfArrayLike(O); result = IS_CONSTRUCTOR ? new this(length) : $Array(length); for (;length > index; index++) { value = mapping ? mapfn(O[index], index) : O[index]; createProperty(result, index, value); } } result.length = index; return result; }; /***/ }), /* 483 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(20); var iteratorClose = __webpack_require__(168); // call something on iterator step with safe closing on error module.exports = function (iterator, fn, value, ENTRIES) { try { return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); } catch (error) { iteratorClose(iterator, 'throw', error); } }; /***/ }), /* 484 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(485); /***/ }), /* 485 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(486); module.exports = parent; /***/ }), /* 486 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(487); module.exports = parent; /***/ }), /* 487 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(488); __webpack_require__(39); module.exports = parent; /***/ }), /* 488 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(38); __webpack_require__(55); var getIteratorMethod = __webpack_require__(106); module.exports = getIteratorMethod; /***/ }), /* 489 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(490); /***/ }), /* 490 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(491); module.exports = parent; /***/ }), /* 491 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(492); var path = __webpack_require__(5); module.exports = path.Reflect.construct; /***/ }), /* 492 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var getBuiltIn = __webpack_require__(18); var apply = __webpack_require__(75); var bind = __webpack_require__(255); var aConstructor = __webpack_require__(174); var anObject = __webpack_require__(20); var isObject = __webpack_require__(11); var create = __webpack_require__(49); var fails = __webpack_require__(2); var nativeConstruct = getBuiltIn('Reflect', 'construct'); var ObjectPrototype = Object.prototype; var push = [].push; // `Reflect.construct` method // https://tc39.es/ecma262/#sec-reflect.construct // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it var NEW_TARGET_BUG = fails(function () { function F() { /* empty */ } return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F); }); var ARGS_BUG = !fails(function () { nativeConstruct(function () { /* empty */ }); }); var FORCED = NEW_TARGET_BUG || ARGS_BUG; $({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, { construct: function construct(Target, args /* , newTarget */) { aConstructor(Target); anObject(args); var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]); if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget); if (Target == newTarget) { // w/o altered newTarget, optimization for 0-4 arguments switch (args.length) { case 0: return new Target(); case 1: return new Target(args[0]); case 2: return new Target(args[0], args[1]); case 3: return new Target(args[0], args[1], args[2]); case 4: return new Target(args[0], args[1], args[2], args[3]); } // w/o altered newTarget, lot of arguments case var $args = [null]; apply(push, $args, args); return new (apply(bind, Target, $args))(); } // with altered newTarget, not support built-in constructors var proto = newTarget.prototype; var instance = create(isObject(proto) ? proto : ObjectPrototype); var result = apply(Target, instance, args); return isObject(result) ? result : instance; } }); /***/ }), /* 493 */ /***/ (function(module, exports, __webpack_require__) { var _Object$create = __webpack_require__(494); var _Object$defineProperty = __webpack_require__(150); var setPrototypeOf = __webpack_require__(504); function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = _Object$create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); _Object$defineProperty(subClass, "prototype", { writable: false }); if (superClass) setPrototypeOf(subClass, superClass); } module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 494 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(495); /***/ }), /* 495 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(496); /***/ }), /* 496 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(497); module.exports = parent; /***/ }), /* 497 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(498); module.exports = parent; /***/ }), /* 498 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(499); module.exports = parent; /***/ }), /* 499 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(500); var path = __webpack_require__(5); var Object = path.Object; module.exports = function create(P, D) { return Object.create(P, D); }; /***/ }), /* 500 */ /***/ (function(module, exports, __webpack_require__) { // TODO: Remove from `core-js@4` var $ = __webpack_require__(0); var DESCRIPTORS = __webpack_require__(14); var create = __webpack_require__(49); // `Object.create` method // https://tc39.es/ecma262/#sec-object.create $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, { create: create }); /***/ }), /* 501 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(502); /***/ }), /* 502 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(503); module.exports = parent; /***/ }), /* 503 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(241); module.exports = parent; /***/ }), /* 504 */ /***/ (function(module, exports, __webpack_require__) { var _Object$setPrototypeOf = __webpack_require__(256); var _bindInstanceProperty = __webpack_require__(257); function _setPrototypeOf(o, p) { var _context; module.exports = _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }, module.exports.__esModule = true, module.exports["default"] = module.exports; return _setPrototypeOf(o, p); } module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 505 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(506); /***/ }), /* 506 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(507); module.exports = parent; /***/ }), /* 507 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(239); module.exports = parent; /***/ }), /* 508 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(509); /***/ }), /* 509 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(510); module.exports = parent; /***/ }), /* 510 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(511); module.exports = parent; /***/ }), /* 511 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(512); module.exports = parent; /***/ }), /* 512 */ /***/ (function(module, exports, __webpack_require__) { var isPrototypeOf = __webpack_require__(19); var method = __webpack_require__(513); var FunctionPrototype = Function.prototype; module.exports = function (it) { var own = it.bind; return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own; }; /***/ }), /* 513 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(514); var entryVirtual = __webpack_require__(40); module.exports = entryVirtual('Function').bind; /***/ }), /* 514 */ /***/ (function(module, exports, __webpack_require__) { // TODO: Remove from `core-js@4` var $ = __webpack_require__(0); var bind = __webpack_require__(255); // `Function.prototype.bind` method // https://tc39.es/ecma262/#sec-function.prototype.bind $({ target: 'Function', proto: true, forced: Function.bind !== bind }, { bind: bind }); /***/ }), /* 515 */ /***/ (function(module, exports, __webpack_require__) { var _typeof = __webpack_require__(73)["default"]; var assertThisInitialized = __webpack_require__(516); function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return assertThisInitialized(self); } module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 516 */ /***/ (function(module, exports) { function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 517 */ /***/ (function(module, exports, __webpack_require__) { var _Object$setPrototypeOf = __webpack_require__(256); var _bindInstanceProperty = __webpack_require__(257); var _Object$getPrototypeOf = __webpack_require__(518); function _getPrototypeOf(o) { var _context; module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) { return o.__proto__ || _Object$getPrototypeOf(o); }, module.exports.__esModule = true, module.exports["default"] = module.exports; return _getPrototypeOf(o); } module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 518 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(519); /***/ }), /* 519 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(520); /***/ }), /* 520 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(521); module.exports = parent; /***/ }), /* 521 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(233); module.exports = parent; /***/ }), /* 522 */ /***/ (function(module, exports) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 523 */ /***/ (function(module, exports, __webpack_require__) { var _Object$defineProperty = __webpack_require__(150); function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; _Object$defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); _Object$defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 524 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _slice = _interopRequireDefault(__webpack_require__(61)); // base64 character set, plus padding character (=) var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; module.exports = function (string) { var result = ''; for (var i = 0; i < string.length;) { var a = string.charCodeAt(i++); var b = string.charCodeAt(i++); var c = string.charCodeAt(i++); if (a > 255 || b > 255 || c > 255) { throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.'); } var bitmap = a << 16 | b << 8 | c; result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63); } // To determine the final padding var rest = string.length % 3; // If there's need of padding, replace the last 'A's with equal signs return rest ? (0, _slice.default)(result).call(result, 0, rest - 3) + '==='.substring(rest) : result; }; /***/ }), /* 525 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(3); var ajax = __webpack_require__(116); module.exports = function upload(uploadInfo, data, file) { var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; return ajax({ url: uploadInfo.upload_url, method: 'PUT', data: data, headers: _.extend({ 'Content-Type': file.get('mime_type'), 'Cache-Control': 'public, max-age=31536000' }, file._uploadHeaders), onprogress: saveOptions.onprogress }).then(function () { file.attributes.url = uploadInfo.url; file._bucket = uploadInfo.bucket; file.id = uploadInfo.objectId; return file; }); }; /***/ }), /* 526 */ /***/ (function(module, exports, __webpack_require__) { (function(){ var crypt = __webpack_require__(527), utf8 = __webpack_require__(258).utf8, isBuffer = __webpack_require__(528), bin = __webpack_require__(258).bin, // The core md5 = function (message, options) { // Convert to byte array if (message.constructor == String) if (options && options.encoding === 'binary') message = bin.stringToBytes(message); else message = utf8.stringToBytes(message); else if (isBuffer(message)) message = Array.prototype.slice.call(message, 0); else if (!Array.isArray(message)) message = message.toString(); // else, assume byte array already var m = crypt.bytesToWords(message), l = message.length * 8, a = 1732584193, b = -271733879, c = -1732584194, d = 271733878; // Swap endian for (var i = 0; i < m.length; i++) { m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF | ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00; } // Padding m[l >>> 5] |= 0x80 << (l % 32); m[(((l + 64) >>> 9) << 4) + 14] = l; // Method shortcuts var FF = md5._ff, GG = md5._gg, HH = md5._hh, II = md5._ii; for (var i = 0; i < m.length; i += 16) { var aa = a, bb = b, cc = c, dd = d; a = FF(a, b, c, d, m[i+ 0], 7, -680876936); d = FF(d, a, b, c, m[i+ 1], 12, -389564586); c = FF(c, d, a, b, m[i+ 2], 17, 606105819); b = FF(b, c, d, a, m[i+ 3], 22, -1044525330); a = FF(a, b, c, d, m[i+ 4], 7, -176418897); d = FF(d, a, b, c, m[i+ 5], 12, 1200080426); c = FF(c, d, a, b, m[i+ 6], 17, -1473231341); b = FF(b, c, d, a, m[i+ 7], 22, -45705983); a = FF(a, b, c, d, m[i+ 8], 7, 1770035416); d = FF(d, a, b, c, m[i+ 9], 12, -1958414417); c = FF(c, d, a, b, m[i+10], 17, -42063); b = FF(b, c, d, a, m[i+11], 22, -1990404162); a = FF(a, b, c, d, m[i+12], 7, 1804603682); d = FF(d, a, b, c, m[i+13], 12, -40341101); c = FF(c, d, a, b, m[i+14], 17, -1502002290); b = FF(b, c, d, a, m[i+15], 22, 1236535329); a = GG(a, b, c, d, m[i+ 1], 5, -165796510); d = GG(d, a, b, c, m[i+ 6], 9, -1069501632); c = GG(c, d, a, b, m[i+11], 14, 643717713); b = GG(b, c, d, a, m[i+ 0], 20, -373897302); a = GG(a, b, c, d, m[i+ 5], 5, -701558691); d = GG(d, a, b, c, m[i+10], 9, 38016083); c = GG(c, d, a, b, m[i+15], 14, -660478335); b = GG(b, c, d, a, m[i+ 4], 20, -405537848); a = GG(a, b, c, d, m[i+ 9], 5, 568446438); d = GG(d, a, b, c, m[i+14], 9, -1019803690); c = GG(c, d, a, b, m[i+ 3], 14, -187363961); b = GG(b, c, d, a, m[i+ 8], 20, 1163531501); a = GG(a, b, c, d, m[i+13], 5, -1444681467); d = GG(d, a, b, c, m[i+ 2], 9, -51403784); c = GG(c, d, a, b, m[i+ 7], 14, 1735328473); b = GG(b, c, d, a, m[i+12], 20, -1926607734); a = HH(a, b, c, d, m[i+ 5], 4, -378558); d = HH(d, a, b, c, m[i+ 8], 11, -2022574463); c = HH(c, d, a, b, m[i+11], 16, 1839030562); b = HH(b, c, d, a, m[i+14], 23, -35309556); a = HH(a, b, c, d, m[i+ 1], 4, -1530992060); d = HH(d, a, b, c, m[i+ 4], 11, 1272893353); c = HH(c, d, a, b, m[i+ 7], 16, -155497632); b = HH(b, c, d, a, m[i+10], 23, -1094730640); a = HH(a, b, c, d, m[i+13], 4, 681279174); d = HH(d, a, b, c, m[i+ 0], 11, -358537222); c = HH(c, d, a, b, m[i+ 3], 16, -722521979); b = HH(b, c, d, a, m[i+ 6], 23, 76029189); a = HH(a, b, c, d, m[i+ 9], 4, -640364487); d = HH(d, a, b, c, m[i+12], 11, -421815835); c = HH(c, d, a, b, m[i+15], 16, 530742520); b = HH(b, c, d, a, m[i+ 2], 23, -995338651); a = II(a, b, c, d, m[i+ 0], 6, -198630844); d = II(d, a, b, c, m[i+ 7], 10, 1126891415); c = II(c, d, a, b, m[i+14], 15, -1416354905); b = II(b, c, d, a, m[i+ 5], 21, -57434055); a = II(a, b, c, d, m[i+12], 6, 1700485571); d = II(d, a, b, c, m[i+ 3], 10, -1894986606); c = II(c, d, a, b, m[i+10], 15, -1051523); b = II(b, c, d, a, m[i+ 1], 21, -2054922799); a = II(a, b, c, d, m[i+ 8], 6, 1873313359); d = II(d, a, b, c, m[i+15], 10, -30611744); c = II(c, d, a, b, m[i+ 6], 15, -1560198380); b = II(b, c, d, a, m[i+13], 21, 1309151649); a = II(a, b, c, d, m[i+ 4], 6, -145523070); d = II(d, a, b, c, m[i+11], 10, -1120210379); c = II(c, d, a, b, m[i+ 2], 15, 718787259); b = II(b, c, d, a, m[i+ 9], 21, -343485551); a = (a + aa) >>> 0; b = (b + bb) >>> 0; c = (c + cc) >>> 0; d = (d + dd) >>> 0; } return crypt.endian([a, b, c, d]); }; // Auxiliary functions md5._ff = function (a, b, c, d, x, s, t) { var n = a + (b & c | ~b & d) + (x >>> 0) + t; return ((n << s) | (n >>> (32 - s))) + b; }; md5._gg = function (a, b, c, d, x, s, t) { var n = a + (b & d | c & ~d) + (x >>> 0) + t; return ((n << s) | (n >>> (32 - s))) + b; }; md5._hh = function (a, b, c, d, x, s, t) { var n = a + (b ^ c ^ d) + (x >>> 0) + t; return ((n << s) | (n >>> (32 - s))) + b; }; md5._ii = function (a, b, c, d, x, s, t) { var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; return ((n << s) | (n >>> (32 - s))) + b; }; // Package private blocksize md5._blocksize = 16; md5._digestsize = 16; module.exports = function (message, options) { if (message === undefined || message === null) throw new Error('Illegal argument ' + message); var digestbytes = crypt.wordsToBytes(md5(message, options)); return options && options.asBytes ? digestbytes : options && options.asString ? bin.bytesToString(digestbytes) : crypt.bytesToHex(digestbytes); }; })(); /***/ }), /* 527 */ /***/ (function(module, exports) { (function() { var base64map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', crypt = { // Bit-wise rotation left rotl: function(n, b) { return (n << b) | (n >>> (32 - b)); }, // Bit-wise rotation right rotr: function(n, b) { return (n << (32 - b)) | (n >>> b); }, // Swap big-endian to little-endian and vice versa endian: function(n) { // If number given, swap endian if (n.constructor == Number) { return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00; } // Else, assume array and swap all items for (var i = 0; i < n.length; i++) n[i] = crypt.endian(n[i]); return n; }, // Generate an array of any length of random bytes randomBytes: function(n) { for (var bytes = []; n > 0; n--) bytes.push(Math.floor(Math.random() * 256)); return bytes; }, // Convert a byte array to big-endian 32-bit words bytesToWords: function(bytes) { for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8) words[b >>> 5] |= bytes[i] << (24 - b % 32); return words; }, // Convert big-endian 32-bit words to a byte array wordsToBytes: function(words) { for (var bytes = [], b = 0; b < words.length * 32; b += 8) bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF); return bytes; }, // Convert a byte array to a hex string bytesToHex: function(bytes) { for (var hex = [], i = 0; i < bytes.length; i++) { hex.push((bytes[i] >>> 4).toString(16)); hex.push((bytes[i] & 0xF).toString(16)); } return hex.join(''); }, // Convert a hex string to a byte array hexToBytes: function(hex) { for (var bytes = [], c = 0; c < hex.length; c += 2) bytes.push(parseInt(hex.substr(c, 2), 16)); return bytes; }, // Convert a byte array to a base-64 string bytesToBase64: function(bytes) { for (var base64 = [], i = 0; i < bytes.length; i += 3) { var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]; for (var j = 0; j < 4; j++) if (i * 8 + j * 6 <= bytes.length * 8) base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F)); else base64.push('='); } return base64.join(''); }, // Convert a base-64 string to a byte array base64ToBytes: function(base64) { // Remove non-base-64 characters base64 = base64.replace(/[^A-Z0-9+\/]/ig, ''); for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) { if (imod4 == 0) continue; bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2)) | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2))); } return bytes; } }; module.exports = crypt; })(); /***/ }), /* 528 */ /***/ (function(module, exports) { /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ // The _isBuffer check is for Safari 5-7 support, because it's missing // Object.prototype.constructor. Remove this eventually module.exports = function (obj) { return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) } function isBuffer (obj) { return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) } // For Node v0.10 support. Remove this eventually. function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } /***/ }), /* 529 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _indexOf = _interopRequireDefault(__webpack_require__(71)); var dataURItoBlob = function dataURItoBlob(dataURI, type) { var _context; var byteString; // 传入的 base64,不是 dataURL if ((0, _indexOf.default)(dataURI).call(dataURI, 'base64') < 0) { byteString = atob(dataURI); } else if ((0, _indexOf.default)(_context = dataURI.split(',')[0]).call(_context, 'base64') >= 0) { type = type || dataURI.split(',')[0].split(':')[1].split(';')[0]; byteString = atob(dataURI.split(',')[1]); } else { byteString = unescape(dataURI.split(',')[1]); } var ia = new Uint8Array(byteString.length); for (var i = 0; i < byteString.length; i++) { ia[i] = byteString.charCodeAt(i); } return new Blob([ia], { type: type }); }; module.exports = dataURItoBlob; /***/ }), /* 530 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _slicedToArray2 = _interopRequireDefault(__webpack_require__(531)); var _map = _interopRequireDefault(__webpack_require__(35)); var _indexOf = _interopRequireDefault(__webpack_require__(71)); var _find = _interopRequireDefault(__webpack_require__(93)); var _promise = _interopRequireDefault(__webpack_require__(12)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _keys2 = _interopRequireDefault(__webpack_require__(59)); var _stringify = _interopRequireDefault(__webpack_require__(36)); var _defineProperty = _interopRequireDefault(__webpack_require__(92)); var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151)); var _ = __webpack_require__(3); var AVError = __webpack_require__(46); var _require = __webpack_require__(27), _request = _require._request; var _require2 = __webpack_require__(30), isNullOrUndefined = _require2.isNullOrUndefined, ensureArray = _require2.ensureArray, transformFetchOptions = _require2.transformFetchOptions, setValue = _require2.setValue, findValue = _require2.findValue, isPlainObject = _require2.isPlainObject, continueWhile = _require2.continueWhile; var recursiveToPointer = function recursiveToPointer(value) { if (_.isArray(value)) return (0, _map.default)(value).call(value, recursiveToPointer); if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer); if (_.isObject(value) && value._toPointer) return value._toPointer(); return value; }; var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt']; var checkReservedKey = function checkReservedKey(key) { if ((0, _indexOf.default)(RESERVED_KEYS).call(RESERVED_KEYS, key) !== -1) { throw new Error("key[".concat(key, "] is reserved")); } }; var handleBatchResults = function handleBatchResults(results) { var firstError = (0, _find.default)(_).call(_, results, function (result) { return result instanceof Error; }); if (!firstError) { return results; } var error = new AVError(firstError.code, firstError.message); error.results = results; throw error; }; // Helper function to get a value from a Backbone object as a property // or as a function. function getValue(object, prop) { if (!(object && object[prop])) { return null; } return _.isFunction(object[prop]) ? object[prop]() : object[prop]; } // AV.Object is analogous to the Java AVObject. // It also implements the same interface as a Backbone model. module.exports = function (AV) { /** * Creates a new model with defined attributes. A client id (cid) is * automatically generated and assigned for you. * *

You won't normally call this method directly. It is recommended that * you use a subclass of AV.Object instead, created by calling * extend.

* *

However, if you don't want to use a subclass, or aren't sure which * subclass is appropriate, you can use this form:

   *     var object = new AV.Object("ClassName");
   * 
* That is basically equivalent to:
   *     var MyClass = AV.Object.extend("ClassName");
   *     var object = new MyClass();
   * 

* * @param {Object} attributes The initial set of data to store in the object. * @param {Object} options A set of Backbone-like options for creating the * object. The only option currently supported is "collection". * @see AV.Object.extend * * @class * *

The fundamental unit of AV data, which implements the Backbone Model * interface.

*/ AV.Object = function (attributes, options) { // Allow new AV.Object("ClassName") as a shortcut to _create. if (_.isString(attributes)) { return AV.Object._create.apply(this, arguments); } attributes = attributes || {}; if (options && options.parse) { attributes = this.parse(attributes); attributes = this._mergeMagicFields(attributes); } var defaults = getValue(this, 'defaults'); if (defaults) { attributes = _.extend({}, defaults, attributes); } if (options && options.collection) { this.collection = options.collection; } this._serverData = {}; // The last known data for this object from cloud. this._opSetQueue = [{}]; // List of sets of changes to the data. this._flags = {}; this.attributes = {}; // The best estimate of this's current data. this._hashedJSON = {}; // Hash of values of containers at last save. this._escapedAttributes = {}; this.cid = _.uniqueId('c'); this.changed = {}; this._silent = {}; this._pending = {}; this.set(attributes, { silent: true }); this.changed = {}; this._silent = {}; this._pending = {}; this._hasData = true; this._previousAttributes = _.clone(this.attributes); this.initialize.apply(this, arguments); }; /** * @lends AV.Object.prototype * @property {String} id The objectId of the AV Object. */ /** * Saves the given list of AV.Object. * If any error is encountered, stops and calls the error handler. * * @example * AV.Object.saveAll([object1, object2, ...]).then(function(list) { * // All the objects were saved. * }, function(error) { * // An error occurred while saving one of the objects. * }); * * @param {Array} list A list of AV.Object. */ AV.Object.saveAll = function (list, options) { return AV.Object._deepSaveAsync(list, null, options); }; /** * Fetch the given list of AV.Object. * * @param {AV.Object[]} objects A list of AV.Object * @param {AuthOptions} options * @return {Promise.} The given list of AV.Object, updated */ AV.Object.fetchAll = function (objects, options) { return _promise.default.resolve().then(function () { return _request('batch', null, null, 'POST', { requests: (0, _map.default)(_).call(_, objects, function (object) { var _context; if (!object.className) throw new Error('object must have className to fetch'); if (!object.id) throw new Error('object must have id to fetch'); if (object.dirty()) throw new Error('object is modified but not saved'); return { method: 'GET', path: (0, _concat.default)(_context = "/1.1/classes/".concat(object.className, "/")).call(_context, object.id) }; }) }, options); }).then(function (response) { var results = (0, _map.default)(_).call(_, objects, function (object, i) { if (response[i].success) { var fetchedAttrs = object.parse(response[i].success); object._cleanupUnsetKeys(fetchedAttrs); object._finishFetch(fetchedAttrs); return object; } if (response[i].success === null) { return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'); } return new AVError(response[i].error.code, response[i].error.error); }); return handleBatchResults(results); }); }; // Attach all inheritable methods to the AV.Object prototype. _.extend(AV.Object.prototype, AV.Events, /** @lends AV.Object.prototype */ { _fetchWhenSave: false, /** * Initialize is an empty function by default. Override it with your own * initialization logic. */ initialize: function initialize() {}, /** * Set whether to enable fetchWhenSave option when updating object. * When set true, SDK would fetch the latest object after saving. * Default is false. * * @deprecated use AV.Object#save with options.fetchWhenSave instead * @param {boolean} enable true to enable fetchWhenSave option. */ fetchWhenSave: function fetchWhenSave(enable) { console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.'); if (!_.isBoolean(enable)) { throw new Error('Expect boolean value for fetchWhenSave'); } this._fetchWhenSave = enable; }, /** * Returns the object's objectId. * @return {String} the objectId. */ getObjectId: function getObjectId() { return this.id; }, /** * Returns the object's createdAt attribute. * @return {Date} */ getCreatedAt: function getCreatedAt() { return this.createdAt; }, /** * Returns the object's updatedAt attribute. * @return {Date} */ getUpdatedAt: function getUpdatedAt() { return this.updatedAt; }, /** * Returns a JSON version of the object. * @return {Object} */ toJSON: function toJSON(key, holder) { var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; return this._toFullJSON(seenObjects, false); }, /** * Returns a JSON version of the object with meta data. * Inverse to {@link AV.parseJSON} * @since 3.0.0 * @return {Object} */ toFullJSON: function toFullJSON() { var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; return this._toFullJSON(seenObjects); }, _toFullJSON: function _toFullJSON(seenObjects) { var _this = this; var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var json = _.clone(this.attributes); if (_.isArray(seenObjects)) { var newSeenObjects = (0, _concat.default)(seenObjects).call(seenObjects, this); } AV._objectEach(json, function (val, key) { json[key] = AV._encode(val, newSeenObjects, undefined, full); }); AV._objectEach(this._operations, function (val, key) { json[key] = val; }); if (_.has(this, 'id')) { json.objectId = this.id; } ['createdAt', 'updatedAt'].forEach(function (key) { if (_.has(_this, key)) { var val = _this[key]; json[key] = _.isDate(val) ? val.toJSON() : val; } }); if (full) { json.__type = 'Object'; if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer'; json.className = this.className; } return json; }, /** * Updates _hashedJSON to reflect the current state of this object. * Adds any changed hash values to the set of pending changes. * @private */ _refreshCache: function _refreshCache() { var self = this; if (self._refreshingCache) { return; } self._refreshingCache = true; AV._objectEach(this.attributes, function (value, key) { if (value instanceof AV.Object) { value._refreshCache(); } else if (_.isObject(value)) { if (self._resetCacheForKey(key)) { self.set(key, new AV.Op.Set(value), { silent: true }); } } }); delete self._refreshingCache; }, /** * Returns true if this object has been modified since its last * save/refresh. If an attribute is specified, it returns true only if that * particular attribute has been modified since the last save/refresh. * @param {String} attr An attribute name (optional). * @return {Boolean} */ dirty: function dirty(attr) { this._refreshCache(); var currentChanges = _.last(this._opSetQueue); if (attr) { return currentChanges[attr] ? true : false; } if (!this.id) { return true; } if ((0, _keys2.default)(_).call(_, currentChanges).length > 0) { return true; } return false; }, /** * Returns the keys of the modified attribute since its last save/refresh. * @return {String[]} */ dirtyKeys: function dirtyKeys() { this._refreshCache(); var currentChanges = _.last(this._opSetQueue); return (0, _keys2.default)(_).call(_, currentChanges); }, /** * Gets a Pointer referencing this Object. * @private */ _toPointer: function _toPointer() { // if (!this.id) { // throw new Error("Can't serialize an unsaved AV.Object"); // } return { __type: 'Pointer', className: this.className, objectId: this.id }; }, /** * Gets the value of an attribute. * @param {String} attr The string name of an attribute. */ get: function get(attr) { switch (attr) { case 'objectId': return this.id; case 'createdAt': case 'updatedAt': return this[attr]; default: return this.attributes[attr]; } }, /** * Gets a relation on the given class for the attribute. * @param {String} attr The attribute to get the relation for. * @return {AV.Relation} */ relation: function relation(attr) { var value = this.get(attr); if (value) { if (!(value instanceof AV.Relation)) { throw new Error('Called relation() on non-relation field ' + attr); } value._ensureParentAndKey(this, attr); return value; } else { return new AV.Relation(this, attr); } }, /** * Gets the HTML-escaped value of an attribute. */ escape: function escape(attr) { var html = this._escapedAttributes[attr]; if (html) { return html; } var val = this.attributes[attr]; var escaped; if (isNullOrUndefined(val)) { escaped = ''; } else { escaped = _.escape(val.toString()); } this._escapedAttributes[attr] = escaped; return escaped; }, /** * Returns true if the attribute contains a value that is not * null or undefined. * @param {String} attr The string name of the attribute. * @return {Boolean} */ has: function has(attr) { return !isNullOrUndefined(this.attributes[attr]); }, /** * Pulls "special" fields like objectId, createdAt, etc. out of attrs * and puts them on "this" directly. Removes them from attrs. * @param attrs - A dictionary with the data for this AV.Object. * @private */ _mergeMagicFields: function _mergeMagicFields(attrs) { // Check for changes of magic fields. var model = this; var specialFields = ['objectId', 'createdAt', 'updatedAt']; AV._arrayEach(specialFields, function (attr) { if (attrs[attr]) { if (attr === 'objectId') { model.id = attrs[attr]; } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) { model[attr] = AV._parseDate(attrs[attr]); } else { model[attr] = attrs[attr]; } delete attrs[attr]; } }); return attrs; }, /** * Returns the json to be sent to the server. * @private */ _startSave: function _startSave() { this._opSetQueue.push({}); }, /** * Called when a save fails because of an error. Any changes that were part * of the save need to be merged with changes made after the save. This * might throw an exception is you do conflicting operations. For example, * if you do: * object.set("foo", "bar"); * object.set("invalid field name", "baz"); * object.save(); * object.increment("foo"); * then this will throw when the save fails and the client tries to merge * "bar" with the +1. * @private */ _cancelSave: function _cancelSave() { var failedChanges = _.first(this._opSetQueue); this._opSetQueue = _.rest(this._opSetQueue); var nextChanges = _.first(this._opSetQueue); AV._objectEach(failedChanges, function (op, key) { var op1 = failedChanges[key]; var op2 = nextChanges[key]; if (op1 && op2) { nextChanges[key] = op2._mergeWithPrevious(op1); } else if (op1) { nextChanges[key] = op1; } }); this._saving = this._saving - 1; }, /** * Called when a save completes successfully. This merges the changes that * were saved into the known server data, and overrides it with any data * sent directly from the server. * @private */ _finishSave: function _finishSave(serverData) { var _context2; // Grab a copy of any object referenced by this object. These instances // may have already been fetched, and we don't want to lose their data. // Note that doing it like this means we will unify separate copies of the // same object, but that's a risk we have to take. var fetchedObjects = {}; AV._traverse(this.attributes, function (object) { if (object instanceof AV.Object && object.id && object._hasData) { fetchedObjects[object.id] = object; } }); var savedChanges = _.first(this._opSetQueue); this._opSetQueue = _.rest(this._opSetQueue); this._applyOpSet(savedChanges, this._serverData); this._mergeMagicFields(serverData); var self = this; AV._objectEach(serverData, function (value, key) { self._serverData[key] = AV._decode(value, key); // Look for any objects that might have become unfetched and fix them // by replacing their values with the previously observed values. var fetched = AV._traverse(self._serverData[key], function (object) { if (object instanceof AV.Object && fetchedObjects[object.id]) { return fetchedObjects[object.id]; } }); if (fetched) { self._serverData[key] = fetched; } }); this._rebuildAllEstimatedData(); var opSetQueue = (0, _map.default)(_context2 = this._opSetQueue).call(_context2, _.clone); this._refreshCache(); this._opSetQueue = opSetQueue; this._saving = this._saving - 1; }, /** * Called when a fetch or login is complete to set the known server data to * the given object. * @private */ _finishFetch: function _finishFetch(serverData, hasData) { // Clear out any changes the user might have made previously. this._opSetQueue = [{}]; // Bring in all the new server data. this._mergeMagicFields(serverData); var self = this; AV._objectEach(serverData, function (value, key) { self._serverData[key] = AV._decode(value, key); }); // Refresh the attributes. this._rebuildAllEstimatedData(); // Clear out the cache of mutable containers. this._refreshCache(); this._opSetQueue = [{}]; this._hasData = hasData; }, /** * Applies the set of AV.Op in opSet to the object target. * @private */ _applyOpSet: function _applyOpSet(opSet, target) { var self = this; AV._objectEach(opSet, function (change, key) { var _findValue = findValue(target, key), _findValue2 = (0, _slicedToArray2.default)(_findValue, 3), value = _findValue2[0], actualTarget = _findValue2[1], actualKey = _findValue2[2]; setValue(target, key, change._estimate(value, self, key)); if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) { delete actualTarget[actualKey]; } }); }, /** * Replaces the cached value for key with the current value. * Returns true if the new value is different than the old value. * @private */ _resetCacheForKey: function _resetCacheForKey(key) { var value = this.attributes[key]; if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) { var json = (0, _stringify.default)(recursiveToPointer(value)); if (this._hashedJSON[key] !== json) { var wasSet = !!this._hashedJSON[key]; this._hashedJSON[key] = json; return wasSet; } } return false; }, /** * Populates attributes[key] by starting with the last known data from the * server, and applying all of the local changes that have been made to that * key since then. * @private */ _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) { var self = this; delete this.attributes[key]; if (this._serverData[key]) { this.attributes[key] = this._serverData[key]; } AV._arrayEach(this._opSetQueue, function (opSet) { var op = opSet[key]; if (op) { var _findValue3 = findValue(self.attributes, key), _findValue4 = (0, _slicedToArray2.default)(_findValue3, 4), value = _findValue4[0], actualTarget = _findValue4[1], actualKey = _findValue4[2], firstKey = _findValue4[3]; setValue(self.attributes, key, op._estimate(value, self, key)); if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) { delete actualTarget[actualKey]; } self._resetCacheForKey(firstKey); } }); }, /** * Populates attributes by starting with the last known data from the * server, and applying all of the local changes that have been made since * then. * @private */ _rebuildAllEstimatedData: function _rebuildAllEstimatedData() { var self = this; var previousAttributes = _.clone(this.attributes); this.attributes = _.clone(this._serverData); AV._arrayEach(this._opSetQueue, function (opSet) { self._applyOpSet(opSet, self.attributes); AV._objectEach(opSet, function (op, key) { self._resetCacheForKey(key); }); }); // Trigger change events for anything that changed because of the fetch. AV._objectEach(previousAttributes, function (oldValue, key) { if (self.attributes[key] !== oldValue) { self.trigger('change:' + key, self, self.attributes[key], {}); } }); AV._objectEach(this.attributes, function (newValue, key) { if (!_.has(previousAttributes, key)) { self.trigger('change:' + key, self, newValue, {}); } }); }, /** * Sets a hash of model attributes on the object, firing * "change" unless you choose to silence it. * *

You can call it with an object containing keys and values, or with one * key and value. For example:

* * @example * gameTurn.set({ * player: player1, * diceRoll: 2 * }); * * game.set("currentPlayer", player2); * * game.set("finished", true); * * @param {String} key The key to set. * @param {Any} value The value to give it. * @param {Object} [options] * @param {Boolean} [options.silent] * @return {AV.Object} self if succeeded, throws if the value is not valid. * @see AV.Object#validate */ set: function set(key, value, options) { var attrs; if (_.isObject(key) || isNullOrUndefined(key)) { attrs = _.mapObject(key, function (v, k) { checkReservedKey(k); return AV._decode(v, k); }); options = value; } else { attrs = {}; checkReservedKey(key); attrs[key] = AV._decode(value, key); } // Extract attributes and options. options = options || {}; if (!attrs) { return this; } if (attrs instanceof AV.Object) { attrs = attrs.attributes; } // If the unset option is used, every attribute should be a Unset. if (options.unset) { AV._objectEach(attrs, function (unused_value, key) { attrs[key] = new AV.Op.Unset(); }); } // Apply all the attributes to get the estimated values. var dataToValidate = _.clone(attrs); var self = this; AV._objectEach(dataToValidate, function (value, key) { if (value instanceof AV.Op) { dataToValidate[key] = value._estimate(self.attributes[key], self, key); if (dataToValidate[key] === AV.Op._UNSET) { delete dataToValidate[key]; } } }); // Run validation. this._validate(attrs, options); options.changes = {}; var escaped = this._escapedAttributes; // Update attributes. AV._arrayEach((0, _keys2.default)(_).call(_, attrs), function (attr) { var val = attrs[attr]; // If this is a relation object we need to set the parent correctly, // since the location where it was parsed does not have access to // this object. if (val instanceof AV.Relation) { val.parent = self; } if (!(val instanceof AV.Op)) { val = new AV.Op.Set(val); } // See if this change will actually have any effect. var isRealChange = true; if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) { isRealChange = false; } if (isRealChange) { delete escaped[attr]; if (options.silent) { self._silent[attr] = true; } else { options.changes[attr] = true; } } var currentChanges = _.last(self._opSetQueue); currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]); self._rebuildEstimatedDataForKey(attr); if (isRealChange) { self.changed[attr] = self.attributes[attr]; if (!options.silent) { self._pending[attr] = true; } } else { delete self.changed[attr]; delete self._pending[attr]; } }); if (!options.silent) { this.change(options); } return this; }, /** * Remove an attribute from the model, firing "change" unless * you choose to silence it. This is a noop if the attribute doesn't * exist. * @param key {String} The key. */ unset: function unset(attr, options) { options = options || {}; options.unset = true; return this.set(attr, null, options); }, /** * Atomically increments the value of the given attribute the next time the * object is saved. If no amount is specified, 1 is used by default. * * @param key {String} The key. * @param amount {Number} The amount to increment by. */ increment: function increment(attr, amount) { if (_.isUndefined(amount) || _.isNull(amount)) { amount = 1; } return this.set(attr, new AV.Op.Increment(amount)); }, /** * Atomically add an object to the end of the array associated with a given * key. * @param key {String} The key. * @param item {} The item to add. */ add: function add(attr, item) { return this.set(attr, new AV.Op.Add(ensureArray(item))); }, /** * Atomically add an object to the array associated with a given key, only * if it is not already present in the array. The position of the insert is * not guaranteed. * * @param key {String} The key. * @param item {} The object to add. */ addUnique: function addUnique(attr, item) { return this.set(attr, new AV.Op.AddUnique(ensureArray(item))); }, /** * Atomically remove all instances of an object from the array associated * with a given key. * * @param key {String} The key. * @param item {} The object to remove. */ remove: function remove(attr, item) { return this.set(attr, new AV.Op.Remove(ensureArray(item))); }, /** * Atomically apply a "bit and" operation on the value associated with a * given key. * * @param key {String} The key. * @param value {Number} The value to apply. */ bitAnd: function bitAnd(attr, value) { return this.set(attr, new AV.Op.BitAnd(value)); }, /** * Atomically apply a "bit or" operation on the value associated with a * given key. * * @param key {String} The key. * @param value {Number} The value to apply. */ bitOr: function bitOr(attr, value) { return this.set(attr, new AV.Op.BitOr(value)); }, /** * Atomically apply a "bit xor" operation on the value associated with a * given key. * * @param key {String} The key. * @param value {Number} The value to apply. */ bitXor: function bitXor(attr, value) { return this.set(attr, new AV.Op.BitXor(value)); }, /** * Returns an instance of a subclass of AV.Op describing what kind of * modification has been performed on this field since the last time it was * saved. For example, after calling object.increment("x"), calling * object.op("x") would return an instance of AV.Op.Increment. * * @param key {String} The key. * @returns {AV.Op} The operation, or undefined if none. */ op: function op(attr) { return _.last(this._opSetQueue)[attr]; }, /** * Clear all attributes on the model, firing "change" unless * you choose to silence it. */ clear: function clear(options) { options = options || {}; options.unset = true; var keysToClear = _.extend(this.attributes, this._operations); return this.set(keysToClear, options); }, /** * Clears any (or specific) changes to the model made since the last save. * @param {string|string[]} [keys] specify keys to revert. */ revert: function revert(keys) { var lastOp = _.last(this._opSetQueue); var _keys = ensureArray(keys || (0, _keys2.default)(_).call(_, lastOp)); _keys.forEach(function (key) { delete lastOp[key]; }); this._rebuildAllEstimatedData(); return this; }, /** * Returns a JSON-encoded set of operations to be sent with the next save * request. * @private */ _getSaveJSON: function _getSaveJSON() { var json = _.clone(_.first(this._opSetQueue)); AV._objectEach(json, function (op, key) { json[key] = op.toJSON(); }); return json; }, /** * Returns true if this object can be serialized for saving. * @private */ _canBeSerialized: function _canBeSerialized() { return AV.Object._canBeSerializedAsValue(this.attributes); }, /** * Fetch the model from the server. If the server's representation of the * model differs from its current attributes, they will be overriden, * triggering a "change" event. * @param {Object} fetchOptions Optional options to set 'keys', * 'include' and 'includeACL' option. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the fetch * completes. */ fetch: function fetch() { var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var options = arguments.length > 1 ? arguments[1] : undefined; if (!this.id) { throw new Error('Cannot fetch unsaved object'); } var self = this; var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options); return request.then(function (response) { var fetchedAttrs = self.parse(response); self._cleanupUnsetKeys(fetchedAttrs, (0, _keys2.default)(fetchOptions) ? ensureArray((0, _keys2.default)(fetchOptions)).join(',').split(',') : undefined); self._finishFetch(fetchedAttrs, true); return self; }); }, _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) { var _this2 = this; var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _keys2.default)(_).call(_, this._serverData); _.forEach(fetchedKeys, function (key) { if (fetchedAttrs[key] === undefined) delete _this2._serverData[key]; }); }, /** * Set a hash of model attributes, and save the model to the server. * updatedAt will be updated when the request returns. * You can either call it as:
     *   object.save();
* or
     *   object.save(null, options);
* or
     *   object.save(attrs, options);
* or
     *   object.save(key, value, options);
* * @example * gameTurn.save({ * player: "Jake Cutter", * diceRoll: 2 * }).then(function(gameTurnAgain) { * // The save was successful. * }, function(error) { * // The save failed. Error is an instance of AVError. * }); * * @param {AuthOptions} options AuthOptions plus: * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded * @param {AV.Query} options.query Save object only when it matches the query * @return {Promise} A promise that is fulfilled when the save * completes. * @see AVError */ save: function save(arg1, arg2, arg3) { var attrs, current, options; if (_.isObject(arg1) || isNullOrUndefined(arg1)) { attrs = arg1; options = arg2; } else { attrs = {}; attrs[arg1] = arg2; options = arg3; } options = _.clone(options) || {}; if (options.wait) { current = _.clone(this.attributes); } var setOptions = _.clone(options) || {}; if (setOptions.wait) { setOptions.silent = true; } if (attrs) { this.set(attrs, setOptions); } var model = this; var unsavedChildren = []; var unsavedFiles = []; AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles); if (unsavedChildren.length + unsavedFiles.length > 1) { return AV.Object._deepSaveAsync(this, model, options); } this._startSave(); this._saving = (this._saving || 0) + 1; this._allPreviousSaves = this._allPreviousSaves || _promise.default.resolve(); this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () { var method = model.id ? 'PUT' : 'POST'; var json = model._getSaveJSON(); var query = {}; if (model._fetchWhenSave || options.fetchWhenSave) { query['new'] = 'true'; } // user login option if (options._failOnNotExist) { query.failOnNotExist = 'true'; } if (options.query) { var queryParams; if (typeof options.query._getParams === 'function') { queryParams = options.query._getParams(); if (queryParams) { query.where = queryParams.where; } } if (!query.where) { var error = new Error('options.query is not an AV.Query'); throw error; } } _.extend(json, model._flags); var route = 'classes'; var className = model.className; if (model.className === '_User' && !model.id) { // Special-case user sign-up. route = 'users'; className = null; } //hook makeRequest in options. var makeRequest = options._makeRequest || _request; var requestPromise = makeRequest(route, className, model.id, method, json, options, query); requestPromise = requestPromise.then(function (resp) { var serverAttrs = model.parse(resp); if (options.wait) { serverAttrs = _.extend(attrs || {}, serverAttrs); } model._finishSave(serverAttrs); if (options.wait) { model.set(current, setOptions); } return model; }, function (error) { model._cancelSave(); throw error; }); return requestPromise; }); return this._allPreviousSaves; }, /** * Destroy this model on the server if it was already persisted. * Optimistically removes the model from its collection, if it has one. * @param {AuthOptions} options AuthOptions plus: * @param {Boolean} [options.wait] wait for the server to respond * before removal. * * @return {Promise} A promise that is fulfilled when the destroy * completes. */ destroy: function destroy(options) { options = options || {}; var model = this; var triggerDestroy = function triggerDestroy() { model.trigger('destroy', model, model.collection, options); }; if (!this.id) { return triggerDestroy(); } if (!options.wait) { triggerDestroy(); } var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options); return request.then(function () { if (options.wait) { triggerDestroy(); } return model; }); }, /** * Converts a response into the hash of attributes to be set on the model. * @ignore */ parse: function parse(resp) { var output = _.clone(resp); ['createdAt', 'updatedAt'].forEach(function (key) { if (output[key]) { output[key] = AV._parseDate(output[key]); } }); if (output.createdAt && !output.updatedAt) { output.updatedAt = output.createdAt; } return output; }, /** * Creates a new model with identical attributes to this one. * @return {AV.Object} */ clone: function clone() { return new this.constructor(this.attributes); }, /** * Returns true if this object has never been saved to AV. * @return {Boolean} */ isNew: function isNew() { return !this.id; }, /** * Call this method to manually fire a `"change"` event for this model and * a `"change:attribute"` event for each changed attribute. * Calling this will cause all objects observing the model to update. */ change: function change(options) { options = options || {}; var changing = this._changing; this._changing = true; // Silent changes become pending changes. var self = this; AV._objectEach(this._silent, function (attr) { self._pending[attr] = true; }); // Silent changes are triggered. var changes = _.extend({}, options.changes, this._silent); this._silent = {}; AV._objectEach(changes, function (unused_value, attr) { self.trigger('change:' + attr, self, self.get(attr), options); }); if (changing) { return this; } // This is to get around lint not letting us make a function in a loop. var deleteChanged = function deleteChanged(value, attr) { if (!self._pending[attr] && !self._silent[attr]) { delete self.changed[attr]; } }; // Continue firing `"change"` events while there are pending changes. while (!_.isEmpty(this._pending)) { this._pending = {}; this.trigger('change', this, options); // Pending and silent changes still remain. AV._objectEach(this.changed, deleteChanged); self._previousAttributes = _.clone(this.attributes); } this._changing = false; return this; }, /** * Gets the previous value of an attribute, recorded at the time the last * "change" event was fired. * @param {String} attr Name of the attribute to get. */ previous: function previous(attr) { if (!arguments.length || !this._previousAttributes) { return null; } return this._previousAttributes[attr]; }, /** * Gets all of the attributes of the model at the time of the previous * "change" event. * @return {Object} */ previousAttributes: function previousAttributes() { return _.clone(this._previousAttributes); }, /** * Checks if the model is currently in a valid state. It's only possible to * get into an *invalid* state if you're using silent changes. * @return {Boolean} */ isValid: function isValid() { try { this.validate(this.attributes); } catch (error) { return false; } return true; }, /** * You should not call this function directly unless you subclass * AV.Object, in which case you can override this method * to provide additional validation on set and * save. Your implementation should throw an Error if * the attrs is invalid * * @param {Object} attrs The current data to validate. * @see AV.Object#set */ validate: function validate(attrs) { if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) { throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.'); } }, /** * Run validation against a set of incoming attributes, returning `true` * if all is well. If a specific `error` callback has been passed, * call that instead of firing the general `"error"` event. * @private */ _validate: function _validate(attrs, options) { if (options.silent || !this.validate) { return; } attrs = _.extend({}, this.attributes, attrs); this.validate(attrs); }, /** * Returns the ACL for this object. * @returns {AV.ACL} An instance of AV.ACL. * @see AV.Object#get */ getACL: function getACL() { return this.get('ACL'); }, /** * Sets the ACL to be used for this object. * @param {AV.ACL} acl An instance of AV.ACL. * @param {Object} options Optional Backbone-like options object to be * passed in to set. * @return {AV.Object} self * @see AV.Object#set */ setACL: function setACL(acl, options) { return this.set('ACL', acl, options); }, disableBeforeHook: function disableBeforeHook() { this.ignoreHook('beforeSave'); this.ignoreHook('beforeUpdate'); this.ignoreHook('beforeDelete'); }, disableAfterHook: function disableAfterHook() { this.ignoreHook('afterSave'); this.ignoreHook('afterUpdate'); this.ignoreHook('afterDelete'); }, ignoreHook: function ignoreHook(hookName) { if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) { throw new Error('Unsupported hookName: ' + hookName); } if (!AV.hookKey) { throw new Error('ignoreHook required hookKey'); } if (!this._flags.__ignore_hooks) { this._flags.__ignore_hooks = []; } this._flags.__ignore_hooks.push(hookName); } }); /** * Creates an instance of a subclass of AV.Object for the give classname * and id. * @param {String|Function} class the className or a subclass of AV.Object. * @param {String} id The object id of this model. * @return {AV.Object} A new subclass instance of AV.Object. */ AV.Object.createWithoutData = function (klass, id, hasData) { var _klass; if (_.isString(klass)) { _klass = AV.Object._getSubclass(klass); } else if (klass.prototype && klass.prototype instanceof AV.Object) { _klass = klass; } else { throw new Error('class must be a string or a subclass of AV.Object.'); } if (!id) { throw new TypeError('The objectId must be provided'); } var object = new _klass(); object.id = id; object._hasData = hasData; return object; }; /** * Delete objects in batch. * @param {AV.Object[]} objects The AV.Object array to be deleted. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the save * completes. */ AV.Object.destroyAll = function (objects) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!objects || objects.length === 0) { return _promise.default.resolve(); } var objectsByClassNameAndFlags = _.groupBy(objects, function (object) { return (0, _stringify.default)({ className: object.className, flags: object._flags }); }); var body = { requests: (0, _map.default)(_).call(_, objectsByClassNameAndFlags, function (objects) { var _context3; var ids = (0, _map.default)(_).call(_, objects, 'id').join(','); return { method: 'DELETE', path: (0, _concat.default)(_context3 = "/1.1/classes/".concat(objects[0].className, "/")).call(_context3, ids), body: objects[0]._flags }; }) }; return _request('batch', null, null, 'POST', body, options).then(function (response) { var firstError = (0, _find.default)(_).call(_, response, function (result) { return !result.success; }); if (firstError) throw new AVError(firstError.error.code, firstError.error.error); return undefined; }); }; /** * Returns the appropriate subclass for making new instances of the given * className string. * @private */ AV.Object._getSubclass = function (className) { if (!_.isString(className)) { throw new Error('AV.Object._getSubclass requires a string argument.'); } var ObjectClass = AV.Object._classMap[className]; if (!ObjectClass) { ObjectClass = AV.Object.extend(className); AV.Object._classMap[className] = ObjectClass; } return ObjectClass; }; /** * Creates an instance of a subclass of AV.Object for the given classname. * @private */ AV.Object._create = function (className, attributes, options) { var ObjectClass = AV.Object._getSubclass(className); return new ObjectClass(attributes, options); }; // Set up a map of className to class so that we can create new instances of // AV Objects from JSON automatically. AV.Object._classMap = {}; AV.Object._extend = AV._extend; /** * Creates a new model with defined attributes, * It's the same with *
   *   new AV.Object(attributes, options);
   *  
* @param {Object} attributes The initial set of data to store in the object. * @param {Object} options A set of Backbone-like options for creating the * object. The only option currently supported is "collection". * @return {AV.Object} * @since v0.4.4 * @see AV.Object * @see AV.Object.extend */ AV.Object['new'] = function (attributes, options) { return new AV.Object(attributes, options); }; /** * Creates a new subclass of AV.Object for the given AV class name. * *

Every extension of a AV class will inherit from the most recent * previous extension of that class. When a AV.Object is automatically * created by parsing JSON, it will use the most recent extension of that * class.

* * @example * var MyClass = AV.Object.extend("MyClass", { * // Instance properties * }, { * // Class properties * }); * * @param {String} className The name of the AV class backing this model. * @param {Object} protoProps Instance properties to add to instances of the * class returned from this method. * @param {Object} classProps Class properties to add the class returned from * this method. * @return {Class} A new subclass of AV.Object. */ AV.Object.extend = function (className, protoProps, classProps) { // Handle the case with only two args. if (!_.isString(className)) { if (className && _.has(className, 'className')) { return AV.Object.extend(className.className, className, protoProps); } else { throw new Error("AV.Object.extend's first argument should be the className."); } } // If someone tries to subclass "User", coerce it to the right type. if (className === 'User') { className = '_User'; } var NewClassObject = null; if (_.has(AV.Object._classMap, className)) { var OldClassObject = AV.Object._classMap[className]; // This new subclass has been told to extend both from "this" and from // OldClassObject. This is multiple inheritance, which isn't supported. // For now, let's just pick one. if (protoProps || classProps) { NewClassObject = OldClassObject._extend(protoProps, classProps); } else { return OldClassObject; } } else { protoProps = protoProps || {}; protoProps._className = className; NewClassObject = this._extend(protoProps, classProps); } // Extending a subclass should reuse the classname automatically. NewClassObject.extend = function (arg0) { var _context4; if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) { return AV.Object.extend.apply(NewClassObject, arguments); } var newArguments = (0, _concat.default)(_context4 = [className]).call(_context4, _.toArray(arguments)); return AV.Object.extend.apply(NewClassObject, newArguments); }; // Add the query property descriptor. (0, _defineProperty.default)(NewClassObject, 'query', (0, _getOwnPropertyDescriptor.default)(AV.Object, 'query')); NewClassObject['new'] = function (attributes, options) { return new NewClassObject(attributes, options); }; AV.Object._classMap[className] = NewClassObject; return NewClassObject; }; // ES6 class syntax support (0, _defineProperty.default)(AV.Object.prototype, 'className', { get: function get() { var className = this._className || this.constructor._LCClassName || this.constructor.name; // If someone tries to subclass "User", coerce it to the right type. if (className === 'User') { return '_User'; } return className; } }); /** * Register a class. * If a subclass of AV.Object is defined with your own implement * rather then AV.Object.extend, the subclass must be registered. * @param {Function} klass A subclass of AV.Object * @param {String} [name] Specify the name of the class. Useful when the class might be uglified. * @example * class Person extend AV.Object {} * AV.Object.register(Person); */ AV.Object.register = function (klass, name) { if (!(klass.prototype instanceof AV.Object)) { throw new Error('registered class is not a subclass of AV.Object'); } var className = name || klass.name; if (!className.length) { throw new Error('registered class must be named'); } if (name) { klass._LCClassName = name; } AV.Object._classMap[className] = klass; }; /** * Get a new Query of the current class * @name query * @memberof AV.Object * @type AV.Query * @readonly * @since v3.1.0 * @example * const Post = AV.Object.extend('Post'); * Post.query.equalTo('author', 'leancloud').find().then(); */ (0, _defineProperty.default)(AV.Object, 'query', { get: function get() { return new AV.Query(this.prototype.className); } }); AV.Object._findUnsavedChildren = function (objects, children, files) { AV._traverse(objects, function (object) { if (object instanceof AV.Object) { if (object.dirty()) { children.push(object); } return; } if (object instanceof AV.File) { if (!object.id) { files.push(object); } return; } }); }; AV.Object._canBeSerializedAsValue = function (object) { var canBeSerializedAsValue = true; if (object instanceof AV.Object || object instanceof AV.File) { canBeSerializedAsValue = !!object.id; } else if (_.isArray(object)) { AV._arrayEach(object, function (child) { if (!AV.Object._canBeSerializedAsValue(child)) { canBeSerializedAsValue = false; } }); } else if (_.isObject(object)) { AV._objectEach(object, function (child) { if (!AV.Object._canBeSerializedAsValue(child)) { canBeSerializedAsValue = false; } }); } return canBeSerializedAsValue; }; AV.Object._deepSaveAsync = function (object, model, options) { var unsavedChildren = []; var unsavedFiles = []; AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles); unsavedFiles = _.uniq(unsavedFiles); var promise = _promise.default.resolve(); _.each(unsavedFiles, function (file) { promise = promise.then(function () { return file.save(); }); }); var objects = _.uniq(unsavedChildren); var remaining = _.uniq(objects); return promise.then(function () { return continueWhile(function () { return remaining.length > 0; }, function () { // Gather up all the objects that can be saved in this batch. var batch = []; var newRemaining = []; AV._arrayEach(remaining, function (object) { if (object._canBeSerialized()) { batch.push(object); } else { newRemaining.push(object); } }); remaining = newRemaining; // If we can't save any objects, there must be a circular reference. if (batch.length === 0) { return _promise.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.')); } // Reserve a spot in every object's save queue. var readyToStart = _promise.default.resolve((0, _map.default)(_).call(_, batch, function (object) { return object._allPreviousSaves || _promise.default.resolve(); })); // Save a single batch, whether previous saves succeeded or failed. var bathSavePromise = readyToStart.then(function () { return _request('batch', null, null, 'POST', { requests: (0, _map.default)(_).call(_, batch, function (object) { var method = object.id ? 'PUT' : 'POST'; var json = object._getSaveJSON(); _.extend(json, object._flags); var route = 'classes'; var className = object.className; var path = "/".concat(route, "/").concat(className); if (object.className === '_User' && !object.id) { // Special-case user sign-up. path = '/users'; } var path = "/1.1".concat(path); if (object.id) { path = path + '/' + object.id; } object._startSave(); return { method: method, path: path, body: json, params: options && options.fetchWhenSave ? { fetchWhenSave: true } : undefined }; }) }, options).then(function (response) { var results = (0, _map.default)(_).call(_, batch, function (object, i) { if (response[i].success) { object._finishSave(object.parse(response[i].success)); return object; } object._cancelSave(); return new AVError(response[i].error.code, response[i].error.error); }); return handleBatchResults(results); }); }); AV._arrayEach(batch, function (object) { object._allPreviousSaves = bathSavePromise; }); return bathSavePromise; }); }).then(function () { return object; }); }; }; /***/ }), /* 531 */ /***/ (function(module, exports, __webpack_require__) { var arrayWithHoles = __webpack_require__(532); var iterableToArrayLimit = __webpack_require__(540); var unsupportedIterableToArray = __webpack_require__(541); var nonIterableRest = __webpack_require__(551); function _slicedToArray(arr, i) { return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); } module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 532 */ /***/ (function(module, exports, __webpack_require__) { var _Array$isArray = __webpack_require__(533); function _arrayWithHoles(arr) { if (_Array$isArray(arr)) return arr; } module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 533 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(534); /***/ }), /* 534 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(535); /***/ }), /* 535 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(536); module.exports = parent; /***/ }), /* 536 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(537); module.exports = parent; /***/ }), /* 537 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(538); module.exports = parent; /***/ }), /* 538 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(539); var path = __webpack_require__(5); module.exports = path.Array.isArray; /***/ }), /* 539 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var isArray = __webpack_require__(90); // `Array.isArray` method // https://tc39.es/ecma262/#sec-array.isarray $({ target: 'Array', stat: true }, { isArray: isArray }); /***/ }), /* 540 */ /***/ (function(module, exports, __webpack_require__) { var _Symbol = __webpack_require__(242); var _getIteratorMethod = __webpack_require__(254); function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 541 */ /***/ (function(module, exports, __webpack_require__) { var _sliceInstanceProperty = __webpack_require__(542); var _Array$from = __webpack_require__(546); var arrayLikeToArray = __webpack_require__(550); function _unsupportedIterableToArray(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); } module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 542 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(543); /***/ }), /* 543 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(544); /***/ }), /* 544 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(545); module.exports = parent; /***/ }), /* 545 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(240); module.exports = parent; /***/ }), /* 546 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(547); /***/ }), /* 547 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(548); /***/ }), /* 548 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(549); module.exports = parent; /***/ }), /* 549 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(253); module.exports = parent; /***/ }), /* 550 */ /***/ (function(module, exports) { function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 551 */ /***/ (function(module, exports) { function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 552 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(553); module.exports = parent; /***/ }), /* 553 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(554); var path = __webpack_require__(5); var Object = path.Object; var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) { return Object.getOwnPropertyDescriptor(it, key); }; if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true; /***/ }), /* 554 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var fails = __webpack_require__(2); var toIndexedObject = __webpack_require__(32); var nativeGetOwnPropertyDescriptor = __webpack_require__(62).f; var DESCRIPTORS = __webpack_require__(14); var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); }); var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor $({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key); } }); /***/ }), /* 555 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(3); var AVError = __webpack_require__(46); module.exports = function (AV) { AV.Role = AV.Object.extend('_Role', /** @lends AV.Role.prototype */ { // Instance Methods /** * Represents a Role on the AV server. Roles represent groupings of * Users for the purposes of granting permissions (e.g. specifying an ACL * for an Object). Roles are specified by their sets of child users and * child roles, all of which are granted any permissions that the parent * role has. * *

Roles must have a name (which cannot be changed after creation of the * role), and must specify an ACL.

* An AV.Role is a local representation of a role persisted to the AV * cloud. * @class AV.Role * @param {String} name The name of the Role to create. * @param {AV.ACL} acl The ACL for this role. */ constructor: function constructor(name, acl) { if (_.isString(name)) { AV.Object.prototype.constructor.call(this, null, null); this.setName(name); } else { AV.Object.prototype.constructor.call(this, name, acl); } if (acl) { if (!(acl instanceof AV.ACL)) { throw new TypeError('acl must be an instance of AV.ACL'); } else { this.setACL(acl); } } }, /** * Gets the name of the role. You can alternatively call role.get("name") * * @return {String} the name of the role. */ getName: function getName() { return this.get('name'); }, /** * Sets the name for a role. This value must be set before the role has * been saved to the server, and cannot be set once the role has been * saved. * *

* A role's name can only contain alphanumeric characters, _, -, and * spaces. *

* *

This is equivalent to calling role.set("name", name)

* * @param {String} name The name of the role. */ setName: function setName(name, options) { return this.set('name', name, options); }, /** * Gets the AV.Relation for the AV.Users that are direct * children of this role. These users are granted any privileges that this * role has been granted (e.g. read or write access through ACLs). You can * add or remove users from the role through this relation. * *

This is equivalent to calling role.relation("users")

* * @return {AV.Relation} the relation for the users belonging to this * role. */ getUsers: function getUsers() { return this.relation('users'); }, /** * Gets the AV.Relation for the AV.Roles that are direct * children of this role. These roles' users are granted any privileges that * this role has been granted (e.g. read or write access through ACLs). You * can add or remove child roles from this role through this relation. * *

This is equivalent to calling role.relation("roles")

* * @return {AV.Relation} the relation for the roles belonging to this * role. */ getRoles: function getRoles() { return this.relation('roles'); }, /** * @ignore */ validate: function validate(attrs, options) { if ('name' in attrs && attrs.name !== this.getName()) { var newName = attrs.name; if (this.id && this.id !== attrs.objectId) { // Check to see if the objectId being set matches this.id. // This happens during a fetch -- the id is set before calling fetch. // Let the name be set in this case. return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved."); } if (!_.isString(newName)) { return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String."); } if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) { return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.'); } } if (AV.Object.prototype.validate) { return AV.Object.prototype.validate.call(this, attrs, options); } return false; } }); }; /***/ }), /* 556 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _defineProperty2 = _interopRequireDefault(__webpack_require__(557)); var _promise = _interopRequireDefault(__webpack_require__(12)); var _map = _interopRequireDefault(__webpack_require__(35)); var _find = _interopRequireDefault(__webpack_require__(93)); var _stringify = _interopRequireDefault(__webpack_require__(36)); var _ = __webpack_require__(3); var uuid = __webpack_require__(232); var AVError = __webpack_require__(46); var _require = __webpack_require__(27), AVRequest = _require._request, request = _require.request; var _require2 = __webpack_require__(72), getAdapter = _require2.getAdapter; var PLATFORM_ANONYMOUS = 'anonymous'; var PLATFORM_QQAPP = 'lc_qqapp'; var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() { var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin'; return function (authData, unionId) { var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, _ref$unionIdPlatform = _ref.unionIdPlatform, unionIdPlatform = _ref$unionIdPlatform === void 0 ? defaultUnionIdPlatform : _ref$unionIdPlatform, _ref$asMainAccount = _ref.asMainAccount, asMainAccount = _ref$asMainAccount === void 0 ? false : _ref$asMainAccount; if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string'); if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string'); return _.extend({}, authData, { platform: unionIdPlatform, unionid: unionId, main_account: Boolean(asMainAccount) }); }; }; module.exports = function (AV) { /** * @class * *

An AV.User object is a local representation of a user persisted to the * LeanCloud server. This class is a subclass of an AV.Object, and retains the * same functionality of an AV.Object, but also extends it with various * user specific methods, like authentication, signing up, and validation of * uniqueness.

*/ AV.User = AV.Object.extend('_User', /** @lends AV.User.prototype */ { // Instance Variables _isCurrentUser: false, // Instance Methods /** * Internal method to handle special fields in a _User response. * @private */ _mergeMagicFields: function _mergeMagicFields(attrs) { if (attrs.sessionToken) { this._sessionToken = attrs.sessionToken; delete attrs.sessionToken; } return AV.User.__super__._mergeMagicFields.call(this, attrs); }, /** * Removes null values from authData (which exist temporarily for * unlinking) * @private */ _cleanupAuthData: function _cleanupAuthData() { if (!this.isCurrent()) { return; } var authData = this.get('authData'); if (!authData) { return; } AV._objectEach(this.get('authData'), function (value, key) { if (!authData[key]) { delete authData[key]; } }); }, /** * Synchronizes authData for all providers. * @private */ _synchronizeAllAuthData: function _synchronizeAllAuthData() { var authData = this.get('authData'); if (!authData) { return; } var self = this; AV._objectEach(this.get('authData'), function (value, key) { self._synchronizeAuthData(key); }); }, /** * Synchronizes auth data for a provider (e.g. puts the access token in the * right place to be used by the Facebook SDK). * @private */ _synchronizeAuthData: function _synchronizeAuthData(provider) { if (!this.isCurrent()) { return; } var authType; if (_.isString(provider)) { authType = provider; provider = AV.User._authProviders[authType]; } else { authType = provider.getAuthType(); } var authData = this.get('authData'); if (!authData || !provider) { return; } var success = provider.restoreAuthentication(authData[authType]); if (!success) { this.dissociateAuthData(provider); } }, _handleSaveResult: function _handleSaveResult(makeCurrent) { // Clean up and synchronize the authData object, removing any unset values if (makeCurrent && !AV._config.disableCurrentUser) { this._isCurrentUser = true; } this._cleanupAuthData(); this._synchronizeAllAuthData(); // Don't keep the password around. delete this._serverData.password; this._rebuildEstimatedDataForKey('password'); this._refreshCache(); if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) { // Some old version of leanengine-node-sdk will overwrite // AV.User._saveCurrentUser which returns no Promise. // So we need a Promise wrapper. return _promise.default.resolve(AV.User._saveCurrentUser(this)); } else { return _promise.default.resolve(); } }, /** * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can * call linkWith on the user (even if it doesn't exist yet on the server). * @private */ _linkWith: function _linkWith(provider, data) { var _this = this; var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, _ref2$failOnNotExist = _ref2.failOnNotExist, failOnNotExist = _ref2$failOnNotExist === void 0 ? false : _ref2$failOnNotExist; var authType; if (_.isString(provider)) { authType = provider; provider = AV.User._authProviders[provider]; } else { authType = provider.getAuthType(); } if (data) { return this.save({ authData: (0, _defineProperty2.default)({}, authType, data) }, { fetchWhenSave: !!this.get('authData'), _failOnNotExist: failOnNotExist }).then(function (model) { return model._handleSaveResult(true).then(function () { return model; }); }); } else { return provider.authenticate().then(function (result) { return _this._linkWith(provider, result); }); } }, /** * Associate the user with a third party authData. * @since 3.3.0 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 } * @param {string} platform Available platform for sign up. * @return {Promise} A promise that is fulfilled with the user when completed. * @example user.associateWithAuthData({ * openid: 'abc123', * access_token: '123abc', * expires_in: 1382686496 * }, 'weixin').then(function(user) { * //Access user here * }).catch(function(error) { * //console.error("error: ", error); * }); */ associateWithAuthData: function associateWithAuthData(authData, platform) { return this._linkWith(platform, authData); }, /** * Associate the user with a third party authData and unionId. * @since 3.5.0 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 } * @param {string} platform Available platform for sign up. * @param {string} unionId * @param {Object} [unionLoginOptions] * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user. * @return {Promise} A promise that is fulfilled with the user when completed. * @example user.associateWithAuthDataAndUnionId({ * openid: 'abc123', * access_token: '123abc', * expires_in: 1382686496 * }, 'weixin', 'union123', { * unionIdPlatform: 'weixin', * asMainAccount: true, * }).then(function(user) { * //Access user here * }).catch(function(error) { * //console.error("error: ", error); * }); */ associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) { return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions)); }, /** * Associate the user with the identity of the current mini-app. * @since 4.6.0 * @param {Object} [authInfo] * @param {Object} [option] * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists. * @return {Promise} */ associateWithMiniApp: function associateWithMiniApp(authInfo, option) { var _this2 = this; if (authInfo === undefined) { var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo().then(function (authInfo) { return _this2._linkWith(authInfo.provider, authInfo.authData, option); }); } return this._linkWith(authInfo.provider, authInfo.authData, option); }, /** * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。 * 仅在 QQ 小程序中可用。 * * @deprecated Please use {@link AV.User#associateWithMiniApp} * @since 4.2.0 * @param {Object} [options] * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user. * @return {Promise} */ associateWithQQApp: function associateWithQQApp() { var _this3 = this; var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref3$preferUnionId = _ref3.preferUnionId, preferUnionId = _ref3$preferUnionId === void 0 ? false : _ref3$preferUnionId, _ref3$unionIdPlatform = _ref3.unionIdPlatform, unionIdPlatform = _ref3$unionIdPlatform === void 0 ? 'qq' : _ref3$unionIdPlatform, _ref3$asMainAccount = _ref3.asMainAccount, asMainAccount = _ref3$asMainAccount === void 0 ? true : _ref3$asMainAccount; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ preferUnionId: preferUnionId, asMainAccount: asMainAccount, platform: unionIdPlatform }).then(function (authInfo) { authInfo.provider = PLATFORM_QQAPP; return _this3.associateWithMiniApp(authInfo); }); }, /** * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。 * 仅在微信小程序中可用。 * * @deprecated Please use {@link AV.User#associateWithMiniApp} * @since 3.13.0 * @param {Object} [options] * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user. * @return {Promise} */ associateWithWeapp: function associateWithWeapp() { var _this4 = this; var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref4$preferUnionId = _ref4.preferUnionId, preferUnionId = _ref4$preferUnionId === void 0 ? false : _ref4$preferUnionId, _ref4$unionIdPlatform = _ref4.unionIdPlatform, unionIdPlatform = _ref4$unionIdPlatform === void 0 ? 'weixin' : _ref4$unionIdPlatform, _ref4$asMainAccount = _ref4.asMainAccount, asMainAccount = _ref4$asMainAccount === void 0 ? true : _ref4$asMainAccount; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ preferUnionId: preferUnionId, asMainAccount: asMainAccount, platform: unionIdPlatform }).then(function (authInfo) { return _this4.associateWithMiniApp(authInfo); }); }, /** * @deprecated renamed to {@link AV.User#associateWithWeapp} * @return {Promise} */ linkWithWeapp: function linkWithWeapp(options) { console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替'); return this.associateWithWeapp(options); }, /** * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。 * 仅在 QQ 小程序中可用。 * * @deprecated Please use {@link AV.User#associateWithMiniApp} * @since 4.2.0 * @param {string} unionId * @param {Object} [unionOptions] * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user. * @return {Promise} */ associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) { var _this5 = this; var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref5$unionIdPlatform = _ref5.unionIdPlatform, unionIdPlatform = _ref5$unionIdPlatform === void 0 ? 'qq' : _ref5$unionIdPlatform, _ref5$asMainAccount = _ref5.asMainAccount, asMainAccount = _ref5$asMainAccount === void 0 ? false : _ref5$asMainAccount; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) { authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount }); authInfo.provider = PLATFORM_QQAPP; return _this5.associateWithMiniApp(authInfo); }); }, /** * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。 * 仅在微信小程序中可用。 * * @deprecated Please use {@link AV.User#associateWithMiniApp} * @since 3.13.0 * @param {string} unionId * @param {Object} [unionOptions] * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user. * @return {Promise} */ associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) { var _this6 = this; var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref6$unionIdPlatform = _ref6.unionIdPlatform, unionIdPlatform = _ref6$unionIdPlatform === void 0 ? 'weixin' : _ref6$unionIdPlatform, _ref6$asMainAccount = _ref6.asMainAccount, asMainAccount = _ref6$asMainAccount === void 0 ? false : _ref6$asMainAccount; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) { authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount }); return _this6.associateWithMiniApp(authInfo); }); }, /** * Unlinks a user from a service. * @param {string} platform * @return {Promise} * @since 3.3.0 */ dissociateAuthData: function dissociateAuthData(provider) { this.unset("authData.".concat(provider)); return this.save().then(function (model) { return model._handleSaveResult(true).then(function () { return model; }); }); }, /** * @private * @deprecated */ _unlinkFrom: function _unlinkFrom(provider) { console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替'); return this.dissociateAuthData(provider); }, /** * Checks whether a user is linked to a service. * @private */ _isLinked: function _isLinked(provider) { var authType; if (_.isString(provider)) { authType = provider; } else { authType = provider.getAuthType(); } var authData = this.get('authData') || {}; return !!authData[authType]; }, /** * Checks whether a user is anonymous. * @since 3.9.0 * @return {boolean} */ isAnonymous: function isAnonymous() { return this._isLinked(PLATFORM_ANONYMOUS); }, logOut: function logOut() { this._logOutWithAll(); this._isCurrentUser = false; }, /** * Deauthenticates all providers. * @private */ _logOutWithAll: function _logOutWithAll() { var authData = this.get('authData'); if (!authData) { return; } var self = this; AV._objectEach(this.get('authData'), function (value, key) { self._logOutWith(key); }); }, /** * Deauthenticates a single provider (e.g. removing access tokens from the * Facebook SDK). * @private */ _logOutWith: function _logOutWith(provider) { if (!this.isCurrent()) { return; } if (_.isString(provider)) { provider = AV.User._authProviders[provider]; } if (provider && provider.deauthenticate) { provider.deauthenticate(); } }, /** * Signs up a new user. You should call this instead of save for * new AV.Users. This will create a new AV.User on the server, and * also persist the session on disk so that you can access the user using * current. * *

A username and password must be set before calling signUp.

* * @param {Object} attrs Extra fields to set on the new user, or null. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the signup * finishes. * @see AV.User.signUp */ signUp: function signUp(attrs, options) { var error; var username = attrs && attrs.username || this.get('username'); if (!username || username === '') { error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.'); throw error; } var password = attrs && attrs.password || this.get('password'); if (!password || password === '') { error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.'); throw error; } return this.save(attrs, options).then(function (model) { if (model.isAnonymous()) { model.unset("authData.".concat(PLATFORM_ANONYMOUS)); model._opSetQueue = [{}]; } return model._handleSaveResult(true).then(function () { return model; }); }); }, /** * Signs up a new user with mobile phone and sms code. * You should call this instead of save for * new AV.Users. This will create a new AV.User on the server, and * also persist the session on disk so that you can access the user using * current. * *

A username and password must be set before calling signUp.

* * @param {Object} attrs Extra fields to set on the new user, or null. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the signup * finishes. * @see AV.User.signUpOrlogInWithMobilePhone * @see AV.Cloud.requestSmsCode */ signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var error; var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber'); if (!mobilePhoneNumber || mobilePhoneNumber === '') { error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.'); throw error; } var smsCode = attrs && attrs.smsCode || this.get('smsCode'); if (!smsCode || smsCode === '') { error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.'); throw error; } options._makeRequest = function (route, className, id, method, json) { return AVRequest('usersByMobilePhone', null, null, 'POST', json); }; return this.save(attrs, options).then(function (model) { delete model.attributes.smsCode; delete model._serverData.smsCode; return model._handleSaveResult(true).then(function () { return model; }); }); }, /** * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login. * @since 3.7.0 */ loginWithAuthData: function loginWithAuthData(authData, platform, options) { return this._linkWith(platform, authData, options); }, /** * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login. * @since 3.7.0 */ loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) { return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions); }, /** * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login. * @deprecated please use {@link AV.User#loginWithMiniApp} * @since 3.7.0 * @param {Object} [options] * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0) * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user. * @return {Promise} */ loginWithWeapp: function loginWithWeapp() { var _this7 = this; var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref7$preferUnionId = _ref7.preferUnionId, preferUnionId = _ref7$preferUnionId === void 0 ? false : _ref7$preferUnionId, _ref7$unionIdPlatform = _ref7.unionIdPlatform, unionIdPlatform = _ref7$unionIdPlatform === void 0 ? 'weixin' : _ref7$unionIdPlatform, _ref7$asMainAccount = _ref7.asMainAccount, asMainAccount = _ref7$asMainAccount === void 0 ? true : _ref7$asMainAccount, _ref7$failOnNotExist = _ref7.failOnNotExist, failOnNotExist = _ref7$failOnNotExist === void 0 ? false : _ref7$failOnNotExist; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ preferUnionId: preferUnionId, asMainAccount: asMainAccount, platform: unionIdPlatform }).then(function (authInfo) { return _this7.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist }); }); }, /** * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login. * @deprecated please use {@link AV.User#loginWithMiniApp} * @since 3.13.0 */ loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) { var _this8 = this; var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref8$unionIdPlatform = _ref8.unionIdPlatform, unionIdPlatform = _ref8$unionIdPlatform === void 0 ? 'weixin' : _ref8$unionIdPlatform, _ref8$asMainAccount = _ref8.asMainAccount, asMainAccount = _ref8$asMainAccount === void 0 ? false : _ref8$asMainAccount, _ref8$failOnNotExist = _ref8.failOnNotExist, failOnNotExist = _ref8$failOnNotExist === void 0 ? false : _ref8$failOnNotExist; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) { authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount }); return _this8.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist }); }); }, /** * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login. * @deprecated please use {@link AV.User#loginWithMiniApp} * @since 4.2.0 * @param {Object} [options] * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user. */ loginWithQQApp: function loginWithQQApp() { var _this9 = this; var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref9$preferUnionId = _ref9.preferUnionId, preferUnionId = _ref9$preferUnionId === void 0 ? false : _ref9$preferUnionId, _ref9$unionIdPlatform = _ref9.unionIdPlatform, unionIdPlatform = _ref9$unionIdPlatform === void 0 ? 'qq' : _ref9$unionIdPlatform, _ref9$asMainAccount = _ref9.asMainAccount, asMainAccount = _ref9$asMainAccount === void 0 ? true : _ref9$asMainAccount, _ref9$failOnNotExist = _ref9.failOnNotExist, failOnNotExist = _ref9$failOnNotExist === void 0 ? false : _ref9$failOnNotExist; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ preferUnionId: preferUnionId, asMainAccount: asMainAccount, platform: unionIdPlatform }).then(function (authInfo) { authInfo.provider = PLATFORM_QQAPP; return _this9.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist }); }); }, /** * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login. * @deprecated please use {@link AV.User#loginWithMiniApp} * @since 4.2.0 */ loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) { var _this10 = this; var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref10$unionIdPlatfor = _ref10.unionIdPlatform, unionIdPlatform = _ref10$unionIdPlatfor === void 0 ? 'qq' : _ref10$unionIdPlatfor, _ref10$asMainAccount = _ref10.asMainAccount, asMainAccount = _ref10$asMainAccount === void 0 ? false : _ref10$asMainAccount, _ref10$failOnNotExist = _ref10.failOnNotExist, failOnNotExist = _ref10$failOnNotExist === void 0 ? false : _ref10$failOnNotExist; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) { authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount }); authInfo.provider = PLATFORM_QQAPP; return _this10.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist }); }); }, /** * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login. * @since 4.6.0 */ loginWithMiniApp: function loginWithMiniApp(authInfo, option) { var _this11 = this; if (authInfo === undefined) { var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo().then(function (authInfo) { return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option); }); } return this.loginWithAuthData(authInfo.authData, authInfo.provider, option); }, /** * Logs in a AV.User. On success, this saves the session to localStorage, * so you can retrieve the currently logged in user using * current. * *

A username and password must be set before calling logIn.

* * @see AV.User.logIn * @return {Promise} A promise that is fulfilled with the user when * the login is complete. */ logIn: function logIn() { var model = this; var request = AVRequest('login', null, null, 'POST', this.toJSON()); return request.then(function (resp) { var serverAttrs = model.parse(resp); model._finishFetch(serverAttrs); return model._handleSaveResult(true).then(function () { if (!serverAttrs.smsCode) delete model.attributes['smsCode']; return model; }); }); }, /** * @see AV.Object#save */ save: function save(arg1, arg2, arg3) { var attrs, options; if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) { attrs = arg1; options = arg2; } else { attrs = {}; attrs[arg1] = arg2; options = arg3; } options = options || {}; return AV.Object.prototype.save.call(this, attrs, options).then(function (model) { return model._handleSaveResult(false).then(function () { return model; }); }); }, /** * Follow a user * @since 0.3.0 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user. * @param {AV.User | String} options.user The target user or user's objectId to follow. * @param {Object} [options.attributes] key-value attributes dictionary to be used as * conditions of followerQuery/followeeQuery. * @param {AuthOptions} [authOptions] */ follow: function follow(options, authOptions) { if (!this.id) { throw new Error('Please signin.'); } var user; var attributes; if (options.user) { user = options.user; attributes = options.attributes; } else { user = options; } var userObjectId = _.isString(user) ? user : user.id; if (!userObjectId) { throw new Error('Invalid target user.'); } var route = 'users/' + this.id + '/friendship/' + userObjectId; var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions); return request; }, /** * Unfollow a user. * @since 0.3.0 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user. * @param {AV.User | String} options.user The target user or user's objectId to unfollow. * @param {AuthOptions} [authOptions] */ unfollow: function unfollow(options, authOptions) { if (!this.id) { throw new Error('Please signin.'); } var user; if (options.user) { user = options.user; } else { user = options; } var userObjectId = _.isString(user) ? user : user.id; if (!userObjectId) { throw new Error('Invalid target user.'); } var route = 'users/' + this.id + '/friendship/' + userObjectId; var request = AVRequest(route, null, null, 'DELETE', null, authOptions); return request; }, /** * Get the user's followers and followees. * @since 4.8.0 * @param {Object} [options] * @param {Number} [options.skip] * @param {Number} [options.limit] * @param {AuthOptions} [authOptions] */ getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) { if (!this.id) { throw new Error('Please signin.'); } return request({ method: 'GET', path: "/users/".concat(this.id, "/followersAndFollowees"), query: { skip: options && options.skip, limit: options && options.limit, include: 'follower,followee', keys: 'follower,followee' }, authOptions: authOptions }).then(function (_ref11) { var followers = _ref11.followers, followees = _ref11.followees; return { followers: (0, _map.default)(followers).call(followers, function (_ref12) { var follower = _ref12.follower; return AV._decode(follower); }), followees: (0, _map.default)(followees).call(followees, function (_ref13) { var followee = _ref13.followee; return AV._decode(followee); }) }; }); }, /** *Create a follower query to query the user's followers. * @since 0.3.0 * @see AV.User#followerQuery */ followerQuery: function followerQuery() { return AV.User.followerQuery(this.id); }, /** *Create a followee query to query the user's followees. * @since 0.3.0 * @see AV.User#followeeQuery */ followeeQuery: function followeeQuery() { return AV.User.followeeQuery(this.id); }, /** * @see AV.Object#fetch */ fetch: function fetch(fetchOptions, options) { return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) { return model._handleSaveResult(false).then(function () { return model; }); }); }, /** * Update user's new password safely based on old password. * @param {String} oldPassword the old password. * @param {String} newPassword the new password. * @param {AuthOptions} options */ updatePassword: function updatePassword(oldPassword, newPassword, options) { var _this12 = this; var route = 'users/' + this.id + '/updatePassword'; var params = { old_password: oldPassword, new_password: newPassword }; var request = AVRequest(route, null, null, 'PUT', params, options); return request.then(function (resp) { _this12._finishFetch(_this12.parse(resp)); return _this12._handleSaveResult(true).then(function () { return resp; }); }); }, /** * Returns true if current would return this user. * @see AV.User#current */ isCurrent: function isCurrent() { return this._isCurrentUser; }, /** * Returns get("username"). * @return {String} * @see AV.Object#get */ getUsername: function getUsername() { return this.get('username'); }, /** * Returns get("mobilePhoneNumber"). * @return {String} * @see AV.Object#get */ getMobilePhoneNumber: function getMobilePhoneNumber() { return this.get('mobilePhoneNumber'); }, /** * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result. * @param {String} mobilePhoneNumber * @return {Boolean} * @see AV.Object#set */ setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) { return this.set('mobilePhoneNumber', phone, options); }, /** * Calls set("username", username, options) and returns the result. * @param {String} username * @return {Boolean} * @see AV.Object#set */ setUsername: function setUsername(username, options) { return this.set('username', username, options); }, /** * Calls set("password", password, options) and returns the result. * @param {String} password * @return {Boolean} * @see AV.Object#set */ setPassword: function setPassword(password, options) { return this.set('password', password, options); }, /** * Returns get("email"). * @return {String} * @see AV.Object#get */ getEmail: function getEmail() { return this.get('email'); }, /** * Calls set("email", email, options) and returns the result. * @param {String} email * @param {AuthOptions} options * @return {Boolean} * @see AV.Object#set */ setEmail: function setEmail(email, options) { return this.set('email', email, options); }, /** * Checks whether this user is the current user and has been authenticated. * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(), * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id * @return (Boolean) whether this user is the current user and is logged in. */ authenticated: function authenticated() { console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。'); return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id; }, /** * Detects if current sessionToken is valid. * * @since 2.0.0 * @return Promise. */ isAuthenticated: function isAuthenticated() { var _this13 = this; return _promise.default.resolve().then(function () { return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () { return true; }, function (error) { if (error.code === 211) { return false; } throw error; }); }); }, /** * Get sessionToken of current user. * @return {String} sessionToken */ getSessionToken: function getSessionToken() { return this._sessionToken; }, /** * Refresh sessionToken of current user. * @since 2.1.0 * @param {AuthOptions} [options] * @return {Promise.} user with refreshed sessionToken */ refreshSessionToken: function refreshSessionToken(options) { var _this14 = this; return AVRequest("users/".concat(this.id, "/refreshSessionToken"), null, null, 'PUT', null, options).then(function (response) { _this14._finishFetch(response); return _this14._handleSaveResult(true).then(function () { return _this14; }); }); }, /** * Get this user's Roles. * @param {AuthOptions} [options] * @return {Promise.} A promise that is fulfilled with the roles when * the query is complete. */ getRoles: function getRoles(options) { var _context; return (0, _find.default)(_context = AV.Relation.reverseQuery('_Role', 'users', this)).call(_context, options); } }, /** @lends AV.User */ { // Class Variables // The currently logged-in user. _currentUser: null, // Whether currentUser is known to match the serialized version on disk. // This is useful for saving a localstorage check if you try to load // _currentUser frequently while there is none stored. _currentUserMatchesDisk: false, // The localStorage key suffix that the current user is stored under. _CURRENT_USER_KEY: 'currentUser', // The mapping of auth provider names to actual providers _authProviders: {}, // Class Methods /** * Signs up a new user with a username (or email) and password. * This will create a new AV.User on the server, and also persist the * session in localStorage so that you can access the user using * {@link #current}. * * @param {String} username The username (or email) to sign up with. * @param {String} password The password to sign up with. * @param {Object} [attrs] Extra fields to set on the new user. * @param {AuthOptions} [options] * @return {Promise} A promise that is fulfilled with the user when * the signup completes. * @see AV.User#signUp */ signUp: function signUp(username, password, attrs, options) { attrs = attrs || {}; attrs.username = username; attrs.password = password; var user = AV.Object._create('_User'); return user.signUp(attrs, options); }, /** * Logs in a user with a username (or email) and password. On success, this * saves the session to disk, so you can retrieve the currently logged in * user using current. * * @param {String} username The username (or email) to log in with. * @param {String} password The password to log in with. * @return {Promise} A promise that is fulfilled with the user when * the login completes. * @see AV.User#logIn */ logIn: function logIn(username, password) { var user = AV.Object._create('_User'); user._finishFetch({ username: username, password: password }); return user.logIn(); }, /** * Logs in a user with a session token. On success, this saves the session * to disk, so you can retrieve the currently logged in user using * current. * * @param {String} sessionToken The sessionToken to log in with. * @return {Promise} A promise that is fulfilled with the user when * the login completes. */ become: function become(sessionToken) { return this._fetchUserBySessionToken(sessionToken).then(function (user) { return user._handleSaveResult(true).then(function () { return user; }); }); }, _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) { if (sessionToken === undefined) { return _promise.default.reject(new Error('The sessionToken cannot be undefined')); } var user = AV.Object._create('_User'); return request({ method: 'GET', path: '/users/me', authOptions: { sessionToken: sessionToken } }).then(function (resp) { var serverAttrs = user.parse(resp); user._finishFetch(serverAttrs); return user; }); }, /** * Logs in a user with a mobile phone number and sms code sent by * AV.User.requestLoginSmsCode.On success, this * saves the session to disk, so you can retrieve the currently logged in * user using current. * * @param {String} mobilePhone The user's mobilePhoneNumber * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode * @return {Promise} A promise that is fulfilled with the user when * the login completes. * @see AV.User#logIn */ logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) { var user = AV.Object._create('_User'); user._finishFetch({ mobilePhoneNumber: mobilePhone, smsCode: smsCode }); return user.logIn(); }, /** * Signs up or logs in a user with a mobilePhoneNumber and smsCode. * On success, this saves the session to disk, so you can retrieve the currently * logged in user using current. * * @param {String} mobilePhoneNumber The user's mobilePhoneNumber. * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode * @param {Object} attributes The user's other attributes such as username etc. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled with the user when * the login completes. * @see AV.User#signUpOrlogInWithMobilePhone * @see AV.Cloud.requestSmsCode */ signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) { attrs = attrs || {}; attrs.mobilePhoneNumber = mobilePhoneNumber; attrs.smsCode = smsCode; var user = AV.Object._create('_User'); return user.signUpOrlogInWithMobilePhone(attrs, options); }, /** * Logs in a user with a mobile phone number and password. On success, this * saves the session to disk, so you can retrieve the currently logged in * user using current. * * @param {String} mobilePhone The user's mobilePhoneNumber * @param {String} password The password to log in with. * @return {Promise} A promise that is fulfilled with the user when * the login completes. * @see AV.User#logIn */ logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) { var user = AV.Object._create('_User'); user._finishFetch({ mobilePhoneNumber: mobilePhone, password: password }); return user.logIn(); }, /** * Logs in a user with email and password. * * @since 3.13.0 * @param {String} email The user's email. * @param {String} password The password to log in with. * @return {Promise} A promise that is fulfilled with the user when * the login completes. */ loginWithEmail: function loginWithEmail(email, password) { var user = AV.Object._create('_User'); user._finishFetch({ email: email, password: password }); return user.logIn(); }, /** * Signs up or logs in a user with a third party auth data(AccessToken). * On success, this saves the session to disk, so you can retrieve the currently * logged in user using current. * * @since 3.7.0 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 } * @param {string} platform Available platform for sign up. * @param {Object} [options] * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise} A promise that is fulfilled with the user when * the login completes. * @example AV.User.loginWithAuthData({ * openid: 'abc123', * access_token: '123abc', * expires_in: 1382686496 * }, 'weixin').then(function(user) { * //Access user here * }).catch(function(error) { * //console.error("error: ", error); * }); * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户} */ loginWithAuthData: function loginWithAuthData(authData, platform, options) { return AV.User._logInWith(platform, authData, options); }, /** * @deprecated renamed to {@link AV.User.loginWithAuthData} */ signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() { console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替'); return this.loginWithAuthData.apply(this, arguments); }, /** * Signs up or logs in a user with a third party authData and unionId. * @since 3.7.0 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 } * @param {string} platform Available platform for sign up. * @param {string} unionId * @param {Object} [unionLoginOptions] * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user. * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise} A promise that is fulfilled with the user when completed. * @example AV.User.loginWithAuthDataAndUnionId({ * openid: 'abc123', * access_token: '123abc', * expires_in: 1382686496 * }, 'weixin', 'union123', { * unionIdPlatform: 'weixin', * asMainAccount: true, * }).then(function(user) { * //Access user here * }).catch(function(error) { * //console.error("error: ", error); * }); */ loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) { return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions); }, /** * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId} * @since 3.5.0 */ signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() { console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替'); return this.loginWithAuthDataAndUnionId.apply(this, arguments); }, /** * Merge unionId into authInfo. * @since 4.6.0 * @param {Object} authInfo * @param {String} unionId * @param {Object} [unionIdOption] * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user. */ mergeUnionId: function mergeUnionId(authInfo, unionId) { var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, _ref14$asMainAccount = _ref14.asMainAccount, asMainAccount = _ref14$asMainAccount === void 0 ? false : _ref14$asMainAccount; authInfo = JSON.parse((0, _stringify.default)(authInfo)); var _authInfo = authInfo, authData = _authInfo.authData, platform = _authInfo.platform; authData.platform = platform; authData.main_account = asMainAccount; authData.unionid = unionId; return authInfo; }, /** * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。 * 仅在微信小程序中可用。 * * @deprecated please use {@link AV.User.loginWithMiniApp} * @since 2.0.0 * @param {Object} [options] * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0) * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user. * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0) * @return {Promise.} */ loginWithWeapp: function loginWithWeapp() { var _this15 = this; var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref15$preferUnionId = _ref15.preferUnionId, preferUnionId = _ref15$preferUnionId === void 0 ? false : _ref15$preferUnionId, _ref15$unionIdPlatfor = _ref15.unionIdPlatform, unionIdPlatform = _ref15$unionIdPlatfor === void 0 ? 'weixin' : _ref15$unionIdPlatfor, _ref15$asMainAccount = _ref15.asMainAccount, asMainAccount = _ref15$asMainAccount === void 0 ? true : _ref15$asMainAccount, _ref15$failOnNotExist = _ref15.failOnNotExist, failOnNotExist = _ref15$failOnNotExist === void 0 ? false : _ref15$failOnNotExist; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ preferUnionId: preferUnionId, asMainAccount: asMainAccount, platform: unionIdPlatform }).then(function (authInfo) { return _this15.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist }); }); }, /** * 使用当前使用微信小程序的微信用户身份注册或登录, * 仅在微信小程序中可用。 * * @deprecated please use {@link AV.User.loginWithMiniApp} * @since 3.13.0 * @param {Object} [unionLoginOptions] * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user. * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.} */ loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) { var _this16 = this; var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref16$unionIdPlatfor = _ref16.unionIdPlatform, unionIdPlatform = _ref16$unionIdPlatfor === void 0 ? 'weixin' : _ref16$unionIdPlatfor, _ref16$asMainAccount = _ref16.asMainAccount, asMainAccount = _ref16$asMainAccount === void 0 ? false : _ref16$asMainAccount, _ref16$failOnNotExist = _ref16.failOnNotExist, failOnNotExist = _ref16$failOnNotExist === void 0 ? false : _ref16$failOnNotExist; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) { authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount }); return _this16.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist }); }); }, /** * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。 * 仅在 QQ 小程序中可用。 * * @deprecated please use {@link AV.User.loginWithMiniApp} * @since 4.2.0 * @param {Object} [options] * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user. * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0) * @return {Promise.} */ loginWithQQApp: function loginWithQQApp() { var _this17 = this; var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref17$preferUnionId = _ref17.preferUnionId, preferUnionId = _ref17$preferUnionId === void 0 ? false : _ref17$preferUnionId, _ref17$unionIdPlatfor = _ref17.unionIdPlatform, unionIdPlatform = _ref17$unionIdPlatfor === void 0 ? 'qq' : _ref17$unionIdPlatfor, _ref17$asMainAccount = _ref17.asMainAccount, asMainAccount = _ref17$asMainAccount === void 0 ? true : _ref17$asMainAccount, _ref17$failOnNotExist = _ref17.failOnNotExist, failOnNotExist = _ref17$failOnNotExist === void 0 ? false : _ref17$failOnNotExist; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ preferUnionId: preferUnionId, asMainAccount: asMainAccount, platform: unionIdPlatform }).then(function (authInfo) { authInfo.provider = PLATFORM_QQAPP; return _this17.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist }); }); }, /** * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录, * 仅在 QQ 小程序中可用。 * * @deprecated please use {@link AV.User.loginWithMiniApp} * @since 4.2.0 * @param {Object} [unionLoginOptions] * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user. * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.} */ loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) { var _this18 = this; var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref18$unionIdPlatfor = _ref18.unionIdPlatform, unionIdPlatform = _ref18$unionIdPlatfor === void 0 ? 'qq' : _ref18$unionIdPlatfor, _ref18$asMainAccount = _ref18.asMainAccount, asMainAccount = _ref18$asMainAccount === void 0 ? false : _ref18$asMainAccount, _ref18$failOnNotExist = _ref18.failOnNotExist, failOnNotExist = _ref18$failOnNotExist === void 0 ? false : _ref18$failOnNotExist; var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) { authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount }); authInfo.provider = PLATFORM_QQAPP; return _this18.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist }); }); }, /** * Register or login using the identity of the current mini-app. * @param {Object} authInfo * @param {Object} [option] * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists. */ loginWithMiniApp: function loginWithMiniApp(authInfo, option) { var _this19 = this; if (authInfo === undefined) { var getAuthInfo = getAdapter('getAuthInfo'); return getAuthInfo().then(function (authInfo) { return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option); }); } return this.loginWithAuthData(authInfo.authData, authInfo.provider, option); }, /** * Only use for DI in tests to produce deterministic IDs. */ _genId: function _genId() { return uuid(); }, /** * Creates an anonymous user. * * @since 3.9.0 * @return {Promise.} */ loginAnonymously: function loginAnonymously() { return this.loginWithAuthData({ id: AV.User._genId() }, 'anonymous'); }, associateWithAuthData: function associateWithAuthData(userObj, platform, authData) { console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替'); return userObj._linkWith(platform, authData); }, /** * Logs out the currently logged in user session. This will remove the * session from disk, log out of linked services, and future calls to * current will return null. * @return {Promise} */ logOut: function logOut() { if (AV._config.disableCurrentUser) { 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'); return _promise.default.resolve(null); } if (AV.User._currentUser !== null) { AV.User._currentUser._logOutWithAll(); AV.User._currentUser._isCurrentUser = false; } AV.User._currentUserMatchesDisk = true; AV.User._currentUser = null; return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () { return AV._refreshSubscriptionId(); }); }, /** *Create a follower query for special user to query the user's followers. * @param {String} userObjectId The user object id. * @return {AV.FriendShipQuery} * @since 0.3.0 */ followerQuery: function followerQuery(userObjectId) { if (!userObjectId || !_.isString(userObjectId)) { throw new Error('Invalid user object id.'); } var query = new AV.FriendShipQuery('_Follower'); query._friendshipTag = 'follower'; query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId)); return query; }, /** *Create a followee query for special user to query the user's followees. * @param {String} userObjectId The user object id. * @return {AV.FriendShipQuery} * @since 0.3.0 */ followeeQuery: function followeeQuery(userObjectId) { if (!userObjectId || !_.isString(userObjectId)) { throw new Error('Invalid user object id.'); } var query = new AV.FriendShipQuery('_Followee'); query._friendshipTag = 'followee'; query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId)); return query; }, /** * Requests a password reset email to be sent to the specified email address * associated with the user account. This email allows the user to securely * reset their password on the AV site. * * @param {String} email The email address associated with the user that * forgot their password. * @return {Promise} */ requestPasswordReset: function requestPasswordReset(email) { var json = { email: email }; var request = AVRequest('requestPasswordReset', null, null, 'POST', json); return request; }, /** * Requests a verify email to be sent to the specified email address * associated with the user account. This email allows the user to securely * verify their email address on the AV site. * * @param {String} email The email address associated with the user that * doesn't verify their email address. * @return {Promise} */ requestEmailVerify: function requestEmailVerify(email) { var json = { email: email }; var request = AVRequest('requestEmailVerify', null, null, 'POST', json); return request; }, /** * Requests a verify sms code to be sent to the specified mobile phone * number associated with the user account. This sms code allows the user to * verify their mobile phone number by calling AV.User.verifyMobilePhone * * @param {String} mobilePhoneNumber The mobile phone number associated with the * user that doesn't verify their mobile phone number. * @param {SMSAuthOptions} [options] * @return {Promise} */ requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var data = { mobilePhoneNumber: mobilePhoneNumber }; if (options.validateToken) { data.validate_token = options.validateToken; } var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options); return request; }, /** * Requests a reset password sms code to be sent to the specified mobile phone * number associated with the user account. This sms code allows the user to * reset their account's password by calling AV.User.resetPasswordBySmsCode * * @param {String} mobilePhoneNumber The mobile phone number associated with the * user that doesn't verify their mobile phone number. * @param {SMSAuthOptions} [options] * @return {Promise} */ requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var data = { mobilePhoneNumber: mobilePhoneNumber }; if (options.validateToken) { data.validate_token = options.validateToken; } var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options); return request; }, /** * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber. * This sms code allows current user to reset it's mobilePhoneNumber by * calling {@link AV.User.changePhoneNumber} * @since 4.7.0 * @param {String} mobilePhoneNumber * @param {Number} [ttl] ttl of sms code (default is 6 minutes) * @param {SMSAuthOptions} [options] * @return {Promise} */ requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) { var data = { mobilePhoneNumber: mobilePhoneNumber }; if (ttl) { data.ttl = options.ttl; } if (options && options.validateToken) { data.validate_token = options.validateToken; } return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options); }, /** * Makes a call to reset user's account mobilePhoneNumber by sms code. * The sms code is sent by {@link AV.User.requestChangePhoneNumber} * @since 4.7.0 * @param {String} mobilePhoneNumber * @param {String} code The sms code. * @return {Promise} */ changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) { var data = { mobilePhoneNumber: mobilePhoneNumber, code: code }; return AVRequest('changePhoneNumber', null, null, 'POST', data); }, /** * Makes a call to reset user's account password by sms code and new password. * The sms code is sent by AV.User.requestPasswordResetBySmsCode. * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode * @param {String} password The new password. * @return {Promise} A promise that will be resolved with the result * of the function. */ resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) { var json = { password: password }; var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json); return request; }, /** * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode * If verify successfully,the user mobilePhoneVerified attribute will be true. * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode * @return {Promise} A promise that will be resolved with the result * of the function. */ verifyMobilePhone: function verifyMobilePhone(code) { var request = AVRequest('verifyMobilePhone', null, code, 'POST', null); return request; }, /** * Requests a logIn sms code to be sent to the specified mobile phone * number associated with the user account. This sms code allows the user to * login by AV.User.logInWithMobilePhoneSmsCode function. * * @param {String} mobilePhoneNumber The mobile phone number associated with the * user that want to login by AV.User.logInWithMobilePhoneSmsCode * @param {SMSAuthOptions} [options] * @return {Promise} */ requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var data = { mobilePhoneNumber: mobilePhoneNumber }; if (options.validateToken) { data.validate_token = options.validateToken; } var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options); return request; }, /** * Retrieves the currently logged in AVUser with a valid session, * either from memory or localStorage, if necessary. * @return {Promise.} resolved with the currently logged in AV.User. */ currentAsync: function currentAsync() { if (AV._config.disableCurrentUser) { 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'); return _promise.default.resolve(null); } if (AV.User._currentUser) { return _promise.default.resolve(AV.User._currentUser); } if (AV.User._currentUserMatchesDisk) { return _promise.default.resolve(AV.User._currentUser); } return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) { if (!userData) { return null; } // Load the user from local storage. AV.User._currentUserMatchesDisk = true; AV.User._currentUser = AV.Object._create('_User'); AV.User._currentUser._isCurrentUser = true; var json = JSON.parse(userData); AV.User._currentUser.id = json._id; delete json._id; AV.User._currentUser._sessionToken = json._sessionToken; delete json._sessionToken; AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json); AV.User._currentUser._synchronizeAllAuthData(); AV.User._currentUser._refreshCache(); AV.User._currentUser._opSetQueue = [{}]; return AV.User._currentUser; }); }, /** * Retrieves the currently logged in AVUser with a valid session, * either from memory or localStorage, if necessary. * @return {AV.User} The currently logged in AV.User. */ current: function current() { if (AV._config.disableCurrentUser) { 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'); return null; } if (AV.localStorage.async) { var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.'); error.code = 'SYNC_API_NOT_AVAILABLE'; throw error; } if (AV.User._currentUser) { return AV.User._currentUser; } if (AV.User._currentUserMatchesDisk) { return AV.User._currentUser; } // Load the user from local storage. AV.User._currentUserMatchesDisk = true; var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY)); if (!userData) { return null; } AV.User._currentUser = AV.Object._create('_User'); AV.User._currentUser._isCurrentUser = true; var json = JSON.parse(userData); AV.User._currentUser.id = json._id; delete json._id; AV.User._currentUser._sessionToken = json._sessionToken; delete json._sessionToken; AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json); AV.User._currentUser._synchronizeAllAuthData(); AV.User._currentUser._refreshCache(); AV.User._currentUser._opSetQueue = [{}]; return AV.User._currentUser; }, /** * Persists a user as currentUser to localStorage, and into the singleton. * @private */ _saveCurrentUser: function _saveCurrentUser(user) { var promise; if (AV.User._currentUser !== user) { promise = AV.User.logOut(); } else { promise = _promise.default.resolve(); } return promise.then(function () { user._isCurrentUser = true; AV.User._currentUser = user; var json = user._toFullJSON(); json._id = user.id; json._sessionToken = user._sessionToken; return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify.default)(json)).then(function () { AV.User._currentUserMatchesDisk = true; return AV._refreshSubscriptionId(); }); }); }, _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) { AV.User._authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider. if (!AV._config.disableCurrentUser && AV.User.current()) { AV.User.current()._synchronizeAuthData(provider.getAuthType()); } }, _logInWith: function _logInWith(provider, authData, options) { var user = AV.Object._create('_User'); return user._linkWith(provider, authData, options); } }); }; /***/ }), /* 557 */ /***/ (function(module, exports, __webpack_require__) { var _Object$defineProperty = __webpack_require__(150); function _defineProperty(obj, key, value) { if (key in obj) { _Object$defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; /***/ }), /* 558 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _map = _interopRequireDefault(__webpack_require__(35)); var _promise = _interopRequireDefault(__webpack_require__(12)); var _keys = _interopRequireDefault(__webpack_require__(59)); var _stringify = _interopRequireDefault(__webpack_require__(36)); var _find = _interopRequireDefault(__webpack_require__(93)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _ = __webpack_require__(3); var debug = __webpack_require__(60)('leancloud:query'); var AVError = __webpack_require__(46); var _require = __webpack_require__(27), _request = _require._request, request = _require.request; var _require2 = __webpack_require__(30), ensureArray = _require2.ensureArray, transformFetchOptions = _require2.transformFetchOptions, continueWhile = _require2.continueWhile; var requires = function requires(value, message) { if (value === undefined) { throw new Error(message); } }; // AV.Query is a way to create a list of AV.Objects. module.exports = function (AV) { /** * Creates a new AV.Query for the given AV.Object subclass. * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string. * @class * *

AV.Query defines a query that is used to fetch AV.Objects. The * most common use case is finding all objects that match a query through the * find method. For example, this sample code fetches all objects * of class MyClass. It calls a different function depending on * whether the fetch succeeded or not. * *

   * var query = new AV.Query(MyClass);
   * query.find().then(function(results) {
   *   // results is an array of AV.Object.
   * }, function(error) {
   *   // error is an instance of AVError.
   * });

* *

An AV.Query can also be used to retrieve a single object whose id is * known, through the get method. For example, this sample code fetches an * object of class MyClass and id myId. It calls a * different function depending on whether the fetch succeeded or not. * *

   * var query = new AV.Query(MyClass);
   * query.get(myId).then(function(object) {
   *   // object is an instance of AV.Object.
   * }, function(error) {
   *   // error is an instance of AVError.
   * });

* *

An AV.Query can also be used to count the number of objects that match * the query without retrieving all of those objects. For example, this * sample code counts the number of objects of the class MyClass *

   * var query = new AV.Query(MyClass);
   * query.count().then(function(number) {
   *   // There are number instances of MyClass.
   * }, function(error) {
   *   // error is an instance of AVError.
   * });

*/ AV.Query = function (objectClass) { if (_.isString(objectClass)) { objectClass = AV.Object._getSubclass(objectClass); } this.objectClass = objectClass; this.className = objectClass.prototype.className; this._where = {}; this._include = []; this._select = []; this._limit = -1; // negative limit means, do not send a limit this._skip = 0; this._defaultParams = {}; }; /** * Constructs a AV.Query that is the OR of the passed in queries. For * example: *
var compoundQuery = AV.Query.or(query1, query2, query3);
* * will create a compoundQuery that is an or of the query1, query2, and * query3. * @param {...AV.Query} var_args The list of queries to OR. * @return {AV.Query} The query that is the OR of the passed in queries. */ AV.Query.or = function () { var queries = _.toArray(arguments); var className = null; AV._arrayEach(queries, function (q) { if (_.isNull(className)) { className = q.className; } if (className !== q.className) { throw new Error('All queries must be for the same class'); } }); var query = new AV.Query(className); query._orQuery(queries); return query; }; /** * Constructs a AV.Query that is the AND of the passed in queries. For * example: *
var compoundQuery = AV.Query.and(query1, query2, query3);
* * will create a compoundQuery that is an 'and' of the query1, query2, and * query3. * @param {...AV.Query} var_args The list of queries to AND. * @return {AV.Query} The query that is the AND of the passed in queries. */ AV.Query.and = function () { var queries = _.toArray(arguments); var className = null; AV._arrayEach(queries, function (q) { if (_.isNull(className)) { className = q.className; } if (className !== q.className) { throw new Error('All queries must be for the same class'); } }); var query = new AV.Query(className); query._andQuery(queries); return query; }; /** * Retrieves a list of AVObjects that satisfy the CQL. * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}. * * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}. * @param {Array} pvalues An array contains placeholder values. * @param {AuthOptions} options * @return {Promise} A promise that is resolved with the results when * the query completes. */ AV.Query.doCloudQuery = function (cql, pvalues, options) { var params = { cql: cql }; if (_.isArray(pvalues)) { params.pvalues = pvalues; } else { options = pvalues; } var request = _request('cloudQuery', null, null, 'GET', params, options); return request.then(function (response) { //query to process results. var query = new AV.Query(response.className); var results = (0, _map.default)(_).call(_, response.results, function (json) { var obj = query._newObject(response); if (obj._finishFetch) { obj._finishFetch(query._processResult(json), true); } return obj; }); return { results: results, count: response.count, className: response.className }; }); }; /** * Return a query with conditions from json. * This can be useful to send a query from server side to client side. * @since 4.0.0 * @param {Object} json from {@link AV.Query#toJSON} * @return {AV.Query} */ AV.Query.fromJSON = function (_ref) { var className = _ref.className, where = _ref.where, include = _ref.include, select = _ref.select, includeACL = _ref.includeACL, limit = _ref.limit, skip = _ref.skip, order = _ref.order; if (typeof className !== 'string') { throw new TypeError('Invalid Query JSON, className must be a String.'); } var query = new AV.Query(className); _.extend(query, { _where: where, _include: include, _select: select, _includeACL: includeACL, _limit: limit, _skip: skip, _order: order }); return query; }; AV.Query._extend = AV._extend; _.extend(AV.Query.prototype, /** @lends AV.Query.prototype */ { //hook to iterate result. Added by dennis. _processResult: function _processResult(obj) { return obj; }, /** * Constructs an AV.Object whose id is already known by fetching data from * the server. * * @param {String} objectId The id of the object to be fetched. * @param {AuthOptions} options * @return {Promise.} */ get: function get(objectId, options) { if (!_.isString(objectId)) { throw new Error('objectId must be a string'); } if (objectId === '') { return _promise.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.')); } var obj = this._newObject(); obj.id = objectId; var queryJSON = this._getParams(); var fetchOptions = {}; if ((0, _keys.default)(queryJSON)) fetchOptions.keys = (0, _keys.default)(queryJSON); if (queryJSON.include) fetchOptions.include = queryJSON.include; if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL; return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) { if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'); obj._finishFetch(obj.parse(response), true); return obj; }); }, /** * Returns a JSON representation of this query. * @return {Object} */ toJSON: function toJSON() { var className = this.className, where = this._where, include = this._include, select = this._select, includeACL = this._includeACL, limit = this._limit, skip = this._skip, order = this._order; return { className: className, where: where, include: include, select: select, includeACL: includeACL, limit: limit, skip: skip, order: order }; }, _getParams: function _getParams() { var params = _.extend({}, this._defaultParams, { where: this._where }); if (this._include.length > 0) { params.include = this._include.join(','); } if (this._select.length > 0) { params.keys = this._select.join(','); } if (this._includeACL !== undefined) { params.returnACL = this._includeACL; } if (this._limit >= 0) { params.limit = this._limit; } if (this._skip > 0) { params.skip = this._skip; } if (this._order !== undefined) { params.order = this._order; } return params; }, _newObject: function _newObject(response) { var obj; if (response && response.className) { obj = new AV.Object(response.className); } else { obj = new this.objectClass(); } return obj; }, _createRequest: function _createRequest() { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams(); var options = arguments.length > 1 ? arguments[1] : undefined; var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "/classes/".concat(this.className); if (encodeURIComponent((0, _stringify.default)(params)).length > 2000) { var body = { requests: [{ method: 'GET', path: "/1.1".concat(path), params: params }] }; return request({ path: '/batch', method: 'POST', data: body, authOptions: options }).then(function (response) { var result = response[0]; if (result.success) { return result.success; } var error = new AVError(result.error.code, result.error.error || 'Unknown batch error'); throw error; }); } return request({ method: 'GET', path: path, query: params, authOptions: options }); }, _parseResponse: function _parseResponse(response) { var _this = this; return (0, _map.default)(_).call(_, response.results, function (json) { var obj = _this._newObject(response); if (obj._finishFetch) { obj._finishFetch(_this._processResult(json), true); } return obj; }); }, /** * Retrieves a list of AVObjects that satisfy this query. * * @param {AuthOptions} options * @return {Promise} A promise that is resolved with the results when * the query completes. */ find: function find(options) { var request = this._createRequest(undefined, options); return request.then(this._parseResponse.bind(this)); }, /** * Retrieves both AVObjects and total count. * * @since 4.12.0 * @param {AuthOptions} options * @return {Promise} A tuple contains results and count. */ findAndCount: function findAndCount(options) { var _this2 = this; var params = this._getParams(); params.count = 1; var request = this._createRequest(params, options); return request.then(function (response) { return [_this2._parseResponse(response), response.count]; }); }, /** * scan a Query. masterKey required. * * @since 2.1.0 * @param {object} [options] * @param {string} [options.orderedBy] specify the key to sort * @param {number} [options.batchSize] specify the batch size for each request * @param {AuthOptions} [authOptions] * @return {AsyncIterator.} * @example const testIterator = { * [Symbol.asyncIterator]() { * return new Query('Test').scan(undefined, { useMasterKey: true }); * }, * }; * for await (const test of testIterator) { * console.log(test.id); * } */ scan: function scan() { var _this3 = this; var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, orderedBy = _ref2.orderedBy, batchSize = _ref2.batchSize; var authOptions = arguments.length > 1 ? arguments[1] : undefined; var condition = this._getParams(); debug('scan %O', condition); if (condition.order) { console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.'); delete condition.order; } if (condition.skip) { console.warn('The skip option of the query is ignored for Query#scan.'); delete condition.skip; } if (condition.limit) { console.warn('The limit option of the query is ignored for Query#scan.'); delete condition.limit; } if (orderedBy) condition.scan_key = orderedBy; if (batchSize) condition.limit = batchSize; var cursor; var remainResults = []; return { next: function next() { if (remainResults.length) { return _promise.default.resolve({ done: false, value: remainResults.shift() }); } if (cursor === null) { return _promise.default.resolve({ done: true }); } return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, { cursor: cursor }) : condition, authOptions).then(function (response) { cursor = response.cursor; if (response.results.length) { var results = _this3._parseResponse(response); results.forEach(function (result) { return remainResults.push(result); }); } if (cursor === null && remainResults.length === 0) { return { done: true }; } return { done: false, value: remainResults.shift() }; }); } }; }, /** * Delete objects retrieved by this query. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the save * completes. */ destroyAll: function destroyAll(options) { var self = this; return (0, _find.default)(self).call(self, options).then(function (objects) { return AV.Object.destroyAll(objects, options); }); }, /** * Counts the number of objects that match this query. * * @param {AuthOptions} options * @return {Promise} A promise that is resolved with the count when * the query completes. */ count: function count(options) { var params = this._getParams(); params.limit = 0; params.count = 1; var request = this._createRequest(params, options); return request.then(function (response) { return response.count; }); }, /** * Retrieves at most one AV.Object that satisfies this query. * * @param {AuthOptions} options * @return {Promise} A promise that is resolved with the object when * the query completes. */ first: function first(options) { var self = this; var params = this._getParams(); params.limit = 1; var request = this._createRequest(params, options); return request.then(function (response) { return (0, _map.default)(_).call(_, response.results, function (json) { var obj = self._newObject(); if (obj._finishFetch) { obj._finishFetch(self._processResult(json), true); } return obj; })[0]; }); }, /** * Sets the number of results to skip before returning any results. * This is useful for pagination. * Default is to skip zero results. * @param {Number} n the number of results to skip. * @return {AV.Query} Returns the query, so you can chain this call. */ skip: function skip(n) { requires(n, 'undefined is not a valid skip value'); this._skip = n; return this; }, /** * Sets the limit of the number of results to return. The default limit is * 100, with a maximum of 1000 results being returned at a time. * @param {Number} n the number of results to limit to. * @return {AV.Query} Returns the query, so you can chain this call. */ limit: function limit(n) { requires(n, 'undefined is not a valid limit value'); this._limit = n; return this; }, /** * Add a constraint to the query that requires a particular key's value to * be equal to the provided value. * @param {String} key The key to check. * @param value The value that the AV.Object must contain. * @return {AV.Query} Returns the query, so you can chain this call. */ equalTo: function equalTo(key, value) { requires(key, 'undefined is not a valid key'); requires(value, 'undefined is not a valid value'); this._where[key] = AV._encode(value); return this; }, /** * Helper for condition queries * @private */ _addCondition: function _addCondition(key, condition, value) { requires(key, 'undefined is not a valid condition key'); requires(condition, 'undefined is not a valid condition'); requires(value, 'undefined is not a valid condition value'); // Check if we already have a condition if (!this._where[key]) { this._where[key] = {}; } this._where[key][condition] = AV._encode(value); return this; }, /** * Add a constraint to the query that requires a particular * array key's length to be equal to the provided value. * @param {String} key The array key to check. * @param {number} value The length value. * @return {AV.Query} Returns the query, so you can chain this call. */ sizeEqualTo: function sizeEqualTo(key, value) { this._addCondition(key, '$size', value); return this; }, /** * Add a constraint to the query that requires a particular key's value to * be not equal to the provided value. * @param {String} key The key to check. * @param value The value that must not be equalled. * @return {AV.Query} Returns the query, so you can chain this call. */ notEqualTo: function notEqualTo(key, value) { this._addCondition(key, '$ne', value); return this; }, /** * Add a constraint to the query that requires a particular key's value to * be less than the provided value. * @param {String} key The key to check. * @param value The value that provides an upper bound. * @return {AV.Query} Returns the query, so you can chain this call. */ lessThan: function lessThan(key, value) { this._addCondition(key, '$lt', value); return this; }, /** * Add a constraint to the query that requires a particular key's value to * be greater than the provided value. * @param {String} key The key to check. * @param value The value that provides an lower bound. * @return {AV.Query} Returns the query, so you can chain this call. */ greaterThan: function greaterThan(key, value) { this._addCondition(key, '$gt', value); return this; }, /** * Add a constraint to the query that requires a particular key's value to * be less than or equal to the provided value. * @param {String} key The key to check. * @param value The value that provides an upper bound. * @return {AV.Query} Returns the query, so you can chain this call. */ lessThanOrEqualTo: function lessThanOrEqualTo(key, value) { this._addCondition(key, '$lte', value); return this; }, /** * Add a constraint to the query that requires a particular key's value to * be greater than or equal to the provided value. * @param {String} key The key to check. * @param value The value that provides an lower bound. * @return {AV.Query} Returns the query, so you can chain this call. */ greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) { this._addCondition(key, '$gte', value); return this; }, /** * Add a constraint to the query that requires a particular key's value to * be contained in the provided list of values. * @param {String} key The key to check. * @param {Array} values The values that will match. * @return {AV.Query} Returns the query, so you can chain this call. */ containedIn: function containedIn(key, values) { this._addCondition(key, '$in', values); return this; }, /** * Add a constraint to the query that requires a particular key's value to * not be contained in the provided list of values. * @param {String} key The key to check. * @param {Array} values The values that will not match. * @return {AV.Query} Returns the query, so you can chain this call. */ notContainedIn: function notContainedIn(key, values) { this._addCondition(key, '$nin', values); return this; }, /** * Add a constraint to the query that requires a particular key's value to * contain each one of the provided list of values. * @param {String} key The key to check. This key's value must be an array. * @param {Array} values The values that will match. * @return {AV.Query} Returns the query, so you can chain this call. */ containsAll: function containsAll(key, values) { this._addCondition(key, '$all', values); return this; }, /** * Add a constraint for finding objects that contain the given key. * @param {String} key The key that should exist. * @return {AV.Query} Returns the query, so you can chain this call. */ exists: function exists(key) { this._addCondition(key, '$exists', true); return this; }, /** * Add a constraint for finding objects that do not contain a given key. * @param {String} key The key that should not exist * @return {AV.Query} Returns the query, so you can chain this call. */ doesNotExist: function doesNotExist(key) { this._addCondition(key, '$exists', false); return this; }, /** * Add a regular expression constraint for finding string values that match * the provided regular expression. * This may be slow for large datasets. * @param {String} key The key that the string to match is stored in. * @param {RegExp} regex The regular expression pattern to match. * @return {AV.Query} Returns the query, so you can chain this call. */ matches: function matches(key, regex, modifiers) { this._addCondition(key, '$regex', regex); if (!modifiers) { modifiers = ''; } // Javascript regex options support mig as inline options but store them // as properties of the object. We support mi & should migrate them to // modifiers if (regex.ignoreCase) { modifiers += 'i'; } if (regex.multiline) { modifiers += 'm'; } if (modifiers && modifiers.length) { this._addCondition(key, '$options', modifiers); } return this; }, /** * Add a constraint that requires that a key's value matches a AV.Query * constraint. * @param {String} key The key that the contains the object to match the * query. * @param {AV.Query} query The query that should match. * @return {AV.Query} Returns the query, so you can chain this call. */ matchesQuery: function matchesQuery(key, query) { var queryJSON = query._getParams(); queryJSON.className = query.className; this._addCondition(key, '$inQuery', queryJSON); return this; }, /** * Add a constraint that requires that a key's value not matches a * AV.Query constraint. * @param {String} key The key that the contains the object to match the * query. * @param {AV.Query} query The query that should not match. * @return {AV.Query} Returns the query, so you can chain this call. */ doesNotMatchQuery: function doesNotMatchQuery(key, query) { var queryJSON = query._getParams(); queryJSON.className = query.className; this._addCondition(key, '$notInQuery', queryJSON); return this; }, /** * Add a constraint that requires that a key's value matches a value in * an object returned by a different AV.Query. * @param {String} key The key that contains the value that is being * matched. * @param {String} queryKey The key in the objects returned by the query to * match against. * @param {AV.Query} query The query to run. * @return {AV.Query} Returns the query, so you can chain this call. */ matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) { var queryJSON = query._getParams(); queryJSON.className = query.className; this._addCondition(key, '$select', { key: queryKey, query: queryJSON }); return this; }, /** * Add a constraint that requires that a key's value not match a value in * an object returned by a different AV.Query. * @param {String} key The key that contains the value that is being * excluded. * @param {String} queryKey The key in the objects returned by the query to * match against. * @param {AV.Query} query The query to run. * @return {AV.Query} Returns the query, so you can chain this call. */ doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) { var queryJSON = query._getParams(); queryJSON.className = query.className; this._addCondition(key, '$dontSelect', { key: queryKey, query: queryJSON }); return this; }, /** * Add constraint that at least one of the passed in queries matches. * @param {Array} queries * @return {AV.Query} Returns the query, so you can chain this call. * @private */ _orQuery: function _orQuery(queries) { var queryJSON = (0, _map.default)(_).call(_, queries, function (q) { return q._getParams().where; }); this._where.$or = queryJSON; return this; }, /** * Add constraint that both of the passed in queries matches. * @param {Array} queries * @return {AV.Query} Returns the query, so you can chain this call. * @private */ _andQuery: function _andQuery(queries) { var queryJSON = (0, _map.default)(_).call(_, queries, function (q) { return q._getParams().where; }); this._where.$and = queryJSON; return this; }, /** * Converts a string into a regex that matches it. * Surrounding with \Q .. \E does this, we just need to escape \E's in * the text separately. * @private */ _quote: function _quote(s) { return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E'; }, /** * Add a constraint for finding string values that contain a provided * string. This may be slow for large datasets. * @param {String} key The key that the string to match is stored in. * @param {String} substring The substring that the value must contain. * @return {AV.Query} Returns the query, so you can chain this call. */ contains: function contains(key, value) { this._addCondition(key, '$regex', this._quote(value)); return this; }, /** * Add a constraint for finding string values that start with a provided * string. This query will use the backend index, so it will be fast even * for large datasets. * @param {String} key The key that the string to match is stored in. * @param {String} prefix The substring that the value must start with. * @return {AV.Query} Returns the query, so you can chain this call. */ startsWith: function startsWith(key, value) { this._addCondition(key, '$regex', '^' + this._quote(value)); return this; }, /** * Add a constraint for finding string values that end with a provided * string. This will be slow for large datasets. * @param {String} key The key that the string to match is stored in. * @param {String} suffix The substring that the value must end with. * @return {AV.Query} Returns the query, so you can chain this call. */ endsWith: function endsWith(key, value) { this._addCondition(key, '$regex', this._quote(value) + '$'); return this; }, /** * Sorts the results in ascending order by the given key. * * @param {String} key The key to order by. * @return {AV.Query} Returns the query, so you can chain this call. */ ascending: function ascending(key) { requires(key, 'undefined is not a valid key'); this._order = key; return this; }, /** * Also sorts the results in ascending order by the given key. The previous sort keys have * precedence over this key. * * @param {String} key The key to order by * @return {AV.Query} Returns the query so you can chain this call. */ addAscending: function addAscending(key) { requires(key, 'undefined is not a valid key'); if (this._order) this._order += ',' + key;else this._order = key; return this; }, /** * Sorts the results in descending order by the given key. * * @param {String} key The key to order by. * @return {AV.Query} Returns the query, so you can chain this call. */ descending: function descending(key) { requires(key, 'undefined is not a valid key'); this._order = '-' + key; return this; }, /** * Also sorts the results in descending order by the given key. The previous sort keys have * precedence over this key. * * @param {String} key The key to order by * @return {AV.Query} Returns the query so you can chain this call. */ addDescending: function addDescending(key) { requires(key, 'undefined is not a valid key'); if (this._order) this._order += ',-' + key;else this._order = '-' + key; return this; }, /** * Add a proximity based constraint for finding objects with key point * values near the point given. * @param {String} key The key that the AV.GeoPoint is stored in. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used. * @return {AV.Query} Returns the query, so you can chain this call. */ near: function near(key, point) { if (!(point instanceof AV.GeoPoint)) { // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works. point = new AV.GeoPoint(point); } this._addCondition(key, '$nearSphere', point); return this; }, /** * Add a proximity based constraint for finding objects with key point * values near the point given and within the maximum distance given. * @param {String} key The key that the AV.GeoPoint is stored in. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used. * @param maxDistance Maximum distance (in radians) of results to return. * @return {AV.Query} Returns the query, so you can chain this call. */ withinRadians: function withinRadians(key, point, distance) { this.near(key, point); this._addCondition(key, '$maxDistance', distance); return this; }, /** * Add a proximity based constraint for finding objects with key point * values near the point given and within the maximum distance given. * Radius of earth used is 3958.8 miles. * @param {String} key The key that the AV.GeoPoint is stored in. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used. * @param {Number} maxDistance Maximum distance (in miles) of results to * return. * @return {AV.Query} Returns the query, so you can chain this call. */ withinMiles: function withinMiles(key, point, distance) { return this.withinRadians(key, point, distance / 3958.8); }, /** * Add a proximity based constraint for finding objects with key point * values near the point given and within the maximum distance given. * Radius of earth used is 6371.0 kilometers. * @param {String} key The key that the AV.GeoPoint is stored in. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used. * @param {Number} maxDistance Maximum distance (in kilometers) of results * to return. * @return {AV.Query} Returns the query, so you can chain this call. */ withinKilometers: function withinKilometers(key, point, distance) { return this.withinRadians(key, point, distance / 6371.0); }, /** * Add a constraint to the query that requires a particular key's * coordinates be contained within a given rectangular geographic bounding * box. * @param {String} key The key to be constrained. * @param {AV.GeoPoint} southwest * The lower-left inclusive corner of the box. * @param {AV.GeoPoint} northeast * The upper-right inclusive corner of the box. * @return {AV.Query} Returns the query, so you can chain this call. */ withinGeoBox: function withinGeoBox(key, southwest, northeast) { if (!(southwest instanceof AV.GeoPoint)) { southwest = new AV.GeoPoint(southwest); } if (!(northeast instanceof AV.GeoPoint)) { northeast = new AV.GeoPoint(northeast); } this._addCondition(key, '$within', { $box: [southwest, northeast] }); return this; }, /** * Include nested AV.Objects for the provided key. You can use dot * notation to specify which fields in the included object are also fetch. * @param {String[]} keys The name of the key to include. * @return {AV.Query} Returns the query, so you can chain this call. */ include: function include(keys) { var _this4 = this; requires(keys, 'undefined is not a valid key'); _.forEach(arguments, function (keys) { var _context; _this4._include = (0, _concat.default)(_context = _this4._include).call(_context, ensureArray(keys)); }); return this; }, /** * Include the ACL. * @param {Boolean} [value=true] Whether to include the ACL * @return {AV.Query} Returns the query, so you can chain this call. */ includeACL: function includeACL() { var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this._includeACL = value; return this; }, /** * Restrict the fields of the returned AV.Objects to include only the * provided keys. If this is called multiple times, then all of the keys * specified in each of the calls will be included. * @param {String[]} keys The names of the keys to include. * @return {AV.Query} Returns the query, so you can chain this call. */ select: function select(keys) { var _this5 = this; requires(keys, 'undefined is not a valid key'); _.forEach(arguments, function (keys) { var _context2; _this5._select = (0, _concat.default)(_context2 = _this5._select).call(_context2, ensureArray(keys)); }); return this; }, /** * Iterates over each result of a query, calling a callback for each one. If * the callback returns a promise, the iteration will not continue until * that promise has been fulfilled. If the callback returns a rejected * promise, then iteration will stop with that error. The items are * processed in an unspecified order. The query may not have any sort order, * and may not use limit or skip. * @param callback {Function} Callback that will be called with each result * of the query. * @return {Promise} A promise that will be fulfilled once the * iteration has completed. */ each: function each(callback) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (this._order || this._skip || this._limit >= 0) { var error = new Error('Cannot iterate on a query with sort, skip, or limit.'); return _promise.default.reject(error); } var query = new AV.Query(this.objectClass); // We can override the batch size from the options. // This is undocumented, but useful for testing. query._limit = options.batchSize || 100; query._where = _.clone(this._where); query._include = _.clone(this._include); query.ascending('objectId'); var finished = false; return continueWhile(function () { return !finished; }, function () { return (0, _find.default)(query).call(query, options).then(function (results) { var callbacksDone = _promise.default.resolve(); _.each(results, function (result) { callbacksDone = callbacksDone.then(function () { return callback(result); }); }); return callbacksDone.then(function () { if (results.length >= query._limit) { query.greaterThan('objectId', results[results.length - 1].id); } else { finished = true; } }); }); }); }, /** * Subscribe the changes of this query. * * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}. * * @since 3.0.0 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates; */ subscribe: function subscribe(options) { return AV.LiveQuery.init(this, options); } }); AV.FriendShipQuery = AV.Query._extend({ _newObject: function _newObject() { var UserClass = AV.Object._getSubclass('_User'); return new UserClass(); }, _processResult: function _processResult(json) { if (json && json[this._friendshipTag]) { var user = json[this._friendshipTag]; if (user.__type === 'Pointer' && user.className === '_User') { delete user.__type; delete user.className; } return user; } else { return null; } } }); }; /***/ }), /* 559 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _keys = _interopRequireDefault(__webpack_require__(59)); var _ = __webpack_require__(3); var EventEmitter = __webpack_require__(235); var _require = __webpack_require__(30), inherits = _require.inherits; var _require2 = __webpack_require__(27), request = _require2.request; var subscribe = function subscribe(queryJSON, subscriptionId) { return request({ method: 'POST', path: '/LiveQuery/subscribe', data: { query: queryJSON, id: subscriptionId } }); }; module.exports = function (AV) { var requireRealtime = function requireRealtime() { if (!AV._config.realtime) { throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query'); } }; /** * @class * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query. * @since 3.0.0 */ AV.LiveQuery = inherits(EventEmitter, /** @lends AV.LiveQuery.prototype */ { constructor: function constructor(id, client, queryJSON, subscriptionId) { var _this = this; EventEmitter.apply(this); this.id = id; this._client = client; this._client.register(this); this._queryJSON = queryJSON; this._subscriptionId = subscriptionId; this._onMessage = this._dispatch.bind(this); this._onReconnect = function () { subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) { return console.error("LiveQuery resubscribe error: ".concat(error.message)); }); }; client.on('message', this._onMessage); client.on('reconnect', this._onReconnect); }, _dispatch: function _dispatch(message) { var _this2 = this; message.forEach(function (_ref) { var op = _ref.op, object = _ref.object, queryId = _ref.query_id, updatedKeys = _ref.updatedKeys; if (queryId !== _this2.id) return; var target = AV.parseJSON(_.extend({ __type: object.className === '_File' ? 'File' : 'Object' }, object)); if (updatedKeys) { /** * An existing AV.Object which fulfills the Query you subscribe is updated. * @event AV.LiveQuery#update * @param {AV.Object|AV.File} target updated object * @param {String[]} updatedKeys updated keys */ /** * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query. * @event AV.LiveQuery#enter * @param {AV.Object|AV.File} target updated object * @param {String[]} updatedKeys updated keys */ /** * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query. * @event AV.LiveQuery#leave * @param {AV.Object|AV.File} target updated object * @param {String[]} updatedKeys updated keys */ _this2.emit(op, target, updatedKeys); } else { /** * A new AV.Object which fulfills the Query you subscribe is created. * @event AV.LiveQuery#create * @param {AV.Object|AV.File} target updated object */ /** * An existing AV.Object which fulfills the Query you subscribe is deleted. * @event AV.LiveQuery#delete * @param {AV.Object|AV.File} target updated object */ _this2.emit(op, target); } }); }, /** * unsubscribe the query * * @return {Promise} */ unsubscribe: function unsubscribe() { var client = this._client; client.off('message', this._onMessage); client.off('reconnect', this._onReconnect); client.deregister(this); return request({ method: 'POST', path: '/LiveQuery/unsubscribe', data: { id: client.id, query_id: this.id } }); } }, /** @lends AV.LiveQuery */ { init: function init(query) { var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$subscriptionId = _ref2.subscriptionId, userDefinedSubscriptionId = _ref2$subscriptionId === void 0 ? AV._getSubscriptionId() : _ref2$subscriptionId; requireRealtime(); if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query'); return _promise.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) { return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) { var _query$_getParams = query._getParams(), where = _query$_getParams.where, keys = (0, _keys.default)(_query$_getParams), returnACL = _query$_getParams.returnACL; var queryJSON = { where: where, keys: keys, returnACL: returnACL, className: query.className }; var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) { var queryId = _ref3.query_id; return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId); }).finally(function () { liveQueryClient.deregister(promise); }); liveQueryClient.register(promise); return promise; }); }); }, /** * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background. * @static * @return void */ pause: function pause() { requireRealtime(); return AV._config.realtime.pause(); }, /** * Resume the LiveQuery connection. All subscriptions will be restored after reconnection. * @static * @return void */ resume: function resume() { requireRealtime(); return AV._config.realtime.resume(); } }); }; /***/ }), /* 560 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(3); var _require = __webpack_require__(30), tap = _require.tap; module.exports = function (AV) { /** * @class * @example * AV.Captcha.request().then(captcha => { * captcha.bind({ * textInput: 'code', // the id for textInput * image: 'captcha', * verifyButton: 'verify', * }, { * success: (validateCode) => {}, // next step * error: (error) => {}, // present error.message to user * }); * }); */ AV.Captcha = function Captcha(options, authOptions) { this._options = options; this._authOptions = authOptions; /** * The image url of the captcha * @type string */ this.url = undefined; /** * The captchaToken of the captcha. * @type string */ this.captchaToken = undefined; /** * The validateToken of the captcha. * @type string */ this.validateToken = undefined; }; /** * Refresh the captcha * @return {Promise.} a new capcha url */ AV.Captcha.prototype.refresh = function refresh() { var _this = this; return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) { var captchaToken = _ref.captchaToken, url = _ref.url; _.extend(_this, { captchaToken: captchaToken, url: url }); return url; }); }; /** * Verify the captcha * @param {String} code The code from user input * @return {Promise.} validateToken if the code is valid */ AV.Captcha.prototype.verify = function verify(code) { var _this2 = this; return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) { return _this2.validateToken = validateToken; })); }; if (false) { /** * Bind the captcha to HTMLElements. ONLY AVAILABLE in browsers. * @param [elements] * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element. * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element. * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element. * @param [callbacks] * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request. * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`. */ AV.Captcha.prototype.bind = function bind(_ref2, _ref3) { var _this3 = this; var textInput = _ref2.textInput, image = _ref2.image, verifyButton = _ref2.verifyButton; var success = _ref3.success, error = _ref3.error; if (typeof textInput === 'string') { textInput = document.getElementById(textInput); if (!textInput) throw new Error("textInput with id ".concat(textInput, " not found")); } if (typeof image === 'string') { image = document.getElementById(image); if (!image) throw new Error("image with id ".concat(image, " not found")); } if (typeof verifyButton === 'string') { verifyButton = document.getElementById(verifyButton); if (!verifyButton) throw new Error("verifyButton with id ".concat(verifyButton, " not found")); } this.__refresh = function () { return _this3.refresh().then(function (url) { image.src = url; if (textInput) { textInput.value = ''; textInput.focus(); } }).catch(function (err) { return console.warn("refresh captcha fail: ".concat(err.message)); }); }; if (image) { this.__image = image; image.src = this.url; image.addEventListener('click', this.__refresh); } this.__verify = function () { var code = textInput.value; _this3.verify(code).catch(function (err) { _this3.__refresh(); throw err; }).then(success, error).catch(function (err) { return console.warn("verify captcha fail: ".concat(err.message)); }); }; if (textInput && verifyButton) { this.__verifyButton = verifyButton; verifyButton.addEventListener('click', this.__verify); } }; /** * unbind the captcha from HTMLElements. ONLY AVAILABLE in browsers. */ AV.Captcha.prototype.unbind = function unbind() { if (this.__image) this.__image.removeEventListener('click', this.__refresh); if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify); }; } /** * Request a captcha * @param [options] * @param {Number} [options.width] width(px) of the captcha, ranged 60-200 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required. * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required. * @return {Promise.} */ AV.Captcha.request = function (options, authOptions) { var captcha = new AV.Captcha(options, authOptions); return captcha.refresh().then(function () { return captcha; }); }; }; /***/ }), /* 561 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _ = __webpack_require__(3); var _require = __webpack_require__(27), _request = _require._request, request = _require.request; module.exports = function (AV) { /** * Contains functions for calling and declaring *

* Some functions are only available from Cloud Code. *

* * @namespace * @borrows AV.Captcha.request as requestCaptcha */ AV.Cloud = AV.Cloud || {}; _.extend(AV.Cloud, /** @lends AV.Cloud */ { /** * Makes a call to a cloud function. * @param {String} name The function name. * @param {Object} [data] The parameters to send to the cloud function. * @param {AuthOptions} [options] * @return {Promise} A promise that will be resolved with the result * of the function. */ run: function run(name, data, options) { return request({ service: 'engine', method: 'POST', path: "/functions/".concat(name), data: AV._encode(data, null, true), authOptions: options }).then(function (resp) { return AV._decode(resp).result; }); }, /** * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object} * @param {String} name The function name. * @param {Object} [data] The parameters to send to the cloud function. * @param {AuthOptions} [options] * @return {Promise} A promise that will be resolved with the result of the function. */ rpc: function rpc(name, data, options) { if (_.isArray(data)) { return _promise.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK.")); } return request({ service: 'engine', method: 'POST', path: "/call/".concat(name), data: AV._encodeObjectOrArray(data), authOptions: options }).then(function (resp) { return AV._decode(resp).result; }); }, /** * Make a call to request server date time. * @return {Promise.} A promise that will be resolved with the result * of the function. * @since 0.5.9 */ getServerDate: function getServerDate() { return _request('date', null, null, 'GET').then(function (resp) { return AV._decode(resp); }); }, /** * Makes a call to request an sms code for operation verification. * @param {String|Object} data The mobile phone number string or a JSON * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc. * @param {String} data.mobilePhoneNumber * @param {String} [data.template] sms template name * @param {String} [data.sign] sms signature name * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call * @param {SMSAuthOptions} [options] * @return {Promise} A promise that will be resolved if the request succeed */ requestSmsCode: function requestSmsCode(data) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (_.isString(data)) { data = { mobilePhoneNumber: data }; } if (!data.mobilePhoneNumber) { throw new Error('Missing mobilePhoneNumber.'); } if (options.validateToken) { data = _.extend({}, data, { validate_token: options.validateToken }); } return _request('requestSmsCode', null, null, 'POST', data, options); }, /** * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode * @param {String} code The sms code sent by AV.Cloud.requestSmsCode * @param {phone} phone The mobile phoner number. * @return {Promise} A promise that will be resolved with the result * of the function. */ verifySmsCode: function verifySmsCode(code, phone) { if (!code) throw new Error('Missing sms code.'); var params = {}; if (_.isString(phone)) { params['mobilePhoneNumber'] = phone; } return _request('verifySmsCode', code, null, 'POST', params); }, _requestCaptcha: function _requestCaptcha(options, authOptions) { return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) { var url = _ref.captcha_url, captchaToken = _ref.captcha_token; return { captchaToken: captchaToken, url: url }; }); }, /** * Request a captcha. */ requestCaptcha: AV.Captcha.request, /** * Verify captcha code. This is the low-level API for captcha. * Checkout {@link AV.Captcha} for high abstract APIs. * @param {String} code the code from user input * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha} * @return {Promise.} validateToken if the code is valid */ verifyCaptcha: function verifyCaptcha(code, captchaToken) { return _request('verifyCaptcha', null, null, 'POST', { captcha_code: code, captcha_token: captchaToken }).then(function (_ref2) { var validateToken = _ref2.validate_token; return validateToken; }); } }); }; /***/ }), /* 562 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var request = __webpack_require__(27).request; module.exports = function (AV) { AV.Installation = AV.Object.extend('_Installation'); /** * @namespace */ AV.Push = AV.Push || {}; /** * Sends a push notification. * @param {Object} data The data of the push notification. * @param {String[]} [data.channels] An Array of channels to push to. * @param {Date} [data.push_time] A Date object for when to send the push. * @param {Date} [data.expiration_time] A Date object for when to expire * the push. * @param {Number} [data.expiration_interval] The seconds from now to expire the push. * @param {Number} [data.flow_control] The clients to notify per second * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match * a set of installations to push to. * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match * a set of installations to push to. * @param {Object} data.data The data to send as part of the push. More details: https://url.leanapp.cn/pushData * @param {AuthOptions} [options] * @return {Promise} */ AV.Push.send = function (data, options) { if (data.where) { data.where = data.where._getParams().where; } if (data.where && data.cql) { throw new Error("Both where and cql can't be set"); } if (data.push_time) { data.push_time = data.push_time.toJSON(); } if (data.expiration_time) { data.expiration_time = data.expiration_time.toJSON(); } if (data.expiration_time && data.expiration_interval) { throw new Error("Both expiration_time and expiration_interval can't be set"); } return request({ service: 'push', method: 'POST', path: '/push', data: data, authOptions: options }); }; }; /***/ }), /* 563 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _typeof2 = _interopRequireDefault(__webpack_require__(73)); var _ = __webpack_require__(3); var AVRequest = __webpack_require__(27)._request; var _require = __webpack_require__(30), getSessionToken = _require.getSessionToken; module.exports = function (AV) { var getUser = function getUser() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var sessionToken = getSessionToken(options); if (sessionToken) { return AV.User._fetchUserBySessionToken(getSessionToken(options)); } return AV.User.currentAsync(); }; var getUserPointer = function getUserPointer(options) { return getUser(options).then(function (currUser) { return AV.Object.createWithoutData('_User', currUser.id)._toPointer(); }); }; /** * Contains functions to deal with Status in LeanCloud. * @class */ AV.Status = function (imageUrl, message) { this.data = {}; this.inboxType = 'default'; this.query = null; if (imageUrl && (0, _typeof2.default)(imageUrl) === 'object') { this.data = imageUrl; } else { if (imageUrl) { this.data.image = imageUrl; } if (message) { this.data.message = message; } } return this; }; _.extend(AV.Status.prototype, /** @lends AV.Status.prototype */ { /** * Gets the value of an attribute in status data. * @param {String} attr The string name of an attribute. */ get: function get(attr) { return this.data[attr]; }, /** * Sets a hash of model attributes on the status data. * @param {String} key The key to set. * @param {any} value The value to give it. */ set: function set(key, value) { this.data[key] = value; return this; }, /** * Destroy this status,then it will not be avaiable in other user's inboxes. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the destroy * completes. */ destroy: function destroy(options) { if (!this.id) return _promise.default.reject(new Error('The status id is not exists.')); var request = AVRequest('statuses', null, this.id, 'DELETE', options); return request; }, /** * Cast the AV.Status object to an AV.Object pointer. * @return {AV.Object} A AV.Object pointer. */ toObject: function toObject() { if (!this.id) return null; return AV.Object.createWithoutData('_Status', this.id); }, _getDataJSON: function _getDataJSON() { var json = _.clone(this.data); return AV._encode(json); }, /** * Send a status by a AV.Query object. * @since 0.3.0 * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the send * completes. * @example * // send a status to male users * var status = new AVStatus('image url', 'a message'); * status.query = new AV.Query('_User'); * status.query.equalTo('gender', 'male'); * status.send().then(function(){ * //send status successfully. * }, function(err){ * //an error threw. * console.dir(err); * }); */ send: function send() { var _this = this; var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (!getSessionToken(options) && !AV.User.current()) { throw new Error('Please signin an user.'); } if (!this.query) { return AV.Status.sendStatusToFollowers(this, options); } return getUserPointer(options).then(function (currUser) { var query = _this.query._getParams(); query.className = _this.query.className; var data = {}; data.query = query; _this.data = _this.data || {}; _this.data.source = _this.data.source || currUser; data.data = _this._getDataJSON(); data.inboxType = _this.inboxType || 'default'; return AVRequest('statuses', null, null, 'POST', data, options); }).then(function (response) { _this.id = response.objectId; _this.createdAt = AV._parseDate(response.createdAt); return _this; }); }, _finishFetch: function _finishFetch(serverData) { this.id = serverData.objectId; this.createdAt = AV._parseDate(serverData.createdAt); this.updatedAt = AV._parseDate(serverData.updatedAt); this.messageId = serverData.messageId; delete serverData.messageId; delete serverData.objectId; delete serverData.createdAt; delete serverData.updatedAt; this.data = AV._decode(serverData); } }); /** * Send a status to current signined user's followers. * @since 0.3.0 * @param {AV.Status} status A status object to be send to followers. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the send * completes. * @example * var status = new AVStatus('image url', 'a message'); * AV.Status.sendStatusToFollowers(status).then(function(){ * //send status successfully. * }, function(err){ * //an error threw. * console.dir(err); * }); */ AV.Status.sendStatusToFollowers = function (status) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!getSessionToken(options) && !AV.User.current()) { throw new Error('Please signin an user.'); } return getUserPointer(options).then(function (currUser) { var query = {}; query.className = '_Follower'; query.keys = 'follower'; query.where = { user: currUser }; var data = {}; data.query = query; status.data = status.data || {}; status.data.source = status.data.source || currUser; data.data = status._getDataJSON(); data.inboxType = status.inboxType || 'default'; var request = AVRequest('statuses', null, null, 'POST', data, options); return request.then(function (response) { status.id = response.objectId; status.createdAt = AV._parseDate(response.createdAt); return status; }); }); }; /** *

Send a status from current signined user to other user's private status inbox.

* @since 0.3.0 * @param {AV.Status} status A status object to be send to followers. * @param {String} target The target user or user's objectId. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the send * completes. * @example * // send a private status to user '52e84e47e4b0f8de283b079b' * var status = new AVStatus('image url', 'a message'); * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){ * //send status successfully. * }, function(err){ * //an error threw. * console.dir(err); * }); */ AV.Status.sendPrivateStatus = function (status, target) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (!getSessionToken(options) && !AV.User.current()) { throw new Error('Please signin an user.'); } if (!target) { throw new Error('Invalid target user.'); } var userObjectId = _.isString(target) ? target : target.id; if (!userObjectId) { throw new Error('Invalid target user.'); } return getUserPointer(options).then(function (currUser) { var query = {}; query.className = '_User'; query.where = { objectId: userObjectId }; var data = {}; data.query = query; status.data = status.data || {}; status.data.source = status.data.source || currUser; data.data = status._getDataJSON(); data.inboxType = 'private'; status.inboxType = 'private'; var request = AVRequest('statuses', null, null, 'POST', data, options); return request.then(function (response) { status.id = response.objectId; status.createdAt = AV._parseDate(response.createdAt); return status; }); }); }; /** * Count unread statuses in someone's inbox. * @since 0.3.0 * @param {AV.User} owner The status owner. * @param {String} inboxType The inbox type, 'default' by default. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the count * completes. * @example * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){ * console.log(response.unread); //unread statuses number. * console.log(response.total); //total statuses number. * }); */ AV.Status.countUnreadStatuses = function (owner) { var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default'; var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (!_.isString(inboxType)) options = inboxType; if (!getSessionToken(options) && owner == null && !AV.User.current()) { throw new Error('Please signin an user or pass the owner objectId.'); } return _promise.default.resolve(owner || getUser(options)).then(function (owner) { var params = {}; params.inboxType = AV._encode(inboxType); params.owner = AV._encode(owner); return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options); }); }; /** * reset unread statuses count in someone's inbox. * @since 2.1.0 * @param {AV.User} owner The status owner. * @param {String} inboxType The inbox type, 'default' by default. * @param {AuthOptions} options * @return {Promise} A promise that is fulfilled when the reset * completes. * @example * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){ * console.log(response.unread); //unread statuses number. * console.log(response.total); //total statuses number. * }); */ AV.Status.resetUnreadCount = function (owner) { var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default'; var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (!_.isString(inboxType)) options = inboxType; if (!getSessionToken(options) && owner == null && !AV.User.current()) { throw new Error('Please signin an user or pass the owner objectId.'); } return _promise.default.resolve(owner || getUser(options)).then(function (owner) { var params = {}; params.inboxType = AV._encode(inboxType); params.owner = AV._encode(owner); return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options); }); }; /** * Create a status query to find someone's published statuses. * @since 0.3.0 * @param {AV.User} source The status source, typically the publisher. * @return {AV.Query} The query object for status. * @example * //Find current user's published statuses. * var query = AV.Status.statusQuery(AV.User.current()); * query.find().then(function(statuses){ * //process statuses * }); */ AV.Status.statusQuery = function (source) { var query = new AV.Query('_Status'); if (source) { query.equalTo('source', source); } return query; }; /** *

AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.

* @class */ AV.InboxQuery = AV.Query._extend( /** @lends AV.InboxQuery.prototype */ { _objectClass: AV.Status, _sinceId: 0, _maxId: 0, _inboxType: 'default', _owner: null, _newObject: function _newObject() { return new AV.Status(); }, _createRequest: function _createRequest(params, options) { return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses'); }, /** * Sets the messageId of results to skip before returning any results. * This is useful for pagination. * Default is zero. * @param {Number} n the mesage id. * @return {AV.InboxQuery} Returns the query, so you can chain this call. */ sinceId: function sinceId(id) { this._sinceId = id; return this; }, /** * Sets the maximal messageId of results。 * This is useful for pagination. * Default is zero that is no limition. * @param {Number} n the mesage id. * @return {AV.InboxQuery} Returns the query, so you can chain this call. */ maxId: function maxId(id) { this._maxId = id; return this; }, /** * Sets the owner of the querying inbox. * @param {AV.User} owner The inbox owner. * @return {AV.InboxQuery} Returns the query, so you can chain this call. */ owner: function owner(_owner) { this._owner = _owner; return this; }, /** * Sets the querying inbox type.default is 'default'. * @param {String} type The inbox type. * @return {AV.InboxQuery} Returns the query, so you can chain this call. */ inboxType: function inboxType(type) { this._inboxType = type; return this; }, _getParams: function _getParams() { var params = AV.InboxQuery.__super__._getParams.call(this); params.owner = AV._encode(this._owner); params.inboxType = AV._encode(this._inboxType); params.sinceId = AV._encode(this._sinceId); params.maxId = AV._encode(this._maxId); return params; } }); /** * Create a inbox status query to find someone's inbox statuses. * @since 0.3.0 * @param {AV.User} owner The inbox's owner * @param {String} inboxType The inbox type,'default' by default. * @return {AV.InboxQuery} The inbox query object. * @see AV.InboxQuery * @example * //Find current user's default inbox statuses. * var query = AV.Status.inboxQuery(AV.User.current()); * //find the statuses after the last message id * query.sinceId(lastMessageId); * query.find().then(function(statuses){ * //process statuses * }); */ AV.Status.inboxQuery = function (owner, inboxType) { var query = new AV.InboxQuery(AV.Status); if (owner) { query._owner = owner; } if (inboxType) { query._inboxType = inboxType; } return query; }; }; /***/ }), /* 564 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _stringify = _interopRequireDefault(__webpack_require__(36)); var _map = _interopRequireDefault(__webpack_require__(35)); var _ = __webpack_require__(3); var AVRequest = __webpack_require__(27)._request; module.exports = function (AV) { /** * A builder to generate sort string for app searching.For example: * @class * @since 0.5.1 * @example * var builder = new AV.SearchSortBuilder(); * builder.ascending('key1').descending('key2','max'); * var query = new AV.SearchQuery('Player'); * query.sortBy(builder); * query.find().then(); */ AV.SearchSortBuilder = function () { this._sortFields = []; }; _.extend(AV.SearchSortBuilder.prototype, /** @lends AV.SearchSortBuilder.prototype */ { _addField: function _addField(key, order, mode, missing) { var field = {}; field[key] = { order: order || 'asc', mode: mode || 'avg', missing: '_' + (missing || 'last') }; this._sortFields.push(field); return this; }, /** * Sorts the results in ascending order by the given key and options. * * @param {String} key The key to order by. * @param {String} mode The sort mode, default is 'avg', you can choose * 'max' or 'min' too. * @param {String} missing The missing key behaviour, default is 'last', * you can choose 'first' too. * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call. */ ascending: function ascending(key, mode, missing) { return this._addField(key, 'asc', mode, missing); }, /** * Sorts the results in descending order by the given key and options. * * @param {String} key The key to order by. * @param {String} mode The sort mode, default is 'avg', you can choose * 'max' or 'min' too. * @param {String} missing The missing key behaviour, default is 'last', * you can choose 'first' too. * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call. */ descending: function descending(key, mode, missing) { return this._addField(key, 'desc', mode, missing); }, /** * Add a proximity based constraint for finding objects with key point * values near the point given. * @param {String} key The key that the AV.GeoPoint is stored in. * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used. * @param {Object} options The other options such as mode,order, unit etc. * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call. */ whereNear: function whereNear(key, point, options) { options = options || {}; var field = {}; var geo = { lat: point.latitude, lon: point.longitude }; var m = { order: options.order || 'asc', mode: options.mode || 'avg', unit: options.unit || 'km' }; m[key] = geo; field['_geo_distance'] = m; this._sortFields.push(field); return this; }, /** * Build a sort string by configuration. * @return {String} the sort string. */ build: function build() { return (0, _stringify.default)(AV._encode(this._sortFields)); } }); /** * App searching query.Use just like AV.Query: * * Visit App Searching Guide * for more details. * @class * @since 0.5.1 * @example * var query = new AV.SearchQuery('Player'); * query.queryString('*'); * query.find().then(function(results) { * console.log('Found %d objects', query.hits()); * //Process results * }); */ AV.SearchQuery = AV.Query._extend( /** @lends AV.SearchQuery.prototype */ { _sid: null, _hits: 0, _queryString: null, _highlights: null, _sortBuilder: null, _clazz: null, constructor: function constructor(className) { if (className) { this._clazz = className; } else { className = '__INVALID_CLASS'; } AV.Query.call(this, className); }, _createRequest: function _createRequest(params, options) { return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options); }, /** * Sets the sid of app searching query.Default is null. * @param {String} sid Scroll id for searching. * @return {AV.SearchQuery} Returns the query, so you can chain this call. */ sid: function sid(_sid) { this._sid = _sid; return this; }, /** * Sets the query string of app searching. * @param {String} q The query string. * @return {AV.SearchQuery} Returns the query, so you can chain this call. */ queryString: function queryString(q) { this._queryString = q; return this; }, /** * Sets the highlight fields. Such as *

     *   query.highlights('title');
     *   //or pass an array.
     *   query.highlights(['title', 'content'])
     * 
* @param {String|String[]} highlights a list of fields. * @return {AV.SearchQuery} Returns the query, so you can chain this call. */ highlights: function highlights(_highlights) { var objects; if (_highlights && _.isString(_highlights)) { objects = _.toArray(arguments); } else { objects = _highlights; } this._highlights = objects; return this; }, /** * Sets the sort builder for this query. * @see AV.SearchSortBuilder * @param { AV.SearchSortBuilder} builder The sort builder. * @return {AV.SearchQuery} Returns the query, so you can chain this call. * */ sortBy: function sortBy(builder) { this._sortBuilder = builder; return this; }, /** * Returns the number of objects that match this query. * @return {Number} */ hits: function hits() { if (!this._hits) { this._hits = 0; } return this._hits; }, _processResult: function _processResult(json) { delete json['className']; delete json['_app_url']; delete json['_deeplink']; return json; }, /** * Returns true when there are more documents can be retrieved by this * query instance, you can call find function to get more results. * @see AV.SearchQuery#find * @return {Boolean} */ hasMore: function hasMore() { return !this._hitEnd; }, /** * Reset current query instance state(such as sid, hits etc) except params * for a new searching. After resetting, hasMore() will return true. */ reset: function reset() { this._hitEnd = false; this._sid = null; this._hits = 0; }, /** * Retrieves a list of AVObjects that satisfy this query. * Either options.success or options.error is called when the find * completes. * * @see AV.Query#find * @param {AuthOptions} options * @return {Promise} A promise that is resolved with the results when * the query completes. */ find: function find(options) { var self = this; var request = this._createRequest(undefined, options); return request.then(function (response) { //update sid for next querying. if (response.sid) { self._oldSid = self._sid; self._sid = response.sid; } else { self._sid = null; self._hitEnd = true; } self._hits = response.hits || 0; return (0, _map.default)(_).call(_, response.results, function (json) { if (json.className) { response.className = json.className; } var obj = self._newObject(response); obj.appURL = json['_app_url']; obj._finishFetch(self._processResult(json), true); return obj; }); }); }, _getParams: function _getParams() { var params = AV.SearchQuery.__super__._getParams.call(this); delete params.where; if (this._clazz) { params.clazz = this.className; } if (this._sid) { params.sid = this._sid; } if (!this._queryString) { throw new Error('Please set query string.'); } else { params.q = this._queryString; } if (this._highlights) { params.highlights = this._highlights.join(','); } if (this._sortBuilder && params.order) { throw new Error('sort and order can not be set at same time.'); } if (this._sortBuilder) { params.sort = this._sortBuilder.build(); } return params; } }); }; /** * Sorts the results in ascending order by the given key. * * @method AV.SearchQuery#ascending * @param {String} key The key to order by. * @return {AV.SearchQuery} Returns the query, so you can chain this call. */ /** * Also sorts the results in ascending order by the given key. The previous sort keys have * precedence over this key. * * @method AV.SearchQuery#addAscending * @param {String} key The key to order by * @return {AV.SearchQuery} Returns the query so you can chain this call. */ /** * Sorts the results in descending order by the given key. * * @method AV.SearchQuery#descending * @param {String} key The key to order by. * @return {AV.SearchQuery} Returns the query, so you can chain this call. */ /** * Also sorts the results in descending order by the given key. The previous sort keys have * precedence over this key. * * @method AV.SearchQuery#addDescending * @param {String} key The key to order by * @return {AV.SearchQuery} Returns the query so you can chain this call. */ /** * Include nested AV.Objects for the provided key. You can use dot * notation to specify which fields in the included object are also fetch. * @method AV.SearchQuery#include * @param {String[]} keys The name of the key to include. * @return {AV.SearchQuery} Returns the query, so you can chain this call. */ /** * Sets the number of results to skip before returning any results. * This is useful for pagination. * Default is to skip zero results. * @method AV.SearchQuery#skip * @param {Number} n the number of results to skip. * @return {AV.SearchQuery} Returns the query, so you can chain this call. */ /** * Sets the limit of the number of results to return. The default limit is * 100, with a maximum of 1000 results being returned at a time. * @method AV.SearchQuery#limit * @param {Number} n the number of results to limit to. * @return {AV.SearchQuery} Returns the query, so you can chain this call. */ /***/ }), /* 565 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _ = __webpack_require__(3); var AVError = __webpack_require__(46); var _require = __webpack_require__(27), request = _require.request; module.exports = function (AV) { /** * 包含了使用了 LeanCloud * 离线数据分析功能的函数。 *

* 仅在云引擎运行环境下有效。 *

* @namespace */ AV.Insight = AV.Insight || {}; _.extend(AV.Insight, /** @lends AV.Insight */ { /** * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用 * AV.Insight.JobQuery 查询任务状态和结果。 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:
     *                   { "sql" : "select count(*) as c,gender from _User group by gender",
     *                     "saveAs": {
     *                         "className" : "UserGender",
     *                         "limit": 1
     *                      }
     *                   }
     *                  
* sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。 * @param {AuthOptions} [options] * @return {Promise} A promise that will be resolved with the result * of the function. */ startJob: function startJob(jobConfig, options) { if (!jobConfig || !jobConfig.sql) { throw new Error('Please provide the sql to run the job.'); } var data = { jobConfig: jobConfig, appId: AV.applicationId }; return request({ path: '/bigquery/jobs', method: 'POST', data: AV._encode(data, null, true), authOptions: options, signKey: false }).then(function (resp) { return AV._decode(resp).id; }); }, /** * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放) *

* 仅在云引擎运行环境下有效。 *

* @param {String} event 监听的事件,目前尚不支持。 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息, * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。 * */ on: function on(event, cb) {} }); /** * 创建一个对象,用于查询 Insight 任务状态和结果。 * @class * @param {String} id 任务 id * @since 0.5.5 */ AV.Insight.JobQuery = function (id, className) { if (!id) { throw new Error('Please provide the job id.'); } this.id = id; this.className = className; this._skip = 0; this._limit = 100; }; _.extend(AV.Insight.JobQuery.prototype, /** @lends AV.Insight.JobQuery.prototype */ { /** * Sets the number of results to skip before returning any results. * This is useful for pagination. * Default is to skip zero results. * @param {Number} n the number of results to skip. * @return {AV.Query} Returns the query, so you can chain this call. */ skip: function skip(n) { this._skip = n; return this; }, /** * Sets the limit of the number of results to return. The default limit is * 100, with a maximum of 1000 results being returned at a time. * @param {Number} n the number of results to limit to. * @return {AV.Query} Returns the query, so you can chain this call. */ limit: function limit(n) { this._limit = n; return this; }, /** * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数, * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间 * startTime、endTime 等信息。 * * @param {AuthOptions} [options] * @return {Promise} A promise that will be resolved with the result * of the function. * */ find: function find(options) { var params = { skip: this._skip, limit: this._limit }; return request({ path: "/bigquery/jobs/".concat(this.id), method: 'GET', query: params, authOptions: options, signKey: false }).then(function (response) { if (response.error) { return _promise.default.reject(new AVError(response.code, response.error)); } return _promise.default.resolve(response); }); } }); }; /***/ }), /* 566 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _ = __webpack_require__(3); var _require = __webpack_require__(27), LCRequest = _require.request; var _require2 = __webpack_require__(30), getSessionToken = _require2.getSessionToken; module.exports = function (AV) { var getUserWithSessionToken = function getUserWithSessionToken(authOptions) { if (authOptions.user) { if (!authOptions.user._sessionToken) { throw new Error('authOptions.user is not signed in.'); } return _promise.default.resolve(authOptions.user); } if (authOptions.sessionToken) { return AV.User._fetchUserBySessionToken(authOptions.sessionToken); } return AV.User.currentAsync(); }; var getSessionTokenAsync = function getSessionTokenAsync(authOptions) { var sessionToken = getSessionToken(authOptions); if (sessionToken) { return _promise.default.resolve(sessionToken); } return AV.User.currentAsync().then(function (user) { if (user) { return user.getSessionToken(); } }); }; /** * Contains functions to deal with Friendship in LeanCloud. * @class */ AV.Friendship = { /** * Request friendship. * @since 4.8.0 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend. * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow. * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery. * @param {AuthOptions} [authOptions] * @return {Promise} */ request: function request(options) { var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var friend; var attributes; if (options.friend) { friend = options.friend; attributes = options.attributes; } else { friend = options; } var friendObj = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend; return getUserWithSessionToken(authOptions).then(function (userObj) { if (!userObj) { throw new Error('Please signin an user.'); } return LCRequest({ method: 'POST', path: '/users/friendshipRequests', data: { user: userObj._toPointer(), friend: friendObj._toPointer(), friendship: attributes }, authOptions: authOptions }); }); }, /** * Accept a friendship request. * @since 4.8.0 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest. * @param {AV.Object} options.request The request (or it's objectId) to be accepted. * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}. * @param {AuthOptions} [authOptions] * @return {Promise} */ acceptRequest: function acceptRequest(options) { var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var request; var attributes; if (options.request) { request = options.request; attributes = options.attributes; } else { request = options; } var requestId = _.isString(request) ? request : request.id; return getSessionTokenAsync(authOptions).then(function (sessionToken) { if (!sessionToken) { throw new Error('Please signin an user.'); } return LCRequest({ method: 'PUT', path: '/users/friendshipRequests/' + requestId + '/accept', data: { friendship: AV._encode(attributes) }, authOptions: authOptions }); }); }, /** * Decline a friendship request. * @param {AV.Object | string} request The request (or it's objectId) to be declined. * @param {AuthOptions} [authOptions] * @return {Promise} */ declineRequest: function declineRequest(request) { var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var requestId = _.isString(request) ? request : request.id; return getSessionTokenAsync(authOptions).then(function (sessionToken) { if (!sessionToken) { throw new Error('Please signin an user.'); } return LCRequest({ method: 'PUT', path: '/users/friendshipRequests/' + requestId + '/decline', authOptions: authOptions }); }); } }; }; /***/ }), /* 567 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _stringify = _interopRequireDefault(__webpack_require__(36)); var _ = __webpack_require__(3); var _require = __webpack_require__(27), _request = _require._request; var AV = __webpack_require__(69); var serializeMessage = function serializeMessage(message) { if (typeof message === 'string') { return message; } if (typeof message.getPayload === 'function') { return (0, _stringify.default)(message.getPayload()); } return (0, _stringify.default)(message); }; /** *

An AV.Conversation is a local representation of a LeanCloud realtime's * conversation. This class is a subclass of AV.Object, and retains the * same functionality of an AV.Object, but also extends it with various * conversation specific methods, like get members, creators of this conversation. *

* * @class AV.Conversation * @param {String} name The name of the Role to create. * @param {Object} [options] * @param {Boolean} [options.isSystem] Set this conversation as system conversation. * @param {Boolean} [options.isTransient] Set this conversation as transient conversation. */ module.exports = AV.Object.extend('_Conversation', /** @lends AV.Conversation.prototype */ { constructor: function constructor(name) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; AV.Object.prototype.constructor.call(this, null, null); this.set('name', name); if (options.isSystem !== undefined) { this.set('sys', options.isSystem ? true : false); } if (options.isTransient !== undefined) { this.set('tr', options.isTransient ? true : false); } }, /** * Get current conversation's creator. * * @return {String} */ getCreator: function getCreator() { return this.get('c'); }, /** * Get the last message's time. * * @return {Date} */ getLastMessageAt: function getLastMessageAt() { return this.get('lm'); }, /** * Get this conversation's members * * @return {String[]} */ getMembers: function getMembers() { return this.get('m'); }, /** * Add a member to this conversation * * @param {String} member */ addMember: function addMember(member) { return this.add('m', member); }, /** * Get this conversation's members who set this conversation as muted. * * @return {String[]} */ getMutedMembers: function getMutedMembers() { return this.get('mu'); }, /** * Get this conversation's name field. * * @return String */ getName: function getName() { return this.get('name'); }, /** * Returns true if this conversation is transient conversation. * * @return {Boolean} */ isTransient: function isTransient() { return this.get('tr'); }, /** * Returns true if this conversation is system conversation. * * @return {Boolean} */ isSystem: function isSystem() { return this.get('sys'); }, /** * Send realtime message to this conversation, using HTTP request. * * @param {String} fromClient Sender's client id. * @param {String|Object} message The message which will send to conversation. * It could be a raw string, or an object with a `toJSON` method, like a * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息} * @param {Object} [options] * @param {Boolean} [options.transient] Whether send this message as transient message or not. * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation. * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容} * @param {AuthOptions} [authOptions] * @return {Promise} */ send: function send(fromClient, message) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var data = { from_peer: fromClient, conv_id: this.id, transient: false, message: serializeMessage(message) }; if (options.toClients !== undefined) { data.to_peers = options.toClients; } if (options.transient !== undefined) { data.transient = options.transient ? true : false; } if (options.pushData !== undefined) { data.push_data = options.pushData; } return _request('rtm', 'messages', null, 'POST', data, authOptions); }, /** * Send realtime broadcast message to all clients, via this conversation, using HTTP request. * * @param {String} fromClient Sender's client id. * @param {String|Object} message The message which will send to conversation. * It could be a raw string, or an object with a `toJSON` method, like a * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}. * @param {Object} [options] * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}. * @param {Object} [options.validTill] The message will valid till this time. * @param {AuthOptions} [authOptions] * @return {Promise} */ broadcast: function broadcast(fromClient, message) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var data = { from_peer: fromClient, conv_id: this.id, message: serializeMessage(message) }; if (options.pushData !== undefined) { data.push = options.pushData; } if (options.validTill !== undefined) { var ts = options.validTill; if (_.isDate(ts)) { ts = ts.getTime(); } options.valid_till = ts; } return _request('rtm', 'broadcast', null, 'POST', data, authOptions); } }); /***/ }), /* 568 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _promise = _interopRequireDefault(__webpack_require__(12)); var _map = _interopRequireDefault(__webpack_require__(35)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _ = __webpack_require__(3); var _require = __webpack_require__(27), request = _require.request; var _require2 = __webpack_require__(30), ensureArray = _require2.ensureArray, parseDate = _require2.parseDate; var AV = __webpack_require__(69); /** * The version change interval for Leaderboard * @enum */ AV.LeaderboardVersionChangeInterval = { NEVER: 'never', DAY: 'day', WEEK: 'week', MONTH: 'month' }; /** * The order of the leaderboard results * @enum */ AV.LeaderboardOrder = { ASCENDING: 'ascending', DESCENDING: 'descending' }; /** * The update strategy for Leaderboard * @enum */ AV.LeaderboardUpdateStrategy = { /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */ BETTER: 'better', /** Keep the last updated statistic */ LAST: 'last', /** Keep the sum of all updated statistics */ SUM: 'sum' }; /** * @typedef {Object} Ranking * @property {number} rank Starts at 0 * @property {number} value the statistic value of this ranking * @property {AV.User} user The user of this ranking * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()` */ /** * @typedef {Object} LeaderboardArchive * @property {string} statisticName * @property {number} version version of the leaderboard * @property {string} status * @property {string} url URL for the downloadable archive * @property {Date} activatedAt time when this version became active * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing */ /** * @class */ function Statistic(_ref) { var name = _ref.name, value = _ref.value, version = _ref.version; /** * @type {string} */ this.name = name; /** * @type {number} */ this.value = value; /** * @type {number?} */ this.version = version; } var parseStatisticData = function parseStatisticData(statisticData) { var _AV$_decode = AV._decode(statisticData), name = _AV$_decode.statisticName, value = _AV$_decode.statisticValue, version = _AV$_decode.version; return new Statistic({ name: name, value: value, version: version }); }; /** * @class */ AV.Leaderboard = function Leaderboard(statisticName) { /** * @type {string} */ this.statisticName = statisticName; /** * @type {AV.LeaderboardOrder} */ this.order = undefined; /** * @type {AV.LeaderboardUpdateStrategy} */ this.updateStrategy = undefined; /** * @type {AV.LeaderboardVersionChangeInterval} */ this.versionChangeInterval = undefined; /** * @type {number} */ this.version = undefined; /** * @type {Date?} */ this.nextResetAt = undefined; /** * @type {Date?} */ this.createdAt = undefined; }; var Leaderboard = AV.Leaderboard; /** * Create an instance of Leaderboard for the give statistic name. * @param {string} statisticName * @return {AV.Leaderboard} */ AV.Leaderboard.createWithoutData = function (statisticName) { return new Leaderboard(statisticName); }; /** * (masterKey required) Create a new Leaderboard. * @param {Object} options * @param {string} options.statisticName * @param {AV.LeaderboardOrder} options.order * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER * @param {AuthOptions} [authOptions] * @return {Promise} */ AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) { var statisticName = _ref2.statisticName, order = _ref2.order, versionChangeInterval = _ref2.versionChangeInterval, updateStrategy = _ref2.updateStrategy; return request({ method: 'POST', path: '/leaderboard/leaderboards', data: { statisticName: statisticName, order: order, versionChangeInterval: versionChangeInterval, updateStrategy: updateStrategy }, authOptions: authOptions }).then(function (data) { var leaderboard = new Leaderboard(statisticName); return leaderboard._finishFetch(data); }); }; /** * Get the Leaderboard with the specified statistic name. * @param {string} statisticName * @param {AuthOptions} [authOptions] * @return {Promise} */ AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) { return Leaderboard.createWithoutData(statisticName).fetch(authOptions); }; /** * Get Statistics for the specified user. * @param {AV.User} user The specified AV.User pointer. * @param {Object} [options] * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched. * @param {AuthOptions} [authOptions] * @return {Promise} */ AV.Leaderboard.getStatistics = function (user) { var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, statisticNames = _ref3.statisticNames; var authOptions = arguments.length > 2 ? arguments[2] : undefined; return _promise.default.resolve().then(function () { if (!(user && user.id)) throw new Error('user must be an AV.User'); return request({ method: 'GET', path: "/leaderboard/users/".concat(user.id, "/statistics"), query: { statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined }, authOptions: authOptions }).then(function (_ref4) { var results = _ref4.results; return (0, _map.default)(results).call(results, parseStatisticData); }); }); }; /** * Update Statistics for the specified user. * @param {AV.User} user The specified AV.User pointer. * @param {Object} statistics A name-value pair representing the statistics to update. * @param {AuthOptions} [options] AuthOptions plus: * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards * @return {Promise} */ AV.Leaderboard.updateStatistics = function (user, statistics) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return _promise.default.resolve().then(function () { if (!(user && user.id)) throw new Error('user must be an AV.User'); var data = (0, _map.default)(_).call(_, statistics, function (value, key) { return { statisticName: key, statisticValue: value }; }); var overwrite = options.overwrite; return request({ method: 'POST', path: "/leaderboard/users/".concat(user.id, "/statistics"), query: { overwrite: overwrite ? 1 : undefined }, data: data, authOptions: options }).then(function (_ref5) { var results = _ref5.results; return (0, _map.default)(results).call(results, parseStatisticData); }); }); }; /** * Delete Statistics for the specified user. * @param {AV.User} user The specified AV.User pointer. * @param {Object} statistics A name-value pair representing the statistics to delete. * @param {AuthOptions} [options] * @return {Promise} */ AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) { return _promise.default.resolve().then(function () { if (!(user && user.id)) throw new Error('user must be an AV.User'); return request({ method: 'DELETE', path: "/leaderboard/users/".concat(user.id, "/statistics"), query: { statistics: ensureArray(statisticNames).join(',') }, authOptions: authOptions }).then(function () { return undefined; }); }); }; _.extend(Leaderboard.prototype, /** @lends AV.Leaderboard.prototype */ { _finishFetch: function _finishFetch(data) { var _this = this; _.forEach(data, function (value, key) { if (key === 'updatedAt' || key === 'objectId') return; if (key === 'expiredAt') { key = 'nextResetAt'; } if (key === 'createdAt') { value = parseDate(value); } if (value && value.__type === 'Date') { value = parseDate(value.iso); } _this[key] = value; }); return this; }, /** * Fetch data from the srever. * @param {AuthOptions} [authOptions] * @return {Promise} */ fetch: function fetch(authOptions) { var _this2 = this; return request({ method: 'GET', path: "/leaderboard/leaderboards/".concat(this.statisticName), authOptions: authOptions }).then(function (data) { return _this2._finishFetch(data); }); }, /** * Counts the number of users participated in this leaderboard * @param {Object} [options] * @param {number} [options.version] Specify the version of the leaderboard * @param {AuthOptions} [authOptions] * @return {Promise} */ count: function count() { var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, version = _ref6.version; var authOptions = arguments.length > 1 ? arguments[1] : undefined; return request({ method: 'GET', path: "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks"), query: { count: 1, limit: 0, version: version }, authOptions: authOptions }).then(function (_ref7) { var count = _ref7.count; return count; }); }, _getResults: function _getResults(_ref8, authOptions, userId) { var _context; var skip = _ref8.skip, limit = _ref8.limit, selectUserKeys = _ref8.selectUserKeys, includeUserKeys = _ref8.includeUserKeys, includeStatistics = _ref8.includeStatistics, version = _ref8.version; return request({ method: 'GET', path: (0, _concat.default)(_context = "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks")).call(_context, userId ? "/".concat(userId) : ''), query: { skip: skip, limit: limit, selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined, includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined, includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined, version: version }, authOptions: authOptions }).then(function (_ref9) { var rankings = _ref9.results; return (0, _map.default)(rankings).call(rankings, function (rankingData) { var _AV$_decode2 = AV._decode(rankingData), user = _AV$_decode2.user, value = _AV$_decode2.statisticValue, rank = _AV$_decode2.rank, _AV$_decode2$statisti = _AV$_decode2.statistics, statistics = _AV$_decode2$statisti === void 0 ? [] : _AV$_decode2$statisti; return { user: user, value: value, rank: rank, includedStatistics: (0, _map.default)(statistics).call(statistics, parseStatisticData) }; }); }); }, /** * Retrieve a list of ranked users for this Leaderboard. * @param {Object} [options] * @param {number} [options.skip] The number of results to skip. This is useful for pagination. * @param {number} [options.limit] The limit of the number of results. * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value. * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings * @param {number} [options.version] Specify the version of the leaderboard * @param {AuthOptions} [authOptions] * @return {Promise} */ getResults: function getResults() { var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, skip = _ref10.skip, limit = _ref10.limit, selectUserKeys = _ref10.selectUserKeys, includeUserKeys = _ref10.includeUserKeys, includeStatistics = _ref10.includeStatistics, version = _ref10.version; var authOptions = arguments.length > 1 ? arguments[1] : undefined; return this._getResults({ skip: skip, limit: limit, selectUserKeys: selectUserKeys, includeUserKeys: includeUserKeys, includeStatistics: includeStatistics, version: version }, authOptions); }, /** * Retrieve a list of ranked users for this Leaderboard, centered on the specified user. * @param {AV.User} user The specified AV.User pointer. * @param {Object} [options] * @param {number} [options.limit] The limit of the number of results. * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value. * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings * @param {number} [options.version] Specify the version of the leaderboard * @param {AuthOptions} [authOptions] * @return {Promise} */ getResultsAroundUser: function getResultsAroundUser(user) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var authOptions = arguments.length > 2 ? arguments[2] : undefined; // getResultsAroundUser(options, authOptions) if (user && typeof user.id !== 'string') { return this.getResultsAroundUser(undefined, user, options); } var limit = options.limit, selectUserKeys = options.selectUserKeys, includeUserKeys = options.includeUserKeys, includeStatistics = options.includeStatistics, version = options.version; return this._getResults({ limit: limit, selectUserKeys: selectUserKeys, includeUserKeys: includeUserKeys, includeStatistics: includeStatistics, version: version }, authOptions, user ? user.id : 'self'); }, _update: function _update(data, authOptions) { var _this3 = this; return request({ method: 'PUT', path: "/leaderboard/leaderboards/".concat(this.statisticName), data: data, authOptions: authOptions }).then(function (result) { return _this3._finishFetch(result); }); }, /** * (masterKey required) Update the version change interval of the Leaderboard. * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval * @param {AuthOptions} [authOptions] * @return {Promise} */ updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) { return this._update({ versionChangeInterval: versionChangeInterval }, authOptions); }, /** * (masterKey required) Update the version change interval of the Leaderboard. * @param {AV.LeaderboardUpdateStrategy} updateStrategy * @param {AuthOptions} [authOptions] * @return {Promise} */ updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) { return this._update({ updateStrategy: updateStrategy }, authOptions); }, /** * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1. * @param {AuthOptions} [authOptions] * @return {Promise} */ reset: function reset(authOptions) { var _this4 = this; return request({ method: 'PUT', path: "/leaderboard/leaderboards/".concat(this.statisticName, "/incrementVersion"), authOptions: authOptions }).then(function (data) { return _this4._finishFetch(data); }); }, /** * (masterKey required) Delete the Leaderboard and its all archived versions. * @param {AuthOptions} [authOptions] * @return {void} */ destroy: function destroy(authOptions) { return AV.request({ method: 'DELETE', path: "/leaderboard/leaderboards/".concat(this.statisticName), authOptions: authOptions }).then(function () { return undefined; }); }, /** * (masterKey required) Get archived versions. * @param {Object} [options] * @param {number} [options.skip] The number of results to skip. This is useful for pagination. * @param {number} [options.limit] The limit of the number of results. * @param {AuthOptions} [authOptions] * @return {Promise} */ getArchives: function getArchives() { var _this5 = this; var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, skip = _ref11.skip, limit = _ref11.limit; var authOptions = arguments.length > 1 ? arguments[1] : undefined; return request({ method: 'GET', path: "/leaderboard/leaderboards/".concat(this.statisticName, "/archives"), query: { skip: skip, limit: limit }, authOptions: authOptions }).then(function (_ref12) { var results = _ref12.results; return (0, _map.default)(results).call(results, function (_ref13) { var version = _ref13.version, status = _ref13.status, url = _ref13.url, activatedAt = _ref13.activatedAt, deactivatedAt = _ref13.deactivatedAt; return { statisticName: _this5.statisticName, version: version, status: status, url: url, activatedAt: parseDate(activatedAt.iso), deactivatedAt: parseDate(deactivatedAt.iso) }; }); }); } }); /***/ }), /* 569 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _typeof2 = _interopRequireDefault(__webpack_require__(73)); var _defineProperty = _interopRequireDefault(__webpack_require__(92)); var _setPrototypeOf = _interopRequireDefault(__webpack_require__(238)); var _assign2 = _interopRequireDefault(__webpack_require__(152)); var _indexOf = _interopRequireDefault(__webpack_require__(71)); var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153)); var _promise = _interopRequireDefault(__webpack_require__(12)); var _symbol = _interopRequireDefault(__webpack_require__(149)); var _iterator = _interopRequireDefault(__webpack_require__(576)); var _weakMap = _interopRequireDefault(__webpack_require__(260)); var _keys = _interopRequireDefault(__webpack_require__(115)); var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151)); var _getPrototypeOf = _interopRequireDefault(__webpack_require__(147)); var _map = _interopRequireDefault(__webpack_require__(583)); (0, _defineProperty.default)(exports, '__esModule', { value: true }); /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var _extendStatics$ = function extendStatics$1(d, b) { _extendStatics$ = _setPrototypeOf.default || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; } }; return _extendStatics$(d, b); }; function __extends$1(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); _extendStatics$(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var _assign = function __assign() { _assign = _assign2.default || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } } return t; }; return _assign.apply(this, arguments); }; function __rest(s, e) { var t = {}; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && (0, _indexOf.default)(e).call(e, p) < 0) t[p] = s[p]; } if (s != null && typeof _getOwnPropertySymbols.default === "function") for (var i = 0, p = (0, _getOwnPropertySymbols.default)(s); i < p.length; i++) { if ((0, _indexOf.default)(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = _promise.default))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function sent() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof _symbol.default === "function" && (g[_iterator.default] = function () { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) { try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var PROVIDER = "lc_weapp"; var PLATFORM = "weixin"; function getLoginCode() { return new _promise.default(function (resolve, reject) { wx.login({ success: function success(res) { return res.code ? resolve(res.code) : reject(new Error(res.errMsg)); }, fail: function fail(_a) { var errMsg = _a.errMsg; return reject(new Error(errMsg)); } }); }); } var getAuthInfo = function getAuthInfo(_a) { var _b = _a === void 0 ? {} : _a, _c = _b.platform, platform = _c === void 0 ? PLATFORM : _c, _d = _b.preferUnionId, preferUnionId = _d === void 0 ? false : _d, _e = _b.asMainAccount, asMainAccount = _e === void 0 ? false : _e; return __awaiter(this, void 0, void 0, function () { var code, authData; return __generator(this, function (_f) { switch (_f.label) { case 0: return [4 /*yield*/ , getLoginCode()]; case 1: code = _f.sent(); authData = { code: code }; if (preferUnionId) { authData.platform = platform; authData.main_account = asMainAccount; } return [2 /*return*/ , { authData: authData, platform: platform, provider: PROVIDER }]; } }); }); }; var storage = { getItem: function getItem(key) { return wx.getStorageSync(key); }, setItem: function setItem(key, value) { return wx.setStorageSync(key, value); }, removeItem: function removeItem(key) { return wx.removeStorageSync(key); }, clear: function clear() { return wx.clearStorageSync(); } }; /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var _extendStatics = function extendStatics(d, b) { _extendStatics = _setPrototypeOf.default || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var AbortError = /** @class */ function (_super) { __extends(AbortError, _super); function AbortError() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.name = "AbortError"; return _this; } return AbortError; }(Error); var request = function request(url, options) { if (options === void 0) { options = {}; } var method = options.method, data = options.data, headers = options.headers, signal = options.signal; if (signal === null || signal === void 0 ? void 0 : signal.aborted) { return _promise.default.reject(new AbortError("Request aborted")); } return new _promise.default(function (resolve, reject) { var task = wx.request({ url: url, method: method, data: data, header: headers, complete: function complete(res) { signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener); if (!res.statusCode) { reject(new Error(res.errMsg)); return; } resolve({ ok: !(res.statusCode >= 400), status: res.statusCode, headers: res.header, data: res.data }); } }); var abortListener = function abortListener() { reject(new AbortError("Request aborted")); task.abort(); }; signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener); }); }; var upload = function upload(url, file, options) { if (options === void 0) { options = {}; } var headers = options.headers, data = options.data, onprogress = options.onprogress, signal = options.signal; if (signal === null || signal === void 0 ? void 0 : signal.aborted) { return _promise.default.reject(new AbortError("Request aborted")); } if (!(file && file.data && file.data.uri)) { return _promise.default.reject(new TypeError("File data must be an object like { uri: localPath }.")); } return new _promise.default(function (resolve, reject) { var task = wx.uploadFile({ url: url, header: headers, filePath: file.data.uri, name: file.field, formData: data, success: function success(response) { var status = response.statusCode, data = response.data, rest = __rest(response, ["statusCode", "data"]); resolve(_assign(_assign({}, rest), { data: typeof data === "string" ? JSON.parse(data) : data, status: status, ok: !(status >= 400) })); }, fail: function fail(response) { reject(new Error(response.errMsg)); }, complete: function complete() { signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener); } }); var abortListener = function abortListener() { reject(new AbortError("Request aborted")); task.abort(); }; signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener); if (onprogress) { task.onProgressUpdate(function (event) { return onprogress({ loaded: event.totalBytesSent, total: event.totalBytesExpectedToSend, percent: event.progress }); }); } }); }; /** * @author Toru Nagashima * @copyright 2015 Toru Nagashima. All rights reserved. * See LICENSE file in root directory for full license. */ /** * @typedef {object} PrivateData * @property {EventTarget} eventTarget The event target. * @property {{type:string}} event The original event object. * @property {number} eventPhase The current event phase. * @property {EventTarget|null} currentTarget The current event target. * @property {boolean} canceled The flag to prevent default. * @property {boolean} stopped The flag to stop propagation. * @property {boolean} immediateStopped The flag to stop propagation immediately. * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null. * @property {number} timeStamp The unix time. * @private */ /** * Private data for event wrappers. * @type {WeakMap} * @private */ var privateData = new _weakMap.default(); /** * Cache for wrapper classes. * @type {WeakMap} * @private */ var wrappers = new _weakMap.default(); /** * Get private data. * @param {Event} event The event object to get private data. * @returns {PrivateData} The private data of the event. * @private */ function pd(event) { var retv = privateData.get(event); console.assert(retv != null, "'this' is expected an Event object, but got", event); return retv; } /** * https://dom.spec.whatwg.org/#set-the-canceled-flag * @param data {PrivateData} private data. */ function setCancelFlag(data) { if (data.passiveListener != null) { if (typeof console !== "undefined" && typeof console.error === "function") { console.error("Unable to preventDefault inside passive event listener invocation.", data.passiveListener); } return; } if (!data.event.cancelable) { return; } data.canceled = true; if (typeof data.event.preventDefault === "function") { data.event.preventDefault(); } } /** * @see https://dom.spec.whatwg.org/#interface-event * @private */ /** * The event wrapper. * @constructor * @param {EventTarget} eventTarget The event target of this dispatching. * @param {Event|{type:string}} event The original event to wrap. */ function Event(eventTarget, event) { privateData.set(this, { eventTarget: eventTarget, event: event, eventPhase: 2, currentTarget: eventTarget, canceled: false, stopped: false, immediateStopped: false, passiveListener: null, timeStamp: event.timeStamp || Date.now() }); // https://heycam.github.io/webidl/#Unforgeable (0, _defineProperty.default)(this, "isTrusted", { value: false, enumerable: true }); // Define accessors var keys = (0, _keys.default)(event); for (var i = 0; i < keys.length; ++i) { var key = keys[i]; if (!(key in this)) { (0, _defineProperty.default)(this, key, defineRedirectDescriptor(key)); } } } // Should be enumerable, but class methods are not enumerable. Event.prototype = { /** * The type of this event. * @type {string} */ get type() { return pd(this).event.type; }, /** * The target of this event. * @type {EventTarget} */ get target() { return pd(this).eventTarget; }, /** * The target of this event. * @type {EventTarget} */ get currentTarget() { return pd(this).currentTarget; }, /** * @returns {EventTarget[]} The composed path of this event. */ composedPath: function composedPath() { var currentTarget = pd(this).currentTarget; if (currentTarget == null) { return []; } return [currentTarget]; }, /** * Constant of NONE. * @type {number} */ get NONE() { return 0; }, /** * Constant of CAPTURING_PHASE. * @type {number} */ get CAPTURING_PHASE() { return 1; }, /** * Constant of AT_TARGET. * @type {number} */ get AT_TARGET() { return 2; }, /** * Constant of BUBBLING_PHASE. * @type {number} */ get BUBBLING_PHASE() { return 3; }, /** * The target of this event. * @type {number} */ get eventPhase() { return pd(this).eventPhase; }, /** * Stop event bubbling. * @returns {void} */ stopPropagation: function stopPropagation() { var data = pd(this); data.stopped = true; if (typeof data.event.stopPropagation === "function") { data.event.stopPropagation(); } }, /** * Stop event bubbling. * @returns {void} */ stopImmediatePropagation: function stopImmediatePropagation() { var data = pd(this); data.stopped = true; data.immediateStopped = true; if (typeof data.event.stopImmediatePropagation === "function") { data.event.stopImmediatePropagation(); } }, /** * The flag to be bubbling. * @type {boolean} */ get bubbles() { return Boolean(pd(this).event.bubbles); }, /** * The flag to be cancelable. * @type {boolean} */ get cancelable() { return Boolean(pd(this).event.cancelable); }, /** * Cancel this event. * @returns {void} */ preventDefault: function preventDefault() { setCancelFlag(pd(this)); }, /** * The flag to indicate cancellation state. * @type {boolean} */ get defaultPrevented() { return pd(this).canceled; }, /** * The flag to be composed. * @type {boolean} */ get composed() { return Boolean(pd(this).event.composed); }, /** * The unix time of this event. * @type {number} */ get timeStamp() { return pd(this).timeStamp; }, /** * The target of this event. * @type {EventTarget} * @deprecated */ get srcElement() { return pd(this).eventTarget; }, /** * The flag to stop event bubbling. * @type {boolean} * @deprecated */ get cancelBubble() { return pd(this).stopped; }, set cancelBubble(value) { if (!value) { return; } var data = pd(this); data.stopped = true; if (typeof data.event.cancelBubble === "boolean") { data.event.cancelBubble = true; } }, /** * The flag to indicate cancellation state. * @type {boolean} * @deprecated */ get returnValue() { return !pd(this).canceled; }, set returnValue(value) { if (!value) { setCancelFlag(pd(this)); } }, /** * Initialize this event object. But do nothing under event dispatching. * @param {string} type The event type. * @param {boolean} [bubbles=false] The flag to be possible to bubble up. * @param {boolean} [cancelable=false] The flag to be possible to cancel. * @deprecated */ initEvent: function initEvent() {// Do nothing. } }; // `constructor` is not enumerable. (0, _defineProperty.default)(Event.prototype, "constructor", { value: Event, configurable: true, writable: true }); // Ensure `event instanceof window.Event` is `true`. if (typeof window !== "undefined" && typeof window.Event !== "undefined") { (0, _setPrototypeOf.default)(Event.prototype, window.Event.prototype); // Make association for wrappers. wrappers.set(window.Event.prototype, Event); } /** * Get the property descriptor to redirect a given property. * @param {string} key Property name to define property descriptor. * @returns {PropertyDescriptor} The property descriptor to redirect the property. * @private */ function defineRedirectDescriptor(key) { return { get: function get() { return pd(this).event[key]; }, set: function set(value) { pd(this).event[key] = value; }, configurable: true, enumerable: true }; } /** * Get the property descriptor to call a given method property. * @param {string} key Property name to define property descriptor. * @returns {PropertyDescriptor} The property descriptor to call the method property. * @private */ function defineCallDescriptor(key) { return { value: function value() { var event = pd(this).event; return event[key].apply(event, arguments); }, configurable: true, enumerable: true }; } /** * Define new wrapper class. * @param {Function} BaseEvent The base wrapper class. * @param {Object} proto The prototype of the original event. * @returns {Function} The defined wrapper class. * @private */ function defineWrapper(BaseEvent, proto) { var keys = (0, _keys.default)(proto); if (keys.length === 0) { return BaseEvent; } /** CustomEvent */ function CustomEvent(eventTarget, event) { BaseEvent.call(this, eventTarget, event); } CustomEvent.prototype = Object.create(BaseEvent.prototype, { constructor: { value: CustomEvent, configurable: true, writable: true } }); // Define accessors. for (var i = 0; i < keys.length; ++i) { var key = keys[i]; if (!(key in BaseEvent.prototype)) { var descriptor = (0, _getOwnPropertyDescriptor.default)(proto, key); var isFunc = typeof descriptor.value === "function"; (0, _defineProperty.default)(CustomEvent.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key)); } } return CustomEvent; } /** * Get the wrapper class of a given prototype. * @param {Object} proto The prototype of the original event to get its wrapper. * @returns {Function} The wrapper class. * @private */ function getWrapper(proto) { if (proto == null || proto === Object.prototype) { return Event; } var wrapper = wrappers.get(proto); if (wrapper == null) { wrapper = defineWrapper(getWrapper((0, _getPrototypeOf.default)(proto)), proto); wrappers.set(proto, wrapper); } return wrapper; } /** * Wrap a given event to management a dispatching. * @param {EventTarget} eventTarget The event target of this dispatching. * @param {Object} event The event to wrap. * @returns {Event} The wrapper instance. * @private */ function wrapEvent(eventTarget, event) { var Wrapper = getWrapper((0, _getPrototypeOf.default)(event)); return new Wrapper(eventTarget, event); } /** * Get the immediateStopped flag of a given event. * @param {Event} event The event to get. * @returns {boolean} The flag to stop propagation immediately. * @private */ function isStopped(event) { return pd(event).immediateStopped; } /** * Set the current event phase of a given event. * @param {Event} event The event to set current target. * @param {number} eventPhase New event phase. * @returns {void} * @private */ function setEventPhase(event, eventPhase) { pd(event).eventPhase = eventPhase; } /** * Set the current target of a given event. * @param {Event} event The event to set current target. * @param {EventTarget|null} currentTarget New current target. * @returns {void} * @private */ function setCurrentTarget(event, currentTarget) { pd(event).currentTarget = currentTarget; } /** * Set a passive listener of a given event. * @param {Event} event The event to set current target. * @param {Function|null} passiveListener New passive listener. * @returns {void} * @private */ function setPassiveListener(event, passiveListener) { pd(event).passiveListener = passiveListener; } /** * @typedef {object} ListenerNode * @property {Function} listener * @property {1|2|3} listenerType * @property {boolean} passive * @property {boolean} once * @property {ListenerNode|null} next * @private */ /** * @type {WeakMap>} * @private */ var listenersMap = new _weakMap.default(); // Listener types var CAPTURE = 1; var BUBBLE = 2; var ATTRIBUTE = 3; /** * Check whether a given value is an object or not. * @param {any} x The value to check. * @returns {boolean} `true` if the value is an object. */ function isObject(x) { return x !== null && (0, _typeof2.default)(x) === "object"; //eslint-disable-line no-restricted-syntax } /** * Get listeners. * @param {EventTarget} eventTarget The event target to get. * @returns {Map} The listeners. * @private */ function getListeners(eventTarget) { var listeners = listenersMap.get(eventTarget); if (listeners == null) { throw new TypeError("'this' is expected an EventTarget object, but got another value."); } return listeners; } /** * Get the property descriptor for the event attribute of a given event. * @param {string} eventName The event name to get property descriptor. * @returns {PropertyDescriptor} The property descriptor. * @private */ function defineEventAttributeDescriptor(eventName) { return { get: function get() { var listeners = getListeners(this); var node = listeners.get(eventName); while (node != null) { if (node.listenerType === ATTRIBUTE) { return node.listener; } node = node.next; } return null; }, set: function set(listener) { if (typeof listener !== "function" && !isObject(listener)) { listener = null; // eslint-disable-line no-param-reassign } var listeners = getListeners(this); // Traverse to the tail while removing old value. var prev = null; var node = listeners.get(eventName); while (node != null) { if (node.listenerType === ATTRIBUTE) { // Remove old value. if (prev !== null) { prev.next = node.next; } else if (node.next !== null) { listeners.set(eventName, node.next); } else { listeners.delete(eventName); } } else { prev = node; } node = node.next; } // Add new value. if (listener !== null) { var newNode = { listener: listener, listenerType: ATTRIBUTE, passive: false, once: false, next: null }; if (prev === null) { listeners.set(eventName, newNode); } else { prev.next = newNode; } } }, configurable: true, enumerable: true }; } /** * Define an event attribute (e.g. `eventTarget.onclick`). * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite. * @param {string} eventName The event name to define. * @returns {void} */ function defineEventAttribute(eventTargetPrototype, eventName) { (0, _defineProperty.default)(eventTargetPrototype, "on".concat(eventName), defineEventAttributeDescriptor(eventName)); } /** * Define a custom EventTarget with event attributes. * @param {string[]} eventNames Event names for event attributes. * @returns {EventTarget} The custom EventTarget. * @private */ function defineCustomEventTarget(eventNames) { /** CustomEventTarget */ function CustomEventTarget() { EventTarget.call(this); } CustomEventTarget.prototype = Object.create(EventTarget.prototype, { constructor: { value: CustomEventTarget, configurable: true, writable: true } }); for (var i = 0; i < eventNames.length; ++i) { defineEventAttribute(CustomEventTarget.prototype, eventNames[i]); } return CustomEventTarget; } /** * EventTarget. * * - This is constructor if no arguments. * - This is a function which returns a CustomEventTarget constructor if there are arguments. * * For example: * * class A extends EventTarget {} * class B extends EventTarget("message") {} * class C extends EventTarget("message", "error") {} * class D extends EventTarget(["message", "error"]) {} */ function EventTarget() { /*eslint-disable consistent-return */ if (this instanceof EventTarget) { listenersMap.set(this, new _map.default()); return; } if (arguments.length === 1 && Array.isArray(arguments[0])) { return defineCustomEventTarget(arguments[0]); } if (arguments.length > 0) { var types = new Array(arguments.length); for (var i = 0; i < arguments.length; ++i) { types[i] = arguments[i]; } return defineCustomEventTarget(types); } throw new TypeError("Cannot call a class as a function"); /*eslint-enable consistent-return */ } // Should be enumerable, but class methods are not enumerable. EventTarget.prototype = { /** * Add a given listener to this event target. * @param {string} eventName The event name to add. * @param {Function} listener The listener to add. * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. * @returns {void} */ addEventListener: function addEventListener(eventName, listener, options) { if (listener == null) { return; } if (typeof listener !== "function" && !isObject(listener)) { throw new TypeError("'listener' should be a function or an object."); } var listeners = getListeners(this); var optionsIsObj = isObject(options); var capture = optionsIsObj ? Boolean(options.capture) : Boolean(options); var listenerType = capture ? CAPTURE : BUBBLE; var newNode = { listener: listener, listenerType: listenerType, passive: optionsIsObj && Boolean(options.passive), once: optionsIsObj && Boolean(options.once), next: null }; // Set it as the first node if the first node is null. var node = listeners.get(eventName); if (node === undefined) { listeners.set(eventName, newNode); return; } // Traverse to the tail while checking duplication.. var prev = null; while (node != null) { if (node.listener === listener && node.listenerType === listenerType) { // Should ignore duplication. return; } prev = node; node = node.next; } // Add it. prev.next = newNode; }, /** * Remove a given listener from this event target. * @param {string} eventName The event name to remove. * @param {Function} listener The listener to remove. * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. * @returns {void} */ removeEventListener: function removeEventListener(eventName, listener, options) { if (listener == null) { return; } var listeners = getListeners(this); var capture = isObject(options) ? Boolean(options.capture) : Boolean(options); var listenerType = capture ? CAPTURE : BUBBLE; var prev = null; var node = listeners.get(eventName); while (node != null) { if (node.listener === listener && node.listenerType === listenerType) { if (prev !== null) { prev.next = node.next; } else if (node.next !== null) { listeners.set(eventName, node.next); } else { listeners.delete(eventName); } return; } prev = node; node = node.next; } }, /** * Dispatch a given event. * @param {Event|{type:string}} event The event to dispatch. * @returns {boolean} `false` if canceled. */ dispatchEvent: function dispatchEvent(event) { if (event == null || typeof event.type !== "string") { throw new TypeError('"event.type" should be a string.'); } // If listeners aren't registered, terminate. var listeners = getListeners(this); var eventName = event.type; var node = listeners.get(eventName); if (node == null) { return true; } // Since we cannot rewrite several properties, so wrap object. var wrappedEvent = wrapEvent(this, event); // This doesn't process capturing phase and bubbling phase. // This isn't participating in a tree. var prev = null; while (node != null) { // Remove this listener if it's once if (node.once) { if (prev !== null) { prev.next = node.next; } else if (node.next !== null) { listeners.set(eventName, node.next); } else { listeners.delete(eventName); } } else { prev = node; } // Call this listener setPassiveListener(wrappedEvent, node.passive ? node.listener : null); if (typeof node.listener === "function") { try { node.listener.call(this, wrappedEvent); } catch (err) { if (typeof console !== "undefined" && typeof console.error === "function") { console.error(err); } } } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") { node.listener.handleEvent(wrappedEvent); } // Break if `event.stopImmediatePropagation` was called. if (isStopped(wrappedEvent)) { break; } node = node.next; } setPassiveListener(wrappedEvent, null); setEventPhase(wrappedEvent, 0); setCurrentTarget(wrappedEvent, null); return !wrappedEvent.defaultPrevented; } }; // `constructor` is not enumerable. (0, _defineProperty.default)(EventTarget.prototype, "constructor", { value: EventTarget, configurable: true, writable: true }); // Ensure `eventTarget instanceof window.EventTarget` is `true`. if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") { (0, _setPrototypeOf.default)(EventTarget.prototype, window.EventTarget.prototype); } var WS = /** @class */ function (_super) { __extends$1(WS, _super); function WS(url, protocol) { var _this = _super.call(this) || this; _this._readyState = WS.CLOSED; if (!url) { throw new TypeError("Failed to construct 'WebSocket': url required"); } _this._url = url; _this._protocol = protocol; return _this; } (0, _defineProperty.default)(WS.prototype, "url", { get: function get() { return this._url; }, enumerable: false, configurable: true }); (0, _defineProperty.default)(WS.prototype, "protocol", { get: function get() { return this._protocol; }, enumerable: false, configurable: true }); (0, _defineProperty.default)(WS.prototype, "readyState", { get: function get() { return this._readyState; }, enumerable: false, configurable: true }); WS.CONNECTING = 0; WS.OPEN = 1; WS.CLOSING = 2; WS.CLOSED = 3; return WS; }(EventTarget("open", "error", "message", "close")); var WechatWS = /** @class */ function (_super) { __extends$1(WechatWS, _super); function WechatWS(url, protocol) { var _this = _super.call(this, url, protocol) || this; if (protocol && !(wx.canIUse && wx.canIUse("connectSocket.object.protocols"))) { throw new Error("subprotocol not supported in weapp"); } _this._readyState = WS.CONNECTING; var errorHandler = function errorHandler(event) { _this._readyState = WS.CLOSED; _this.dispatchEvent({ type: "error", message: event.errMsg }); }; var socketTask = wx.connectSocket({ url: url, protocols: _this._protocol === undefined || Array.isArray(_this._protocol) ? _this._protocol : [_this._protocol], fail: function fail(error) { return setTimeout(function () { return errorHandler(error); }, 0); } }); _this._socketTask = socketTask; socketTask.onOpen(function () { _this._readyState = WS.OPEN; _this.dispatchEvent({ type: "open" }); }); socketTask.onError(errorHandler); socketTask.onMessage(function (event) { var data = event.data; _this.dispatchEvent({ data: data, type: "message" }); }); socketTask.onClose(function (event) { _this._readyState = WS.CLOSED; var code = event.code, reason = event.reason; _this.dispatchEvent({ code: code, reason: reason, type: "close" }); }); return _this; } WechatWS.prototype.close = function () { if (this.readyState === WS.CLOSED) return; if (this.readyState === WS.CONNECTING) { console.warn("close WebSocket which is connecting might not work"); } this._socketTask.close({}); }; WechatWS.prototype.send = function (data) { if (this.readyState !== WS.OPEN) { throw new Error("INVALID_STATE_ERR"); } if (!(typeof data === "string" || data instanceof ArrayBuffer)) { throw new TypeError("only String/ArrayBuffer supported"); } this._socketTask.send({ data: data }); }; return WechatWS; }(WS); var WebSocket = WechatWS; var platformInfo = { name: "Weapp" }; exports.WebSocket = WebSocket; exports.getAuthInfo = getAuthInfo; exports.platformInfo = platformInfo; exports.request = request; exports.storage = storage; exports.upload = upload; /***/ }), /* 570 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(571); module.exports = parent; /***/ }), /* 571 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(572); var path = __webpack_require__(5); module.exports = path.Object.assign; /***/ }), /* 572 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var assign = __webpack_require__(573); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign // eslint-disable-next-line es-x/no-object-assign -- required for testing $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, { assign: assign }); /***/ }), /* 573 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DESCRIPTORS = __webpack_require__(14); var uncurryThis = __webpack_require__(4); var call = __webpack_require__(15); var fails = __webpack_require__(2); var objectKeys = __webpack_require__(105); var getOwnPropertySymbolsModule = __webpack_require__(104); var propertyIsEnumerableModule = __webpack_require__(120); var toObject = __webpack_require__(34); var IndexedObject = __webpack_require__(95); // eslint-disable-next-line es-x/no-object-assign -- safe var $assign = Object.assign; // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing var defineProperty = Object.defineProperty; var concat = uncurryThis([].concat); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign module.exports = !$assign || fails(function () { // should have correct order of operations (Edge bug) if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', { enumerable: true, get: function () { defineProperty(this, 'b', { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug) var A = {}; var B = {}; // eslint-disable-next-line es-x/no-symbol -- safe var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` var T = toObject(target); var argumentsLength = arguments.length; var index = 1; var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; var propertyIsEnumerable = propertyIsEnumerableModule.f; while (argumentsLength > index) { var S = IndexedObject(arguments[index++]); var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S); var length = keys.length; var j = 0; var key; while (length > j) { key = keys[j++]; if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key]; } } return T; } : $assign; /***/ }), /* 574 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(575); module.exports = parent; /***/ }), /* 575 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(244); var path = __webpack_require__(5); module.exports = path.Object.getOwnPropertySymbols; /***/ }), /* 576 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(249); /***/ }), /* 577 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(578); __webpack_require__(39); module.exports = parent; /***/ }), /* 578 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(38); __webpack_require__(53); __webpack_require__(579); var path = __webpack_require__(5); module.exports = path.WeakMap; /***/ }), /* 579 */ /***/ (function(module, exports, __webpack_require__) { // TODO: Remove this module from `core-js@4` since it's replaced to module below __webpack_require__(580); /***/ }), /* 580 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(7); var uncurryThis = __webpack_require__(4); var defineBuiltIns = __webpack_require__(154); var InternalMetadataModule = __webpack_require__(94); var collection = __webpack_require__(155); var collectionWeak = __webpack_require__(582); var isObject = __webpack_require__(11); var isExtensible = __webpack_require__(261); var enforceInternalState = __webpack_require__(43).enforce; var NATIVE_WEAK_MAP = __webpack_require__(170); var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; var InternalWeakMap; var wrapper = function (init) { return function WeakMap() { return init(this, arguments.length ? arguments[0] : undefined); }; }; // `WeakMap` constructor // https://tc39.es/ecma262/#sec-weakmap-constructor var $WeakMap = collection('WeakMap', wrapper, collectionWeak); // IE11 WeakMap frozen keys fix // We can't use feature detection because it crash some old IE builds // https://github.com/zloirock/core-js/issues/485 if (NATIVE_WEAK_MAP && IS_IE11) { InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); InternalMetadataModule.enable(); var WeakMapPrototype = $WeakMap.prototype; var nativeDelete = uncurryThis(WeakMapPrototype['delete']); var nativeHas = uncurryThis(WeakMapPrototype.has); var nativeGet = uncurryThis(WeakMapPrototype.get); var nativeSet = uncurryThis(WeakMapPrototype.set); defineBuiltIns(WeakMapPrototype, { 'delete': function (key) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeDelete(this, key) || state.frozen['delete'](key); } return nativeDelete(this, key); }, has: function has(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) || state.frozen.has(key); } return nativeHas(this, key); }, get: function get(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); } return nativeGet(this, key); }, set: function set(key, value) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); } else nativeSet(this, key, value); return this; } }); } /***/ }), /* 581 */ /***/ (function(module, exports, __webpack_require__) { // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it var fails = __webpack_require__(2); module.exports = fails(function () { if (typeof ArrayBuffer == 'function') { var buffer = new ArrayBuffer(8); // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 }); } }); /***/ }), /* 582 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(4); var defineBuiltIns = __webpack_require__(154); var getWeakData = __webpack_require__(94).getWeakData; var anObject = __webpack_require__(20); var isObject = __webpack_require__(11); var anInstance = __webpack_require__(108); var iterate = __webpack_require__(42); var ArrayIterationModule = __webpack_require__(70); var hasOwn = __webpack_require__(13); var InternalStateModule = __webpack_require__(43); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; var find = ArrayIterationModule.find; var findIndex = ArrayIterationModule.findIndex; var splice = uncurryThis([].splice); var id = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function (store) { return store.frozen || (store.frozen = new UncaughtFrozenStore()); }; var UncaughtFrozenStore = function () { this.entries = []; }; var findUncaughtFrozen = function (store, key) { return find(store.entries, function (it) { return it[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function (key) { var entry = findUncaughtFrozen(this, key); if (entry) return entry[1]; }, has: function (key) { return !!findUncaughtFrozen(this, key); }, set: function (key, value) { var entry = findUncaughtFrozen(this, key); if (entry) entry[1] = value; else this.entries.push([key, value]); }, 'delete': function (key) { var index = findIndex(this.entries, function (it) { return it[0] === key; }); if (~index) splice(this.entries, index, 1); return !!~index; } }; module.exports = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, id: id++, frozen: undefined }); if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { var state = getInternalState(that); var data = getWeakData(anObject(key), true); if (data === true) uncaughtFrozenStore(state).set(key, value); else data[state.id] = value; return that; }; defineBuiltIns(Prototype, { // `{ WeakMap, WeakSet }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.delete // https://tc39.es/ecma262/#sec-weakset.prototype.delete 'delete': function (key) { var state = getInternalState(this); if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state)['delete'](key); return data && hasOwn(data, state.id) && delete data[state.id]; }, // `{ WeakMap, WeakSet }.prototype.has(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.has // https://tc39.es/ecma262/#sec-weakset.prototype.has has: function has(key) { var state = getInternalState(this); if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).has(key); return data && hasOwn(data, state.id); } }); defineBuiltIns(Prototype, IS_MAP ? { // `WeakMap.prototype.get(key)` method // https://tc39.es/ecma262/#sec-weakmap.prototype.get get: function get(key) { var state = getInternalState(this); if (isObject(key)) { var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).get(key); return data ? data[state.id] : undefined; } }, // `WeakMap.prototype.set(key, value)` method // https://tc39.es/ecma262/#sec-weakmap.prototype.set set: function set(key, value) { return define(this, key, value); } } : { // `WeakSet.prototype.add(value)` method // https://tc39.es/ecma262/#sec-weakset.prototype.add add: function add(value) { return define(this, value, true); } }); return Constructor; } }; /***/ }), /* 583 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(584); /***/ }), /* 584 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(585); __webpack_require__(39); module.exports = parent; /***/ }), /* 585 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(38); __webpack_require__(586); __webpack_require__(53); __webpack_require__(55); var path = __webpack_require__(5); module.exports = path.Map; /***/ }), /* 586 */ /***/ (function(module, exports, __webpack_require__) { // TODO: Remove this module from `core-js@4` since it's replaced to module below __webpack_require__(587); /***/ }), /* 587 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var collection = __webpack_require__(155); var collectionStrong = __webpack_require__(263); // `Map` constructor // https://tc39.es/ecma262/#sec-map-objects collection('Map', function (init) { return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); /***/ }), /* 588 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _require = __webpack_require__(156), Realtime = _require.Realtime, setRTMAdapters = _require.setAdapters; var _require2 = __webpack_require__(664), LiveQueryPlugin = _require2.LiveQueryPlugin; Realtime.__preRegisteredPlugins = [LiveQueryPlugin]; module.exports = function (AV) { AV._sharedConfig.liveQueryRealtime = Realtime; var setAdapters = AV.setAdapters; AV.setAdapters = function (adapters) { setAdapters(adapters); setRTMAdapters(adapters); }; return AV; }; /***/ }), /* 589 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { var _interopRequireDefault = __webpack_require__(1); var _typeof3 = _interopRequireDefault(__webpack_require__(73)); var _defineProperty2 = _interopRequireDefault(__webpack_require__(92)); var _freeze = _interopRequireDefault(__webpack_require__(590)); var _assign = _interopRequireDefault(__webpack_require__(152)); var _symbol = _interopRequireDefault(__webpack_require__(149)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _keys = _interopRequireDefault(__webpack_require__(115)); var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153)); var _filter = _interopRequireDefault(__webpack_require__(250)); var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(151)); var _getOwnPropertyDescriptors = _interopRequireDefault(__webpack_require__(594)); var _defineProperties = _interopRequireDefault(__webpack_require__(598)); var _promise = _interopRequireDefault(__webpack_require__(12)); var _slice = _interopRequireDefault(__webpack_require__(61)); var _indexOf = _interopRequireDefault(__webpack_require__(71)); var _weakMap = _interopRequireDefault(__webpack_require__(260)); var _stringify = _interopRequireDefault(__webpack_require__(36)); var _map = _interopRequireDefault(__webpack_require__(35)); var _reduce = _interopRequireDefault(__webpack_require__(602)); var _find = _interopRequireDefault(__webpack_require__(93)); var _set = _interopRequireDefault(__webpack_require__(264)); var _context6, _context15; (0, _defineProperty2.default)(exports, '__esModule', { value: true }); function _interopDefault(ex) { return ex && (0, _typeof3.default)(ex) === 'object' && 'default' in ex ? ex['default'] : ex; } var protobufLight = _interopDefault(__webpack_require__(612)); var EventEmitter = _interopDefault(__webpack_require__(616)); var _regeneratorRuntime = _interopDefault(__webpack_require__(617)); var _asyncToGenerator = _interopDefault(__webpack_require__(619)); var _toConsumableArray = _interopDefault(__webpack_require__(620)); var _defineProperty = _interopDefault(__webpack_require__(623)); var _objectWithoutProperties = _interopDefault(__webpack_require__(624)); var _assertThisInitialized = _interopDefault(__webpack_require__(626)); var _inheritsLoose = _interopDefault(__webpack_require__(627)); var d = _interopDefault(__webpack_require__(60)); var shuffle = _interopDefault(__webpack_require__(628)); var values = _interopDefault(__webpack_require__(269)); var _toArray = _interopDefault(__webpack_require__(655)); var _createClass = _interopDefault(__webpack_require__(658)); var _applyDecoratedDescriptor = _interopDefault(__webpack_require__(659)); var StateMachine = _interopDefault(__webpack_require__(660)); var _typeof = _interopDefault(__webpack_require__(661)); var isPlainObject = _interopDefault(__webpack_require__(662)); var promiseTimeout = __webpack_require__(251); var messageCompiled = protobufLight.newBuilder({})['import']({ "package": 'push_server.messages2', syntax: 'proto2', options: { objc_class_prefix: 'AVIM' }, messages: [{ name: 'JsonObjectMessage', syntax: 'proto2', fields: [{ rule: 'required', type: 'string', name: 'data', id: 1 }] }, { name: 'UnreadTuple', syntax: 'proto2', fields: [{ rule: 'required', type: 'string', name: 'cid', id: 1 }, { rule: 'required', type: 'int32', name: 'unread', id: 2 }, { rule: 'optional', type: 'string', name: 'mid', id: 3 }, { rule: 'optional', type: 'int64', name: 'timestamp', id: 4 }, { rule: 'optional', type: 'string', name: 'from', id: 5 }, { rule: 'optional', type: 'string', name: 'data', id: 6 }, { rule: 'optional', type: 'int64', name: 'patchTimestamp', id: 7 }, { rule: 'optional', type: 'bool', name: 'mentioned', id: 8 }, { rule: 'optional', type: 'bytes', name: 'binaryMsg', id: 9 }, { rule: 'optional', type: 'int32', name: 'convType', id: 10 }] }, { name: 'LogItem', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'from', id: 1 }, { rule: 'optional', type: 'string', name: 'data', id: 2 }, { rule: 'optional', type: 'int64', name: 'timestamp', id: 3 }, { rule: 'optional', type: 'string', name: 'msgId', id: 4 }, { rule: 'optional', type: 'int64', name: 'ackAt', id: 5 }, { rule: 'optional', type: 'int64', name: 'readAt', id: 6 }, { rule: 'optional', type: 'int64', name: 'patchTimestamp', id: 7 }, { rule: 'optional', type: 'bool', name: 'mentionAll', id: 8 }, { rule: 'repeated', type: 'string', name: 'mentionPids', id: 9 }, { rule: 'optional', type: 'bool', name: 'bin', id: 10 }, { rule: 'optional', type: 'int32', name: 'convType', id: 11 }] }, { name: 'ConvMemberInfo', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'pid', id: 1 }, { rule: 'optional', type: 'string', name: 'role', id: 2 }, { rule: 'optional', type: 'string', name: 'infoId', id: 3 }] }, { name: 'DataCommand', syntax: 'proto2', fields: [{ rule: 'repeated', type: 'string', name: 'ids', id: 1 }, { rule: 'repeated', type: 'JsonObjectMessage', name: 'msg', id: 2 }, { rule: 'optional', type: 'bool', name: 'offline', id: 3 }] }, { name: 'SessionCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'int64', name: 't', id: 1 }, { rule: 'optional', type: 'string', name: 'n', id: 2 }, { rule: 'optional', type: 'string', name: 's', id: 3 }, { rule: 'optional', type: 'string', name: 'ua', id: 4 }, { rule: 'optional', type: 'bool', name: 'r', id: 5 }, { rule: 'optional', type: 'string', name: 'tag', id: 6 }, { rule: 'optional', type: 'string', name: 'deviceId', id: 7 }, { rule: 'repeated', type: 'string', name: 'sessionPeerIds', id: 8 }, { rule: 'repeated', type: 'string', name: 'onlineSessionPeerIds', id: 9 }, { rule: 'optional', type: 'string', name: 'st', id: 10 }, { rule: 'optional', type: 'int32', name: 'stTtl', id: 11 }, { rule: 'optional', type: 'int32', name: 'code', id: 12 }, { rule: 'optional', type: 'string', name: 'reason', id: 13 }, { rule: 'optional', type: 'string', name: 'deviceToken', id: 14 }, { rule: 'optional', type: 'bool', name: 'sp', id: 15 }, { rule: 'optional', type: 'string', name: 'detail', id: 16 }, { rule: 'optional', type: 'int64', name: 'lastUnreadNotifTime', id: 17 }, { rule: 'optional', type: 'int64', name: 'lastPatchTime', id: 18 }, { rule: 'optional', type: 'int64', name: 'configBitmap', id: 19 }] }, { name: 'ErrorCommand', syntax: 'proto2', fields: [{ rule: 'required', type: 'int32', name: 'code', id: 1 }, { rule: 'required', type: 'string', name: 'reason', id: 2 }, { rule: 'optional', type: 'int32', name: 'appCode', id: 3 }, { rule: 'optional', type: 'string', name: 'detail', id: 4 }, { rule: 'repeated', type: 'string', name: 'pids', id: 5 }, { rule: 'optional', type: 'string', name: 'appMsg', id: 6 }] }, { name: 'DirectCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'msg', id: 1 }, { rule: 'optional', type: 'string', name: 'uid', id: 2 }, { rule: 'optional', type: 'string', name: 'fromPeerId', id: 3 }, { rule: 'optional', type: 'int64', name: 'timestamp', id: 4 }, { rule: 'optional', type: 'bool', name: 'offline', id: 5 }, { rule: 'optional', type: 'bool', name: 'hasMore', id: 6 }, { rule: 'repeated', type: 'string', name: 'toPeerIds', id: 7 }, { rule: 'optional', type: 'bool', name: 'r', id: 10 }, { rule: 'optional', type: 'string', name: 'cid', id: 11 }, { rule: 'optional', type: 'string', name: 'id', id: 12 }, { rule: 'optional', type: 'bool', name: 'transient', id: 13 }, { rule: 'optional', type: 'string', name: 'dt', id: 14 }, { rule: 'optional', type: 'string', name: 'roomId', id: 15 }, { rule: 'optional', type: 'string', name: 'pushData', id: 16 }, { rule: 'optional', type: 'bool', name: 'will', id: 17 }, { rule: 'optional', type: 'int64', name: 'patchTimestamp', id: 18 }, { rule: 'optional', type: 'bytes', name: 'binaryMsg', id: 19 }, { rule: 'repeated', type: 'string', name: 'mentionPids', id: 20 }, { rule: 'optional', type: 'bool', name: 'mentionAll', id: 21 }, { rule: 'optional', type: 'int32', name: 'convType', id: 22 }] }, { name: 'AckCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'int32', name: 'code', id: 1 }, { rule: 'optional', type: 'string', name: 'reason', id: 2 }, { rule: 'optional', type: 'string', name: 'mid', id: 3 }, { rule: 'optional', type: 'string', name: 'cid', id: 4 }, { rule: 'optional', type: 'int64', name: 't', id: 5 }, { rule: 'optional', type: 'string', name: 'uid', id: 6 }, { rule: 'optional', type: 'int64', name: 'fromts', id: 7 }, { rule: 'optional', type: 'int64', name: 'tots', id: 8 }, { rule: 'optional', type: 'string', name: 'type', id: 9 }, { rule: 'repeated', type: 'string', name: 'ids', id: 10 }, { rule: 'optional', type: 'int32', name: 'appCode', id: 11 }, { rule: 'optional', type: 'string', name: 'appMsg', id: 12 }] }, { name: 'UnreadCommand', syntax: 'proto2', fields: [{ rule: 'repeated', type: 'UnreadTuple', name: 'convs', id: 1 }, { rule: 'optional', type: 'int64', name: 'notifTime', id: 2 }] }, { name: 'ConvCommand', syntax: 'proto2', fields: [{ rule: 'repeated', type: 'string', name: 'm', id: 1 }, { rule: 'optional', type: 'bool', name: 'transient', id: 2 }, { rule: 'optional', type: 'bool', name: 'unique', id: 3 }, { rule: 'optional', type: 'string', name: 'cid', id: 4 }, { rule: 'optional', type: 'string', name: 'cdate', id: 5 }, { rule: 'optional', type: 'string', name: 'initBy', id: 6 }, { rule: 'optional', type: 'string', name: 'sort', id: 7 }, { rule: 'optional', type: 'int32', name: 'limit', id: 8 }, { rule: 'optional', type: 'int32', name: 'skip', id: 9 }, { rule: 'optional', type: 'int32', name: 'flag', id: 10 }, { rule: 'optional', type: 'int32', name: 'count', id: 11 }, { rule: 'optional', type: 'string', name: 'udate', id: 12 }, { rule: 'optional', type: 'int64', name: 't', id: 13 }, { rule: 'optional', type: 'string', name: 'n', id: 14 }, { rule: 'optional', type: 'string', name: 's', id: 15 }, { rule: 'optional', type: 'bool', name: 'statusSub', id: 16 }, { rule: 'optional', type: 'bool', name: 'statusPub', id: 17 }, { rule: 'optional', type: 'int32', name: 'statusTTL', id: 18 }, { rule: 'optional', type: 'string', name: 'uniqueId', id: 19 }, { rule: 'optional', type: 'string', name: 'targetClientId', id: 20 }, { rule: 'optional', type: 'int64', name: 'maxReadTimestamp', id: 21 }, { rule: 'optional', type: 'int64', name: 'maxAckTimestamp', id: 22 }, { rule: 'optional', type: 'bool', name: 'queryAllMembers', id: 23 }, { rule: 'repeated', type: 'MaxReadTuple', name: 'maxReadTuples', id: 24 }, { rule: 'repeated', type: 'string', name: 'cids', id: 25 }, { rule: 'optional', type: 'ConvMemberInfo', name: 'info', id: 26 }, { rule: 'optional', type: 'bool', name: 'tempConv', id: 27 }, { rule: 'optional', type: 'int32', name: 'tempConvTTL', id: 28 }, { rule: 'repeated', type: 'string', name: 'tempConvIds', id: 29 }, { rule: 'repeated', type: 'string', name: 'allowedPids', id: 30 }, { rule: 'repeated', type: 'ErrorCommand', name: 'failedPids', id: 31 }, { rule: 'optional', type: 'string', name: 'next', id: 40 }, { rule: 'optional', type: 'JsonObjectMessage', name: 'results', id: 100 }, { rule: 'optional', type: 'JsonObjectMessage', name: 'where', id: 101 }, { rule: 'optional', type: 'JsonObjectMessage', name: 'attr', id: 103 }, { rule: 'optional', type: 'JsonObjectMessage', name: 'attrModified', id: 104 }] }, { name: 'RoomCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'roomId', id: 1 }, { rule: 'optional', type: 'string', name: 's', id: 2 }, { rule: 'optional', type: 'int64', name: 't', id: 3 }, { rule: 'optional', type: 'string', name: 'n', id: 4 }, { rule: 'optional', type: 'bool', name: 'transient', id: 5 }, { rule: 'repeated', type: 'string', name: 'roomPeerIds', id: 6 }, { rule: 'optional', type: 'string', name: 'byPeerId', id: 7 }] }, { name: 'LogsCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'cid', id: 1 }, { rule: 'optional', type: 'int32', name: 'l', id: 2 }, { rule: 'optional', type: 'int32', name: 'limit', id: 3 }, { rule: 'optional', type: 'int64', name: 't', id: 4 }, { rule: 'optional', type: 'int64', name: 'tt', id: 5 }, { rule: 'optional', type: 'string', name: 'tmid', id: 6 }, { rule: 'optional', type: 'string', name: 'mid', id: 7 }, { rule: 'optional', type: 'string', name: 'checksum', id: 8 }, { rule: 'optional', type: 'bool', name: 'stored', id: 9 }, { rule: 'optional', type: 'QueryDirection', name: 'direction', id: 10, options: { "default": 'OLD' } }, { rule: 'optional', type: 'bool', name: 'tIncluded', id: 11 }, { rule: 'optional', type: 'bool', name: 'ttIncluded', id: 12 }, { rule: 'optional', type: 'int32', name: 'lctype', id: 13 }, { rule: 'repeated', type: 'LogItem', name: 'logs', id: 105 }], enums: [{ name: 'QueryDirection', syntax: 'proto2', values: [{ name: 'OLD', id: 1 }, { name: 'NEW', id: 2 }] }] }, { name: 'RcpCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'id', id: 1 }, { rule: 'optional', type: 'string', name: 'cid', id: 2 }, { rule: 'optional', type: 'int64', name: 't', id: 3 }, { rule: 'optional', type: 'bool', name: 'read', id: 4 }, { rule: 'optional', type: 'string', name: 'from', id: 5 }] }, { name: 'ReadTuple', syntax: 'proto2', fields: [{ rule: 'required', type: 'string', name: 'cid', id: 1 }, { rule: 'optional', type: 'int64', name: 'timestamp', id: 2 }, { rule: 'optional', type: 'string', name: 'mid', id: 3 }] }, { name: 'MaxReadTuple', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'pid', id: 1 }, { rule: 'optional', type: 'int64', name: 'maxAckTimestamp', id: 2 }, { rule: 'optional', type: 'int64', name: 'maxReadTimestamp', id: 3 }] }, { name: 'ReadCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'cid', id: 1 }, { rule: 'repeated', type: 'string', name: 'cids', id: 2 }, { rule: 'repeated', type: 'ReadTuple', name: 'convs', id: 3 }] }, { name: 'PresenceCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'StatusType', name: 'status', id: 1 }, { rule: 'repeated', type: 'string', name: 'sessionPeerIds', id: 2 }, { rule: 'optional', type: 'string', name: 'cid', id: 3 }] }, { name: 'ReportCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'bool', name: 'initiative', id: 1 }, { rule: 'optional', type: 'string', name: 'type', id: 2 }, { rule: 'optional', type: 'string', name: 'data', id: 3 }] }, { name: 'PatchItem', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'cid', id: 1 }, { rule: 'optional', type: 'string', name: 'mid', id: 2 }, { rule: 'optional', type: 'int64', name: 'timestamp', id: 3 }, { rule: 'optional', type: 'bool', name: 'recall', id: 4 }, { rule: 'optional', type: 'string', name: 'data', id: 5 }, { rule: 'optional', type: 'int64', name: 'patchTimestamp', id: 6 }, { rule: 'optional', type: 'string', name: 'from', id: 7 }, { rule: 'optional', type: 'bytes', name: 'binaryMsg', id: 8 }, { rule: 'optional', type: 'bool', name: 'mentionAll', id: 9 }, { rule: 'repeated', type: 'string', name: 'mentionPids', id: 10 }, { rule: 'optional', type: 'int64', name: 'patchCode', id: 11 }, { rule: 'optional', type: 'string', name: 'patchReason', id: 12 }] }, { name: 'PatchCommand', syntax: 'proto2', fields: [{ rule: 'repeated', type: 'PatchItem', name: 'patches', id: 1 }, { rule: 'optional', type: 'int64', name: 'lastPatchTime', id: 2 }] }, { name: 'PubsubCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'cid', id: 1 }, { rule: 'repeated', type: 'string', name: 'cids', id: 2 }, { rule: 'optional', type: 'string', name: 'topic', id: 3 }, { rule: 'optional', type: 'string', name: 'subtopic', id: 4 }, { rule: 'repeated', type: 'string', name: 'topics', id: 5 }, { rule: 'repeated', type: 'string', name: 'subtopics', id: 6 }, { rule: 'optional', type: 'JsonObjectMessage', name: 'results', id: 7 }] }, { name: 'BlacklistCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'string', name: 'srcCid', id: 1 }, { rule: 'repeated', type: 'string', name: 'toPids', id: 2 }, { rule: 'optional', type: 'string', name: 'srcPid', id: 3 }, { rule: 'repeated', type: 'string', name: 'toCids', id: 4 }, { rule: 'optional', type: 'int32', name: 'limit', id: 5 }, { rule: 'optional', type: 'string', name: 'next', id: 6 }, { rule: 'repeated', type: 'string', name: 'blockedPids', id: 8 }, { rule: 'repeated', type: 'string', name: 'blockedCids', id: 9 }, { rule: 'repeated', type: 'string', name: 'allowedPids', id: 10 }, { rule: 'repeated', type: 'ErrorCommand', name: 'failedPids', id: 11 }, { rule: 'optional', type: 'int64', name: 't', id: 12 }, { rule: 'optional', type: 'string', name: 'n', id: 13 }, { rule: 'optional', type: 'string', name: 's', id: 14 }] }, { name: 'GenericCommand', syntax: 'proto2', fields: [{ rule: 'optional', type: 'CommandType', name: 'cmd', id: 1 }, { rule: 'optional', type: 'OpType', name: 'op', id: 2 }, { rule: 'optional', type: 'string', name: 'appId', id: 3 }, { rule: 'optional', type: 'string', name: 'peerId', id: 4 }, { rule: 'optional', type: 'int32', name: 'i', id: 5 }, { rule: 'optional', type: 'string', name: 'installationId', id: 6 }, { rule: 'optional', type: 'int32', name: 'priority', id: 7 }, { rule: 'optional', type: 'int32', name: 'service', id: 8 }, { rule: 'optional', type: 'int64', name: 'serverTs', id: 9 }, { rule: 'optional', type: 'int64', name: 'clientTs', id: 10 }, { rule: 'optional', type: 'int32', name: 'notificationType', id: 11 }, { rule: 'optional', type: 'DataCommand', name: 'dataMessage', id: 101 }, { rule: 'optional', type: 'SessionCommand', name: 'sessionMessage', id: 102 }, { rule: 'optional', type: 'ErrorCommand', name: 'errorMessage', id: 103 }, { rule: 'optional', type: 'DirectCommand', name: 'directMessage', id: 104 }, { rule: 'optional', type: 'AckCommand', name: 'ackMessage', id: 105 }, { rule: 'optional', type: 'UnreadCommand', name: 'unreadMessage', id: 106 }, { rule: 'optional', type: 'ReadCommand', name: 'readMessage', id: 107 }, { rule: 'optional', type: 'RcpCommand', name: 'rcpMessage', id: 108 }, { rule: 'optional', type: 'LogsCommand', name: 'logsMessage', id: 109 }, { rule: 'optional', type: 'ConvCommand', name: 'convMessage', id: 110 }, { rule: 'optional', type: 'RoomCommand', name: 'roomMessage', id: 111 }, { rule: 'optional', type: 'PresenceCommand', name: 'presenceMessage', id: 112 }, { rule: 'optional', type: 'ReportCommand', name: 'reportMessage', id: 113 }, { rule: 'optional', type: 'PatchCommand', name: 'patchMessage', id: 114 }, { rule: 'optional', type: 'PubsubCommand', name: 'pubsubMessage', id: 115 }, { rule: 'optional', type: 'BlacklistCommand', name: 'blacklistMessage', id: 116 }] }], enums: [{ name: 'CommandType', syntax: 'proto2', values: [{ name: 'session', id: 0 }, { name: 'conv', id: 1 }, { name: 'direct', id: 2 }, { name: 'ack', id: 3 }, { name: 'rcp', id: 4 }, { name: 'unread', id: 5 }, { name: 'logs', id: 6 }, { name: 'error', id: 7 }, { name: 'login', id: 8 }, { name: 'data', id: 9 }, { name: 'room', id: 10 }, { name: 'read', id: 11 }, { name: 'presence', id: 12 }, { name: 'report', id: 13 }, { name: 'echo', id: 14 }, { name: 'loggedin', id: 15 }, { name: 'logout', id: 16 }, { name: 'loggedout', id: 17 }, { name: 'patch', id: 18 }, { name: 'pubsub', id: 19 }, { name: 'blacklist', id: 20 }, { name: 'goaway', id: 21 }] }, { name: 'OpType', syntax: 'proto2', values: [{ name: 'open', id: 1 }, { name: 'add', id: 2 }, { name: 'remove', id: 3 }, { name: 'close', id: 4 }, { name: 'opened', id: 5 }, { name: 'closed', id: 6 }, { name: 'query', id: 7 }, { name: 'query_result', id: 8 }, { name: 'conflict', id: 9 }, { name: 'added', id: 10 }, { name: 'removed', id: 11 }, { name: 'refresh', id: 12 }, { name: 'refreshed', id: 13 }, { name: 'start', id: 30 }, { name: 'started', id: 31 }, { name: 'joined', id: 32 }, { name: 'members_joined', id: 33 }, { name: 'left', id: 39 }, { name: 'members_left', id: 40 }, { name: 'results', id: 42 }, { name: 'count', id: 43 }, { name: 'result', id: 44 }, { name: 'update', id: 45 }, { name: 'updated', id: 46 }, { name: 'mute', id: 47 }, { name: 'unmute', id: 48 }, { name: 'status', id: 49 }, { name: 'members', id: 50 }, { name: 'max_read', id: 51 }, { name: 'is_member', id: 52 }, { name: 'member_info_update', id: 53 }, { name: 'member_info_updated', id: 54 }, { name: 'member_info_changed', id: 55 }, { name: 'join', id: 80 }, { name: 'invite', id: 81 }, { name: 'leave', id: 82 }, { name: 'kick', id: 83 }, { name: 'reject', id: 84 }, { name: 'invited', id: 85 }, { name: 'kicked', id: 86 }, { name: 'upload', id: 100 }, { name: 'uploaded', id: 101 }, { name: 'subscribe', id: 120 }, { name: 'subscribed', id: 121 }, { name: 'unsubscribe', id: 122 }, { name: 'unsubscribed', id: 123 }, { name: 'is_subscribed', id: 124 }, { name: 'modify', id: 150 }, { name: 'modified', id: 151 }, { name: 'block', id: 170 }, { name: 'unblock', id: 171 }, { name: 'blocked', id: 172 }, { name: 'unblocked', id: 173 }, { name: 'members_blocked', id: 174 }, { name: 'members_unblocked', id: 175 }, { name: 'check_block', id: 176 }, { name: 'check_result', id: 177 }, { name: 'add_shutup', id: 180 }, { name: 'remove_shutup', id: 181 }, { name: 'query_shutup', id: 182 }, { name: 'shutup_added', id: 183 }, { name: 'shutup_removed', id: 184 }, { name: 'shutup_result', id: 185 }, { name: 'shutuped', id: 186 }, { name: 'unshutuped', id: 187 }, { name: 'members_shutuped', id: 188 }, { name: 'members_unshutuped', id: 189 }, { name: 'check_shutup', id: 190 }] }, { name: 'StatusType', syntax: 'proto2', values: [{ name: 'on', id: 1 }, { name: 'off', id: 2 }] }], isNamespace: true }).build(); var _messages$push_server = messageCompiled.push_server.messages2, JsonObjectMessage = _messages$push_server.JsonObjectMessage, UnreadTuple = _messages$push_server.UnreadTuple, LogItem = _messages$push_server.LogItem, DataCommand = _messages$push_server.DataCommand, SessionCommand = _messages$push_server.SessionCommand, ErrorCommand = _messages$push_server.ErrorCommand, DirectCommand = _messages$push_server.DirectCommand, AckCommand = _messages$push_server.AckCommand, UnreadCommand = _messages$push_server.UnreadCommand, ConvCommand = _messages$push_server.ConvCommand, RoomCommand = _messages$push_server.RoomCommand, LogsCommand = _messages$push_server.LogsCommand, RcpCommand = _messages$push_server.RcpCommand, ReadTuple = _messages$push_server.ReadTuple, MaxReadTuple = _messages$push_server.MaxReadTuple, ReadCommand = _messages$push_server.ReadCommand, PresenceCommand = _messages$push_server.PresenceCommand, ReportCommand = _messages$push_server.ReportCommand, GenericCommand = _messages$push_server.GenericCommand, BlacklistCommand = _messages$push_server.BlacklistCommand, PatchCommand = _messages$push_server.PatchCommand, PatchItem = _messages$push_server.PatchItem, ConvMemberInfo = _messages$push_server.ConvMemberInfo, CommandType = _messages$push_server.CommandType, OpType = _messages$push_server.OpType, StatusType = _messages$push_server.StatusType; var message = /*#__PURE__*/(0, _freeze.default)({ __proto__: null, JsonObjectMessage: JsonObjectMessage, UnreadTuple: UnreadTuple, LogItem: LogItem, DataCommand: DataCommand, SessionCommand: SessionCommand, ErrorCommand: ErrorCommand, DirectCommand: DirectCommand, AckCommand: AckCommand, UnreadCommand: UnreadCommand, ConvCommand: ConvCommand, RoomCommand: RoomCommand, LogsCommand: LogsCommand, RcpCommand: RcpCommand, ReadTuple: ReadTuple, MaxReadTuple: MaxReadTuple, ReadCommand: ReadCommand, PresenceCommand: PresenceCommand, ReportCommand: ReportCommand, GenericCommand: GenericCommand, BlacklistCommand: BlacklistCommand, PatchCommand: PatchCommand, PatchItem: PatchItem, ConvMemberInfo: ConvMemberInfo, CommandType: CommandType, OpType: OpType, StatusType: StatusType }); var adapters = {}; var getAdapter = function getAdapter(name) { var adapter = adapters[name]; if (adapter === undefined) { throw new Error("".concat(name, " adapter is not configured")); } return adapter; }; /** * 指定 Adapters * @function * @memberof module:leancloud-realtime * @param {Adapters} newAdapters Adapters 的类型请参考 {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} 中的定义 */ var setAdapters = function setAdapters(newAdapters) { (0, _assign.default)(adapters, newAdapters); }; /* eslint-disable */ var global$1 = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {}; var EXPIRED = (0, _symbol.default)('expired'); var debug = d('LC:Expirable'); var Expirable = /*#__PURE__*/function () { function Expirable(value, ttl) { this.originalValue = value; if (typeof ttl === 'number') { this.expiredAt = Date.now() + ttl; } } _createClass(Expirable, [{ key: "value", get: function get() { var expired = this.expiredAt && this.expiredAt <= Date.now(); if (expired) debug("expired: ".concat(this.originalValue)); return expired ? EXPIRED : this.originalValue; } }]); return Expirable; }(); Expirable.EXPIRED = EXPIRED; var debug$1 = d('LC:Cache'); var Cache = /*#__PURE__*/function () { function Cache() { var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'anonymous'; this.name = name; this._map = {}; } var _proto = Cache.prototype; _proto.get = function get(key) { var _context5; var cache = this._map[key]; if (cache) { var value = cache.value; if (value !== Expirable.EXPIRED) { debug$1('[%s] hit: %s', this.name, key); return value; } delete this._map[key]; } debug$1((0, _concat.default)(_context5 = "[".concat(this.name, "] missed: ")).call(_context5, key)); return null; }; _proto.set = function set(key, value, ttl) { debug$1('[%s] set: %s %d', this.name, key, ttl); this._map[key] = new Expirable(value, ttl); }; return Cache; }(); function ownKeys(object, enumerableOnly) { var keys = (0, _keys.default)(object); if (_getOwnPropertySymbols.default) { var symbols = (0, _getOwnPropertySymbols.default)(object); if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) { return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (_getOwnPropertyDescriptors.default) { (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source)); } else { ownKeys(Object(source)).forEach(function (key) { (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key)); }); } } return target; } /** * 调试日志控制器 * @const * @memberof module:leancloud-realtime * @example * debug.enable(); // 启用调试日志 * debug.disable(); // 关闭调试日志 */ var debug$2 = { enable: function enable() { var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'LC*'; return d.enable(namespaces); }, disable: d.disable }; var tryAll = function tryAll(promiseConstructors) { var promise = new _promise.default(promiseConstructors[0]); if (promiseConstructors.length === 1) { return promise; } return promise["catch"](function () { return tryAll((0, _slice.default)(promiseConstructors).call(promiseConstructors, 1)); }); }; // eslint-disable-next-line no-sequences var tap = function tap(interceptor) { return function (value) { return interceptor(value), value; }; }; var isIE10 = global$1.navigator && global$1.navigator.userAgent && (0, _indexOf.default)(_context6 = global$1.navigator.userAgent).call(_context6, 'MSIE 10.') !== -1; var map = new _weakMap.default(); // protected property helper var internal = function internal(object) { if (!map.has(object)) { map.set(object, {}); } return map.get(object); }; var compact = function compact(obj, filter) { if (!isPlainObject(obj)) return obj; var object = _objectSpread({}, obj); (0, _keys.default)(object).forEach(function (prop) { var value = object[prop]; if (value === filter) { delete object[prop]; } else { object[prop] = compact(value, filter); } }); return object; }; // debug utility var removeNull = function removeNull(obj) { return compact(obj, null); }; var trim = function trim(message) { return removeNull(JSON.parse((0, _stringify.default)(message))); }; var ensureArray = function ensureArray(target) { if (Array.isArray(target)) { return target; } if (target === undefined || target === null) { return []; } return [target]; }; var isWeapp = // eslint-disable-next-line no-undef (typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object' && typeof wx.connectSocket === 'function'; // throttle decorator var isCNApp = function isCNApp(appId) { return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI'; }; var equalBuffer = function equalBuffer(buffer1, buffer2) { if (!buffer1 || !buffer2) return false; if (buffer1.byteLength !== buffer2.byteLength) return false; var a = new Uint8Array(buffer1); var b = new Uint8Array(buffer2); return !a.some(function (value, index) { return value !== b[index]; }); }; var _class; function ownKeys$1(object, enumerableOnly) { var keys = (0, _keys.default)(object); if (_getOwnPropertySymbols.default) { var symbols = (0, _getOwnPropertySymbols.default)(object); if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) { return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (_getOwnPropertyDescriptors.default) { (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key)); }); } } return target; } var debug$3 = d('LC:WebSocketPlus'); var OPEN = 'open'; var DISCONNECT = 'disconnect'; var RECONNECT = 'reconnect'; var RETRY = 'retry'; var SCHEDULE = 'schedule'; var OFFLINE = 'offline'; var ONLINE = 'online'; var ERROR = 'error'; var MESSAGE = 'message'; var HEARTBEAT_TIME = 180000; var TIMEOUT_TIME = 380000; var DEFAULT_RETRY_STRATEGY = function DEFAULT_RETRY_STRATEGY(attempt) { return Math.min(1000 * Math.pow(2, attempt), 300000); }; var requireConnected = function requireConnected(target, name, descriptor) { return _objectSpread$1(_objectSpread$1({}, descriptor), {}, { value: function requireConnectedWrapper() { var _context7; var _descriptor$value; this.checkConnectionAvailability(name); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return (_descriptor$value = descriptor.value).call.apply(_descriptor$value, (0, _concat.default)(_context7 = [this]).call(_context7, args)); } }); }; var WebSocketPlus = (_class = /*#__PURE__*/function (_EventEmitter) { _inheritsLoose(WebSocketPlus, _EventEmitter); _createClass(WebSocketPlus, [{ key: "urls", get: function get() { return this._urls; }, set: function set(urls) { this._urls = ensureArray(urls); } }]); function WebSocketPlus(getUrls, protocol) { var _this; _this = _EventEmitter.call(this) || this; _this.init(); _this._protocol = protocol; _promise.default.resolve(typeof getUrls === 'function' ? getUrls() : getUrls).then(ensureArray).then(function (urls) { _this._urls = urls; return _this._open(); }).then(function () { _this.__postponeTimeoutTimer = _this._postponeTimeoutTimer.bind(_assertThisInitialized(_this)); if (global$1.addEventListener) { _this.__pause = function () { if (_this.can('pause')) _this.pause(); }; _this.__resume = function () { if (_this.can('resume')) _this.resume(); }; global$1.addEventListener('offline', _this.__pause); global$1.addEventListener('online', _this.__resume); } _this.open(); })["catch"](_this["throw"].bind(_assertThisInitialized(_this))); return _this; } var _proto = WebSocketPlus.prototype; _proto._open = function _open() { var _this2 = this; return this._createWs(this._urls, this._protocol).then(function (ws) { var _context8; var _this2$_urls = _toArray(_this2._urls), first = _this2$_urls[0], reset = (0, _slice.default)(_this2$_urls).call(_this2$_urls, 1); _this2._urls = (0, _concat.default)(_context8 = []).call(_context8, _toConsumableArray(reset), [first]); return ws; }); }; _proto._createWs = function _createWs(urls, protocol) { var _this3 = this; return tryAll((0, _map.default)(urls).call(urls, function (url) { return function (resolve, reject) { var _context9; debug$3((0, _concat.default)(_context9 = "connect [".concat(url, "] ")).call(_context9, protocol)); var WebSocket = getAdapter('WebSocket'); var ws = protocol ? new WebSocket(url, protocol) : new WebSocket(url); ws.binaryType = _this3.binaryType || 'arraybuffer'; ws.onopen = function () { return resolve(ws); }; ws.onclose = function (error) { if (error instanceof Error) { return reject(error); } // in browser, error event is useless return reject(new Error("Failed to connect [".concat(url, "]"))); }; ws.onerror = ws.onclose; }; })).then(function (ws) { _this3._ws = ws; _this3._ws.onclose = _this3._handleClose.bind(_this3); _this3._ws.onmessage = _this3._handleMessage.bind(_this3); return ws; }); }; _proto._destroyWs = function _destroyWs() { var ws = this._ws; if (!ws) return; ws.onopen = null; ws.onclose = null; ws.onerror = null; ws.onmessage = null; this._ws = null; ws.close(); } // eslint-disable-next-line class-methods-use-this ; _proto.onbeforeevent = function onbeforeevent(event, from, to) { var _context10, _context11; for (var _len2 = arguments.length, payload = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) { payload[_key2 - 3] = arguments[_key2]; } debug$3((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "".concat(event, ": ")).call(_context11, from, " -> ")).call(_context10, to, " %o"), payload); }; _proto.onopen = function onopen() { this.emit(OPEN); }; _proto.onconnected = function onconnected() { this._startConnectionKeeper(); }; _proto.onleaveconnected = function onleaveconnected(event, from, to) { this._stopConnectionKeeper(); this._destroyWs(); if (to === 'offline' || to === 'disconnected') { this.emit(DISCONNECT); } }; _proto.onpause = function onpause() { this.emit(OFFLINE); }; _proto.onbeforeresume = function onbeforeresume() { this.emit(ONLINE); }; _proto.onreconnect = function onreconnect() { this.emit(RECONNECT); }; _proto.ondisconnected = function ondisconnected(event, from, to) { var _context12; var _this4 = this; var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; var delay = from === OFFLINE ? 0 : DEFAULT_RETRY_STRATEGY.call(null, attempt); debug$3((0, _concat.default)(_context12 = "schedule attempt=".concat(attempt, " delay=")).call(_context12, delay)); this.emit(SCHEDULE, attempt, delay); if (this.__scheduledRetry) { clearTimeout(this.__scheduledRetry); } this.__scheduledRetry = setTimeout(function () { if (_this4.is('disconnected')) { _this4.retry(attempt); } }, delay); }; _proto.onretry = function onretry(event, from, to) { var _this5 = this; var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; this.emit(RETRY, attempt); this._open().then(function () { return _this5.can('reconnect') && _this5.reconnect(); }, function () { return _this5.can('fail') && _this5.fail(attempt + 1); }); }; _proto.onerror = function onerror(event, from, to, error) { this.emit(ERROR, error); }; _proto.onclose = function onclose() { if (global$1.removeEventListener) { if (this.__pause) global$1.removeEventListener('offline', this.__pause); if (this.__resume) global$1.removeEventListener('online', this.__resume); } }; _proto.checkConnectionAvailability = function checkConnectionAvailability() { var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'API'; if (!this.is('connected')) { var _context13; var currentState = this.current; console.warn((0, _concat.default)(_context13 = "".concat(name, " should not be called when the connection is ")).call(_context13, currentState)); if (this.is('disconnected') || this.is('reconnecting')) { console.warn('disconnect and reconnect event should be handled to avoid such calls.'); } throw new Error('Connection unavailable'); } } // jsdoc-ignore-start ; _proto. // jsdoc-ignore-end _ping = function _ping() { debug$3('ping'); try { this.ping(); } catch (error) { console.warn("websocket ping error: ".concat(error.message)); } }; _proto.ping = function ping() { if (this._ws.ping) { this._ws.ping(); } else { console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism."); } }; _proto._postponeTimeoutTimer = function _postponeTimeoutTimer() { var _this6 = this; debug$3('_postponeTimeoutTimer'); this._clearTimeoutTimers(); this._timeoutTimer = setTimeout(function () { debug$3('timeout'); _this6.disconnect(); }, TIMEOUT_TIME); }; _proto._clearTimeoutTimers = function _clearTimeoutTimers() { if (this._timeoutTimer) { clearTimeout(this._timeoutTimer); } }; _proto._startConnectionKeeper = function _startConnectionKeeper() { debug$3('start connection keeper'); this._heartbeatTimer = setInterval(this._ping.bind(this), HEARTBEAT_TIME); var addListener = this._ws.addListener || this._ws.addEventListener; if (!addListener) { debug$3('connection keeper disabled due to the lack of #addEventListener.'); return; } addListener.call(this._ws, 'message', this.__postponeTimeoutTimer); addListener.call(this._ws, 'pong', this.__postponeTimeoutTimer); this._postponeTimeoutTimer(); }; _proto._stopConnectionKeeper = function _stopConnectionKeeper() { debug$3('stop connection keeper'); // websockets/ws#489 var removeListener = this._ws.removeListener || this._ws.removeEventListener; if (removeListener) { removeListener.call(this._ws, 'message', this.__postponeTimeoutTimer); removeListener.call(this._ws, 'pong', this.__postponeTimeoutTimer); this._clearTimeoutTimers(); } if (this._heartbeatTimer) { clearInterval(this._heartbeatTimer); } }; _proto._handleClose = function _handleClose(event) { var _context14; debug$3((0, _concat.default)(_context14 = "ws closed [".concat(event.code, "] ")).call(_context14, event.reason)); // socket closed manually, ignore close event. if (this.isFinished()) return; this.handleClose(event); }; _proto.handleClose = function handleClose() { // reconnect this.disconnect(); } // jsdoc-ignore-start ; _proto. // jsdoc-ignore-end send = function send(data) { debug$3('send', data); this._ws.send(data); }; _proto._handleMessage = function _handleMessage(event) { debug$3('message', event.data); this.handleMessage(event.data); }; _proto.handleMessage = function handleMessage(message) { this.emit(MESSAGE, message); }; return WebSocketPlus; }(EventEmitter), (_applyDecoratedDescriptor(_class.prototype, "_ping", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_ping"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "send", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "send"), _class.prototype)), _class); StateMachine.create({ target: WebSocketPlus.prototype, initial: { state: 'initialized', event: 'init', defer: true }, terminal: 'closed', events: [{ name: 'open', from: 'initialized', to: 'connected' }, { name: 'disconnect', from: 'connected', to: 'disconnected' }, { name: 'retry', from: 'disconnected', to: 'reconnecting' }, { name: 'fail', from: 'reconnecting', to: 'disconnected' }, { name: 'reconnect', from: 'reconnecting', to: 'connected' }, { name: 'pause', from: ['connected', 'disconnected', 'reconnecting'], to: 'offline' }, {}, { name: 'resume', from: 'offline', to: 'disconnected' }, { name: 'close', from: ['connected', 'disconnected', 'reconnecting', 'offline'], to: 'closed' }, { name: 'throw', from: '*', to: 'error' }] }); var error = (0, _freeze.default)({ 1000: { name: 'CLOSE_NORMAL' }, 1006: { name: 'CLOSE_ABNORMAL' }, 4100: { name: 'APP_NOT_AVAILABLE', message: 'App not exists or realtime message service is disabled.' }, 4102: { name: 'SIGNATURE_FAILED', message: 'Login signature mismatch.' }, 4103: { name: 'INVALID_LOGIN', message: 'Malformed clientId.' }, 4105: { name: 'SESSION_REQUIRED', message: 'Message sent before session opened.' }, 4107: { name: 'READ_TIMEOUT' }, 4108: { name: 'LOGIN_TIMEOUT' }, 4109: { name: 'FRAME_TOO_LONG' }, 4110: { name: 'INVALID_ORIGIN', message: 'Access denied by domain whitelist.' }, 4111: { name: 'SESSION_CONFLICT' }, 4112: { name: 'SESSION_TOKEN_EXPIRED' }, 4113: { name: 'APP_QUOTA_EXCEEDED', message: 'The daily active users limit exceeded.' }, 4116: { name: 'MESSAGE_SENT_QUOTA_EXCEEDED', message: 'Command sent too fast.' }, 4200: { name: 'INTERNAL_ERROR', message: 'Internal error, please contact LeanCloud for support.' }, 4301: { name: 'CONVERSATION_API_FAILED', message: 'Upstream Conversatoin API failed, see error.detail for details.' }, 4302: { name: 'CONVERSATION_SIGNATURE_FAILED', message: 'Conversation action signature mismatch.' }, 4303: { name: 'CONVERSATION_NOT_FOUND' }, 4304: { name: 'CONVERSATION_FULL' }, 4305: { name: 'CONVERSATION_REJECTED_BY_APP', message: 'Conversation action rejected by hook.' }, 4306: { name: 'CONVERSATION_UPDATE_FAILED' }, 4307: { name: 'CONVERSATION_READ_ONLY' }, 4308: { name: 'CONVERSATION_NOT_ALLOWED' }, 4309: { name: 'CONVERSATION_UPDATE_REJECTED', message: 'Conversation update rejected because the client is not a member.' }, 4310: { name: 'CONVERSATION_QUERY_FAILED', message: 'Conversation query failed because it is too expansive.' }, 4311: { name: 'CONVERSATION_LOG_FAILED' }, 4312: { name: 'CONVERSATION_LOG_REJECTED', message: 'Message query rejected because the client is not a member of the conversation.' }, 4313: { name: 'SYSTEM_CONVERSATION_REQUIRED' }, 4314: { name: 'NORMAL_CONVERSATION_REQUIRED' }, 4315: { name: 'CONVERSATION_BLACKLISTED', message: 'Blacklisted in the conversation.' }, 4316: { name: 'TRANSIENT_CONVERSATION_REQUIRED' }, 4317: { name: 'CONVERSATION_MEMBERSHIP_REQUIRED' }, 4318: { name: 'CONVERSATION_API_QUOTA_EXCEEDED', message: 'LeanCloud API quota exceeded. You may upgrade your plan.' }, 4323: { name: 'TEMPORARY_CONVERSATION_EXPIRED', message: 'Temporary conversation expired or does not exist.' }, 4401: { name: 'INVALID_MESSAGING_TARGET', message: 'Conversation does not exist or client is not a member.' }, 4402: { name: 'MESSAGE_REJECTED_BY_APP', message: 'Message rejected by hook.' }, 4403: { name: 'MESSAGE_OWNERSHIP_REQUIRED' }, 4404: { name: 'MESSAGE_NOT_FOUND' }, 4405: { name: 'MESSAGE_UPDATE_REJECTED_BY_APP', message: 'Message update rejected by hook.' }, 4406: { name: 'MESSAGE_EDIT_DISABLED' }, 4407: { name: 'MESSAGE_RECALL_DISABLED' }, 5130: { name: 'OWNER_PROMOTION_NOT_ALLOWED', message: "Updating a member's role to owner is not allowed." } }); var ErrorCode = (0, _freeze.default)((0, _reduce.default)(_context15 = (0, _keys.default)(error)).call(_context15, function (result, code) { return (0, _assign.default)(result, _defineProperty({}, error[code].name, Number(code))); }, {})); var createError = function createError(_ref) { var code = _ref.code, reason = _ref.reason, appCode = _ref.appCode, detail = _ref.detail, errorMessage = _ref.error; var message = reason || detail || errorMessage; var name = reason; if (!message && error[code]) { name = error[code].name; message = error[code].message || name; } if (!message) { message = "Unknow Error: ".concat(code); } var err = new Error(message); return (0, _assign.default)(err, { code: code, appCode: appCode, detail: detail, name: name }); }; var debug$4 = d('LC:Connection'); var COMMAND_TIMEOUT = 20000; var EXPIRE = (0, _symbol.default)('expire'); var isIdempotentCommand = function isIdempotentCommand(command) { return !(command.cmd === CommandType.direct || command.cmd === CommandType.session && command.op === OpType.open || command.cmd === CommandType.conv && (command.op === OpType.start || command.op === OpType.update || command.op === OpType.members)); }; var Connection = /*#__PURE__*/function (_WebSocketPlus) { _inheritsLoose(Connection, _WebSocketPlus); function Connection(getUrl, _ref) { var _context16; var _this; var format = _ref.format, version = _ref.version; debug$4('initializing Connection'); var protocolString = (0, _concat.default)(_context16 = "lc.".concat(format, ".")).call(_context16, version); _this = _WebSocketPlus.call(this, getUrl, protocolString) || this; _this._protocolFormat = format; _this._commands = {}; _this._serialId = 0; return _this; } var _proto = Connection.prototype; _proto.send = /*#__PURE__*/function () { var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(command) { var _this2 = this; var waitingForRespond, buffer, serialId, duplicatedCommand, message, promise, _args = arguments; return _regeneratorRuntime.wrap(function _callee$(_context) { var _context17, _context18; while (1) { switch (_context.prev = _context.next) { case 0: waitingForRespond = _args.length > 1 && _args[1] !== undefined ? _args[1] : true; if (!waitingForRespond) { _context.next = 11; break; } if (!isIdempotentCommand(command)) { _context.next = 8; break; } buffer = command.toArrayBuffer(); duplicatedCommand = (0, _find.default)(_context17 = values(this._commands)).call(_context17, function (_ref2) { var targetBuffer = _ref2.buffer, targetCommand = _ref2.command; return targetCommand.cmd === command.cmd && targetCommand.op === command.op && equalBuffer(targetBuffer, buffer); }); if (!duplicatedCommand) { _context.next = 8; break; } console.warn((0, _concat.default)(_context18 = "Duplicated command [cmd:".concat(command.cmd, " op:")).call(_context18, command.op, "] is throttled.")); return _context.abrupt("return", duplicatedCommand.promise); case 8: this._serialId += 1; serialId = this._serialId; command.i = serialId; // eslint-disable-line no-param-reassign case 11: if (debug$4.enabled) debug$4('↑ %O sent', trim(command)); if (this._protocolFormat === 'proto2base64') { message = command.toBase64(); } else if (command.toArrayBuffer) { message = command.toArrayBuffer(); } if (message) { _context.next = 15; break; } throw new TypeError("".concat(command, " is not a GenericCommand")); case 15: _WebSocketPlus.prototype.send.call(this, message); if (waitingForRespond) { _context.next = 18; break; } return _context.abrupt("return", undefined); case 18: promise = new _promise.default(function (resolve, reject) { _this2._commands[serialId] = { command: command, buffer: buffer, resolve: resolve, reject: reject, timeout: setTimeout(function () { if (_this2._commands[serialId]) { var _context19; if (debug$4.enabled) debug$4('✗ %O timeout', trim(command)); reject(createError({ error: (0, _concat.default)(_context19 = "Command Timeout [cmd:".concat(command.cmd, " op:")).call(_context19, command.op, "]"), name: 'COMMAND_TIMEOUT' })); delete _this2._commands[serialId]; } }, COMMAND_TIMEOUT) }; }); this._commands[serialId].promise = promise; return _context.abrupt("return", promise); case 21: case "end": return _context.stop(); } } }, _callee, this); })); function send(_x) { return _send.apply(this, arguments); } return send; }(); _proto.handleMessage = function handleMessage(msg) { var message; try { message = GenericCommand.decode(msg); if (debug$4.enabled) debug$4('↓ %O received', trim(message)); } catch (e) { console.warn('Decode message failed:', e.message, msg); return; } var serialId = message.i; if (serialId) { if (this._commands[serialId]) { clearTimeout(this._commands[serialId].timeout); if (message.cmd === CommandType.error) { this._commands[serialId].reject(createError(message.errorMessage)); } else { this._commands[serialId].resolve(message); } delete this._commands[serialId]; } else { console.warn("Unexpected command received with serialId [".concat(serialId, "],\n which have timed out or never been requested.")); } } else { switch (message.cmd) { case CommandType.error: { this.emit(ERROR, createError(message.errorMessage)); return; } case CommandType.goaway: { this.emit(EXPIRE); return; } default: { this.emit(MESSAGE, message); } } } }; _proto.ping = function ping() { return this.send(new GenericCommand({ cmd: CommandType.echo }))["catch"](function (error) { return debug$4('ping failed:', error); }); }; return Connection; }(WebSocketPlus); var debug$5 = d('LC:request'); var request = function request(_ref) { var _ref$method = _ref.method, method = _ref$method === void 0 ? 'GET' : _ref$method, _url = _ref.url, query = _ref.query, headers = _ref.headers, data = _ref.data, time = _ref.timeout; var url = _url; if (query) { var _context20, _context21, _context23; var queryString = (0, _filter.default)(_context20 = (0, _map.default)(_context21 = (0, _keys.default)(query)).call(_context21, function (key) { var _context22; var value = query[key]; if (value === undefined) return undefined; var v = isPlainObject(value) ? (0, _stringify.default)(value) : value; return (0, _concat.default)(_context22 = "".concat(encodeURIComponent(key), "=")).call(_context22, encodeURIComponent(v)); })).call(_context20, function (qs) { return qs; }).join('&'); url = (0, _concat.default)(_context23 = "".concat(url, "?")).call(_context23, queryString); } debug$5('Req: %O %O %O', method, url, { headers: headers, data: data }); var request = getAdapter('request'); var promise = request(url, { method: method, headers: headers, data: data }).then(function (response) { if (response.ok === false) { var error = createError(response.data); error.response = response; throw error; } debug$5('Res: %O %O %O', url, response.status, response.data); return response.data; })["catch"](function (error) { if (error.response) { debug$5('Error: %O %O %O', url, error.response.status, error.response.data); } throw error; }); return time ? promiseTimeout.timeout(promise, time) : promise; }; var applyDecorators = function applyDecorators(decorators, target) { if (decorators) { decorators.forEach(function (decorator) { try { decorator(target); } catch (error) { if (decorator._pluginName) { error.message += "[".concat(decorator._pluginName, "]"); } throw error; } }); } }; var applyDispatcher = function applyDispatcher(dispatchers, payload) { var _context24; return (0, _reduce.default)(_context24 = ensureArray(dispatchers)).call(_context24, function (resultPromise, dispatcher) { return resultPromise.then(function (shouldDispatch) { return shouldDispatch === false ? false : dispatcher.apply(void 0, _toConsumableArray(payload)); })["catch"](function (error) { if (dispatcher._pluginName) { // eslint-disable-next-line no-param-reassign error.message += "[".concat(dispatcher._pluginName, "]"); } throw error; }); }, _promise.default.resolve(true)); }; var version = "5.0.0-rc.7"; function ownKeys$2(object, enumerableOnly) { var keys = (0, _keys.default)(object); if (_getOwnPropertySymbols.default) { var symbols = (0, _getOwnPropertySymbols.default)(object); if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) { return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (_getOwnPropertyDescriptors.default) { (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key)); }); } } return target; } var debug$6 = d('LC:Realtime'); var routerCache = new Cache('push-router'); var initializedApp = {}; var Realtime = /*#__PURE__*/function (_EventEmitter) { _inheritsLoose(Realtime, _EventEmitter); /** * @extends EventEmitter * @param {Object} options * @param {String} options.appId * @param {String} options.appKey (since 4.0.0) * @param {String|Object} [options.server] 指定服务器域名,中国节点应用此参数必填(since 4.0.0) * @param {Boolean} [options.noBinary=false] 设置 WebSocket 使用字符串格式收发消息(默认为二进制格式)。 * 适用于 WebSocket 实现不支持二进制数据格式的情况 * @param {Boolean} [options.ssl=true] 使用 wss 进行连接 * @param {String|String[]} [options.RTMServers] 指定私有部署的 RTM 服务器地址(since 4.0.0) * @param {Plugin[]} [options.plugins] 加载插件(since 3.1.0) */ function Realtime(_ref) { var _context25; var _this2; var plugins = _ref.plugins, options = _objectWithoutProperties(_ref, ["plugins"]); debug$6('initializing Realtime %s %O', version, options); _this2 = _EventEmitter.call(this) || this; var appId = options.appId; if (typeof appId !== 'string') { throw new TypeError("appId [".concat(appId, "] is not a string")); } if (initializedApp[appId]) { throw new Error("App [".concat(appId, "] is already initialized.")); } initializedApp[appId] = true; if (typeof options.appKey !== 'string') { throw new TypeError("appKey [".concat(options.appKey, "] is not a string")); } if (isCNApp(appId)) { if (!options.server) { throw new TypeError("server option is required for apps from CN region"); } } _this2._options = _objectSpread$2({ appId: undefined, appKey: undefined, noBinary: false, ssl: true, RTMServerName: typeof process !== 'undefined' ? process.env.RTM_SERVER_NAME : undefined }, options); _this2._cache = new Cache('endpoints'); var _this = internal(_assertThisInitialized(_this2)); _this.clients = new _set.default(); _this.pendingClients = new _set.default(); var mergedPlugins = (0, _concat.default)(_context25 = []).call(_context25, _toConsumableArray(ensureArray(Realtime.__preRegisteredPlugins)), _toConsumableArray(ensureArray(plugins))); debug$6('Using plugins %o', (0, _map.default)(mergedPlugins).call(mergedPlugins, function (plugin) { return plugin.name; })); _this2._plugins = (0, _reduce.default)(mergedPlugins).call(mergedPlugins, function (result, plugin) { (0, _keys.default)(plugin).forEach(function (hook) { if ({}.hasOwnProperty.call(plugin, hook) && hook !== 'name') { var _context26; if (plugin.name) { ensureArray(plugin[hook]).forEach(function (value) { // eslint-disable-next-line no-param-reassign value._pluginName = plugin.name; }); } // eslint-disable-next-line no-param-reassign result[hook] = (0, _concat.default)(_context26 = ensureArray(result[hook])).call(_context26, plugin[hook]); } }); return result; }, {}); // onRealtimeCreate hook applyDecorators(_this2._plugins.onRealtimeCreate, _assertThisInitialized(_this2)); return _this2; } var _proto = Realtime.prototype; _proto._request = /*#__PURE__*/function () { var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) { var method, _url, _ref2$version, version, path, query, headers, data, url, _this$_options, appId, server, _yield$this$construct, api; return _regeneratorRuntime.wrap(function _callee$(_context) { var _context27, _context28; while (1) { switch (_context.prev = _context.next) { case 0: method = _ref2.method, _url = _ref2.url, _ref2$version = _ref2.version, version = _ref2$version === void 0 ? '1.1' : _ref2$version, path = _ref2.path, query = _ref2.query, headers = _ref2.headers, data = _ref2.data; url = _url; if (url) { _context.next = 9; break; } _this$_options = this._options, appId = _this$_options.appId, server = _this$_options.server; _context.next = 6; return this.constructor._getServerUrls({ appId: appId, server: server }); case 6: _yield$this$construct = _context.sent; api = _yield$this$construct.api; url = (0, _concat.default)(_context27 = (0, _concat.default)(_context28 = "".concat(api, "/")).call(_context28, version)).call(_context27, path); case 9: return _context.abrupt("return", request({ url: url, method: method, query: query, headers: _objectSpread$2({ 'X-LC-Id': this._options.appId, 'X-LC-Key': this._options.appKey }, headers), data: data })); case 10: case "end": return _context.stop(); } } }, _callee, this); })); function _request(_x) { return _request2.apply(this, arguments); } return _request; }(); _proto._open = function _open() { var _this3 = this; if (this._openPromise) return this._openPromise; var format = 'protobuf2'; if (this._options.noBinary) { // 不发送 binary data,fallback to base64 string format = 'proto2base64'; } var version = 3; var protocol = { format: format, version: version }; this._openPromise = new _promise.default(function (resolve, reject) { debug$6('No connection established, create a new one.'); var connection = new Connection(function () { return _this3._getRTMServers(_this3._options); }, protocol); connection.on(OPEN, function () { return resolve(connection); }).on(ERROR, function (error) { delete _this3._openPromise; reject(error); }).on(EXPIRE, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() { return _regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: debug$6('Connection expired. Refresh endpoints.'); _this3._cache.set('endpoints', null, 0); _context2.next = 4; return _this3._getRTMServers(_this3._options); case 4: connection.urls = _context2.sent; connection.disconnect(); case 6: case "end": return _context2.stop(); } } }, _callee2); }))).on(MESSAGE, _this3._dispatchCommand.bind(_this3)); /** * 连接断开。 * 连接断开可能是因为 SDK 进入了离线状态(see {@link Realtime#event:OFFLINE}),或长时间没有收到服务器心跳。 * 连接断开后所有的网络操作都会失败,请在连接断开后禁用相关的 UI 元素。 * @event Realtime#DISCONNECT */ /** * 计划在一段时间后尝试重新连接 * @event Realtime#SCHEDULE * @param {Number} attempt 尝试重连的次数 * @param {Number} delay 延迟的毫秒数 */ /** * 正在尝试重新连接 * @event Realtime#RETRY * @param {Number} attempt 尝试重连的次数 */ /** * 连接恢复正常。 * 请重新启用在 {@link Realtime#event:DISCONNECT} 事件中禁用的相关 UI 元素 * @event Realtime#RECONNECT */ /** * 客户端连接断开 * @event IMClient#DISCONNECT * @see Realtime#event:DISCONNECT * @since 3.2.0 */ /** * 计划在一段时间后尝试重新连接 * @event IMClient#SCHEDULE * @param {Number} attempt 尝试重连的次数 * @param {Number} delay 延迟的毫秒数 * @since 3.2.0 */ /** * 正在尝试重新连接 * @event IMClient#RETRY * @param {Number} attempt 尝试重连的次数 * @since 3.2.0 */ /** * 客户端进入离线状态。 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用 * @event Realtime#OFFLINE * @since 3.4.0 */ /** * 客户端恢复在线状态 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用 * @event Realtime#ONLINE * @since 3.4.0 */ /** * 进入离线状态。 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用 * @event IMClient#OFFLINE * @since 3.4.0 */ /** * 恢复在线状态 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用 * @event IMClient#ONLINE * @since 3.4.0 */ // event proxy [DISCONNECT, RECONNECT, RETRY, SCHEDULE, OFFLINE, ONLINE].forEach(function (event) { return connection.on(event, function () { var _context29; for (var _len = arguments.length, payload = new Array(_len), _key = 0; _key < _len; _key++) { payload[_key] = arguments[_key]; } debug$6("".concat(event, " event emitted. %o"), payload); _this3.emit.apply(_this3, (0, _concat.default)(_context29 = [event]).call(_context29, payload)); if (event !== RECONNECT) { internal(_this3).clients.forEach(function (client) { var _context30; client.emit.apply(client, (0, _concat.default)(_context30 = [event]).call(_context30, payload)); }); } }); }); // override handleClose connection.handleClose = function handleClose(event) { var isFatal = [ErrorCode.APP_NOT_AVAILABLE, ErrorCode.INVALID_LOGIN, ErrorCode.INVALID_ORIGIN].some(function (errorCode) { return errorCode === event.code; }); if (isFatal) { // in these cases, SDK should throw. this["throw"](createError(event)); } else { // reconnect this.disconnect(); } }; internal(_this3).connection = connection; }); return this._openPromise; }; _proto._getRTMServers = /*#__PURE__*/function () { var _getRTMServers2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) { var info, cachedEndPoints, _info, server, secondary, ttl; return _regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: if (!options.RTMServers) { _context3.next = 2; break; } return _context3.abrupt("return", shuffle(ensureArray(options.RTMServers))); case 2: cachedEndPoints = this._cache.get('endpoints'); if (!cachedEndPoints) { _context3.next = 7; break; } info = cachedEndPoints; _context3.next = 14; break; case 7: _context3.next = 9; return this.constructor._fetchRTMServers(options); case 9: info = _context3.sent; _info = info, server = _info.server, secondary = _info.secondary, ttl = _info.ttl; if (!(typeof server !== 'string' && typeof secondary !== 'string' && typeof ttl !== 'number')) { _context3.next = 13; break; } throw new Error("malformed RTM route response: ".concat((0, _stringify.default)(info))); case 13: this._cache.set('endpoints', info, info.ttl * 1000); case 14: debug$6('endpoint info: %O', info); return _context3.abrupt("return", [info.server, info.secondary]); case 16: case "end": return _context3.stop(); } } }, _callee3, this); })); function _getRTMServers(_x2) { return _getRTMServers2.apply(this, arguments); } return _getRTMServers; }(); Realtime._getServerUrls = /*#__PURE__*/function () { var _getServerUrls2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) { var appId, server, cachedRouter, defaultProtocol; return _regeneratorRuntime.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: appId = _ref4.appId, server = _ref4.server; debug$6('fetch server urls'); if (!server) { _context4.next = 6; break; } if (!(typeof server !== 'string')) { _context4.next = 5; break; } return _context4.abrupt("return", server); case 5: return _context4.abrupt("return", { RTMRouter: server, api: server }); case 6: cachedRouter = routerCache.get(appId); if (!cachedRouter) { _context4.next = 9; break; } return _context4.abrupt("return", cachedRouter); case 9: defaultProtocol = 'https://'; return _context4.abrupt("return", request({ url: 'https://app-router.com/2/route', query: { appId: appId }, timeout: 20000 }).then(tap(debug$6)).then(function (_ref5) { var _context31, _context32; var RTMRouterServer = _ref5.rtm_router_server, APIServer = _ref5.api_server, _ref5$ttl = _ref5.ttl, ttl = _ref5$ttl === void 0 ? 3600 : _ref5$ttl; if (!RTMRouterServer) { throw new Error('rtm router not exists'); } var serverUrls = { RTMRouter: (0, _concat.default)(_context31 = "".concat(defaultProtocol)).call(_context31, RTMRouterServer), api: (0, _concat.default)(_context32 = "".concat(defaultProtocol)).call(_context32, APIServer) }; routerCache.set(appId, serverUrls, ttl * 1000); return serverUrls; })["catch"](function () { var _context33, _context34, _context35, _context36; var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase(); var domain = 'lncldglobal.com'; return { RTMRouter: (0, _concat.default)(_context33 = (0, _concat.default)(_context34 = "".concat(defaultProtocol)).call(_context34, id, ".rtm.")).call(_context33, domain), api: (0, _concat.default)(_context35 = (0, _concat.default)(_context36 = "".concat(defaultProtocol)).call(_context36, id, ".api.")).call(_context35, domain) }; })); case 11: case "end": return _context4.stop(); } } }, _callee4); })); function _getServerUrls(_x3) { return _getServerUrls2.apply(this, arguments); } return _getServerUrls; }(); Realtime._fetchRTMServers = function _fetchRTMServers(_ref6) { var appId = _ref6.appId, ssl = _ref6.ssl, server = _ref6.server, RTMServerName = _ref6.RTMServerName; debug$6('fetch endpoint info'); return this._getServerUrls({ appId: appId, server: server }).then(tap(debug$6)).then(function (_ref7) { var RTMRouter = _ref7.RTMRouter; return request({ url: "".concat(RTMRouter, "/v1/route"), query: { appId: appId, secure: ssl, features: isWeapp ? 'wechat' : undefined, server: RTMServerName, _t: Date.now() }, timeout: 20000 }).then(tap(debug$6)); }); }; _proto._close = function _close() { if (this._openPromise) { this._openPromise.then(function (connection) { return connection.close(); }); } delete this._openPromise; } /** * 手动进行重连。 * SDK 在网络出现异常时会自动按照一定的时间间隔尝试重连,调用该方法会立即尝试重连并重置重连尝试计数器。 * 只能在 `SCHEDULE` 事件之后,`RETRY` 事件之前调用,如果当前网络正常或者正在进行重连,调用该方法会抛异常。 */ ; _proto.retry = function retry() { var _internal = internal(this), connection = _internal.connection; if (!connection) { throw new Error('no connection established'); } if (connection.cannot('retry')) { throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(connection.current)); } return connection.retry(); } /** * 暂停,使 SDK 进入离线状态。 * 你可以在网络断开、应用进入后台等时刻调用该方法让 SDK 进入离线状态,离线状态下不会尝试重连。 * 在浏览器中 SDK 会自动监听网络变化,因此无需手动调用该方法。 * * @since 3.4.0 * @see Realtime#event:OFFLINE */ ; _proto.pause = function pause() { // 这个方法常常在网络断开、进入后台时被调用,此时 connection 可能没有建立或者已经 close。 // 因此不像 retry,这个方法应该尽可能 loose var _internal2 = internal(this), connection = _internal2.connection; if (!connection) return; if (connection.can('pause')) connection.pause(); } /** * 恢复在线状态。 * 你可以在网络恢复、应用回到前台等时刻调用该方法让 SDK 恢复在线状态,恢复在线状态后 SDK 会开始尝试重连。 * * @since 3.4.0 * @see Realtime#event:ONLINE */ ; _proto.resume = function resume() { // 与 pause 一样,这个方法应该尽可能 loose var _internal3 = internal(this), connection = _internal3.connection; if (!connection) return; if (connection.can('resume')) connection.resume(); }; _proto._registerPending = function _registerPending(value) { internal(this).pendingClients.add(value); }; _proto._deregisterPending = function _deregisterPending(client) { internal(this).pendingClients["delete"](client); }; _proto._register = function _register(client) { internal(this).clients.add(client); }; _proto._deregister = function _deregister(client) { var _this = internal(this); _this.clients["delete"](client); if (_this.clients.size + _this.pendingClients.size === 0) { this._close(); } }; _proto._dispatchCommand = function _dispatchCommand(command) { return applyDispatcher(this._plugins.beforeCommandDispatch, [command, this]).then(function (shouldDispatch) { // no plugin handled this command if (shouldDispatch) return debug$6('[WARN] Unexpected message received: %O', trim(command)); return false; }); }; return Realtime; }(EventEmitter); // For test purpose only var polyfilledPromise = _promise.default; exports.EventEmitter = EventEmitter; exports.Promise = polyfilledPromise; exports.Protocals = message; exports.Protocols = message; exports.Realtime = Realtime; exports.debug = debug$2; exports.getAdapter = getAdapter; exports.setAdapters = setAdapters; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74))) /***/ }), /* 590 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(591); /***/ }), /* 591 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(592); module.exports = parent; /***/ }), /* 592 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(593); var path = __webpack_require__(5); module.exports = path.Object.freeze; /***/ }), /* 593 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var FREEZING = __webpack_require__(262); var fails = __webpack_require__(2); var isObject = __webpack_require__(11); var onFreeze = __webpack_require__(94).onFreeze; // eslint-disable-next-line es-x/no-object-freeze -- safe var $freeze = Object.freeze; var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); }); // `Object.freeze` method // https://tc39.es/ecma262/#sec-object.freeze $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, { freeze: function freeze(it) { return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it; } }); /***/ }), /* 594 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(595); /***/ }), /* 595 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(596); module.exports = parent; /***/ }), /* 596 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(597); var path = __webpack_require__(5); module.exports = path.Object.getOwnPropertyDescriptors; /***/ }), /* 597 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var DESCRIPTORS = __webpack_require__(14); var ownKeys = __webpack_require__(162); var toIndexedObject = __webpack_require__(32); var getOwnPropertyDescriptorModule = __webpack_require__(62); var createProperty = __webpack_require__(91); // `Object.getOwnPropertyDescriptors` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors $({ target: 'Object', stat: true, sham: !DESCRIPTORS }, { getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { var O = toIndexedObject(object); var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var keys = ownKeys(O); var result = {}; var index = 0; var key, descriptor; while (keys.length > index) { descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); if (descriptor !== undefined) createProperty(result, key, descriptor); } return result; } }); /***/ }), /* 598 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(599); /***/ }), /* 599 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(600); module.exports = parent; /***/ }), /* 600 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(601); var path = __webpack_require__(5); var Object = path.Object; var defineProperties = module.exports = function defineProperties(T, D) { return Object.defineProperties(T, D); }; if (Object.defineProperties.sham) defineProperties.sham = true; /***/ }), /* 601 */ /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__(0); var DESCRIPTORS = __webpack_require__(14); var defineProperties = __webpack_require__(128).f; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es-x/no-object-defineproperties -- safe $({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, { defineProperties: defineProperties }); /***/ }), /* 602 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(603); /***/ }), /* 603 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(604); module.exports = parent; /***/ }), /* 604 */ /***/ (function(module, exports, __webpack_require__) { var isPrototypeOf = __webpack_require__(19); var method = __webpack_require__(605); var ArrayPrototype = Array.prototype; module.exports = function (it) { var own = it.reduce; return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own; }; /***/ }), /* 605 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(606); var entryVirtual = __webpack_require__(40); module.exports = entryVirtual('Array').reduce; /***/ }), /* 606 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(0); var $reduce = __webpack_require__(607).left; var arrayMethodIsStrict = __webpack_require__(231); var CHROME_VERSION = __webpack_require__(77); var IS_NODE = __webpack_require__(107); var STRICT_METHOD = arrayMethodIsStrict('reduce'); // Chrome 80-82 has a critical bug // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83; // `Array.prototype.reduce` method // https://tc39.es/ecma262/#sec-array.prototype.reduce $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, { reduce: function reduce(callbackfn /* , initialValue */) { var length = arguments.length; return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined); } }); /***/ }), /* 607 */ /***/ (function(module, exports, __webpack_require__) { var aCallable = __webpack_require__(31); var toObject = __webpack_require__(34); var IndexedObject = __webpack_require__(95); var lengthOfArrayLike = __webpack_require__(41); var $TypeError = TypeError; // `Array.prototype.{ reduce, reduceRight }` methods implementation var createMethod = function (IS_RIGHT) { return function (that, callbackfn, argumentsLength, memo) { aCallable(callbackfn); var O = toObject(that); var self = IndexedObject(O); var length = lengthOfArrayLike(O); var index = IS_RIGHT ? length - 1 : 0; var i = IS_RIGHT ? -1 : 1; if (argumentsLength < 2) while (true) { if (index in self) { memo = self[index]; index += i; break; } index += i; if (IS_RIGHT ? index < 0 : length <= index) { throw $TypeError('Reduce of empty array with no initial value'); } } for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { memo = callbackfn(memo, self[index], index, O); } return memo; }; }; module.exports = { // `Array.prototype.reduce` method // https://tc39.es/ecma262/#sec-array.prototype.reduce left: createMethod(false), // `Array.prototype.reduceRight` method // https://tc39.es/ecma262/#sec-array.prototype.reduceright right: createMethod(true) }; /***/ }), /* 608 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(609); __webpack_require__(39); module.exports = parent; /***/ }), /* 609 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(38); __webpack_require__(53); __webpack_require__(610); __webpack_require__(55); var path = __webpack_require__(5); module.exports = path.Set; /***/ }), /* 610 */ /***/ (function(module, exports, __webpack_require__) { // TODO: Remove this module from `core-js@4` since it's replaced to module below __webpack_require__(611); /***/ }), /* 611 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var collection = __webpack_require__(155); var collectionStrong = __webpack_require__(263); // `Set` constructor // https://tc39.es/ecma262/#sec-set-objects collection('Set', function (init) { return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); /***/ }), /* 612 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Daniel Wirtz Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * @license protobuf.js (c) 2013 Daniel Wirtz * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/protobuf.js for details */ (function(global, factory) { /* AMD */ if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(613)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"]) module["exports"] = factory(require("bytebuffer"), true); /* Global */ else (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]); })(this, function(ByteBuffer, isCommonJS) { "use strict"; /** * The ProtoBuf namespace. * @exports ProtoBuf * @namespace * @expose */ var ProtoBuf = {}; /** * @type {!function(new: ByteBuffer, ...[*])} * @expose */ ProtoBuf.ByteBuffer = ByteBuffer; /** * @type {?function(new: Long, ...[*])} * @expose */ ProtoBuf.Long = ByteBuffer.Long || null; /** * ProtoBuf.js version. * @type {string} * @const * @expose */ ProtoBuf.VERSION = "5.0.3"; /** * Wire types. * @type {Object.} * @const * @expose */ ProtoBuf.WIRE_TYPES = {}; /** * Varint wire type. * @type {number} * @expose */ ProtoBuf.WIRE_TYPES.VARINT = 0; /** * Fixed 64 bits wire type. * @type {number} * @const * @expose */ ProtoBuf.WIRE_TYPES.BITS64 = 1; /** * Length delimited wire type. * @type {number} * @const * @expose */ ProtoBuf.WIRE_TYPES.LDELIM = 2; /** * Start group wire type. * @type {number} * @const * @expose */ ProtoBuf.WIRE_TYPES.STARTGROUP = 3; /** * End group wire type. * @type {number} * @const * @expose */ ProtoBuf.WIRE_TYPES.ENDGROUP = 4; /** * Fixed 32 bits wire type. * @type {number} * @const * @expose */ ProtoBuf.WIRE_TYPES.BITS32 = 5; /** * Packable wire types. * @type {!Array.} * @const * @expose */ ProtoBuf.PACKABLE_WIRE_TYPES = [ ProtoBuf.WIRE_TYPES.VARINT, ProtoBuf.WIRE_TYPES.BITS64, ProtoBuf.WIRE_TYPES.BITS32 ]; /** * Types. * @dict * @type {!Object.} * @const * @expose */ ProtoBuf.TYPES = { // According to the protobuf spec. "int32": { name: "int32", wireType: ProtoBuf.WIRE_TYPES.VARINT, defaultValue: 0 }, "uint32": { name: "uint32", wireType: ProtoBuf.WIRE_TYPES.VARINT, defaultValue: 0 }, "sint32": { name: "sint32", wireType: ProtoBuf.WIRE_TYPES.VARINT, defaultValue: 0 }, "int64": { name: "int64", wireType: ProtoBuf.WIRE_TYPES.VARINT, defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined }, "uint64": { name: "uint64", wireType: ProtoBuf.WIRE_TYPES.VARINT, defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined }, "sint64": { name: "sint64", wireType: ProtoBuf.WIRE_TYPES.VARINT, defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined }, "bool": { name: "bool", wireType: ProtoBuf.WIRE_TYPES.VARINT, defaultValue: false }, "double": { name: "double", wireType: ProtoBuf.WIRE_TYPES.BITS64, defaultValue: 0 }, "string": { name: "string", wireType: ProtoBuf.WIRE_TYPES.LDELIM, defaultValue: "" }, "bytes": { name: "bytes", wireType: ProtoBuf.WIRE_TYPES.LDELIM, defaultValue: null // overridden in the code, must be a unique instance }, "fixed32": { name: "fixed32", wireType: ProtoBuf.WIRE_TYPES.BITS32, defaultValue: 0 }, "sfixed32": { name: "sfixed32", wireType: ProtoBuf.WIRE_TYPES.BITS32, defaultValue: 0 }, "fixed64": { name: "fixed64", wireType: ProtoBuf.WIRE_TYPES.BITS64, defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined }, "sfixed64": { name: "sfixed64", wireType: ProtoBuf.WIRE_TYPES.BITS64, defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined }, "float": { name: "float", wireType: ProtoBuf.WIRE_TYPES.BITS32, defaultValue: 0 }, "enum": { name: "enum", wireType: ProtoBuf.WIRE_TYPES.VARINT, defaultValue: 0 }, "message": { name: "message", wireType: ProtoBuf.WIRE_TYPES.LDELIM, defaultValue: null }, "group": { name: "group", wireType: ProtoBuf.WIRE_TYPES.STARTGROUP, defaultValue: null } }; /** * Valid map key types. * @type {!Array.>} * @const * @expose */ ProtoBuf.MAP_KEY_TYPES = [ ProtoBuf.TYPES["int32"], ProtoBuf.TYPES["sint32"], ProtoBuf.TYPES["sfixed32"], ProtoBuf.TYPES["uint32"], ProtoBuf.TYPES["fixed32"], ProtoBuf.TYPES["int64"], ProtoBuf.TYPES["sint64"], ProtoBuf.TYPES["sfixed64"], ProtoBuf.TYPES["uint64"], ProtoBuf.TYPES["fixed64"], ProtoBuf.TYPES["bool"], ProtoBuf.TYPES["string"], ProtoBuf.TYPES["bytes"] ]; /** * Minimum field id. * @type {number} * @const * @expose */ ProtoBuf.ID_MIN = 1; /** * Maximum field id. * @type {number} * @const * @expose */ ProtoBuf.ID_MAX = 0x1FFFFFFF; /** * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`. * Must be set prior to parsing. * @type {boolean} * @expose */ ProtoBuf.convertFieldsToCamelCase = false; /** * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by * setting this to `false` prior to building messages. * @type {boolean} * @expose */ ProtoBuf.populateAccessors = true; /** * By default, messages are populated with default values if a field is not present on the wire. To disable * this behavior, set this setting to `false`. * @type {boolean} * @expose */ ProtoBuf.populateDefaults = true; /** * @alias ProtoBuf.Util * @expose */ ProtoBuf.Util = (function() { "use strict"; /** * ProtoBuf utilities. * @exports ProtoBuf.Util * @namespace */ var Util = {}; /** * Flag if running in node or not. * @type {boolean} * @const * @expose */ Util.IS_NODE = !!( typeof process === 'object' && process+'' === '[object process]' && !process['browser'] ); /** * Constructs a XMLHttpRequest object. * @return {XMLHttpRequest} * @throws {Error} If XMLHttpRequest is not supported * @expose */ Util.XHR = function() { // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html var XMLHttpFactories = [ function () {return new XMLHttpRequest()}, function () {return new ActiveXObject("Msxml2.XMLHTTP")}, function () {return new ActiveXObject("Msxml3.XMLHTTP")}, function () {return new ActiveXObject("Microsoft.XMLHTTP")} ]; /** @type {?XMLHttpRequest} */ var xhr = null; for (var i=0;i} * @expose */ ProtoBuf.Lang = { // Characters always ending a statement DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g, // Field rules RULE: /^(?:required|optional|repeated|map)$/, // Field types TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/, // Names NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/, // Type definitions TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/, // Type references TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/, // Fully qualified type references FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/, // All numbers NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/, // Decimal numbers NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/, // Hexadecimal numbers NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/, // Octal numbers NUMBER_OCT: /^0[0-7]+$/, // Floating point numbers NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/, // Booleans BOOL: /^(?:true|false)$/i, // Id numbers ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/, // Negative id numbers (enum values) NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/, // Whitespaces WHITESPACE: /\s/, // All strings STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g, // Double quoted strings STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, // Single quoted strings STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g }; /** * @alias ProtoBuf.Reflect * @expose */ ProtoBuf.Reflect = (function(ProtoBuf) { "use strict"; /** * Reflection types. * @exports ProtoBuf.Reflect * @namespace */ var Reflect = {}; /** * Constructs a Reflect base class. * @exports ProtoBuf.Reflect.T * @constructor * @abstract * @param {!ProtoBuf.Builder} builder Builder reference * @param {?ProtoBuf.Reflect.T} parent Parent object * @param {string} name Object name */ var T = function(builder, parent, name) { /** * Builder reference. * @type {!ProtoBuf.Builder} * @expose */ this.builder = builder; /** * Parent object. * @type {?ProtoBuf.Reflect.T} * @expose */ this.parent = parent; /** * Object name in namespace. * @type {string} * @expose */ this.name = name; /** * Fully qualified class name * @type {string} * @expose */ this.className; }; /** * @alias ProtoBuf.Reflect.T.prototype * @inner */ var TPrototype = T.prototype; /** * Returns the fully qualified name of this object. * @returns {string} Fully qualified name as of ".PATH.TO.THIS" * @expose */ TPrototype.fqn = function() { var name = this.name, ptr = this; do { ptr = ptr.parent; if (ptr == null) break; name = ptr.name+"."+name; } while (true); return name; }; /** * Returns a string representation of this Reflect object (its fully qualified name). * @param {boolean=} includeClass Set to true to include the class name. Defaults to false. * @return String representation * @expose */ TPrototype.toString = function(includeClass) { return (includeClass ? this.className + " " : "") + this.fqn(); }; /** * Builds this type. * @throws {Error} If this type cannot be built directly * @expose */ TPrototype.build = function() { throw Error(this.toString(true)+" cannot be built directly"); }; /** * @alias ProtoBuf.Reflect.T * @expose */ Reflect.T = T; /** * Constructs a new Namespace. * @exports ProtoBuf.Reflect.Namespace * @param {!ProtoBuf.Builder} builder Builder reference * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent * @param {string} name Namespace name * @param {Object.=} options Namespace options * @param {string?} syntax The syntax level of this definition (e.g., proto3) * @constructor * @extends ProtoBuf.Reflect.T */ var Namespace = function(builder, parent, name, options, syntax) { T.call(this, builder, parent, name); /** * @override */ this.className = "Namespace"; /** * Children inside the namespace. * @type {!Array.} */ this.children = []; /** * Options. * @type {!Object.} */ this.options = options || {}; /** * Syntax level (e.g., proto2 or proto3). * @type {!string} */ this.syntax = syntax || "proto2"; }; /** * @alias ProtoBuf.Reflect.Namespace.prototype * @inner */ var NamespacePrototype = Namespace.prototype = Object.create(T.prototype); /** * Returns an array of the namespace's children. * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children). * @return {Array.} * @expose */ NamespacePrototype.getChildren = function(type) { type = type || null; if (type == null) return this.children.slice(); var children = []; for (var i=0, k=this.children.length; i} qn Qualified name to resolve * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false` * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found * @expose */ NamespacePrototype.resolve = function(qn, excludeNonNamespace) { var part = typeof qn === 'string' ? qn.split(".") : qn, ptr = this, i = 0; if (part[i] === "") { // Fully qualified name, e.g. ".My.Message' while (ptr.parent !== null) ptr = ptr.parent; i++; } var child; do { do { if (!(ptr instanceof Reflect.Namespace)) { ptr = null; break; } child = ptr.getChild(part[i]); if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) { ptr = null; break; } ptr = child; i++; } while (i < part.length); if (ptr != null) break; // Found // Else search the parent if (this.parent !== null) return this.parent.resolve(qn, excludeNonNamespace); } while (ptr != null); return ptr; }; /** * Determines the shortest qualified name of the specified type, if any, relative to this namespace. * @param {!ProtoBuf.Reflect.T} t Reflection type * @returns {string} The shortest qualified name or, if there is none, the fqn * @expose */ NamespacePrototype.qn = function(t) { var part = [], ptr = t; do { part.unshift(ptr.name); ptr = ptr.parent; } while (ptr !== null); for (var len=1; len <= part.length; len++) { var qn = part.slice(part.length-len); if (t === this.resolve(qn, t instanceof Reflect.Namespace)) return qn.join("."); } return t.fqn(); }; /** * Builds the namespace and returns the runtime counterpart. * @return {Object.} Runtime namespace * @expose */ NamespacePrototype.build = function() { /** @dict */ var ns = {}; var children = this.children; for (var i=0, k=children.length, child; i} */ NamespacePrototype.buildOpt = function() { var opt = {}, keys = Object.keys(this.options); for (var i=0, k=keys.length; i}null} Option value or NULL if there is no such option */ NamespacePrototype.getOption = function(name) { if (typeof name === 'undefined') return this.options; return typeof this.options[name] !== 'undefined' ? this.options[name] : null; }; /** * @alias ProtoBuf.Reflect.Namespace * @expose */ Reflect.Namespace = Namespace; /** * Constructs a new Element implementation that checks and converts values for a * particular field type, as appropriate. * * An Element represents a single value: either the value of a singular field, * or a value contained in one entry of a repeated field or map field. This * class does not implement these higher-level concepts; it only encapsulates * the low-level typechecking and conversion. * * @exports ProtoBuf.Reflect.Element * @param {{name: string, wireType: number}} type Resolved data type * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant * (e.g. submessage field). * @param {boolean} isMapKey Is this element a Map key? The value will be * converted to string form if so. * @param {string} syntax Syntax level of defining message type, e.g., * proto2 or proto3. * @param {string} name Name of the field containing this element (for error * messages) * @constructor */ var Element = function(type, resolvedType, isMapKey, syntax, name) { /** * Element type, as a string (e.g., int32). * @type {{name: string, wireType: number}} */ this.type = type; /** * Element type reference to submessage or enum definition, if needed. * @type {ProtoBuf.Reflect.T|null} */ this.resolvedType = resolvedType; /** * Element is a map key. * @type {boolean} */ this.isMapKey = isMapKey; /** * Syntax level of defining message type, e.g., proto2 or proto3. * @type {string} */ this.syntax = syntax; /** * Name of the field containing this element (for error messages) * @type {string} */ this.name = name; if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0) throw Error("Invalid map key type: " + type.name); }; var ElementPrototype = Element.prototype; /** * Obtains a (new) default value for the specified type. * @param type {string|{name: string, wireType: number}} Field type * @returns {*} Default value * @inner */ function mkDefault(type) { if (typeof type === 'string') type = ProtoBuf.TYPES[type]; if (typeof type.defaultValue === 'undefined') throw Error("default value for type "+type.name+" is not supported"); if (type == ProtoBuf.TYPES["bytes"]) return new ByteBuffer(0); return type.defaultValue; } /** * Returns the default value for this field in proto3. * @function * @param type {string|{name: string, wireType: number}} the field type * @returns {*} Default value */ Element.defaultFieldValue = mkDefault; /** * Makes a Long from a value. * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for * strings and numbers * @returns {!Long} * @throws {Error} If the value cannot be converted to a Long * @inner */ function mkLong(value, unsigned) { if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean' && value.low === value.low && value.high === value.high) return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned); if (typeof value === 'string') return ProtoBuf.Long.fromString(value, unsigned || false, 10); if (typeof value === 'number') return ProtoBuf.Long.fromNumber(value, unsigned || false); throw Error("not convertible to Long"); } ElementPrototype.toString = function() { return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element'; } /** * Checks if the given value can be set for an element of this type (singular * field or one element of a repeated field or map). * @param {*} value Value to check * @return {*} Verified, maybe adjusted, value * @throws {Error} If the value cannot be verified for this element slot * @expose */ ElementPrototype.verifyValue = function(value) { var self = this; function fail(val, msg) { throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")"); } switch (this.type) { // Signed 32bit case ProtoBuf.TYPES["int32"]: case ProtoBuf.TYPES["sint32"]: case ProtoBuf.TYPES["sfixed32"]: // Account for !NaN: value === value if (typeof value !== 'number' || (value === value && value % 1 !== 0)) fail(typeof value, "not an integer"); return value > 4294967295 ? value | 0 : value; // Unsigned 32bit case ProtoBuf.TYPES["uint32"]: case ProtoBuf.TYPES["fixed32"]: if (typeof value !== 'number' || (value === value && value % 1 !== 0)) fail(typeof value, "not an integer"); return value < 0 ? value >>> 0 : value; // Signed 64bit case ProtoBuf.TYPES["int64"]: case ProtoBuf.TYPES["sint64"]: case ProtoBuf.TYPES["sfixed64"]: { if (ProtoBuf.Long) try { return mkLong(value, false); } catch (e) { fail(typeof value, e.message); } else fail(typeof value, "requires Long.js"); } // Unsigned 64bit case ProtoBuf.TYPES["uint64"]: case ProtoBuf.TYPES["fixed64"]: { if (ProtoBuf.Long) try { return mkLong(value, true); } catch (e) { fail(typeof value, e.message); } else fail(typeof value, "requires Long.js"); } // Bool case ProtoBuf.TYPES["bool"]: if (typeof value !== 'boolean') fail(typeof value, "not a boolean"); return value; // Float case ProtoBuf.TYPES["float"]: case ProtoBuf.TYPES["double"]: if (typeof value !== 'number') fail(typeof value, "not a number"); return value; // Length-delimited string case ProtoBuf.TYPES["string"]: if (typeof value !== 'string' && !(value && value instanceof String)) fail(typeof value, "not a string"); return ""+value; // Convert String object to string // Length-delimited bytes case ProtoBuf.TYPES["bytes"]: if (ByteBuffer.isByteBuffer(value)) return value; return ByteBuffer.wrap(value, "base64"); // Constant enum value case ProtoBuf.TYPES["enum"]: { var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value); for (i=0; i 4294967295 || value < 0) fail(typeof value, "not in range for uint32") return value; } else { // proto2 requires enum values to be valid. fail(value, "not a valid enum value"); } } // Embedded message case ProtoBuf.TYPES["group"]: case ProtoBuf.TYPES["message"]: { if (!value || typeof value !== 'object') fail(typeof value, "object expected"); if (value instanceof this.resolvedType.clazz) return value; if (value instanceof ProtoBuf.Builder.Message) { // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180) var obj = {}; for (var i in value) if (value.hasOwnProperty(i)) obj[i] = value[i]; value = obj; } // Else let's try to construct one from a key-value object return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons } } // We should never end here throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")"); }; /** * Calculates the byte length of an element on the wire. * @param {number} id Field number * @param {*} value Field value * @returns {number} Byte length * @throws {Error} If the value cannot be calculated * @expose */ ElementPrototype.calculateLength = function(id, value) { if (value === null) return 0; // Nothing to encode // Tag has already been written var n; switch (this.type) { case ProtoBuf.TYPES["int32"]: return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value); case ProtoBuf.TYPES["uint32"]: return ByteBuffer.calculateVarint32(value); case ProtoBuf.TYPES["sint32"]: return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value)); case ProtoBuf.TYPES["fixed32"]: case ProtoBuf.TYPES["sfixed32"]: case ProtoBuf.TYPES["float"]: return 4; case ProtoBuf.TYPES["int64"]: case ProtoBuf.TYPES["uint64"]: return ByteBuffer.calculateVarint64(value); case ProtoBuf.TYPES["sint64"]: return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value)); case ProtoBuf.TYPES["fixed64"]: case ProtoBuf.TYPES["sfixed64"]: return 8; case ProtoBuf.TYPES["bool"]: return 1; case ProtoBuf.TYPES["enum"]: return ByteBuffer.calculateVarint32(value); case ProtoBuf.TYPES["double"]: return 8; case ProtoBuf.TYPES["string"]: n = ByteBuffer.calculateUTF8Bytes(value); return ByteBuffer.calculateVarint32(n) + n; case ProtoBuf.TYPES["bytes"]: if (value.remaining() < 0) throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining"); return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining(); case ProtoBuf.TYPES["message"]: n = this.resolvedType.calculate(value); return ByteBuffer.calculateVarint32(n) + n; case ProtoBuf.TYPES["group"]: n = this.resolvedType.calculate(value); return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP); } // We should never end here throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)"); }; /** * Encodes a value to the specified buffer. Does not encode the key. * @param {number} id Field number * @param {*} value Field value * @param {ByteBuffer} buffer ByteBuffer to encode to * @return {ByteBuffer} The ByteBuffer for chaining * @throws {Error} If the value cannot be encoded * @expose */ ElementPrototype.encodeValue = function(id, value, buffer) { if (value === null) return buffer; // Nothing to encode // Tag has already been written switch (this.type) { // 32bit signed varint case ProtoBuf.TYPES["int32"]: // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes // long – it is, effectively, treated like a very large unsigned integer." (see #122) if (value < 0) buffer.writeVarint64(value); else buffer.writeVarint32(value); break; // 32bit unsigned varint case ProtoBuf.TYPES["uint32"]: buffer.writeVarint32(value); break; // 32bit varint zig-zag case ProtoBuf.TYPES["sint32"]: buffer.writeVarint32ZigZag(value); break; // Fixed unsigned 32bit case ProtoBuf.TYPES["fixed32"]: buffer.writeUint32(value); break; // Fixed signed 32bit case ProtoBuf.TYPES["sfixed32"]: buffer.writeInt32(value); break; // 64bit varint as-is case ProtoBuf.TYPES["int64"]: case ProtoBuf.TYPES["uint64"]: buffer.writeVarint64(value); // throws break; // 64bit varint zig-zag case ProtoBuf.TYPES["sint64"]: buffer.writeVarint64ZigZag(value); // throws break; // Fixed unsigned 64bit case ProtoBuf.TYPES["fixed64"]: buffer.writeUint64(value); // throws break; // Fixed signed 64bit case ProtoBuf.TYPES["sfixed64"]: buffer.writeInt64(value); // throws break; // Bool case ProtoBuf.TYPES["bool"]: if (typeof value === 'string') buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value); else buffer.writeVarint32(value ? 1 : 0); break; // Constant enum value case ProtoBuf.TYPES["enum"]: buffer.writeVarint32(value); break; // 32bit float case ProtoBuf.TYPES["float"]: buffer.writeFloat32(value); break; // 64bit float case ProtoBuf.TYPES["double"]: buffer.writeFloat64(value); break; // Length-delimited string case ProtoBuf.TYPES["string"]: buffer.writeVString(value); break; // Length-delimited bytes case ProtoBuf.TYPES["bytes"]: if (value.remaining() < 0) throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining"); var prevOffset = value.offset; buffer.writeVarint32(value.remaining()); buffer.append(value); value.offset = prevOffset; break; // Embedded message case ProtoBuf.TYPES["message"]: var bb = new ByteBuffer().LE(); this.resolvedType.encode(value, bb); buffer.writeVarint32(bb.offset); buffer.append(bb.flip()); break; // Legacy group case ProtoBuf.TYPES["group"]: this.resolvedType.encode(value, buffer); buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP); break; default: // We should never end here throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)"); } return buffer; }; /** * Decode one element value from the specified buffer. * @param {ByteBuffer} buffer ByteBuffer to decode from * @param {number} wireType The field wire type * @param {number} id The field number * @return {*} Decoded value * @throws {Error} If the field cannot be decoded * @expose */ ElementPrototype.decode = function(buffer, wireType, id) { if (wireType != this.type.wireType) throw Error("Unexpected wire type for element"); var value, nBytes; switch (this.type) { // 32bit signed varint case ProtoBuf.TYPES["int32"]: return buffer.readVarint32() | 0; // 32bit unsigned varint case ProtoBuf.TYPES["uint32"]: return buffer.readVarint32() >>> 0; // 32bit signed varint zig-zag case ProtoBuf.TYPES["sint32"]: return buffer.readVarint32ZigZag() | 0; // Fixed 32bit unsigned case ProtoBuf.TYPES["fixed32"]: return buffer.readUint32() >>> 0; case ProtoBuf.TYPES["sfixed32"]: return buffer.readInt32() | 0; // 64bit signed varint case ProtoBuf.TYPES["int64"]: return buffer.readVarint64(); // 64bit unsigned varint case ProtoBuf.TYPES["uint64"]: return buffer.readVarint64().toUnsigned(); // 64bit signed varint zig-zag case ProtoBuf.TYPES["sint64"]: return buffer.readVarint64ZigZag(); // Fixed 64bit unsigned case ProtoBuf.TYPES["fixed64"]: return buffer.readUint64(); // Fixed 64bit signed case ProtoBuf.TYPES["sfixed64"]: return buffer.readInt64(); // Bool varint case ProtoBuf.TYPES["bool"]: return !!buffer.readVarint32(); // Constant enum value (varint) case ProtoBuf.TYPES["enum"]: // The following Builder.Message#set will already throw return buffer.readVarint32(); // 32bit float case ProtoBuf.TYPES["float"]: return buffer.readFloat(); // 64bit float case ProtoBuf.TYPES["double"]: return buffer.readDouble(); // Length-delimited string case ProtoBuf.TYPES["string"]: return buffer.readVString(); // Length-delimited bytes case ProtoBuf.TYPES["bytes"]: { nBytes = buffer.readVarint32(); if (buffer.remaining() < nBytes) throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining()); value = buffer.clone(); // Offset already set value.limit = value.offset+nBytes; buffer.offset += nBytes; return value; } // Length-delimited embedded message case ProtoBuf.TYPES["message"]: { nBytes = buffer.readVarint32(); return this.resolvedType.decode(buffer, nBytes); } // Legacy group case ProtoBuf.TYPES["group"]: return this.resolvedType.decode(buffer, -1, id); } // We should never end here throw Error("[INTERNAL] Illegal decode type"); }; /** * Converts a value from a string to the canonical element type. * * Legal only when isMapKey is true. * * @param {string} str The string value * @returns {*} The value */ ElementPrototype.valueFromString = function(str) { if (!this.isMapKey) { throw Error("valueFromString() called on non-map-key element"); } switch (this.type) { case ProtoBuf.TYPES["int32"]: case ProtoBuf.TYPES["sint32"]: case ProtoBuf.TYPES["sfixed32"]: case ProtoBuf.TYPES["uint32"]: case ProtoBuf.TYPES["fixed32"]: return this.verifyValue(parseInt(str)); case ProtoBuf.TYPES["int64"]: case ProtoBuf.TYPES["sint64"]: case ProtoBuf.TYPES["sfixed64"]: case ProtoBuf.TYPES["uint64"]: case ProtoBuf.TYPES["fixed64"]: // Long-based fields support conversions from string already. return this.verifyValue(str); case ProtoBuf.TYPES["bool"]: return str === "true"; case ProtoBuf.TYPES["string"]: return this.verifyValue(str); case ProtoBuf.TYPES["bytes"]: return ByteBuffer.fromBinary(str); } }; /** * Converts a value from the canonical element type to a string. * * It should be the case that `valueFromString(valueToString(val))` returns * a value equivalent to `verifyValue(val)` for every legal value of `val` * according to this element type. * * This may be used when the element must be stored or used as a string, * e.g., as a map key on an Object. * * Legal only when isMapKey is true. * * @param {*} val The value * @returns {string} The string form of the value. */ ElementPrototype.valueToString = function(value) { if (!this.isMapKey) { throw Error("valueToString() called on non-map-key element"); } if (this.type === ProtoBuf.TYPES["bytes"]) { return value.toString("binary"); } else { return value.toString(); } }; /** * @alias ProtoBuf.Reflect.Element * @expose */ Reflect.Element = Element; /** * Constructs a new Message. * @exports ProtoBuf.Reflect.Message * @param {!ProtoBuf.Builder} builder Builder reference * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace * @param {string} name Message name * @param {Object.=} options Message options * @param {boolean=} isGroup `true` if this is a legacy group * @param {string?} syntax The syntax level of this definition (e.g., proto3) * @constructor * @extends ProtoBuf.Reflect.Namespace */ var Message = function(builder, parent, name, options, isGroup, syntax) { Namespace.call(this, builder, parent, name, options, syntax); /** * @override */ this.className = "Message"; /** * Extensions range. * @type {!Array.|undefined} * @expose */ this.extensions = undefined; /** * Runtime message class. * @type {?function(new:ProtoBuf.Builder.Message)} * @expose */ this.clazz = null; /** * Whether this is a legacy group or not. * @type {boolean} * @expose */ this.isGroup = !!isGroup; // The following cached collections are used to efficiently iterate over or look up fields when decoding. /** * Cached fields. * @type {?Array.} * @private */ this._fields = null; /** * Cached fields by id. * @type {?Object.} * @private */ this._fieldsById = null; /** * Cached fields by name. * @type {?Object.} * @private */ this._fieldsByName = null; }; /** * @alias ProtoBuf.Reflect.Message.prototype * @inner */ var MessagePrototype = Message.prototype = Object.create(Namespace.prototype); /** * Builds the message and returns the runtime counterpart, which is a fully functional class. * @see ProtoBuf.Builder.Message * @param {boolean=} rebuild Whether to rebuild or not, defaults to false * @return {ProtoBuf.Reflect.Message} Message class * @throws {Error} If the message cannot be built * @expose */ MessagePrototype.build = function(rebuild) { if (this.clazz && !rebuild) return this.clazz; // Create the runtime Message class in its own scope var clazz = (function(ProtoBuf, T) { var fields = T.getChildren(ProtoBuf.Reflect.Message.Field), oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf); /** * Constructs a new runtime Message. * @name ProtoBuf.Builder.Message * @class Barebone of all runtime messages. * @param {!Object.|string} values Preset values * @param {...string} var_args * @constructor * @throws {Error} If the message cannot be created */ var Message = function(values, var_args) { ProtoBuf.Builder.Message.call(this); // Create virtual oneof properties for (var i=0, k=oneofs.length; i 0) { var value; // Set field values from a values object if (arguments.length === 1 && values !== null && typeof values === 'object' && /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) && /* not a repeated field */ !Array.isArray(values) && /* not a Map */ !(values instanceof ProtoBuf.Map) && /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) && /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) && /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) { this.$set(values); } else // Set field values from arguments, in declaration order for (i=0, k=arguments.length; i} keyOrObj String key or plain object holding multiple values * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false` * @returns {!ProtoBuf.Builder.Message} this * @throws {Error} If the value cannot be set * @expose */ MessagePrototype.set = function(keyOrObj, value, noAssert) { if (keyOrObj && typeof keyOrObj === 'object') { noAssert = value; for (var ikey in keyOrObj) { // Check if virtual oneof field - don't set these if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined) this.$set(ikey, value, noAssert); } return this; } var field = T._fieldsByName[keyOrObj]; if (!noAssert) { if (!field) throw Error(this+"#"+keyOrObj+" is not a field: undefined"); if (!(field instanceof ProtoBuf.Reflect.Message.Field)) throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true)); this[field.name] = (value = field.verifyValue(value)); // May throw } else this[keyOrObj] = value; if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field) var currentField = this[field.oneof.name]; // Virtual field references currently set field if (value !== null) { if (currentField !== null && currentField !== field.name) this[currentField] = null; // Clear currently set field this[field.oneof.name] = field.name; // Point virtual field at this field } else if (/* value === null && */currentField === keyOrObj) this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared) } return this; }; /** * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}. * @name ProtoBuf.Builder.Message#$set * @function * @param {string|!Object.} keyOrObj String key or plain object holding multiple values * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted * @param {boolean=} noAssert Whether to not assert the value, defaults to `false` * @throws {Error} If the value cannot be set * @expose */ MessagePrototype.$set = MessagePrototype.set; /** * Gets a field's value. * @name ProtoBuf.Builder.Message#get * @function * @param {string} key Key * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false` * @return {*} Value * @throws {Error} If there is no such field * @expose */ MessagePrototype.get = function(key, noAssert) { if (noAssert) return this[key]; var field = T._fieldsByName[key]; if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field)) throw Error(this+"#"+key+" is not a field: undefined"); if (!(field instanceof ProtoBuf.Reflect.Message.Field)) throw Error(this+"#"+key+" is not a field: "+field.toString(true)); return this[field.name]; }; /** * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}. * @name ProtoBuf.Builder.Message#$get * @function * @param {string} key Key * @return {*} Value * @throws {Error} If there is no such field * @expose */ MessagePrototype.$get = MessagePrototype.get; // Getters and setters for (var i=0; i} data Data payload * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false` * @return {!ByteBuffer} Encoded message as a ByteBuffer * @expose */ Message.encode = function(data, buffer, noVerify) { return new Message(data).encode(buffer, noVerify); }; /** * Calculates the byte length of the message. * @name ProtoBuf.Builder.Message#calculate * @function * @returns {number} Byte length * @throws {Error} If the message cannot be calculated or if required fields are missing. * @expose */ MessagePrototype.calculate = function() { return T.calculate(this); }; /** * Encodes the varint32 length-delimited message. * @name ProtoBuf.Builder.Message#encodeDelimited * @function * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted. * @param {boolean=} noVerify Whether to not verify field values, defaults to `false` * @return {!ByteBuffer} Encoded message as a ByteBuffer * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still * returns the encoded ByteBuffer in the `encoded` property on the error. * @expose */ MessagePrototype.encodeDelimited = function(buffer, noVerify) { var isNew = false; if (!buffer) buffer = new ByteBuffer(), isNew = true; var enc = new ByteBuffer().LE(); T.encode(this, enc, noVerify).flip(); buffer.writeVarint32(enc.remaining()); buffer.append(enc); return isNew ? buffer.flip() : buffer; }; /** * Directly encodes the message to an ArrayBuffer. * @name ProtoBuf.Builder.Message#encodeAB * @function * @return {ArrayBuffer} Encoded message as ArrayBuffer * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still * returns the encoded ArrayBuffer in the `encoded` property on the error. * @expose */ MessagePrototype.encodeAB = function() { try { return this.encode().toArrayBuffer(); } catch (e) { if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer(); throw(e); } }; /** * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}. * @name ProtoBuf.Builder.Message#toArrayBuffer * @function * @return {ArrayBuffer} Encoded message as ArrayBuffer * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still * returns the encoded ArrayBuffer in the `encoded` property on the error. * @expose */ MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB; /** * Directly encodes the message to a node Buffer. * @name ProtoBuf.Builder.Message#encodeNB * @function * @return {!Buffer} * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are * missing. The later still returns the encoded node Buffer in the `encoded` property on the error. * @expose */ MessagePrototype.encodeNB = function() { try { return this.encode().toBuffer(); } catch (e) { if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer(); throw(e); } }; /** * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}. * @name ProtoBuf.Builder.Message#toBuffer * @function * @return {!Buffer} * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still * returns the encoded node Buffer in the `encoded` property on the error. * @expose */ MessagePrototype.toBuffer = MessagePrototype.encodeNB; /** * Directly encodes the message to a base64 encoded string. * @name ProtoBuf.Builder.Message#encode64 * @function * @return {string} Base64 encoded string * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later * still returns the encoded base64 string in the `encoded` property on the error. * @expose */ MessagePrototype.encode64 = function() { try { return this.encode().toBase64(); } catch (e) { if (e["encoded"]) e["encoded"] = e["encoded"].toBase64(); throw(e); } }; /** * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}. * @name ProtoBuf.Builder.Message#toBase64 * @function * @return {string} Base64 encoded string * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still * returns the encoded base64 string in the `encoded` property on the error. * @expose */ MessagePrototype.toBase64 = MessagePrototype.encode64; /** * Directly encodes the message to a hex encoded string. * @name ProtoBuf.Builder.Message#encodeHex * @function * @return {string} Hex encoded string * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later * still returns the encoded hex string in the `encoded` property on the error. * @expose */ MessagePrototype.encodeHex = function() { try { return this.encode().toHex(); } catch (e) { if (e["encoded"]) e["encoded"] = e["encoded"].toHex(); throw(e); } }; /** * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}. * @name ProtoBuf.Builder.Message#toHex * @function * @return {string} Hex encoded string * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still * returns the encoded hex string in the `encoded` property on the error. * @expose */ MessagePrototype.toHex = MessagePrototype.encodeHex; /** * Clones a message object or field value to a raw object. * @param {*} obj Object to clone * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise * @param {boolean} longsAsStrings Whether to encode longs as strings * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field * @returns {*} Cloned object * @inner */ function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) { if (obj === null || typeof obj !== 'object') { // Convert enum values to their respective names if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) { var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj); if (name !== null) return name; } // Pass-through string, number, boolean, null... return obj; } // Convert ByteBuffers to raw buffer or strings if (ByteBuffer.isByteBuffer(obj)) return binaryAsBase64 ? obj.toBase64() : obj.toBuffer(); // Convert Longs to proper objects or strings if (ProtoBuf.Long.isLong(obj)) return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj); var clone; // Clone arrays if (Array.isArray(obj)) { clone = []; obj.forEach(function(v, k) { clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType); }); return clone; } clone = {}; // Convert maps to objects if (obj instanceof ProtoBuf.Map) { var it = obj.entries(); for (var e = it.next(); !e.done; e = it.next()) clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType); return clone; } // Everything else is a non-null object var type = obj.$type, field = undefined; for (var i in obj) if (obj.hasOwnProperty(i)) { if (type && (field = type.getChild(i))) clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType); else clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings); } return clone; } /** * Returns the message's raw payload. * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false` * @param {boolean} longsAsStrings Whether to encode longs as strings * @returns {Object.} Raw payload * @expose */ MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) { return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type); }; /** * Encodes a message to JSON. * @returns {string} JSON string * @expose */ MessagePrototype.encodeJSON = function() { return JSON.stringify( cloneRaw(this, /* binary-as-base64 */ true, /* longs-as-strings */ true, this.$type ) ); }; /** * Decodes a message from the specified buffer or string. * @name ProtoBuf.Builder.Message.decode * @function * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from * @param {(number|string)=} length Message length. Defaults to decode all the remainig data. * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64 * @return {!ProtoBuf.Builder.Message} Decoded message * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still * returns the decoded message with missing fields in the `decoded` property on the error. * @expose * @see ProtoBuf.Builder.Message.decode64 * @see ProtoBuf.Builder.Message.decodeHex */ Message.decode = function(buffer, length, enc) { if (typeof length === 'string') enc = length, length = -1; if (typeof buffer === 'string') buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64"); else if (!ByteBuffer.isByteBuffer(buffer)) buffer = ByteBuffer.wrap(buffer); // May throw var le = buffer.littleEndian; try { var msg = T.decode(buffer.LE(), length); buffer.LE(le); return msg; } catch (e) { buffer.LE(le); throw(e); } }; /** * Decodes a varint32 length-delimited message from the specified buffer or string. * @name ProtoBuf.Builder.Message.decodeDelimited * @function * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still * returns the decoded message with missing fields in the `decoded` property on the error. * @expose */ Message.decodeDelimited = function(buffer, enc) { if (typeof buffer === 'string') buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64"); else if (!ByteBuffer.isByteBuffer(buffer)) buffer = ByteBuffer.wrap(buffer); // May throw if (buffer.remaining() < 1) return null; var off = buffer.offset, len = buffer.readVarint32(); if (buffer.remaining() < len) { buffer.offset = off; return null; } try { var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE()); buffer.offset += len; return msg; } catch (err) { buffer.offset += len; throw err; } }; /** * Decodes the message from the specified base64 encoded string. * @name ProtoBuf.Builder.Message.decode64 * @function * @param {string} str String to decode from * @return {!ProtoBuf.Builder.Message} Decoded message * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still * returns the decoded message with missing fields in the `decoded` property on the error. * @expose */ Message.decode64 = function(str) { return Message.decode(str, "base64"); }; /** * Decodes the message from the specified hex encoded string. * @name ProtoBuf.Builder.Message.decodeHex * @function * @param {string} str String to decode from * @return {!ProtoBuf.Builder.Message} Decoded message * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still * returns the decoded message with missing fields in the `decoded` property on the error. * @expose */ Message.decodeHex = function(str) { return Message.decode(str, "hex"); }; /** * Decodes the message from a JSON string. * @name ProtoBuf.Builder.Message.decodeJSON * @function * @param {string} str String to decode from * @return {!ProtoBuf.Builder.Message} Decoded message * @throws {Error} If the message cannot be decoded or if required fields are * missing. * @expose */ Message.decodeJSON = function(str) { return new Message(JSON.parse(str)); }; // Utility /** * Returns a string representation of this Message. * @name ProtoBuf.Builder.Message#toString * @function * @return {string} String representation as of ".Fully.Qualified.MessageName" * @expose */ MessagePrototype.toString = function() { return T.toString(); }; // Properties /** * Message options. * @name ProtoBuf.Builder.Message.$options * @type {Object.} * @expose */ var $optionsS; // cc needs this /** * Message options. * @name ProtoBuf.Builder.Message#$options * @type {Object.} * @expose */ var $options; /** * Reflection type. * @name ProtoBuf.Builder.Message.$type * @type {!ProtoBuf.Reflect.Message} * @expose */ var $typeS; /** * Reflection type. * @name ProtoBuf.Builder.Message#$type * @type {!ProtoBuf.Reflect.Message} * @expose */ var $type; if (Object.defineProperty) Object.defineProperty(Message, '$options', { "value": T.buildOpt() }), Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }), Object.defineProperty(Message, "$type", { "value": T }), Object.defineProperty(MessagePrototype, "$type", { "value": T }); return Message; })(ProtoBuf, this); // Static enums and prototyped sub-messages / cached collections this._fields = []; this._fieldsById = {}; this._fieldsByName = {}; this._oneofsByName = {}; for (var i=0, k=this.children.length, child; i>> 3; switch (wireType) { case ProtoBuf.WIRE_TYPES.VARINT: do tag = buf.readUint8(); while ((tag & 0x80) === 0x80); break; case ProtoBuf.WIRE_TYPES.BITS64: buf.offset += 8; break; case ProtoBuf.WIRE_TYPES.LDELIM: tag = buf.readVarint32(); // reads the varint buf.offset += tag; // skips n bytes break; case ProtoBuf.WIRE_TYPES.STARTGROUP: skipTillGroupEnd(id, buf); break; case ProtoBuf.WIRE_TYPES.ENDGROUP: if (id === expectedId) return false; else throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)"); case ProtoBuf.WIRE_TYPES.BITS32: buf.offset += 4; break; default: throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType); } return true; } /** * Decodes an encoded message and returns the decoded message. * @param {ByteBuffer} buffer ByteBuffer to decode from * @param {number=} length Message length. Defaults to decode all remaining data. * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group * @return {ProtoBuf.Builder.Message} Decoded message * @throws {Error} If the message cannot be decoded * @expose */ MessagePrototype.decode = function(buffer, length, expectedGroupEndId) { if (typeof length !== 'number') length = -1; var start = buffer.offset, msg = new (this.clazz)(), tag, wireType, id, field; while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) { tag = buffer.readVarint32(); wireType = tag & 0x07; id = tag >>> 3; if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) { if (id !== expectedGroupEndId) throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")"); break; } if (!(field = this._fieldsById[id])) { // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing." switch (wireType) { case ProtoBuf.WIRE_TYPES.VARINT: buffer.readVarint32(); break; case ProtoBuf.WIRE_TYPES.BITS32: buffer.offset += 4; break; case ProtoBuf.WIRE_TYPES.BITS64: buffer.offset += 8; break; case ProtoBuf.WIRE_TYPES.LDELIM: var len = buffer.readVarint32(); buffer.offset += len; break; case ProtoBuf.WIRE_TYPES.STARTGROUP: while (skipTillGroupEnd(id, buffer)) {} break; default: throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType); } continue; } if (field.repeated && !field.options["packed"]) { msg[field.name].push(field.decode(wireType, buffer)); } else if (field.map) { var keyval = field.decode(wireType, buffer); msg[field.name].set(keyval[0], keyval[1]); } else { msg[field.name] = field.decode(wireType, buffer); if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field) var currentField = msg[field.oneof.name]; // Virtual field references currently set field if (currentField !== null && currentField !== field.name) msg[currentField] = null; // Clear currently set field msg[field.oneof.name] = field.name; // Point virtual field at this field } } } // Check if all required fields are present and set default values for optional fields that are not for (var i=0, k=this._fields.length; i=} options Options * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf * @param {string?} syntax The syntax level of this definition (e.g., proto3) * @constructor * @extends ProtoBuf.Reflect.T */ var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) { T.call(this, builder, message, name); /** * @override */ this.className = "Message.Field"; /** * Message field required flag. * @type {boolean} * @expose */ this.required = rule === "required"; /** * Message field repeated flag. * @type {boolean} * @expose */ this.repeated = rule === "repeated"; /** * Message field map flag. * @type {boolean} * @expose */ this.map = rule === "map"; /** * Message field key type. Type reference string if unresolved, protobuf * type if resolved. Valid only if this.map === true, null otherwise. * @type {string|{name: string, wireType: number}|null} * @expose */ this.keyType = keytype || null; /** * Message field type. Type reference string if unresolved, protobuf type if * resolved. In a map field, this is the value type. * @type {string|{name: string, wireType: number}} * @expose */ this.type = type; /** * Resolved type reference inside the global namespace. * @type {ProtoBuf.Reflect.T|null} * @expose */ this.resolvedType = null; /** * Unique message field id. * @type {number} * @expose */ this.id = id; /** * Message field options. * @type {!Object.} * @dict * @expose */ this.options = options || {}; /** * Default value. * @type {*} * @expose */ this.defaultValue = null; /** * Enclosing OneOf. * @type {?ProtoBuf.Reflect.Message.OneOf} * @expose */ this.oneof = oneof || null; /** * Syntax level of this definition (e.g., proto3). * @type {string} * @expose */ this.syntax = syntax || 'proto2'; /** * Original field name. * @type {string} * @expose */ this.originalName = this.name; // Used to revert camelcase transformation on naming collisions /** * Element implementation. Created in build() after types are resolved. * @type {ProtoBuf.Element} * @expose */ this.element = null; /** * Key element implementation, for map fields. Created in build() after * types are resolved. * @type {ProtoBuf.Element} * @expose */ this.keyElement = null; // Convert field names to camel case notation if the override is set if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField)) this.name = ProtoBuf.Util.toCamelCase(this.name); }; /** * @alias ProtoBuf.Reflect.Message.Field.prototype * @inner */ var FieldPrototype = Field.prototype = Object.create(T.prototype); /** * Builds the field. * @override * @expose */ FieldPrototype.build = function() { this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name); if (this.map) this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name); // In proto3, fields do not have field presence, and every field is set to // its type's default value ("", 0, 0.0, or false). if (this.syntax === 'proto3' && !this.repeated && !this.map) this.defaultValue = Element.defaultFieldValue(this.type); // Otherwise, default values are present when explicitly specified else if (typeof this.options['default'] !== 'undefined') this.defaultValue = this.verifyValue(this.options['default']); }; /** * Checks if the given value can be set for this field. * @param {*} value Value to check * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false. * @return {*} Verified, maybe adjusted, value * @throws {Error} If the value cannot be set for this field * @expose */ FieldPrototype.verifyValue = function(value, skipRepeated) { skipRepeated = skipRepeated || false; var self = this; function fail(val, msg) { throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")"); } if (value === null) { // NULL values for optional fields if (this.required) fail(typeof value, "required"); if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"]) fail(typeof value, "proto3 field without field presence cannot be null"); return null; } var i; if (this.repeated && !skipRepeated) { // Repeated values as arrays if (!Array.isArray(value)) value = [value]; var res = []; for (i=0; i 0; case ProtoBuf.TYPES["bytes"]: return value.remaining() > 0; case ProtoBuf.TYPES["enum"]: return value !== 0; case ProtoBuf.TYPES["message"]: return value !== null; default: return true; } }; /** * Encodes the specified field value to the specified buffer. * @param {*} value Verified field value * @param {ByteBuffer} buffer ByteBuffer to encode to * @param {!ProtoBuf.Builder.Message} message Runtime message * @return {ByteBuffer} The ByteBuffer for chaining * @throws {Error} If the field cannot be encoded * @expose */ FieldPrototype.encode = function(value, buffer, message) { if (this.type === null || typeof this.type !== 'object') throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type); if (value === null || (this.repeated && value.length == 0)) return buffer; // Optional omitted try { if (this.repeated) { var i; // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire // types) can be declared 'packed'." if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) { // "All of the elements of the field are packed into a single key-value pair with wire type 2 // (length-delimited). Each element is encoded the same way it would be normally, except without a // tag preceding it." buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM); buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1 var start = buffer.offset; // Remember where the contents begin for (i=0; i 1) { // We need to move the contents var contents = buffer.slice(start, buffer.offset); start += varintLen-1; buffer.offset = start; buffer.append(contents); } buffer.writeVarint32(len, start-varintLen); } else { // "If your message definition has repeated elements (without the [packed=true] option), the encoded // message has zero or more key-value pairs with the same tag number" for (i=0; i= 0) { n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM); ni = 0; for (i=0; i= 0) { if (!skipRepeated) { nBytes = buffer.readVarint32(); nBytes = buffer.offset + nBytes; // Limit var values = []; while (buffer.offset < nBytes) values.push(this.decode(this.type.wireType, buffer, true)); return values; } // Read the next value otherwise... } // Handle maps. if (this.map) { // Read one (key, value) submessage, and return [key, value] var key = Element.defaultFieldValue(this.keyType); value = Element.defaultFieldValue(this.type); // Read the length nBytes = buffer.readVarint32(); if (buffer.remaining() < nBytes) throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining()); // Get a sub-buffer of this key/value submessage var msgbuf = buffer.clone(); msgbuf.limit = msgbuf.offset + nBytes; buffer.offset += nBytes; while (msgbuf.remaining() > 0) { var tag = msgbuf.readVarint32(); wireType = tag & 0x07; var id = tag >>> 3; if (id === 1) { key = this.keyElement.decode(msgbuf, wireType, id); } else if (id === 2) { value = this.element.decode(msgbuf, wireType, id); } else { throw Error("Unexpected tag in map field key/value submessage"); } } return [key, value]; } // Handle singular and non-packed repeated field values. return this.element.decode(buffer, wireType, this.id); }; /** * @alias ProtoBuf.Reflect.Message.Field * @expose */ Reflect.Message.Field = Field; /** * Constructs a new Message ExtensionField. * @exports ProtoBuf.Reflect.Message.ExtensionField * @param {!ProtoBuf.Builder} builder Builder reference * @param {!ProtoBuf.Reflect.Message} message Message reference * @param {string} rule Rule, one of requried, optional, repeated * @param {string} type Data type, e.g. int32 * @param {string} name Field name * @param {number} id Unique field id * @param {!Object.=} options Options * @constructor * @extends ProtoBuf.Reflect.Message.Field */ var ExtensionField = function(builder, message, rule, type, name, id, options) { Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options); /** * Extension reference. * @type {!ProtoBuf.Reflect.Extension} * @expose */ this.extension; }; // Extends Field ExtensionField.prototype = Object.create(Field.prototype); /** * @alias ProtoBuf.Reflect.Message.ExtensionField * @expose */ Reflect.Message.ExtensionField = ExtensionField; /** * Constructs a new Message OneOf. * @exports ProtoBuf.Reflect.Message.OneOf * @param {!ProtoBuf.Builder} builder Builder reference * @param {!ProtoBuf.Reflect.Message} message Message reference * @param {string} name OneOf name * @constructor * @extends ProtoBuf.Reflect.T */ var OneOf = function(builder, message, name) { T.call(this, builder, message, name); /** * Enclosed fields. * @type {!Array.} * @expose */ this.fields = []; }; /** * @alias ProtoBuf.Reflect.Message.OneOf * @expose */ Reflect.Message.OneOf = OneOf; /** * Constructs a new Enum. * @exports ProtoBuf.Reflect.Enum * @param {!ProtoBuf.Builder} builder Builder reference * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object * @param {string} name Enum name * @param {Object.=} options Enum options * @param {string?} syntax The syntax level (e.g., proto3) * @constructor * @extends ProtoBuf.Reflect.Namespace */ var Enum = function(builder, parent, name, options, syntax) { Namespace.call(this, builder, parent, name, options, syntax); /** * @override */ this.className = "Enum"; /** * Runtime enum object. * @type {Object.|null} * @expose */ this.object = null; }; /** * Gets the string name of an enum value. * @param {!ProtoBuf.Builder.Enum} enm Runtime enum * @param {number} value Enum value * @returns {?string} Name or `null` if not present * @expose */ Enum.getName = function(enm, value) { var keys = Object.keys(enm); for (var i=0, key; i} * @expose */ EnumPrototype.build = function(rebuild) { if (this.object && !rebuild) return this.object; var enm = new ProtoBuf.Builder.Enum(), values = this.getChildren(Enum.Value); for (var i=0, k=values.length; i=} options Options * @constructor * @extends ProtoBuf.Reflect.Namespace */ var Service = function(builder, root, name, options) { Namespace.call(this, builder, root, name, options); /** * @override */ this.className = "Service"; /** * Built runtime service class. * @type {?function(new:ProtoBuf.Builder.Service)} */ this.clazz = null; }; /** * @alias ProtoBuf.Reflect.Service.prototype * @inner */ var ServicePrototype = Service.prototype = Object.create(Namespace.prototype); /** * Builds the service and returns the runtime counterpart, which is a fully functional class. * @see ProtoBuf.Builder.Service * @param {boolean=} rebuild Whether to rebuild or not * @return {Function} Service class * @throws {Error} If the message cannot be built * @expose */ ServicePrototype.build = function(rebuild) { if (this.clazz && !rebuild) return this.clazz; // Create the runtime Service class in its own scope return this.clazz = (function(ProtoBuf, T) { /** * Constructs a new runtime Service. * @name ProtoBuf.Builder.Service * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message * @class Barebone of all runtime services. * @constructor * @throws {Error} If the service cannot be created */ var Service = function(rpcImpl) { ProtoBuf.Builder.Service.call(this); /** * Service implementation. * @name ProtoBuf.Builder.Service#rpcImpl * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} * @expose */ this.rpcImpl = rpcImpl || function(name, msg, callback) { // This is what a user has to implement: A function receiving the method name, the actual message to // send (type checked) and the callback that's either provided with the error as its first // argument or null and the actual response message. setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async! }; }; /** * @alias ProtoBuf.Builder.Service.prototype * @inner */ var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype); /** * Asynchronously performs an RPC call using the given RPC implementation. * @name ProtoBuf.Builder.Service.[Method] * @function * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation * @param {ProtoBuf.Builder.Message} req Request * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving * the error if any and the response either as a pre-parsed message or as its raw bytes * @abstract */ /** * Asynchronously performs an RPC call using the instance's RPC implementation. * @name ProtoBuf.Builder.Service#[Method] * @function * @param {ProtoBuf.Builder.Message} req Request * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving * the error if any and the response either as a pre-parsed message or as its raw bytes * @abstract */ var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod); for (var i=0; i} * @expose */ var $optionsS; // cc needs this /** * Service options. * @name ProtoBuf.Builder.Service#$options * @type {Object.} * @expose */ var $options; /** * Reflection type. * @name ProtoBuf.Builder.Service.$type * @type {!ProtoBuf.Reflect.Service} * @expose */ var $typeS; /** * Reflection type. * @name ProtoBuf.Builder.Service#$type * @type {!ProtoBuf.Reflect.Service} * @expose */ var $type; if (Object.defineProperty) Object.defineProperty(Service, "$options", { "value": T.buildOpt() }), Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }), Object.defineProperty(Service, "$type", { "value": T }), Object.defineProperty(ServicePrototype, "$type", { "value": T }); return Service; })(ProtoBuf, this); }; /** * @alias ProtoBuf.Reflect.Service * @expose */ Reflect.Service = Service; /** * Abstract service method. * @exports ProtoBuf.Reflect.Service.Method * @param {!ProtoBuf.Builder} builder Builder reference * @param {!ProtoBuf.Reflect.Service} svc Service * @param {string} name Method name * @param {Object.=} options Options * @constructor * @extends ProtoBuf.Reflect.T */ var Method = function(builder, svc, name, options) { T.call(this, builder, svc, name); /** * @override */ this.className = "Service.Method"; /** * Options. * @type {Object.} * @expose */ this.options = options || {}; }; /** * @alias ProtoBuf.Reflect.Service.Method.prototype * @inner */ var MethodPrototype = Method.prototype = Object.create(T.prototype); /** * Builds the method's '$options' property. * @name ProtoBuf.Reflect.Service.Method#buildOpt * @function * @return {Object.} */ MethodPrototype.buildOpt = NamespacePrototype.buildOpt; /** * @alias ProtoBuf.Reflect.Service.Method * @expose */ Reflect.Service.Method = Method; /** * RPC service method. * @exports ProtoBuf.Reflect.Service.RPCMethod * @param {!ProtoBuf.Builder} builder Builder reference * @param {!ProtoBuf.Reflect.Service} svc Service * @param {string} name Method name * @param {string} request Request message name * @param {string} response Response message name * @param {boolean} request_stream Whether requests are streamed * @param {boolean} response_stream Whether responses are streamed * @param {Object.=} options Options * @constructor * @extends ProtoBuf.Reflect.Service.Method */ var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) { Method.call(this, builder, svc, name, options); /** * @override */ this.className = "Service.RPCMethod"; /** * Request message name. * @type {string} * @expose */ this.requestName = request; /** * Response message name. * @type {string} * @expose */ this.responseName = response; /** * Whether requests are streamed * @type {bool} * @expose */ this.requestStream = request_stream; /** * Whether responses are streamed * @type {bool} * @expose */ this.responseStream = response_stream; /** * Resolved request message type. * @type {ProtoBuf.Reflect.Message} * @expose */ this.resolvedRequestType = null; /** * Resolved response message type. * @type {ProtoBuf.Reflect.Message} * @expose */ this.resolvedResponseType = null; }; // Extends Method RPCMethod.prototype = Object.create(Method.prototype); /** * @alias ProtoBuf.Reflect.Service.RPCMethod * @expose */ Reflect.Service.RPCMethod = RPCMethod; return Reflect; })(ProtoBuf); /** * @alias ProtoBuf.Builder * @expose */ ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) { "use strict"; /** * Constructs a new Builder. * @exports ProtoBuf.Builder * @class Provides the functionality to build protocol messages. * @param {Object.=} options Options * @constructor */ var Builder = function(options) { /** * Namespace. * @type {ProtoBuf.Reflect.Namespace} * @expose */ this.ns = new Reflect.Namespace(this, null, ""); // Global namespace /** * Namespace pointer. * @type {ProtoBuf.Reflect.T} * @expose */ this.ptr = this.ns; /** * Resolved flag. * @type {boolean} * @expose */ this.resolved = false; /** * The current building result. * @type {Object.|null} * @expose */ this.result = null; /** * Imported files. * @type {Array.} * @expose */ this.files = {}; /** * Import root override. * @type {?string} * @expose */ this.importRoot = null; /** * Options. * @type {!Object.} * @expose */ this.options = options || {}; }; /** * @alias ProtoBuf.Builder.prototype * @inner */ var BuilderPrototype = Builder.prototype; // ----- Definition tests ----- /** * Tests if a definition most likely describes a message. * @param {!Object} def * @returns {boolean} * @expose */ Builder.isMessage = function(def) { // Messages require a string name if (typeof def["name"] !== 'string') return false; // Messages do not contain values (enum) or rpc methods (service) if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined') return false; return true; }; /** * Tests if a definition most likely describes a message field. * @param {!Object} def * @returns {boolean} * @expose */ Builder.isMessageField = function(def) { // Message fields require a string rule, name and type and an id if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined') return false; return true; }; /** * Tests if a definition most likely describes an enum. * @param {!Object} def * @returns {boolean} * @expose */ Builder.isEnum = function(def) { // Enums require a string name if (typeof def["name"] !== 'string') return false; // Enums require at least one value if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0) return false; return true; }; /** * Tests if a definition most likely describes a service. * @param {!Object} def * @returns {boolean} * @expose */ Builder.isService = function(def) { // Services require a string name and an rpc object if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"]) return false; return true; }; /** * Tests if a definition most likely describes an extended message * @param {!Object} def * @returns {boolean} * @expose */ Builder.isExtend = function(def) { // Extends rquire a string ref if (typeof def["ref"] !== 'string') return false; return true; }; // ----- Building ----- /** * Resets the pointer to the root namespace. * @returns {!ProtoBuf.Builder} this * @expose */ BuilderPrototype.reset = function() { this.ptr = this.ns; return this; }; /** * Defines a namespace on top of the current pointer position and places the pointer on it. * @param {string} namespace * @return {!ProtoBuf.Builder} this * @expose */ BuilderPrototype.define = function(namespace) { if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace)) throw Error("illegal namespace: "+namespace); namespace.split(".").forEach(function(part) { var ns = this.ptr.getChild(part); if (ns === null) // Keep existing this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part)); this.ptr = ns; }, this); return this; }; /** * Creates the specified definitions at the current pointer position. * @param {!Array.} defs Messages, enums or services to create * @returns {!ProtoBuf.Builder} this * @throws {Error} If a message definition is invalid * @expose */ BuilderPrototype.create = function(defs) { if (!defs) return this; // Nothing to create if (!Array.isArray(defs)) defs = [defs]; else { if (defs.length === 0) return this; defs = defs.slice(); } // It's quite hard to keep track of scopes and memory here, so let's do this iteratively. var stack = [defs]; while (stack.length > 0) { defs = stack.pop(); if (!Array.isArray(defs)) // Stack always contains entire namespaces throw Error("not a valid namespace: "+JSON.stringify(defs)); while (defs.length > 0) { var def = defs.shift(); // Namespaces always contain an array of messages, enums and services if (Builder.isMessage(def)) { var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]); // Create OneOfs var oneofs = {}; if (def["oneofs"]) Object.keys(def["oneofs"]).forEach(function(name) { obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name)); }, this); // Create fields if (def["fields"]) def["fields"].forEach(function(fld) { if (obj.getChild(fld["id"]|0) !== null) throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']); if (fld["options"] && typeof fld["options"] !== 'object') throw Error("illegal field options in "+obj.name+"#"+fld["name"]); var oneof = null; if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]])) throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]); fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]); if (oneof) oneof.fields.push(fld); obj.addChild(fld); }, this); // Push children to stack var subObj = []; if (def["enums"]) def["enums"].forEach(function(enm) { subObj.push(enm); }); if (def["messages"]) def["messages"].forEach(function(msg) { subObj.push(msg); }); if (def["services"]) def["services"].forEach(function(svc) { subObj.push(svc); }); // Set extension ranges if (def["extensions"]) { if (typeof def["extensions"][0] === 'number') // pre 5.0.1 obj.extensions = [ def["extensions"] ]; else obj.extensions = def["extensions"]; } // Create on top of current namespace this.ptr.addChild(obj); if (subObj.length > 0) { stack.push(defs); // Push the current level back defs = subObj; // Continue processing sub level subObj = null; this.ptr = obj; // And move the pointer to this namespace obj = null; continue; } subObj = null; } else if (Builder.isEnum(def)) { obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]); def["values"].forEach(function(val) { obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"])); }, this); this.ptr.addChild(obj); } else if (Builder.isService(def)) { obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]); Object.keys(def["rpc"]).forEach(function(name) { var mtd = def["rpc"][name]; obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"])); }, this); this.ptr.addChild(obj); } else if (Builder.isExtend(def)) { obj = this.ptr.resolve(def["ref"], true); if (obj) { def["fields"].forEach(function(fld) { if (obj.getChild(fld['id']|0) !== null) throw Error("duplicate extended field id in "+obj.name+": "+fld['id']); // Check if field id is allowed to be extended if (obj.extensions) { var valid = false; obj.extensions.forEach(function(range) { if (fld["id"] >= range[0] && fld["id"] <= range[1]) valid = true; }); if (!valid) throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)"); } // Convert extension field names to camel case notation if the override is set var name = fld["name"]; if (this.options['convertFieldsToCamelCase']) name = ProtoBuf.Util.toCamelCase(name); // see #161: Extensions use their fully qualified name as their runtime key and... var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]); // ...are added on top of the current namespace as an extension which is used for // resolving their type later on (the extension always keeps the original name to // prevent naming collisions) var ext = new Reflect.Extension(this, this.ptr, fld["name"], field); field.extension = ext; this.ptr.addChild(ext); obj.addChild(field); }, this); } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions throw Error("extended message "+def["ref"]+" is not defined"); } else throw Error("not a valid definition: "+JSON.stringify(def)); def = null; obj = null; } // Break goes here defs = null; this.ptr = this.ptr.parent; // Namespace done, continue at parent } this.resolved = false; // Require re-resolve this.result = null; // Require re-build return this; }; /** * Propagates syntax to all children. * @param {!Object} parent * @inner */ function propagateSyntax(parent) { if (parent['messages']) { parent['messages'].forEach(function(child) { child["syntax"] = parent["syntax"]; propagateSyntax(child); }); } if (parent['enums']) { parent['enums'].forEach(function(child) { child["syntax"] = parent["syntax"]; }); } } /** * Imports another definition into this builder. * @param {Object.} json Parsed import * @param {(string|{root: string, file: string})=} filename Imported file name * @returns {!ProtoBuf.Builder} this * @throws {Error} If the definition or file cannot be imported * @expose */ BuilderPrototype["import"] = function(json, filename) { var delim = '/'; // Make sure to skip duplicate imports if (typeof filename === 'string') { if (ProtoBuf.Util.IS_NODE) filename = __webpack_require__(117)['resolve'](filename); if (this.files[filename] === true) return this.reset(); this.files[filename] = true; } else if (typeof filename === 'object') { // Object with root, file. var root = filename.root; if (ProtoBuf.Util.IS_NODE) root = __webpack_require__(117)['resolve'](root); if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0) delim = '\\'; var fname; if (ProtoBuf.Util.IS_NODE) fname = __webpack_require__(117)['join'](root, filename.file); else fname = root + delim + filename.file; if (this.files[fname] === true) return this.reset(); this.files[fname] = true; } // Import imports if (json['imports'] && json['imports'].length > 0) { var importRoot, resetRoot = false; if (typeof filename === 'object') { // If an import root is specified, override this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards importRoot = this.importRoot; filename = filename["file"]; if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0) delim = '\\'; } else if (typeof filename === 'string') { if (this.importRoot) // If import root is overridden, use it importRoot = this.importRoot; else { // Otherwise compute from filename if (filename.indexOf("/") >= 0) { // Unix importRoot = filename.replace(/\/[^\/]*$/, ""); if (/* /file.proto */ importRoot === "") importRoot = "/"; } else if (filename.indexOf("\\") >= 0) { // Windows importRoot = filename.replace(/\\[^\\]*$/, ""); delim = '\\'; } else importRoot = "."; } } else importRoot = null; for (var i=0; i)=} path Specifies what to return. If omitted, the entire namespace will be returned. * @returns {!ProtoBuf.Builder.Message|!Object.} * @throws {Error} If a type could not be resolved * @expose */ BuilderPrototype.build = function(path) { this.reset(); if (!this.resolved) this.resolveAll(), this.resolved = true, this.result = null; // Require re-build if (this.result === null) // (Re-)Build this.result = this.ns.build(); if (!path) return this.result; var part = typeof path === 'string' ? path.split(".") : path, ptr = this.result; // Build namespace pointer (no hasChild etc.) for (var i=0; i=} contents Initial contents * @constructor */ var Map = function(field, contents) { if (!field.map) throw Error("field is not a map"); /** * The field corresponding to this map. * @type {!ProtoBuf.Reflect.Field} */ this.field = field; /** * Element instance corresponding to key type. * @type {!ProtoBuf.Reflect.Element} */ this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax); /** * Element instance corresponding to value type. * @type {!ProtoBuf.Reflect.Element} */ this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax); /** * Internal map: stores mapping of (string form of key) -> (key, value) * pair. * * We provide map semantics for arbitrary key types, but we build on top * of an Object, which has only string keys. In order to avoid the need * to convert a string key back to its native type in many situations, * we store the native key value alongside the value. Thus, we only need * a one-way mapping from a key type to its string form that guarantees * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1 * === K2). * * @type {!Object} */ this.map = {}; /** * Returns the number of elements in the map. */ Object.defineProperty(this, "size", { get: function() { return Object.keys(this.map).length; } }); // Fill initial contents from a raw object. if (contents) { var keys = Object.keys(contents); for (var i = 0; i < keys.length; i++) { var key = this.keyElem.valueFromString(keys[i]); var val = this.valueElem.verifyValue(contents[keys[i]]); this.map[this.keyElem.valueToString(key)] = { key: key, value: val }; } } }; var MapPrototype = Map.prototype; /** * Helper: return an iterator over an array. * @param {!Array<*>} arr the array * @returns {!Object} an iterator * @inner */ function arrayIterator(arr) { var idx = 0; return { next: function() { if (idx < arr.length) return { done: false, value: arr[idx++] }; return { done: true }; } } } /** * Clears the map. */ MapPrototype.clear = function() { this.map = {}; }; /** * Deletes a particular key from the map. * @returns {boolean} Whether any entry with this key was deleted. */ MapPrototype["delete"] = function(key) { var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key)); var hadKey = keyValue in this.map; delete this.map[keyValue]; return hadKey; }; /** * Returns an iterator over [key, value] pairs in the map. * @returns {Object} The iterator */ MapPrototype.entries = function() { var entries = []; var strKeys = Object.keys(this.map); for (var i = 0, entry; i < strKeys.length; i++) entries.push([(entry=this.map[strKeys[i]]).key, entry.value]); return arrayIterator(entries); }; /** * Returns an iterator over keys in the map. * @returns {Object} The iterator */ MapPrototype.keys = function() { var keys = []; var strKeys = Object.keys(this.map); for (var i = 0; i < strKeys.length; i++) keys.push(this.map[strKeys[i]].key); return arrayIterator(keys); }; /** * Returns an iterator over values in the map. * @returns {!Object} The iterator */ MapPrototype.values = function() { var values = []; var strKeys = Object.keys(this.map); for (var i = 0; i < strKeys.length; i++) values.push(this.map[strKeys[i]].value); return arrayIterator(values); }; /** * Iterates over entries in the map, calling a function on each. * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments. * @param {Object=} thisArg The `this` value for the callback */ MapPrototype.forEach = function(cb, thisArg) { var strKeys = Object.keys(this.map); for (var i = 0, entry; i < strKeys.length; i++) cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this); }; /** * Sets a key in the map to the given value. * @param {*} key The key * @param {*} value The value * @returns {!ProtoBuf.Map} The map instance */ MapPrototype.set = function(key, value) { var keyValue = this.keyElem.verifyValue(key); var valValue = this.valueElem.verifyValue(value); this.map[this.keyElem.valueToString(keyValue)] = { key: keyValue, value: valValue }; return this; }; /** * Gets the value corresponding to a key in the map. * @param {*} key The key * @returns {*|undefined} The value, or `undefined` if key not present */ MapPrototype.get = function(key) { var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key)); if (!(keyValue in this.map)) return undefined; return this.map[keyValue].value; }; /** * Determines whether the given key is present in the map. * @param {*} key The key * @returns {boolean} `true` if the key is present */ MapPrototype.has = function(key) { var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key)); return (keyValue in this.map); }; return Map; })(ProtoBuf, ProtoBuf.Reflect); /** * Constructs a new empty Builder. * @param {Object.=} options Builder options, defaults to global options set on ProtoBuf * @return {!ProtoBuf.Builder} Builder * @expose */ ProtoBuf.newBuilder = function(options) { options = options || {}; if (typeof options['convertFieldsToCamelCase'] === 'undefined') options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase; if (typeof options['populateAccessors'] === 'undefined') options['populateAccessors'] = ProtoBuf.populateAccessors; return new ProtoBuf.Builder(options); }; /** * Loads a .json definition and returns the Builder. * @param {!*|string} json JSON definition * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted. * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports. * @return {ProtoBuf.Builder} Builder to create new messages * @throws {Error} If the definition cannot be parsed or built * @expose */ ProtoBuf.loadJson = function(json, builder, filename) { if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string')) filename = builder, builder = null; if (!builder || typeof builder !== 'object') builder = ProtoBuf.newBuilder(); if (typeof json === 'string') json = JSON.parse(json); builder["import"](json, filename); builder.resolveAll(); return builder; }; /** * Loads a .json file and returns the Builder. * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with * an overridden 'root' path for all imported files. * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the * file will be read synchronously and this function will return the Builder. * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted. * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the * request has failed), else undefined * @expose */ ProtoBuf.loadJsonFile = function(filename, callback, builder) { if (callback && typeof callback === 'object') builder = callback, callback = null; else if (!callback || typeof callback !== 'function') callback = null; if (callback) return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) { if (contents === null) { callback(Error("Failed to fetch file")); return; } try { callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename)); } catch (e) { callback(e); } }); var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename); return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename); }; return ProtoBuf; }); /***/ }), /* 613 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013-2014 Daniel Wirtz Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * @license bytebuffer.js (c) 2015 Daniel Wirtz * Backing buffer: ArrayBuffer, Accessor: Uint8Array * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/bytebuffer.js for details */ (function(global, factory) { /* AMD */ if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(614)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"]) module['exports'] = (function() { var Long; try { Long = require("long"); } catch (e) {} return factory(Long); })(); /* Global */ else (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]); })(this, function(Long) { "use strict"; /** * Constructs a new ByteBuffer. * @class The swiss army knife for binary data in JavaScript. * @exports ByteBuffer * @constructor * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to * {@link ByteBuffer.DEFAULT_ENDIAN}. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to * {@link ByteBuffer.DEFAULT_NOASSERT}. * @expose */ var ByteBuffer = function(capacity, littleEndian, noAssert) { if (typeof capacity === 'undefined') capacity = ByteBuffer.DEFAULT_CAPACITY; if (typeof littleEndian === 'undefined') littleEndian = ByteBuffer.DEFAULT_ENDIAN; if (typeof noAssert === 'undefined') noAssert = ByteBuffer.DEFAULT_NOASSERT; if (!noAssert) { capacity = capacity | 0; if (capacity < 0) throw RangeError("Illegal capacity"); littleEndian = !!littleEndian; noAssert = !!noAssert; } /** * Backing ArrayBuffer. * @type {!ArrayBuffer} * @expose */ this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity); /** * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`. * @type {?Uint8Array} * @expose */ this.view = capacity === 0 ? null : new Uint8Array(this.buffer); /** * Absolute read/write offset. * @type {number} * @expose * @see ByteBuffer#flip * @see ByteBuffer#clear */ this.offset = 0; /** * Marked offset. * @type {number} * @expose * @see ByteBuffer#mark * @see ByteBuffer#reset */ this.markedOffset = -1; /** * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation. * @type {number} * @expose * @see ByteBuffer#flip * @see ByteBuffer#clear */ this.limit = capacity; /** * Whether to use little endian byte order, defaults to `false` for big endian. * @type {boolean} * @expose */ this.littleEndian = littleEndian; /** * Whether to skip assertions of offsets and values, defaults to `false`. * @type {boolean} * @expose */ this.noAssert = noAssert; }; /** * ByteBuffer version. * @type {string} * @const * @expose */ ByteBuffer.VERSION = "5.0.1"; /** * Little endian constant that can be used instead of its boolean value. Evaluates to `true`. * @type {boolean} * @const * @expose */ ByteBuffer.LITTLE_ENDIAN = true; /** * Big endian constant that can be used instead of its boolean value. Evaluates to `false`. * @type {boolean} * @const * @expose */ ByteBuffer.BIG_ENDIAN = false; /** * Default initial capacity of `16`. * @type {number} * @expose */ ByteBuffer.DEFAULT_CAPACITY = 16; /** * Default endianess of `false` for big endian. * @type {boolean} * @expose */ ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN; /** * Default no assertions flag of `false`. * @type {boolean} * @expose */ ByteBuffer.DEFAULT_NOASSERT = false; /** * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded * and int64 support is not available. * @type {?Long} * @const * @see https://github.com/dcodeIO/long.js * @expose */ ByteBuffer.Long = Long || null; /** * @alias ByteBuffer.prototype * @inner */ var ByteBufferPrototype = ByteBuffer.prototype; /** * An indicator used to reliably determine if an object is a ByteBuffer or not. * @type {boolean} * @const * @expose * @private */ ByteBufferPrototype.__isByteBuffer__; Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", { value: true, enumerable: false, configurable: false }); // helpers /** * @type {!ArrayBuffer} * @inner */ var EMPTY_BUFFER = new ArrayBuffer(0); /** * String.fromCharCode reference for compile-time renaming. * @type {function(...number):string} * @inner */ var stringFromCharCode = String.fromCharCode; /** * Creates a source function for a string. * @param {string} s String to read from * @returns {function():number|null} Source function returning the next char code respectively `null` if there are * no more characters left. * @throws {TypeError} If the argument is invalid * @inner */ function stringSource(s) { var i=0; return function() { return i < s.length ? s.charCodeAt(i++) : null; }; } /** * Creates a destination function for a string. * @returns {function(number=):undefined|string} Destination function successively called with the next char code. * Returns the final string when called without arguments. * @inner */ function stringDestination() { var cs = [], ps = []; return function() { if (arguments.length === 0) return ps.join('')+stringFromCharCode.apply(String, cs); if (cs.length + arguments.length > 1024) ps.push(stringFromCharCode.apply(String, cs)), cs.length = 0; Array.prototype.push.apply(cs, arguments); }; } /** * Gets the accessor type. * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes) * @expose */ ByteBuffer.accessor = function() { return Uint8Array; }; /** * Allocates a new ByteBuffer backed by a buffer of the specified capacity. * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}. * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to * {@link ByteBuffer.DEFAULT_ENDIAN}. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to * {@link ByteBuffer.DEFAULT_NOASSERT}. * @returns {!ByteBuffer} * @expose */ ByteBuffer.allocate = function(capacity, littleEndian, noAssert) { return new ByteBuffer(capacity, littleEndian, noAssert); }; /** * Concatenates multiple ByteBuffers into one. * @param {!Array.} buffers Buffers to concatenate * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary", * defaults to "utf8") * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults * to {@link ByteBuffer.DEFAULT_ENDIAN}. * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to * {@link ByteBuffer.DEFAULT_NOASSERT}. * @returns {!ByteBuffer} Concatenated ByteBuffer * @expose */ ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) { if (typeof encoding === 'boolean' || typeof encoding !== 'string') { noAssert = littleEndian; littleEndian = encoding; encoding = undefined; } var capacity = 0; for (var i=0, k=buffers.length, length; i 0) capacity += length; } if (capacity === 0) return new ByteBuffer(0, littleEndian, noAssert); var bb = new ByteBuffer(capacity, littleEndian, noAssert), bi; i=0; while (i} buffer Anything that can be wrapped * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to * "utf8") * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to * {@link ByteBuffer.DEFAULT_ENDIAN}. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to * {@link ByteBuffer.DEFAULT_NOASSERT}. * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer` * @expose */ ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) { if (typeof encoding !== 'string') { noAssert = littleEndian; littleEndian = encoding; encoding = undefined; } if (typeof buffer === 'string') { if (typeof encoding === 'undefined') encoding = "utf8"; switch (encoding) { case "base64": return ByteBuffer.fromBase64(buffer, littleEndian); case "hex": return ByteBuffer.fromHex(buffer, littleEndian); case "binary": return ByteBuffer.fromBinary(buffer, littleEndian); case "utf8": return ByteBuffer.fromUTF8(buffer, littleEndian); case "debug": return ByteBuffer.fromDebug(buffer, littleEndian); default: throw Error("Unsupported encoding: "+encoding); } } if (buffer === null || typeof buffer !== 'object') throw TypeError("Illegal buffer"); var bb; if (ByteBuffer.isByteBuffer(buffer)) { bb = ByteBufferPrototype.clone.call(buffer); bb.markedOffset = -1; return bb; } if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array bb = new ByteBuffer(0, littleEndian, noAssert); if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER bb.buffer = buffer.buffer; bb.offset = buffer.byteOffset; bb.limit = buffer.byteOffset + buffer.byteLength; bb.view = new Uint8Array(buffer.buffer); } } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer bb = new ByteBuffer(0, littleEndian, noAssert); if (buffer.byteLength > 0) { bb.buffer = buffer; bb.offset = 0; bb.limit = buffer.byteLength; bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null; } } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets bb = new ByteBuffer(buffer.length, littleEndian, noAssert); bb.limit = buffer.length; for (var i=0; i} value Array of booleans to write * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted. * @returns {!ByteBuffer} * @expose */ ByteBufferPrototype.writeBitSet = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (!(value instanceof Array)) throw TypeError("Illegal BitSet: Not an array"); if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } var start = offset, bits = value.length, bytes = (bits >> 3), bit = 0, k; offset += this.writeVarint32(bits,offset); while(bytes--) { k = (!!value[bit++] & 1) | ((!!value[bit++] & 1) << 1) | ((!!value[bit++] & 1) << 2) | ((!!value[bit++] & 1) << 3) | ((!!value[bit++] & 1) << 4) | ((!!value[bit++] & 1) << 5) | ((!!value[bit++] & 1) << 6) | ((!!value[bit++] & 1) << 7); this.writeByte(k,offset++); } if(bit < bits) { var m = 0; k = 0; while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++)); this.writeByte(k,offset++); } if (relative) { this.offset = offset; return this; } return offset - start; } /** * Reads a BitSet as an array of booleans. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted. * @returns {Array * @expose */ ByteBufferPrototype.readBitSet = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; var ret = this.readVarint32(offset), bits = ret.value, bytes = (bits >> 3), bit = 0, value = [], k; offset += ret.length; while(bytes--) { k = this.readByte(offset++); value[bit++] = !!(k & 0x01); value[bit++] = !!(k & 0x02); value[bit++] = !!(k & 0x04); value[bit++] = !!(k & 0x08); value[bit++] = !!(k & 0x10); value[bit++] = !!(k & 0x20); value[bit++] = !!(k & 0x40); value[bit++] = !!(k & 0x80); } if(bit < bits) { var m = 0; k = this.readByte(offset++); while(bit < bits) value[bit++] = !!((k >> (m++)) & 1); } if (relative) { this.offset = offset; } return value; } /** * Reads the specified number of bytes. * @param {number} length Number of bytes to read * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted. * @returns {!ByteBuffer} * @expose */ ByteBufferPrototype.readBytes = function(length, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + length > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength); } var slice = this.slice(offset, offset + length); if (relative) this.offset += length; return slice; }; /** * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}. * @function * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets * will be modified according to the performed read operation. * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8") * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeBytes = ByteBufferPrototype.append; // types/ints/int8 /** * Writes an 8bit signed integer. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeInt8 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value !== 'number' || value % 1 !== 0) throw TypeError("Illegal value: "+value+" (not an integer)"); value |= 0; if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } offset += 1; var capacity0 = this.buffer.byteLength; if (offset > capacity0) this.resize((capacity0 *= 2) > offset ? capacity0 : offset); offset -= 1; this.view[offset] = value; if (relative) this.offset += 1; return this; }; /** * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}. * @function * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8; /** * Reads an 8bit signed integer. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted. * @returns {number} Value read * @expose */ ByteBufferPrototype.readInt8 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 1 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength); } var value = this.view[offset]; if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed if (relative) this.offset += 1; return value; }; /** * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}. * @function * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted. * @returns {number} Value read * @expose */ ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8; /** * Writes an 8bit unsigned integer. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeUint8 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value !== 'number' || value % 1 !== 0) throw TypeError("Illegal value: "+value+" (not an integer)"); value >>>= 0; if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } offset += 1; var capacity1 = this.buffer.byteLength; if (offset > capacity1) this.resize((capacity1 *= 2) > offset ? capacity1 : offset); offset -= 1; this.view[offset] = value; if (relative) this.offset += 1; return this; }; /** * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}. * @function * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8; /** * Reads an 8bit unsigned integer. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted. * @returns {number} Value read * @expose */ ByteBufferPrototype.readUint8 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 1 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength); } var value = this.view[offset]; if (relative) this.offset += 1; return value; }; /** * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}. * @function * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted. * @returns {number} Value read * @expose */ ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8; // types/ints/int16 /** * Writes a 16bit signed integer. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted. * @throws {TypeError} If `offset` or `value` is not a valid number * @throws {RangeError} If `offset` is out of bounds * @expose */ ByteBufferPrototype.writeInt16 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value !== 'number' || value % 1 !== 0) throw TypeError("Illegal value: "+value+" (not an integer)"); value |= 0; if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } offset += 2; var capacity2 = this.buffer.byteLength; if (offset > capacity2) this.resize((capacity2 *= 2) > offset ? capacity2 : offset); offset -= 2; if (this.littleEndian) { this.view[offset+1] = (value & 0xFF00) >>> 8; this.view[offset ] = value & 0x00FF; } else { this.view[offset] = (value & 0xFF00) >>> 8; this.view[offset+1] = value & 0x00FF; } if (relative) this.offset += 2; return this; }; /** * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}. * @function * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted. * @throws {TypeError} If `offset` or `value` is not a valid number * @throws {RangeError} If `offset` is out of bounds * @expose */ ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16; /** * Reads a 16bit signed integer. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted. * @returns {number} Value read * @throws {TypeError} If `offset` is not a valid number * @throws {RangeError} If `offset` is out of bounds * @expose */ ByteBufferPrototype.readInt16 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 2 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength); } var value = 0; if (this.littleEndian) { value = this.view[offset ]; value |= this.view[offset+1] << 8; } else { value = this.view[offset ] << 8; value |= this.view[offset+1]; } if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed if (relative) this.offset += 2; return value; }; /** * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}. * @function * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted. * @returns {number} Value read * @throws {TypeError} If `offset` is not a valid number * @throws {RangeError} If `offset` is out of bounds * @expose */ ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16; /** * Writes a 16bit unsigned integer. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted. * @throws {TypeError} If `offset` or `value` is not a valid number * @throws {RangeError} If `offset` is out of bounds * @expose */ ByteBufferPrototype.writeUint16 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value !== 'number' || value % 1 !== 0) throw TypeError("Illegal value: "+value+" (not an integer)"); value >>>= 0; if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } offset += 2; var capacity3 = this.buffer.byteLength; if (offset > capacity3) this.resize((capacity3 *= 2) > offset ? capacity3 : offset); offset -= 2; if (this.littleEndian) { this.view[offset+1] = (value & 0xFF00) >>> 8; this.view[offset ] = value & 0x00FF; } else { this.view[offset] = (value & 0xFF00) >>> 8; this.view[offset+1] = value & 0x00FF; } if (relative) this.offset += 2; return this; }; /** * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}. * @function * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted. * @throws {TypeError} If `offset` or `value` is not a valid number * @throws {RangeError} If `offset` is out of bounds * @expose */ ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16; /** * Reads a 16bit unsigned integer. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted. * @returns {number} Value read * @throws {TypeError} If `offset` is not a valid number * @throws {RangeError} If `offset` is out of bounds * @expose */ ByteBufferPrototype.readUint16 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 2 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength); } var value = 0; if (this.littleEndian) { value = this.view[offset ]; value |= this.view[offset+1] << 8; } else { value = this.view[offset ] << 8; value |= this.view[offset+1]; } if (relative) this.offset += 2; return value; }; /** * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}. * @function * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted. * @returns {number} Value read * @throws {TypeError} If `offset` is not a valid number * @throws {RangeError} If `offset` is out of bounds * @expose */ ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16; // types/ints/int32 /** * Writes a 32bit signed integer. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @expose */ ByteBufferPrototype.writeInt32 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value !== 'number' || value % 1 !== 0) throw TypeError("Illegal value: "+value+" (not an integer)"); value |= 0; if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } offset += 4; var capacity4 = this.buffer.byteLength; if (offset > capacity4) this.resize((capacity4 *= 2) > offset ? capacity4 : offset); offset -= 4; if (this.littleEndian) { this.view[offset+3] = (value >>> 24) & 0xFF; this.view[offset+2] = (value >>> 16) & 0xFF; this.view[offset+1] = (value >>> 8) & 0xFF; this.view[offset ] = value & 0xFF; } else { this.view[offset ] = (value >>> 24) & 0xFF; this.view[offset+1] = (value >>> 16) & 0xFF; this.view[offset+2] = (value >>> 8) & 0xFF; this.view[offset+3] = value & 0xFF; } if (relative) this.offset += 4; return this; }; /** * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @expose */ ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32; /** * Reads a 32bit signed integer. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @returns {number} Value read * @expose */ ByteBufferPrototype.readInt32 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 4 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength); } var value = 0; if (this.littleEndian) { value = this.view[offset+2] << 16; value |= this.view[offset+1] << 8; value |= this.view[offset ]; value += this.view[offset+3] << 24 >>> 0; } else { value = this.view[offset+1] << 16; value |= this.view[offset+2] << 8; value |= this.view[offset+3]; value += this.view[offset ] << 24 >>> 0; } value |= 0; // Cast to signed if (relative) this.offset += 4; return value; }; /** * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}. * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted. * @returns {number} Value read * @expose */ ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32; /** * Writes a 32bit unsigned integer. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @expose */ ByteBufferPrototype.writeUint32 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value !== 'number' || value % 1 !== 0) throw TypeError("Illegal value: "+value+" (not an integer)"); value >>>= 0; if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } offset += 4; var capacity5 = this.buffer.byteLength; if (offset > capacity5) this.resize((capacity5 *= 2) > offset ? capacity5 : offset); offset -= 4; if (this.littleEndian) { this.view[offset+3] = (value >>> 24) & 0xFF; this.view[offset+2] = (value >>> 16) & 0xFF; this.view[offset+1] = (value >>> 8) & 0xFF; this.view[offset ] = value & 0xFF; } else { this.view[offset ] = (value >>> 24) & 0xFF; this.view[offset+1] = (value >>> 16) & 0xFF; this.view[offset+2] = (value >>> 8) & 0xFF; this.view[offset+3] = value & 0xFF; } if (relative) this.offset += 4; return this; }; /** * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}. * @function * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @expose */ ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32; /** * Reads a 32bit unsigned integer. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @returns {number} Value read * @expose */ ByteBufferPrototype.readUint32 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 4 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength); } var value = 0; if (this.littleEndian) { value = this.view[offset+2] << 16; value |= this.view[offset+1] << 8; value |= this.view[offset ]; value += this.view[offset+3] << 24 >>> 0; } else { value = this.view[offset+1] << 16; value |= this.view[offset+2] << 8; value |= this.view[offset+3]; value += this.view[offset ] << 24 >>> 0; } if (relative) this.offset += 4; return value; }; /** * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}. * @function * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @returns {number} Value read * @expose */ ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32; // types/ints/int64 if (Long) { /** * Writes a 64bit signed integer. * @param {number|!Long} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeInt64 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value === 'number') value = Long.fromNumber(value); else if (typeof value === 'string') value = Long.fromString(value); else if (!(value && value instanceof Long)) throw TypeError("Illegal value: "+value+" (not an integer or Long)"); if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } if (typeof value === 'number') value = Long.fromNumber(value); else if (typeof value === 'string') value = Long.fromString(value); offset += 8; var capacity6 = this.buffer.byteLength; if (offset > capacity6) this.resize((capacity6 *= 2) > offset ? capacity6 : offset); offset -= 8; var lo = value.low, hi = value.high; if (this.littleEndian) { this.view[offset+3] = (lo >>> 24) & 0xFF; this.view[offset+2] = (lo >>> 16) & 0xFF; this.view[offset+1] = (lo >>> 8) & 0xFF; this.view[offset ] = lo & 0xFF; offset += 4; this.view[offset+3] = (hi >>> 24) & 0xFF; this.view[offset+2] = (hi >>> 16) & 0xFF; this.view[offset+1] = (hi >>> 8) & 0xFF; this.view[offset ] = hi & 0xFF; } else { this.view[offset ] = (hi >>> 24) & 0xFF; this.view[offset+1] = (hi >>> 16) & 0xFF; this.view[offset+2] = (hi >>> 8) & 0xFF; this.view[offset+3] = hi & 0xFF; offset += 4; this.view[offset ] = (lo >>> 24) & 0xFF; this.view[offset+1] = (lo >>> 16) & 0xFF; this.view[offset+2] = (lo >>> 8) & 0xFF; this.view[offset+3] = lo & 0xFF; } if (relative) this.offset += 8; return this; }; /** * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}. * @param {number|!Long} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64; /** * Reads a 64bit signed integer. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!Long} * @expose */ ByteBufferPrototype.readInt64 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 8 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength); } var lo = 0, hi = 0; if (this.littleEndian) { lo = this.view[offset+2] << 16; lo |= this.view[offset+1] << 8; lo |= this.view[offset ]; lo += this.view[offset+3] << 24 >>> 0; offset += 4; hi = this.view[offset+2] << 16; hi |= this.view[offset+1] << 8; hi |= this.view[offset ]; hi += this.view[offset+3] << 24 >>> 0; } else { hi = this.view[offset+1] << 16; hi |= this.view[offset+2] << 8; hi |= this.view[offset+3]; hi += this.view[offset ] << 24 >>> 0; offset += 4; lo = this.view[offset+1] << 16; lo |= this.view[offset+2] << 8; lo |= this.view[offset+3]; lo += this.view[offset ] << 24 >>> 0; } var value = new Long(lo, hi, false); if (relative) this.offset += 8; return value; }; /** * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!Long} * @expose */ ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64; /** * Writes a 64bit unsigned integer. * @param {number|!Long} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeUint64 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value === 'number') value = Long.fromNumber(value); else if (typeof value === 'string') value = Long.fromString(value); else if (!(value && value instanceof Long)) throw TypeError("Illegal value: "+value+" (not an integer or Long)"); if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } if (typeof value === 'number') value = Long.fromNumber(value); else if (typeof value === 'string') value = Long.fromString(value); offset += 8; var capacity7 = this.buffer.byteLength; if (offset > capacity7) this.resize((capacity7 *= 2) > offset ? capacity7 : offset); offset -= 8; var lo = value.low, hi = value.high; if (this.littleEndian) { this.view[offset+3] = (lo >>> 24) & 0xFF; this.view[offset+2] = (lo >>> 16) & 0xFF; this.view[offset+1] = (lo >>> 8) & 0xFF; this.view[offset ] = lo & 0xFF; offset += 4; this.view[offset+3] = (hi >>> 24) & 0xFF; this.view[offset+2] = (hi >>> 16) & 0xFF; this.view[offset+1] = (hi >>> 8) & 0xFF; this.view[offset ] = hi & 0xFF; } else { this.view[offset ] = (hi >>> 24) & 0xFF; this.view[offset+1] = (hi >>> 16) & 0xFF; this.view[offset+2] = (hi >>> 8) & 0xFF; this.view[offset+3] = hi & 0xFF; offset += 4; this.view[offset ] = (lo >>> 24) & 0xFF; this.view[offset+1] = (lo >>> 16) & 0xFF; this.view[offset+2] = (lo >>> 8) & 0xFF; this.view[offset+3] = lo & 0xFF; } if (relative) this.offset += 8; return this; }; /** * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}. * @function * @param {number|!Long} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64; /** * Reads a 64bit unsigned integer. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!Long} * @expose */ ByteBufferPrototype.readUint64 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 8 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength); } var lo = 0, hi = 0; if (this.littleEndian) { lo = this.view[offset+2] << 16; lo |= this.view[offset+1] << 8; lo |= this.view[offset ]; lo += this.view[offset+3] << 24 >>> 0; offset += 4; hi = this.view[offset+2] << 16; hi |= this.view[offset+1] << 8; hi |= this.view[offset ]; hi += this.view[offset+3] << 24 >>> 0; } else { hi = this.view[offset+1] << 16; hi |= this.view[offset+2] << 8; hi |= this.view[offset+3]; hi += this.view[offset ] << 24 >>> 0; offset += 4; lo = this.view[offset+1] << 16; lo |= this.view[offset+2] << 8; lo |= this.view[offset+3]; lo += this.view[offset ] << 24 >>> 0; } var value = new Long(lo, hi, true); if (relative) this.offset += 8; return value; }; /** * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}. * @function * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!Long} * @expose */ ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64; } // Long // types/floats/float32 /* ieee754 - https://github.com/feross/ieee754 The MIT License (MIT) Copyright (c) Feross Aboukhadijeh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Reads an IEEE754 float from a byte array. * @param {!Array} buffer * @param {number} offset * @param {boolean} isLE * @param {number} mLen * @param {number} nBytes * @returns {number} * @inner */ function ieee754_read(buffer, offset, isLE, mLen, nBytes) { var e, m, eLen = nBytes * 8 - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, nBits = -7, i = isLE ? (nBytes - 1) : 0, d = isLE ? -1 : 1, s = buffer[offset + i]; i += d; e = s & ((1 << (-nBits)) - 1); s >>= (-nBits); nBits += eLen; for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} m = e & ((1 << (-nBits)) - 1); e >>= (-nBits); nBits += mLen; for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias; } else if (e === eMax) { return m ? NaN : ((s ? -1 : 1) * Infinity); } else { m = m + Math.pow(2, mLen); e = e - eBias; } return (s ? -1 : 1) * m * Math.pow(2, e - mLen); } /** * Writes an IEEE754 float to a byte array. * @param {!Array} buffer * @param {number} value * @param {number} offset * @param {boolean} isLE * @param {number} mLen * @param {number} nBytes * @inner */ function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) { var e, m, c, eLen = nBytes * 8 - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), i = isLE ? 0 : (nBytes - 1), d = isLE ? 1 : -1, s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; value = Math.abs(value); if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0; e = eMax; } else { e = Math.floor(Math.log(value) / Math.LN2); if (value * (c = Math.pow(2, -e)) < 1) { e--; c *= 2; } if (e + eBias >= 1) { value += rt / c; } else { value += rt * Math.pow(2, 1 - eBias); } if (value * c >= 2) { e++; c /= 2; } if (e + eBias >= eMax) { m = 0; e = eMax; } else if (e + eBias >= 1) { m = (value * c - 1) * Math.pow(2, mLen); e = e + eBias; } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); e = 0; } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} e = (e << mLen) | m; eLen += mLen; for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} buffer[offset + i - d] |= s * 128; } /** * Writes a 32bit float. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeFloat32 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value !== 'number') throw TypeError("Illegal value: "+value+" (not a number)"); if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } offset += 4; var capacity8 = this.buffer.byteLength; if (offset > capacity8) this.resize((capacity8 *= 2) > offset ? capacity8 : offset); offset -= 4; ieee754_write(this.view, value, offset, this.littleEndian, 23, 4); if (relative) this.offset += 4; return this; }; /** * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}. * @function * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32; /** * Reads a 32bit float. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @returns {number} * @expose */ ByteBufferPrototype.readFloat32 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 4 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength); } var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4); if (relative) this.offset += 4; return value; }; /** * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}. * @function * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted. * @returns {number} * @expose */ ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32; // types/floats/float64 /** * Writes a 64bit float. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeFloat64 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value !== 'number') throw TypeError("Illegal value: "+value+" (not a number)"); if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } offset += 8; var capacity9 = this.buffer.byteLength; if (offset > capacity9) this.resize((capacity9 *= 2) > offset ? capacity9 : offset); offset -= 8; ieee754_write(this.view, value, offset, this.littleEndian, 52, 8); if (relative) this.offset += 8; return this; }; /** * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}. * @function * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64; /** * Reads a 64bit float. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {number} * @expose */ ByteBufferPrototype.readFloat64 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 8 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength); } var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8); if (relative) this.offset += 8; return value; }; /** * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}. * @function * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted. * @returns {number} * @expose */ ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64; // types/varints/varint32 /** * Maximum number of bytes required to store a 32bit base 128 variable-length integer. * @type {number} * @const * @expose */ ByteBuffer.MAX_VARINT32_BYTES = 5; /** * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer. * @param {number} value Value to encode * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES} * @expose */ ByteBuffer.calculateVarint32 = function(value) { // ref: src/google/protobuf/io/coded_stream.cc value = value >>> 0; if (value < 1 << 7 ) return 1; else if (value < 1 << 14) return 2; else if (value < 1 << 21) return 3; else if (value < 1 << 28) return 4; else return 5; }; /** * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding. * @param {number} n Signed 32bit integer * @returns {number} Unsigned zigzag encoded 32bit integer * @expose */ ByteBuffer.zigZagEncode32 = function(n) { return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h }; /** * Decodes a zigzag encoded signed 32bit integer. * @param {number} n Unsigned zigzag encoded 32bit integer * @returns {number} Signed 32bit integer * @expose */ ByteBuffer.zigZagDecode32 = function(n) { return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h }; /** * Writes a 32bit base 128 variable-length integer. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written * @expose */ ByteBufferPrototype.writeVarint32 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value !== 'number' || value % 1 !== 0) throw TypeError("Illegal value: "+value+" (not an integer)"); value |= 0; if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } var size = ByteBuffer.calculateVarint32(value), b; offset += size; var capacity10 = this.buffer.byteLength; if (offset > capacity10) this.resize((capacity10 *= 2) > offset ? capacity10 : offset); offset -= size; value >>>= 0; while (value >= 0x80) { b = (value & 0x7f) | 0x80; this.view[offset++] = b; value >>>= 7; } this.view[offset++] = value; if (relative) { this.offset = offset; return this; } return size; }; /** * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer. * @param {number} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written * @expose */ ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) { return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset); }; /** * Reads a 32bit base 128 variable-length integer. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read * and the actual number of bytes read. * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available * to fully decode the varint. * @expose */ ByteBufferPrototype.readVarint32 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 1 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength); } var c = 0, value = 0 >>> 0, b; do { if (!this.noAssert && offset > this.limit) { var err = Error("Truncated"); err['truncated'] = true; throw err; } b = this.view[offset++]; if (c < 5) value |= (b & 0x7f) << (7*c); ++c; } while ((b & 0x80) !== 0); value |= 0; if (relative) { this.offset = offset; return value; } return { "value": value, "length": c }; }; /** * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read * and the actual number of bytes read. * @throws {Error} If it's not a valid varint * @expose */ ByteBufferPrototype.readVarint32ZigZag = function(offset) { var val = this.readVarint32(offset); if (typeof val === 'object') val["value"] = ByteBuffer.zigZagDecode32(val["value"]); else val = ByteBuffer.zigZagDecode32(val); return val; }; // types/varints/varint64 if (Long) { /** * Maximum number of bytes required to store a 64bit base 128 variable-length integer. * @type {number} * @const * @expose */ ByteBuffer.MAX_VARINT64_BYTES = 10; /** * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer. * @param {number|!Long} value Value to encode * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES} * @expose */ ByteBuffer.calculateVarint64 = function(value) { if (typeof value === 'number') value = Long.fromNumber(value); else if (typeof value === 'string') value = Long.fromString(value); // ref: src/google/protobuf/io/coded_stream.cc var part0 = value.toInt() >>> 0, part1 = value.shiftRightUnsigned(28).toInt() >>> 0, part2 = value.shiftRightUnsigned(56).toInt() >>> 0; if (part2 == 0) { if (part1 == 0) { if (part0 < 1 << 14) return part0 < 1 << 7 ? 1 : 2; else return part0 < 1 << 21 ? 3 : 4; } else { if (part1 < 1 << 14) return part1 < 1 << 7 ? 5 : 6; else return part1 < 1 << 21 ? 7 : 8; } } else return part2 < 1 << 7 ? 9 : 10; }; /** * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding. * @param {number|!Long} value Signed long * @returns {!Long} Unsigned zigzag encoded long * @expose */ ByteBuffer.zigZagEncode64 = function(value) { if (typeof value === 'number') value = Long.fromNumber(value, false); else if (typeof value === 'string') value = Long.fromString(value, false); else if (value.unsigned !== false) value = value.toSigned(); // ref: src/google/protobuf/wire_format_lite.h return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned(); }; /** * Decodes a zigzag encoded signed 64bit integer. * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number * @returns {!Long} Signed long * @expose */ ByteBuffer.zigZagDecode64 = function(value) { if (typeof value === 'number') value = Long.fromNumber(value, false); else if (typeof value === 'string') value = Long.fromString(value, false); else if (value.unsigned !== false) value = value.toSigned(); // ref: src/google/protobuf/wire_format_lite.h return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned(); }; /** * Writes a 64bit base 128 variable-length integer. * @param {number|Long} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written. * @expose */ ByteBufferPrototype.writeVarint64 = function(value, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof value === 'number') value = Long.fromNumber(value); else if (typeof value === 'string') value = Long.fromString(value); else if (!(value && value instanceof Long)) throw TypeError("Illegal value: "+value+" (not an integer or Long)"); if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } if (typeof value === 'number') value = Long.fromNumber(value, false); else if (typeof value === 'string') value = Long.fromString(value, false); else if (value.unsigned !== false) value = value.toSigned(); var size = ByteBuffer.calculateVarint64(value), part0 = value.toInt() >>> 0, part1 = value.shiftRightUnsigned(28).toInt() >>> 0, part2 = value.shiftRightUnsigned(56).toInt() >>> 0; offset += size; var capacity11 = this.buffer.byteLength; if (offset > capacity11) this.resize((capacity11 *= 2) > offset ? capacity11 : offset); offset -= size; switch (size) { case 10: this.view[offset+9] = (part2 >>> 7) & 0x01; case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F; case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F; case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F; case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F; case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F; case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F; case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F; case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F; case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F; } if (relative) { this.offset += size; return this; } else { return size; } }; /** * Writes a zig-zag encoded 64bit base 128 variable-length integer. * @param {number|Long} value Value to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written. * @expose */ ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) { return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset); }; /** * Reads a 64bit base 128 variable-length integer. Requires Long.js. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes * read if omitted. * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and * the actual number of bytes read. * @throws {Error} If it's not a valid varint * @expose */ ByteBufferPrototype.readVarint64 = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 1 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength); } // ref: src/google/protobuf/io/coded_stream.cc var start = offset, part0 = 0, part1 = 0, part2 = 0, b = 0; b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) { b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) { b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) { b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) { b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) { b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) { b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) { b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) { b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) { b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) { throw Error("Buffer overrun"); }}}}}}}}}} var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false); if (relative) { this.offset = offset; return value; } else { return { 'value': value, 'length': offset-start }; } }; /** * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes * read if omitted. * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and * the actual number of bytes read. * @throws {Error} If it's not a valid varint * @expose */ ByteBufferPrototype.readVarint64ZigZag = function(offset) { var val = this.readVarint64(offset); if (val && val['value'] instanceof Long) val["value"] = ByteBuffer.zigZagDecode64(val["value"]); else val = ByteBuffer.zigZagDecode64(val); return val; }; } // Long // types/strings/cstring /** * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL * characters itself. * @param {string} str String to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes * contained in `str` + 1 if omitted. * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written * @expose */ ByteBufferPrototype.writeCString = function(str, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; var i, k = str.length; if (!this.noAssert) { if (typeof str !== 'string') throw TypeError("Illegal str: Not a string"); for (i=0; i>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } // UTF8 strings do not contain zero bytes in between except for the zero character, so: k = utfx.calculateUTF16asUTF8(stringSource(str))[1]; offset += k+1; var capacity12 = this.buffer.byteLength; if (offset > capacity12) this.resize((capacity12 *= 2) > offset ? capacity12 : offset); offset -= k+1; utfx.encodeUTF16toUTF8(stringSource(str), function(b) { this.view[offset++] = b; }.bind(this)); this.view[offset++] = 0; if (relative) { this.offset = offset; return this; } return k; }; /** * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters * itself. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes * read if omitted. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string * read and the actual number of bytes read. * @expose */ ByteBufferPrototype.readCString = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 1 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength); } var start = offset, temp; // UTF8 strings do not contain zero bytes in between except for the zero character itself, so: var sd, b = -1; utfx.decodeUTF8toUTF16(function() { if (b === 0) return null; if (offset >= this.limit) throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit); b = this.view[offset++]; return b === 0 ? null : b; }.bind(this), sd = stringDestination(), true); if (relative) { this.offset = offset; return sd(); } else { return { "string": sd(), "length": offset - start }; } }; // types/strings/istring /** * Writes a length as uint32 prefixed UTF8 encoded string. * @param {string} str String to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written * @expose * @see ByteBuffer#writeVarint32 */ ByteBufferPrototype.writeIString = function(str, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof str !== 'string') throw TypeError("Illegal str: Not a string"); if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } var start = offset, k; k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1]; offset += 4+k; var capacity13 = this.buffer.byteLength; if (offset > capacity13) this.resize((capacity13 *= 2) > offset ? capacity13 : offset); offset -= 4+k; if (this.littleEndian) { this.view[offset+3] = (k >>> 24) & 0xFF; this.view[offset+2] = (k >>> 16) & 0xFF; this.view[offset+1] = (k >>> 8) & 0xFF; this.view[offset ] = k & 0xFF; } else { this.view[offset ] = (k >>> 24) & 0xFF; this.view[offset+1] = (k >>> 16) & 0xFF; this.view[offset+2] = (k >>> 8) & 0xFF; this.view[offset+3] = k & 0xFF; } offset += 4; utfx.encodeUTF16toUTF8(stringSource(str), function(b) { this.view[offset++] = b; }.bind(this)); if (offset !== start + 4 + k) throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k)); if (relative) { this.offset = offset; return this; } return offset - start; }; /** * Reads a length as uint32 prefixed UTF8 encoded string. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes * read if omitted. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string * read and the actual number of bytes read. * @expose * @see ByteBuffer#readVarint32 */ ByteBufferPrototype.readIString = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 4 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength); } var start = offset; var len = this.readUint32(offset); var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4); offset += str['length']; if (relative) { this.offset = offset; return str['string']; } else { return { 'string': str['string'], 'length': offset - start }; } }; // types/strings/utf8string /** * Metrics representing number of UTF8 characters. Evaluates to `c`. * @type {string} * @const * @expose */ ByteBuffer.METRICS_CHARS = 'c'; /** * Metrics representing number of bytes. Evaluates to `b`. * @type {string} * @const * @expose */ ByteBuffer.METRICS_BYTES = 'b'; /** * Writes an UTF8 encoded string. * @param {string} str String to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted. * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written. * @expose */ ByteBufferPrototype.writeUTF8String = function(str, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } var k; var start = offset; k = utfx.calculateUTF16asUTF8(stringSource(str))[1]; offset += k; var capacity14 = this.buffer.byteLength; if (offset > capacity14) this.resize((capacity14 *= 2) > offset ? capacity14 : offset); offset -= k; utfx.encodeUTF16toUTF8(stringSource(str), function(b) { this.view[offset++] = b; }.bind(this)); if (relative) { this.offset = offset; return this; } return offset - start; }; /** * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}. * @function * @param {string} str String to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted. * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written. * @expose */ ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String; /** * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF. * @param {string} str String to calculate * @returns {number} Number of UTF8 characters * @expose */ ByteBuffer.calculateUTF8Chars = function(str) { return utfx.calculateUTF16asUTF8(stringSource(str))[0]; }; /** * Calculates the number of UTF8 bytes of a string. * @param {string} str String to calculate * @returns {number} Number of UTF8 bytes * @expose */ ByteBuffer.calculateUTF8Bytes = function(str) { return utfx.calculateUTF16asUTF8(stringSource(str))[1]; }; /** * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}. * @function * @param {string} str String to calculate * @returns {number} Number of UTF8 bytes * @expose */ ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes; /** * Reads an UTF8 encoded string. * @param {number} length Number of characters or bytes to read. * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to * {@link ByteBuffer.METRICS_CHARS}. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes * read if omitted. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string * read and the actual number of bytes read. * @expose */ ByteBufferPrototype.readUTF8String = function(length, metrics, offset) { if (typeof metrics === 'number') { offset = metrics; metrics = undefined; } var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS; if (!this.noAssert) { if (typeof length !== 'number' || length % 1 !== 0) throw TypeError("Illegal length: "+length+" (not an integer)"); length |= 0; if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } var i = 0, start = offset, sd; if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser sd = stringDestination(); utfx.decodeUTF8(function() { return i < length && offset < this.limit ? this.view[offset++] : null; }.bind(this), function(cp) { ++i; utfx.UTF8toUTF16(cp, sd); }); if (i !== length) throw RangeError("Illegal range: Truncated data, "+i+" == "+length); if (relative) { this.offset = offset; return sd(); } else { return { "string": sd(), "length": offset - start }; } } else if (metrics === ByteBuffer.METRICS_BYTES) { if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + length > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength); } var k = offset + length; utfx.decodeUTF8toUTF16(function() { return offset < k ? this.view[offset++] : null; }.bind(this), sd = stringDestination(), this.noAssert); if (offset !== k) throw RangeError("Illegal range: Truncated data, "+offset+" == "+k); if (relative) { this.offset = offset; return sd(); } else { return { 'string': sd(), 'length': offset - start }; } } else throw TypeError("Unsupported metrics: "+metrics); }; /** * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}. * @function * @param {number} length Number of characters or bytes to read * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to * {@link ByteBuffer.METRICS_CHARS}. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes * read if omitted. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string * read and the actual number of bytes read. * @expose */ ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String; // types/strings/vstring /** * Writes a length as varint32 prefixed UTF8 encoded string. * @param {string} str String to write * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written * @expose * @see ByteBuffer#writeVarint32 */ ByteBufferPrototype.writeVString = function(str, offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof str !== 'string') throw TypeError("Illegal str: Not a string"); if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } var start = offset, k, l; k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1]; l = ByteBuffer.calculateVarint32(k); offset += l+k; var capacity15 = this.buffer.byteLength; if (offset > capacity15) this.resize((capacity15 *= 2) > offset ? capacity15 : offset); offset -= l+k; offset += this.writeVarint32(k, offset); utfx.encodeUTF16toUTF8(stringSource(str), function(b) { this.view[offset++] = b; }.bind(this)); if (offset !== start+k+l) throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l)); if (relative) { this.offset = offset; return this; } return offset - start; }; /** * Reads a length as varint32 prefixed UTF8 encoded string. * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes * read if omitted. * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string * read and the actual number of bytes read. * @expose * @see ByteBuffer#readVarint32 */ ByteBufferPrototype.readVString = function(offset) { var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 1 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength); } var start = offset; var len = this.readVarint32(offset); var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']); offset += str['length']; if (relative) { this.offset = offset; return str['string']; } else { return { 'string': str['string'], 'length': offset - start }; } }; /** * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended * data's length. * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets * will be modified according to the performed read operation. * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8") * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. * @returns {!ByteBuffer} this * @expose * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|` * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|` */ ByteBufferPrototype.append = function(source, encoding, offset) { if (typeof encoding === 'number' || typeof encoding !== 'string') { offset = encoding; encoding = undefined; } var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } if (!(source instanceof ByteBuffer)) source = ByteBuffer.wrap(source, encoding); var length = source.limit - source.offset; if (length <= 0) return this; // Nothing to append offset += length; var capacity16 = this.buffer.byteLength; if (offset > capacity16) this.resize((capacity16 *= 2) > offset ? capacity16 : offset); offset -= length; this.view.set(source.view.subarray(source.offset, source.limit), offset); source.offset += length; if (relative) this.offset += length; return this; }; /** * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the specified offset up to the length of this ByteBuffer's data. * @param {!ByteBuffer} target Target ByteBuffer * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes * read if omitted. * @returns {!ByteBuffer} this * @expose * @see ByteBuffer#append */ ByteBufferPrototype.appendTo = function(target, offset) { target.append(this, offset); return this; }; /** * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to * disable them if your code already makes sure that everything is valid. * @param {boolean} assert `true` to enable assertions, otherwise `false` * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.assert = function(assert) { this.noAssert = !assert; return this; }; /** * Gets the capacity of this ByteBuffer's backing buffer. * @returns {number} Capacity of the backing buffer * @expose */ ByteBufferPrototype.capacity = function() { return this.buffer.byteLength; }; /** * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.clear = function() { this.offset = 0; this.limit = this.buffer.byteLength; this.markedOffset = -1; return this; }; /** * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset}, * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}. * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false` * @returns {!ByteBuffer} Cloned instance * @expose */ ByteBufferPrototype.clone = function(copy) { var bb = new ByteBuffer(0, this.littleEndian, this.noAssert); if (copy) { bb.buffer = new ArrayBuffer(this.buffer.byteLength); bb.view = new Uint8Array(bb.buffer); } else { bb.buffer = this.buffer; bb.view = this.view; } bb.offset = this.offset; bb.markedOffset = this.markedOffset; bb.limit = this.limit; return bb; }; /** * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and * adapt {@link ByteBuffer#markedOffset} to the same relative position if set. * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset} * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit} * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.compact = function(begin, end) { if (typeof begin === 'undefined') begin = this.offset; if (typeof end === 'undefined') end = this.limit; if (!this.noAssert) { if (typeof begin !== 'number' || begin % 1 !== 0) throw TypeError("Illegal begin: Not an integer"); begin >>>= 0; if (typeof end !== 'number' || end % 1 !== 0) throw TypeError("Illegal end: Not an integer"); end >>>= 0; if (begin < 0 || begin > end || end > this.buffer.byteLength) throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength); } if (begin === 0 && end === this.buffer.byteLength) return this; // Already compacted var len = end - begin; if (len === 0) { this.buffer = EMPTY_BUFFER; this.view = null; if (this.markedOffset >= 0) this.markedOffset -= begin; this.offset = 0; this.limit = 0; return this; } var buffer = new ArrayBuffer(len); var view = new Uint8Array(buffer); view.set(this.view.subarray(begin, end)); this.buffer = buffer; this.view = view; if (this.markedOffset >= 0) this.markedOffset -= begin; this.offset = 0; this.limit = len; return this; }; /** * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and * {@link ByteBuffer#limit}. * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}. * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}. * @returns {!ByteBuffer} Copy * @expose */ ByteBufferPrototype.copy = function(begin, end) { if (typeof begin === 'undefined') begin = this.offset; if (typeof end === 'undefined') end = this.limit; if (!this.noAssert) { if (typeof begin !== 'number' || begin % 1 !== 0) throw TypeError("Illegal begin: Not an integer"); begin >>>= 0; if (typeof end !== 'number' || end % 1 !== 0) throw TypeError("Illegal end: Not an integer"); end >>>= 0; if (begin < 0 || begin > end || end > this.buffer.byteLength) throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength); } if (begin === end) return new ByteBuffer(0, this.littleEndian, this.noAssert); var capacity = end - begin, bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert); bb.offset = 0; bb.limit = capacity; if (bb.markedOffset >= 0) bb.markedOffset -= begin; this.copyTo(bb, 0, begin, end); return bb; }; /** * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and * {@link ByteBuffer#limit}. * @param {!ByteBuffer} target Target ByteBuffer * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset} * by the number of bytes copied if omitted. * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the * number of bytes copied if omitted. * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit} * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) { var relative, targetRelative; if (!this.noAssert) { if (!ByteBuffer.isByteBuffer(target)) throw TypeError("Illegal target: Not a ByteBuffer"); } targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0; sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0; sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0; if (targetOffset < 0 || targetOffset > target.buffer.byteLength) throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength); if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength) throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength); var len = sourceLimit - sourceOffset; if (len === 0) return target; // Nothing to copy target.ensureCapacity(targetOffset + len); target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset); if (relative) this.offset += len; if (targetRelative) target.offset += len; return this; }; /** * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity, * the required capacity will be used instead. * @param {number} capacity Required capacity * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.ensureCapacity = function(capacity) { var current = this.buffer.byteLength; if (current < capacity) return this.resize((current *= 2) > capacity ? current : capacity); return this; }; /** * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. * @param {number|string} value Byte value to fill with. If given as a string, the first character is used. * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes * written if omitted. defaults to {@link ByteBuffer#offset}. * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}. * @returns {!ByteBuffer} this * @expose * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes */ ByteBufferPrototype.fill = function(value, begin, end) { var relative = typeof begin === 'undefined'; if (relative) begin = this.offset; if (typeof value === 'string' && value.length > 0) value = value.charCodeAt(0); if (typeof begin === 'undefined') begin = this.offset; if (typeof end === 'undefined') end = this.limit; if (!this.noAssert) { if (typeof value !== 'number' || value % 1 !== 0) throw TypeError("Illegal value: "+value+" (not an integer)"); value |= 0; if (typeof begin !== 'number' || begin % 1 !== 0) throw TypeError("Illegal begin: Not an integer"); begin >>>= 0; if (typeof end !== 'number' || end % 1 !== 0) throw TypeError("Illegal end: Not an integer"); end >>>= 0; if (begin < 0 || begin > end || end > this.buffer.byteLength) throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength); } if (begin >= end) return this; // Nothing to fill while (begin < end) this.view[begin++] = value; if (relative) this.offset = begin; return this; }; /** * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.flip = function() { this.limit = this.offset; this.offset = 0; return this; }; /** * Marks an offset on this ByteBuffer to be used later. * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}. * @returns {!ByteBuffer} this * @throws {TypeError} If `offset` is not a valid number * @throws {RangeError} If `offset` is out of bounds * @see ByteBuffer#reset * @expose */ ByteBufferPrototype.mark = function(offset) { offset = typeof offset === 'undefined' ? this.offset : offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } this.markedOffset = offset; return this; }; /** * Sets the byte order. * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.order = function(littleEndian) { if (!this.noAssert) { if (typeof littleEndian !== 'boolean') throw TypeError("Illegal littleEndian: Not a boolean"); } this.littleEndian = !!littleEndian; return this; }; /** * Switches (to) little endian byte order. * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.LE = function(littleEndian) { this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true; return this; }; /** * Switches (to) big endian byte order. * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.BE = function(bigEndian) { this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false; return this; }; /** * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer * will be resized and its contents moved accordingly. * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be * modified according to the performed read operation. * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8") * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes * prepended if omitted. * @returns {!ByteBuffer} this * @expose * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|` * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|` */ ByteBufferPrototype.prepend = function(source, encoding, offset) { if (typeof encoding === 'number' || typeof encoding !== 'string') { offset = encoding; encoding = undefined; } var relative = typeof offset === 'undefined'; if (relative) offset = this.offset; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: "+offset+" (not an integer)"); offset >>>= 0; if (offset < 0 || offset + 0 > this.buffer.byteLength) throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength); } if (!(source instanceof ByteBuffer)) source = ByteBuffer.wrap(source, encoding); var len = source.limit - source.offset; if (len <= 0) return this; // Nothing to prepend var diff = len - offset; if (diff > 0) { // Not enough space before offset, so resize + move var buffer = new ArrayBuffer(this.buffer.byteLength + diff); var view = new Uint8Array(buffer); view.set(this.view.subarray(offset, this.buffer.byteLength), len); this.buffer = buffer; this.view = view; this.offset += diff; if (this.markedOffset >= 0) this.markedOffset += diff; this.limit += diff; offset += diff; } else { var arrayView = new Uint8Array(this.buffer); } this.view.set(source.view.subarray(source.offset, source.limit), offset - len); source.offset = source.limit; if (relative) this.offset -= len; return this; }; /** * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer * will be resized and its contents moved accordingly. * @param {!ByteBuffer} target Target ByteBuffer * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes * prepended if omitted. * @returns {!ByteBuffer} this * @expose * @see ByteBuffer#prepend */ ByteBufferPrototype.prependTo = function(target, offset) { target.prepend(this, offset); return this; }; /** * Prints debug information about this ByteBuffer's contents. * @param {function(string)=} out Output function to call, defaults to console.log * @expose */ ByteBufferPrototype.printDebug = function(out) { if (typeof out !== 'function') out = console.log.bind(console); out( this.toString()+"\n"+ "-------------------------------------------------------------------\n"+ this.toDebug(/* columns */ true) ); }; /** * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and * {@link ByteBuffer#limit}, so this returns `limit - offset`. * @returns {number} Remaining readable bytes. May be negative if `offset > limit`. * @expose */ ByteBufferPrototype.remaining = function() { return this.limit - this.offset; }; /** * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark} * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been * marked, sets `offset = 0`. * @returns {!ByteBuffer} this * @see ByteBuffer#mark * @expose */ ByteBufferPrototype.reset = function() { if (this.markedOffset >= 0) { this.offset = this.markedOffset; this.markedOffset = -1; } else { this.offset = 0; } return this; }; /** * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that * large or larger. * @param {number} capacity Capacity required * @returns {!ByteBuffer} this * @throws {TypeError} If `capacity` is not a number * @throws {RangeError} If `capacity < 0` * @expose */ ByteBufferPrototype.resize = function(capacity) { if (!this.noAssert) { if (typeof capacity !== 'number' || capacity % 1 !== 0) throw TypeError("Illegal capacity: "+capacity+" (not an integer)"); capacity |= 0; if (capacity < 0) throw RangeError("Illegal capacity: 0 <= "+capacity); } if (this.buffer.byteLength < capacity) { var buffer = new ArrayBuffer(capacity); var view = new Uint8Array(buffer); view.set(this.view); this.buffer = buffer; this.view = view; } return this; }; /** * Reverses this ByteBuffer's contents. * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset} * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit} * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.reverse = function(begin, end) { if (typeof begin === 'undefined') begin = this.offset; if (typeof end === 'undefined') end = this.limit; if (!this.noAssert) { if (typeof begin !== 'number' || begin % 1 !== 0) throw TypeError("Illegal begin: Not an integer"); begin >>>= 0; if (typeof end !== 'number' || end % 1 !== 0) throw TypeError("Illegal end: Not an integer"); end >>>= 0; if (begin < 0 || begin > end || end > this.buffer.byteLength) throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength); } if (begin === end) return this; // Nothing to reverse Array.prototype.reverse.call(this.view.subarray(begin, end)); return this; }; /** * Skips the next `length` bytes. This will just advance * @param {number} length Number of bytes to skip. May also be negative to move the offset back. * @returns {!ByteBuffer} this * @expose */ ByteBufferPrototype.skip = function(length) { if (!this.noAssert) { if (typeof length !== 'number' || length % 1 !== 0) throw TypeError("Illegal length: "+length+" (not an integer)"); length |= 0; } var offset = this.offset + length; if (!this.noAssert) { if (offset < 0 || offset > this.buffer.byteLength) throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength); } this.offset = offset; return this; }; /** * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`. * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}. * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}. * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer} * @expose */ ByteBufferPrototype.slice = function(begin, end) { if (typeof begin === 'undefined') begin = this.offset; if (typeof end === 'undefined') end = this.limit; if (!this.noAssert) { if (typeof begin !== 'number' || begin % 1 !== 0) throw TypeError("Illegal begin: Not an integer"); begin >>>= 0; if (typeof end !== 'number' || end % 1 !== 0) throw TypeError("Illegal end: Not an integer"); end >>>= 0; if (begin < 0 || begin > end || end > this.buffer.byteLength) throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength); } var bb = this.clone(); bb.offset = begin; bb.limit = end; return bb; }; /** * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if * possible. Defaults to `false` * @returns {!ArrayBuffer} Contents as an ArrayBuffer * @expose */ ByteBufferPrototype.toBuffer = function(forceCopy) { var offset = this.offset, limit = this.limit; if (!this.noAssert) { if (typeof offset !== 'number' || offset % 1 !== 0) throw TypeError("Illegal offset: Not an integer"); offset >>>= 0; if (typeof limit !== 'number' || limit % 1 !== 0) throw TypeError("Illegal limit: Not an integer"); limit >>>= 0; if (offset < 0 || offset > limit || limit > this.buffer.byteLength) throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength); } // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So: if (!forceCopy && offset === 0 && limit === this.buffer.byteLength) return this.buffer; if (offset === limit) return EMPTY_BUFFER; var buffer = new ArrayBuffer(limit - offset); new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0); return buffer; }; /** * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}. * @function * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory. * Defaults to `false` * @returns {!ArrayBuffer} Contents as an ArrayBuffer * @expose */ ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer; /** * Converts the ByteBuffer's contents to a string. * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with * highlighted offsets. * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset} * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit} * @returns {string} String representation * @throws {Error} If `encoding` is invalid * @expose */ ByteBufferPrototype.toString = function(encoding, begin, end) { if (typeof encoding === 'undefined') return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")"; if (typeof encoding === 'number') encoding = "utf8", begin = encoding, end = begin; switch (encoding) { case "utf8": return this.toUTF8(begin, end); case "base64": return this.toBase64(begin, end); case "hex": return this.toHex(begin, end); case "binary": return this.toBinary(begin, end); case "debug": return this.toDebug(); case "columns": return this.toColumns(); default: throw Error("Unsupported encoding: "+encoding); } }; // lxiv-embeddable /** * lxiv-embeddable (c) 2014 Daniel Wirtz * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/lxiv for details */ var lxiv = function() { "use strict"; /** * lxiv namespace. * @type {!Object.} * @exports lxiv */ var lxiv = {}; /** * Character codes for output. * @type {!Array.} * @inner */ var aout = [ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47 ]; /** * Character codes for input. * @type {!Array.} * @inner */ var ain = []; for (var i=0, k=aout.length; i>2)&0x3f]); t = (b&0x3)<<4; if ((b = src()) !== null) { t |= (b>>4)&0xf; dst(aout[(t|((b>>4)&0xf))&0x3f]); t = (b&0xf)<<2; if ((b = src()) !== null) dst(aout[(t|((b>>6)&0x3))&0x3f]), dst(aout[b&0x3f]); else dst(aout[t&0x3f]), dst(61); } else dst(aout[t&0x3f]), dst(61), dst(61); } }; /** * Decodes base64 char codes to bytes. * @param {!function():number|null} src Characters source as a function returning the next char code respectively * `null` if there are no more characters left. * @param {!function(number)} dst Bytes destination as a function successively called with the next byte. * @throws {Error} If a character code is invalid */ lxiv.decode = function(src, dst) { var c, t1, t2; function fail(c) { throw Error("Illegal character code: "+c); } while ((c = src()) !== null) { t1 = ain[c]; if (typeof t1 === 'undefined') fail(c); if ((c = src()) !== null) { t2 = ain[c]; if (typeof t2 === 'undefined') fail(c); dst((t1<<2)>>>0|(t2&0x30)>>4); if ((c = src()) !== null) { t1 = ain[c]; if (typeof t1 === 'undefined') if (c === 61) break; else fail(c); dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2); if ((c = src()) !== null) { t2 = ain[c]; if (typeof t2 === 'undefined') if (c === 61) break; else fail(c); dst(((t1&0x3)<<6)>>>0|t2); } } } } }; /** * Tests if a string is valid base64. * @param {string} str String to test * @returns {boolean} `true` if valid, otherwise `false` */ lxiv.test = function(str) { return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str); }; return lxiv; }(); // encodings/base64 /** * Encodes this ByteBuffer's contents to a base64 encoded string. * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}. * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}. * @returns {string} Base64 encoded string * @throws {RangeError} If `begin` or `end` is out of bounds * @expose */ ByteBufferPrototype.toBase64 = function(begin, end) { if (typeof begin === 'undefined') begin = this.offset; if (typeof end === 'undefined') end = this.limit; begin = begin | 0; end = end | 0; if (begin < 0 || end > this.capacity || begin > end) throw RangeError("begin, end"); var sd; lxiv.encode(function() { return begin < end ? this.view[begin++] : null; }.bind(this), sd = stringDestination()); return sd(); }; /** * Decodes a base64 encoded string to a ByteBuffer. * @param {string} str String to decode * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to * {@link ByteBuffer.DEFAULT_ENDIAN}. * @returns {!ByteBuffer} ByteBuffer * @expose */ ByteBuffer.fromBase64 = function(str, littleEndian) { if (typeof str !== 'string') throw TypeError("str"); var bb = new ByteBuffer(str.length/4*3, littleEndian), i = 0; lxiv.decode(stringSource(str), function(b) { bb.view[i++] = b; }); bb.limit = i; return bb; }; /** * Encodes a binary string to base64 like `window.btoa` does. * @param {string} str Binary string * @returns {string} Base64 encoded string * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa * @expose */ ByteBuffer.btoa = function(str) { return ByteBuffer.fromBinary(str).toBase64(); }; /** * Decodes a base64 encoded string to binary like `window.atob` does. * @param {string} b64 Base64 encoded string * @returns {string} Binary string * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob * @expose */ ByteBuffer.atob = function(b64) { return ByteBuffer.fromBase64(b64).toBinary(); }; // encodings/binary /** * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes. * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}. * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}. * @returns {string} Binary encoded string * @throws {RangeError} If `offset > limit` * @expose */ ByteBufferPrototype.toBinary = function(begin, end) { if (typeof begin === 'undefined') begin = this.offset; if (typeof end === 'undefined') end = this.limit; begin |= 0; end |= 0; if (begin < 0 || end > this.capacity() || begin > end) throw RangeError("begin, end"); if (begin === end) return ""; var chars = [], parts = []; while (begin < end) { chars.push(this.view[begin++]); if (chars.length >= 1024) parts.push(String.fromCharCode.apply(String, chars)), chars = []; } return parts.join('') + String.fromCharCode.apply(String, chars); }; /** * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer. * @param {string} str String to decode * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to * {@link ByteBuffer.DEFAULT_ENDIAN}. * @returns {!ByteBuffer} ByteBuffer * @expose */ ByteBuffer.fromBinary = function(str, littleEndian) { if (typeof str !== 'string') throw TypeError("str"); var i = 0, k = str.length, charCode, bb = new ByteBuffer(k, littleEndian); while (i 0xff) throw RangeError("illegal char code: "+charCode); bb.view[i++] = charCode; } bb.limit = k; return bb; }; // encodings/debug /** * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are: * * `<` : offset, * * `'` : markedOffset, * * `>` : limit, * * `|` : offset and limit, * * `[` : offset and markedOffset, * * `]` : markedOffset and limit, * * `!` : offset, markedOffset and limit * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false` * @returns {string|!Array.} Debug string or array of lines if `asArray = true` * @expose * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3` * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4` * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1` * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1` */ ByteBufferPrototype.toDebug = function(columns) { var i = -1, k = this.buffer.byteLength, b, hex = "", asc = "", out = ""; while (i 32 && b < 127 ? String.fromCharCode(b) : '.'; } ++i; if (columns) { if (i > 0 && i % 16 === 0 && i !== k) { while (hex.length < 3*16+3) hex += " "; out += hex+asc+"\n"; hex = asc = ""; } } if (i === this.offset && i === this.limit) hex += i === this.markedOffset ? "!" : "|"; else if (i === this.offset) hex += i === this.markedOffset ? "[" : "<"; else if (i === this.limit) hex += i === this.markedOffset ? "]" : ">"; else hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : ""); } if (columns && hex !== " ") { while (hex.length < 3*16+3) hex += " "; out += hex + asc + "\n"; } return columns ? out : hex; }; /** * Decodes a hex encoded string with marked offsets to a ByteBuffer. * @param {string} str Debug string to decode (not be generated with `columns = true`) * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to * {@link ByteBuffer.DEFAULT_ENDIAN}. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to * {@link ByteBuffer.DEFAULT_NOASSERT}. * @returns {!ByteBuffer} ByteBuffer * @expose * @see ByteBuffer#toDebug */ ByteBuffer.fromDebug = function(str, littleEndian, noAssert) { var k = str.length, bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert); var i = 0, j = 0, ch, b, rs = false, // Require symbol next ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)? fail = false; while (i': if (!noAssert) { if (hl) { fail = true; break; } hl = true; } bb.limit = j; rs = false; break; case "'": if (!noAssert) { if (hm) { fail = true; break; } hm = true; } bb.markedOffset = j; rs = false; break; case ' ': rs = false; break; default: if (!noAssert) { if (rs) { fail = true; break; } } b = parseInt(ch+str.charAt(i++), 16); if (!noAssert) { if (isNaN(b) || b < 0 || b > 255) throw TypeError("Illegal str: Not a debug encoded string"); } bb.view[j++] = b; rs = true; } if (fail) throw TypeError("Illegal str: Invalid symbol at "+i); } if (!noAssert) { if (!ho || !hl) throw TypeError("Illegal str: Missing offset or limit"); if (j>>= 0; if (typeof end !== 'number' || end % 1 !== 0) throw TypeError("Illegal end: Not an integer"); end >>>= 0; if (begin < 0 || begin > end || end > this.buffer.byteLength) throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength); } var out = new Array(end - begin), b; while (begin < end) { b = this.view[begin++]; if (b < 0x10) out.push("0", b.toString(16)); else out.push(b.toString(16)); } return out.join(''); }; /** * Decodes a hex encoded string to a ByteBuffer. * @param {string} str String to decode * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to * {@link ByteBuffer.DEFAULT_ENDIAN}. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to * {@link ByteBuffer.DEFAULT_NOASSERT}. * @returns {!ByteBuffer} ByteBuffer * @expose */ ByteBuffer.fromHex = function(str, littleEndian, noAssert) { if (!noAssert) { if (typeof str !== 'string') throw TypeError("Illegal str: Not a string"); if (str.length % 2 !== 0) throw TypeError("Illegal str: Length not a multiple of 2"); } var k = str.length, bb = new ByteBuffer((k / 2) | 0, littleEndian), b; for (var i=0, j=0; i 255) throw TypeError("Illegal str: Contains non-hex characters"); bb.view[j++] = b; } bb.limit = j; return bb; }; // utfx-embeddable /** * utfx-embeddable (c) 2014 Daniel Wirtz * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/utfx for details */ var utfx = function() { "use strict"; /** * utfx namespace. * @inner * @type {!Object.} */ var utfx = {}; /** * Maximum valid code point. * @type {number} * @const */ utfx.MAX_CODEPOINT = 0x10FFFF; /** * Encodes UTF8 code points to UTF8 bytes. * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point * respectively `null` if there are no more code points left or a single numeric code point. * @param {!function(number)} dst Bytes destination as a function successively called with the next byte */ utfx.encodeUTF8 = function(src, dst) { var cp = null; if (typeof src === 'number') cp = src, src = function() { return null; }; while (cp !== null || (cp = src()) !== null) { if (cp < 0x80) dst(cp&0x7F); else if (cp < 0x800) dst(((cp>>6)&0x1F)|0xC0), dst((cp&0x3F)|0x80); else if (cp < 0x10000) dst(((cp>>12)&0x0F)|0xE0), dst(((cp>>6)&0x3F)|0x80), dst((cp&0x3F)|0x80); else dst(((cp>>18)&0x07)|0xF0), dst(((cp>>12)&0x3F)|0x80), dst(((cp>>6)&0x3F)|0x80), dst((cp&0x3F)|0x80); cp = null; } }; /** * Decodes UTF8 bytes to UTF8 code points. * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there * are no more bytes left. * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point. * @throws {RangeError} If a starting byte is invalid in UTF8 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the * remaining bytes. */ utfx.decodeUTF8 = function(src, dst) { var a, b, c, d, fail = function(b) { b = b.slice(0, b.indexOf(null)); var err = Error(b.toString()); err.name = "TruncatedError"; err['bytes'] = b; throw err; }; while ((a = src()) !== null) { if ((a&0x80) === 0) dst(a); else if ((a&0xE0) === 0xC0) ((b = src()) === null) && fail([a, b]), dst(((a&0x1F)<<6) | (b&0x3F)); else if ((a&0xF0) === 0xE0) ((b=src()) === null || (c=src()) === null) && fail([a, b, c]), dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F)); else if ((a&0xF8) === 0xF0) ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]), dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F)); else throw RangeError("Illegal starting byte: "+a); } }; /** * Converts UTF16 characters to UTF8 code points. * @param {!function():number|null} src Characters source as a function returning the next char code respectively * `null` if there are no more characters left. * @param {!function(number)} dst Code points destination as a function successively called with each converted code * point. */ utfx.UTF16toUTF8 = function(src, dst) { var c1, c2 = null; while (true) { if ((c1 = c2 !== null ? c2 : src()) === null) break; if (c1 >= 0xD800 && c1 <= 0xDFFF) { if ((c2 = src()) !== null) { if (c2 >= 0xDC00 && c2 <= 0xDFFF) { dst((c1-0xD800)*0x400+c2-0xDC00+0x10000); c2 = null; continue; } } } dst(c1); } if (c2 !== null) dst(c2); }; /** * Converts UTF8 code points to UTF16 characters. * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point * respectively `null` if there are no more code points left or a single numeric code point. * @param {!function(number)} dst Characters destination as a function successively called with each converted char code. * @throws {RangeError} If a code point is out of range */ utfx.UTF8toUTF16 = function(src, dst) { var cp = null; if (typeof src === 'number') cp = src, src = function() { return null; }; while (cp !== null || (cp = src()) !== null) { if (cp <= 0xFFFF) dst(cp); else cp -= 0x10000, dst((cp>>10)+0xD800), dst((cp%0x400)+0xDC00); cp = null; } }; /** * Converts and encodes UTF16 characters to UTF8 bytes. * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null` * if there are no more characters left. * @param {!function(number)} dst Bytes destination as a function successively called with the next byte. */ utfx.encodeUTF16toUTF8 = function(src, dst) { utfx.UTF16toUTF8(src, function(cp) { utfx.encodeUTF8(cp, dst); }); }; /** * Decodes and converts UTF8 bytes to UTF16 characters. * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there * are no more bytes left. * @param {!function(number)} dst Characters destination as a function successively called with each converted char code. * @throws {RangeError} If a starting byte is invalid in UTF8 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes. */ utfx.decodeUTF8toUTF16 = function(src, dst) { utfx.decodeUTF8(src, function(cp) { utfx.UTF8toUTF16(cp, dst); }); }; /** * Calculates the byte length of an UTF8 code point. * @param {number} cp UTF8 code point * @returns {number} Byte length */ utfx.calculateCodePoint = function(cp) { return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4; }; /** * Calculates the number of UTF8 bytes required to store UTF8 code points. * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively * `null` if there are no more code points left. * @returns {number} The number of UTF8 bytes required */ utfx.calculateUTF8 = function(src) { var cp, l=0; while ((cp = src()) !== null) l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4; return l; }; /** * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes. * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively * `null` if there are no more characters left. * @returns {!Array.} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1. */ utfx.calculateUTF16asUTF8 = function(src) { var n=0, l=0; utfx.UTF16toUTF8(src, function(cp) { ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4; }); return [n,l]; }; return utfx; }(); // encodings/utf8 /** * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded * string. * @returns {string} Hex encoded string * @throws {RangeError} If `offset > limit` * @expose */ ByteBufferPrototype.toUTF8 = function(begin, end) { if (typeof begin === 'undefined') begin = this.offset; if (typeof end === 'undefined') end = this.limit; if (!this.noAssert) { if (typeof begin !== 'number' || begin % 1 !== 0) throw TypeError("Illegal begin: Not an integer"); begin >>>= 0; if (typeof end !== 'number' || end % 1 !== 0) throw TypeError("Illegal end: Not an integer"); end >>>= 0; if (begin < 0 || begin > end || end > this.buffer.byteLength) throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength); } var sd; try { utfx.decodeUTF8toUTF16(function() { return begin < end ? this.view[begin++] : null; }.bind(this), sd = stringDestination()); } catch (e) { if (begin !== end) throw RangeError("Illegal range: Truncated data, "+begin+" != "+end); } return sd(); }; /** * Decodes an UTF8 encoded string to a ByteBuffer. * @param {string} str String to decode * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to * {@link ByteBuffer.DEFAULT_ENDIAN}. * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to * {@link ByteBuffer.DEFAULT_NOASSERT}. * @returns {!ByteBuffer} ByteBuffer * @expose */ ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) { if (!noAssert) if (typeof str !== 'string') throw TypeError("Illegal str: Not a string"); var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert), i = 0; utfx.encodeUTF16toUTF8(stringSource(str), function(b) { bb.view[i++] = b; }); bb.limit = i; return bb; }; return ByteBuffer; }); /***/ }), /* 614 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 2013 Daniel Wirtz Copyright 2009 The Closure Library Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * @license long.js (c) 2013 Daniel Wirtz * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/long.js for details */ (function(global, factory) { /* AMD */ if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"]) module["exports"] = factory(); /* Global */ else (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory(); })(this, function() { "use strict"; /** * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. * See the from* functions below for more convenient ways of constructing Longs. * @exports Long * @class A Long class for representing a 64 bit two's-complement integer value. * @param {number} low The low (signed) 32 bits of the long * @param {number} high The high (signed) 32 bits of the long * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed * @constructor */ function Long(low, high, unsigned) { /** * The low 32 bits as a signed value. * @type {number} */ this.low = low | 0; /** * The high 32 bits as a signed value. * @type {number} */ this.high = high | 0; /** * Whether unsigned or not. * @type {boolean} */ this.unsigned = !!unsigned; } // The internal representation of a long is the two given signed, 32-bit values. // We use 32-bit pieces because these are the size of integers on which // Javascript performs bit-operations. For operations like addition and // multiplication, we split each number into 16 bit pieces, which can easily be // multiplied within Javascript's floating-point representation without overflow // or change in sign. // // In the algorithms below, we frequently reduce the negative case to the // positive case by negating the input(s) and then post-processing the result. // Note that we must ALWAYS check specially whether those values are MIN_VALUE // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as // a positive number, it overflows back into a negative). Not handling this // case would often result in infinite recursion. // // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from* // methods on which they depend. /** * An indicator used to reliably determine if an object is a Long or not. * @type {boolean} * @const * @private */ Long.prototype.__isLong__; Object.defineProperty(Long.prototype, "__isLong__", { value: true, enumerable: false, configurable: false }); /** * @function * @param {*} obj Object * @returns {boolean} * @inner */ function isLong(obj) { return (obj && obj["__isLong__"]) === true; } /** * Tests if the specified object is a Long. * @function * @param {*} obj Object * @returns {boolean} */ Long.isLong = isLong; /** * A cache of the Long representations of small integer values. * @type {!Object} * @inner */ var INT_CACHE = {}; /** * A cache of the Long representations of small unsigned integer values. * @type {!Object} * @inner */ var UINT_CACHE = {}; /** * @param {number} value * @param {boolean=} unsigned * @returns {!Long} * @inner */ function fromInt(value, unsigned) { var obj, cachedObj, cache; if (unsigned) { value >>>= 0; if (cache = (0 <= value && value < 256)) { cachedObj = UINT_CACHE[value]; if (cachedObj) return cachedObj; } obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true); if (cache) UINT_CACHE[value] = obj; return obj; } else { value |= 0; if (cache = (-128 <= value && value < 128)) { cachedObj = INT_CACHE[value]; if (cachedObj) return cachedObj; } obj = fromBits(value, value < 0 ? -1 : 0, false); if (cache) INT_CACHE[value] = obj; return obj; } } /** * Returns a Long representing the given 32 bit integer value. * @function * @param {number} value The 32 bit integer in question * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed * @returns {!Long} The corresponding Long value */ Long.fromInt = fromInt; /** * @param {number} value * @param {boolean=} unsigned * @returns {!Long} * @inner */ function fromNumber(value, unsigned) { if (isNaN(value) || !isFinite(value)) return unsigned ? UZERO : ZERO; if (unsigned) { if (value < 0) return UZERO; if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE; } else { if (value <= -TWO_PWR_63_DBL) return MIN_VALUE; if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE; } if (value < 0) return fromNumber(-value, unsigned).neg(); return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned); } /** * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. * @function * @param {number} value The number in question * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed * @returns {!Long} The corresponding Long value */ Long.fromNumber = fromNumber; /** * @param {number} lowBits * @param {number} highBits * @param {boolean=} unsigned * @returns {!Long} * @inner */ function fromBits(lowBits, highBits, unsigned) { return new Long(lowBits, highBits, unsigned); } /** * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is * assumed to use 32 bits. * @function * @param {number} lowBits The low 32 bits * @param {number} highBits The high 32 bits * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed * @returns {!Long} The corresponding Long value */ Long.fromBits = fromBits; /** * @function * @param {number} base * @param {number} exponent * @returns {number} * @inner */ var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4) /** * @param {string} str * @param {(boolean|number)=} unsigned * @param {number=} radix * @returns {!Long} * @inner */ function fromString(str, unsigned, radix) { if (str.length === 0) throw Error('empty string'); if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") return ZERO; if (typeof unsigned === 'number') { // For goog.math.long compatibility radix = unsigned, unsigned = false; } else { unsigned = !! unsigned; } radix = radix || 10; if (radix < 2 || 36 < radix) throw RangeError('radix'); var p; if ((p = str.indexOf('-')) > 0) throw Error('interior hyphen'); else if (p === 0) { return fromString(str.substring(1), unsigned, radix).neg(); } // Do several (8) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. var radixToPower = fromNumber(pow_dbl(radix, 8)); var result = ZERO; for (var i = 0; i < str.length; i += 8) { var size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix); if (size < 8) { var power = fromNumber(pow_dbl(radix, size)); result = result.mul(power).add(fromNumber(value)); } else { result = result.mul(radixToPower); result = result.add(fromNumber(value)); } } result.unsigned = unsigned; return result; } /** * Returns a Long representation of the given string, written using the specified radix. * @function * @param {string} str The textual representation of the Long * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed * @param {number=} radix The radix in which the text is written (2-36), defaults to 10 * @returns {!Long} The corresponding Long value */ Long.fromString = fromString; /** * @function * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val * @returns {!Long} * @inner */ function fromValue(val) { if (val /* is compatible */ instanceof Long) return val; if (typeof val === 'number') return fromNumber(val); if (typeof val === 'string') return fromString(val); // Throws for non-objects, converts non-instanceof Long: return fromBits(val.low, val.high, val.unsigned); } /** * Converts the specified value to a Long. * @function * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value * @returns {!Long} */ Long.fromValue = fromValue; // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be // no runtime penalty for these. /** * @type {number} * @const * @inner */ var TWO_PWR_16_DBL = 1 << 16; /** * @type {number} * @const * @inner */ var TWO_PWR_24_DBL = 1 << 24; /** * @type {number} * @const * @inner */ var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; /** * @type {number} * @const * @inner */ var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL; /** * @type {number} * @const * @inner */ var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2; /** * @type {!Long} * @const * @inner */ var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL); /** * @type {!Long} * @inner */ var ZERO = fromInt(0); /** * Signed zero. * @type {!Long} */ Long.ZERO = ZERO; /** * @type {!Long} * @inner */ var UZERO = fromInt(0, true); /** * Unsigned zero. * @type {!Long} */ Long.UZERO = UZERO; /** * @type {!Long} * @inner */ var ONE = fromInt(1); /** * Signed one. * @type {!Long} */ Long.ONE = ONE; /** * @type {!Long} * @inner */ var UONE = fromInt(1, true); /** * Unsigned one. * @type {!Long} */ Long.UONE = UONE; /** * @type {!Long} * @inner */ var NEG_ONE = fromInt(-1); /** * Signed negative one. * @type {!Long} */ Long.NEG_ONE = NEG_ONE; /** * @type {!Long} * @inner */ var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false); /** * Maximum signed value. * @type {!Long} */ Long.MAX_VALUE = MAX_VALUE; /** * @type {!Long} * @inner */ var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true); /** * Maximum unsigned value. * @type {!Long} */ Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE; /** * @type {!Long} * @inner */ var MIN_VALUE = fromBits(0, 0x80000000|0, false); /** * Minimum signed value. * @type {!Long} */ Long.MIN_VALUE = MIN_VALUE; /** * @alias Long.prototype * @inner */ var LongPrototype = Long.prototype; /** * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. * @returns {number} */ LongPrototype.toInt = function toInt() { return this.unsigned ? this.low >>> 0 : this.low; }; /** * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). * @returns {number} */ LongPrototype.toNumber = function toNumber() { if (this.unsigned) return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0); return this.high * TWO_PWR_32_DBL + (this.low >>> 0); }; /** * Converts the Long to a string written in the specified radix. * @param {number=} radix Radix (2-36), defaults to 10 * @returns {string} * @override * @throws {RangeError} If `radix` is out of range */ LongPrototype.toString = function toString(radix) { radix = radix || 10; if (radix < 2 || 36 < radix) throw RangeError('radix'); if (this.isZero()) return '0'; if (this.isNegative()) { // Unsigned Longs are never negative if (this.eq(MIN_VALUE)) { // We need to change the Long value before it can be negated, so we remove // the bottom-most digit in this base and then recurse to do the rest. var radixLong = fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this); return div.toString(radix) + rem1.toInt().toString(radix); } else return '-' + this.neg().toString(radix); } // Do several (6) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), rem = this; var result = ''; while (true) { var remDiv = rem.div(radixToPower), intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, digits = intval.toString(radix); rem = remDiv; if (rem.isZero()) return digits + result; else { while (digits.length < 6) digits = '0' + digits; result = '' + digits + result; } } }; /** * Gets the high 32 bits as a signed integer. * @returns {number} Signed high bits */ LongPrototype.getHighBits = function getHighBits() { return this.high; }; /** * Gets the high 32 bits as an unsigned integer. * @returns {number} Unsigned high bits */ LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() { return this.high >>> 0; }; /** * Gets the low 32 bits as a signed integer. * @returns {number} Signed low bits */ LongPrototype.getLowBits = function getLowBits() { return this.low; }; /** * Gets the low 32 bits as an unsigned integer. * @returns {number} Unsigned low bits */ LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() { return this.low >>> 0; }; /** * Gets the number of bits needed to represent the absolute value of this Long. * @returns {number} */ LongPrototype.getNumBitsAbs = function getNumBitsAbs() { if (this.isNegative()) // Unsigned Longs are never negative return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs(); var val = this.high != 0 ? this.high : this.low; for (var bit = 31; bit > 0; bit--) if ((val & (1 << bit)) != 0) break; return this.high != 0 ? bit + 33 : bit + 1; }; /** * Tests if this Long's value equals zero. * @returns {boolean} */ LongPrototype.isZero = function isZero() { return this.high === 0 && this.low === 0; }; /** * Tests if this Long's value is negative. * @returns {boolean} */ LongPrototype.isNegative = function isNegative() { return !this.unsigned && this.high < 0; }; /** * Tests if this Long's value is positive. * @returns {boolean} */ LongPrototype.isPositive = function isPositive() { return this.unsigned || this.high >= 0; }; /** * Tests if this Long's value is odd. * @returns {boolean} */ LongPrototype.isOdd = function isOdd() { return (this.low & 1) === 1; }; /** * Tests if this Long's value is even. * @returns {boolean} */ LongPrototype.isEven = function isEven() { return (this.low & 1) === 0; }; /** * Tests if this Long's value equals the specified's. * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.equals = function equals(other) { if (!isLong(other)) other = fromValue(other); if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1) return false; return this.high === other.high && this.low === other.low; }; /** * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}. * @function * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.eq = LongPrototype.equals; /** * Tests if this Long's value differs from the specified's. * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.notEquals = function notEquals(other) { return !this.eq(/* validates */ other); }; /** * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}. * @function * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.neq = LongPrototype.notEquals; /** * Tests if this Long's value is less than the specified's. * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.lessThan = function lessThan(other) { return this.comp(/* validates */ other) < 0; }; /** * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}. * @function * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.lt = LongPrototype.lessThan; /** * Tests if this Long's value is less than or equal the specified's. * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) { return this.comp(/* validates */ other) <= 0; }; /** * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}. * @function * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.lte = LongPrototype.lessThanOrEqual; /** * Tests if this Long's value is greater than the specified's. * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.greaterThan = function greaterThan(other) { return this.comp(/* validates */ other) > 0; }; /** * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}. * @function * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.gt = LongPrototype.greaterThan; /** * Tests if this Long's value is greater than or equal the specified's. * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) { return this.comp(/* validates */ other) >= 0; }; /** * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}. * @function * @param {!Long|number|string} other Other value * @returns {boolean} */ LongPrototype.gte = LongPrototype.greaterThanOrEqual; /** * Compares this Long's value with the specified's. * @param {!Long|number|string} other Other value * @returns {number} 0 if they are the same, 1 if the this is greater and -1 * if the given one is greater */ LongPrototype.compare = function compare(other) { if (!isLong(other)) other = fromValue(other); if (this.eq(other)) return 0; var thisNeg = this.isNegative(), otherNeg = other.isNegative(); if (thisNeg && !otherNeg) return -1; if (!thisNeg && otherNeg) return 1; // At this point the sign bits are the same if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1; // Both are positive if at least one is unsigned return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1; }; /** * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}. * @function * @param {!Long|number|string} other Other value * @returns {number} 0 if they are the same, 1 if the this is greater and -1 * if the given one is greater */ LongPrototype.comp = LongPrototype.compare; /** * Negates this Long's value. * @returns {!Long} Negated Long */ LongPrototype.negate = function negate() { if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE; return this.not().add(ONE); }; /** * Negates this Long's value. This is an alias of {@link Long#negate}. * @function * @returns {!Long} Negated Long */ LongPrototype.neg = LongPrototype.negate; /** * Returns the sum of this and the specified Long. * @param {!Long|number|string} addend Addend * @returns {!Long} Sum */ LongPrototype.add = function add(addend) { if (!isLong(addend)) addend = fromValue(addend); // Divide each number into 4 chunks of 16 bits, and then sum the chunks. var a48 = this.high >>> 16; var a32 = this.high & 0xFFFF; var a16 = this.low >>> 16; var a00 = this.low & 0xFFFF; var b48 = addend.high >>> 16; var b32 = addend.high & 0xFFFF; var b16 = addend.low >>> 16; var b00 = addend.low & 0xFFFF; var c48 = 0, c32 = 0, c16 = 0, c00 = 0; c00 += a00 + b00; c16 += c00 >>> 16; c00 &= 0xFFFF; c16 += a16 + b16; c32 += c16 >>> 16; c16 &= 0xFFFF; c32 += a32 + b32; c48 += c32 >>> 16; c32 &= 0xFFFF; c48 += a48 + b48; c48 &= 0xFFFF; return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); }; /** * Returns the difference of this and the specified Long. * @param {!Long|number|string} subtrahend Subtrahend * @returns {!Long} Difference */ LongPrototype.subtract = function subtract(subtrahend) { if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend); return this.add(subtrahend.neg()); }; /** * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}. * @function * @param {!Long|number|string} subtrahend Subtrahend * @returns {!Long} Difference */ LongPrototype.sub = LongPrototype.subtract; /** * Returns the product of this and the specified Long. * @param {!Long|number|string} multiplier Multiplier * @returns {!Long} Product */ LongPrototype.multiply = function multiply(multiplier) { if (this.isZero()) return ZERO; if (!isLong(multiplier)) multiplier = fromValue(multiplier); if (multiplier.isZero()) return ZERO; if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO; if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO; if (this.isNegative()) { if (multiplier.isNegative()) return this.neg().mul(multiplier.neg()); else return this.neg().mul(multiplier).neg(); } else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg(); // If both longs are small, use float multiplication if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24)) return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned); // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products. // We can skip products that would overflow. var a48 = this.high >>> 16; var a32 = this.high & 0xFFFF; var a16 = this.low >>> 16; var a00 = this.low & 0xFFFF; var b48 = multiplier.high >>> 16; var b32 = multiplier.high & 0xFFFF; var b16 = multiplier.low >>> 16; var b00 = multiplier.low & 0xFFFF; var c48 = 0, c32 = 0, c16 = 0, c00 = 0; c00 += a00 * b00; c16 += c00 >>> 16; c00 &= 0xFFFF; c16 += a16 * b00; c32 += c16 >>> 16; c16 &= 0xFFFF; c16 += a00 * b16; c32 += c16 >>> 16; c16 &= 0xFFFF; c32 += a32 * b00; c48 += c32 >>> 16; c32 &= 0xFFFF; c32 += a16 * b16; c48 += c32 >>> 16; c32 &= 0xFFFF; c32 += a00 * b32; c48 += c32 >>> 16; c32 &= 0xFFFF; c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; c48 &= 0xFFFF; return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); }; /** * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}. * @function * @param {!Long|number|string} multiplier Multiplier * @returns {!Long} Product */ LongPrototype.mul = LongPrototype.multiply; /** * Returns this Long divided by the specified. The result is signed if this Long is signed or * unsigned if this Long is unsigned. * @param {!Long|number|string} divisor Divisor * @returns {!Long} Quotient */ LongPrototype.divide = function divide(divisor) { if (!isLong(divisor)) divisor = fromValue(divisor); if (divisor.isZero()) throw Error('division by zero'); if (this.isZero()) return this.unsigned ? UZERO : ZERO; var approx, rem, res; if (!this.unsigned) { // This section is only relevant for signed longs and is derived from the // closure library as a whole. if (this.eq(MIN_VALUE)) { if (divisor.eq(ONE) || divisor.eq(NEG_ONE)) return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE else if (divisor.eq(MIN_VALUE)) return ONE; else { // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. var halfThis = this.shr(1); approx = halfThis.div(divisor).shl(1); if (approx.eq(ZERO)) { return divisor.isNegative() ? ONE : NEG_ONE; } else { rem = this.sub(divisor.mul(approx)); res = approx.add(rem.div(divisor)); return res; } } } else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO; if (this.isNegative()) { if (divisor.isNegative()) return this.neg().div(divisor.neg()); return this.neg().div(divisor).neg(); } else if (divisor.isNegative()) return this.div(divisor.neg()).neg(); res = ZERO; } else { // The algorithm below has not been made for unsigned longs. It's therefore // required to take special care of the MSB prior to running it. if (!divisor.unsigned) divisor = divisor.toUnsigned(); if (divisor.gt(this)) return UZERO; if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true return UONE; res = UZERO; } // Repeat the following until the remainder is less than other: find a // floating-point that approximates remainder / other *from below*, add this // into the result, and subtract it from the remainder. It is critical that // the approximate value is less than or equal to the real value so that the // remainder never becomes negative. rem = this; while (rem.gte(divisor)) { // Approximate the result of division. This may be a little greater or // smaller than the actual value. approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); // We will tweak the approximate result by changing it in the 48-th digit or // the smallest non-fractional digit, whichever is larger. var log2 = Math.ceil(Math.log(approx) / Math.LN2), delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48), // Decrease the approximation until it is smaller than the remainder. Note // that if it is too large, the product overflows and is negative. approxRes = fromNumber(approx), approxRem = approxRes.mul(divisor); while (approxRem.isNegative() || approxRem.gt(rem)) { approx -= delta; approxRes = fromNumber(approx, this.unsigned); approxRem = approxRes.mul(divisor); } // We know the answer can't be zero... and actually, zero would cause // infinite recursion since we would make no progress. if (approxRes.isZero()) approxRes = ONE; res = res.add(approxRes); rem = rem.sub(approxRem); } return res; }; /** * Returns this Long divided by the specified. This is an alias of {@link Long#divide}. * @function * @param {!Long|number|string} divisor Divisor * @returns {!Long} Quotient */ LongPrototype.div = LongPrototype.divide; /** * Returns this Long modulo the specified. * @param {!Long|number|string} divisor Divisor * @returns {!Long} Remainder */ LongPrototype.modulo = function modulo(divisor) { if (!isLong(divisor)) divisor = fromValue(divisor); return this.sub(this.div(divisor).mul(divisor)); }; /** * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. * @function * @param {!Long|number|string} divisor Divisor * @returns {!Long} Remainder */ LongPrototype.mod = LongPrototype.modulo; /** * Returns the bitwise NOT of this Long. * @returns {!Long} */ LongPrototype.not = function not() { return fromBits(~this.low, ~this.high, this.unsigned); }; /** * Returns the bitwise AND of this Long and the specified. * @param {!Long|number|string} other Other Long * @returns {!Long} */ LongPrototype.and = function and(other) { if (!isLong(other)) other = fromValue(other); return fromBits(this.low & other.low, this.high & other.high, this.unsigned); }; /** * Returns the bitwise OR of this Long and the specified. * @param {!Long|number|string} other Other Long * @returns {!Long} */ LongPrototype.or = function or(other) { if (!isLong(other)) other = fromValue(other); return fromBits(this.low | other.low, this.high | other.high, this.unsigned); }; /** * Returns the bitwise XOR of this Long and the given one. * @param {!Long|number|string} other Other Long * @returns {!Long} */ LongPrototype.xor = function xor(other) { if (!isLong(other)) other = fromValue(other); return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned); }; /** * Returns this Long with bits shifted to the left by the given amount. * @param {number|!Long} numBits Number of bits * @returns {!Long} Shifted Long */ LongPrototype.shiftLeft = function shiftLeft(numBits) { if (isLong(numBits)) numBits = numBits.toInt(); if ((numBits &= 63) === 0) return this; else if (numBits < 32) return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned); else return fromBits(0, this.low << (numBits - 32), this.unsigned); }; /** * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}. * @function * @param {number|!Long} numBits Number of bits * @returns {!Long} Shifted Long */ LongPrototype.shl = LongPrototype.shiftLeft; /** * Returns this Long with bits arithmetically shifted to the right by the given amount. * @param {number|!Long} numBits Number of bits * @returns {!Long} Shifted Long */ LongPrototype.shiftRight = function shiftRight(numBits) { if (isLong(numBits)) numBits = numBits.toInt(); if ((numBits &= 63) === 0) return this; else if (numBits < 32) return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned); else return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned); }; /** * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}. * @function * @param {number|!Long} numBits Number of bits * @returns {!Long} Shifted Long */ LongPrototype.shr = LongPrototype.shiftRight; /** * Returns this Long with bits logically shifted to the right by the given amount. * @param {number|!Long} numBits Number of bits * @returns {!Long} Shifted Long */ LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) { if (isLong(numBits)) numBits = numBits.toInt(); numBits &= 63; if (numBits === 0) return this; else { var high = this.high; if (numBits < 32) { var low = this.low; return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned); } else if (numBits === 32) return fromBits(high, 0, this.unsigned); else return fromBits(high >>> (numBits - 32), 0, this.unsigned); } }; /** * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}. * @function * @param {number|!Long} numBits Number of bits * @returns {!Long} Shifted Long */ LongPrototype.shru = LongPrototype.shiftRightUnsigned; /** * Converts this Long to signed. * @returns {!Long} Signed long */ LongPrototype.toSigned = function toSigned() { if (!this.unsigned) return this; return fromBits(this.low, this.high, false); }; /** * Converts this Long to unsigned. * @returns {!Long} Unsigned long */ LongPrototype.toUnsigned = function toUnsigned() { if (this.unsigned) return this; return fromBits(this.low, this.high, true); }; /** * Converts this Long to its byte representation. * @param {boolean=} le Whether little or big endian, defaults to big endian * @returns {!Array.} Byte representation */ LongPrototype.toBytes = function(le) { return le ? this.toBytesLE() : this.toBytesBE(); } /** * Converts this Long to its little endian byte representation. * @returns {!Array.} Little endian byte representation */ LongPrototype.toBytesLE = function() { var hi = this.high, lo = this.low; return [ lo & 0xff, (lo >>> 8) & 0xff, (lo >>> 16) & 0xff, (lo >>> 24) & 0xff, hi & 0xff, (hi >>> 8) & 0xff, (hi >>> 16) & 0xff, (hi >>> 24) & 0xff ]; } /** * Converts this Long to its big endian byte representation. * @returns {!Array.} Big endian byte representation */ LongPrototype.toBytesBE = function() { var hi = this.high, lo = this.low; return [ (hi >>> 24) & 0xff, (hi >>> 16) & 0xff, (hi >>> 8) & 0xff, hi & 0xff, (lo >>> 24) & 0xff, (lo >>> 16) & 0xff, (lo >>> 8) & 0xff, lo & 0xff ]; } return Long; }); /***/ }), /* 615 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), /* 616 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(1); var _slice = _interopRequireDefault(__webpack_require__(61)); var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(153)); var _concat = _interopRequireDefault(__webpack_require__(22)); var has = Object.prototype.hasOwnProperty, prefix = '~'; /** * Constructor to create a storage for our `EE` objects. * An `Events` instance is a plain object whose properties are event names. * * @constructor * @private */ function Events() {} // // We try to not inherit from `Object.prototype`. In some engines creating an // instance in this way is faster than calling `Object.create(null)` directly. // If `Object.create(null)` is not supported we prefix the event names with a // character to make sure that the built-in object properties are not // overridden or used as an attack vector. // if (Object.create) { Events.prototype = Object.create(null); // // This hack is needed because the `__proto__` property is still inherited in // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. // if (!new Events().__proto__) prefix = false; } /** * Representation of a single event listener. * * @param {Function} fn The listener function. * @param {*} context The context to invoke the listener with. * @param {Boolean} [once=false] Specify if the listener is a one-time listener. * @constructor * @private */ function EE(fn, context, once) { this.fn = fn; this.context = context; this.once = once || false; } /** * Add a listener for a given event. * * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} context The context to invoke the listener with. * @param {Boolean} once Specify if the listener is a one-time listener. * @returns {EventEmitter} * @private */ function addListener(emitter, event, fn, context, once) { if (typeof fn !== 'function') { throw new TypeError('The listener must be a function'); } var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event; if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);else emitter._events[evt] = [emitter._events[evt], listener]; return emitter; } /** * Clear event by name. * * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. * @param {(String|Symbol)} evt The Event name. * @private */ function clearEvent(emitter, evt) { if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt]; } /** * Minimal `EventEmitter` interface that is molded against the Node.js * `EventEmitter` interface. * * @constructor * @public */ function EventEmitter() { this._events = new Events(); this._eventsCount = 0; } /** * Return an array listing the events for which the emitter has registered * listeners. * * @returns {Array} * @public */ EventEmitter.prototype.eventNames = function eventNames() { var names = [], events, name; if (this._eventsCount === 0) return names; for (name in events = this._events) { if (has.call(events, name)) names.push(prefix ? (0, _slice.default)(name).call(name, 1) : name); } if (_getOwnPropertySymbols.default) { return (0, _concat.default)(names).call(names, (0, _getOwnPropertySymbols.default)(events)); } return names; }; /** * Return the listeners registered for a given event. * * @param {(String|Symbol)} event The event name. * @returns {Array} The registered listeners. * @public */ EventEmitter.prototype.listeners = function listeners(event) { var evt = prefix ? prefix + event : event, handlers = this._events[evt]; if (!handlers) return []; if (handlers.fn) return [handlers.fn]; for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { ee[i] = handlers[i].fn; } return ee; }; /** * Return the number of listeners listening to a given event. * * @param {(String|Symbol)} event The event name. * @returns {Number} The number of listeners. * @public */ EventEmitter.prototype.listenerCount = function listenerCount(event) { var evt = prefix ? prefix + event : event, listeners = this._events[evt]; if (!listeners) return 0; if (listeners.fn) return 1; return listeners.length; }; /** * Calls each of the listeners registered for a given event. * * @param {(String|Symbol)} event The event name. * @returns {Boolean} `true` if the event had listeners, else `false`. * @public */ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return false; var listeners = this._events[evt], len = arguments.length, args, i; if (listeners.fn) { if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); switch (len) { case 1: return listeners.fn.call(listeners.context), true; case 2: return listeners.fn.call(listeners.context, a1), true; case 3: return listeners.fn.call(listeners.context, a1, a2), true; case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; } for (i = 1, args = new Array(len - 1); i < len; i++) { args[i - 1] = arguments[i]; } listeners.fn.apply(listeners.context, args); } else { var length = listeners.length, j; for (i = 0; i < length; i++) { if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); switch (len) { case 1: listeners[i].fn.call(listeners[i].context); break; case 2: listeners[i].fn.call(listeners[i].context, a1); break; case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; default: if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) { args[j - 1] = arguments[j]; } listeners[i].fn.apply(listeners[i].context, args); } } } return true; }; /** * Add a listener for a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.on = function on(event, fn, context) { return addListener(this, event, fn, context, false); }; /** * Add a one-time listener for a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.once = function once(event, fn, context) { return addListener(this, event, fn, context, true); }; /** * Remove the listeners of a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn Only remove the listeners that match this function. * @param {*} context Only remove the listeners that have this context. * @param {Boolean} once Only remove one-time listeners. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return this; if (!fn) { clearEvent(this, evt); return this; } var listeners = this._events[evt]; if (listeners.fn) { if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) { clearEvent(this, evt); } } else { for (var i = 0, events = [], length = listeners.length; i < length; i++) { if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) { events.push(listeners[i]); } } // // Reset the array, or remove it completely if we have no more listeners. // if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt); } return this; }; /** * Remove all listeners, or those of the specified event. * * @param {(String|Symbol)} [event] The event name. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { var evt; if (event) { evt = prefix ? prefix + event : event; if (this._events[evt]) clearEvent(this, evt); } else { this._events = new Events(); this._eventsCount = 0; } return this; }; // // Alias methods names because people roll like that. // EventEmitter.prototype.off = EventEmitter.prototype.removeListener; EventEmitter.prototype.addListener = EventEmitter.prototype.on; // // Expose the prefix. // EventEmitter.prefixed = prefix; // // Allow `EventEmitter` to be imported as module namespace. // EventEmitter.EventEmitter = EventEmitter; // // Expose the module. // if (true) { module.exports = EventEmitter; } /***/ }), /* 617 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(618); /***/ }), /* 618 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var runtime = (function (exports) { "use strict"; var Op = Object.prototype; var hasOwn = Op.hasOwnProperty; var undefined; // More compressible than void 0. var $Symbol = typeof Symbol === "function" ? Symbol : {}; var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); return obj[key]; } try { // IE 8 has a broken Object.defineProperty that only works on DOM objects. define({}, ""); } catch (err) { define = function(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, // .throw, and .return methods. generator._invoke = makeInvokeMethod(innerFn, self, context); return generator; } exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion // record like context.tryEntries[i].completion. This interface could // have been (and was previously) designed to take a closure to be // invoked without arguments, but in all the cases we care about we // already have an existing method we want to call, so there's no need // to create a new function object. We can even get away with assuming // the method takes exactly one argument, since that happens to be true // in every case, so we don't have to touch the arguments object. The // only additional allocation required is the completion record, which // has a stable shape and so hopefully should be cheap to allocate. function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as // breaking out of the dispatch switch statement. var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and // .constructor.prototype properties for functions that return Generator // objects. For full spec compliance, you may wish to configure your // minifier not to mangle the names of these two functions. function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that // don't natively support it. var IteratorPrototype = {}; IteratorPrototype[iteratorSymbol] = function () { return this; }; var getProto = Object.getPrototypeOf; var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { // This environment has a native %IteratorPrototype%; use it instead // of the polyfill. IteratorPrototype = NativeIteratorPrototype; } var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; GeneratorFunctionPrototype.constructor = GeneratorFunction; GeneratorFunction.displayName = define( GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction" ); // Helper for defining the .next, .throw, and .return methods of the // Iterator interface in terms of a single ._invoke method. function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function(method) { define(prototype, method, function(arg) { return this._invoke(method, arg); }); }); } exports.isGeneratorFunction = function(genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can // do is to check its .name property. (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; exports.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; define(genFun, toStringTagSymbol, "GeneratorFunction"); } genFun.prototype = Object.create(Gp); return genFun; }; // Within the body of any async function, `await x` is transformed to // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test // `hasOwn.call(value, "__await")` to determine if the yielded value is // meant to be awaited. exports.awrap = function(arg) { return { __await: arg }; }; function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value = result.value; if (value && typeof value === "object" && hasOwn.call(value, "__await")) { return PromiseImpl.resolve(value.__await).then(function(value) { invoke("next", value, resolve, reject); }, function(err) { invoke("throw", err, resolve, reject); }); } return PromiseImpl.resolve(value).then(function(unwrapped) { // When a yielded Promise is resolved, its final value becomes // the .value of the Promise<{value,done}> result for the // current iteration. result.value = unwrapped; resolve(result); }, function(error) { // If a rejected Promise was yielded, throw the rejection back // into the async generator function so it can be handled there. return invoke("throw", error, resolve, reject); }); } } var previousPromise; function enqueue(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function(resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = // If enqueue has been called before, then we want to wait until // all previous Promises have been resolved before calling invoke, // so that results are always delivered in the correct order. If // enqueue has not been called before, then it is important to // call invoke immediately, without waiting on a callback to fire, // so that the async generator function has the opportunity to do // any necessary setup in a predictable way. This predictability // is why the Promise constructor synchronously invokes its // executor callback, and why async functions synchronously // execute code before the first await. Since we implement simple // async functions in terms of async generators, it is especially // important to get this right, even though it requires care. previousPromise ? previousPromise.then( callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later // invocations of the iterator. callInvokeWithMethodAndArg ) : callInvokeWithMethodAndArg(); } // Define the unified helper method that is used to implement .next, // .throw, and .return (see defineIteratorMethods). this._invoke = enqueue; } defineIteratorMethods(AsyncIterator.prototype); AsyncIterator.prototype[asyncIteratorSymbol] = function () { return this; }; exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of // AsyncIterator objects; they just return a Promise for the value of // the final result produced by the iterator. exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { if (PromiseImpl === void 0) PromiseImpl = Promise; var iter = new AsyncIterator( wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl ); return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. : iter.next().then(function(result) { return result.done ? result.value : iter.next(); }); }; function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function invoke(method, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } if (state === GenStateCompleted) { if (method === "throw") { throw arg; } // Be forgiving, per 25.3.3.3.3 of the spec: // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume return doneResult(); } context.method = method; context.arg = arg; while (true) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (context.method === "next") { // Setting context._sent for legacy support of Babel's // function.sent implementation. context.sent = context._sent = context.arg; } else if (context.method === "throw") { if (state === GenStateSuspendedStart) { state = GenStateCompleted; throw context.arg; } context.dispatchException(context.arg); } else if (context.method === "return") { context.abrupt("return", context.arg); } state = GenStateExecuting; var record = tryCatch(innerFn, self, context); if (record.type === "normal") { // If an exception is thrown from innerFn, we leave state === // GenStateExecuting and loop back for another invocation. state = context.done ? GenStateCompleted : GenStateSuspendedYield; if (record.arg === ContinueSentinel) { continue; } return { value: record.arg, done: context.done }; } else if (record.type === "throw") { state = GenStateCompleted; // Dispatch the exception by looping back around to the // context.dispatchException(context.arg) call above. context.method = "throw"; context.arg = record.arg; } } }; } // Call delegate.iterator[context.method](context.arg) and handle the // result, either by returning a { value, done } result from the // delegate iterator, or by modifying context.method and context.arg, // setting context.delegate to null, and returning the ContinueSentinel. function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (method === undefined) { // A .throw or .return when the delegate iterator has no .throw // method always terminates the yield* loop. context.delegate = null; if (context.method === "throw") { // Note: ["return"] must be used for ES3 parsing compatibility. if (delegate.iterator["return"]) { // If the delegate iterator has a return method, give it a // chance to clean up. context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); if (context.method === "throw") { // If maybeInvokeDelegate(context) changed context.method from // "return" to "throw", let that override the TypeError below. return ContinueSentinel; } } context.method = "throw"; context.arg = new TypeError( "The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (record.type === "throw") { context.method = "throw"; context.arg = record.arg; context.delegate = null; return ContinueSentinel; } var info = record.arg; if (! info) { context.method = "throw"; context.arg = new TypeError("iterator result is not an object"); context.delegate = null; return ContinueSentinel; } if (info.done) { // Assign the result of the finished delegate to the temporary // variable specified by delegate.resultName (see delegateYield). context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the // exception, let the outer generator proceed normally. If // context.method was "next", forget context.arg since it has been // "consumed" by the delegate iterator. If context.method was // "return", allow the original .return call to continue in the // outer generator. if (context.method !== "return") { context.method = "next"; context.arg = undefined; } } else { // Re-yield the result returned by the delegate method. return info; } // The delegate iterator is finished, so forget it and continue with // the outer generator. context.delegate = null; return ContinueSentinel; } // Define Generator.prototype.{next,throw,return} in terms of the // unified ._invoke helper method. defineIteratorMethods(Gp); define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the // @@iterator function is called on it. Some browsers' implementations of the // iterator prototype chain incorrectly implement this, causing the Generator // object to not be returned from this call. This ensures that doesn't happen. // See https://github.com/facebook/regenerator/issues/274 for more details. Gp[iteratorSymbol] = function() { return this; }; Gp.toString = function() { return "[object Generator]"; }; function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; if (1 in locs) { entry.catchLoc = locs[1]; } if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } function Context(tryLocsList) { // The root entry object (effectively a try statement without a catch // or a finally block) gives us a place to store values thrown from // locations where there is no enclosing try statement. this.tryEntries = [{ tryLoc: "root" }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } exports.keys = function(object) { var keys = []; for (var key in object) { keys.push(key); } keys.reverse(); // Rather than returning an object with a next method, we keep // things simple and return the next function itself. return function next() { while (keys.length) { var key = keys.pop(); if (key in object) { next.value = key; next.done = false; return next; } } // To avoid creating an additional object, we just hang the .value // and .done properties off the next function object itself. This // also ensures that the minifier will not anonymize the function. next.done = true; return next; }; }; function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) { return iteratorMethod.call(iterable); } if (typeof iterable.next === "function") { return iterable; } if (!isNaN(iterable.length)) { var i = -1, next = function next() { while (++i < iterable.length) { if (hasOwn.call(iterable, i)) { next.value = iterable[i]; next.done = false; return next; } } next.value = undefined; next.done = true; return next; }; return next.next = next; } } // Return an iterator with no values. return { next: doneResult }; } exports.values = values; function doneResult() { return { value: undefined, done: true }; } Context.prototype = { constructor: Context, reset: function(skipTempReset) { this.prev = 0; this.next = 0; // Resetting context._sent for legacy support of Babel's // function.sent implementation. this.sent = this._sent = undefined; this.done = false; this.delegate = null; this.method = "next"; this.arg = undefined; this.tryEntries.forEach(resetTryEntry); if (!skipTempReset) { for (var name in this) { // Not sure about the optimal order of these conditions: if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined; } } } }, stop: function() { this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; if (rootRecord.type === "throw") { throw rootRecord.arg; } return this.rval; }, dispatchException: function(exception) { if (this.done) { throw exception; } var context = this; function handle(loc, caught) { record.type = "throw"; record.arg = exception; context.next = loc; if (caught) { // If the dispatched exception was caught by a catch block, // then let that catch block handle the exception normally. context.method = "next"; context.arg = undefined; } return !! caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; var record = entry.completion; if (entry.tryLoc === "root") { // Exception thrown outside of any try block that could handle // it, so set the completion value of the entire function to // throw the exception. return handle("end"); } if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"); var hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } else if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else if (hasCatch) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } } else if (hasFinally) { if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else { throw new Error("try statement without catch or finally"); } } } }, abrupt: function(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { // Ignore the finally entry if control is not jumping to a // location outside the try/catch block. finallyEntry = null; } var record = finallyEntry ? finallyEntry.completion : {}; record.type = type; record.arg = arg; if (finallyEntry) { this.method = "next"; this.next = finallyEntry.finallyLoc; return ContinueSentinel; } return this.complete(record); }, complete: function(record, afterLoc) { if (record.type === "throw") { throw record.arg; } if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { this.rval = this.arg = record.arg; this.method = "return"; this.next = "end"; } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } return ContinueSentinel; }, finish: function(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); return ContinueSentinel; } } }, "catch": function(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } // The context.catch method must only be called with a location // argument that corresponds to a known catch block. throw new Error("illegal catch attempt"); }, delegateYield: function(iterable, resultName, nextLoc) { this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }; if (this.method === "next") { // Deliberately forget the last sent value so that we don't // accidentally pass it on to the delegate. this.arg = undefined; } return ContinueSentinel; } }; // Regardless of whether this script is executing as a CommonJS module // or not, return the runtime object so that we can declare the variable // regeneratorRuntime in the outer scope, which allows this module to be // injected easily by `bin/regenerator --include-runtime script.js`. return exports; }( // If this script is executing as a CommonJS module, use module.exports // as the regeneratorRuntime namespace. Otherwise create a new empty // object. Either way, the resulting object will be used to initialize // the regeneratorRuntime variable at the top of this file. true ? module.exports : {} )); try { regeneratorRuntime = runtime; } catch (accidentalStrictMode) { // This module should not be running in strict mode, so the above // assignment should always work unless something is misconfigured. Just // in case runtime.js accidentally runs in strict mode, we can escape // strict mode using a global Function call. This could conceivably fail // if a Content Security Policy forbids using Function, but in that case // the proper solution is to fix the accidental strict mode problem. If // you've misconfigured your bundler to force strict mode and applied a // CSP to forbid Function, and you're not willing to fix either of those // problems, please detail your unique predicament in a GitHub issue. Function("r", "regeneratorRuntime = r")(runtime); } /***/ }), /* 619 */ /***/ (function(module, exports) { function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } module.exports = _asyncToGenerator; /***/ }), /* 620 */ /***/ (function(module, exports, __webpack_require__) { var arrayWithoutHoles = __webpack_require__(621); var iterableToArray = __webpack_require__(266); var unsupportedIterableToArray = __webpack_require__(267); var nonIterableSpread = __webpack_require__(622); function _toConsumableArray(arr) { return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); } module.exports = _toConsumableArray; /***/ }), /* 621 */ /***/ (function(module, exports, __webpack_require__) { var arrayLikeToArray = __webpack_require__(265); function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return arrayLikeToArray(arr); } module.exports = _arrayWithoutHoles; /***/ }), /* 622 */ /***/ (function(module, exports) { function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } module.exports = _nonIterableSpread; /***/ }), /* 623 */ /***/ (function(module, exports) { function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } module.exports = _defineProperty; /***/ }), /* 624 */ /***/ (function(module, exports, __webpack_require__) { var objectWithoutPropertiesLoose = __webpack_require__(625); function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } module.exports = _objectWithoutProperties; /***/ }), /* 625 */ /***/ (function(module, exports) { function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } module.exports = _objectWithoutPropertiesLoose; /***/ }), /* 626 */ /***/ (function(module, exports) { function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } module.exports = _assertThisInitialized; /***/ }), /* 627 */ /***/ (function(module, exports) { function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } module.exports = _inheritsLoose; /***/ }), /* 628 */ /***/ (function(module, exports, __webpack_require__) { var arrayShuffle = __webpack_require__(629), baseShuffle = __webpack_require__(632), isArray = __webpack_require__(273); /** * Creates an array of shuffled values, using a version of the * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. * @example * * _.shuffle([1, 2, 3, 4]); * // => [4, 1, 3, 2] */ function shuffle(collection) { var func = isArray(collection) ? arrayShuffle : baseShuffle; return func(collection); } module.exports = shuffle; /***/ }), /* 629 */ /***/ (function(module, exports, __webpack_require__) { var copyArray = __webpack_require__(630), shuffleSelf = __webpack_require__(268); /** * A specialized version of `_.shuffle` for arrays. * * @private * @param {Array} array The array to shuffle. * @returns {Array} Returns the new shuffled array. */ function arrayShuffle(array) { return shuffleSelf(copyArray(array)); } module.exports = arrayShuffle; /***/ }), /* 630 */ /***/ (function(module, exports) { /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } module.exports = copyArray; /***/ }), /* 631 */ /***/ (function(module, exports) { /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeFloor = Math.floor, nativeRandom = Math.random; /** * The base implementation of `_.random` without support for returning * floating-point numbers. * * @private * @param {number} lower The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the random number. */ function baseRandom(lower, upper) { return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } module.exports = baseRandom; /***/ }), /* 632 */ /***/ (function(module, exports, __webpack_require__) { var shuffleSelf = __webpack_require__(268), values = __webpack_require__(269); /** * The base implementation of `_.shuffle`. * * @private * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. */ function baseShuffle(collection) { return shuffleSelf(values(collection)); } module.exports = baseShuffle; /***/ }), /* 633 */ /***/ (function(module, exports, __webpack_require__) { var arrayMap = __webpack_require__(634); /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names * of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the array of property values. */ function baseValues(object, props) { return arrayMap(props, function(key) { return object[key]; }); } module.exports = baseValues; /***/ }), /* 634 */ /***/ (function(module, exports) { /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } module.exports = arrayMap; /***/ }), /* 635 */ /***/ (function(module, exports, __webpack_require__) { var arrayLikeKeys = __webpack_require__(636), baseKeys = __webpack_require__(649), isArrayLike = __webpack_require__(652); /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } module.exports = keys; /***/ }), /* 636 */ /***/ (function(module, exports, __webpack_require__) { var baseTimes = __webpack_require__(637), isArguments = __webpack_require__(638), isArray = __webpack_require__(273), isBuffer = __webpack_require__(642), isIndex = __webpack_require__(644), isTypedArray = __webpack_require__(645); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. (isBuff && (key == 'offset' || key == 'parent')) || // PhantomJS 2 has enumerable non-index properties on typed arrays. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties. isIndex(key, length) ))) { result.push(key); } } return result; } module.exports = arrayLikeKeys; /***/ }), /* 637 */ /***/ (function(module, exports) { /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } module.exports = baseTimes; /***/ }), /* 638 */ /***/ (function(module, exports, __webpack_require__) { var baseIsArguments = __webpack_require__(639), isObjectLike = __webpack_require__(119); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; module.exports = isArguments; /***/ }), /* 639 */ /***/ (function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(118), isObjectLike = __webpack_require__(119); /** `Object#toString` result references. */ var argsTag = '[object Arguments]'; /** * The base implementation of `_.isArguments`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } module.exports = baseIsArguments; /***/ }), /* 640 */ /***/ (function(module, exports, __webpack_require__) { var Symbol = __webpack_require__(270); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Built-in value references. */ var symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } module.exports = getRawTag; /***/ }), /* 641 */ /***/ (function(module, exports) { /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } module.exports = objectToString; /***/ }), /* 642 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(271), stubFalse = __webpack_require__(643); /** Detect free variable `exports`. */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || stubFalse; module.exports = isBuffer; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(274)(module))) /***/ }), /* 643 */ /***/ (function(module, exports) { /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } module.exports = stubFalse; /***/ }), /* 644 */ /***/ (function(module, exports) { /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length); } module.exports = isIndex; /***/ }), /* 645 */ /***/ (function(module, exports, __webpack_require__) { var baseIsTypedArray = __webpack_require__(646), baseUnary = __webpack_require__(647), nodeUtil = __webpack_require__(648); /* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; module.exports = isTypedArray; /***/ }), /* 646 */ /***/ (function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(118), isLength = __webpack_require__(275), isObjectLike = __webpack_require__(119); /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } module.exports = baseIsTypedArray; /***/ }), /* 647 */ /***/ (function(module, exports) { /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { return func(value); }; } module.exports = baseUnary; /***/ }), /* 648 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(272); /** Detect free variable `exports`. */ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { // Use `util.types` for Node.js 10+. var types = freeModule && freeModule.require && freeModule.require('util').types; if (types) { return types; } // Legacy `process.binding('util')` for Node.js < 10. return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); module.exports = nodeUtil; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(274)(module))) /***/ }), /* 649 */ /***/ (function(module, exports, __webpack_require__) { var isPrototype = __webpack_require__(650), nativeKeys = __webpack_require__(651); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } module.exports = baseKeys; /***/ }), /* 650 */ /***/ (function(module, exports) { /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } module.exports = isPrototype; /***/ }), /* 651 */ /***/ (function(module, exports, __webpack_require__) { var overArg = __webpack_require__(276); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object); module.exports = nativeKeys; /***/ }), /* 652 */ /***/ (function(module, exports, __webpack_require__) { var isFunction = __webpack_require__(653), isLength = __webpack_require__(275); /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } module.exports = isArrayLike; /***/ }), /* 653 */ /***/ (function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(118), isObject = __webpack_require__(654); /** `Object#toString` result references. */ var asyncTag = '[object AsyncFunction]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', proxyTag = '[object Proxy]'; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } module.exports = isFunction; /***/ }), /* 654 */ /***/ (function(module, exports) { /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } module.exports = isObject; /***/ }), /* 655 */ /***/ (function(module, exports, __webpack_require__) { var arrayWithHoles = __webpack_require__(656); var iterableToArray = __webpack_require__(266); var unsupportedIterableToArray = __webpack_require__(267); var nonIterableRest = __webpack_require__(657); function _toArray(arr) { return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); } module.exports = _toArray; /***/ }), /* 656 */ /***/ (function(module, exports) { function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } module.exports = _arrayWithHoles; /***/ }), /* 657 */ /***/ (function(module, exports) { function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } module.exports = _nonIterableRest; /***/ }), /* 658 */ /***/ (function(module, exports) { function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } module.exports = _createClass; /***/ }), /* 659 */ /***/ (function(module, exports) { function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } module.exports = _applyDecoratedDescriptor; /***/ }), /* 660 */ /***/ (function(module, exports, __webpack_require__) { /* Javascript State Machine Library - https://github.com/jakesgordon/javascript-state-machine Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors Released under the MIT license - https://github.com/jakesgordon/javascript-state-machine/blob/master/LICENSE */ (function () { var StateMachine = { //--------------------------------------------------------------------------- VERSION: "2.4.0", //--------------------------------------------------------------------------- Result: { SUCCEEDED: 1, // the event transitioned successfully from one state to another NOTRANSITION: 2, // the event was successfull but no state transition was necessary CANCELLED: 3, // the event was cancelled by the caller in a beforeEvent callback PENDING: 4 // the event is asynchronous and the caller is in control of when the transition occurs }, Error: { INVALID_TRANSITION: 100, // caller tried to fire an event that was innapropriate in the current state PENDING_TRANSITION: 200, // caller tried to fire an event while an async transition was still pending INVALID_CALLBACK: 300 // caller provided callback function threw an exception }, WILDCARD: '*', ASYNC: 'async', //--------------------------------------------------------------------------- create: function(cfg, target) { var initial = (typeof cfg.initial == 'string') ? { state: cfg.initial } : cfg.initial; // allow for a simple string, or an object with { state: 'foo', event: 'setup', defer: true|false } var terminal = cfg.terminal || cfg['final']; var fsm = target || cfg.target || {}; var events = cfg.events || []; var callbacks = cfg.callbacks || {}; var map = {}; // track state transitions allowed for an event { event: { from: [ to ] } } var transitions = {}; // track events allowed from a state { state: [ event ] } var add = function(e) { var from = Array.isArray(e.from) ? e.from : (e.from ? [e.from] : [StateMachine.WILDCARD]); // allow 'wildcard' transition if 'from' is not specified map[e.name] = map[e.name] || {}; for (var n = 0 ; n < from.length ; n++) { transitions[from[n]] = transitions[from[n]] || []; transitions[from[n]].push(e.name); map[e.name][from[n]] = e.to || from[n]; // allow no-op transition if 'to' is not specified } if (e.to) transitions[e.to] = transitions[e.to] || []; }; if (initial) { initial.event = initial.event || 'startup'; add({ name: initial.event, from: 'none', to: initial.state }); } for(var n = 0 ; n < events.length ; n++) add(events[n]); for(var name in map) { if (map.hasOwnProperty(name)) fsm[name] = StateMachine.buildEvent(name, map[name]); } for(var name in callbacks) { if (callbacks.hasOwnProperty(name)) fsm[name] = callbacks[name] } fsm.current = 'none'; fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); }; fsm.can = function(event) { return !this.transition && (map[event] !== undefined) && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); } fsm.cannot = function(event) { return !this.can(event); }; fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD] || []); }; fsm.isFinished = function() { return this.is(terminal); }; fsm.error = cfg.error || function(name, from, to, args, error, msg, e) { throw e || msg; }; // default behavior when something unexpected happens is to throw an exception, but caller can override this behavior if desired (see github issue #3 and #17) fsm.states = function() { return Object.keys(transitions).sort() }; if (initial && !initial.defer) fsm[initial.event](); return fsm; }, //=========================================================================== doCallback: function(fsm, func, name, from, to, args) { if (func) { try { return func.apply(fsm, [name, from, to].concat(args)); } catch(e) { return fsm.error(name, from, to, args, StateMachine.Error.INVALID_CALLBACK, "an exception occurred in a caller-provided callback function", e); } } }, beforeAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbeforeevent'], name, from, to, args); }, afterAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafterevent'] || fsm['onevent'], name, from, to, args); }, leaveAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleavestate'], name, from, to, args); }, enterAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenterstate'] || fsm['onstate'], name, from, to, args); }, changeState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onchangestate'], name, from, to, args); }, beforeThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbefore' + name], name, from, to, args); }, afterThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafter' + name] || fsm['on' + name], name, from, to, args); }, leaveThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleave' + from], name, from, to, args); }, enterThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenter' + to] || fsm['on' + to], name, from, to, args); }, beforeEvent: function(fsm, name, from, to, args) { if ((false === StateMachine.beforeThisEvent(fsm, name, from, to, args)) || (false === StateMachine.beforeAnyEvent( fsm, name, from, to, args))) return false; }, afterEvent: function(fsm, name, from, to, args) { StateMachine.afterThisEvent(fsm, name, from, to, args); StateMachine.afterAnyEvent( fsm, name, from, to, args); }, leaveState: function(fsm, name, from, to, args) { var specific = StateMachine.leaveThisState(fsm, name, from, to, args), general = StateMachine.leaveAnyState( fsm, name, from, to, args); if ((false === specific) || (false === general)) return false; else if ((StateMachine.ASYNC === specific) || (StateMachine.ASYNC === general)) return StateMachine.ASYNC; }, enterState: function(fsm, name, from, to, args) { StateMachine.enterThisState(fsm, name, from, to, args); StateMachine.enterAnyState( fsm, name, from, to, args); }, //=========================================================================== buildEvent: function(name, map) { return function() { var from = this.current; var to = map[from] || (map[StateMachine.WILDCARD] != StateMachine.WILDCARD ? map[StateMachine.WILDCARD] : from) || from; var args = Array.prototype.slice.call(arguments); // turn arguments into pure array if (this.transition) return this.error(name, from, to, args, StateMachine.Error.PENDING_TRANSITION, "event " + name + " inappropriate because previous transition did not complete"); if (this.cannot(name)) return this.error(name, from, to, args, StateMachine.Error.INVALID_TRANSITION, "event " + name + " inappropriate in current state " + this.current); if (false === StateMachine.beforeEvent(this, name, from, to, args)) return StateMachine.Result.CANCELLED; if (from === to) { StateMachine.afterEvent(this, name, from, to, args); return StateMachine.Result.NOTRANSITION; } // prepare a transition method for use EITHER lower down, or by caller if they want an async transition (indicated by an ASYNC return value from leaveState) var fsm = this; this.transition = function() { fsm.transition = null; // this method should only ever be called once fsm.current = to; StateMachine.enterState( fsm, name, from, to, args); StateMachine.changeState(fsm, name, from, to, args); StateMachine.afterEvent( fsm, name, from, to, args); return StateMachine.Result.SUCCEEDED; }; this.transition.cancel = function() { // provide a way for caller to cancel async transition if desired (issue #22) fsm.transition = null; StateMachine.afterEvent(fsm, name, from, to, args); } var leave = StateMachine.leaveState(this, name, from, to, args); if (false === leave) { this.transition = null; return StateMachine.Result.CANCELLED; } else if (StateMachine.ASYNC === leave) { return StateMachine.Result.PENDING; } else { if (this.transition) // need to check in case user manually called transition() but forgot to return StateMachine.ASYNC return this.transition(); } }; } }; // StateMachine //=========================================================================== //====== // NODE //====== if (true) { if (typeof module !== 'undefined' && module.exports) { exports = module.exports = StateMachine; } exports.StateMachine = StateMachine; } //============ // AMD/REQUIRE //============ else if (typeof define === 'function' && define.amd) { define(function(require) { return StateMachine; }); } //======== // BROWSER //======== else if (typeof window !== 'undefined') { window.StateMachine = StateMachine; } //=========== // WEB WORKER //=========== else if (typeof self !== 'undefined') { self.StateMachine = StateMachine; } }()); /***/ }), /* 661 */ /***/ (function(module, exports) { function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { module.exports = _typeof = function _typeof(obj) { return typeof obj; }; } else { module.exports = _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } module.exports = _typeof; /***/ }), /* 662 */ /***/ (function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(118), getPrototype = __webpack_require__(663), isObjectLike = __webpack_require__(119); /** `Object#toString` result references. */ var objectTag = '[object Object]'; /** Used for built-in method references. */ var funcProto = Function.prototype, objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @since 0.8.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!isObjectLike(value) || baseGetTag(value) != objectTag) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } module.exports = isPlainObject; /***/ }), /* 663 */ /***/ (function(module, exports, __webpack_require__) { var overArg = __webpack_require__(276); /** Built-in value references. */ var getPrototype = overArg(Object.getPrototypeOf, Object); module.exports = getPrototype; /***/ }), /* 664 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; var _interopRequireDefault = __webpack_require__(1); var _isIterable2 = _interopRequireDefault(__webpack_require__(665)); var _from = _interopRequireDefault(__webpack_require__(252)); var _set = _interopRequireDefault(__webpack_require__(264)); var _concat = _interopRequireDefault(__webpack_require__(22)); var _assign = _interopRequireDefault(__webpack_require__(152)); var _map = _interopRequireDefault(__webpack_require__(35)); var _defineProperty = _interopRequireDefault(__webpack_require__(92)); var _typeof2 = _interopRequireDefault(__webpack_require__(73)); (function (global, factory) { ( false ? "undefined" : (0, _typeof2.default)(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, __webpack_require__(156)) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(156)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.AV = global.AV || {}, global.AV)); })(void 0, function (exports, core) { 'use strict'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } function _iterableToArray(iter) { if ((0, _isIterable2.default)(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return (0, _from.default)(iter); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } /* eslint-disable import/no-unresolved */ if (!core.Protocals) { throw new Error('LeanCloud Realtime SDK not installed'); } var CommandType = core.Protocals.CommandType, GenericCommand = core.Protocals.GenericCommand, AckCommand = core.Protocals.AckCommand; var warn = function warn(error) { return console.warn(error.message); }; var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) { _inheritsLoose(LiveQueryClient, _EventEmitter); function LiveQueryClient(appId, subscriptionId, connection) { var _this; _this = _EventEmitter.call(this) || this; _this._appId = appId; _this.id = subscriptionId; _this._connection = connection; _this._eventemitter = new core.EventEmitter(); _this._querys = new _set.default(); return _this; } var _proto = LiveQueryClient.prototype; _proto._send = function _send(cmd) { var _context; var _this$_connection; for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return (_this$_connection = this._connection).send.apply(_this$_connection, (0, _concat.default)(_context = [(0, _assign.default)(cmd, { appId: this._appId, installationId: this.id, service: 1 })]).call(_context, args)); }; _proto._open = function _open() { return this._send(new GenericCommand({ cmd: CommandType.login })); }; _proto.close = function close() { var _ee = this._eventemitter; _ee.emit('beforeclose'); return this._send(new GenericCommand({ cmd: CommandType.logout })).then(function () { return _ee.emit('close'); }); }; _proto.register = function register(liveQuery) { this._querys.add(liveQuery); }; _proto.deregister = function deregister(liveQuery) { var _this2 = this; this._querys.delete(liveQuery); setTimeout(function () { if (!_this2._querys.size) _this2.close().catch(warn); }, 0); }; _proto._dispatchCommand = function _dispatchCommand(command) { if (command.cmd !== CommandType.data) { this.emit('unhandledmessage', command); return core.Promise.resolve(); } return this._dispatchDataCommand(command); }; _proto._dispatchDataCommand = function _dispatchDataCommand(_ref) { var _ref$dataMessage = _ref.dataMessage, ids = _ref$dataMessage.ids, msg = _ref$dataMessage.msg; this.emit('message', (0, _map.default)(msg).call(msg, function (_ref2) { var data = _ref2.data; return JSON.parse(data); })); // send ack var command = new GenericCommand({ cmd: CommandType.ack, ackMessage: new AckCommand({ ids: ids }) }); return this._send(command, false).catch(warn); }; return LiveQueryClient; }(core.EventEmitter); var finalize = function finalize(callback) { return [// eslint-disable-next-line no-sequences function (value) { return callback(), value; }, function (error) { callback(); throw error; }]; }; var onRealtimeCreate = function onRealtimeCreate(realtime) { /* eslint-disable no-param-reassign */ realtime._liveQueryClients = {}; realtime.createLiveQueryClient = function (subscriptionId) { var _realtime$_open$then; if (realtime._liveQueryClients[subscriptionId] !== undefined) { return core.Promise.resolve(realtime._liveQueryClients[subscriptionId]); } var promise = (_realtime$_open$then = realtime._open().then(function (connection) { var client = new LiveQueryClient(realtime._options.appId, subscriptionId, connection); connection.on('reconnect', function () { return client._open().then(function () { return client.emit('reconnect'); }, function (error) { return client.emit('reconnecterror', error); }); }); client._eventemitter.on('beforeclose', function () { delete realtime._liveQueryClients[client.id]; }, realtime); client._eventemitter.on('close', function () { realtime._deregister(client); }, realtime); return client._open().then(function () { realtime._liveQueryClients[client.id] = client; realtime._register(client); return client; }); })).then.apply(_realtime$_open$then, _toConsumableArray(finalize(function () { if (realtime._deregisterPending) realtime._deregisterPending(promise); }))); realtime._liveQueryClients[subscriptionId] = promise; if (realtime._registerPending) realtime._registerPending(promise); return promise; }; /* eslint-enable no-param-reassign */ }; var beforeCommandDispatch = function beforeCommandDispatch(command, realtime) { var isLiveQueryCommand = command.installationId && command.service === 1; if (!isLiveQueryCommand) return true; var targetClient = realtime._liveQueryClients[command.installationId]; if (targetClient) { targetClient._dispatchCommand(command).catch(function (error) { return console.warn(error); }); } else { console.warn('Unexpected message received without any live client match: %O', command); } return false; }; // eslint-disable-next-line import/prefer-default-export var LiveQueryPlugin = { name: 'leancloud-realtime-plugin-live-query', onRealtimeCreate: onRealtimeCreate, beforeCommandDispatch: beforeCommandDispatch }; exports.LiveQueryPlugin = LiveQueryPlugin; (0, _defineProperty.default)(exports, '__esModule', { value: true }); }); /***/ }), /* 665 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(666); /***/ }), /* 666 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(667); /***/ }), /* 667 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(668); module.exports = parent; /***/ }), /* 668 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(669); module.exports = parent; /***/ }), /* 669 */ /***/ (function(module, exports, __webpack_require__) { var parent = __webpack_require__(670); __webpack_require__(39); module.exports = parent; /***/ }), /* 670 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(38); __webpack_require__(55); var isIterable = __webpack_require__(671); module.exports = isIterable; /***/ }), /* 671 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(51); var hasOwn = __webpack_require__(13); var wellKnownSymbol = __webpack_require__(9); var Iterators = __webpack_require__(50); var ITERATOR = wellKnownSymbol('iterator'); var $Object = Object; module.exports = function (it) { var O = $Object(it); return O[ITERATOR] !== undefined || '@@iterator' in O || hasOwn(Iterators, classof(O)); }; /***/ }) /******/ ]); }); //# sourceMappingURL=av-live-query-weapp.js.map