/******/ (function(modules) { // webpackBootstrap /******/ function hotDisposeChunk(chunkId) { /******/ delete installedChunks[chunkId]; /******/ } /******/ var parentHotUpdateCallback = window["webpackHotUpdate"]; /******/ window["webpackHotUpdate"] = // eslint-disable-next-line no-unused-vars /******/ function webpackHotUpdateCallback(chunkId, moreModules) { /******/ hotAddUpdateChunk(chunkId, moreModules); /******/ if (parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules); /******/ } ; /******/ /******/ // eslint-disable-next-line no-unused-vars /******/ function hotDownloadUpdateChunk(chunkId) { /******/ var head = document.getElementsByTagName("head")[0]; /******/ var script = document.createElement("script"); /******/ script.charset = "utf-8"; /******/ script.src = __webpack_require__.p + "" + chunkId + "." + hotCurrentHash + ".hot-update.js"; /******/ if (null) script.crossOrigin = null; /******/ head.appendChild(script); /******/ } /******/ /******/ // eslint-disable-next-line no-unused-vars /******/ function hotDownloadManifest(requestTimeout) { /******/ requestTimeout = requestTimeout || 10000; /******/ return new Promise(function(resolve, reject) { /******/ if (typeof XMLHttpRequest === "undefined") { /******/ return reject(new Error("No browser support")); /******/ } /******/ try { /******/ var request = new XMLHttpRequest(); /******/ var requestPath = __webpack_require__.p + "" + hotCurrentHash + ".hot-update.json"; /******/ request.open("GET", requestPath, true); /******/ request.timeout = requestTimeout; /******/ request.send(null); /******/ } catch (err) { /******/ return reject(err); /******/ } /******/ request.onreadystatechange = function() { /******/ if (request.readyState !== 4) return; /******/ if (request.status === 0) { /******/ // timeout /******/ reject( /******/ new Error("Manifest request to " + requestPath + " timed out.") /******/ ); /******/ } else if (request.status === 404) { /******/ // no update available /******/ resolve(); /******/ } else if (request.status !== 200 && request.status !== 304) { /******/ // other failure /******/ reject(new Error("Manifest request to " + requestPath + " failed.")); /******/ } else { /******/ // success /******/ try { /******/ var update = JSON.parse(request.responseText); /******/ } catch (e) { /******/ reject(e); /******/ return; /******/ } /******/ resolve(update); /******/ } /******/ }; /******/ }); /******/ } /******/ /******/ var hotApplyOnUpdate = true; /******/ // eslint-disable-next-line no-unused-vars /******/ var hotCurrentHash = "458a554240822553b816"; /******/ var hotRequestTimeout = 10000; /******/ var hotCurrentModuleData = {}; /******/ var hotCurrentChildModule; /******/ // eslint-disable-next-line no-unused-vars /******/ var hotCurrentParents = []; /******/ // eslint-disable-next-line no-unused-vars /******/ var hotCurrentParentsTemp = []; /******/ /******/ // eslint-disable-next-line no-unused-vars /******/ function hotCreateRequire(moduleId) { /******/ var me = installedModules[moduleId]; /******/ if (!me) return __webpack_require__; /******/ var fn = function(request) { /******/ if (me.hot.active) { /******/ if (installedModules[request]) { /******/ if (installedModules[request].parents.indexOf(moduleId) === -1) { /******/ installedModules[request].parents.push(moduleId); /******/ } /******/ } else { /******/ hotCurrentParents = [moduleId]; /******/ hotCurrentChildModule = request; /******/ } /******/ if (me.children.indexOf(request) === -1) { /******/ me.children.push(request); /******/ } /******/ } else { /******/ console.warn( /******/ "[HMR] unexpected require(" + /******/ request + /******/ ") from disposed module " + /******/ moduleId /******/ ); /******/ hotCurrentParents = []; /******/ } /******/ return __webpack_require__(request); /******/ }; /******/ var ObjectFactory = function ObjectFactory(name) { /******/ return { /******/ configurable: true, /******/ enumerable: true, /******/ get: function() { /******/ return __webpack_require__[name]; /******/ }, /******/ set: function(value) { /******/ __webpack_require__[name] = value; /******/ } /******/ }; /******/ }; /******/ for (var name in __webpack_require__) { /******/ if ( /******/ Object.prototype.hasOwnProperty.call(__webpack_require__, name) && /******/ name !== "e" && /******/ name !== "t" /******/ ) { /******/ Object.defineProperty(fn, name, ObjectFactory(name)); /******/ } /******/ } /******/ fn.e = function(chunkId) { /******/ if (hotStatus === "ready") hotSetStatus("prepare"); /******/ hotChunksLoading++; /******/ return __webpack_require__.e(chunkId).then(finishChunkLoading, function(err) { /******/ finishChunkLoading(); /******/ throw err; /******/ }); /******/ /******/ function finishChunkLoading() { /******/ hotChunksLoading--; /******/ if (hotStatus === "prepare") { /******/ if (!hotWaitingFilesMap[chunkId]) { /******/ hotEnsureUpdateChunk(chunkId); /******/ } /******/ if (hotChunksLoading === 0 && hotWaitingFiles === 0) { /******/ hotUpdateDownloaded(); /******/ } /******/ } /******/ } /******/ }; /******/ fn.t = function(value, mode) { /******/ if (mode & 1) value = fn(value); /******/ return __webpack_require__.t(value, mode & ~1); /******/ }; /******/ return fn; /******/ } /******/ /******/ // eslint-disable-next-line no-unused-vars /******/ function hotCreateModule(moduleId) { /******/ var hot = { /******/ // private stuff /******/ _acceptedDependencies: {}, /******/ _declinedDependencies: {}, /******/ _selfAccepted: false, /******/ _selfDeclined: false, /******/ _disposeHandlers: [], /******/ _main: hotCurrentChildModule !== moduleId, /******/ /******/ // Module API /******/ active: true, /******/ accept: function(dep, callback) { /******/ if (dep === undefined) hot._selfAccepted = true; /******/ else if (typeof dep === "function") hot._selfAccepted = dep; /******/ else if (typeof dep === "object") /******/ for (var i = 0; i < dep.length; i++) /******/ hot._acceptedDependencies[dep[i]] = callback || function() {}; /******/ else hot._acceptedDependencies[dep] = callback || function() {}; /******/ }, /******/ decline: function(dep) { /******/ if (dep === undefined) hot._selfDeclined = true; /******/ else if (typeof dep === "object") /******/ for (var i = 0; i < dep.length; i++) /******/ hot._declinedDependencies[dep[i]] = true; /******/ else hot._declinedDependencies[dep] = true; /******/ }, /******/ dispose: function(callback) { /******/ hot._disposeHandlers.push(callback); /******/ }, /******/ addDisposeHandler: function(callback) { /******/ hot._disposeHandlers.push(callback); /******/ }, /******/ removeDisposeHandler: function(callback) { /******/ var idx = hot._disposeHandlers.indexOf(callback); /******/ if (idx >= 0) hot._disposeHandlers.splice(idx, 1); /******/ }, /******/ /******/ // Management API /******/ check: hotCheck, /******/ apply: hotApply, /******/ status: function(l) { /******/ if (!l) return hotStatus; /******/ hotStatusHandlers.push(l); /******/ }, /******/ addStatusHandler: function(l) { /******/ hotStatusHandlers.push(l); /******/ }, /******/ removeStatusHandler: function(l) { /******/ var idx = hotStatusHandlers.indexOf(l); /******/ if (idx >= 0) hotStatusHandlers.splice(idx, 1); /******/ }, /******/ /******/ //inherit from previous dispose call /******/ data: hotCurrentModuleData[moduleId] /******/ }; /******/ hotCurrentChildModule = undefined; /******/ return hot; /******/ } /******/ /******/ var hotStatusHandlers = []; /******/ var hotStatus = "idle"; /******/ /******/ function hotSetStatus(newStatus) { /******/ hotStatus = newStatus; /******/ for (var i = 0; i < hotStatusHandlers.length; i++) /******/ hotStatusHandlers[i].call(null, newStatus); /******/ } /******/ /******/ // while downloading /******/ var hotWaitingFiles = 0; /******/ var hotChunksLoading = 0; /******/ var hotWaitingFilesMap = {}; /******/ var hotRequestedFilesMap = {}; /******/ var hotAvailableFilesMap = {}; /******/ var hotDeferred; /******/ /******/ // The update info /******/ var hotUpdate, hotUpdateNewHash; /******/ /******/ function toModuleId(id) { /******/ var isNumber = +id + "" === id; /******/ return isNumber ? +id : id; /******/ } /******/ /******/ function hotCheck(apply) { /******/ if (hotStatus !== "idle") { /******/ throw new Error("check() is only allowed in idle status"); /******/ } /******/ hotApplyOnUpdate = apply; /******/ hotSetStatus("check"); /******/ return hotDownloadManifest(hotRequestTimeout).then(function(update) { /******/ if (!update) { /******/ hotSetStatus("idle"); /******/ return null; /******/ } /******/ hotRequestedFilesMap = {}; /******/ hotWaitingFilesMap = {}; /******/ hotAvailableFilesMap = update.c; /******/ hotUpdateNewHash = update.h; /******/ /******/ hotSetStatus("prepare"); /******/ var promise = new Promise(function(resolve, reject) { /******/ hotDeferred = { /******/ resolve: resolve, /******/ reject: reject /******/ }; /******/ }); /******/ hotUpdate = {}; /******/ var chunkId = "index"; /******/ // eslint-disable-next-line no-lone-blocks /******/ { /******/ /*globals chunkId */ /******/ hotEnsureUpdateChunk(chunkId); /******/ } /******/ if ( /******/ hotStatus === "prepare" && /******/ hotChunksLoading === 0 && /******/ hotWaitingFiles === 0 /******/ ) { /******/ hotUpdateDownloaded(); /******/ } /******/ return promise; /******/ }); /******/ } /******/ /******/ // eslint-disable-next-line no-unused-vars /******/ function hotAddUpdateChunk(chunkId, moreModules) { /******/ if (!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId]) /******/ return; /******/ hotRequestedFilesMap[chunkId] = false; /******/ for (var moduleId in moreModules) { /******/ if (Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { /******/ hotUpdate[moduleId] = moreModules[moduleId]; /******/ } /******/ } /******/ if (--hotWaitingFiles === 0 && hotChunksLoading === 0) { /******/ hotUpdateDownloaded(); /******/ } /******/ } /******/ /******/ function hotEnsureUpdateChunk(chunkId) { /******/ if (!hotAvailableFilesMap[chunkId]) { /******/ hotWaitingFilesMap[chunkId] = true; /******/ } else { /******/ hotRequestedFilesMap[chunkId] = true; /******/ hotWaitingFiles++; /******/ hotDownloadUpdateChunk(chunkId); /******/ } /******/ } /******/ /******/ function hotUpdateDownloaded() { /******/ hotSetStatus("ready"); /******/ var deferred = hotDeferred; /******/ hotDeferred = null; /******/ if (!deferred) return; /******/ if (hotApplyOnUpdate) { /******/ // Wrap deferred object in Promise to mark it as a well-handled Promise to /******/ // avoid triggering uncaught exception warning in Chrome. /******/ // See https://bugs.chromium.org/p/chromium/issues/detail?id=465666 /******/ Promise.resolve() /******/ .then(function() { /******/ return hotApply(hotApplyOnUpdate); /******/ }) /******/ .then( /******/ function(result) { /******/ deferred.resolve(result); /******/ }, /******/ function(err) { /******/ deferred.reject(err); /******/ } /******/ ); /******/ } else { /******/ var outdatedModules = []; /******/ for (var id in hotUpdate) { /******/ if (Object.prototype.hasOwnProperty.call(hotUpdate, id)) { /******/ outdatedModules.push(toModuleId(id)); /******/ } /******/ } /******/ deferred.resolve(outdatedModules); /******/ } /******/ } /******/ /******/ function hotApply(options) { /******/ if (hotStatus !== "ready") /******/ throw new Error("apply() is only allowed in ready status"); /******/ options = options || {}; /******/ /******/ var cb; /******/ var i; /******/ var j; /******/ var module; /******/ var moduleId; /******/ /******/ function getAffectedStuff(updateModuleId) { /******/ var outdatedModules = [updateModuleId]; /******/ var outdatedDependencies = {}; /******/ /******/ var queue = outdatedModules.slice().map(function(id) { /******/ return { /******/ chain: [id], /******/ id: id /******/ }; /******/ }); /******/ while (queue.length > 0) { /******/ var queueItem = queue.pop(); /******/ var moduleId = queueItem.id; /******/ var chain = queueItem.chain; /******/ module = installedModules[moduleId]; /******/ if (!module || module.hot._selfAccepted) continue; /******/ if (module.hot._selfDeclined) { /******/ return { /******/ type: "self-declined", /******/ chain: chain, /******/ moduleId: moduleId /******/ }; /******/ } /******/ if (module.hot._main) { /******/ return { /******/ type: "unaccepted", /******/ chain: chain, /******/ moduleId: moduleId /******/ }; /******/ } /******/ for (var i = 0; i < module.parents.length; i++) { /******/ var parentId = module.parents[i]; /******/ var parent = installedModules[parentId]; /******/ if (!parent) continue; /******/ if (parent.hot._declinedDependencies[moduleId]) { /******/ return { /******/ type: "declined", /******/ chain: chain.concat([parentId]), /******/ moduleId: moduleId, /******/ parentId: parentId /******/ }; /******/ } /******/ if (outdatedModules.indexOf(parentId) !== -1) continue; /******/ if (parent.hot._acceptedDependencies[moduleId]) { /******/ if (!outdatedDependencies[parentId]) /******/ outdatedDependencies[parentId] = []; /******/ addAllToSet(outdatedDependencies[parentId], [moduleId]); /******/ continue; /******/ } /******/ delete outdatedDependencies[parentId]; /******/ outdatedModules.push(parentId); /******/ queue.push({ /******/ chain: chain.concat([parentId]), /******/ id: parentId /******/ }); /******/ } /******/ } /******/ /******/ return { /******/ type: "accepted", /******/ moduleId: updateModuleId, /******/ outdatedModules: outdatedModules, /******/ outdatedDependencies: outdatedDependencies /******/ }; /******/ } /******/ /******/ function addAllToSet(a, b) { /******/ for (var i = 0; i < b.length; i++) { /******/ var item = b[i]; /******/ if (a.indexOf(item) === -1) a.push(item); /******/ } /******/ } /******/ /******/ // at begin all updates modules are outdated /******/ // the "outdated" status can propagate to parents if they don't accept the children /******/ var outdatedDependencies = {}; /******/ var outdatedModules = []; /******/ var appliedUpdate = {}; /******/ /******/ var warnUnexpectedRequire = function warnUnexpectedRequire() { /******/ console.warn( /******/ "[HMR] unexpected require(" + result.moduleId + ") to disposed module" /******/ ); /******/ }; /******/ /******/ for (var id in hotUpdate) { /******/ if (Object.prototype.hasOwnProperty.call(hotUpdate, id)) { /******/ moduleId = toModuleId(id); /******/ /** @type {TODO} */ /******/ var result; /******/ if (hotUpdate[id]) { /******/ result = getAffectedStuff(moduleId); /******/ } else { /******/ result = { /******/ type: "disposed", /******/ moduleId: id /******/ }; /******/ } /******/ /** @type {Error|false} */ /******/ var abortError = false; /******/ var doApply = false; /******/ var doDispose = false; /******/ var chainInfo = ""; /******/ if (result.chain) { /******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> "); /******/ } /******/ switch (result.type) { /******/ case "self-declined": /******/ if (options.onDeclined) options.onDeclined(result); /******/ if (!options.ignoreDeclined) /******/ abortError = new Error( /******/ "Aborted because of self decline: " + /******/ result.moduleId + /******/ chainInfo /******/ ); /******/ break; /******/ case "declined": /******/ if (options.onDeclined) options.onDeclined(result); /******/ if (!options.ignoreDeclined) /******/ abortError = new Error( /******/ "Aborted because of declined dependency: " + /******/ result.moduleId + /******/ " in " + /******/ result.parentId + /******/ chainInfo /******/ ); /******/ break; /******/ case "unaccepted": /******/ if (options.onUnaccepted) options.onUnaccepted(result); /******/ if (!options.ignoreUnaccepted) /******/ abortError = new Error( /******/ "Aborted because " + moduleId + " is not accepted" + chainInfo /******/ ); /******/ break; /******/ case "accepted": /******/ if (options.onAccepted) options.onAccepted(result); /******/ doApply = true; /******/ break; /******/ case "disposed": /******/ if (options.onDisposed) options.onDisposed(result); /******/ doDispose = true; /******/ break; /******/ default: /******/ throw new Error("Unexception type " + result.type); /******/ } /******/ if (abortError) { /******/ hotSetStatus("abort"); /******/ return Promise.reject(abortError); /******/ } /******/ if (doApply) { /******/ appliedUpdate[moduleId] = hotUpdate[moduleId]; /******/ addAllToSet(outdatedModules, result.outdatedModules); /******/ for (moduleId in result.outdatedDependencies) { /******/ if ( /******/ Object.prototype.hasOwnProperty.call( /******/ result.outdatedDependencies, /******/ moduleId /******/ ) /******/ ) { /******/ if (!outdatedDependencies[moduleId]) /******/ outdatedDependencies[moduleId] = []; /******/ addAllToSet( /******/ outdatedDependencies[moduleId], /******/ result.outdatedDependencies[moduleId] /******/ ); /******/ } /******/ } /******/ } /******/ if (doDispose) { /******/ addAllToSet(outdatedModules, [result.moduleId]); /******/ appliedUpdate[moduleId] = warnUnexpectedRequire; /******/ } /******/ } /******/ } /******/ /******/ // Store self accepted outdated modules to require them later by the module system /******/ var outdatedSelfAcceptedModules = []; /******/ for (i = 0; i < outdatedModules.length; i++) { /******/ moduleId = outdatedModules[i]; /******/ if ( /******/ installedModules[moduleId] && /******/ installedModules[moduleId].hot._selfAccepted /******/ ) /******/ outdatedSelfAcceptedModules.push({ /******/ module: moduleId, /******/ errorHandler: installedModules[moduleId].hot._selfAccepted /******/ }); /******/ } /******/ /******/ // Now in "dispose" phase /******/ hotSetStatus("dispose"); /******/ Object.keys(hotAvailableFilesMap).forEach(function(chunkId) { /******/ if (hotAvailableFilesMap[chunkId] === false) { /******/ hotDisposeChunk(chunkId); /******/ } /******/ }); /******/ /******/ var idx; /******/ var queue = outdatedModules.slice(); /******/ while (queue.length > 0) { /******/ moduleId = queue.pop(); /******/ module = installedModules[moduleId]; /******/ if (!module) continue; /******/ /******/ var data = {}; /******/ /******/ // Call dispose handlers /******/ var disposeHandlers = module.hot._disposeHandlers; /******/ for (j = 0; j < disposeHandlers.length; j++) { /******/ cb = disposeHandlers[j]; /******/ cb(data); /******/ } /******/ hotCurrentModuleData[moduleId] = data; /******/ /******/ // disable module (this disables requires from this module) /******/ module.hot.active = false; /******/ /******/ // remove module from cache /******/ delete installedModules[moduleId]; /******/ /******/ // when disposing there is no need to call dispose handler /******/ delete outdatedDependencies[moduleId]; /******/ /******/ // remove "parents" references from all children /******/ for (j = 0; j < module.children.length; j++) { /******/ var child = installedModules[module.children[j]]; /******/ if (!child) continue; /******/ idx = child.parents.indexOf(moduleId); /******/ if (idx >= 0) { /******/ child.parents.splice(idx, 1); /******/ } /******/ } /******/ } /******/ /******/ // remove outdated dependency from module children /******/ var dependency; /******/ var moduleOutdatedDependencies; /******/ for (moduleId in outdatedDependencies) { /******/ if ( /******/ Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId) /******/ ) { /******/ module = installedModules[moduleId]; /******/ if (module) { /******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; /******/ for (j = 0; j < moduleOutdatedDependencies.length; j++) { /******/ dependency = moduleOutdatedDependencies[j]; /******/ idx = module.children.indexOf(dependency); /******/ if (idx >= 0) module.children.splice(idx, 1); /******/ } /******/ } /******/ } /******/ } /******/ /******/ // Not in "apply" phase /******/ hotSetStatus("apply"); /******/ /******/ hotCurrentHash = hotUpdateNewHash; /******/ /******/ // insert new code /******/ for (moduleId in appliedUpdate) { /******/ if (Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) { /******/ modules[moduleId] = appliedUpdate[moduleId]; /******/ } /******/ } /******/ /******/ // call accept handlers /******/ var error = null; /******/ for (moduleId in outdatedDependencies) { /******/ if ( /******/ Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId) /******/ ) { /******/ module = installedModules[moduleId]; /******/ if (module) { /******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; /******/ var callbacks = []; /******/ for (i = 0; i < moduleOutdatedDependencies.length; i++) { /******/ dependency = moduleOutdatedDependencies[i]; /******/ cb = module.hot._acceptedDependencies[dependency]; /******/ if (cb) { /******/ if (callbacks.indexOf(cb) !== -1) continue; /******/ callbacks.push(cb); /******/ } /******/ } /******/ for (i = 0; i < callbacks.length; i++) { /******/ cb = callbacks[i]; /******/ try { /******/ cb(moduleOutdatedDependencies); /******/ } catch (err) { /******/ if (options.onErrored) { /******/ options.onErrored({ /******/ type: "accept-errored", /******/ moduleId: moduleId, /******/ dependencyId: moduleOutdatedDependencies[i], /******/ error: err /******/ }); /******/ } /******/ if (!options.ignoreErrored) { /******/ if (!error) error = err; /******/ } /******/ } /******/ } /******/ } /******/ } /******/ } /******/ /******/ // Load self accepted modules /******/ for (i = 0; i < outdatedSelfAcceptedModules.length; i++) { /******/ var item = outdatedSelfAcceptedModules[i]; /******/ moduleId = item.module; /******/ hotCurrentParents = [moduleId]; /******/ try { /******/ __webpack_require__(moduleId); /******/ } catch (err) { /******/ if (typeof item.errorHandler === "function") { /******/ try { /******/ item.errorHandler(err); /******/ } catch (err2) { /******/ if (options.onErrored) { /******/ options.onErrored({ /******/ type: "self-accept-error-handler-errored", /******/ moduleId: moduleId, /******/ error: err2, /******/ originalError: err /******/ }); /******/ } /******/ if (!options.ignoreErrored) { /******/ if (!error) error = err2; /******/ } /******/ if (!error) error = err; /******/ } /******/ } else { /******/ if (options.onErrored) { /******/ options.onErrored({ /******/ type: "self-accept-errored", /******/ moduleId: moduleId, /******/ error: err /******/ }); /******/ } /******/ if (!options.ignoreErrored) { /******/ if (!error) error = err; /******/ } /******/ } /******/ } /******/ } /******/ /******/ // handle errors in accept handlers and self accepted module load /******/ if (error) { /******/ hotSetStatus("fail"); /******/ return Promise.reject(error); /******/ } /******/ /******/ hotSetStatus("idle"); /******/ return new Promise(function(resolve) { /******/ resolve(outdatedModules); /******/ }); /******/ } /******/ /******/ // 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: {}, /******/ hot: hotCreateModule(moduleId), /******/ parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp), /******/ children: [] /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); /******/ /******/ // 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, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // 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 = "/static/"; /******/ /******/ // __webpack_hash__ /******/ __webpack_require__.h = function() { return hotCurrentHash; }; /******/ /******/ /******/ // Load entry module and return exports /******/ return hotCreateRequire(0)(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ({ /***/ "../../node_modules/@ant-design/icons-react/es/components/Icon.js": /*!***************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@ant-design/icons-react/es/components/Icon.js ***! \***************************************************************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babel-runtime/helpers/defineProperty */ "../../node_modules/babel-runtime/helpers/defineProperty.js"); /* harmony import */ var babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babel-runtime/helpers/extends */ "../../node_modules/babel-runtime/helpers/extends.js"); /* harmony import */ var babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! babel-runtime/helpers/objectWithoutProperties */ "../../node_modules/babel-runtime/helpers/objectWithoutProperties.js"); /* harmony import */ var babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ "../../node_modules/babel-runtime/helpers/classCallCheck.js"); /* harmony import */ var babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! babel-runtime/helpers/createClass */ "../../node_modules/babel-runtime/helpers/createClass.js"); /* harmony import */ var babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ "../../node_modules/babel-runtime/helpers/possibleConstructorReturn.js"); /* harmony import */ var babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! babel-runtime/helpers/inherits */ "../../node_modules/babel-runtime/helpers/inherits.js"); /* harmony import */ var babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_7__); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils */ "../../node_modules/@ant-design/icons-react/es/utils.js"); var twoToneColorPalette = { primaryColor: '#333', secondaryColor: '#E6E6E6' }; var Icon = function (_React$Component) { babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_6___default()(Icon, _React$Component); function Icon() { babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_3___default()(this, Icon); return babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, (Icon.__proto__ || Object.getPrototypeOf(Icon)).apply(this, arguments)); } babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_4___default()(Icon, [{ key: 'render', value: function render() { var _extends2; var _props = this.props, type = _props.type, className = _props.className, onClick = _props.onClick, style = _props.style, primaryColor = _props.primaryColor, secondaryColor = _props.secondaryColor, rest = babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2___default()(_props, ['type', 'className', 'onClick', 'style', 'primaryColor', 'secondaryColor']); var target = void 0; var colors = twoToneColorPalette; if (primaryColor) { colors = { primaryColor: primaryColor, secondaryColor: secondaryColor || Object(_utils__WEBPACK_IMPORTED_MODULE_8__["getSecondaryColor"])(primaryColor) }; } if (Object(_utils__WEBPACK_IMPORTED_MODULE_8__["isIconDefinition"])(type)) { target = type; } else if (typeof type === 'string') { target = Icon.get(type, colors); if (!target) { // log(`Could not find icon: ${type}`); return null; } } if (!target) { Object(_utils__WEBPACK_IMPORTED_MODULE_8__["log"])('type should be string or icon definiton, but got ' + type); return null; } if (target && typeof target.icon === 'function') { target = babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({}, target, { icon: target.icon(colors.primaryColor, colors.secondaryColor) }); } return Object(_utils__WEBPACK_IMPORTED_MODULE_8__["generate"])(target.icon, 'svg-' + target.name, babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()((_extends2 = { className: className, onClick: onClick, style: style }, babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_extends2, 'data-icon', target.name), babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_extends2, 'width', '1em'), babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_extends2, 'height', '1em'), babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_extends2, 'fill', 'currentColor'), babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_extends2, 'aria-hidden', 'true'), _extends2), rest)); } }], [{ key: 'add', value: function add() { var _this2 = this; for (var _len = arguments.length, icons = Array(_len), _key = 0; _key < _len; _key++) { icons[_key] = arguments[_key]; } icons.forEach(function (icon) { _this2.definitions.set(Object(_utils__WEBPACK_IMPORTED_MODULE_8__["withSuffix"])(icon.name, icon.theme), icon); }); } }, { key: 'clear', value: function clear() { this.definitions.clear(); } }, { key: 'get', value: function get(key) { var colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : twoToneColorPalette; if (key) { var target = this.definitions.get(key); if (target && typeof target.icon === 'function') { target = babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({}, target, { icon: target.icon(colors.primaryColor, colors.secondaryColor) }); } return target; } } }, { key: 'setTwoToneColors', value: function setTwoToneColors(_ref) { var primaryColor = _ref.primaryColor, secondaryColor = _ref.secondaryColor; twoToneColorPalette.primaryColor = primaryColor; twoToneColorPalette.secondaryColor = secondaryColor || Object(_utils__WEBPACK_IMPORTED_MODULE_8__["getSecondaryColor"])(primaryColor); } }, { key: 'getTwoToneColors', value: function getTwoToneColors() { return babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({}, twoToneColorPalette); } }]); return Icon; }(react__WEBPACK_IMPORTED_MODULE_7__["Component"]); Icon.displayName = 'IconReact'; Icon.definitions = new _utils__WEBPACK_IMPORTED_MODULE_8__["MiniMap"](); /* harmony default export */ __webpack_exports__["default"] = (Icon); /***/ }), /***/ "../../node_modules/@ant-design/icons-react/es/index.js": /*!*****************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@ant-design/icons-react/es/index.js ***! \*****************************************************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _components_Icon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/Icon */ "../../node_modules/@ant-design/icons-react/es/components/Icon.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _components_Icon__WEBPACK_IMPORTED_MODULE_0__["default"]; }); /***/ }), /***/ "../../node_modules/@ant-design/icons-react/es/utils.js": /*!*****************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@ant-design/icons-react/es/utils.js ***! \*****************************************************************************************************************************/ /*! exports provided: log, isIconDefinition, normalizeAttrs, MiniMap, generate, getSecondaryColor, withSuffix */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* WEBPACK VAR INJECTION */(function(process, console) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "log", function() { return log; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIconDefinition", function() { return isIconDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalizeAttrs", function() { return normalizeAttrs; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MiniMap", function() { return MiniMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generate", function() { return generate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSecondaryColor", function() { return getSecondaryColor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withSuffix", function() { return withSuffix; }); /* harmony import */ var babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babel-runtime/helpers/extends */ "../../node_modules/babel-runtime/helpers/extends.js"); /* harmony import */ var babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ "../../node_modules/babel-runtime/helpers/classCallCheck.js"); /* harmony import */ var babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! babel-runtime/helpers/createClass */ "../../node_modules/babel-runtime/helpers/createClass.js"); /* harmony import */ var babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var ant_design_palettes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ant-design-palettes */ "../../node_modules/ant-design-palettes/lib/index.js"); /* harmony import */ var ant_design_palettes__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(ant_design_palettes__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__); function log(message) { if (!(process && Object({"DEVELOPMENT":undefined}) && "development" === 'production')) { console.error('[@ant-design/icons-react]: ' + message + '.'); } } function isIconDefinition(target) { return typeof target === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (typeof target.icon === 'object' || typeof target.icon === 'function'); } function normalizeAttrs() { var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return Object.keys(attrs).reduce(function (acc, key) { var val = attrs[key]; switch (key) { case 'class': acc.className = val; delete acc['class']; break; default: acc[key] = val; } return acc; }, {}); } var MiniMap = function () { function MiniMap() { babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, MiniMap); this.collection = {}; } babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(MiniMap, [{ key: 'clear', value: function clear() { this.collection = {}; } }, { key: 'delete', value: function _delete(key) { return delete this.collection[key]; } }, { key: 'get', value: function get(key) { return this.collection[key]; } }, { key: 'has', value: function has(key) { return Boolean(this.collection[key]); } }, { key: 'set', value: function set(key, value) { this.collection[key] = value; return this; } }, { key: 'size', get: function get() { return Object.keys(this.collection).length; } }]); return MiniMap; }(); function generate(node, key, rootProps) { if (!rootProps) { return react__WEBPACK_IMPORTED_MODULE_4__["createElement"](node.tag, babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({ key: key }, normalizeAttrs(node.attrs)), (node.children || []).map(function (child, index) { return generate(child, key + '-' + node.tag + '-' + index); })); } return react__WEBPACK_IMPORTED_MODULE_4__["createElement"](node.tag, babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({ key: key }, normalizeAttrs(node.attrs), rootProps), (node.children || []).map(function (child, index) { return generate(child, key + '-' + node.tag + '-' + index); })); } function getSecondaryColor(primaryColor) { // choose the second color return Object(ant_design_palettes__WEBPACK_IMPORTED_MODULE_3__["generate"])(primaryColor)[0]; } function withSuffix(name, theme) { switch (theme) { case 'fill': return name + '-fill'; case 'outline': return name + '-o'; case 'twotone': return name + '-twotone'; default: throw new TypeError('Unknown theme type: ' + theme + ', name: ' + name); } } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node-libs-browser/node_modules/process/browser.js */ "../../node_modules/node-libs-browser/node_modules/process/browser.js"), __webpack_require__(/*! ./../../../console-browserify/index.js */ "../../node_modules/console-browserify/index.js"))) /***/ }), /***/ "../../node_modules/@ant-design/icons/lib/dist.js": /*!***********************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@ant-design/icons/lib/dist.js ***! \***********************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var normalViewBox = '0 0 1024 1024'; var newViewBox = '64 64 896 896'; var fill = 'fill'; var outline = 'outline'; var twotone = 'twotone'; function getNode(viewBox) { var paths = []; for (var _i = 1; _i < arguments.length; _i++) { paths[_i - 1] = arguments[_i]; } return { tag: 'svg', attrs: { viewBox: viewBox }, children: paths.map(function (path) { if (Array.isArray(path)) { return { tag: 'path', attrs: { fill: path[0], d: path[1] } }; } return { tag: 'path', attrs: { d: path } }; }) }; } function getIcon(name, theme, icon) { return { name: name, theme: theme, icon: icon }; } exports.AccountBookFill = getIcon('account-book', fill, getNode(newViewBox, 'M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zM648.3 426.8l-87.7 161.1h45.7c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4v29.7h63.4c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4V752c0 5.5-4.5 10-10 10h-41.3c-5.5 0-10-4.5-10-10v-51.8h-63.1c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h63.1v-29.7h-63.1c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h45.2l-88-161.1c-2.6-4.8-.9-10.9 4-13.6 1.5-.8 3.1-1.2 4.8-1.2h46c3.8 0 7.2 2.1 8.9 5.5l72.9 144.3 73.2-144.3a10 10 0 0 1 8.9-5.5h45c5.5 0 10 4.5 10 10 .1 1.7-.3 3.3-1.1 4.8z')); exports.AlertFill = getIcon('alert', fill, getNode(newViewBox, 'M512 244c176.18 0 319 142.82 319 319v233a32 32 0 0 1-32 32H225a32 32 0 0 1-32-32V563c0-176.18 142.82-319 319-319zM484 68h56a8 8 0 0 1 8 8v96a8 8 0 0 1-8 8h-56a8 8 0 0 1-8-8V76a8 8 0 0 1 8-8zM177.25 191.66a8 8 0 0 1 11.32 0l67.88 67.88a8 8 0 0 1 0 11.31l-39.6 39.6a8 8 0 0 1-11.31 0l-67.88-67.88a8 8 0 0 1 0-11.31l39.6-39.6zm669.6 0l39.6 39.6a8 8 0 0 1 0 11.3l-67.88 67.9a8 8 0 0 1-11.32 0l-39.6-39.6a8 8 0 0 1 0-11.32l67.89-67.88a8 8 0 0 1 11.31 0zM192 892h640a32 32 0 0 1 32 32v24a8 8 0 0 1-8 8H168a8 8 0 0 1-8-8v-24a32 32 0 0 1 32-32zm148-317v253h64V575h-64z')); exports.AlipayCircleFill = getIcon('alipay-circle', fill, getNode(newViewBox, 'M308.6 545.7c-19.8 2-57.1 10.7-77.4 28.6-61 53-24.5 150 99 150 71.8 0 143.5-45.7 199.8-119-80.2-38.9-148.1-66.8-221.4-59.6zm460.5 67c100.1 33.4 154.7 43 166.7 44.8A445.9 445.9 0 0 0 960 512c0-247.4-200.6-448-448-448S64 264.6 64 512s200.6 448 448 448c155.9 0 293.2-79.7 373.5-200.5-75.6-29.8-213.6-85-286.8-120.1-69.9 85.7-160.1 137.8-253.7 137.8-158.4 0-212.1-138.1-137.2-229 16.3-19.8 44.2-38.7 87.3-49.4 67.5-16.5 175 10.3 275.7 43.4 18.1-33.3 33.4-69.9 44.7-108.9H305.1V402h160v-56.2H271.3v-31.3h193.8v-80.1s0-13.5 13.7-13.5H557v93.6h191.7v31.3H557.1V402h156.4c-15 61.1-37.7 117.4-66.2 166.8 47.5 17.1 90.1 33.3 121.8 43.9z')); exports.AlipaySquareFill = getIcon('alipay-square', fill, getNode(newViewBox, 'M308.6 545.7c-19.8 2-57.1 10.7-77.4 28.6-61 53-24.5 150 99 150 71.8 0 143.5-45.7 199.8-119-80.2-38.9-148.1-66.8-221.4-59.6zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm29.4 663.2S703 689.4 598.7 639.5C528.8 725.2 438.6 777.3 345 777.3c-158.4 0-212.1-138.1-137.2-229 16.3-19.8 44.2-38.7 87.3-49.4 67.5-16.5 175 10.3 275.7 43.4 18.1-33.3 33.4-69.9 44.7-108.9H305.1V402h160v-56.2H271.3v-31.3h193.8v-80.1s0-13.5 13.7-13.5H557v93.6h191.7v31.3H557.1V402h156.4c-15 61.1-37.7 117.4-66.2 166.8 47.5 17.1 90.1 33.3 121.8 43.9 114.3 38.2 140.2 40.2 140.2 40.2v122.3z')); exports.AliwangwangFill = getIcon('aliwangwang', fill, getNode(newViewBox, 'M868.2 377.4c-18.9-45.1-46.3-85.6-81.2-120.6a377.26 377.26 0 0 0-120.5-81.2A375.65 375.65 0 0 0 519 145.8c-41.9 0-82.9 6.7-121.9 20C306 123.3 200.8 120 170.6 120c-2.2 0-7.4 0-9.4.2-11.9.4-22.8 6.5-29.2 16.4-6.5 9.9-7.7 22.4-3.4 33.5l64.3 161.6a378.59 378.59 0 0 0-52.8 193.2c0 51.4 10 101 29.8 147.6 18.9 45 46.2 85.6 81.2 120.5 34.7 34.8 75.4 62.1 120.5 81.2C418.3 894 467.9 904 519 904c51.3 0 100.9-10 147.7-29.8 44.9-18.9 85.5-46.3 120.4-81.2 34.7-34.8 62.1-75.4 81.2-120.6a376.5 376.5 0 0 0 29.8-147.6c-.2-51.2-10.1-100.8-29.9-147.4zm-325.2 79c0 20.4-16.6 37.1-37.1 37.1-20.4 0-37.1-16.7-37.1-37.1v-55.1c0-20.4 16.6-37.1 37.1-37.1 20.4 0 37.1 16.6 37.1 37.1v55.1zm175.2 0c0 20.4-16.6 37.1-37.1 37.1S644 476.8 644 456.4v-55.1c0-20.4 16.7-37.1 37.1-37.1 20.4 0 37.1 16.6 37.1 37.1v55.1z')); exports.AmazonCircleFill = getIcon('amazon-circle', fill, getNode(newViewBox, 'M485 467.5c-11.6 4.9-20.9 12.2-27.8 22-6.9 9.8-10.4 21.6-10.4 35.5 0 17.8 7.5 31.5 22.4 41.2 14.1 9.1 28.9 11.4 44.4 6.8 17.9-5.2 30-17.9 36.4-38.1 3-9.3 4.5-19.7 4.5-31.3v-50.2c-12.6.4-24.4 1.6-35.5 3.7-11.1 2.1-22.4 5.6-34 10.4zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm35.8 262.7c-7.2-10.9-20.1-16.4-38.7-16.4-1.3 0-3 .1-5.3.3-2.2.2-6.6 1.5-12.9 3.7a79.4 79.4 0 0 0-17.9 9.1c-5.5 3.8-11.5 10-18 18.4-6.4 8.5-11.5 18.4-15.3 29.8l-94-8.4c0-12.4 2.4-24.7 7-36.9 4.7-12.2 11.8-23.9 21.4-35 9.6-11.2 21.1-21 34.5-29.4 13.4-8.5 29.6-15.2 48.4-20.3 18.9-5.1 39.1-7.6 60.9-7.6 21.3 0 40.6 2.6 57.8 7.7 17.2 5.2 31.1 11.5 41.4 19.1a117 117 0 0 1 25.9 25.7c6.9 9.6 11.7 18.5 14.4 26.7 2.7 8.2 4 15.7 4 22.8v182.5c0 6.4 1.4 13 4.3 19.8 2.9 6.8 6.3 12.8 10.2 18 3.9 5.2 7.9 9.9 12 14.3 4.1 4.3 7.6 7.7 10.6 9.9l4.1 3.4-72.5 69.4c-8.5-7.7-16.9-15.4-25.2-23.4-8.3-8-14.5-14-18.5-18.1l-6.1-6.2c-2.4-2.3-5-5.7-8-10.2-8.1 12.2-18.5 22.8-31.1 31.8-12.7 9-26.3 15.6-40.7 19.7-14.5 4.1-29.4 6.5-44.7 7.1-15.3.6-30-1.5-43.9-6.5-13.9-5-26.5-11.7-37.6-20.3-11.1-8.6-19.9-20.2-26.5-35-6.6-14.8-9.9-31.5-9.9-50.4 0-17.4 3-33.3 8.9-47.7 6-14.5 13.6-26.5 23-36.1 9.4-9.6 20.7-18.2 34-25.7s26.4-13.4 39.2-17.7c12.8-4.2 26.6-7.8 41.5-10.7 14.9-2.9 27.6-4.8 38.2-5.7 10.6-.9 21.2-1.6 31.8-2v-39.4c0-13.5-2.3-23.5-6.7-30.1zm180.5 379.6c-2.8 3.3-7.5 7.8-14.1 13.5s-16.8 12.7-30.5 21.1c-13.7 8.4-28.8 16-45 22.9-16.3 6.9-36.3 12.9-60.1 18-23.7 5.1-48.2 7.6-73.3 7.6-25.4 0-50.7-3.2-76.1-9.6-25.4-6.4-47.6-14.3-66.8-23.7-19.1-9.4-37.6-20.2-55.1-32.2-17.6-12.1-31.7-22.9-42.4-32.5-10.6-9.6-19.6-18.7-26.8-27.1-1.7-1.9-2.8-3.6-3.2-5.1-.4-1.5-.3-2.8.3-3.7.6-.9 1.5-1.6 2.6-2.2a7.42 7.42 0 0 1 7.4.8c40.9 24.2 72.9 41.3 95.9 51.4 82.9 36.4 168 45.7 255.3 27.9 40.5-8.3 82.1-22.2 124.9-41.8 3.2-1.2 6-1.5 8.3-.9 2.3.6 3.5 2.4 3.5 5.4 0 2.8-1.6 6.3-4.8 10.2zm59.9-29c-1.8 11.1-4.9 21.6-9.1 31.8-7.2 17.1-16.3 30-27.1 38.4-3.6 2.9-6.4 3.8-8.3 2.8-1.9-1-1.9-3.5 0-7.4 4.5-9.3 9.2-21.8 14.2-37.7 5-15.8 5.7-26 2.1-30.5-1.1-1.5-2.7-2.6-5-3.6-2.2-.9-5.1-1.5-8.6-1.9s-6.7-.6-9.4-.8c-2.8-.2-6.5-.2-11.2 0-4.7.2-8 .4-10.1.6a874.4 874.4 0 0 1-17.1 1.5c-1.3.2-2.7.4-4.1.5-1.5.1-2.7.2-3.5.3l-2.7.3c-1 .1-1.7.2-2.2.2h-3.2l-1-.2-.6-.5-.5-.9c-1.3-3.3 3.7-7.4 15-12.4s22.3-8.1 32.9-9.3c9.8-1.5 21.3-1.5 34.5-.3s21.3 3.7 24.3 7.4c2.3 3.5 2.5 10.7.7 21.7z')); exports.AmazonSquareFill = getIcon('amazon-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM547.8 326.7c-7.2-10.9-20.1-16.4-38.7-16.4-1.3 0-3 .1-5.3.3-2.2.2-6.6 1.5-12.9 3.7a79.4 79.4 0 0 0-17.9 9.1c-5.5 3.8-11.5 10-18 18.4-6.4 8.5-11.5 18.4-15.3 29.8l-94-8.4c0-12.4 2.4-24.7 7-36.9s11.8-23.9 21.4-35c9.6-11.2 21.1-21 34.5-29.4 13.4-8.5 29.6-15.2 48.4-20.3 18.9-5.1 39.1-7.6 60.9-7.6 21.3 0 40.6 2.6 57.8 7.7 17.2 5.2 31.1 11.5 41.4 19.1a117 117 0 0 1 25.9 25.7c6.9 9.6 11.7 18.5 14.4 26.7 2.7 8.2 4 15.7 4 22.8v182.5c0 6.4 1.4 13 4.3 19.8 2.9 6.8 6.3 12.8 10.2 18 3.9 5.2 7.9 9.9 12 14.3 4.1 4.3 7.6 7.7 10.6 9.9l4.1 3.4-72.5 69.4c-8.5-7.7-16.9-15.4-25.2-23.4-8.3-8-14.5-14-18.5-18.1l-6.1-6.2c-2.4-2.3-5-5.7-8-10.2-8.1 12.2-18.5 22.8-31.1 31.8-12.7 9-26.3 15.6-40.7 19.7-14.5 4.1-29.4 6.5-44.7 7.1-15.3.6-30-1.5-43.9-6.5-13.9-5-26.5-11.7-37.6-20.3-11.1-8.6-19.9-20.2-26.5-35-6.6-14.8-9.9-31.5-9.9-50.4 0-17.4 3-33.3 8.9-47.7 6-14.5 13.6-26.5 23-36.1 9.4-9.6 20.7-18.2 34-25.7s26.4-13.4 39.2-17.7c12.8-4.2 26.6-7.8 41.5-10.7 14.9-2.9 27.6-4.8 38.2-5.7 10.6-.9 21.2-1.6 31.8-2v-39.4c0-13.5-2.3-23.5-6.7-30.1zm180.5 379.6c-2.8 3.3-7.5 7.8-14.1 13.5s-16.8 12.7-30.5 21.1c-13.7 8.4-28.8 16-45 22.9-16.3 6.9-36.3 12.9-60.1 18-23.7 5.1-48.2 7.6-73.3 7.6-25.4 0-50.7-3.2-76.1-9.6-25.4-6.4-47.6-14.3-66.8-23.7-19.1-9.4-37.6-20.2-55.1-32.2-17.6-12.1-31.7-22.9-42.4-32.5-10.6-9.6-19.6-18.7-26.8-27.1-1.7-1.9-2.8-3.6-3.2-5.1-.4-1.5-.3-2.8.3-3.7.6-.9 1.5-1.6 2.6-2.2a7.42 7.42 0 0 1 7.4.8c40.9 24.2 72.9 41.3 95.9 51.4 82.9 36.4 168 45.7 255.3 27.9 40.5-8.3 82.1-22.2 124.9-41.8 3.2-1.2 6-1.5 8.3-.9 2.3.6 3.5 2.4 3.5 5.4 0 2.8-1.6 6.3-4.8 10.2zm59.9-29c-1.8 11.1-4.9 21.6-9.1 31.8-7.2 17.1-16.3 30-27.1 38.4-3.6 2.9-6.4 3.8-8.3 2.8-1.9-1-1.9-3.5 0-7.4 4.5-9.3 9.2-21.8 14.2-37.7 5-15.8 5.7-26 2.1-30.5-1.1-1.5-2.7-2.6-5-3.6-2.2-.9-5.1-1.5-8.6-1.9s-6.7-.6-9.4-.8c-2.8-.2-6.5-.2-11.2 0-4.7.2-8 .4-10.1.6a874.4 874.4 0 0 1-17.1 1.5c-1.3.2-2.7.4-4.1.5-1.5.1-2.7.2-3.5.3l-2.7.3c-1 .1-1.7.2-2.2.2h-3.2l-1-.2-.6-.5-.5-.9c-1.3-3.3 3.7-7.4 15-12.4s22.3-8.1 32.9-9.3c9.8-1.5 21.3-1.5 34.5-.3s21.3 3.7 24.3 7.4c2.3 3.5 2.5 10.7.7 21.7zM485 467.5c-11.6 4.9-20.9 12.2-27.8 22-6.9 9.8-10.4 21.6-10.4 35.5 0 17.8 7.5 31.5 22.4 41.2 14.1 9.1 28.9 11.4 44.4 6.8 17.9-5.2 30-17.9 36.4-38.1 3-9.3 4.5-19.7 4.5-31.3v-50.2c-12.6.4-24.4 1.6-35.5 3.7-11.1 2.1-22.4 5.6-34 10.4z')); exports.ApiFill = getIcon('api', fill, getNode(newViewBox, 'M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 0 0-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 0 0 0 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM578.9 546.7a8.03 8.03 0 0 0-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 0 0-11.3 0L363 475.3l-43-43a7.85 7.85 0 0 0-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 68.9-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 0 0 0 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2z')); exports.AndroidFill = getIcon('android', fill, getNode(newViewBox, 'M270.1 741.7c0 23.4 19.1 42.5 42.6 42.5h48.7v120.4c0 30.5 24.5 55.4 54.6 55.4 30.2 0 54.6-24.8 54.6-55.4V784.1h85v120.4c0 30.5 24.5 55.4 54.6 55.4 30.2 0 54.6-24.8 54.6-55.4V784.1h48.7c23.5 0 42.6-19.1 42.6-42.5V346.4h-486v395.3zm357.1-600.1l44.9-65c2.6-3.8 2-8.9-1.5-11.4-3.5-2.4-8.5-1.2-11.1 2.6l-46.6 67.6c-30.7-12.1-64.9-18.8-100.8-18.8-35.9 0-70.1 6.7-100.8 18.8l-46.6-67.5c-2.6-3.8-7.6-5.1-11.1-2.6-3.5 2.4-4.1 7.4-1.5 11.4l44.9 65c-71.4 33.2-121.4 96.1-127.8 169.6h486c-6.6-73.6-56.7-136.5-128-169.7zM409.5 244.1a26.9 26.9 0 1 1 26.9-26.9 26.97 26.97 0 0 1-26.9 26.9zm208.4 0a26.9 26.9 0 1 1 26.9-26.9 26.97 26.97 0 0 1-26.9 26.9zm223.4 100.7c-30.2 0-54.6 24.8-54.6 55.4v216.4c0 30.5 24.5 55.4 54.6 55.4 30.2 0 54.6-24.8 54.6-55.4V400.1c.1-30.6-24.3-55.3-54.6-55.3zm-658.6 0c-30.2 0-54.6 24.8-54.6 55.4v216.4c0 30.5 24.5 55.4 54.6 55.4 30.2 0 54.6-24.8 54.6-55.4V400.1c0-30.6-24.5-55.3-54.6-55.3z')); exports.AudioFill = getIcon('audio', fill, getNode(newViewBox, 'M512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm330-170c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1z')); exports.AppleFill = getIcon('apple', fill, getNode(newViewBox, 'M747.4 535.7c-.4-68.2 30.5-119.6 92.9-157.5-34.9-50-87.7-77.5-157.3-82.8-65.9-5.2-138 38.4-164.4 38.4-27.9 0-91.7-36.6-141.9-36.6C273.1 298.8 163 379.8 163 544.6c0 48.7 8.9 99 26.7 150.8 23.8 68.2 109.6 235.3 199.1 232.6 46.8-1.1 79.9-33.2 140.8-33.2 59.1 0 89.7 33.2 141.9 33.2 90.3-1.3 167.9-153.2 190.5-221.6-121.1-57.1-114.6-167.2-114.6-170.7zm-105.1-305c50.7-60.2 46.1-115 44.6-134.7-44.8 2.6-96.6 30.5-126.1 64.8-32.5 36.8-51.6 82.3-47.5 133.6 48.4 3.7 92.6-21.2 129-63.7z')); exports.AppstoreFill = getIcon('appstore', fill, getNode(newViewBox, 'M864 144H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zM464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm0 400H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16z')); exports.BackwardFill = getIcon('backward', fill, getNode(normalViewBox, 'M485.6 249.9L198.2 498c-8.3 7.1-8.3 20.8 0 27.9l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9zm320 0L518.2 498a18.6 18.6 0 0 0-6.2 14c0 5.2 2.1 10.4 6.2 14l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9z')); exports.BankFill = getIcon('bank', fill, getNode(newViewBox, 'M894 462c30.9 0 43.8-39.7 18.7-58L530.8 126.2a31.81 31.81 0 0 0-37.6 0L111.3 404c-25.1 18.2-12.2 58 18.8 58H192v374h-72c-4.4 0-8 3.6-8 8v52c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-52c0-4.4-3.6-8-8-8h-72V462h62zM381 836H264V462h117v374zm189 0H453V462h117v374zm190 0H642V462h118v374z')); exports.BehanceCircleFill = getIcon('behance-circle', fill, getNode(newViewBox, 'M420.3 470.3c8.7-6.3 12.9-16.7 12.9-31 .3-6.8-1.1-13.5-4.1-19.6-2.7-4.9-6.7-9-11.6-11.9a44.8 44.8 0 0 0-16.6-6c-6.4-1.2-12.9-1.8-19.3-1.7h-70.3v79.7h76.1c13.1.1 24.2-3.1 32.9-9.5zm11.8 72c-9.8-7.5-22.9-11.2-39.2-11.2h-81.8v94h80.2c7.5 0 14.4-.7 21.1-2.1a50.5 50.5 0 0 0 17.8-7.2c5.1-3.3 9.2-7.8 12.3-13.6 3-5.8 4.5-13.2 4.5-22.1 0-17.7-5-30.2-14.9-37.8zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm86.5 286.9h138.4v33.7H598.5v-33.7zM512 628.8a89.52 89.52 0 0 1-27 31c-11.8 8.2-24.9 14.2-38.8 17.7a167.4 167.4 0 0 1-44.6 5.7H236V342.1h161c16.3 0 31.1 1.5 44.6 4.3 13.4 2.8 24.8 7.6 34.4 14.1 9.5 6.5 17 15.2 22.3 26 5.2 10.7 7.9 24.1 7.9 40 0 17.2-3.9 31.4-11.7 42.9-7.9 11.5-19.3 20.8-34.8 28.1 21.1 6 36.6 16.7 46.8 31.7 10.4 15.2 15.5 33.4 15.5 54.8 0 17.4-3.3 32.3-10 44.8zM790.8 576H612.4c0 19.4 6.7 38 16.8 48 10.2 9.9 24.8 14.9 43.9 14.9 13.8 0 25.5-3.5 35.5-10.4 9.9-6.9 15.9-14.2 18.1-21.8h59.8c-9.6 29.7-24.2 50.9-44 63.7-19.6 12.8-43.6 19.2-71.5 19.2-19.5 0-37-3.2-52.7-9.3-15.1-5.9-28.7-14.9-39.9-26.5a121.2 121.2 0 0 1-25.1-41.2c-6.1-16.9-9.1-34.7-8.9-52.6 0-18.5 3.1-35.7 9.1-51.7 11.5-31.1 35.4-56 65.9-68.9 16.3-6.8 33.8-10.2 51.5-10 21 0 39.2 4 55 12.2a111.6 111.6 0 0 1 38.6 32.8c10.1 13.7 17.2 29.3 21.7 46.9 4.3 17.3 5.8 35.5 4.6 54.7zm-122-95.6c-10.8 0-19.9 1.9-26.9 5.6-7 3.7-12.8 8.3-17.2 13.6a48.4 48.4 0 0 0-9.1 17.4c-1.6 5.3-2.7 10.7-3.1 16.2H723c-1.6-17.3-7.6-30.1-15.6-39.1-8.4-8.9-21.9-13.7-38.6-13.7z')); exports.BellFill = getIcon('bell', fill, getNode(newViewBox, 'M816 768h-24V428c0-141.1-104.3-257.8-240-277.2V112c0-22.1-17.9-40-40-40s-40 17.9-40 40v38.8C336.3 170.2 232 286.9 232 428v340h-24c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h216c0 61.8 50.2 112 112 112s112-50.2 112-112h216c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM512 888c-26.5 0-48-21.5-48-48h96c0 26.5-21.5 48-48 48z')); exports.BookFill = getIcon('book', fill, getNode(newViewBox, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zM668 345.9L621.5 312 572 347.4V124h96v221.9z')); exports.BehanceSquareFill = getIcon('behance-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM598.5 350.9h138.4v33.7H598.5v-33.7zM512 628.8a89.52 89.52 0 0 1-27 31c-11.8 8.2-24.9 14.2-38.8 17.7a167.4 167.4 0 0 1-44.6 5.7H236V342.1h161c16.3 0 31.1 1.5 44.6 4.3 13.4 2.8 24.8 7.6 34.4 14.1 9.5 6.5 17 15.2 22.3 26 5.2 10.7 7.9 24.1 7.9 40 0 17.2-3.9 31.4-11.7 42.9-7.9 11.5-19.3 20.8-34.8 28.1 21.1 6 36.6 16.7 46.8 31.7 10.4 15.2 15.5 33.4 15.5 54.8 0 17.4-3.3 32.3-10 44.8zM790.8 576H612.4c0 19.4 6.7 38 16.8 48 10.2 9.9 24.8 14.9 43.9 14.9 13.8 0 25.5-3.5 35.5-10.4 9.9-6.9 15.9-14.2 18.1-21.8h59.8c-9.6 29.7-24.2 50.9-44 63.7-19.6 12.8-43.6 19.2-71.5 19.2-19.5 0-37-3.2-52.7-9.3-15.1-5.9-28.7-14.9-39.9-26.5a121.2 121.2 0 0 1-25.1-41.2c-6.1-16.9-9.1-34.7-8.9-52.6 0-18.5 3.1-35.7 9.1-51.7 11.5-31.1 35.4-56 65.9-68.9 16.3-6.8 33.8-10.2 51.5-10 21 0 39.2 4 55 12.2a111.6 111.6 0 0 1 38.6 32.8c10.1 13.7 17.2 29.3 21.7 46.9 4.3 17.3 5.8 35.5 4.6 54.7zm-122-95.6c-10.8 0-19.9 1.9-26.9 5.6-7 3.7-12.8 8.3-17.2 13.6a48.4 48.4 0 0 0-9.1 17.4c-1.6 5.3-2.7 10.7-3.1 16.2H723c-1.6-17.3-7.6-30.1-15.6-39.1-8.4-8.9-21.9-13.7-38.6-13.7zm-248.5-10.1c8.7-6.3 12.9-16.7 12.9-31 .3-6.8-1.1-13.5-4.1-19.6-2.7-4.9-6.7-9-11.6-11.9a44.8 44.8 0 0 0-16.6-6c-6.4-1.2-12.9-1.8-19.3-1.7h-70.3v79.7h76.1c13.1.1 24.2-3.1 32.9-9.5zm11.8 72c-9.8-7.5-22.9-11.2-39.2-11.2h-81.8v94h80.2c7.5 0 14.4-.7 21.1-2.1s12.7-3.8 17.8-7.2c5.1-3.3 9.2-7.8 12.3-13.6 3-5.8 4.5-13.2 4.5-22.1 0-17.7-5-30.2-14.9-37.8z')); exports.BuildFill = getIcon('build', fill, getNode(newViewBox, 'M916 210H376c-17.7 0-32 14.3-32 32v236H108c-17.7 0-32 14.3-32 32v272c0 17.7 14.3 32 32 32h540c17.7 0 32-14.3 32-32V546h236c17.7 0 32-14.3 32-32V242c0-17.7-14.3-32-32-32zM612 746H412V546h200v200zm268-268H680V278h200v200z')); exports.BulbFill = getIcon('bulb', fill, getNode(newViewBox, 'M348 676.1C250 619.4 184 513.4 184 392c0-181.1 146.9-328 328-328s328 146.9 328 328c0 121.4-66 227.4-164 284.1V792c0 17.7-14.3 32-32 32H380c-17.7 0-32-14.3-32-32V676.1zM392 888h240c4.4 0 8 3.6 8 8v32c0 17.7-14.3 32-32 32H416c-17.7 0-32-14.3-32-32v-32c0-4.4 3.6-8 8-8z')); exports.CalendarFill = getIcon('calendar', fill, getNode(newViewBox, 'M112 880c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V460H112v420zm768-696H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v176h800V216c0-17.7-14.3-32-32-32z')); exports.BoxPlotFill = getIcon('box-plot', fill, getNode(newViewBox, 'M952 224h-52c-4.4 0-8 3.6-8 8v248h-92V304c0-4.4-3.6-8-8-8H448v432h344c4.4 0 8-3.6 8-8V548h92v244c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V232c0-4.4-3.6-8-8-8zm-728 80v176h-92V232c0-4.4-3.6-8-8-8H72c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V548h92v172c0 4.4 3.6 8 8 8h152V296H232c-4.4 0-8 3.6-8 8z')); exports.CalculatorFill = getIcon('calculator', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM440.2 765h-50.8c-2.2 0-4.5-1.1-5.9-2.9L348 718.6l-35.5 43.5a7.38 7.38 0 0 1-5.9 2.9h-50.8c-6.6 0-10.2-7.9-5.8-13.1l62.7-76.8-61.2-74.9c-4.3-5.2-.7-13.1 5.9-13.1h50.9c2.2 0 4.5 1.1 5.9 2.9l34 41.6 34-41.6c1.5-1.9 3.6-2.9 5.9-2.9h50.8c6.6 0 10.2 7.9 5.9 13.1L383.5 675l62.7 76.8c4.2 5.3.6 13.2-6 13.2zm7.8-382c0 2.2-1.4 4-3.2 4H376v68.7c0 1.9-1.8 3.3-4 3.3h-48c-2.2 0-4-1.4-4-3.2V387h-68.8c-1.8 0-3.2-1.8-3.2-4v-48c0-2.2 1.4-4 3.2-4H320v-68.8c0-1.8 1.8-3.2 4-3.2h48c2.2 0 4 1.4 4 3.2V331h68.7c1.9 0 3.3 1.8 3.3 4v48zm328 369c0 2.2-1.4 4-3.2 4H579.2c-1.8 0-3.2-1.8-3.2-4v-48c0-2.2 1.4-4 3.2-4h193.5c1.9 0 3.3 1.8 3.3 4v48zm0-104c0 2.2-1.4 4-3.2 4H579.2c-1.8 0-3.2-1.8-3.2-4v-48c0-2.2 1.4-4 3.2-4h193.5c1.9 0 3.3 1.8 3.3 4v48zm0-265c0 2.2-1.4 4-3.2 4H579.2c-1.8 0-3.2-1.8-3.2-4v-48c0-2.2 1.4-4 3.2-4h193.5c1.9 0 3.3 1.8 3.3 4v48z')); exports.CarFill = getIcon('car', fill, getNode(newViewBox, 'M959 413.4L935.3 372a8 8 0 0 0-10.9-2.9l-50.7 29.6-78.3-216.2a63.9 63.9 0 0 0-60.9-44.4H301.2c-34.7 0-65.5 22.4-76.2 55.5l-74.6 205.2-50.8-29.6a8 8 0 0 0-10.9 2.9L65 413.4c-2.2 3.8-.9 8.6 2.9 10.8l60.4 35.2-14.5 40c-1.2 3.2-1.8 6.6-1.8 10v348.2c0 15.7 11.8 28.4 26.3 28.4h67.6c12.3 0 23-9.3 25.6-22.3l7.7-37.7h545.6l7.7 37.7c2.7 13 13.3 22.3 25.6 22.3h67.6c14.5 0 26.3-12.7 26.3-28.4V509.4c0-3.4-.6-6.8-1.8-10l-14.5-40 60.3-35.2a8 8 0 0 0 3-10.8zM264 621c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm388 75c0 4.4-3.6 8-8 8H380c-4.4 0-8-3.6-8-8v-84c0-4.4 3.6-8 8-8h40c4.4 0 8 3.6 8 8v36h168v-36c0-4.4 3.6-8 8-8h40c4.4 0 8 3.6 8 8v84zm108-75c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM220 418l72.7-199.9.5-1.3.4-1.3c1.1-3.3 4.1-5.5 7.6-5.5h427.6l75.4 208H220z')); exports.CameraFill = getIcon('camera', fill, getNode(newViewBox, 'M864 260H728l-32.4-90.8a32.07 32.07 0 0 0-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 260H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V340c0-44.2-35.8-80-80-80zM512 716c-88.4 0-160-71.6-160-160s71.6-160 160-160 160 71.6 160 160-71.6 160-160 160zm-96-160a96 96 0 1 0 192 0 96 96 0 1 0-192 0z')); exports.CaretLeftFill = getIcon('caret-left', fill, getNode(normalViewBox, 'M689 165.1L308.2 493.5c-10.9 9.4-10.9 27.5 0 37L689 858.9c14.2 12.2 35 1.2 35-18.5V183.6c0-19.7-20.8-30.7-35-18.5z')); exports.CaretDownFill = getIcon('caret-down', fill, getNode(normalViewBox, 'M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z')); exports.CaretRightFill = getIcon('caret-right', fill, getNode(normalViewBox, 'M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z')); exports.CaretUpFill = getIcon('caret-up', fill, getNode(normalViewBox, 'M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z')); exports.CarryOutFill = getIcon('carry-out', fill, getNode(newViewBox, 'M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zM694.5 432.7L481.9 725.4a16.1 16.1 0 0 1-26 0l-126.4-174c-3.8-5.3 0-12.7 6.5-12.7h55.2c5.1 0 10 2.5 13 6.6l64.7 89 150.9-207.8c3-4.1 7.8-6.6 13-6.6H688c6.5.1 10.3 7.5 6.5 12.8z')); exports.CheckCircleFill = getIcon('check-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z')); exports.CheckSquareFill = getIcon('check-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM695.5 365.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L308.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H689c6.5 0 10.3 7.4 6.5 12.7z')); exports.ChromeFill = getIcon('chrome', fill, getNode(newViewBox, 'M371.8 512c0 77.5 62.7 140.2 140.2 140.2S652.2 589.5 652.2 512 589.5 371.8 512 371.8 371.8 434.4 371.8 512zM900 362.4l-234.3 12.1c63.6 74.3 64.6 181.5 11.1 263.7l-188 289.2c78 4.2 158.4-12.9 231.2-55.2 180-104 253-322.1 180-509.8zM320.3 591.9L163.8 284.1A415.35 415.35 0 0 0 96 512c0 208 152.3 380.3 351.4 410.8l106.9-209.4c-96.6 18.2-189.9-34.8-234-121.5zm218.5-285.5l344.4 18.1C848 254.7 792.6 194 719.8 151.7 653.9 113.6 581.5 95.5 510.5 96c-122.5.5-242.2 55.2-322.1 154.5l128.2 196.9c32-91.9 124.8-146.7 222.2-141z')); exports.CiCircleFill = getIcon('ci-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-63.6 656c-103 0-162.4-68.6-162.4-182.6v-49C286 373.5 345.4 304 448.3 304c88.3 0 152.3 56.9 152.3 138.1 0 2.4-2 4.4-4.4 4.4h-52.6c-4.2 0-7.6-3.2-8-7.4-4-46.1-37.6-77.6-87-77.6-61.1 0-95.6 45.4-95.6 126.9v49.3c0 80.3 34.5 125.1 95.6 125.1 49.3 0 82.8-29.5 87-72.4.4-4.1 3.8-7.3 8-7.3h52.7c2.4 0 4.4 2 4.4 4.4 0 77.4-64.3 132.5-152.3 132.5zM738 704.1c0 4.4-3.6 8-8 8h-50.4c-4.4 0-8-3.6-8-8V319.9c0-4.4 3.6-8 8-8H730c4.4 0 8 3.6 8 8v384.2z')); exports.ClockCircleFill = getIcon('clock-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm176.5 585.7l-28.6 39a7.99 7.99 0 0 1-11.2 1.7L483.3 569.8a7.92 7.92 0 0 1-3.3-6.5V288c0-4.4 3.6-8 8-8h48.1c4.4 0 8 3.6 8 8v247.5l142.6 103.1c3.6 2.5 4.4 7.5 1.8 11.1z')); exports.CloseCircleFill = getIcon('close-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z')); exports.CloseSquareFill = getIcon('close-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM676.1 657.9c4.4 5.2.7 13.1-6.1 13.1h-58.9c-4.7 0-9.2-2.1-12.3-5.7L512 561.8l-86.8 103.5c-3 3.6-7.5 5.7-12.3 5.7H354c-6.8 0-10.5-7.9-6.1-13.1L470.2 512 347.9 366.1A7.95 7.95 0 0 1 354 353h58.9c4.7 0 9.2 2.1 12.3 5.7L512 462.2l86.8-103.5c3-3.6 7.5-5.7 12.3-5.7H670c6.8 0 10.5 7.9 6.1 13.1L553.8 512l122.3 145.9z')); exports.CloudFill = getIcon('cloud', fill, getNode(newViewBox, 'M811.4 418.7C765.6 297.9 648.9 212 512.2 212S258.8 297.8 213 418.6C127.3 441.1 64 519.1 64 612c0 110.5 89.5 200 199.9 200h496.2C870.5 812 960 722.5 960 612c0-92.7-63.1-170.7-148.6-193.3z')); exports.CodeSandboxCircleFill = getIcon('code-sandbox-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm243.7 589.2L512 794 268.3 653.2V371.8l110-63.6-.4-.2h.2L512 231l134 77h-.2l-.3.2 110.1 63.6v281.4zM307.9 536.7l87.6 49.9V681l96.7 55.9V524.8L307.9 418.4zm203.9-151.8L418 331l-91.1 52.6 185.2 107 185.2-106.9-91.4-52.8zm20 352l97.3-56.2v-94.1l87-49.5V418.5L531.8 525z')); exports.CodeSandboxSquareFill = getIcon('code-sandbox-square', fill, getNode(newViewBox, 'M307.9 536.7l87.6 49.9V681l96.7 55.9V524.8L307.9 418.4zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM755.7 653.2L512 794 268.3 653.2V371.8l110-63.6-.4-.2h.2L512 231l134 77h-.2l-.3.2 110.1 63.6v281.4zm-223.9 83.7l97.3-56.2v-94.1l87-49.5V418.5L531.8 525zm-20-352L418 331l-91.1 52.6 185.2 107 185.2-106.9-91.4-52.8z')); exports.CodepenSquareFill = getIcon('codepen-square', fill, getNode(newViewBox, 'M723.1 428L535.9 303.4v111.3l103.6 69.1zM512 456.1l-84.5 56.4 84.5 56.4 84.5-56.4zm23.9 154.2v111.3L723.1 597l-83.6-55.8zm-151.4-69.1L300.9 597l187.2 124.6V610.3l-103.6-69.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-90 485c0 1.1-.1 2.1-.2 3.1 0 .4-.1.7-.2 1a14.16 14.16 0 0 1-.8 3.2c-.2.6-.4 1.2-.6 1.7-.2.4-.4.8-.5 1.2-.3.5-.5 1.1-.8 1.6-.2.4-.4.7-.7 1.1-.3.5-.7 1-1 1.5-.3.4-.5.7-.8 1-.4.4-.8.9-1.2 1.3-.3.3-.6.6-1 .9-.4.4-.9.8-1.4 1.1-.4.3-.7.6-1.1.8-.1.1-.3.2-.4.3L525.2 786c-4 2.7-8.6 4-13.2 4-4.7 0-9.3-1.4-13.3-4L244.6 616.9c-.1-.1-.3-.2-.4-.3l-1.1-.8c-.5-.4-.9-.7-1.3-1.1-.3-.3-.6-.6-1-.9-.4-.4-.8-.8-1.2-1.3a7 7 0 0 1-.8-1c-.4-.5-.7-1-1-1.5-.2-.4-.5-.7-.7-1.1-.3-.5-.6-1.1-.8-1.6-.2-.4-.4-.8-.5-1.2-.2-.6-.4-1.2-.6-1.7-.1-.4-.3-.8-.4-1.2-.2-.7-.3-1.3-.4-2-.1-.3-.1-.7-.2-1-.1-1-.2-2.1-.2-3.1V427.9c0-1 .1-2.1.2-3.1.1-.3.1-.7.2-1a14.16 14.16 0 0 1 .8-3.2c.2-.6.4-1.2.6-1.7.2-.4.4-.8.5-1.2.2-.5.5-1.1.8-1.6.2-.4.4-.7.7-1.1.6-.9 1.2-1.7 1.8-2.5.4-.4.8-.9 1.2-1.3.3-.3.6-.6 1-.9.4-.4.9-.8 1.3-1.1.4-.3.7-.6 1.1-.8.1-.1.3-.2.4-.3L498.7 239c8-5.3 18.5-5.3 26.5 0l254.1 169.1c.1.1.3.2.4.3l1.1.8 1.4 1.1c.3.3.6.6 1 .9.4.4.8.8 1.2 1.3.7.8 1.3 1.6 1.8 2.5.2.4.5.7.7 1.1.3.5.6 1 .8 1.6.2.4.4.8.5 1.2.2.6.4 1.2.6 1.7.1.4.3.8.4 1.2.2.7.3 1.3.4 2 .1.3.1.7.2 1 .1 1 .2 2.1.2 3.1V597zm-47.8-44.6v-79.8l-59.8 39.9zm-460.4-79.8v79.8l59.8-39.9zm206.3-57.9V303.4L300.9 428l83.6 55.8z')); exports.CodeFill = getIcon('code', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM513.1 518.1l-192 161c-5.2 4.4-13.1.7-13.1-6.1v-62.7c0-2.3 1.1-4.6 2.9-6.1L420.7 512l-109.8-92.2a7.63 7.63 0 0 1-2.9-6.1V351c0-6.8 7.9-10.5 13.1-6.1l192 160.9c3.9 3.2 3.9 9.1 0 12.3zM716 673c0 4.4-3.4 8-7.5 8h-185c-4.1 0-7.5-3.6-7.5-8v-48c0-4.4 3.4-8 7.5-8h185c4.1 0 7.5 3.6 7.5 8v48z')); exports.CodepenCircleFill = getIcon('codepen-circle', fill, getNode(newViewBox, 'M488.1 414.7V303.4L300.9 428l83.6 55.8zm254.1 137.7v-79.8l-59.8 39.9zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm278 533c0 1.1-.1 2.1-.2 3.1 0 .4-.1.7-.2 1a14.16 14.16 0 0 1-.8 3.2c-.2.6-.4 1.2-.6 1.7-.2.4-.4.8-.5 1.2-.3.5-.5 1.1-.8 1.6-.2.4-.4.7-.7 1.1-.3.5-.7 1-1 1.5-.3.4-.5.7-.8 1-.4.4-.8.9-1.2 1.3-.3.3-.6.6-1 .9-.4.4-.9.8-1.4 1.1-.4.3-.7.6-1.1.8-.1.1-.3.2-.4.3L525.2 786c-4 2.7-8.6 4-13.2 4-4.7 0-9.3-1.4-13.3-4L244.6 616.9c-.1-.1-.3-.2-.4-.3l-1.1-.8c-.5-.4-.9-.7-1.3-1.1-.3-.3-.6-.6-1-.9-.4-.4-.8-.8-1.2-1.3a7 7 0 0 1-.8-1c-.4-.5-.7-1-1-1.5-.2-.4-.5-.7-.7-1.1-.3-.5-.6-1.1-.8-1.6-.2-.4-.4-.8-.5-1.2-.2-.6-.4-1.2-.6-1.7-.1-.4-.3-.8-.4-1.2-.2-.7-.3-1.3-.4-2-.1-.3-.1-.7-.2-1-.1-1-.2-2.1-.2-3.1V427.9c0-1 .1-2.1.2-3.1.1-.3.1-.7.2-1a14.16 14.16 0 0 1 .8-3.2c.2-.6.4-1.2.6-1.7.2-.4.4-.8.5-1.2.2-.5.5-1.1.8-1.6.2-.4.4-.7.7-1.1.6-.9 1.2-1.7 1.8-2.5.4-.4.8-.9 1.2-1.3.3-.3.6-.6 1-.9.4-.4.9-.8 1.3-1.1.4-.3.7-.6 1.1-.8.1-.1.3-.2.4-.3L498.7 239c8-5.3 18.5-5.3 26.5 0l254.1 169.1c.1.1.3.2.4.3l1.1.8 1.4 1.1c.3.3.6.6 1 .9.4.4.8.8 1.2 1.3.7.8 1.3 1.6 1.8 2.5.2.4.5.7.7 1.1.3.5.6 1 .8 1.6.2.4.4.8.5 1.2.2.6.4 1.2.6 1.7.1.4.3.8.4 1.2.2.7.3 1.3.4 2 .1.3.1.7.2 1 .1 1 .2 2.1.2 3.1V597zm-254.1 13.3v111.3L723.1 597l-83.6-55.8zM281.8 472.6v79.8l59.8-39.9zM512 456.1l-84.5 56.4 84.5 56.4 84.5-56.4zM723.1 428L535.9 303.4v111.3l103.6 69.1zM384.5 541.2L300.9 597l187.2 124.6V610.3l-103.6-69.1z')); exports.CompassFill = getIcon('compass', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zM327.3 702.4c-2 .9-4.4 0-5.3-2.1-.4-1-.4-2.2 0-3.2l98.7-225.5 132.1 132.1-225.5 98.7zm375.1-375.1l-98.7 225.5-132.1-132.1L697.1 322c2-.9 4.4 0 5.3 2.1.4 1 .4 2.1 0 3.2z')); exports.ContactsFill = getIcon('contacts', fill, getNode(newViewBox, 'M928 224H768v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H548v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H328v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H96c-17.7 0-32 14.3-32 32v576c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V256c0-17.7-14.3-32-32-32zM661 736h-43.9c-4.2 0-7.6-3.3-7.9-7.5-3.8-50.6-46-90.5-97.2-90.5s-93.4 40-97.2 90.5c-.3 4.2-3.7 7.5-7.9 7.5H363a8 8 0 0 1-8-8.4c2.8-53.3 32-99.7 74.6-126.1a111.8 111.8 0 0 1-29.1-75.5c0-61.9 49.9-112 111.4-112 61.5 0 111.4 50.1 111.4 112 0 29.1-11 55.5-29.1 75.5 42.7 26.5 71.8 72.8 74.6 126.1.4 4.6-3.2 8.4-7.8 8.4zM512 474c-28.5 0-51.7 23.3-51.7 52s23.2 52 51.7 52c28.5 0 51.7-23.3 51.7-52s-23.2-52-51.7-52z')); exports.ContainerFill = getIcon('container', fill, getNode(newViewBox, 'M832 64H192c-17.7 0-32 14.3-32 32v529c0-.6.4-1 1-1h219.3l5.2 24.7C397.6 708.5 450.8 752 512 752s114.4-43.5 126.4-103.3l5.2-24.7H863c.6 0 1 .4 1 1V96c0-17.7-14.3-32-32-32zM712 493c0 4.4-3.6 8-8 8H320c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h384c4.4 0 8 3.6 8 8v48zm0-160c0 4.4-3.6 8-8 8H320c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h384c4.4 0 8 3.6 8 8v48zm151 354H694.1c-11.6 32.8-32 62.3-59.1 84.7-34.5 28.6-78.2 44.3-123 44.3s-88.5-15.8-123-44.3a194.02 194.02 0 0 1-59.1-84.7H161c-.6 0-1-.4-1-1v242c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V686c0 .6-.4 1-1 1z')); exports.ControlFill = getIcon('control', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM404 683v77c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-77c-41.7-13.6-72-52.8-72-99s30.3-85.5 72-99V264c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v221c41.7 13.6 72 52.8 72 99s-30.3 85.5-72 99zm279.6-143.9c.2 0 .3-.1.4-.1v221c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V539c.2 0 .3.1.4.1-42-13.4-72.4-52.7-72.4-99.1 0-46.4 30.4-85.7 72.4-99.1-.2 0-.3.1-.4.1v-77c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v77c-.2 0-.3-.1-.4-.1 42 13.4 72.4 52.7 72.4 99.1 0 46.4-30.4 85.7-72.4 99.1zM616 440a36 36 0 1 0 72 0 36 36 0 1 0-72 0zM403.4 566.5l-1.5-2.4c0-.1-.1-.1-.1-.2l-.9-1.2c-.1-.1-.2-.2-.2-.3-1-1.3-2-2.5-3.2-3.6l-.2-.2c-.4-.4-.8-.8-1.2-1.1-.8-.8-1.7-1.5-2.6-2.1h-.1l-1.2-.9c-.1-.1-.3-.2-.4-.3-1.2-.8-2.5-1.6-3.9-2.2-.2-.1-.5-.2-.7-.4-.4-.2-.7-.3-1.1-.5-.3-.1-.7-.3-1-.4-.5-.2-1-.4-1.5-.5-.4-.1-.9-.3-1.3-.4l-.9-.3-1.4-.3c-.2-.1-.5-.1-.7-.2-.7-.1-1.4-.3-2.1-.4-.2 0-.4 0-.6-.1-.6-.1-1.1-.1-1.7-.2-.2 0-.4 0-.7-.1-.8 0-1.5-.1-2.3-.1s-1.5 0-2.3.1c-.2 0-.4 0-.7.1-.6 0-1.2.1-1.7.2-.2 0-.4 0-.6.1-.7.1-1.4.2-2.1.4-.2.1-.5.1-.7.2l-1.4.3-.9.3c-.4.1-.9.3-1.3.4-.5.2-1 .4-1.5.5-.3.1-.7.3-1 .4-.4.2-.7.3-1.1.5-.2.1-.5.2-.7.4-1.3.7-2.6 1.4-3.9 2.2-.1.1-.3.2-.4.3l-1.2.9h-.1c-.9.7-1.8 1.4-2.6 2.1-.4.4-.8.7-1.2 1.1l-.2.2a54.8 54.8 0 0 0-3.2 3.6c-.1.1-.2.2-.2.3l-.9 1.2c0 .1-.1.1-.1.2l-1.5 2.4c-.1.2-.2.3-.3.5-2.7 5.1-4.3 10.9-4.3 17s1.6 12 4.3 17c.1.2.2.3.3.5l1.5 2.4c0 .1.1.1.1.2l.9 1.2c.1.1.2.2.2.3 1 1.3 2 2.5 3.2 3.6l.2.2c.4.4.8.8 1.2 1.1.8.8 1.7 1.5 2.6 2.1h.1l1.2.9c.1.1.3.2.4.3 1.2.8 2.5 1.6 3.9 2.2.2.1.5.2.7.4.4.2.7.3 1.1.5.3.1.7.3 1 .4.5.2 1 .4 1.5.5.4.1.9.3 1.3.4l.9.3 1.4.3c.2.1.5.1.7.2.7.1 1.4.3 2.1.4.2 0 .4 0 .6.1.6.1 1.1.1 1.7.2.2 0 .4 0 .7.1.8 0 1.5.1 2.3.1s1.5 0 2.3-.1c.2 0 .4 0 .7-.1.6 0 1.2-.1 1.7-.2.2 0 .4 0 .6-.1.7-.1 1.4-.2 2.1-.4.2-.1.5-.1.7-.2l1.4-.3.9-.3c.4-.1.9-.3 1.3-.4.5-.2 1-.4 1.5-.5.3-.1.7-.3 1-.4.4-.2.7-.3 1.1-.5.2-.1.5-.2.7-.4 1.3-.7 2.6-1.4 3.9-2.2.1-.1.3-.2.4-.3l1.2-.9h.1c.9-.7 1.8-1.4 2.6-2.1.4-.4.8-.7 1.2-1.1l.2-.2c1.1-1.1 2.2-2.4 3.2-3.6.1-.1.2-.2.2-.3l.9-1.2c0-.1.1-.1.1-.2l1.5-2.4c.1-.2.2-.3.3-.5 2.7-5.1 4.3-10.9 4.3-17s-1.6-12-4.3-17c-.1-.2-.2-.4-.3-.5z')); exports.CopyFill = getIcon('copy', fill, getNode(newViewBox, 'M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM382 896h-.2L232 746.2v-.2h150v150z')); exports.CopyrightCircleFill = getIcon('copyright-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm5.4 670c-110 0-173.4-73.2-173.4-194.9v-52.3C344 364.2 407.4 290 517.3 290c94.3 0 162.7 60.7 162.7 147.4 0 2.6-2.1 4.7-4.7 4.7h-56.7c-4.2 0-7.6-3.2-8-7.4-4-49.5-40-83.4-93-83.4-65.3 0-102.1 48.5-102.1 135.5v52.6c0 85.7 36.9 133.6 102.1 133.6 52.8 0 88.7-31.7 93-77.8.4-4.1 3.8-7.3 8-7.3h56.8c2.6 0 4.7 2.1 4.7 4.7 0 82.6-68.7 141.4-162.7 141.4z')); exports.CreditCardFill = getIcon('credit-card', fill, getNode(newViewBox, 'M928 160H96c-17.7 0-32 14.3-32 32v160h896V192c0-17.7-14.3-32-32-32zM64 832c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V440H64v392zm579-184c0-4.4 3.6-8 8-8h165c4.4 0 8 3.6 8 8v72c0 4.4-3.6 8-8 8H651c-4.4 0-8-3.6-8-8v-72z')); exports.CrownFill = getIcon('crown', fill, getNode(newViewBox, 'M899.6 276.5L705 396.4 518.4 147.5a8.06 8.06 0 0 0-12.9 0L319 396.4 124.3 276.5c-5.7-3.5-13.1 1.2-12.2 7.9L188.5 865c1.1 7.9 7.9 14 16 14h615.1c8 0 14.9-6 15.9-14l76.4-580.6c.8-6.7-6.5-11.4-12.3-7.9zM512 734.2c-62.1 0-112.6-50.5-112.6-112.6S449.9 509 512 509s112.6 50.5 112.6 112.6S574.1 734.2 512 734.2zm0-160.9c-26.6 0-48.2 21.6-48.2 48.3 0 26.6 21.6 48.3 48.2 48.3s48.2-21.6 48.2-48.3c0-26.6-21.6-48.3-48.2-48.3z')); exports.DashboardFill = getIcon('dashboard', fill, getNode(newViewBox, 'M924.8 385.6a446.7 446.7 0 0 0-96-142.4 446.7 446.7 0 0 0-142.4-96C631.1 123.8 572.5 112 512 112s-119.1 11.8-174.4 35.2a446.7 446.7 0 0 0-142.4 96 446.7 446.7 0 0 0-96 142.4C75.8 440.9 64 499.5 64 560c0 132.7 58.3 257.7 159.9 343.1l1.7 1.4c5.8 4.8 13.1 7.5 20.6 7.5h531.7c7.5 0 14.8-2.7 20.6-7.5l1.7-1.4C901.7 817.7 960 692.7 960 560c0-60.5-11.9-119.1-35.2-174.4zM482 232c0-4.4 3.6-8 8-8h44c4.4 0 8 3.6 8 8v80c0 4.4-3.6 8-8 8h-44c-4.4 0-8-3.6-8-8v-80zM270 582c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8v-44c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8v44zm90.7-204.5l-31.1 31.1a8.03 8.03 0 0 1-11.3 0L261.7 352a8.03 8.03 0 0 1 0-11.3l31.1-31.1c3.1-3.1 8.2-3.1 11.3 0l56.6 56.6c3.1 3.1 3.1 8.2 0 11.3zm291.1 83.6l-84.5 84.5c5 18.7.2 39.4-14.5 54.1a55.95 55.95 0 0 1-79.2 0 55.95 55.95 0 0 1 0-79.2 55.87 55.87 0 0 1 54.1-14.5l84.5-84.5c3.1-3.1 8.2-3.1 11.3 0l28.3 28.3c3.1 3.1 3.1 8.1 0 11.3zm43-52.4l-31.1-31.1a8.03 8.03 0 0 1 0-11.3l56.6-56.6c3.1-3.1 8.2-3.1 11.3 0l31.1 31.1c3.1 3.1 3.1 8.2 0 11.3l-56.6 56.6a8.03 8.03 0 0 1-11.3 0zM846 582c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8v-44c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8v44z')); exports.CustomerServiceFill = getIcon('customer-service', fill, getNode(newViewBox, 'M512 128c-212.1 0-384 171.9-384 384v360c0 13.3 10.7 24 24 24h184c35.3 0 64-28.7 64-64V624c0-35.3-28.7-64-64-64H200v-48c0-172.3 139.7-312 312-312s312 139.7 312 312v48H688c-35.3 0-64 28.7-64 64v208c0 35.3 28.7 64 64 64h184c13.3 0 24-10.7 24-24V512c0-212.1-171.9-384-384-384z')); exports.DeleteFill = getIcon('delete', fill, getNode(newViewBox, 'M864 256H736v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zm-200 0H360v-72h304v72z')); exports.DatabaseFill = getIcon('database', fill, getNode(newViewBox, 'M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z')); exports.DiffFill = getIcon('diff', fill, getNode(newViewBox, 'M854.2 306.6L611.3 72.9c-6-5.7-13.9-8.9-22.2-8.9H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h277l219 210.6V824c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V329.6c0-8.7-3.5-17-9.8-23zM553.4 201.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v704c0 17.7 14.3 32 32 32h512c17.7 0 32-14.3 32-32V397.3c0-8.5-3.4-16.6-9.4-22.6L553.4 201.4zM568 753c0 3.8-3.4 7-7.5 7h-225c-4.1 0-7.5-3.2-7.5-7v-42c0-3.8 3.4-7 7.5-7h225c4.1 0 7.5 3.2 7.5 7v42zm0-220c0 3.8-3.4 7-7.5 7H476v84.9c0 3.9-3.1 7.1-7 7.1h-42c-3.8 0-7-3.2-7-7.1V540h-84.5c-4.1 0-7.5-3.2-7.5-7v-42c0-3.9 3.4-7 7.5-7H420v-84.9c0-3.9 3.2-7.1 7-7.1h42c3.9 0 7 3.2 7 7.1V484h84.5c4.1 0 7.5 3.1 7.5 7v42z')); exports.DingtalkCircleFill = getIcon('dingtalk-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm227 385.3c-1 4.2-3.5 10.4-7 17.8h.1l-.4.7c-20.3 43.1-73.1 127.7-73.1 127.7s-.1-.2-.3-.5l-15.5 26.8h74.5L575.1 810l32.3-128h-58.6l20.4-84.7c-16.5 3.9-35.9 9.4-59 16.8 0 0-31.2 18.2-89.9-35 0 0-39.6-34.7-16.6-43.4 9.8-3.7 47.4-8.4 77-12.3 40-5.4 64.6-8.2 64.6-8.2S422 517 392.7 512.5c-29.3-4.6-66.4-53.1-74.3-95.8 0 0-12.2-23.4 26.3-12.3 38.5 11.1 197.9 43.2 197.9 43.2s-207.4-63.3-221.2-78.7c-13.8-15.4-40.6-84.2-37.1-126.5 0 0 1.5-10.5 12.4-7.7 0 0 153.3 69.7 258.1 107.9 104.8 37.9 195.9 57.3 184.2 106.7z')); exports.DingtalkSquareFill = getIcon('dingtalk-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM739 449.3c-1 4.2-3.5 10.4-7 17.8h.1l-.4.7c-20.3 43.1-73.1 127.7-73.1 127.7s-.1-.2-.3-.5l-15.5 26.8h74.5L575.1 810l32.3-128h-58.6l20.4-84.7c-16.5 3.9-35.9 9.4-59 16.8 0 0-31.2 18.2-89.9-35 0 0-39.6-34.7-16.6-43.4 9.8-3.7 47.4-8.4 77-12.3 40-5.4 64.6-8.2 64.6-8.2S422 517 392.7 512.5c-29.3-4.6-66.4-53.1-74.3-95.8 0 0-12.2-23.4 26.3-12.3 38.5 11.1 197.9 43.2 197.9 43.2s-207.4-63.3-221.2-78.7c-13.8-15.4-40.6-84.2-37.1-126.5 0 0 1.5-10.5 12.4-7.7 0 0 153.3 69.7 258.1 107.9 104.8 37.9 195.9 57.3 184.2 106.7z')); exports.DislikeFill = getIcon('dislike', fill, getNode(newViewBox, 'M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H273v428h.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM112 132v364c0 17.7 14.3 32 32 32h65V100h-65c-17.7 0-32 14.3-32 32z')); exports.DownCircleFill = getIcon('down-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm184.5 353.7l-178 246a7.95 7.95 0 0 1-12.9 0l-178-246c-3.8-5.3 0-12.7 6.5-12.7H381c10.2 0 19.9 4.9 25.9 13.2L512 563.6l105.2-145.4c6-8.3 15.6-13.2 25.9-13.2H690c6.5 0 10.3 7.4 6.5 12.7z')); exports.DownSquareFill = getIcon('down-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM696.5 412.7l-178 246a7.95 7.95 0 0 1-12.9 0l-178-246c-3.8-5.3 0-12.7 6.5-12.7H381c10.2 0 19.9 4.9 25.9 13.2L512 558.6l105.2-145.4c6-8.3 15.6-13.2 25.9-13.2H690c6.5 0 10.3 7.4 6.5 12.7z')); exports.DollarCircleFill = getIcon('dollar-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm22.3 665.2l.2 31.7c0 4.4-3.6 8.1-8 8.1h-28.4c-4.4 0-8-3.6-8-8v-31.4C401.3 723 359.5 672.4 355 617.4c-.4-4.7 3.3-8.7 8-8.7h46.2c3.9 0 7.3 2.8 7.9 6.6 5.1 31.7 29.8 55.4 74.1 61.3V533.9l-24.7-6.3c-52.3-12.5-102.1-45.1-102.1-112.7 0-72.9 55.4-112.1 126.2-119v-33c0-4.4 3.6-8 8-8h28.1c4.4 0 8 3.6 8 8v32.7c68.5 6.9 119.9 46.9 125.9 109.2.5 4.7-3.2 8.8-8 8.8h-44.9c-4 0-7.4-3-7.9-6.9-4-29.2-27.4-53-65.5-58.2v134.3l25.4 5.9c64.8 16 108.9 47 108.9 116.4 0 75.3-56 117.3-134.3 124.1zM426.6 410.3c0 25.4 15.7 45.1 49.5 57.3 4.7 1.9 9.4 3.4 15 5v-124c-36.9 4.7-64.5 25.4-64.5 61.7zm116.5 135.2c-2.8-.6-5.6-1.3-8.8-2.2V677c42.6-3.8 72-27.2 72-66.4 0-30.7-15.9-50.7-63.2-65.1z')); exports.DribbbleCircleFill = getIcon('dribbble-circle', fill, getNode(newViewBox, 'M675.1 328.3a245.2 245.2 0 0 0-220.8-55.1c6.8 9.1 51.5 69.9 91.8 144 87.5-32.8 124.5-82.6 129-88.9zM554 552.8c-138.7 48.3-188.6 144.6-193 153.6 41.7 32.5 94.1 51.9 151 51.9 34.1 0 66.6-6.9 96.1-19.5-3.7-21.6-17.9-96.8-52.5-186.6l-1.6.6zm47.7-11.9c32.2 88.4 45.3 160.4 47.8 175.4 55.2-37.3 94.5-96.4 105.4-164.9-8.4-2.6-76.1-22.8-153.2-10.5zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 736c-158.8 0-288-129.2-288-288s129.2-288 288-288 288 129.2 288 288-129.2 288-288 288zm53.1-346.2c5.7 11.7 11.2 23.6 16.3 35.6 1.8 4.2 3.6 8.4 5.3 12.7 81.8-10.3 163.2 6.2 171.3 7.9-.5-58.1-21.3-111.4-55.5-153.3-5.3 7.1-46.5 60-137.4 97.1zM498.6 432c-40.8-72.5-84.7-133.4-91.2-142.3-68.8 32.5-120.3 95.9-136.2 172.2 11 .2 112.4.7 227.4-29.9zm30.6 82.5c3.2-1 6.4-2 9.7-2.9-6.2-14-12.9-28-19.9-41.7-122.8 36.8-242.1 35.2-252.8 35-.1 2.5-.1 5-.1 7.5 0 63.2 23.9 120.9 63.2 164.5 5.5-9.6 73-121.4 199.9-162.4z')); exports.DribbbleSquareFill = getIcon('dribbble-square', fill, getNode(newViewBox, 'M498.6 432c-40.8-72.5-84.7-133.4-91.2-142.3-68.8 32.5-120.3 95.9-136.2 172.2 11 .2 112.4.7 227.4-29.9zm66.5 21.8c5.7 11.7 11.2 23.6 16.3 35.6 1.8 4.2 3.6 8.4 5.3 12.7 81.8-10.3 163.2 6.2 171.3 7.9-.5-58.1-21.3-111.4-55.5-153.3-5.3 7.1-46.5 60-137.4 97.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM512 800c-158.8 0-288-129.2-288-288s129.2-288 288-288 288 129.2 288 288-129.2 288-288 288zm89.7-259.1c32.2 88.4 45.3 160.4 47.8 175.4 55.2-37.3 94.5-96.4 105.4-164.9-8.4-2.6-76.1-22.8-153.2-10.5zm-72.5-26.4c3.2-1 6.4-2 9.7-2.9-6.2-14-12.9-28-19.9-41.7-122.8 36.8-242.1 35.2-252.8 35-.1 2.5-.1 5-.1 7.5 0 63.2 23.9 120.9 63.2 164.5 5.5-9.6 73-121.4 199.9-162.4zm145.9-186.2a245.2 245.2 0 0 0-220.8-55.1c6.8 9.1 51.5 69.9 91.8 144 87.5-32.8 124.5-82.6 129-88.9zM554 552.8c-138.7 48.3-188.6 144.6-193 153.6 41.7 32.5 94.1 51.9 151 51.9 34.1 0 66.6-6.9 96.1-19.5-3.7-21.6-17.9-96.8-52.5-186.6l-1.6.6z')); exports.DropboxCircleFill = getIcon('dropbox-circle', fill, getNode(newViewBox, 'M663.8 455.5zm-151.5-93.8l-151.8 93.8 151.8 93.9 151.5-93.9zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm151.2 595.5L512.6 750l-151-90.5v-33.1l45.4 29.4 105.6-87.7 105.6 87.7 45.1-29.4v33.1zm-45.6-22.4l-105.3-87.7L407 637.1l-151-99.2 104.5-82.4L256 371.2 407 274l105.3 87.7L617.6 274 768 372.1l-104.2 83.5L768 539l-150.4 98.1z')); exports.DropboxSquareFill = getIcon('dropbox-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM663.2 659.5L512.6 750l-151-90.5v-33.1l45.4 29.4 105.6-87.7 105.6 87.7 45.1-29.4v33.1zm-45.6-22.4l-105.3-87.7L407 637.1l-151-99.2 104.5-82.4L256 371.2 407 274l105.3 87.7L617.6 274 768 372.1l-104.2 83.5L768 539l-150.4 98.1zM512.3 361.7l-151.8 93.8 151.8 93.9 151.5-93.9zm151.5 93.8z')); exports.EditFill = getIcon('edit', fill, getNode(newViewBox, 'M880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32zm-622.3-84c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 0 0 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 0 0 9.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9z')); exports.EnvironmentFill = getIcon('environment', fill, getNode(newViewBox, 'M512 327c-29.9 0-58 11.6-79.2 32.8A111.6 111.6 0 0 0 400 439c0 29.9 11.7 58 32.8 79.2A111.6 111.6 0 0 0 512 551c29.9 0 58-11.7 79.2-32.8C612.4 497 624 468.9 624 439c0-29.9-11.6-58-32.8-79.2S541.9 327 512 327zm342.6-37.9a362.49 362.49 0 0 0-79.9-115.7 370.83 370.83 0 0 0-118.2-77.8C610.7 76.6 562.1 67 512 67c-50.1 0-98.7 9.6-144.5 28.5-44.3 18.3-84 44.5-118.2 77.8A363.6 363.6 0 0 0 169.4 289c-19.5 45-29.4 92.8-29.4 142 0 70.6 16.9 140.9 50.1 208.7 26.7 54.5 64 107.6 111 158.1 80.3 86.2 164.5 138.9 188.4 153a43.9 43.9 0 0 0 22.4 6.1c7.8 0 15.5-2 22.4-6.1 23.9-14.1 108.1-66.8 188.4-153 47-50.4 84.3-103.6 111-158.1C867.1 572 884 501.8 884 431.1c0-49.2-9.9-97-29.4-142zM512 615c-97.2 0-176-78.8-176-176s78.8-176 176-176 176 78.8 176 176-78.8 176-176 176z')); exports.EuroCircleFill = getIcon('euro-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm63.5 375.8c4.4 0 8 3.6 8 8V475c0 4.4-3.6 8-8 8h-136c-.3 4.4-.3 9.1-.3 13.8v36h136.2c4.4 0 8 3.6 8 8V568c0 4.4-3.6 8-8 8H444.9c15.3 62 61.3 98.6 129.8 98.6 19.9 0 37.1-1.2 51.8-4.1 4.9-1 9.5 2.8 9.5 7.8v42.8c0 3.8-2.7 7-6.4 7.8-15.9 3.4-34.3 5.1-55.3 5.1-109.8 0-183-58.8-200.2-158H344c-4.4 0-8-3.6-8-8v-27.2c0-4.4 3.6-8 8-8h26.1v-36.9c0-4.4 0-8.8.3-12.8H344c-4.4 0-8-3.6-8-8v-27.2c0-4.4 3.6-8 8-8h31.7c19.7-94.2 92-149.9 198.6-149.9 20.9 0 39.4 1.9 55.3 5.4 3.7.8 6.3 4 6.3 7.8V346h.1c0 5.1-4.6 8.8-9.6 7.8-14.7-2.9-31.8-4.4-51.7-4.4-65.4 0-110.4 33.5-127.6 90.4h128.4z')); exports.ExclamationCircleFill = getIcon('exclamation-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z')); exports.EyeInvisibleFill = getIcon('eye-invisible', fill, getNode(newViewBox, 'M508 624a112 112 0 0 0 112-112c0-3.28-.15-6.53-.43-9.74L498.26 623.57c3.21.28 6.45.43 9.74.43zm370.72-458.44L836 122.88a8 8 0 0 0-11.31 0L715.37 232.23Q624.91 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 0 0 0 51.5q56.7 119.43 136.55 191.45L112.56 835a8 8 0 0 0 0 11.31L155.25 889a8 8 0 0 0 11.31 0l712.16-712.12a8 8 0 0 0 0-11.32zM332 512a176 176 0 0 1 258.88-155.28l-48.62 48.62a112.08 112.08 0 0 0-140.92 140.92l-48.62 48.62A175.09 175.09 0 0 1 332 512z', 'M942.2 486.2Q889.4 375 816.51 304.85L672.37 449A176.08 176.08 0 0 1 445 676.37L322.74 798.63Q407.82 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 0 0 0-51.5z')); exports.ExperimentFill = getIcon('experiment', fill, getNode(newViewBox, 'M218.9 636.3l42.6 26.6c.1.1.3.2.4.3l12.7 8 .3.3a186.9 186.9 0 0 0 94.1 25.1c44.9 0 87.2-15.7 121-43.8a256.27 256.27 0 0 1 164.9-59.9c52.3 0 102.2 15.7 144.6 44.5l7.9 5-111.6-289V179.8h63.5c4.4 0 8-3.6 8-8V120c0-4.4-3.6-8-8-8H264.7c-4.4 0-8 3.6-8 8v51.9c0 4.4 3.6 8 8 8h63.5v173.6L218.9 636.3zm333-203.1c22 0 39.9 17.9 39.9 39.9S573.9 513 551.9 513 512 495.1 512 473.1s17.9-39.9 39.9-39.9zM878 825.1l-29.9-77.4-85.7-53.5-.1.1c-.7-.5-1.5-1-2.2-1.5l-8.1-5-.3-.3c-29-17.5-62.3-26.8-97-26.8-44.9 0-87.2 15.7-121 43.8a256.27 256.27 0 0 1-164.9 59.9c-53 0-103.5-16.1-146.2-45.6l-28.9-18.1L146 825.1c-2.8 7.4-4.3 15.2-4.3 23 0 35.2 28.6 63.8 63.8 63.8h612.9c7.9 0 15.7-1.5 23-4.3a63.6 63.6 0 0 0 36.6-82.5z')); exports.EyeFill = getIcon('eye', fill, getNode(newViewBox, 'M396 512a112 112 0 1 0 224 0 112 112 0 1 0-224 0zm546.2-25.8C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM508 688c-97.2 0-176-78.8-176-176s78.8-176 176-176 176 78.8 176 176-78.8 176-176 176z')); exports.FacebookFill = getIcon('facebook', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-92.4 233.5h-63.9c-50.1 0-59.8 23.8-59.8 58.8v77.1h119.6l-15.6 120.7h-104V912H539.2V602.2H434.9V481.4h104.3v-89c0-103.3 63.1-159.6 155.3-159.6 44.2 0 82.1 3.3 93.2 4.8v107.9z')); exports.FastBackwardFill = getIcon('fast-backward', fill, getNode(normalViewBox, 'M517.6 273.5L230.2 499.3a16.14 16.14 0 0 0 0 25.4l287.4 225.8c10.7 8.4 26.4.8 26.4-12.7V286.2c0-13.5-15.7-21.1-26.4-12.7zm320 0L550.2 499.3a16.14 16.14 0 0 0 0 25.4l287.4 225.8c10.7 8.4 26.4.8 26.4-12.7V286.2c0-13.5-15.7-21.1-26.4-12.7zm-620-25.5h-51.2c-3.5 0-6.4 2.7-6.4 6v516c0 3.3 2.9 6 6.4 6h51.2c3.5 0 6.4-2.7 6.4-6V254c0-3.3-2.9-6-6.4-6z')); exports.FileAddFill = getIcon('file-add', fill, getNode(newViewBox, 'M480 580H372a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h108v108a8 8 0 0 0 8 8h48a8 8 0 0 0 8-8V644h108a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8H544V472a8 8 0 0 0-8-8h-48a8 8 0 0 0-8 8v108zm374.6-291.3c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2z')); exports.FastForwardFill = getIcon('fast-forward', fill, getNode(normalViewBox, 'M793.8 499.3L506.4 273.5c-10.7-8.4-26.4-.8-26.4 12.7v451.6c0 13.5 15.7 21.1 26.4 12.7l287.4-225.8a16.14 16.14 0 0 0 0-25.4zm-320 0L186.4 273.5c-10.7-8.4-26.4-.8-26.4 12.7v451.5c0 13.5 15.7 21.1 26.4 12.7l287.4-225.8c4.1-3.2 6.2-8 6.2-12.7 0-4.6-2.1-9.4-6.2-12.6zM857.6 248h-51.2c-3.5 0-6.4 2.7-6.4 6v516c0 3.3 2.9 6 6.4 6h51.2c3.5 0 6.4-2.7 6.4-6V254c0-3.3-2.9-6-6.4-6z')); exports.FileExcelFill = getIcon('file-excel', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM575.34 477.84l-61.22 102.3L452.3 477.8a12 12 0 0 0-10.27-5.79h-38.44a12 12 0 0 0-6.4 1.85 12 12 0 0 0-3.75 16.56l82.34 130.42-83.45 132.78a12 12 0 0 0-1.84 6.39 12 12 0 0 0 12 12h34.46a12 12 0 0 0 10.21-5.7l62.7-101.47 62.3 101.45a12 12 0 0 0 10.23 5.72h37.48a12 12 0 0 0 6.48-1.9 12 12 0 0 0 3.62-16.58l-83.83-130.55 85.3-132.47a12 12 0 0 0 1.9-6.5 12 12 0 0 0-12-12h-35.7a12 12 0 0 0-10.29 5.84z')); exports.FileImageFill = getIcon('file-image', fill, getNode(newViewBox, 'M854.6 288.7L639.4 73.4c-6-6-14.2-9.4-22.7-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.6-9.4-22.6zM400 402c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zm296 294H328c-6.7 0-10.4-7.7-6.3-12.9l99.8-127.2a8 8 0 0 1 12.6 0l41.1 52.4 77.8-99.2a8 8 0 0 1 12.6 0l136.5 174c4.3 5.2.5 12.9-6.1 12.9zm-94-370V137.8L790.2 326H602z')); exports.FileExclamationFill = getIcon('file-exclamation', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM512 784a40 40 0 1 0 0-80 40 40 0 0 0 0 80zm32-152V448a8 8 0 0 0-8-8h-48a8 8 0 0 0-8 8v184a8 8 0 0 0 8 8h48a8 8 0 0 0 8-8z')); exports.FileMarkdownFill = getIcon('file-markdown', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM426.13 600.93l59.11 132.97a16 16 0 0 0 14.62 9.5h24.06a16 16 0 0 0 14.63-9.51l59.1-133.35V758a16 16 0 0 0 16.01 16H641a16 16 0 0 0 16-16V486a16 16 0 0 0-16-16h-34.75a16 16 0 0 0-14.67 9.62L512.1 662.2l-79.48-182.59a16 16 0 0 0-14.67-9.61H383a16 16 0 0 0-16 16v272a16 16 0 0 0 16 16h27.13a16 16 0 0 0 16-16V600.93z')); exports.FilePdfFill = getIcon('file-pdf', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM633.22 637.26c-15.18-.5-31.32.67-49.65 2.96-24.3-14.99-40.66-35.58-52.28-65.83l1.07-4.38 1.24-5.18c4.3-18.13 6.61-31.36 7.3-44.7.52-10.07-.04-19.36-1.83-27.97-3.3-18.59-16.45-29.46-33.02-30.13-15.45-.63-29.65 8-33.28 21.37-5.91 21.62-2.45 50.07 10.08 98.59-15.96 38.05-37.05 82.66-51.2 107.54-18.89 9.74-33.6 18.6-45.96 28.42-16.3 12.97-26.48 26.3-29.28 40.3-1.36 6.49.69 14.97 5.36 21.92 5.3 7.88 13.28 13 22.85 13.74 24.15 1.87 53.83-23.03 86.6-79.26 3.29-1.1 6.77-2.26 11.02-3.7l11.9-4.02c7.53-2.54 12.99-4.36 18.39-6.11 23.4-7.62 41.1-12.43 57.2-15.17 27.98 14.98 60.32 24.8 82.1 24.8 17.98 0 30.13-9.32 34.52-23.99 3.85-12.88.8-27.82-7.48-36.08-8.56-8.41-24.3-12.43-45.65-13.12zM385.23 765.68v-.36l.13-.34a54.86 54.86 0 0 1 5.6-10.76c4.28-6.58 10.17-13.5 17.47-20.87 3.92-3.95 8-7.8 12.79-12.12 1.07-.96 7.91-7.05 9.19-8.25l11.17-10.4-8.12 12.93c-12.32 19.64-23.46 33.78-33 43-3.51 3.4-6.6 5.9-9.1 7.51a16.43 16.43 0 0 1-2.61 1.42c-.41.17-.77.27-1.13.3a2.2 2.2 0 0 1-1.12-.15 2.07 2.07 0 0 1-1.27-1.91zM511.17 547.4l-2.26 4-1.4-4.38c-3.1-9.83-5.38-24.64-6.01-38-.72-15.2.49-24.32 5.29-24.32 6.74 0 9.83 10.8 10.07 27.05.22 14.28-2.03 29.14-5.7 35.65zm-5.81 58.46l1.53-4.05 2.09 3.8c11.69 21.24 26.86 38.96 43.54 51.31l3.6 2.66-4.39.9c-16.33 3.38-31.54 8.46-52.34 16.85 2.17-.88-21.62 8.86-27.64 11.17l-5.25 2.01 2.8-4.88c12.35-21.5 23.76-47.32 36.05-79.77zm157.62 76.26c-7.86 3.1-24.78.33-54.57-12.39l-7.56-3.22 8.2-.6c23.3-1.73 39.8-.45 49.42 3.07 4.1 1.5 6.83 3.39 8.04 5.55a4.64 4.64 0 0 1-1.36 6.31 6.7 6.7 0 0 1-2.17 1.28z')); exports.FileWordFill = getIcon('file-word', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM512 566.1l52.81 197a12 12 0 0 0 11.6 8.9h31.77a12 12 0 0 0 11.6-8.88l74.37-276a12 12 0 0 0 .4-3.12 12 12 0 0 0-12-12h-35.57a12 12 0 0 0-11.7 9.31l-45.78 199.1-49.76-199.32A12 12 0 0 0 528.1 472h-32.2a12 12 0 0 0-11.64 9.1L434.6 680.01 388.5 481.3a12 12 0 0 0-11.68-9.29h-35.39a12 12 0 0 0-3.11.41 12 12 0 0 0-8.47 14.7l74.17 276A12 12 0 0 0 415.6 772h31.99a12 12 0 0 0 11.59-8.9l52.81-197z')); exports.FileUnknownFill = getIcon('file-unknown', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM402 549c0 5.4 4.4 9.5 9.8 9.5h32.4c5.4 0 9.8-4.2 9.8-9.4 0-28.2 25.8-51.6 58-51.6s58 23.4 58 51.5c0 25.3-21 47.2-49.3 50.9-19.3 2.8-34.5 20.3-34.7 40.1v32c0 5.5 4.5 10 10 10h32c5.5 0 10-4.5 10-10v-12.2c0-6 4-11.5 9.7-13.3 44.6-14.4 75-54 74.3-98.9-.8-55.5-49.2-100.8-108.5-101.6-61.4-.7-111.5 45.6-111.5 103zm110 227a32 32 0 1 0 0-64 32 32 0 0 0 0 64z')); exports.FilePptFill = getIcon('file-ppt', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM468.53 760v-91.54h59.27c60.57 0 100.2-39.65 100.2-98.12 0-58.22-39.58-98.34-99.98-98.34H424a12 12 0 0 0-12 12v276a12 12 0 0 0 12 12h32.53a12 12 0 0 0 12-12zm0-139.33h34.9c47.82 0 67.19-12.93 67.19-50.33 0-32.05-18.12-50.12-49.87-50.12h-52.22v100.45z')); exports.FileZipFill = getIcon('file-zip', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM296 136v64h64v-64h-64zm64 64v64h64v-64h-64zm-64 64v64h64v-64h-64zm64 64v64h64v-64h-64zm-64 64v64h64v-64h-64zm64 64v64h64v-64h-64zm-64 64v64h64v-64h-64zm0 64v160h128V584H296zm48 48h32v64h-32v-64z')); exports.FileTextFill = getIcon('file-text', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM320 482a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h384a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8H320zm0 136a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h184a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8H320z')); exports.FilterFill = getIcon('filter', fill, getNode(newViewBox, 'M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z')); exports.FileFill = getIcon('file', fill, getNode(newViewBox, 'M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2z')); exports.FireFill = getIcon('fire', fill, getNode(newViewBox, 'M834.1 469.2A347.49 347.49 0 0 0 751.2 354l-29.1-26.7a8.09 8.09 0 0 0-13 3.3l-13 37.3c-8.1 23.4-23 47.3-44.1 70.8-1.4 1.5-3 1.9-4.1 2-1.1.1-2.8-.1-4.3-1.5-1.4-1.2-2.1-3-2-4.8 3.7-60.2-14.3-128.1-53.7-202C555.3 171 510 123.1 453.4 89.7l-41.3-24.3c-5.4-3.2-12.3 1-12 7.3l2.2 48c1.5 32.8-2.3 61.8-11.3 85.9-11 29.5-26.8 56.9-47 81.5a295.64 295.64 0 0 1-47.5 46.1 352.6 352.6 0 0 0-100.3 121.5A347.75 347.75 0 0 0 160 610c0 47.2 9.3 92.9 27.7 136a349.4 349.4 0 0 0 75.5 110.9c32.4 32 70 57.2 111.9 74.7C418.5 949.8 464.5 959 512 959s93.5-9.2 136.9-27.3A348.6 348.6 0 0 0 760.8 857c32.4-32 57.8-69.4 75.5-110.9a344.2 344.2 0 0 0 27.7-136c0-48.8-10-96.2-29.9-140.9z')); exports.FlagFill = getIcon('flag', fill, getNode(newViewBox, 'M880 305H624V192c0-17.7-14.3-32-32-32H184v-40c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v784c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V640h248v113c0 17.7 14.3 32 32 32h416c17.7 0 32-14.3 32-32V337c0-17.7-14.3-32-32-32z')); exports.FolderFill = getIcon('folder', fill, getNode(newViewBox, 'M880 298.4H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32z')); exports.FolderOpenFill = getIcon('folder-open', fill, getNode(newViewBox, 'M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 0 0-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zm-180 0H238c-13 0-24.8 7.9-29.7 20L136 643.2V256h188.5l119.6 114.4H748V444z')); exports.ForwardFill = getIcon('forward', fill, getNode(normalViewBox, 'M825.8 498L538.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L825.8 526c8.3-7.2 8.3-20.8 0-28zm-320 0L218.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L505.8 526c4.1-3.6 6.2-8.8 6.2-14 0-5.2-2.1-10.4-6.2-14z')); exports.FolderAddFill = getIcon('folder-add', fill, getNode(newViewBox, 'M880 298.4H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM632 577c0 3.8-3.4 7-7.5 7H540v84.9c0 3.9-3.2 7.1-7 7.1h-42c-3.8 0-7-3.2-7-7.1V584h-84.5c-4.1 0-7.5-3.2-7.5-7v-42c0-3.8 3.4-7 7.5-7H484v-84.9c0-3.9 3.2-7.1 7-7.1h42c3.8 0 7 3.2 7 7.1V528h84.5c4.1 0 7.5 3.2 7.5 7v42z')); exports.FundFill = getIcon('fund', fill, getNode(newViewBox, 'M926 164H94c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V196c0-17.7-14.3-32-32-32zm-92.3 194.4l-297 297.2a8.03 8.03 0 0 1-11.3 0L410.9 541.1 238.4 713.7a8.03 8.03 0 0 1-11.3 0l-36.8-36.8a8.03 8.03 0 0 1 0-11.3l214.9-215c3.1-3.1 8.2-3.1 11.3 0L531 565l254.5-254.6c3.1-3.1 8.2-3.1 11.3 0l36.8 36.8c3.2 3 3.2 8.1.1 11.2z')); exports.FrownFill = getIcon('frown', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zM288 421a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm376 272h-48.1c-4.2 0-7.8-3.2-8.1-7.4C604 636.1 562.5 597 512 597s-92.1 39.1-95.8 88.6c-.3 4.2-3.9 7.4-8.1 7.4H360a8 8 0 0 1-8-8.4c4.4-84.3 74.5-151.6 160-151.6s155.6 67.3 160 151.6a8 8 0 0 1-8 8.4zm24-224a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z')); exports.FunnelPlotFill = getIcon('funnel-plot', fill, getNode(newViewBox, 'M336.7 586h350.6l84.9-148H251.8zm543.4-432H143.9c-24.5 0-39.8 26.7-27.5 48L215 374h594l98.7-172c12.2-21.3-3.1-48-27.6-48zM349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V650H349v188z')); exports.GiftFill = getIcon('gift', fill, getNode(newViewBox, 'M160 894c0 17.7 14.3 32 32 32h286V550H160v344zm386 32h286c17.7 0 32-14.3 32-32V550H546v376zm334-616H732.4c13.6-21.4 21.6-46.8 21.6-74 0-76.1-61.9-138-138-138-41.4 0-78.7 18.4-104 47.4-25.3-29-62.6-47.4-104-47.4-76.1 0-138 61.9-138 138 0 27.2 7.9 52.6 21.6 74H144c-17.7 0-32 14.3-32 32v140h366V310h68v172h366V342c0-17.7-14.3-32-32-32zm-402-4h-70c-38.6 0-70-31.4-70-70s31.4-70 70-70 70 31.4 70 70v70zm138 0h-70v-70c0-38.6 31.4-70 70-70s70 31.4 70 70-31.4 70-70 70z')); exports.GithubFill = getIcon('github', fill, getNode(newViewBox, 'M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z')); exports.GitlabFill = getIcon('gitlab', fill, getNode(newViewBox, 'M910.5 553.2l-109-370.8c-6.8-20.4-23.1-34.1-44.9-34.1s-39.5 12.3-46.3 32.7l-72.2 215.4H386.2L314 181.1c-6.8-20.4-24.5-32.7-46.3-32.7s-39.5 13.6-44.9 34.1L113.9 553.2c-4.1 13.6 1.4 28.6 12.3 36.8l385.4 289 386.7-289c10.8-8.1 16.3-23.1 12.2-36.8z')); exports.GooglePlusCircleFill = getIcon('google-plus-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm36.5 558.8c-43.9 61.8-132.1 79.8-200.9 53.3-69-26.3-118-99.2-112.1-173.5 1.5-90.9 85.2-170.6 176.1-167.5 43.6-2 84.6 16.9 118 43.6-14.3 16.2-29 31.8-44.8 46.3-40.1-27.7-97.2-35.6-137.3-3.6-57.4 39.7-60 133.4-4.8 176.1 53.7 48.7 155.2 24.5 170.1-50.1-33.6-.5-67.4 0-101-1.1-.1-20.1-.2-40.1-.1-60.2 56.2-.2 112.5-.3 168.8.2 3.3 47.3-3 97.5-32 136.5zM791 536.5c-16.8.2-33.6.3-50.4.4-.2 16.8-.3 33.6-.3 50.4H690c-.2-16.8-.2-33.5-.3-50.3-16.8-.2-33.6-.3-50.4-.5v-50.1c16.8-.2 33.6-.3 50.4-.3.1-16.8.3-33.6.4-50.4h50.2l.3 50.4c16.8.2 33.6.2 50.4.3v50.1z')); exports.GoldenFill = getIcon('golden', fill, getNode(newViewBox, 'M905.9 806.7l-40.2-248c-.6-3.9-4-6.7-7.9-6.7H596.2c-3.9 0-7.3 2.8-7.9 6.7l-40.2 248c-.1.4-.1.9-.1 1.3 0 4.4 3.6 8 8 8h342c.4 0 .9 0 1.3-.1 4.3-.7 7.3-4.8 6.6-9.2zm-470.2-248c-.6-3.9-4-6.7-7.9-6.7H166.2c-3.9 0-7.3 2.8-7.9 6.7l-40.2 248c-.1.4-.1.9-.1 1.3 0 4.4 3.6 8 8 8h342c.4 0 .9 0 1.3-.1 4.4-.7 7.3-4.8 6.6-9.2l-40.2-248zM342 472h342c.4 0 .9 0 1.3-.1 4.4-.7 7.3-4.8 6.6-9.2l-40.2-248c-.6-3.9-4-6.7-7.9-6.7H382.2c-3.9 0-7.3 2.8-7.9 6.7l-40.2 248c-.1.4-.1.9-.1 1.3 0 4.4 3.6 8 8 8z')); exports.GoogleCircleFill = getIcon('google-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm167 633.6C638.4 735 583 757 516.9 757c-95.7 0-178.5-54.9-218.8-134.9C281.5 589 272 551.6 272 512s9.5-77 26.1-110.1c40.3-80.1 123.1-135 218.8-135 66 0 121.4 24.3 163.9 63.8L610.6 401c-25.4-24.3-57.7-36.6-93.6-36.6-63.8 0-117.8 43.1-137.1 101-4.9 14.7-7.7 30.4-7.7 46.6s2.8 31.9 7.7 46.6c19.3 57.9 73.3 101 137 101 33 0 61-8.7 82.9-23.4 26-17.4 43.2-43.3 48.9-74H516.9v-94.8h230.7c2.9 16.1 4.4 32.8 4.4 50.1 0 74.7-26.7 137.4-73 180.1z')); exports.GoogleSquareFill = getIcon('google-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM679 697.6C638.4 735 583 757 516.9 757c-95.7 0-178.5-54.9-218.8-134.9A245.02 245.02 0 0 1 272 512c0-39.6 9.5-77 26.1-110.1 40.3-80.1 123.1-135 218.8-135 66 0 121.4 24.3 163.9 63.8L610.6 401c-25.4-24.3-57.7-36.6-93.6-36.6-63.8 0-117.8 43.1-137.1 101-4.9 14.7-7.7 30.4-7.7 46.6s2.8 31.9 7.7 46.6c19.3 57.9 73.3 101 137 101 33 0 61-8.7 82.9-23.4 26-17.4 43.2-43.3 48.9-74H516.9v-94.8h230.7c2.9 16.1 4.4 32.8 4.4 50.1 0 74.7-26.7 137.4-73 180.1z')); exports.GooglePlusSquareFill = getIcon('google-plus-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM548.5 622.8c-43.9 61.8-132.1 79.8-200.9 53.3-69-26.3-118-99.2-112.1-173.5 1.5-90.9 85.2-170.6 176.1-167.5 43.6-2 84.6 16.9 118 43.6-14.3 16.2-29 31.8-44.8 46.3-40.1-27.7-97.2-35.6-137.3-3.6-57.4 39.7-60 133.4-4.8 176.1 53.7 48.7 155.2 24.5 170.1-50.1-33.6-.5-67.4 0-101-1.1-.1-20.1-.2-40.1-.1-60.2 56.2-.2 112.5-.3 168.8.2 3.3 47.3-3 97.5-32 136.5zM791 536.5c-16.8.2-33.6.3-50.4.4-.2 16.8-.3 33.6-.3 50.4H690c-.2-16.8-.2-33.5-.3-50.3-16.8-.2-33.6-.3-50.4-.5v-50.1c16.8-.2 33.6-.3 50.4-.3.1-16.8.3-33.6.4-50.4h50.2l.3 50.4c16.8.2 33.6.2 50.4.3v50.1z')); exports.HighlightFill = getIcon('highlight', fill, getNode(newViewBox, 'M957.6 507.4L603.2 158.2a7.9 7.9 0 0 0-11.2 0L353.3 393.4a8.03 8.03 0 0 0-.1 11.3l.1.1 40 39.4-117.2 115.3a8.03 8.03 0 0 0-.1 11.3l.1.1 39.5 38.9-189.1 187H72.1c-4.4 0-8.1 3.6-8.1 8V860c0 4.4 3.6 8 8 8h344.9c2.1 0 4.1-.8 5.6-2.3l76.1-75.6 40.4 39.8a7.9 7.9 0 0 0 11.2 0l117.1-115.6 40.1 39.5a7.9 7.9 0 0 0 11.2 0l238.7-235.2c3.4-3 3.4-8 .3-11.2z')); exports.HddFill = getIcon('hdd', fill, getNode(newViewBox, 'M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM456 216c0 4.4-3.6 8-8 8H264c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm576-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm96-152c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H264c-4.4 0-8-3.6-8-8v-48z')); exports.HeartFill = getIcon('heart', fill, getNode(newViewBox, 'M923 283.6a260.04 260.04 0 0 0-56.9-82.8 264.4 264.4 0 0 0-84-55.5A265.34 265.34 0 0 0 679.7 125c-49.3 0-97.4 13.5-139.2 39-10 6.1-19.5 12.8-28.5 20.1-9-7.3-18.5-14-28.5-20.1-41.8-25.5-89.9-39-139.2-39-35.5 0-69.9 6.8-102.4 20.3-31.4 13-59.7 31.7-84 55.5a258.44 258.44 0 0 0-56.9 82.8c-13.9 32.3-21 66.6-21 101.9 0 33.3 6.8 68 20.3 103.3 11.3 29.5 27.5 60.1 48.2 91 32.8 48.9 77.9 99.9 133.9 151.6 92.8 85.7 184.7 144.9 188.6 147.3l23.7 15.2c10.5 6.7 24 6.7 34.5 0l23.7-15.2c3.9-2.5 95.7-61.6 188.6-147.3 56-51.7 101.1-102.7 133.9-151.6 20.7-30.9 37-61.5 48.2-91 13.5-35.3 20.3-70 20.3-103.3.1-35.3-7-69.6-20.9-101.9z')); exports.HomeFill = getIcon('home', fill, getNode(newViewBox, 'M946.5 505L534.6 93.4a31.93 31.93 0 0 0-45.2 0L77.5 505c-12 12-18.8 28.3-18.8 45.3 0 35.3 28.7 64 64 64h43.4V908c0 17.7 14.3 32 32 32H448V716h112v224h265.9c17.7 0 32-14.3 32-32V614.3h43.4c17 0 33.3-6.7 45.3-18.8 24.9-25 24.9-65.5-.1-90.5z')); exports.Html5Fill = getIcon('html5', fill, getNode(newViewBox, 'M145.2 96l66 746.6L512 928l299.6-85.4L878.9 96H145.2zm595 177.1l-4.8 47.2-1.7 19.5H382.3l8.2 94.2h335.1l-3.3 24.3-21.2 242.2-1.7 16.2-187 51.6v.3h-1.2l-.3.1v-.1h-.1l-188.6-52L310.8 572h91.1l6.5 73.2 102.4 27.7h.4l102-27.6 11.4-118.6H510.9v-.1H306l-22.8-253.5-1.7-24.3h460.3l-1.6 24.3z')); exports.IeCircleFill = getIcon('ie-circle', fill, getNode(newViewBox, 'M693.6 284.4c-24 0-51.1 11.7-72.6 22 46.3 18 86 57.3 112.3 99.6 7.1-18.9 14.6-47.9 14.6-67.9 0-32-22.8-53.7-54.3-53.7zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm253.9 492.9H437.1c0 100.4 144.3 136 196.8 47.4h120.8c-32.6 91.7-119.7 146-216.8 146-35.1 0-70.3-.1-101.7-15.6-87.4 44.5-180.3 56.6-180.3-42 0-45.8 23.2-107.1 44-145C335 484 381.3 422.8 435.6 374.5c-43.7 18.9-91.1 66.3-122 101.2 25.9-112.8 129.5-193.6 237.1-186.5 130-59.8 209.7-34.1 209.7 38.6 0 27.4-10.6 63.3-21.4 87.9 25.2 45.5 33.3 97.6 26.9 141.2zM540.5 399.1c-53.7 0-102 39.7-104 94.9h208c-2-55.1-50.6-94.9-104-94.9zM320.6 602.9c-73 152.4 11.5 172.2 100.3 123.3-46.6-27.5-82.6-72.2-100.3-123.3z')); exports.IdcardFill = getIcon('idcard', fill, getNode(newViewBox, 'M373 411c-28.5 0-51.7 23.3-51.7 52s23.2 52 51.7 52 51.7-23.3 51.7-52-23.2-52-51.7-52zm555-251H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zM608 420c0-4.4 1-8 2.3-8h123.4c1.3 0 2.3 3.6 2.3 8v48c0 4.4-1 8-2.3 8H610.3c-1.3 0-2.3-3.6-2.3-8v-48zm-86 253h-43.9c-4.2 0-7.6-3.3-7.9-7.5-3.8-50.5-46-90.5-97.2-90.5s-93.4 40-97.2 90.5c-.3 4.2-3.7 7.5-7.9 7.5H224a8 8 0 0 1-8-8.4c2.8-53.3 32-99.7 74.6-126.1a111.8 111.8 0 0 1-29.1-75.5c0-61.9 49.9-112 111.4-112s111.4 50.1 111.4 112c0 29.1-11 55.5-29.1 75.5 42.7 26.5 71.8 72.8 74.6 126.1.4 4.6-3.2 8.4-7.8 8.4zm278.9-53H615.1c-3.9 0-7.1-3.6-7.1-8v-48c0-4.4 3.2-8 7.1-8h185.7c3.9 0 7.1 3.6 7.1 8v48h.1c0 4.4-3.2 8-7.1 8z')); exports.IeSquareFill = getIcon('ie-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM765.9 556.9H437.1c0 100.4 144.3 136 196.8 47.4h120.8c-32.6 91.7-119.7 146-216.8 146-35.1 0-70.3-.1-101.7-15.6-87.4 44.5-180.3 56.6-180.3-42 0-45.8 23.2-107.1 44-145C335 484 381.3 422.8 435.6 374.5c-43.7 18.9-91.1 66.3-122 101.2 25.9-112.8 129.5-193.6 237.1-186.5 130-59.8 209.7-34.1 209.7 38.6 0 27.4-10.6 63.3-21.4 87.9 25.2 45.5 33.3 97.6 26.9 141.2zm-72.3-272.5c-24 0-51.1 11.7-72.6 22 46.3 18 86 57.3 112.3 99.6 7.1-18.9 14.6-47.9 14.6-67.9 0-32-22.8-53.7-54.3-53.7zM540.5 399.1c-53.7 0-102 39.7-104 94.9h208c-2-55.1-50.6-94.9-104-94.9zM320.6 602.9c-73 152.4 11.5 172.2 100.3 123.3-46.6-27.5-82.6-72.2-100.3-123.3z')); exports.HourglassFill = getIcon('hourglass', fill, getNode(newViewBox, 'M742 318V184h86c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H196c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h86v134c0 81.5 42.4 153.2 106.4 194-64 40.8-106.4 112.5-106.4 194v134h-86c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h632c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-86V706c0-81.5-42.4-153.2-106.4-194 64-40.8 106.4-112.5 106.4-194z')); exports.InfoCircleFill = getIcon('info-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z')); exports.InstagramFill = getIcon('instagram', fill, getNode(newViewBox, 'M512 378.7c-73.4 0-133.3 59.9-133.3 133.3S438.6 645.3 512 645.3 645.3 585.4 645.3 512 585.4 378.7 512 378.7zM911.8 512c0-55.2.5-109.9-2.6-165-3.1-64-17.7-120.8-64.5-167.6-46.9-46.9-103.6-61.4-167.6-64.5-55.2-3.1-109.9-2.6-165-2.6-55.2 0-109.9-.5-165 2.6-64 3.1-120.8 17.7-167.6 64.5C132.6 226.3 118.1 283 115 347c-3.1 55.2-2.6 109.9-2.6 165s-.5 109.9 2.6 165c3.1 64 17.7 120.8 64.5 167.6 46.9 46.9 103.6 61.4 167.6 64.5 55.2 3.1 109.9 2.6 165 2.6 55.2 0 109.9.5 165-2.6 64-3.1 120.8-17.7 167.6-64.5 46.9-46.9 61.4-103.6 64.5-167.6 3.2-55.1 2.6-109.8 2.6-165zM512 717.1c-113.5 0-205.1-91.6-205.1-205.1S398.5 306.9 512 306.9 717.1 398.5 717.1 512 625.5 717.1 512 717.1zm213.5-370.7c-26.5 0-47.9-21.4-47.9-47.9s21.4-47.9 47.9-47.9 47.9 21.4 47.9 47.9a47.84 47.84 0 0 1-47.9 47.9z')); exports.InsuranceFill = getIcon('insurance', fill, getNode(newViewBox, 'M519.9 358.8h97.9v41.6h-97.9zm347-188.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM411.3 656h-.2c0 4.4-3.6 8-8 8h-37.3c-4.4 0-8-3.6-8-8V471.4c-7.7 9.2-15.4 17.9-23.1 26a6.04 6.04 0 0 1-10.2-2.4l-13.2-43.5c-.6-2-.2-4.1 1.2-5.6 37-43.4 64.7-95.1 82.2-153.6 1.1-3.5 5-5.3 8.4-3.7l38.6 18.3c2.7 1.3 4.1 4.4 3.2 7.2a429.2 429.2 0 0 1-33.6 79V656zm296.5-49.2l-26.3 35.3a5.92 5.92 0 0 1-8.9.7c-30.6-29.3-56.8-65.2-78.1-106.9V656c0 4.4-3.6 8-8 8h-36.2c-4.4 0-8-3.6-8-8V536c-22 44.7-49 80.8-80.6 107.6a5.9 5.9 0 0 1-8.9-1.4L430 605.7a6 6 0 0 1 1.6-8.1c28.6-20.3 51.9-45.2 71-76h-55.1c-4.4 0-8-3.6-8-8V478c0-4.4 3.6-8 8-8h94.9v-18.6h-65.9c-4.4 0-8-3.6-8-8V316c0-4.4 3.6-8 8-8h184.7c4.4 0 8 3.6 8 8v127.2c0 4.4-3.6 8-8 8h-66.7v18.6h98.8c4.4 0 8 3.6 8 8v35.6c0 4.4-3.6 8-8 8h-59c18.1 29.1 41.8 54.3 72.3 76.9 2.6 2.1 3.2 5.9 1.2 8.5z')); exports.InterationFill = getIcon('interation', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM726 585.7c0 55.3-44.7 100.1-99.7 100.1H420.6v53.4c0 5.7-6.5 8.8-10.9 5.3l-109.1-85.7c-3.5-2.7-3.5-8 0-10.7l109.1-85.7c4.4-3.5 10.9-.3 10.9 5.3v53.4h205.7c19.6 0 35.5-16 35.5-35.6v-78.9c0-3.7 3-6.8 6.8-6.8h50.7c3.7 0 6.8 3 6.8 6.8v79.1zm-2.6-209.9l-109.1 85.7c-4.4 3.5-10.9.3-10.9-5.3v-53.4H397.7c-19.6 0-35.5 16-35.5 35.6v78.9c0 3.7-3 6.8-6.8 6.8h-50.7c-3.7 0-6.8-3-6.8-6.8v-78.9c0-55.3 44.7-100.1 99.7-100.1h205.7v-53.4c0-5.7 6.5-8.8 10.9-5.3l109.1 85.7c3.6 2.5 3.6 7.8.1 10.5z')); exports.LayoutFill = getIcon('layout', fill, getNode(newViewBox, 'M384 912h496c17.7 0 32-14.3 32-32V340H384v572zm496-800H384v164h528V144c0-17.7-14.3-32-32-32zm-768 32v736c0 17.7 14.3 32 32 32h176V112H144c-17.7 0-32 14.3-32 32z')); exports.LeftCircleFill = getIcon('left-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm104 316.9c0 10.2-4.9 19.9-13.2 25.9L457.4 512l145.4 105.2c8.3 6 13.2 15.6 13.2 25.9V690c0 6.5-7.4 10.3-12.7 6.5l-246-178a7.95 7.95 0 0 1 0-12.9l246-178a8 8 0 0 1 12.7 6.5v46.8z')); exports.LeftSquareFill = getIcon('left-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM624 380.9c0 10.2-4.9 19.9-13.2 25.9L465.4 512l145.4 105.2c8.3 6 13.2 15.6 13.2 25.9V690c0 6.5-7.4 10.3-12.7 6.5l-246-178a7.95 7.95 0 0 1 0-12.9l246-178c5.3-3.8 12.7 0 12.7 6.5v46.8z')); exports.LinkedinFill = getIcon('linkedin', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM349.3 793.7H230.6V411.9h118.7v381.8zm-59.3-434a68.8 68.8 0 1 1 68.8-68.8c-.1 38-30.9 68.8-68.8 68.8zm503.7 434H675.1V608c0-44.3-.8-101.2-61.7-101.2-61.7 0-71.2 48.2-71.2 98v188.9H423.7V411.9h113.8v52.2h1.6c15.8-30 54.5-61.7 112.3-61.7 120.2 0 142.3 79.1 142.3 181.9v209.4z')); exports.LikeFill = getIcon('like', fill, getNode(newViewBox, 'M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311h-.3v428h472.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM112 528v364c0 17.7 14.3 32 32 32h65V496h-65c-17.7 0-32 14.3-32 32z')); exports.MailFill = getIcon('mail', fill, getNode(newViewBox, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-80.8 108.9L531.7 514.4c-7.8 6.1-18.7 6.1-26.5 0L189.6 268.9A7.2 7.2 0 0 1 194 256h648.8a7.2 7.2 0 0 1 4.4 12.9z')); exports.MedicineBoxFill = getIcon('medicine-box', fill, getNode(newViewBox, 'M839.2 278.1a32 32 0 0 0-30.4-22.1H736V144c0-17.7-14.3-32-32-32H320c-17.7 0-32 14.3-32 32v112h-72.8a31.9 31.9 0 0 0-30.4 22.1L112 502v378c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V502l-72.8-223.9zM660 628c0 4.4-3.6 8-8 8H544v108c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V636H372c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h108V464c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v108h108c4.4 0 8 3.6 8 8v48zm4-372H360v-72h304v72z')); exports.MehFill = getIcon('meh', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zM288 421a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm384 200c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h304c4.4 0 8 3.6 8 8v48zm16-152a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z')); exports.MediumCircleFill = getIcon('medium-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm256 253.7l-40.8 39.1c-3.6 2.7-5.3 7.1-4.6 11.4v287.7c-.7 4.4 1 8.8 4.6 11.4l40 39.1v8.7H566.4v-8.3l41.3-40.1c4.1-4.1 4.1-5.3 4.1-11.4V422.5l-115 291.6h-15.5L347.5 422.5V618c-1.2 8.2 1.7 16.5 7.5 22.4l53.8 65.1v8.7H256v-8.7l53.8-65.1a26.1 26.1 0 0 0 7-22.4V392c.7-6.3-1.7-12.4-6.5-16.7l-47.8-57.6V309H411l114.6 251.5 100.9-251.3H768v8.5z')); exports.LockFill = getIcon('lock', fill, getNode(newViewBox, 'M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM540 701v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 1 1 56 0zm152-237H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224z')); exports.MediumSquareFill = getIcon('medium-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM768 317.7l-40.8 39.1c-3.6 2.7-5.3 7.1-4.6 11.4v287.7c-.7 4.4 1 8.8 4.6 11.4l40 39.1v8.7H566.4v-8.3l41.3-40.1c4.1-4.1 4.1-5.3 4.1-11.4V422.5l-115 291.6h-15.5L347.5 422.5V618c-1.2 8.2 1.7 16.5 7.5 22.4l53.8 65.1v8.7H256v-8.7l53.8-65.1a26.1 26.1 0 0 0 7-22.4V392c.7-6.3-1.7-12.4-6.5-16.7l-47.8-57.6V309H411l114.6 251.5 100.9-251.3H768v8.5z')); exports.MessageFill = getIcon('message', fill, getNode(newViewBox, 'M924.3 338.4a447.57 447.57 0 0 0-96.1-143.3 443.09 443.09 0 0 0-143-96.3A443.91 443.91 0 0 0 512 64h-2c-60.5.3-119 12.3-174.1 35.9a444.08 444.08 0 0 0-141.7 96.5 445 445 0 0 0-95 142.8A449.89 449.89 0 0 0 65 514.1c.3 69.4 16.9 138.3 47.9 199.9v152c0 25.4 20.6 46 45.9 46h151.8a447.72 447.72 0 0 0 199.5 48h2.1c59.8 0 117.7-11.6 172.3-34.3A443.2 443.2 0 0 0 827 830.5c41.2-40.9 73.6-88.7 96.3-142 23.5-55.2 35.5-113.9 35.8-174.5.2-60.9-11.6-120-34.8-175.6zM312.4 560c-26.4 0-47.9-21.5-47.9-48s21.5-48 47.9-48 47.9 21.5 47.9 48-21.4 48-47.9 48zm199.6 0c-26.4 0-47.9-21.5-47.9-48s21.5-48 47.9-48 47.9 21.5 47.9 48-21.5 48-47.9 48zm199.6 0c-26.4 0-47.9-21.5-47.9-48s21.5-48 47.9-48 47.9 21.5 47.9 48-21.5 48-47.9 48z')); exports.MinusSquareFill = getIcon('minus-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM704 536c0 4.4-3.6 8-8 8H328c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h368c4.4 0 8 3.6 8 8v48z')); exports.MinusCircleFill = getIcon('minus-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm192 472c0 4.4-3.6 8-8 8H328c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h368c4.4 0 8 3.6 8 8v48z')); exports.MobileFill = getIcon('mobile', fill, getNode(newViewBox, 'M744 62H280c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h464c35.3 0 64-28.7 64-64V126c0-35.3-28.7-64-64-64zM512 824c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40z')); exports.MoneyCollectFill = getIcon('money-collect', fill, getNode(newViewBox, 'M911.5 699.7a8 8 0 0 0-10.3-4.8L840 717.2V179c0-37.6-30.4-68-68-68H252c-37.6 0-68 30.4-68 68v538.2l-61.3-22.3c-.9-.3-1.8-.5-2.7-.5-4.4 0-8 3.6-8 8V762c0 3.3 2.1 6.3 5.3 7.5L501 909.1c7.1 2.6 14.8 2.6 21.9 0l383.8-139.5c3.2-1.2 5.3-4.2 5.3-7.5v-59.6c0-1-.2-1.9-.5-2.8zm-243.8-377L564 514.3h57.6c4.4 0 8 3.6 8 8v27.1c0 4.4-3.6 8-8 8h-76.3v39h76.3c4.4 0 8 3.6 8 8v27.1c0 4.4-3.6 8-8 8h-76.3V703c0 4.4-3.6 8-8 8h-49.9c-4.4 0-8-3.6-8-8v-63.4h-76c-4.4 0-8-3.6-8-8v-27.1c0-4.4 3.6-8 8-8h76v-39h-76c-4.4 0-8-3.6-8-8v-27.1c0-4.4 3.6-8 8-8h57L356.5 322.8c-2.1-3.8-.7-8.7 3.2-10.8 1.2-.7 2.5-1 3.8-1h55.7a8 8 0 0 1 7.1 4.4L511 484.2h3.3L599 315.4c1.3-2.7 4.1-4.4 7.1-4.4h54.5c4.4 0 8 3.6 8.1 7.9 0 1.3-.4 2.6-1 3.8z')); exports.PictureFill = getIcon('picture', fill, getNode(newViewBox, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zM338 304c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm513.9 437.1a8.11 8.11 0 0 1-5.2 1.9H177.2c-4.4 0-8-3.6-8-8 0-1.9.7-3.7 1.9-5.2l170.3-202c2.8-3.4 7.9-3.8 11.3-1 .3.3.7.6 1 1l99.4 118 158.1-187.5c2.8-3.4 7.9-3.8 11.3-1 .3.3.7.6 1 1l229.6 271.6c2.6 3.3 2.2 8.4-1.2 11.2z')); exports.PayCircleFill = getIcon('pay-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm166.6 246.8L567.5 515.6h62c4.4 0 8 3.6 8 8v29.9c0 4.4-3.6 8-8 8h-82V603h82c4.4 0 8 3.6 8 8v29.9c0 4.4-3.6 8-8 8h-82V717c0 4.4-3.6 8-8 8h-54.3c-4.4 0-8-3.6-8-8v-68.1h-81.7c-4.4 0-8-3.6-8-8V611c0-4.4 3.6-8 8-8h81.7v-41.5h-81.7c-4.4 0-8-3.6-8-8v-29.9c0-4.4 3.6-8 8-8h61.4L345.4 310.8a8.07 8.07 0 0 1 7-11.9h60.7c3 0 5.8 1.7 7.1 4.4l90.6 180h3.4l90.6-180a8 8 0 0 1 7.1-4.4h59.5c4.4 0 8 3.6 8 8 .2 1.4-.2 2.7-.8 3.9z')); exports.NotificationFill = getIcon('notification', fill, getNode(newViewBox, 'M880 112c-3.8 0-7.7.7-11.6 2.3L292 345.9H128c-8.8 0-16 7.4-16 16.6v299c0 9.2 7.2 16.6 16 16.6h101.6c-3.7 11.6-5.6 23.9-5.6 36.4 0 65.9 53.8 119.5 120 119.5 55.4 0 102.1-37.6 115.9-88.4l408.6 164.2c3.9 1.5 7.8 2.3 11.6 2.3 16.9 0 32-14.2 32-33.2V145.2C912 126.2 897 112 880 112zM344 762.3c-26.5 0-48-21.4-48-47.8 0-11.2 3.9-21.9 11-30.4l84.9 34.1c-2 24.6-22.7 44.1-47.9 44.1z')); exports.PauseCircleFill = getIcon('pause-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-80 600c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V360c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v304zm224 0c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V360c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v304z')); exports.PieChartFill = getIcon('pie-chart', fill, getNode(newViewBox, 'M863.1 518.5H505.5V160.9c0-4.4-3.6-8-8-8h-26a398.57 398.57 0 0 0-282.5 117 397.47 397.47 0 0 0-85.6 127C82.6 446.2 72 498.5 72 552.5S82.6 658.7 103.4 708c20.1 47.5 48.9 90.3 85.6 127 36.7 36.7 79.4 65.5 127 85.6a396.64 396.64 0 0 0 155.6 31.5 398.57 398.57 0 0 0 282.5-117c36.7-36.7 65.5-79.4 85.6-127a396.64 396.64 0 0 0 31.5-155.6v-26c-.1-4.4-3.7-8-8.1-8zM951 463l-2.6-28.2c-8.5-92-49.3-178.8-115.1-244.3A398.5 398.5 0 0 0 588.4 75.6L560.1 73c-4.7-.4-8.7 3.2-8.7 7.9v383.7c0 4.4 3.6 8 8 8l383.6-1c4.7-.1 8.4-4 8-8.6z')); exports.PlayCircleFill = getIcon('play-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm144.1 454.9L437.7 677.8a8.02 8.02 0 0 1-12.7-6.5V353.7a8 8 0 0 1 12.7-6.5L656.1 506a7.9 7.9 0 0 1 0 12.9z')); exports.PhoneFill = getIcon('phone', fill, getNode(newViewBox, 'M885.6 230.2L779.1 123.8a80.83 80.83 0 0 0-57.3-23.8c-21.7 0-42.1 8.5-57.4 23.8L549.8 238.4a80.83 80.83 0 0 0-23.8 57.3c0 21.7 8.5 42.1 23.8 57.4l83.8 83.8A393.82 393.82 0 0 1 553.1 553 395.34 395.34 0 0 1 437 633.8L353.2 550a80.83 80.83 0 0 0-57.3-23.8c-21.7 0-42.1 8.5-57.4 23.8L123.8 664.5a80.89 80.89 0 0 0-23.8 57.4c0 21.7 8.5 42.1 23.8 57.4l106.3 106.3c24.4 24.5 58.1 38.4 92.7 38.4 7.3 0 14.3-.6 21.2-1.8 134.8-22.2 268.5-93.9 376.4-201.7C828.2 612.8 899.8 479.2 922.3 344c6.8-41.3-6.9-83.8-36.7-113.8z')); exports.PlaySquareFill = getIcon('play-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM641.7 520.8L442.3 677.6c-7.4 5.8-18.3.6-18.3-8.8V355.3c0-9.4 10.9-14.7 18.3-8.8l199.4 156.7a11.2 11.2 0 0 1 0 17.6z')); exports.PlusCircleFill = getIcon('plus-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm192 472c0 4.4-3.6 8-8 8H544v152c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V544H328c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h152V328c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v152h152c4.4 0 8 3.6 8 8v48z')); exports.PlusSquareFill = getIcon('plus-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM704 536c0 4.4-3.6 8-8 8H544v152c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V544H328c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h152V328c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v152h152c4.4 0 8 3.6 8 8v48z')); exports.ProfileFill = getIcon('profile', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM380 696c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm0-144c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm0-144c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm304 272c0 4.4-3.6 8-8 8H492c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48zm0-144c0 4.4-3.6 8-8 8H492c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48zm0-144c0 4.4-3.6 8-8 8H492c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48z')); exports.ProjectFill = getIcon('project', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM368 744c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8V280c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8v464zm192-280c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8V280c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8v184zm192 72c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8V280c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8v256z')); exports.PoundCircleFill = getIcon('pound-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm146 658c0 4.4-3.6 8-8 8H376.2c-4.4 0-8-3.6-8-8v-38.5c0-3.7 2.5-6.9 6.1-7.8 44-10.9 72.8-49 72.8-94.2 0-14.7-2.5-29.4-5.9-44.2H374c-4.4 0-8-3.6-8-8v-30c0-4.4 3.6-8 8-8h53.7c-7.8-25.1-14.6-50.7-14.6-77.1 0-75.8 58.6-120.3 151.5-120.3 26.5 0 51.4 5.5 70.3 12.7 3.1 1.2 5.2 4.2 5.2 7.5v39.5a8 8 0 0 1-10.6 7.6c-17.9-6.4-39-10.5-60.4-10.5-53.3 0-87.3 26.6-87.3 70.2 0 24.7 6.2 47.9 13.4 70.5h112c4.4 0 8 3.6 8 8v30c0 4.4-3.6 8-8 8h-98.6c3.1 13.2 5.3 26.9 5.3 41 0 40.7-16.5 73.9-43.9 91.1v4.7h180c4.4 0 8 3.6 8 8V722z')); exports.PrinterFill = getIcon('printer', fill, getNode(newViewBox, 'M732 120c0-4.4-3.6-8-8-8H300c-4.4 0-8 3.6-8 8v148h440V120zm120 212H172c-44.2 0-80 35.8-80 80v328c0 17.7 14.3 32 32 32h168v132c0 4.4 3.6 8 8 8h424c4.4 0 8-3.6 8-8V772h168c17.7 0 32-14.3 32-32V412c0-44.2-35.8-80-80-80zM664 844H360V568h304v276zm164-360c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-40c0-4.4 3.6-8 8-8h40c4.4 0 8 3.6 8 8v40z')); exports.PropertySafetyFill = getIcon('property-safety', fill, getNode(newViewBox, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM648.3 332.8l-87.7 161.1h45.7c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4v29.7h63.4c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4V658c0 5.5-4.5 10-10 10h-41.3c-5.5 0-10-4.5-10-10v-51.8h-63.1c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h63.1v-29.7h-63.1c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h45.2l-88-161.1c-2.6-4.8-.9-10.9 4-13.6 1.5-.8 3.1-1.2 4.8-1.2h46c3.8 0 7.2 2.1 8.9 5.5l72.9 144.3 73.2-144.3a10 10 0 0 1 8.9-5.5h45c5.5 0 10 4.5 10 10 .1 1.7-.3 3.3-1.1 4.8z')); exports.QqSquareFill = getIcon('qq-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM722.5 676.4c-11.5 1.4-44.9-52.7-44.9-52.7 0 31.3-16.2 72.2-51.1 101.8 16.9 5.2 54.9 19.2 45.9 34.4-7.3 12.3-125.6 7.9-159.8 4-34.2 3.8-152.5 8.3-159.8-4-9.1-15.2 28.9-29.2 45.8-34.4-35-29.5-51.1-70.4-51.1-101.8 0 0-33.4 54.1-44.9 52.7-5.4-.7-12.4-29.6 9.4-99.7 10.3-33 22-60.5 40.2-105.8-3.1-116.9 45.3-215 160.4-215 113.9 0 163.3 96.1 160.4 215 18.1 45.2 29.9 72.8 40.2 105.8 21.7 70.1 14.6 99.1 9.3 99.7z')); exports.PushpinFill = getIcon('pushpin', fill, getNode(newViewBox, 'M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3-15.4 12.3-16.6 35.4-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 0 0-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8z')); exports.QqCircleFill = getIcon('qq-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm210.5 612.4c-11.5 1.4-44.9-52.7-44.9-52.7 0 31.3-16.2 72.2-51.1 101.8 16.9 5.2 54.9 19.2 45.9 34.4-7.3 12.3-125.6 7.9-159.8 4-34.2 3.8-152.5 8.3-159.8-4-9.1-15.2 28.9-29.2 45.8-34.4-35-29.5-51.1-70.4-51.1-101.8 0 0-33.4 54.1-44.9 52.7-5.4-.7-12.4-29.6 9.4-99.7 10.3-33 22-60.5 40.2-105.8-3.1-116.9 45.3-215 160.4-215 113.9 0 163.3 96.1 160.4 215 18.1 45.2 29.9 72.8 40.2 105.8 21.7 70.1 14.6 99.1 9.3 99.7z')); exports.QuestionCircleFill = getIcon('question-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 708c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm62.9-219.5a48.3 48.3 0 0 0-30.9 44.8V620c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-21.5c0-23.1 6.7-45.9 19.9-64.9 12.9-18.6 30.9-32.8 52.1-40.9 34-13.1 56-41.6 56-72.7 0-44.1-43.1-80-96-80s-96 35.9-96 80v7.6c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V420c0-39.3 17.2-76 48.4-103.3C430.4 290.4 470 276 512 276s81.6 14.5 111.6 40.7C654.8 344 672 380.7 672 420c0 57.8-38.1 109.8-97.1 132.5z')); exports.ReadFill = getIcon('read', fill, getNode(newViewBox, 'M928 161H699.2c-49.1 0-97.1 14.1-138.4 40.7L512 233l-48.8-31.3A255.2 255.2 0 0 0 324.8 161H96c-17.7 0-32 14.3-32 32v568c0 17.7 14.3 32 32 32h228.8c49.1 0 97.1 14.1 138.4 40.7l44.4 28.6c1.3.8 2.8 1.3 4.3 1.3s3-.4 4.3-1.3l44.4-28.6C602 807.1 650.1 793 699.2 793H928c17.7 0 32-14.3 32-32V193c0-17.7-14.3-32-32-32zM404 553.5c0 4.1-3.2 7.5-7.1 7.5H211.1c-3.9 0-7.1-3.4-7.1-7.5v-45c0-4.1 3.2-7.5 7.1-7.5h185.7c3.9 0 7.1 3.4 7.1 7.5v45zm0-140c0 4.1-3.2 7.5-7.1 7.5H211.1c-3.9 0-7.1-3.4-7.1-7.5v-45c0-4.1 3.2-7.5 7.1-7.5h185.7c3.9 0 7.1 3.4 7.1 7.5v45zm416 140c0 4.1-3.2 7.5-7.1 7.5H627.1c-3.9 0-7.1-3.4-7.1-7.5v-45c0-4.1 3.2-7.5 7.1-7.5h185.7c3.9 0 7.1 3.4 7.1 7.5v45zm0-140c0 4.1-3.2 7.5-7.1 7.5H627.1c-3.9 0-7.1-3.4-7.1-7.5v-45c0-4.1 3.2-7.5 7.1-7.5h185.7c3.9 0 7.1 3.4 7.1 7.5v45z')); exports.ReconciliationFill = getIcon('reconciliation', fill, getNode(newViewBox, 'M676 623c-18.8 0-34 15.2-34 34s15.2 34 34 34 34-15.2 34-34-15.2-34-34-34zm204-455H668c0-30.9-25.1-56-56-56h-80c-30.9 0-56 25.1-56 56H264c-17.7 0-32 14.3-32 32v200h-88c-17.7 0-32 14.3-32 32v448c0 17.7 14.3 32 32 32h336c17.7 0 32-14.3 32-32v-16h368c17.7 0 32-14.3 32-32V200c0-17.7-14.3-32-32-32zM448 848H176V616h272v232zm0-296H176v-88h272v88zm20-272v-48h72v-56h64v56h72v48H468zm180 168v56c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-56c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8zm28 301c-50.8 0-92-41.2-92-92s41.2-92 92-92 92 41.2 92 92-41.2 92-92 92zm92-245c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-96c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v96zm-92 61c-50.8 0-92 41.2-92 92s41.2 92 92 92 92-41.2 92-92-41.2-92-92-92zm0 126c-18.8 0-34-15.2-34-34s15.2-34 34-34 34 15.2 34 34-15.2 34-34 34z')); exports.RedEnvelopeFill = getIcon('red-envelope', fill, getNode(newViewBox, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zM647 470.4l-87.2 161h45.9c4.6 0 8.4 3.8 8.4 8.4v25.1c0 4.6-3.8 8.4-8.4 8.4h-63.3v28.6h63.3c4.6 0 8.4 3.8 8.4 8.4v25c.2 4.6-3.6 8.5-8.2 8.5h-63.3v49.9c0 4.6-3.8 8.4-8.4 8.4h-43.7c-4.6 0-8.4-3.8-8.4-8.4v-49.9h-63c-4.6 0-8.4-3.8-8.4-8.4v-25.1c0-4.6 3.8-8.4 8.4-8.4h63v-28.6h-63c-4.6 0-8.4-3.8-8.4-8.4v-25.1c0-4.6 3.8-8.4 8.4-8.4h45.4l-87.5-161c-2.2-4.1-.7-9.1 3.4-11.4 1.3-.6 2.6-1 3.9-1h48.8c3.2 0 6.1 1.8 7.5 4.6l71.9 141.8 71.9-141.9a8.5 8.5 0 0 1 7.5-4.6h47.8c4.6 0 8.4 3.8 8.4 8.4-.1 1.5-.5 2.9-1.1 4.1zM512.6 323L289 148h446L512.6 323z')); exports.RedditCircleFill = getIcon('reddit-circle', fill, getNode(newViewBox, 'M584 548a36 36 0 1 0 72 0 36 36 0 1 0-72 0zm144-108a35.9 35.9 0 0 0-32.5 20.6c18.8 14.3 34.4 30.7 45.9 48.8A35.98 35.98 0 0 0 728 440zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm245 477.9c4.6 13.5 7 27.6 7 42.1 0 99.4-112.8 180-252 180s-252-80.6-252-180c0-14.5 2.4-28.6 7-42.1A72.01 72.01 0 0 1 296 404c27.1 0 50.6 14.9 62.9 37 36.2-19.8 80.2-32.8 128.1-36.1l58.4-131.1c4.3-9.8 15.2-14.8 25.5-11.8l91.6 26.5a54.03 54.03 0 0 1 101.6 25.6c0 29.8-24.2 54-54 54-23.5 0-43.5-15.1-50.9-36.1L577 308.3l-43 96.5c49.1 3 94.2 16.1 131.2 36.3 12.3-22.1 35.8-37 62.9-37 39.8 0 72 32.2 72 72-.1 29.3-17.8 54.6-43.1 65.8zm-171.3 83c-14.9 11.7-44.3 24.3-73.7 24.3s-58.9-12.6-73.7-24.3c-9.3-7.3-22.7-5.7-30 3.6-7.3 9.3-5.7 22.7 3.6 30 25.7 20.4 65 33.5 100.1 33.5 35.1 0 74.4-13.1 100.2-33.5 9.3-7.3 10.9-20.8 3.6-30a21.46 21.46 0 0 0-30.1-3.6zM296 440a35.98 35.98 0 0 0-13.4 69.4c11.5-18.1 27.1-34.5 45.9-48.8A35.9 35.9 0 0 0 296 440zm72 108a36 36 0 1 0 72 0 36 36 0 1 0-72 0z')); exports.RedditSquareFill = getIcon('reddit-square', fill, getNode(newViewBox, 'M296 440a35.98 35.98 0 0 0-13.4 69.4c11.5-18.1 27.1-34.5 45.9-48.8A35.9 35.9 0 0 0 296 440zm289.7 184.9c-14.9 11.7-44.3 24.3-73.7 24.3s-58.9-12.6-73.7-24.3c-9.3-7.3-22.7-5.7-30 3.6-7.3 9.3-5.7 22.7 3.6 30 25.7 20.4 65 33.5 100.1 33.5 35.1 0 74.4-13.1 100.2-33.5 9.3-7.3 10.9-20.8 3.6-30a21.46 21.46 0 0 0-30.1-3.6zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM757 541.9c4.6 13.5 7 27.6 7 42.1 0 99.4-112.8 180-252 180s-252-80.6-252-180c0-14.5 2.4-28.6 7-42.1A72.01 72.01 0 0 1 296 404c27.1 0 50.6 14.9 62.9 37 36.2-19.8 80.2-32.8 128.1-36.1l58.4-131.1c4.3-9.8 15.2-14.8 25.5-11.8l91.6 26.5a54.03 54.03 0 0 1 101.6 25.6c0 29.8-24.2 54-54 54-23.5 0-43.5-15.1-50.9-36.1L577 308.3l-43 96.5c49.1 3 94.2 16.1 131.2 36.3 12.3-22.1 35.8-37 62.9-37 39.8 0 72 32.2 72 72-.1 29.3-17.8 54.6-43.1 65.8zM584 548a36 36 0 1 0 72 0 36 36 0 1 0-72 0zm144-108a35.9 35.9 0 0 0-32.5 20.6c18.8 14.3 34.4 30.7 45.9 48.8A35.98 35.98 0 0 0 728 440zM368 548a36 36 0 1 0 72 0 36 36 0 1 0-72 0z')); exports.RightSquareFill = getIcon('right-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM658.7 518.5l-246 178c-5.3 3.8-12.7 0-12.7-6.5v-46.9c0-10.2 4.9-19.9 13.2-25.9L558.6 512 413.2 406.8c-8.3-6-13.2-15.6-13.2-25.9V334c0-6.5 7.4-10.3 12.7-6.5l246 178c4.4 3.2 4.4 9.8 0 13z')); exports.RocketFill = getIcon('rocket', fill, getNode(newViewBox, 'M864 736c0-111.6-65.4-208-160-252.9V317.3c0-15.1-5.3-29.7-15.1-41.2L536.5 95.4C530.1 87.8 521 84 512 84s-18.1 3.8-24.5 11.4L335.1 276.1a63.97 63.97 0 0 0-15.1 41.2v165.8C225.4 528 160 624.4 160 736h156.5c-2.3 7.2-3.5 15-3.5 23.8 0 22.1 7.6 43.7 21.4 60.8a97.2 97.2 0 0 0 43.1 30.6c23.1 54 75.6 88.8 134.5 88.8 29.1 0 57.3-8.6 81.4-24.8 23.6-15.8 41.9-37.9 53-64a97 97 0 0 0 43.1-30.5 97.52 97.52 0 0 0 21.4-60.8c0-8.4-1.1-16.4-3.1-23.8L864 736zM512 352a48.01 48.01 0 0 1 0 96 48.01 48.01 0 0 1 0-96zm116.1 432.2c-5.2 3-11.2 4.2-17.1 3.4l-19.5-2.4-2.8 19.4c-5.4 37.9-38.4 66.5-76.7 66.5s-71.3-28.6-76.7-66.5l-2.8-19.5-19.5 2.5a27.7 27.7 0 0 1-17.1-3.5c-8.7-5-14.1-14.3-14.1-24.4 0-10.6 5.9-19.4 14.6-23.8h231.3c8.8 4.5 14.6 13.3 14.6 23.8-.1 10.2-5.5 19.6-14.2 24.5z')); exports.RestFill = getIcon('rest', fill, getNode(newViewBox, 'M832 256h-28.1l-35.7-120.9c-4-13.7-16.5-23.1-30.7-23.1h-451c-14.3 0-26.8 9.4-30.7 23.1L220.1 256H192c-17.7 0-32 14.3-32 32v28c0 4.4 3.6 8 8 8h45.8l47.7 558.7a32 32 0 0 0 31.9 29.3h429.2a32 32 0 0 0 31.9-29.3L802.2 324H856c4.4 0 8-3.6 8-8v-28c0-17.7-14.3-32-32-32zM508 704c-79.5 0-144-64.5-144-144s64.5-144 144-144 144 64.5 144 144-64.5 144-144 144zM291 256l22.4-76h397.2l22.4 76H291zm137 304a80 80 0 1 0 160 0 80 80 0 1 0-160 0z')); exports.RightCircleFill = getIcon('right-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm154.7 454.5l-246 178c-5.3 3.8-12.7 0-12.7-6.5v-46.9c0-10.2 4.9-19.9 13.2-25.9L566.6 512 421.2 406.8c-8.3-6-13.2-15.6-13.2-25.9V334c0-6.5 7.4-10.3 12.7-6.5l246 178c4.4 3.2 4.4 9.8 0 13z')); exports.SafetyCertificateFill = getIcon('safety-certificate', fill, getNode(newViewBox, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM694.5 340.7L481.9 633.4a16.1 16.1 0 0 1-26 0l-126.4-174c-3.8-5.3 0-12.7 6.5-12.7h55.2c5.1 0 10 2.5 13 6.6l64.7 89 150.9-207.8c3-4.1 7.8-6.6 13-6.6H688c6.5.1 10.3 7.5 6.5 12.8z')); exports.SaveFill = getIcon('save', fill, getNode(newViewBox, 'M893.3 293.3L730.7 130.7c-12-12-28.3-18.7-45.3-18.7H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 176h256v112H384V176zm128 554c-79.5 0-144-64.5-144-144s64.5-144 144-144 144 64.5 144 144-64.5 144-144 144zm0-224c-44.2 0-80 35.8-80 80s35.8 80 80 80 80-35.8 80-80-35.8-80-80-80z')); exports.ScheduleFill = getIcon('schedule', fill, getNode(newViewBox, 'M928 224H768v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H548v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H328v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H96c-17.7 0-32 14.3-32 32v576c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V256c0-17.7-14.3-32-32-32zM424 688c0 4.4-3.6 8-8 8H232c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48zm0-136c0 4.4-3.6 8-8 8H232c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48zm374.5-91.3l-165 228.7a15.9 15.9 0 0 1-25.8 0L493.5 531.2c-3.8-5.3 0-12.7 6.5-12.7h54.9c5.1 0 9.9 2.5 12.9 6.6l52.8 73.1 103.7-143.7c3-4.2 7.8-6.6 12.9-6.6H792c6.5.1 10.3 7.5 6.5 12.8z')); exports.SecurityScanFill = getIcon('security-scan', fill, getNode(newViewBox, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM626.8 554c-48.5 48.5-123 55.2-178.6 20.1l-77.5 77.5a8.03 8.03 0 0 1-11.3 0l-34-34a8.03 8.03 0 0 1 0-11.3l77.5-77.5c-35.1-55.7-28.4-130.1 20.1-178.6 56.3-56.3 147.5-56.3 203.8 0 56.3 56.3 56.3 147.5 0 203.8zm-158.54-45.27a80.1 80.1 0 1 0 113.27-113.28 80.1 80.1 0 1 0-113.27 113.28z')); exports.ShopFill = getIcon('shop', fill, getNode(newViewBox, 'M882 272.1V144c0-17.7-14.3-32-32-32H174c-17.7 0-32 14.3-32 32v128.1c-16.7 1-30 14.9-30 31.9v131.7a177 177 0 0 0 14.4 70.4c4.3 10.2 9.6 19.8 15.6 28.9v345c0 17.6 14.3 32 32 32h274V736h128v176h274c17.7 0 32-14.3 32-32V535a175 175 0 0 0 15.6-28.9c9.5-22.3 14.4-46 14.4-70.4V304c0-17-13.3-30.9-30-31.9zm-72 568H640V704c0-17.7-14.3-32-32-32H416c-17.7 0-32 14.3-32 32v136.1H214V597.9c2.9 1.4 5.9 2.8 9 4 22.3 9.4 46 14.1 70.4 14.1s48-4.7 70.4-14.1c13.8-5.8 26.8-13.2 38.7-22.1.2-.1.4-.1.6 0a180.4 180.4 0 0 0 38.7 22.1c22.3 9.4 46 14.1 70.4 14.1 24.4 0 48-4.7 70.4-14.1 13.8-5.8 26.8-13.2 38.7-22.1.2-.1.4-.1.6 0a180.4 180.4 0 0 0 38.7 22.1c22.3 9.4 46 14.1 70.4 14.1 24.4 0 48-4.7 70.4-14.1 3-1.3 6-2.6 9-4v242.2zm0-568.1H214v-88h596v88z')); exports.SettingFill = getIcon('setting', fill, getNode(newViewBox, 'M512.5 390.6c-29.9 0-57.9 11.6-79.1 32.8-21.1 21.2-32.8 49.2-32.8 79.1 0 29.9 11.7 57.9 32.8 79.1 21.2 21.1 49.2 32.8 79.1 32.8 29.9 0 57.9-11.7 79.1-32.8 21.1-21.2 32.8-49.2 32.8-79.1 0-29.9-11.7-57.9-32.8-79.1a110.96 110.96 0 0 0-79.1-32.8zm412.3 235.5l-65.4-55.9c3.1-19 4.7-38.4 4.7-57.7s-1.6-38.8-4.7-57.7l65.4-55.9a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a442.5 442.5 0 0 0-79.6-137.7l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.2 28.9c-30-24.6-63.4-44-99.6-57.5l-15.7-84.9a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52-9.4-106.8-9.4-158.8 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.3a353.44 353.44 0 0 0-98.9 57.3l-81.8-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a445.93 445.93 0 0 0-79.6 137.7l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.2 56.5c-3.1 18.8-4.6 38-4.6 57 0 19.2 1.5 38.4 4.6 57l-66 56.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.3 44.8 96.8 79.6 137.7l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.8-29.1c29.8 24.5 63 43.9 98.9 57.3l15.8 85.3a32.05 32.05 0 0 0 25.8 25.7l2.7.5a448.27 448.27 0 0 0 158.8 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-84.9c36.2-13.6 69.6-32.9 99.6-57.5l81.2 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.5-87.4 79.6-137.7l.9-2.6c4.3-12.4.6-26.3-9.5-35zm-412.3 52.2c-97.1 0-175.8-78.7-175.8-175.8s78.7-175.8 175.8-175.8 175.8 78.7 175.8 175.8-78.7 175.8-175.8 175.8z')); exports.ShoppingFill = getIcon('shopping', fill, getNode(newViewBox, 'M832 312H696v-16c0-101.6-82.4-184-184-184s-184 82.4-184 184v16H192c-17.7 0-32 14.3-32 32v536c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V344c0-17.7-14.3-32-32-32zm-208 0H400v-16c0-61.9 50.1-112 112-112s112 50.1 112 112v16z')); exports.SketchCircleFill = getIcon('sketch-circle', fill, getNode(newViewBox, 'M582.3 625.6l147.9-166.3h-63.4zm90-202.3h62.5l-92.1-115.1zm-274.7 36L512 684.5l114.4-225.2zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm286.7 380.2L515.8 762.3c-1 1.1-2.4 1.7-3.8 1.7s-2.8-.6-3.8-1.7L225.3 444.2a5.14 5.14 0 0 1-.2-6.6L365.6 262c1-1.2 2.4-1.9 4-1.9h284.6c1.6 0 3 .7 4 1.9l140.5 175.6a4.9 4.9 0 0 1 0 6.6zm-190.5-20.9L512 326.1l-96.2 97.2zM420.3 301.1l-23.1 89.8 88.8-89.8zm183.4 0H538l88.8 89.8zm-222.4 7.1l-92.1 115.1h62.5zm-87.5 151.1l147.9 166.3-84.5-166.3z')); exports.SkinFill = getIcon('skin', fill, getNode(newViewBox, 'M870 126H663.8c-17.4 0-32.9 11.9-37 29.3C614.3 208.1 567 246 512 246s-102.3-37.9-114.8-90.7a37.93 37.93 0 0 0-37-29.3H154a44 44 0 0 0-44 44v252a44 44 0 0 0 44 44h75v388a44 44 0 0 0 44 44h478a44 44 0 0 0 44-44V466h75a44 44 0 0 0 44-44V170a44 44 0 0 0-44-44z')); exports.SketchSquareFill = getIcon('sketch-square', fill, getNode(newViewBox, 'M608.2 423.3L512 326.1l-96.2 97.2zm-25.9 202.3l147.9-166.3h-63.4zm90-202.3h62.5l-92.1-115.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-81.3 332.2L515.8 762.3c-1 1.1-2.4 1.7-3.8 1.7s-2.8-.6-3.8-1.7L225.3 444.2a5.14 5.14 0 0 1-.2-6.6L365.6 262c1-1.2 2.4-1.9 4-1.9h284.6c1.6 0 3 .7 4 1.9l140.5 175.6a4.9 4.9 0 0 1 0 6.6zm-401.1 15.1L512 684.5l114.4-225.2zm-16.3-151.1l-92.1 115.1h62.5zm-87.5 151.1l147.9 166.3-84.5-166.3zm126.5-158.2l-23.1 89.8 88.8-89.8zm183.4 0H538l88.8 89.8z')); exports.SlackCircleFill = getIcon('slack-circle', fill, getNode(newViewBox, 'M445.26 477.67l101.3-32.9 32.9 101.29-101.29 32.9zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm231.1 523.5l-50.3 16.3 16.5 50.6c7.7 23.6-5.3 49-28.9 56.7-23.6 7.7-49-5.3-56.7-28.9l-16.5-50.6L506 664.5l16.5 50.6c7.7 23.6-5.3 49-28.9 56.7-23.6 7.7-49-5.3-56.7-28.9l-16.5-50.6-51 16.6c-23.6 7.7-49-5.3-56.7-28.9s5.3-49 28.9-56.7l51-16.6-32.9-101.3-51 16.6c-23.6 7.7-49-5.3-56.7-28.9-7.7-23.6 5.3-49 28.9-56.7l51-16.6-16.5-50.6c-7.7-23.6 5.3-49 28.9-56.7 23.6-7.7 49 5.3 56.7 28.9l16.5 50.6 101.3-32.9-16.5-50.6c-7.7-23.6 5.3-49 28.9-56.7s49 5.3 56.7 28.9l16.5 50.6 50.3-16.3c23.6-7.7 49 5.3 56.7 28.9 7.7 23.6-5.3 49-28.9 56.7L632.1 417 665 518.3l50.3-16.3c23.6-7.7 49 5.3 56.7 28.9 7.6 23.5-5.3 48.9-28.9 56.6z')); exports.SlidersFill = getIcon('sliders', fill, getNode(newViewBox, 'M904 296h-66v-96c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v96h-66c-4.4 0-8 3.6-8 8v416c0 4.4 3.6 8 8 8h66v96c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-96h66c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8zm-584-72h-66v-56c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v56h-66c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8h66v56c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-56h66c4.4 0 8-3.6 8-8V232c0-4.4-3.6-8-8-8zm292 180h-66V232c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v172h-66c-4.4 0-8 3.6-8 8v200c0 4.4 3.6 8 8 8h66v172c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V620h66c4.4 0 8-3.6 8-8V412c0-4.4-3.6-8-8-8z')); exports.SkypeFill = getIcon('skype', fill, getNode(newViewBox, 'M883.7 578.6c4.1-22.5 6.3-45.5 6.3-68.5 0-51-10-100.5-29.7-147-19-45-46.3-85.4-81-120.1a375.79 375.79 0 0 0-120.1-80.9c-46.6-19.7-96-29.7-147-29.7-24 0-48.1 2.3-71.5 6.8A225.1 225.1 0 0 0 335.6 113c-59.7 0-115.9 23.3-158.1 65.5A222.25 222.25 0 0 0 112 336.6c0 38 9.8 75.4 28.1 108.4-3.7 21.4-5.7 43.3-5.7 65.1 0 51 10 100.5 29.7 147 19 45 46.2 85.4 80.9 120.1 34.7 34.7 75.1 61.9 120.1 80.9 46.6 19.7 96 29.7 147 29.7 22.2 0 44.4-2 66.2-5.9 33.5 18.9 71.3 29 110 29 59.7 0 115.9-23.2 158.1-65.5 42.3-42.2 65.5-98.4 65.5-158.1.1-38-9.7-75.5-28.2-108.7zm-370 162.9c-134.2 0-194.2-66-194.2-115.4 0-25.4 18.7-43.1 44.5-43.1 57.4 0 42.6 82.5 149.7 82.5 54.9 0 85.2-29.8 85.2-60.3 0-18.3-9-38.7-45.2-47.6l-119.4-29.8c-96.1-24.1-113.6-76.1-113.6-124.9 0-101.4 95.5-139.5 185.2-139.5 82.6 0 180 45.7 180 106.5 0 26.1-22.6 41.2-48.4 41.2-49 0-40-67.8-138.7-67.8-49 0-76.1 22.2-76.1 53.9s38.7 41.8 72.3 49.5l88.4 19.6c96.8 21.6 121.3 78.1 121.3 131.3 0 82.3-63.3 143.9-191 143.9z')); exports.SlackSquareFill = getIcon('slack-square', fill, getNode(newViewBox, 'M893.1 397.6c-85.8-286-209.5-352.5-495.5-266.7S45.1 340.4 130.9 626.4s209.5 352.5 495.5 266.7 352.5-209.5 266.7-495.5zm-150 189.9l-50.3 16.3 16.5 50.6c7.7 23.6-5.3 49-28.9 56.7-23.6 7.7-49-5.3-56.7-28.9l-16.5-50.6L506 664.5l16.5 50.6c7.7 23.6-5.3 49-28.9 56.7-23.6 7.7-49-5.3-56.7-28.9l-16.5-50.6-51 16.6c-23.6 7.7-49-5.3-56.7-28.9s5.3-49 28.9-56.7l51-16.6-32.9-101.3-51 16.6c-23.6 7.7-49-5.3-56.7-28.9-7.7-23.6 5.3-49 28.9-56.7l51-16.6-16.5-50.6c-7.7-23.6 5.3-49 28.9-56.7 23.6-7.7 49 5.3 56.7 28.9l16.5 50.6 101.3-32.9-16.5-50.6c-7.7-23.6 5.3-49 28.9-56.7s49 5.3 56.7 28.9l16.5 50.6 50.3-16.3c23.6-7.7 49 5.3 56.7 28.9 7.7 23.6-5.3 49-28.9 56.7L632.1 417 665 518.3l50.3-16.3c23.6-7.7 49 5.3 56.7 28.9 7.7 23.6-5.3 48.9-28.9 56.6zM445.26 477.67l101.3-32.9 32.9 101.29-101.29 32.9z')); exports.SmileFill = getIcon('smile', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zM288 421a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm224 272c-85.5 0-155.6-67.3-160-151.6a8 8 0 0 1 8-8.4h48.1c4.2 0 7.8 3.2 8.1 7.4C420 589.9 461.5 629 512 629s92.1-39.1 95.8-88.6c.3-4.2 3.9-7.4 8.1-7.4H664a8 8 0 0 1 8 8.4C667.6 625.7 597.5 693 512 693zm176-224a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z')); exports.SnippetsFill = getIcon('snippets', fill, getNode(newViewBox, 'M832 112H724V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H500V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H320c-17.7 0-32 14.3-32 32v120h-96c-17.7 0-32 14.3-32 32v632c0 17.7 14.3 32 32 32h512c17.7 0 32-14.3 32-32v-96h96c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM664 486H514V336h.2L664 485.8v.2zm128 274h-56V456L544 264H360v-80h68v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h152v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h68v576z')); exports.StarFill = getIcon('star', fill, getNode(newViewBox, 'M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 0 0 .6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0 0 46.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z')); exports.SoundFill = getIcon('sound', fill, getNode(newViewBox, 'M892.1 737.8l-110.3-63.7a15.9 15.9 0 0 0-21.7 5.9l-19.9 34.5c-4.4 7.6-1.8 17.4 5.8 21.8L856.3 800a15.9 15.9 0 0 0 21.7-5.9l19.9-34.5c4.4-7.6 1.7-17.4-5.8-21.8zM760 344a15.9 15.9 0 0 0 21.7 5.9L892 286.2c7.6-4.4 10.2-14.2 5.8-21.8L878 230a15.9 15.9 0 0 0-21.7-5.9L746 287.8a15.99 15.99 0 0 0-5.8 21.8L760 344zm174 132H806c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16h128c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16zM625.9 115c-5.9 0-11.9 1.6-17.4 5.3L254 352H90c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h164l354.5 231.7c5.5 3.6 11.6 5.3 17.4 5.3 16.7 0 32.1-13.3 32.1-32.1V147.1c0-18.8-15.4-32.1-32.1-32.1z')); exports.StepBackwardFill = getIcon('step-backward', fill, getNode(normalViewBox, 'M347.6 528.95l383.2 301.02c14.25 11.2 35.2 1.1 35.2-16.95V210.97c0-18.05-20.95-28.14-35.2-16.94L347.6 495.05a21.53 21.53 0 0 0 0 33.9M330 864h-64a8 8 0 0 1-8-8V168a8 8 0 0 1 8-8h64a8 8 0 0 1 8 8v688a8 8 0 0 1-8 8')); exports.StepForwardFill = getIcon('step-forward', fill, getNode(normalViewBox, 'M676.4 528.95L293.2 829.97c-14.25 11.2-35.2 1.1-35.2-16.95V210.97c0-18.05 20.95-28.14 35.2-16.94l383.2 301.02a21.53 21.53 0 0 1 0 33.9M694 864h64a8 8 0 0 0 8-8V168a8 8 0 0 0-8-8h-64a8 8 0 0 0-8 8v688a8 8 0 0 0 8 8')); exports.TabletFill = getIcon('tablet', fill, getNode(newViewBox, 'M800 64H224c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h576c35.3 0 64-28.7 64-64V128c0-35.3-28.7-64-64-64zM512 824c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40z')); exports.SwitcherFill = getIcon('switcher', fill, getNode(newViewBox, 'M752 240H144c-17.7 0-32 14.3-32 32v608c0 17.7 14.3 32 32 32h608c17.7 0 32-14.3 32-32V272c0-17.7-14.3-32-32-32zM596 606c0 4.4-3.6 8-8 8H308c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h280c4.4 0 8 3.6 8 8v48zm284-494H264c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h576v576c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32z')); exports.TagFill = getIcon('tag', fill, getNode(newViewBox, 'M938 458.8l-29.6-312.6c-1.5-16.2-14.4-29-30.6-30.6L565.2 86h-.4c-3.2 0-5.7 1-7.6 2.9L88.9 557.2a9.96 9.96 0 0 0 0 14.1l363.8 363.8c1.9 1.9 4.4 2.9 7.1 2.9s5.2-1 7.1-2.9l468.3-468.3c2-2.1 3-5 2.8-8zM699 387c-35.3 0-64-28.7-64-64s28.7-64 64-64 64 28.7 64 64-28.7 64-64 64z')); exports.StopFill = getIcon('stop', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm234.8 736.5L223.5 277.2c16-19.7 34-37.7 53.7-53.7l523.3 523.3c-16 19.6-34 37.7-53.7 53.7z')); exports.TaobaoCircleFill = getIcon('taobao-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zM315.7 291.5c27.3 0 49.5 22.1 49.5 49.4s-22.1 49.4-49.5 49.4a49.4 49.4 0 1 1 0-98.8zM366.9 578c-13.6 42.3-10.2 26.7-64.4 144.5l-78.5-49s87.7-79.8 105.6-116.2c19.2-38.4-21.1-58.9-21.1-58.9l-60.2-37.5 32.7-50.2c45.4 33.7 48.7 36.6 79.2 67.2 23.8 23.9 20.7 56.8 6.7 100.1zm427.2 55c-15.3 143.8-202.4 90.3-202.4 90.3l10.2-41.1 43.3 9.3c80 5 72.3-64.9 72.3-64.9V423c.6-77.3-72.6-85.4-204.2-38.3l30.6 8.3c-2.5 9-12.5 23.2-25.2 38.6h176v35.6h-99.1v44.5h98.7v35.7h-98.7V622c14.9-4.8 28.6-11.5 40.5-20.5l-8.7-32.5 46.5-14.4 38.8 94.9-57.3 23.9-10.2-37.8c-25.6 19.5-78.8 48-171.8 45.4-99.2 2.6-73.7-112-73.7-112l2.5-1.3H472c-.5 14.7-6.6 38.7 1.7 51.8 6.8 10.8 24.2 12.6 35.3 13.1 1.3.1 2.6.1 3.9.1v-85.3h-101v-35.7h101v-44.5H487c-22.7 24.1-43.5 44.1-43.5 44.1l-30.6-26.7c21.7-22.9 43.3-59.1 56.8-83.2-10.9 4.4-22 9.2-33.6 14.2-11.2 14.3-24.2 29-38.7 43.5.5.8-50-28.4-50-28.4 52.2-44.4 81.4-139.9 81.4-139.9l72.5 20.4s-5.9 14-18.4 35.6c290.3-82.3 307.4 50.5 307.4 50.5s19.1 91.8 3.8 235.7z')); exports.TaobaoSquareFill = getIcon('taobao-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM315.7 291.5c27.3 0 49.5 22.1 49.5 49.4s-22.1 49.4-49.5 49.4a49.4 49.4 0 1 1 0-98.8zM366.9 578c-13.6 42.3-10.2 26.7-64.4 144.5l-78.5-49s87.7-79.8 105.6-116.2c19.2-38.4-21.1-58.9-21.1-58.9l-60.2-37.5 32.7-50.2c45.4 33.7 48.7 36.6 79.2 67.2 23.8 23.9 20.7 56.8 6.7 100.1zm427.2 55c-15.3 143.8-202.4 90.3-202.4 90.3l10.2-41.1 43.3 9.3c80 5 72.3-64.9 72.3-64.9V423c.6-77.3-72.6-85.4-204.2-38.3l30.6 8.3c-2.5 9-12.5 23.2-25.2 38.6h176v35.6h-99.1v44.5h98.7v35.7h-98.7V622c14.9-4.8 28.6-11.5 40.5-20.5l-8.7-32.5 46.5-14.4 38.8 94.9-57.3 23.9-10.2-37.8c-25.6 19.5-78.8 48-171.8 45.4-99.2 2.6-73.7-112-73.7-112l2.5-1.3H472c-.5 14.7-6.6 38.7 1.7 51.8 6.8 10.8 24.2 12.6 35.3 13.1 1.3.1 2.6.1 3.9.1v-85.3h-101v-35.7h101v-44.5H487c-22.7 24.1-43.5 44.1-43.5 44.1l-30.6-26.7c21.7-22.9 43.3-59.1 56.8-83.2-10.9 4.4-22 9.2-33.6 14.2-11.2 14.3-24.2 29-38.7 43.5.5.8-50-28.4-50-28.4 52.2-44.4 81.4-139.9 81.4-139.9l72.5 20.4s-5.9 14-18.4 35.6c290.3-82.3 307.4 50.5 307.4 50.5s19.1 91.8 3.8 235.7z')); exports.TagsFill = getIcon('tags', fill, getNode(newViewBox, 'M483.2 790.3L861.4 412c1.7-1.7 2.5-4 2.3-6.3l-25.5-301.4c-.7-7.8-6.8-13.9-14.6-14.6L522.2 64.3c-2.3-.2-4.7.6-6.3 2.3L137.7 444.8a8.03 8.03 0 0 0 0 11.3l334.2 334.2c3.1 3.2 8.2 3.2 11.3 0zm122.7-533.4c18.7-18.7 49.1-18.7 67.9 0 18.7 18.7 18.7 49.1 0 67.9-18.7 18.7-49.1 18.7-67.9 0-18.7-18.7-18.7-49.1 0-67.9zm283.8 282.9l-39.6-39.5a8.03 8.03 0 0 0-11.3 0l-362 361.3-237.6-237a8.03 8.03 0 0 0-11.3 0l-39.6 39.5a8.03 8.03 0 0 0 0 11.3l243.2 242.8 39.6 39.5c3.1 3.1 8.2 3.1 11.3 0l407.3-406.6c3.1-3.1 3.1-8.2 0-11.3z')); exports.ToolFill = getIcon('tool', fill, getNode(newViewBox, 'M865.3 244.7c-.3-.3-61.1 59.8-182.1 180.6l-84.9-84.9 180.9-180.9c-95.2-57.3-217.5-42.6-296.8 36.7A244.42 244.42 0 0 0 419 432l1.8 6.7-283.5 283.4c-6.2 6.2-6.2 16.4 0 22.6l141.4 141.4c6.2 6.2 16.4 6.2 22.6 0l283.3-283.3 6.7 1.8c83.7 22.3 173.6-.9 236-63.3 79.4-79.3 94.1-201.6 38-296.6z')); exports.ThunderboltFill = getIcon('thunderbolt', fill, getNode(newViewBox, 'M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7z')); exports.TrademarkCircleFill = getIcon('trademark-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm164.7 660.2c-1.1.5-2.3.8-3.5.8h-62c-3.1 0-5.9-1.8-7.2-4.6l-74.6-159.2h-88.7V717c0 4.4-3.6 8-8 8H378c-4.4 0-8-3.6-8-8V307c0-4.4 3.6-8 8-8h155.6c98.8 0 144.2 59.9 144.2 131.1 0 70.2-43.6 106.4-78.4 119.2l80.8 164.2c2.1 3.9.4 8.7-3.5 10.7zM523.9 357h-83.4v148H522c53 0 82.8-25.6 82.8-72.4 0-50.3-32.9-75.6-80.9-75.6z')); exports.TwitterCircleFill = getIcon('twitter-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm215.3 337.7c.3 4.7.3 9.6.3 14.4 0 146.8-111.8 315.9-316.1 315.9-63 0-121.4-18.3-170.6-49.8 9 1 17.6 1.4 26.8 1.4 52 0 99.8-17.6 137.9-47.4-48.8-1-89.8-33-103.8-77 17.1 2.5 32.5 2.5 50.1-2a111 111 0 0 1-88.9-109v-1.4c14.7 8.3 32 13.4 50.1 14.1a111.13 111.13 0 0 1-49.5-92.4c0-20.7 5.4-39.6 15.1-56a315.28 315.28 0 0 0 229 116.1C492 353.1 548.4 292 616.2 292c32 0 60.8 13.4 81.1 35 25.1-4.7 49.1-14.1 70.5-26.7-8.3 25.7-25.7 47.4-48.8 61.1 22.4-2.4 44-8.6 64-17.3-15.1 22.2-34 41.9-55.7 57.6z')); exports.TrophyFill = getIcon('trophy', fill, getNode(newViewBox, 'M868 160h-92v-40c0-4.4-3.6-8-8-8H256c-4.4 0-8 3.6-8 8v40h-92a44 44 0 0 0-44 44v148c0 81.7 60 149.6 138.2 162C265.6 630.2 359 721.8 476 734.5v105.2H280c-17.7 0-32 14.3-32 32V904c0 4.4 3.6 8 8 8h512c4.4 0 8-3.6 8-8v-32.3c0-17.7-14.3-32-32-32H548V734.5C665 721.8 758.4 630.2 773.8 514 852 501.6 912 433.7 912 352V204a44 44 0 0 0-44-44zM248 439.6c-37.1-11.9-64-46.7-64-87.6V232h64v207.6zM840 352c0 41-26.9 75.8-64 87.6V232h64v120z')); exports.TwitterSquareFill = getIcon('twitter-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM727.3 401.7c.3 4.7.3 9.6.3 14.4 0 146.8-111.8 315.9-316.1 315.9-63 0-121.4-18.3-170.6-49.8 9 1 17.6 1.4 26.8 1.4 52 0 99.8-17.6 137.9-47.4-48.8-1-89.8-33-103.8-77 17.1 2.5 32.5 2.5 50.1-2a111 111 0 0 1-88.9-109v-1.4c14.7 8.3 32 13.4 50.1 14.1a111.13 111.13 0 0 1-49.5-92.4c0-20.7 5.4-39.6 15.1-56a315.28 315.28 0 0 0 229 116.1C492 353.1 548.4 292 616.2 292c32 0 60.8 13.4 81.1 35 25.1-4.7 49.1-14.1 70.5-26.7-8.3 25.7-25.7 47.4-48.8 61.1 22.4-2.4 44-8.6 64-17.3-15.1 22.2-34 41.9-55.7 57.6z')); exports.UpCircleFill = getIcon('up-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm178 555h-46.9c-10.2 0-19.9-4.9-25.9-13.2L512 460.4 406.8 605.8c-6 8.3-15.6 13.2-25.9 13.2H334c-6.5 0-10.3-7.4-6.5-12.7l178-246c3.2-4.4 9.7-4.4 12.9 0l178 246c3.9 5.3.1 12.7-6.4 12.7z')); exports.UnlockFill = getIcon('unlock', fill, getNode(newViewBox, 'M832 464H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v68c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-68c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM540 701v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 1 1 56 0z')); exports.UsbFill = getIcon('usb', fill, getNode(newViewBox, 'M408 312h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm352 120V144c0-17.7-14.3-32-32-32H296c-17.7 0-32 14.3-32 32v288c-66.2 0-120 52.1-120 116v356c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8V548c0-63.9-53.8-116-120-116zm-72 0H336V184h352v248zM568 312h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z')); exports.UpSquareFill = getIcon('up-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM690 624h-46.9c-10.2 0-19.9-4.9-25.9-13.2L512 465.4 406.8 610.8c-6 8.3-15.6 13.2-25.9 13.2H334c-6.5 0-10.3-7.4-6.5-12.7l178-246c3.2-4.4 9.7-4.4 12.9 0l178 246c3.9 5.3.1 12.7-6.4 12.7z')); exports.VideoCameraFill = getIcon('video-camera', fill, getNode(newViewBox, 'M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM328 352c0 4.4-3.6 8-8 8H208c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h112c4.4 0 8 3.6 8 8v48zm560 273l-104-59.8V458.9L888 399v226z')); exports.WarningFill = getIcon('warning', fill, getNode(newViewBox, 'M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z')); exports.WalletFill = getIcon('wallet', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-32 464H528V448h320v128zm-268-64a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.WechatFill = getIcon('wechat', fill, getNode(newViewBox, 'M690.1 377.4c5.9 0 11.8.2 17.6.5-24.4-128.7-158.3-227.1-319.9-227.1C209 150.8 64 271.4 64 420.2c0 81.1 43.6 154.2 111.9 203.6a21.5 21.5 0 0 1 9.1 17.6c0 2.4-.5 4.6-1.1 6.9-5.5 20.3-14.2 52.8-14.6 54.3-.7 2.6-1.7 5.2-1.7 7.9 0 5.9 4.8 10.8 10.8 10.8 2.3 0 4.2-.9 6.2-2l70.9-40.9c5.3-3.1 11-5 17.2-5 3.2 0 6.4.5 9.5 1.4 33.1 9.5 68.8 14.8 105.7 14.8 6 0 11.9-.1 17.8-.4-7.1-21-10.9-43.1-10.9-66 0-135.8 132.2-245.8 295.3-245.8zm-194.3-86.5c23.8 0 43.2 19.3 43.2 43.1s-19.3 43.1-43.2 43.1c-23.8 0-43.2-19.3-43.2-43.1s19.4-43.1 43.2-43.1zm-215.9 86.2c-23.8 0-43.2-19.3-43.2-43.1s19.3-43.1 43.2-43.1 43.2 19.3 43.2 43.1-19.4 43.1-43.2 43.1zm586.8 415.6c56.9-41.2 93.2-102 93.2-169.7 0-124-120.8-224.5-269.9-224.5-149 0-269.9 100.5-269.9 224.5S540.9 847.5 690 847.5c30.8 0 60.6-4.4 88.1-12.3 2.6-.8 5.2-1.2 7.9-1.2 5.2 0 9.9 1.6 14.3 4.1l59.1 34c1.7 1 3.3 1.7 5.2 1.7a9 9 0 0 0 6.4-2.6 9 9 0 0 0 2.6-6.4c0-2.2-.9-4.4-1.4-6.6-.3-1.2-7.6-28.3-12.2-45.3-.5-1.9-.9-3.8-.9-5.7.1-5.9 3.1-11.2 7.6-14.5zM600.2 587.2c-19.9 0-36-16.1-36-35.9 0-19.8 16.1-35.9 36-35.9s36 16.1 36 35.9c0 19.8-16.2 35.9-36 35.9zm179.9 0c-19.9 0-36-16.1-36-35.9 0-19.8 16.1-35.9 36-35.9s36 16.1 36 35.9a36.08 36.08 0 0 1-36 35.9z')); exports.WeiboCircleFill = getIcon('weibo-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-44.4 672C353.1 736 236 680.4 236 588.9c0-47.8 30.2-103.1 82.3-155.3 69.5-69.6 150.6-101.4 181.1-70.8 13.5 13.5 14.8 36.8 6.1 64.6-4.5 14 13.1 6.3 13.1 6.3 56.2-23.6 105.2-25 123.1.7 9.6 13.7 8.6 32.8-.2 55.1-4.1 10.2 1.3 11.8 9 14.1 31.7 9.8 66.9 33.6 66.9 75.5.2 69.5-99.7 156.9-249.8 156.9zm207.3-290.8a34.9 34.9 0 0 0-7.2-34.1 34.68 34.68 0 0 0-33.1-10.7 18.24 18.24 0 0 1-7.6-35.7c24.1-5.1 50.1 2.3 67.7 21.9 17.7 19.6 22.4 46.3 14.9 69.8a18.13 18.13 0 0 1-22.9 11.7 18.18 18.18 0 0 1-11.8-22.9zm106 34.3s0 .1 0 0a21.1 21.1 0 0 1-26.6 13.7 21.19 21.19 0 0 1-13.6-26.7c11-34.2 4-73.2-21.7-101.8a104.04 104.04 0 0 0-98.9-32.1 21.14 21.14 0 0 1-25.1-16.3 21.07 21.07 0 0 1 16.2-25.1c49.4-10.5 102.8 4.8 139.1 45.1 36.3 40.2 46.1 95.1 30.6 143.2zm-334.5 6.1c-91.4 9-160.7 65.1-154.7 125.2 5.9 60.1 84.8 101.5 176.2 92.5 91.4-9.1 160.7-65.1 154.7-125.3-5.9-60.1-84.8-101.5-176.2-92.4zm80.2 141.7c-18.7 42.3-72.3 64.8-117.8 50.1-43.9-14.2-62.5-57.7-43.3-96.8 18.9-38.4 68-60.1 111.5-48.8 45 11.7 68 54.2 49.6 95.5zm-93-32.2c-14.2-5.9-32.4.2-41.2 13.9-8.8 13.8-4.7 30.2 9.3 36.6 14.3 6.5 33.2.3 42-13.8 8.8-14.3 4.2-30.6-10.1-36.7zm34.9-14.5c-5.4-2.2-12.2.5-15.4 5.8-3.1 5.4-1.4 11.5 4.1 13.8 5.5 2.3 12.6-.3 15.8-5.8 3-5.6 1-11.8-4.5-13.8z')); exports.WeiboSquareFill = getIcon('weibo-square', fill, getNode(newViewBox, 'M433.6 595.1c-14.2-5.9-32.4.2-41.2 13.9-8.8 13.8-4.7 30.2 9.3 36.6 14.3 6.5 33.2.3 42-13.8 8.8-14.3 4.2-30.6-10.1-36.7zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM467.6 736C353.1 736 236 680.4 236 588.9c0-47.8 30.2-103.1 82.3-155.3 69.5-69.6 150.6-101.4 181.1-70.8 13.5 13.5 14.8 36.8 6.1 64.6-4.5 14 13.1 6.3 13.1 6.3 56.2-23.6 105.2-25 123.1.7 9.6 13.7 8.6 32.8-.2 55.1-4.1 10.2 1.3 11.8 9 14.1 31.7 9.8 66.9 33.6 66.9 75.5.2 69.5-99.7 156.9-249.8 156.9zm207.3-290.8a34.9 34.9 0 0 0-7.2-34.1 34.68 34.68 0 0 0-33.1-10.7 18.24 18.24 0 0 1-7.6-35.7c24.1-5.1 50.1 2.3 67.7 21.9 17.7 19.6 22.4 46.3 14.9 69.8a18.13 18.13 0 0 1-22.9 11.7 18.18 18.18 0 0 1-11.8-22.9zm106 34.3s0 .1 0 0a21.1 21.1 0 0 1-26.6 13.7 21.19 21.19 0 0 1-13.6-26.7c11-34.2 4-73.2-21.7-101.8a104.04 104.04 0 0 0-98.9-32.1 21.14 21.14 0 0 1-25.1-16.3 21.07 21.07 0 0 1 16.2-25.1c49.4-10.5 102.8 4.8 139.1 45.1 36.3 40.2 46.1 95.1 30.6 143.2zm-334.5 6.1c-91.4 9-160.7 65.1-154.7 125.2 5.9 60.1 84.8 101.5 176.2 92.5 91.4-9.1 160.7-65.1 154.7-125.3-5.9-60.1-84.8-101.5-176.2-92.4zm80.2 141.7c-18.7 42.3-72.3 64.8-117.8 50.1-43.9-14.2-62.5-57.7-43.3-96.8 18.9-38.4 68-60.1 111.5-48.8 45 11.7 68 54.2 49.6 95.5zm-58.1-46.7c-5.4-2.2-12.2.5-15.4 5.8-3.1 5.4-1.4 11.5 4.1 13.8 5.5 2.3 12.6-.3 15.8-5.8 3-5.6 1-11.8-4.5-13.8z')); exports.WindowsFill = getIcon('windows', fill, getNode(newViewBox, 'M523.8 191.4v288.9h382V128.1zm0 642.2l382 62.2v-352h-382zM120.1 480.2H443V201.9l-322.9 53.5zm0 290.4L443 823.2V543.8H120.1z')); exports.YoutubeFill = getIcon('youtube', fill, getNode(newViewBox, 'M941.3 296.1a112.3 112.3 0 0 0-79.2-79.3C792.2 198 512 198 512 198s-280.2 0-350.1 18.7A112.12 112.12 0 0 0 82.7 296C64 366 64 512 64 512s0 146 18.7 215.9c10.3 38.6 40.7 69 79.2 79.3C231.8 826 512 826 512 826s280.2 0 350.1-18.8c38.6-10.3 68.9-40.7 79.2-79.3C960 658 960 512 960 512s0-146-18.7-215.9zM423 646V378l232 133-232 135z')); exports.ZhihuCircleFill = getIcon('zhihu-circle', fill, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-90.7 477.8l-.1 1.5c-1.5 20.4-6.3 43.9-12.9 67.6l24-18.1 71 80.7c9.2 33-3.3 63.1-3.3 63.1l-95.7-111.9v-.1c-8.9 29-20.1 57.3-33.3 84.7-22.6 45.7-55.2 54.7-89.5 57.7-34.4 3-23.3-5.3-23.3-5.3 68-55.5 78-87.8 96.8-123.1 11.9-22.3 20.4-64.3 25.3-96.8H264.1s4.8-31.2 19.2-41.7h101.6c.6-15.3-1.3-102.8-2-131.4h-49.4c-9.2 45-41 56.7-48.1 60.1-7 3.4-23.6 7.1-21.1 0 2.6-7.1 27-46.2 43.2-110.7 16.3-64.6 63.9-62 63.9-62-12.8 22.5-22.4 73.6-22.4 73.6h159.7c10.1 0 10.6 39 10.6 39h-90.8c-.7 22.7-2.8 83.8-5 131.4H519s12.2 15.4 12.2 41.7H421.3zm346.5 167h-87.6l-69.5 46.6-16.4-46.6h-40.1V321.5h213.6v387.3zM408.2 611s0-.1 0 0zm216 94.3l56.8-38.1h45.6-.1V364.7H596.7v302.5h14.1z')); exports.YahooFill = getIcon('yahoo', fill, getNode(newViewBox, 'M937.3 231H824.7c-15.5 0-27.7 12.6-27.1 28.1l13.1 366h84.4l65.4-366.4c2.7-15.2-7.8-27.7-23.2-27.7zm-77.4 450.4h-14.1c-27.1 0-49.2 22.2-49.2 49.3v14.1c0 27.1 22.2 49.3 49.2 49.3h14.1c27.1 0 49.2-22.2 49.2-49.3v-14.1c0-27.1-22.2-49.3-49.2-49.3zM402.6 231C216.2 231 65 357 65 512.5S216.2 794 402.6 794s337.6-126 337.6-281.5S589.1 231 402.6 231zm225.2 225.2h-65.3L458.9 559.8v65.3h84.4v56.3H318.2v-56.3h84.4v-65.3L242.9 399.9h-37v-56.3h168.5v56.3h-37l93.4 93.5 28.1-28.1V400h168.8v56.2z')); exports.ZhihuSquareFill = getIcon('zhihu-square', fill, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM432.3 592.8l71 80.7c9.2 33-3.3 63.1-3.3 63.1l-95.7-111.9v-.1c-8.9 29-20.1 57.3-33.3 84.7-22.6 45.7-55.2 54.7-89.5 57.7-34.4 3-23.3-5.3-23.3-5.3 68-55.5 78-87.8 96.8-123.1 11.9-22.3 20.4-64.3 25.3-96.8H264.1s4.8-31.2 19.2-41.7h101.6c.6-15.3-1.3-102.8-2-131.4h-49.4c-9.2 45-41 56.7-48.1 60.1-7 3.4-23.6 7.1-21.1 0 2.6-7.1 27-46.2 43.2-110.7 16.3-64.6 63.9-62 63.9-62-12.8 22.5-22.4 73.6-22.4 73.6h159.7c10.1 0 10.6 39 10.6 39h-90.8c-.7 22.7-2.8 83.8-5 131.4H519s12.2 15.4 12.2 41.7h-110l-.1 1.5c-1.5 20.4-6.3 43.9-12.9 67.6l24.1-18.1zm335.5 116h-87.6l-69.5 46.6-16.4-46.6h-40.1V321.5h213.6v387.3zM408.2 611s0-.1 0 0zm216 94.3l56.8-38.1h45.6-.1V364.7H596.7v302.5h14.1z')); exports.AccountBookOutline = getIcon('account-book', outline, getNode(newViewBox, 'M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v584zM639.5 414h-45c-3 0-5.8 1.7-7.1 4.4L514 563.8h-2.8l-73.4-145.4a8 8 0 0 0-7.1-4.4h-46c-1.3 0-2.7.3-3.8 1-3.9 2.1-5.3 7-3.2 10.9l89.3 164h-48.6c-4.4 0-8 3.6-8 8v21.3c0 4.4 3.6 8 8 8h65.1v33.7h-65.1c-4.4 0-8 3.6-8 8v21.3c0 4.4 3.6 8 8 8h65.1V752c0 4.4 3.6 8 8 8h41.3c4.4 0 8-3.6 8-8v-53.8h65.4c4.4 0 8-3.6 8-8v-21.3c0-4.4-3.6-8-8-8h-65.4v-33.7h65.4c4.4 0 8-3.6 8-8v-21.3c0-4.4-3.6-8-8-8h-49.1l89.3-164.1c.6-1.2 1-2.5 1-3.8.1-4.4-3.4-8-7.9-8z')); exports.YuqueFill = getIcon('yuque', fill, getNode(newViewBox, 'M854.6 370.6c-9.9-39.4 9.9-102.2 73.4-124.4l-67.9-3.6s-25.7-90-143.6-98c-117.9-8.1-195-3-195-3s87.4 55.6 52.4 154.7c-25.6 52.5-65.8 95.6-108.8 144.7-1.3 1.3-2.5 2.6-3.5 3.7C319.4 605 96 860 96 860c245.9 64.4 410.7-6.3 508.2-91.1 20.5-.2 35.9-.3 46.3-.3 135.8 0 250.6-117.6 245.9-248.4-3.2-89.9-31.9-110.2-41.8-149.6z')); exports.AlertOutline = getIcon('alert', outline, getNode(newViewBox, 'M193 796c0 17.7 14.3 32 32 32h574c17.7 0 32-14.3 32-32V563c0-176.2-142.8-319-319-319S193 386.8 193 563v233zm72-233c0-136.4 110.6-247 247-247s247 110.6 247 247v193H404V585c0-5.5-4.5-10-10-10h-44c-5.5 0-10 4.5-10 10v171h-75V563zm-48.1-252.5l39.6-39.6c3.1-3.1 3.1-8.2 0-11.3l-67.9-67.9a8.03 8.03 0 0 0-11.3 0l-39.6 39.6a8.03 8.03 0 0 0 0 11.3l67.9 67.9c3.1 3.1 8.1 3.1 11.3 0zm669.6-79.2l-39.6-39.6a8.03 8.03 0 0 0-11.3 0l-67.9 67.9a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l67.9-67.9c3.1-3.2 3.1-8.2 0-11.3zM832 892H192c-17.7 0-32 14.3-32 32v24c0 4.4 3.6 8 8 8h688c4.4 0 8-3.6 8-8v-24c0-17.7-14.3-32-32-32zM484 180h56c4.4 0 8-3.6 8-8V76c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v96c0 4.4 3.6 8 8 8z')); exports.AliwangwangOutline = getIcon('aliwangwang', outline, getNode(newViewBox, 'M868.2 377.4c-18.9-45.1-46.3-85.6-81.2-120.6a377.26 377.26 0 0 0-120.5-81.2A375.65 375.65 0 0 0 519 145.8c-41.9 0-82.9 6.7-121.9 20C306 123.3 200.8 120 170.6 120c-2.2 0-7.4 0-9.4.2-11.9.4-22.8 6.5-29.2 16.4-6.5 9.9-7.7 22.4-3.4 33.5l64.3 161.6a378.59 378.59 0 0 0-52.8 193.2c0 51.4 10 101 29.8 147.6 18.9 45 46.2 85.6 81.2 120.5 34.7 34.8 75.4 62.1 120.5 81.2C418.3 894 467.9 904 519 904c51.3 0 100.9-10.1 147.7-29.8 44.9-18.9 85.5-46.3 120.4-81.2 34.7-34.8 62.1-75.4 81.2-120.6a376.5 376.5 0 0 0 29.8-147.6c-.2-51.2-10.1-100.8-29.9-147.4zm-66.4 266.5a307.08 307.08 0 0 1-65.9 98c-28.4 28.5-61.3 50.7-97.7 65.9h-.1c-38 16-78.3 24.2-119.9 24.2a306.51 306.51 0 0 1-217.5-90.2c-28.4-28.5-50.6-61.4-65.8-97.8v-.1c-16-37.8-24.1-78.2-24.1-119.9 0-55.4 14.8-109.7 42.8-157l13.2-22.1-9.5-23.9L206 192c14.9.6 35.9 2.1 59.7 5.6 43.8 6.5 82.5 17.5 114.9 32.6l19 8.9 19.9-6.8c31.5-10.8 64.8-16.2 98.9-16.2a306.51 306.51 0 0 1 217.5 90.2c28.4 28.5 50.6 61.4 65.8 97.8l.1.1.1.1c16 37.6 24.1 78 24.2 119.8-.1 41.7-8.3 82-24.3 119.8zM681.1 364.2c-20.4 0-37.1 16.7-37.1 37.1v55.1c0 20.4 16.6 37.1 37.1 37.1s37.1-16.7 37.1-37.1v-55.1c0-20.5-16.7-37.1-37.1-37.1zm-175.2 0c-20.5 0-37.1 16.7-37.1 37.1v55.1c0 20.4 16.7 37.1 37.1 37.1 20.5 0 37.1-16.7 37.1-37.1v-55.1c0-20.5-16.7-37.1-37.1-37.1z')); exports.AlipayCircleOutline = getIcon('alipay-circle', outline, getNode(newViewBox, 'M308.6 545.7c-19.8 2-57.1 10.7-77.4 28.6-61 53-24.5 150 99 150 71.8 0 143.5-45.7 199.8-119-80.2-38.9-148.1-66.8-221.4-59.6zm460.5 67c100.1 33.4 154.7 43 166.7 44.8A445.9 445.9 0 0 0 960 512c0-247.4-200.6-448-448-448S64 264.6 64 512s200.6 448 448 448c155.9 0 293.2-79.7 373.5-200.5-75.6-29.8-213.6-85-286.8-120.1-69.9 85.7-160.1 137.8-253.7 137.8-158.4 0-212.1-138.1-137.2-229 16.3-19.8 44.2-38.7 87.3-49.4 67.5-16.5 175 10.3 275.7 43.4 18.1-33.3 33.4-69.9 44.7-108.9H305.1V402h160v-56.2H271.3v-31.3h193.8v-80.1s0-13.5 13.7-13.5H557v93.6h191.7v31.3H557.1V402h156.4c-15 61.1-37.7 117.4-66.2 166.8 47.5 17.1 90.1 33.3 121.8 43.9z')); exports.AndroidOutline = getIcon('android', outline, getNode(newViewBox, 'M448.3 225.2c-18.6 0-32 13.4-32 31.9s13.5 31.9 32 31.9c18.6 0 32-13.4 32-31.9.1-18.4-13.4-31.9-32-31.9zm393.9 96.4c-13.8-13.8-32.7-21.5-53.2-21.5-3.9 0-7.4.4-10.7 1v-1h-3.6c-5.5-30.6-18.6-60.5-38.1-87.4-18.7-25.7-43-47.9-70.8-64.9l25.1-35.8v-3.3c0-.8.4-2.3.7-3.8.6-2.4 1.4-5.5 1.4-8.9 0-18.5-13.5-31.9-32-31.9-9.8 0-19.5 5.7-25.9 15.4l-29.3 42.1c-30-9.8-62.4-15-93.8-15-31.3 0-63.7 5.2-93.8 15L389 79.4c-6.6-9.6-16.1-15.4-26-15.4-18.6 0-32 13.4-32 31.9 0 6.2 2.5 12.8 6.7 17.4l22.6 32.3c-28.7 17-53.5 39.4-72.2 65.1-19.4 26.9-32 56.8-36.7 87.4h-5.5v1c-3.2-.6-6.7-1-10.7-1-20.3 0-39.2 7.5-53.1 21.3-13.8 13.8-21.5 32.6-21.5 53v235c0 20.3 7.5 39.1 21.4 52.9 13.8 13.8 32.8 21.5 53.2 21.5 3.9 0 7.4-.4 10.7-1v93.5c0 29.2 23.9 53.1 53.2 53.1H331v58.3c0 20.3 7.5 39.1 21.4 52.9 13.8 13.8 32.8 21.5 53.2 21.5 20.3 0 39.2-7.5 53.1-21.3 13.8-13.8 21.5-32.6 21.5-53v-58.2H544v58.1c0 20.3 7.5 39.1 21.4 52.9 13.8 13.8 32.8 21.5 53.2 21.5 20.4 0 39.2-7.5 53.1-21.6 13.8-13.8 21.5-32.6 21.5-53v-58.2h31.9c29.3 0 53.2-23.8 53.2-53.1v-91.4c3.2.6 6.7 1 10.7 1 20.3 0 39.2-7.5 53.1-21.3 13.8-13.8 21.5-32.6 21.5-53v-235c-.1-20.3-7.6-39-21.4-52.9zM246 609.6c0 6.8-3.9 10.6-10.7 10.6-6.8 0-10.7-3.8-10.7-10.6V374.5c0-6.8 3.9-10.6 10.7-10.6 6.8 0 10.7 3.8 10.7 10.6v235.1zm131.1-396.8c37.5-27.3 85.3-42.3 135-42.3s97.5 15.1 135 42.5c32.4 23.7 54.2 54.2 62.7 87.5H314.4c8.5-33.4 30.5-64 62.7-87.7zm39.3 674.7c-.6 5.6-4.4 8.7-10.5 8.7-6.8 0-10.7-3.8-10.7-10.6v-58.2h21.2v60.1zm202.3 8.7c-6.8 0-10.7-3.8-10.7-10.6v-58.2h21.2v60.1c-.6 5.6-4.3 8.7-10.5 8.7zm95.8-132.6H309.9V364h404.6v399.6zm85.2-154c0 6.8-3.9 10.6-10.7 10.6-6.8 0-10.7-3.8-10.7-10.6V374.5c0-6.8 3.9-10.6 10.7-10.6 6.8 0 10.7 3.8 10.7 10.6v235.1zM576.1 225.2c-18.6 0-32 13.4-32 31.9s13.5 31.9 32 31.9c18.6 0 32.1-13.4 32.1-32-.1-18.6-13.4-31.8-32.1-31.8z')); exports.AppstoreOutline = getIcon('appstore', outline, getNode(newViewBox, 'M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z')); exports.AppleOutline = getIcon('apple', outline, getNode(newViewBox, 'M747.4 535.7c-.4-68.2 30.5-119.6 92.9-157.5-34.9-50-87.7-77.5-157.3-82.8-65.9-5.2-138 38.4-164.4 38.4-27.9 0-91.7-36.6-141.9-36.6C273.1 298.8 163 379.8 163 544.6c0 48.7 8.9 99 26.7 150.8 23.8 68.2 109.6 235.3 199.1 232.6 46.8-1.1 79.9-33.2 140.8-33.2 59.1 0 89.7 33.2 141.9 33.2 90.3-1.3 167.9-153.2 190.5-221.6-121.1-57.1-114.6-167.2-114.6-170.7zm-10.6 267c-14.3 19.9-28.7 35.6-41.9 45.7-10.5 8-18.6 11.4-24 11.6-9-.1-17.7-2.3-34.7-8.8-1.2-.5-2.5-1-4.2-1.6l-4.4-1.7c-17.4-6.7-27.8-10.3-41.1-13.8-18.6-4.8-37.1-7.4-56.9-7.4-20.2 0-39.2 2.5-58.1 7.2-13.9 3.5-25.6 7.4-42.7 13.8-.7.3-8.1 3.1-10.2 3.9-3.5 1.3-6.2 2.3-8.7 3.2-10.4 3.6-17 5.1-22.9 5.2-.7 0-1.3-.1-1.8-.2-1.1-.2-2.5-.6-4.1-1.3-4.5-1.8-9.9-5.1-16-9.8-14-10.9-29.4-28-45.1-49.9-27.5-38.6-53.5-89.8-66-125.7-15.4-44.8-23-87.7-23-128.6 0-60.2 17.8-106 48.4-137.1 26.3-26.6 61.7-41.5 97.8-42.3 5.9.1 14.5 1.5 25.4 4.5 8.6 2.3 18 5.4 30.7 9.9 3.8 1.4 16.9 6.1 18.5 6.7 7.7 2.8 13.5 4.8 19.2 6.6 18.2 5.8 32.3 9 47.6 9 15.5 0 28.8-3.3 47.7-9.8 7.1-2.4 32.9-12 37.5-13.6 25.6-9.1 44.5-14 60.8-15.2 4.8-.4 9.1-.4 13.2-.1 22.7 1.8 42.1 6.3 58.6 13.8-37.6 43.4-57 96.5-56.9 158.4-.3 14.7.9 31.7 5.1 51.8 6.4 30.5 18.6 60.7 37.9 89 14.7 21.5 32.9 40.9 54.7 57.8-11.5 23.7-25.6 48.2-40.4 68.8zm-94.5-572c50.7-60.2 46.1-115 44.6-134.7-44.8 2.6-96.6 30.5-126.1 64.8-32.5 36.8-51.6 82.3-47.5 133.6 48.4 3.7 92.6-21.2 129-63.7z')); exports.ApiOutline = getIcon('api', outline, getNode(newViewBox, 'M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 0 0-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 0 0 0 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 0 0-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 0 0-11.3 0L363 475.3l-43-43a7.85 7.85 0 0 0-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 0 0 0 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 0 1-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 0 1-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z')); exports.BackwardOutline = getIcon('backward', outline, getNode(normalViewBox, 'M485.6 249.9L198.2 498c-8.3 7.1-8.3 20.8 0 27.9l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9zm320 0L518.2 498a18.6 18.6 0 0 0-6.2 14c0 5.2 2.1 10.4 6.2 14l287.4 248.2c10.7 9.2 26.4.9 26.4-14V263.8c0-14.8-15.7-23.2-26.4-13.9z')); exports.AudioOutline = getIcon('audio', outline, getNode(newViewBox, 'M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z')); exports.BankOutline = getIcon('bank', outline, getNode(newViewBox, 'M894 462c30.9 0 43.8-39.7 18.7-58L530.8 126.2a31.81 31.81 0 0 0-37.6 0L111.3 404c-25.1 18.2-12.2 58 18.8 58H192v374h-72c-4.4 0-8 3.6-8 8v52c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-52c0-4.4-3.6-8-8-8h-72V462h62zM512 196.7l271.1 197.2H240.9L512 196.7zM264 462h117v374H264V462zm189 0h117v374H453V462zm307 374H642V462h118v374z')); exports.BehanceSquareOutline = getIcon('behance-square', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM598.5 350.9h138.4v33.7H598.5v-33.7zM512 628.8a89.52 89.52 0 0 1-27 31c-11.8 8.2-24.9 14.2-38.8 17.7a167.4 167.4 0 0 1-44.6 5.7H236V342.1h161c16.3 0 31.1 1.5 44.6 4.3 13.4 2.8 24.8 7.6 34.4 14.1 9.5 6.5 17 15.2 22.3 26 5.2 10.7 7.9 24.1 7.9 40 0 17.2-3.9 31.4-11.7 42.9-7.9 11.5-19.3 20.8-34.8 28.1 21.1 6 36.6 16.7 46.8 31.7 10.4 15.2 15.5 33.4 15.5 54.8 0 17.4-3.3 32.3-10 44.8zM790.8 576H612.4c0 19.4 6.7 38 16.8 48 10.2 9.9 24.8 14.9 43.9 14.9 13.8 0 25.5-3.5 35.5-10.4 9.9-6.9 15.9-14.2 18.1-21.8h59.8c-9.6 29.7-24.2 50.9-44 63.7-19.6 12.8-43.6 19.2-71.5 19.2-19.5 0-37-3.2-52.7-9.3-15.1-5.9-28.7-14.9-39.9-26.5a121.2 121.2 0 0 1-25.1-41.2c-6.1-16.9-9.1-34.7-8.9-52.6 0-18.5 3.1-35.7 9.1-51.7 11.5-31.1 35.4-56 65.9-68.9 16.3-6.8 33.8-10.2 51.5-10 21 0 39.2 4 55 12.2a111.6 111.6 0 0 1 38.6 32.8c10.1 13.7 17.2 29.3 21.7 46.9 4.3 17.3 5.8 35.5 4.6 54.7zm-122-95.6c-10.8 0-19.9 1.9-26.9 5.6-7 3.7-12.8 8.3-17.2 13.6a48.4 48.4 0 0 0-9.1 17.4c-1.6 5.3-2.7 10.7-3.1 16.2H723c-1.6-17.3-7.6-30.1-15.6-39.1-8.4-8.9-21.9-13.7-38.6-13.7zm-248.5-10.1c8.7-6.3 12.9-16.7 12.9-31 .3-6.8-1.1-13.5-4.1-19.6-2.7-4.9-6.7-9-11.6-11.9a44.8 44.8 0 0 0-16.6-6c-6.4-1.2-12.9-1.8-19.3-1.7h-70.3v79.7h76.1c13.1.1 24.2-3.1 32.9-9.5zm11.8 72c-9.8-7.5-22.9-11.2-39.2-11.2h-81.8v94h80.2c7.5 0 14.4-.7 21.1-2.1s12.7-3.8 17.8-7.2c5.1-3.3 9.2-7.8 12.3-13.6 3-5.8 4.5-13.2 4.5-22.1 0-17.7-5-30.2-14.9-37.8z')); exports.BookOutline = getIcon('book', outline, getNode(newViewBox, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zm220 752H232V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0 0 22.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752z')); exports.BoxPlotOutline = getIcon('box-plot', outline, getNode(newViewBox, 'M952 224h-52c-4.4 0-8 3.6-8 8v248h-92V304c0-4.4-3.6-8-8-8H232c-4.4 0-8 3.6-8 8v176h-92V232c0-4.4-3.6-8-8-8H72c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V548h92v172c0 4.4 3.6 8 8 8h560c4.4 0 8-3.6 8-8V548h92v244c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V232c0-4.4-3.6-8-8-8zM296 368h88v288h-88V368zm432 288H448V368h280v288z')); exports.BellOutline = getIcon('bell', outline, getNode(newViewBox, 'M816 768h-24V428c0-141.1-104.3-257.7-240-277.1V112c0-22.1-17.9-40-40-40s-40 17.9-40 40v38.9c-135.7 19.4-240 136-240 277.1v340h-24c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h216c0 61.8 50.2 112 112 112s112-50.2 112-112h216c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM512 888c-26.5 0-48-21.5-48-48h96c0 26.5-21.5 48-48 48zM304 768V428c0-55.6 21.6-107.8 60.9-147.1S456.4 220 512 220c55.6 0 107.8 21.6 147.1 60.9S720 372.4 720 428v340H304z')); exports.BulbOutline = getIcon('bulb', outline, getNode(newViewBox, 'M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z')); exports.BuildOutline = getIcon('build', outline, getNode(newViewBox, 'M916 210H376c-17.7 0-32 14.3-32 32v236H108c-17.7 0-32 14.3-32 32v272c0 17.7 14.3 32 32 32h540c17.7 0 32-14.3 32-32V546h236c17.7 0 32-14.3 32-32V242c0-17.7-14.3-32-32-32zm-504 68h200v200H412V278zm-68 468H144V546h200v200zm268 0H412V546h200v200zm268-268H680V278h200v200z')); exports.CameraOutline = getIcon('camera', outline, getNode(newViewBox, 'M864 248H728l-32.4-90.8a32.07 32.07 0 0 0-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 248H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V328c0-44.2-35.8-80-80-80zm8 536c0 4.4-3.6 8-8 8H160c-4.4 0-8-3.6-8-8V328c0-4.4 3.6-8 8-8h186.7l17.1-47.8 22.9-64.2h250.5l22.9 64.2 17.1 47.8H864c4.4 0 8 3.6 8 8v456zM512 384c-88.4 0-160 71.6-160 160s71.6 160 160 160 160-71.6 160-160-71.6-160-160-160zm0 256c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96z')); exports.CalculatorOutline = getIcon('calculator', outline, getNode(newViewBox, 'M251.2 387H320v68.8c0 1.8 1.8 3.2 4 3.2h48c2.2 0 4-1.4 4-3.3V387h68.8c1.8 0 3.2-1.8 3.2-4v-48c0-2.2-1.4-4-3.3-4H376v-68.8c0-1.8-1.8-3.2-4-3.2h-48c-2.2 0-4 1.4-4 3.2V331h-68.8c-1.8 0-3.2 1.8-3.2 4v48c0 2.2 1.4 4 3.2 4zm328 0h193.6c1.8 0 3.2-1.8 3.2-4v-48c0-2.2-1.4-4-3.3-4H579.2c-1.8 0-3.2 1.8-3.2 4v48c0 2.2 1.4 4 3.2 4zm0 265h193.6c1.8 0 3.2-1.8 3.2-4v-48c0-2.2-1.4-4-3.3-4H579.2c-1.8 0-3.2 1.8-3.2 4v48c0 2.2 1.4 4 3.2 4zm0 104h193.6c1.8 0 3.2-1.8 3.2-4v-48c0-2.2-1.4-4-3.3-4H579.2c-1.8 0-3.2 1.8-3.2 4v48c0 2.2 1.4 4 3.2 4zm-195.7-81l61.2-74.9c4.3-5.2.7-13.1-5.9-13.1H388c-2.3 0-4.5 1-5.9 2.9l-34 41.6-34-41.6a7.85 7.85 0 0 0-5.9-2.9h-50.9c-6.6 0-10.2 7.9-5.9 13.1l61.2 74.9-62.7 76.8c-4.4 5.2-.8 13.1 5.8 13.1h50.8c2.3 0 4.5-1 5.9-2.9l35.5-43.5 35.5 43.5c1.5 1.8 3.7 2.9 5.9 2.9h50.8c6.6 0 10.2-7.9 5.9-13.1L383.5 675zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-36 732H180V180h664v664z')); exports.CalendarOutline = getIcon('calendar', outline, getNode(newViewBox, 'M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z')); exports.CaretDownOutline = getIcon('caret-down', outline, getNode(normalViewBox, 'M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z')); exports.CarOutline = getIcon('car', outline, getNode(newViewBox, 'M380 704h264c4.4 0 8-3.6 8-8v-84c0-4.4-3.6-8-8-8h-40c-4.4 0-8 3.6-8 8v36H428v-36c0-4.4-3.6-8-8-8h-40c-4.4 0-8 3.6-8 8v84c0 4.4 3.6 8 8 8zm340-123a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm239-167.6L935.3 372a8 8 0 0 0-10.9-2.9l-50.7 29.6-78.3-216.2a63.9 63.9 0 0 0-60.9-44.4H301.2c-34.7 0-65.5 22.4-76.2 55.5l-74.6 205.2-50.8-29.6a8 8 0 0 0-10.9 2.9L65 413.4c-2.2 3.8-.9 8.6 2.9 10.8l60.4 35.2-14.5 40c-1.2 3.2-1.8 6.6-1.8 10v348.2c0 15.7 11.8 28.4 26.3 28.4h67.6c12.3 0 23-9.3 25.6-22.3l7.7-37.7h545.6l7.7 37.7c2.7 13 13.3 22.3 25.6 22.3h67.6c14.5 0 26.3-12.7 26.3-28.4V509.4c0-3.4-.6-6.8-1.8-10l-14.5-40 60.3-35.2a8 8 0 0 0 3-10.8zM840 517v237H184V517l15.6-43h624.8l15.6 43zM292.7 218.1l.5-1.3.4-1.3c1.1-3.3 4.1-5.5 7.6-5.5h427.6l75.4 208H220l72.7-199.9zM224 581a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.CaretRightOutline = getIcon('caret-right', outline, getNode(normalViewBox, 'M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z')); exports.CaretUpOutline = getIcon('caret-up', outline, getNode(normalViewBox, 'M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z')); exports.CaretLeftOutline = getIcon('caret-left', outline, getNode(normalViewBox, 'M689 165.1L308.2 493.5c-10.9 9.4-10.9 27.5 0 37L689 858.9c14.2 12.2 35 1.2 35-18.5V183.6c0-19.7-20.8-30.7-35-18.5z')); exports.CarryOutOutline = getIcon('carry-out', outline, getNode(newViewBox, 'M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v584zM688 420h-55.2c-5.1 0-10 2.5-13 6.6L468.9 634.4l-64.7-89c-3-4.1-7.8-6.6-13-6.6H336c-6.5 0-10.3 7.4-6.5 12.7l126.4 174a16.1 16.1 0 0 0 26 0l212.6-292.7c3.8-5.4 0-12.8-6.5-12.8z')); exports.CheckCircleOutline = getIcon('check-circle', outline, getNode(newViewBox, 'M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0 0 51.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z', 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z')); exports.ChromeOutline = getIcon('chrome', outline, getNode(newViewBox, 'M928 512.3v-.3c0-229.8-186.2-416-416-416S96 282.2 96 512v.4c0 229.8 186.2 416 416 416s416-186.2 416-416v-.3.2zm-6.7-74.6l.6 3.3-.6-3.3zM676.7 638.2c53.5-82.2 52.5-189.4-11.1-263.7l162.4-8.4c20.5 44.4 32 93.8 32 145.9 0 185.2-144.6 336.6-327.1 347.4l143.8-221.2zM512 652.3c-77.5 0-140.2-62.7-140.2-140.2 0-77.7 62.7-140.2 140.2-140.2S652.2 434.5 652.2 512 589.5 652.3 512 652.3zm369.2-331.7l-3-5.7 3 5.7zM512 164c121.3 0 228.2 62.1 290.4 156.2l-263.6-13.9c-97.5-5.7-190.2 49.2-222.3 141.1L227.8 311c63.1-88.9 166.9-147 284.2-147zM102.5 585.8c26 145 127.1 264 261.6 315.1C229.6 850 128.5 731 102.5 585.8zM164 512c0-55.9 13.2-108.7 36.6-155.5l119.7 235.4c44.1 86.7 137.4 139.7 234 121.6l-74 145.1C302.9 842.5 164 693.5 164 512zm324.7 415.4c4 .2 8 .4 12 .5-4-.2-8-.3-12-.5z')); exports.CheckSquareOutline = getIcon('check-square', outline, getNode(newViewBox, 'M433.1 657.7a31.8 31.8 0 0 0 51.7 0l210.6-292c3.8-5.3 0-12.7-6.5-12.7H642c-10.2 0-19.9 4.9-25.9 13.3L459 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H315c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8z', 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.ClockCircleOutline = getIcon('clock-circle', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z', 'M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z')); exports.CloudOutline = getIcon('cloud', outline, getNode(newViewBox, 'M811.4 418.7C765.6 297.9 648.9 212 512.2 212S258.8 297.8 213 418.6C127.3 441.1 64 519.1 64 612c0 110.5 89.5 200 199.9 200h496.2C870.5 812 960 722.5 960 612c0-92.7-63.1-170.7-148.6-193.3zm36.3 281a123.07 123.07 0 0 1-87.6 36.3H263.9c-33.1 0-64.2-12.9-87.6-36.3A123.3 123.3 0 0 1 140 612c0-28 9.1-54.3 26.2-76.3a125.7 125.7 0 0 1 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0 1 52.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10c54.3 14.5 92.1 63.8 92.1 120 0 33.1-12.9 64.3-36.3 87.7z')); exports.CloseCircleOutline = getIcon('close-circle', outline, getNode(newViewBox, 'M685.4 354.8c0-4.4-3.6-8-8-8l-66 .3L512 465.6l-99.3-118.4-66.1-.3c-4.4 0-8 3.5-8 8 0 1.9.7 3.7 1.9 5.2l130.1 155L340.5 670a8.32 8.32 0 0 0-1.9 5.2c0 4.4 3.6 8 8 8l66.1-.3L512 564.4l99.3 118.4 66 .3c4.4 0 8-3.5 8-8 0-1.9-.7-3.7-1.9-5.2L553.5 515l130.1-155c1.2-1.4 1.8-3.3 1.8-5.2z', 'M512 65C264.6 65 64 265.6 64 513s200.6 448 448 448 448-200.6 448-448S759.4 65 512 65zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z')); exports.CodeOutline = getIcon('code', outline, getNode(newViewBox, 'M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 0 0 308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 0 0-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.CodepenCircleOutline = getIcon('codepen-circle', outline, getNode(newViewBox, 'M488.1 414.7V303.4L300.9 428l83.6 55.8zm254.1 137.7v-79.8l-59.8 39.9zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm278 533c0 1.1-.1 2.1-.2 3.1 0 .4-.1.7-.2 1a14.16 14.16 0 0 1-.8 3.2c-.2.6-.4 1.2-.6 1.7-.2.4-.4.8-.5 1.2-.3.5-.5 1.1-.8 1.6-.2.4-.4.7-.7 1.1-.3.5-.7 1-1 1.5-.3.4-.5.7-.8 1-.4.4-.8.9-1.2 1.3-.3.3-.6.6-1 .9-.4.4-.9.8-1.4 1.1-.4.3-.7.6-1.1.8-.1.1-.3.2-.4.3L525.2 786c-4 2.7-8.6 4-13.2 4-4.7 0-9.3-1.4-13.3-4L244.6 616.9c-.1-.1-.3-.2-.4-.3l-1.1-.8c-.5-.4-.9-.7-1.3-1.1-.3-.3-.6-.6-1-.9-.4-.4-.8-.8-1.2-1.3a7 7 0 0 1-.8-1c-.4-.5-.7-1-1-1.5-.2-.4-.5-.7-.7-1.1-.3-.5-.6-1.1-.8-1.6-.2-.4-.4-.8-.5-1.2-.2-.6-.4-1.2-.6-1.7-.1-.4-.3-.8-.4-1.2-.2-.7-.3-1.3-.4-2-.1-.3-.1-.7-.2-1-.1-1-.2-2.1-.2-3.1V427.9c0-1 .1-2.1.2-3.1.1-.3.1-.7.2-1a14.16 14.16 0 0 1 .8-3.2c.2-.6.4-1.2.6-1.7.2-.4.4-.8.5-1.2.2-.5.5-1.1.8-1.6.2-.4.4-.7.7-1.1.6-.9 1.2-1.7 1.8-2.5.4-.4.8-.9 1.2-1.3.3-.3.6-.6 1-.9.4-.4.9-.8 1.3-1.1.4-.3.7-.6 1.1-.8.1-.1.3-.2.4-.3L498.7 239c8-5.3 18.5-5.3 26.5 0l254.1 169.1c.1.1.3.2.4.3l1.1.8 1.4 1.1c.3.3.6.6 1 .9.4.4.8.8 1.2 1.3.7.8 1.3 1.6 1.8 2.5.2.4.5.7.7 1.1.3.5.6 1 .8 1.6.2.4.4.8.5 1.2.2.6.4 1.2.6 1.7.1.4.3.8.4 1.2.2.7.3 1.3.4 2 .1.3.1.7.2 1 .1 1 .2 2.1.2 3.1V597zm-254.1 13.3v111.3L723.1 597l-83.6-55.8zM281.8 472.6v79.8l59.8-39.9zM512 456.1l-84.5 56.4 84.5 56.4 84.5-56.4zM723.1 428L535.9 303.4v111.3l103.6 69.1zM384.5 541.2L300.9 597l187.2 124.6V610.3l-103.6-69.1z')); exports.CloseSquareOutline = getIcon('close-square', outline, getNode(newViewBox, 'M354 671h58.9c4.7 0 9.2-2.1 12.3-5.7L512 561.8l86.8 103.5c3 3.6 7.5 5.7 12.3 5.7H670c6.8 0 10.5-7.9 6.1-13.1L553.8 512l122.4-145.9c4.4-5.2.7-13.1-6.1-13.1h-58.9c-4.7 0-9.2 2.1-12.3 5.7L512 462.2l-86.8-103.5c-3-3.6-7.5-5.7-12.3-5.7H354c-6.8 0-10.5 7.9-6.1 13.1L470.2 512 347.9 657.9A7.95 7.95 0 0 0 354 671z', 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.CompassOutline = getIcon('compass', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm198.4-588.1a32 32 0 0 0-24.5.5L414.9 415 296.4 686c-3.6 8.2-3.6 17.5 0 25.7 3.4 7.8 9.7 13.9 17.7 17 3.8 1.5 7.7 2.2 11.7 2.2 4.4 0 8.7-.9 12.8-2.7l271-118.6 118.5-271a32.06 32.06 0 0 0-17.7-42.7zM576.8 534.4l26.2 26.2-42.4 42.4-26.2-26.2L380 644.4 447.5 490 422 464.4l42.4-42.4 25.5 25.5L644.4 380l-67.6 154.4zM464.4 422L422 464.4l25.5 25.6 86.9 86.8 26.2 26.2 42.4-42.4-26.2-26.2-86.8-86.9z')); exports.ContactsOutline = getIcon('contacts', outline, getNode(newViewBox, 'M594.3 601.5a111.8 111.8 0 0 0 29.1-75.5c0-61.9-49.9-112-111.4-112s-111.4 50.1-111.4 112c0 29.1 11 55.5 29.1 75.5a158.09 158.09 0 0 0-74.6 126.1 8 8 0 0 0 8 8.4H407c4.2 0 7.6-3.3 7.9-7.5 3.8-50.6 46-90.5 97.2-90.5s93.4 40 97.2 90.5c.3 4.2 3.7 7.5 7.9 7.5H661a8 8 0 0 0 8-8.4c-2.8-53.3-32-99.7-74.7-126.1zM512 578c-28.5 0-51.7-23.3-51.7-52s23.2-52 51.7-52 51.7 23.3 51.7 52-23.2 52-51.7 52zm416-354H768v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H548v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H328v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H96c-17.7 0-32 14.3-32 32v576c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V256c0-17.7-14.3-32-32-32zm-40 568H136V296h120v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h148v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h148v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h120v496z')); exports.ControlOutline = getIcon('control', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM340 683v77c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-77c-10.1 3.3-20.8 5-32 5s-21.9-1.8-32-5zm64-198V264c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v221c10.1-3.3 20.8-5 32-5s21.9 1.8 32 5zm-64 198c10.1 3.3 20.8 5 32 5s21.9-1.8 32-5c41.8-13.5 72-52.7 72-99s-30.2-85.5-72-99c-10.1-3.3-20.8-5-32-5s-21.9 1.8-32 5c-41.8 13.5-72 52.7-72 99s30.2 85.5 72 99zm.1-115.7c.3-.6.7-1.2 1-1.8v-.1l1.2-1.8c.1-.2.2-.3.3-.5.3-.5.7-.9 1-1.4.1-.1.2-.3.3-.4.5-.6.9-1.1 1.4-1.6l.3-.3 1.2-1.2.4-.4c.5-.5 1-.9 1.6-1.4.6-.5 1.1-.9 1.7-1.3.2-.1.3-.2.5-.3.5-.3.9-.7 1.4-1 .1-.1.3-.2.4-.3.6-.4 1.2-.7 1.9-1.1.1-.1.3-.1.4-.2.5-.3 1-.5 1.6-.8l.6-.3c.7-.3 1.3-.6 2-.8.7-.3 1.4-.5 2.1-.7.2-.1.4-.1.6-.2.6-.2 1.1-.3 1.7-.4.2 0 .3-.1.5-.1.7-.2 1.5-.3 2.2-.4.2 0 .3 0 .5-.1.6-.1 1.2-.1 1.8-.2h.6c.8 0 1.5-.1 2.3-.1s1.5 0 2.3.1h.6c.6 0 1.2.1 1.8.2.2 0 .3 0 .5.1.7.1 1.5.2 2.2.4.2 0 .3.1.5.1.6.1 1.2.3 1.7.4.2.1.4.1.6.2.7.2 1.4.4 2.1.7.7.2 1.3.5 2 .8l.6.3c.5.2 1.1.5 1.6.8.1.1.3.1.4.2.6.3 1.3.7 1.9 1.1.1.1.3.2.4.3.5.3 1 .6 1.4 1 .2.1.3.2.5.3.6.4 1.2.9 1.7 1.3s1.1.9 1.6 1.4l.4.4 1.2 1.2.3.3c.5.5 1 1.1 1.4 1.6.1.1.2.3.3.4.4.4.7.9 1 1.4.1.2.2.3.3.5l1.2 1.8s0 .1.1.1a36.18 36.18 0 0 1 5.1 18.5c0 6-1.5 11.7-4.1 16.7-.3.6-.7 1.2-1 1.8 0 0 0 .1-.1.1l-1.2 1.8c-.1.2-.2.3-.3.5-.3.5-.7.9-1 1.4-.1.1-.2.3-.3.4-.5.6-.9 1.1-1.4 1.6l-.3.3-1.2 1.2-.4.4c-.5.5-1 .9-1.6 1.4-.6.5-1.1.9-1.7 1.3-.2.1-.3.2-.5.3-.5.3-.9.7-1.4 1-.1.1-.3.2-.4.3-.6.4-1.2.7-1.9 1.1-.1.1-.3.1-.4.2-.5.3-1 .5-1.6.8l-.6.3c-.7.3-1.3.6-2 .8-.7.3-1.4.5-2.1.7-.2.1-.4.1-.6.2-.6.2-1.1.3-1.7.4-.2 0-.3.1-.5.1-.7.2-1.5.3-2.2.4-.2 0-.3 0-.5.1-.6.1-1.2.1-1.8.2h-.6c-.8 0-1.5.1-2.3.1s-1.5 0-2.3-.1h-.6c-.6 0-1.2-.1-1.8-.2-.2 0-.3 0-.5-.1-.7-.1-1.5-.2-2.2-.4-.2 0-.3-.1-.5-.1-.6-.1-1.2-.3-1.7-.4-.2-.1-.4-.1-.6-.2-.7-.2-1.4-.4-2.1-.7-.7-.2-1.3-.5-2-.8l-.6-.3c-.5-.2-1.1-.5-1.6-.8-.1-.1-.3-.1-.4-.2-.6-.3-1.3-.7-1.9-1.1-.1-.1-.3-.2-.4-.3-.5-.3-1-.6-1.4-1-.2-.1-.3-.2-.5-.3-.6-.4-1.2-.9-1.7-1.3s-1.1-.9-1.6-1.4l-.4-.4-1.2-1.2-.3-.3c-.5-.5-1-1.1-1.4-1.6-.1-.1-.2-.3-.3-.4-.4-.4-.7-.9-1-1.4-.1-.2-.2-.3-.3-.5l-1.2-1.8v-.1c-.4-.6-.7-1.2-1-1.8-2.6-5-4.1-10.7-4.1-16.7s1.5-11.7 4.1-16.7zM620 539v221c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V539c-10.1 3.3-20.8 5-32 5s-21.9-1.8-32-5zm64-198v-77c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v77c10.1-3.3 20.8-5 32-5s21.9 1.8 32 5zm-64 198c10.1 3.3 20.8 5 32 5s21.9-1.8 32-5c41.8-13.5 72-52.7 72-99s-30.2-85.5-72-99c-10.1-3.3-20.8-5-32-5s-21.9 1.8-32 5c-41.8 13.5-72 52.7-72 99s30.2 85.5 72 99zm.1-115.7c.3-.6.7-1.2 1-1.8v-.1l1.2-1.8c.1-.2.2-.3.3-.5.3-.5.7-.9 1-1.4.1-.1.2-.3.3-.4.5-.6.9-1.1 1.4-1.6l.3-.3 1.2-1.2.4-.4c.5-.5 1-.9 1.6-1.4.6-.5 1.1-.9 1.7-1.3.2-.1.3-.2.5-.3.5-.3.9-.7 1.4-1 .1-.1.3-.2.4-.3.6-.4 1.2-.7 1.9-1.1.1-.1.3-.1.4-.2.5-.3 1-.5 1.6-.8l.6-.3c.7-.3 1.3-.6 2-.8.7-.3 1.4-.5 2.1-.7.2-.1.4-.1.6-.2.6-.2 1.1-.3 1.7-.4.2 0 .3-.1.5-.1.7-.2 1.5-.3 2.2-.4.2 0 .3 0 .5-.1.6-.1 1.2-.1 1.8-.2h.6c.8 0 1.5-.1 2.3-.1s1.5 0 2.3.1h.6c.6 0 1.2.1 1.8.2.2 0 .3 0 .5.1.7.1 1.5.2 2.2.4.2 0 .3.1.5.1.6.1 1.2.3 1.7.4.2.1.4.1.6.2.7.2 1.4.4 2.1.7.7.2 1.3.5 2 .8l.6.3c.5.2 1.1.5 1.6.8.1.1.3.1.4.2.6.3 1.3.7 1.9 1.1.1.1.3.2.4.3.5.3 1 .6 1.4 1 .2.1.3.2.5.3.6.4 1.2.9 1.7 1.3s1.1.9 1.6 1.4l.4.4 1.2 1.2.3.3c.5.5 1 1.1 1.4 1.6.1.1.2.3.3.4.4.4.7.9 1 1.4.1.2.2.3.3.5l1.2 1.8v.1a36.18 36.18 0 0 1 5.1 18.5c0 6-1.5 11.7-4.1 16.7-.3.6-.7 1.2-1 1.8v.1l-1.2 1.8c-.1.2-.2.3-.3.5-.3.5-.7.9-1 1.4-.1.1-.2.3-.3.4-.5.6-.9 1.1-1.4 1.6l-.3.3-1.2 1.2-.4.4c-.5.5-1 .9-1.6 1.4-.6.5-1.1.9-1.7 1.3-.2.1-.3.2-.5.3-.5.3-.9.7-1.4 1-.1.1-.3.2-.4.3-.6.4-1.2.7-1.9 1.1-.1.1-.3.1-.4.2-.5.3-1 .5-1.6.8l-.6.3c-.7.3-1.3.6-2 .8-.7.3-1.4.5-2.1.7-.2.1-.4.1-.6.2-.6.2-1.1.3-1.7.4-.2 0-.3.1-.5.1-.7.2-1.5.3-2.2.4-.2 0-.3 0-.5.1-.6.1-1.2.1-1.8.2h-.6c-.8 0-1.5.1-2.3.1s-1.5 0-2.3-.1h-.6c-.6 0-1.2-.1-1.8-.2-.2 0-.3 0-.5-.1-.7-.1-1.5-.2-2.2-.4-.2 0-.3-.1-.5-.1-.6-.1-1.2-.3-1.7-.4-.2-.1-.4-.1-.6-.2-.7-.2-1.4-.4-2.1-.7-.7-.2-1.3-.5-2-.8l-.6-.3c-.5-.2-1.1-.5-1.6-.8-.1-.1-.3-.1-.4-.2-.6-.3-1.3-.7-1.9-1.1-.1-.1-.3-.2-.4-.3-.5-.3-1-.6-1.4-1-.2-.1-.3-.2-.5-.3-.6-.4-1.2-.9-1.7-1.3s-1.1-.9-1.6-1.4l-.4-.4-1.2-1.2-.3-.3c-.5-.5-1-1.1-1.4-1.6-.1-.1-.2-.3-.3-.4-.4-.4-.7-.9-1-1.4-.1-.2-.2-.3-.3-.5l-1.2-1.8v-.1c-.4-.6-.7-1.2-1-1.8-2.6-5-4.1-10.7-4.1-16.7s1.5-11.7 4.1-16.7z')); exports.ContainerOutline = getIcon('container', outline, getNode(newViewBox, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-40 824H232V687h97.9c11.6 32.8 32 62.3 59.1 84.7 34.5 28.5 78.2 44.3 123 44.3s88.5-15.7 123-44.3c27.1-22.4 47.5-51.9 59.1-84.7H792v-63H643.6l-5.2 24.7C626.4 708.5 573.2 752 512 752s-114.4-43.5-126.5-103.3l-5.2-24.7H232V136h560v752zM320 341h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 160h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z')); exports.CrownOutline = getIcon('crown', outline, getNode(newViewBox, 'M899.6 276.5L705 396.4 518.4 147.5a8.06 8.06 0 0 0-12.9 0L319 396.4 124.3 276.5c-5.7-3.5-13.1 1.2-12.2 7.9L188.5 865c1.1 7.9 7.9 14 16 14h615.1c8 0 14.9-6 15.9-14l76.4-580.6c.8-6.7-6.5-11.4-12.3-7.9zm-126 534.1H250.3l-53.8-409.4 139.8 86.1L512 252.9l175.7 234.4 139.8-86.1-53.9 409.4zM512 509c-62.1 0-112.6 50.5-112.6 112.6S449.9 734.2 512 734.2s112.6-50.5 112.6-112.6S574.1 509 512 509zm0 160.9c-26.6 0-48.2-21.6-48.2-48.3 0-26.6 21.6-48.3 48.2-48.3s48.2 21.6 48.2 48.3c0 26.6-21.6 48.3-48.2 48.3z')); exports.CustomerServiceOutline = getIcon('customer-service', outline, getNode(newViewBox, 'M512 128c-212.1 0-384 171.9-384 384v360c0 13.3 10.7 24 24 24h184c35.3 0 64-28.7 64-64V624c0-35.3-28.7-64-64-64H200v-48c0-172.3 139.7-312 312-312s312 139.7 312 312v48H688c-35.3 0-64 28.7-64 64v208c0 35.3 28.7 64 64 64h184c13.3 0 24-10.7 24-24V512c0-212.1-171.9-384-384-384zM328 632v192H200V632h128zm496 192H696V632h128v192z')); exports.CopyOutline = getIcon('copy', outline, getNode(newViewBox, 'M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z')); exports.CreditCardOutline = getIcon('credit-card', outline, getNode(newViewBox, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-792 72h752v120H136V232zm752 560H136V440h752v352zm-237-64h165c4.4 0 8-3.6 8-8v-72c0-4.4-3.6-8-8-8H651c-4.4 0-8 3.6-8 8v72c0 4.4 3.6 8 8 8z')); exports.DashboardOutline = getIcon('dashboard', outline, getNode(newViewBox, 'M924.8 385.6a446.7 446.7 0 0 0-96-142.4 446.7 446.7 0 0 0-142.4-96C631.1 123.8 572.5 112 512 112s-119.1 11.8-174.4 35.2a446.7 446.7 0 0 0-142.4 96 446.7 446.7 0 0 0-96 142.4C75.8 440.9 64 499.5 64 560c0 132.7 58.3 257.7 159.9 343.1l1.7 1.4c5.8 4.8 13.1 7.5 20.6 7.5h531.7c7.5 0 14.8-2.7 20.6-7.5l1.7-1.4C901.7 817.7 960 692.7 960 560c0-60.5-11.9-119.1-35.2-174.4zM761.4 836H262.6A371.12 371.12 0 0 1 140 560c0-99.4 38.7-192.8 109-263 70.3-70.3 163.7-109 263-109 99.4 0 192.8 38.7 263 109 70.3 70.3 109 163.7 109 263 0 105.6-44.5 205.5-122.6 276zM623.5 421.5a8.03 8.03 0 0 0-11.3 0L527.7 506c-18.7-5-39.4-.2-54.1 14.5a55.95 55.95 0 0 0 0 79.2 55.95 55.95 0 0 0 79.2 0 55.87 55.87 0 0 0 14.5-54.1l84.5-84.5c3.1-3.1 3.1-8.2 0-11.3l-28.3-28.3zM490 320h44c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8h-44c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8zm260 218v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8zm12.7-197.2l-31.1-31.1a8.03 8.03 0 0 0-11.3 0l-56.6 56.6a8.03 8.03 0 0 0 0 11.3l31.1 31.1c3.1 3.1 8.2 3.1 11.3 0l56.6-56.6c3.1-3.1 3.1-8.2 0-11.3zm-458.6-31.1a8.03 8.03 0 0 0-11.3 0l-31.1 31.1a8.03 8.03 0 0 0 0 11.3l56.6 56.6c3.1 3.1 8.2 3.1 11.3 0l31.1-31.1c3.1-3.1 3.1-8.2 0-11.3l-56.6-56.6zM262 530h-80c-4.4 0-8 3.6-8 8v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8z')); exports.DatabaseOutline = getIcon('database', outline, getNode(newViewBox, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0 272a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0 272a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.DiffOutline = getIcon('diff', outline, getNode(newViewBox, 'M476 399.1c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1V484h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H420v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V540h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H476v-84.9zM560.5 704h-225c-4.1 0-7.5 3.2-7.5 7v42c0 3.8 3.4 7 7.5 7h225c4.1 0 7.5-3.2 7.5-7v-42c0-3.8-3.4-7-7.5-7zm-7.1-502.6c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v704c0 17.7 14.3 32 32 32h512c17.7 0 32-14.3 32-32V397.3c0-8.5-3.4-16.6-9.4-22.6L553.4 201.4zM664 888H232V264h282.2L664 413.8V888zm190.2-581.4L611.3 72.9c-6-5.7-13.9-8.9-22.2-8.9H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h277l219 210.6V824c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V329.6c0-8.7-3.5-17-9.8-23z')); exports.DownCircleOutline = getIcon('down-circle', outline, getNode(newViewBox, 'M690 405h-46.9c-10.2 0-19.9 4.9-25.9 13.2L512 563.6 406.8 418.2c-6-8.3-15.6-13.2-25.9-13.2H334c-6.5 0-10.3 7.4-6.5 12.7l178 246c3.2 4.4 9.7 4.4 12.9 0l178-246c3.9-5.3.1-12.7-6.4-12.7z', 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z')); exports.DownSquareOutline = getIcon('down-square', outline, getNode(newViewBox, 'M505.5 658.7c3.2 4.4 9.7 4.4 12.9 0l178-246c3.8-5.3 0-12.7-6.5-12.7H643c-10.2 0-19.9 4.9-25.9 13.2L512 558.6 406.8 413.2c-6-8.3-15.6-13.2-25.9-13.2H334c-6.5 0-10.3 7.4-6.5 12.7l178 246z', 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.DeleteOutline = getIcon('delete', outline, getNode(newViewBox, 'M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z')); exports.DislikeOutline = getIcon('dislike', outline, getNode(newViewBox, 'M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h129.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM184 456V172h81v284h-81zm627.2 160.4H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3L329 459.2V172h415.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z')); exports.DribbbleSquareOutline = getIcon('dribbble-square', outline, getNode(newViewBox, 'M498.6 432c-40.8-72.5-84.7-133.4-91.2-142.3-68.8 32.5-120.3 95.9-136.2 172.2 11 .2 112.4.7 227.4-29.9zm66.5 21.8c5.7 11.7 11.2 23.6 16.3 35.6 1.8 4.2 3.6 8.4 5.3 12.7 81.8-10.3 163.2 6.2 171.3 7.9-.5-58.1-21.3-111.4-55.5-153.3-5.3 7.1-46.5 60-137.4 97.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM512 800c-158.8 0-288-129.2-288-288s129.2-288 288-288 288 129.2 288 288-129.2 288-288 288zm89.7-259.1c32.2 88.4 45.3 160.4 47.8 175.4 55.2-37.3 94.5-96.4 105.4-164.9-8.4-2.6-76.1-22.8-153.2-10.5zm-72.5-26.4c3.2-1 6.4-2 9.7-2.9-6.2-14-12.9-28-19.9-41.7-122.8 36.8-242.1 35.2-252.8 35-.1 2.5-.1 5-.1 7.5 0 63.2 23.9 120.9 63.2 164.5 5.5-9.6 73-121.4 199.9-162.4zm145.9-186.2a245.2 245.2 0 0 0-220.8-55.1c6.8 9.1 51.5 69.9 91.8 144 87.5-32.8 124.5-82.6 129-88.9zM554 552.8c-138.7 48.3-188.6 144.6-193 153.6 41.7 32.5 94.1 51.9 151 51.9 34.1 0 66.6-6.9 96.1-19.5-3.7-21.6-17.9-96.8-52.5-186.6l-1.6.6z')); exports.EditOutline = getIcon('edit', outline, getNode(newViewBox, 'M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 0 0 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 0 0 9.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z')); exports.EnvironmentOutline = getIcon('environment', outline, getNode(newViewBox, 'M854.6 289.1a362.49 362.49 0 0 0-79.9-115.7 370.83 370.83 0 0 0-118.2-77.8C610.7 76.6 562.1 67 512 67c-50.1 0-98.7 9.6-144.5 28.5-44.3 18.3-84 44.5-118.2 77.8A363.6 363.6 0 0 0 169.4 289c-19.5 45-29.4 92.8-29.4 142 0 70.6 16.9 140.9 50.1 208.7 26.7 54.5 64 107.6 111 158.1 80.3 86.2 164.5 138.9 188.4 153a43.9 43.9 0 0 0 22.4 6.1c7.8 0 15.5-2 22.4-6.1 23.9-14.1 108.1-66.8 188.4-153 47-50.4 84.3-103.6 111-158.1C867.1 572 884 501.8 884 431.1c0-49.2-9.9-97-29.4-142zM512 880.2c-65.9-41.9-300-207.8-300-449.1 0-77.9 31.1-151.1 87.6-206.3C356.3 169.5 431.7 139 512 139s155.7 30.5 212.4 85.9C780.9 280 812 353.2 812 431.1c0 241.3-234.1 407.2-300 449.1zm0-617.2c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 551c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 439c0-29.9 11.7-58 32.8-79.2C454 338.6 482.1 327 512 327c29.9 0 58 11.6 79.2 32.8C612.4 381 624 409.1 624 439c0 29.9-11.6 58-32.8 79.2z')); exports.EyeInvisibleOutline = getIcon('eye-invisible', outline, getNode(newViewBox, 'M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 0 0 0-51.5zm-63.57-320.64L836 122.88a8 8 0 0 0-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 0 0 0 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 0 0 0 11.31L155.17 889a8 8 0 0 0 11.31 0l712.15-712.12a8 8 0 0 0 0-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 0 0-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 0 1 146.2-106.69L401.31 546.2A112 112 0 0 1 396 512z', 'M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 0 0 227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 0 1-112 112z')); exports.ExperimentOutline = getIcon('experiment', outline, getNode(newViewBox, 'M512 472a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 0 1-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z')); exports.ExclamationCircleOutline = getIcon('exclamation-circle', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z', 'M464 688a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z')); exports.EyeOutline = getIcon('eye', outline, getNode(newViewBox, 'M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z')); exports.FacebookOutline = getIcon('facebook', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-32 736H663.9V602.2h104l15.6-120.7H663.9v-77.1c0-35 9.7-58.8 59.8-58.8h63.9v-108c-11.1-1.5-49-4.8-93.2-4.8-92.2 0-155.3 56.3-155.3 159.6v89H434.9v120.7h104.3V848H176V176h672v672z')); exports.FastForwardOutline = getIcon('fast-forward', outline, getNode(normalViewBox, 'M793.8 499.3L506.4 273.5c-10.7-8.4-26.4-.8-26.4 12.7v451.6c0 13.5 15.7 21.1 26.4 12.7l287.4-225.8a16.14 16.14 0 0 0 0-25.4zm-320 0L186.4 273.5c-10.7-8.4-26.4-.8-26.4 12.7v451.5c0 13.5 15.7 21.1 26.4 12.7l287.4-225.8c4.1-3.2 6.2-8 6.2-12.7 0-4.6-2.1-9.4-6.2-12.6zM857.6 248h-51.2c-3.5 0-6.4 2.7-6.4 6v516c0 3.3 2.9 6 6.4 6h51.2c3.5 0 6.4-2.7 6.4-6V254c0-3.3-2.9-6-6.4-6z')); exports.FastBackwardOutline = getIcon('fast-backward', outline, getNode(normalViewBox, 'M517.6 273.5L230.2 499.3a16.14 16.14 0 0 0 0 25.4l287.4 225.8c10.7 8.4 26.4.8 26.4-12.7V286.2c0-13.5-15.7-21.1-26.4-12.7zm320 0L550.2 499.3a16.14 16.14 0 0 0 0 25.4l287.4 225.8c10.7 8.4 26.4.8 26.4-12.7V286.2c0-13.5-15.7-21.1-26.4-12.7zm-620-25.5h-51.2c-3.5 0-6.4 2.7-6.4 6v516c0 3.3 2.9 6 6.4 6h51.2c3.5 0 6.4-2.7 6.4-6V254c0-3.3-2.9-6-6.4-6z')); exports.FileExcelOutline = getIcon('file-excel', outline, getNode(newViewBox, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0 0 10.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 0 0-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z')); exports.FileExclamationOutline = getIcon('file-exclamation', outline, getNode(newViewBox, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM472 744a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z')); exports.FileAddOutline = getIcon('file-add', outline, getNode(newViewBox, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM544 472c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v108H372c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h108v108c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V644h108c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V472z')); exports.FilePdfOutline = getIcon('file-pdf', outline, getNode(newViewBox, 'M531.3 574.4l.3-1.4c5.8-23.9 13.1-53.7 7.4-80.7-3.8-21.3-19.5-29.6-32.9-30.2-15.8-.7-29.9 8.3-33.4 21.4-6.6 24-.7 56.8 10.1 98.6-13.6 32.4-35.3 79.5-51.2 107.5-29.6 15.3-69.3 38.9-75.2 68.7-1.2 5.5.2 12.5 3.5 18.8 3.7 7 9.6 12.4 16.5 15 3 1.1 6.6 2 10.8 2 17.6 0 46.1-14.2 84.1-79.4 5.8-1.9 11.8-3.9 17.6-5.9 27.2-9.2 55.4-18.8 80.9-23.1 28.2 15.1 60.3 24.8 82.1 24.8 21.6 0 30.1-12.8 33.3-20.5 5.6-13.5 2.9-30.5-6.2-39.6-13.2-13-45.3-16.4-95.3-10.2-24.6-15-40.7-35.4-52.4-65.8zM421.6 726.3c-13.9 20.2-24.4 30.3-30.1 34.7 6.7-12.3 19.8-25.3 30.1-34.7zm87.6-235.5c5.2 8.9 4.5 35.8.5 49.4-4.9-19.9-5.6-48.1-2.7-51.4.8.1 1.5.7 2.2 2zm-1.6 120.5c10.7 18.5 24.2 34.4 39.1 46.2-21.6 4.9-41.3 13-58.9 20.2-4.2 1.7-8.3 3.4-12.3 5 13.3-24.1 24.4-51.4 32.1-71.4zm155.6 65.5c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6 40.6-1.9 45 7.3 45.1 7.4zm191.4-388.2L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z')); exports.FileMarkdownOutline = getIcon('file-markdown', outline, getNode(newViewBox, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM429 481.2c-1.9-4.4-6.2-7.2-11-7.2h-35c-6.6 0-12 5.4-12 12v272c0 6.6 5.4 12 12 12h27.1c6.6 0 12-5.4 12-12V582.1l66.8 150.2a12 12 0 0 0 11 7.1H524c4.7 0 9-2.8 11-7.1l66.8-150.6V758c0 6.6 5.4 12 12 12H641c6.6 0 12-5.4 12-12V486c0-6.6-5.4-12-12-12h-34.7c-4.8 0-9.1 2.8-11 7.2l-83.1 191-83.2-191z')); exports.FilePptOutline = getIcon('file-ppt', outline, getNode(newViewBox, 'M424 476c-4.4 0-8 3.6-8 8v276c0 4.4 3.6 8 8 8h32.5c4.4 0 8-3.6 8-8v-95.5h63.3c59.4 0 96.2-38.9 96.2-94.1 0-54.5-36.3-94.3-96-94.3H424zm150.6 94.3c0 43.4-26.5 54.3-71.2 54.3h-38.9V516.2h56.2c33.8 0 53.9 19.7 53.9 54.1zm280-281.7L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z')); exports.FileImageOutline = getIcon('file-image', outline, getNode(newViewBox, 'M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 0 0-12.6 0l-99.8 127.2a7.98 7.98 0 0 0 6.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 0 0-12.7 0zM360 442a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm494.6-153.4L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z')); exports.FileUnknownOutline = getIcon('file-unknown', outline, getNode(newViewBox, 'M854.6 288.7L639.4 73.4c-6-6-14.2-9.4-22.7-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.6-9.4-22.6zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM402 549c0 5.4 4.4 9.5 9.8 9.5h32.4c5.4 0 9.8-4.2 9.8-9.4 0-28.2 25.8-51.6 58-51.6s58 23.4 58 51.5c0 25.3-21 47.2-49.3 50.9-19.3 2.8-34.5 20.3-34.7 40.1v32c0 5.5 4.5 10 10 10h32c5.5 0 10-4.5 10-10v-12.2c0-6 4-11.5 9.7-13.3 44.6-14.4 75-54 74.3-98.9-.8-55.5-49.2-100.8-108.5-101.6-61.4-.7-111.5 45.6-111.5 103zm78 195a32 32 0 1 0 64 0 32 32 0 1 0-64 0z')); exports.FileTextOutline = getIcon('file-text', outline, getNode(newViewBox, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z')); exports.FileWordOutline = getIcon('file-word', outline, getNode(newViewBox, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 0 0-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 0 0-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z')); exports.FilterOutline = getIcon('filter', outline, getNode(newViewBox, 'M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z')); exports.FileOutline = getIcon('file', outline, getNode(newViewBox, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z')); exports.FileZipOutline = getIcon('file-zip', outline, getNode(newViewBox, 'M296 392h64v64h-64zm0 190v160h128V582h-64v-62h-64v62zm80 48v64h-32v-64h32zm-16-302h64v64h-64zm-64-64h64v64h-64zm64 192h64v64h-64zm0-256h64v64h-64zm494.6 88.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h64v64h64v-64h174v216a42 42 0 0 0 42 42h216v494z')); exports.FireOutline = getIcon('fire', outline, getNode(newViewBox, 'M834.1 469.2A347.49 347.49 0 0 0 751.2 354l-29.1-26.7a8.09 8.09 0 0 0-13 3.3l-13 37.3c-8.1 23.4-23 47.3-44.1 70.8-1.4 1.5-3 1.9-4.1 2-1.1.1-2.8-.1-4.3-1.5-1.4-1.2-2.1-3-2-4.8 3.7-60.2-14.3-128.1-53.7-202C555.3 171 510 123.1 453.4 89.7l-41.3-24.3c-5.4-3.2-12.3 1-12 7.3l2.2 48c1.5 32.8-2.3 61.8-11.3 85.9-11 29.5-26.8 56.9-47 81.5a295.64 295.64 0 0 1-47.5 46.1 352.6 352.6 0 0 0-100.3 121.5A347.75 347.75 0 0 0 160 610c0 47.2 9.3 92.9 27.7 136a349.4 349.4 0 0 0 75.5 110.9c32.4 32 70 57.2 111.9 74.7C418.5 949.8 464.5 959 512 959s93.5-9.2 136.9-27.3A348.6 348.6 0 0 0 760.8 857c32.4-32 57.8-69.4 75.5-110.9a344.2 344.2 0 0 0 27.7-136c0-48.8-10-96.2-29.9-140.9zM713 808.5c-53.7 53.2-125 82.4-201 82.4s-147.3-29.2-201-82.4c-53.5-53.1-83-123.5-83-198.4 0-43.5 9.8-85.2 29.1-124 18.8-37.9 46.8-71.8 80.8-97.9a349.6 349.6 0 0 0 58.6-56.8c25-30.5 44.6-64.5 58.2-101a240 240 0 0 0 12.1-46.5c24.1 22.2 44.3 49 61.2 80.4 33.4 62.6 48.8 118.3 45.8 165.7a74.01 74.01 0 0 0 24.4 59.8 73.36 73.36 0 0 0 53.4 18.8c19.7-1 37.8-9.7 51-24.4 13.3-14.9 24.8-30.1 34.4-45.6 14 17.9 25.7 37.4 35 58.4 15.9 35.8 24 73.9 24 113.1 0 74.9-29.5 145.4-83 198.4z')); exports.FolderAddOutline = getIcon('folder-add', outline, getNode(newViewBox, 'M484 443.1V528h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H484v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V584h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H540v-84.9c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1zm396-144.7H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z')); exports.FlagOutline = getIcon('flag', outline, getNode(newViewBox, 'M880 305H624V192c0-17.7-14.3-32-32-32H184v-40c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v784c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V640h248v113c0 17.7 14.3 32 32 32h416c17.7 0 32-14.3 32-32V337c0-17.7-14.3-32-32-32zM184 568V232h368v336H184zm656 145H504v-73h112c4.4 0 8-3.6 8-8V377h216v336z')); exports.FolderOutline = getIcon('folder', outline, getNode(newViewBox, 'M880 298.4H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z')); exports.FolderOpenOutline = getIcon('folder-open', outline, getNode(newViewBox, 'M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 0 0-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z')); exports.ForwardOutline = getIcon('forward', outline, getNode(normalViewBox, 'M825.8 498L538.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L825.8 526c8.3-7.2 8.3-20.8 0-28zm-320 0L218.4 249.9c-10.7-9.2-26.4-.9-26.4 14v496.3c0 14.9 15.7 23.2 26.4 14L505.8 526c4.1-3.6 6.2-8.8 6.2-14 0-5.2-2.1-10.4-6.2-14z')); exports.FundOutline = getIcon('fund', outline, getNode(newViewBox, 'M926 164H94c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V196c0-17.7-14.3-32-32-32zm-40 632H134V236h752v560zm-658.9-82.3c3.1 3.1 8.2 3.1 11.3 0l172.5-172.5 114.4 114.5c3.1 3.1 8.2 3.1 11.3 0l297-297.2c3.1-3.1 3.1-8.2 0-11.3l-36.8-36.8a8.03 8.03 0 0 0-11.3 0L531 565 416.6 450.5a8.03 8.03 0 0 0-11.3 0l-214.9 215a8.03 8.03 0 0 0 0 11.3l36.7 36.9z')); exports.GiftOutline = getIcon('gift', outline, getNode(newViewBox, 'M880 310H732.4c13.6-21.4 21.6-46.8 21.6-74 0-76.1-61.9-138-138-138-41.4 0-78.7 18.4-104 47.4-25.3-29-62.6-47.4-104-47.4-76.1 0-138 61.9-138 138 0 27.2 7.9 52.6 21.6 74H144c-17.7 0-32 14.3-32 32v200c0 4.4 3.6 8 8 8h40v344c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V550h40c4.4 0 8-3.6 8-8V342c0-17.7-14.3-32-32-32zm-334-74c0-38.6 31.4-70 70-70s70 31.4 70 70-31.4 70-70 70h-70v-70zm-138-70c38.6 0 70 31.4 70 70v70h-70c-38.6 0-70-31.4-70-70s31.4-70 70-70zM180 482V378h298v104H180zm48 68h250v308H228V550zm568 308H546V550h250v308zm48-376H546V378h298v104z')); exports.FrownOutline = getIcon('frown', outline, getNode(newViewBox, 'M288 421a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm352 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 0 1 248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 0 1 249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 0 1 775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 0 1 775 775zM512 533c-85.5 0-155.6 67.3-160 151.6a8 8 0 0 0 8 8.4h48.1c4.2 0 7.8-3.2 8.1-7.4C420 636.1 461.5 597 512 597s92.1 39.1 95.8 88.6c.3 4.2 3.9 7.4 8.1 7.4H664a8 8 0 0 0 8-8.4C667.6 600.3 597.5 533 512 533z')); exports.FunnelPlotOutline = getIcon('funnel-plot', outline, getNode(newViewBox, 'M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 607.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V607.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V650h182.9v148zm9.6-226.6l-8.4 14.6H419.3l-8.4-14.6L334.4 438h355.2L613 571.4zM726.3 374H297.7l-85-148h598.6l-85 148z')); exports.GithubOutline = getIcon('github', outline, getNode(newViewBox, 'M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z')); exports.GitlabOutline = getIcon('gitlab', outline, getNode(newViewBox, 'M913.9 552.2L805 181.4v-.1c-7.6-22.9-25.7-36.5-48.3-36.5-23.4 0-42.5 13.5-49.7 35.2l-71.4 213H388.8l-71.4-213c-7.2-21.7-26.3-35.2-49.7-35.2-23.1 0-42.5 14.8-48.4 36.6L110.5 552.2c-4.4 14.7 1.2 31.4 13.5 40.7l368.5 276.4c2.6 3.6 6.2 6.3 10.4 7.8l8.6 6.4 8.5-6.4c4.9-1.7 9-4.7 11.9-8.9l368.4-275.4c12.4-9.2 18-25.9 13.6-40.6zM751.7 193.4c1-1.8 2.9-1.9 3.5-1.9 1.1 0 2.5.3 3.4 3L818 394.3H684.5l67.2-200.9zm-487.4 1c.9-2.6 2.3-2.9 3.4-2.9 2.7 0 2.9.1 3.4 1.7l67.3 201.2H206.5l57.8-200zM158.8 558.7l28.2-97.3 202.4 270.2-230.6-172.9zm73.9-116.4h122.1l90.8 284.3-212.9-284.3zM512.9 776L405.7 442.3H620L512.9 776zm157.9-333.7h119.5L580 723.1l90.8-280.8zm-40.7 293.9l207.3-276.7 29.5 99.2-236.8 177.5z')); exports.HomeOutline = getIcon('home', outline, getNode(newViewBox, 'M946.5 505L560.1 118.8l-25.9-25.9a31.5 31.5 0 0 0-44.4 0L77.5 505a63.9 63.9 0 0 0-18.8 46c.4 35.2 29.7 63.3 64.9 63.3h42.5V940h691.8V614.3h43.4c17.1 0 33.2-6.7 45.3-18.8a63.6 63.6 0 0 0 18.7-45.3c0-17-6.7-33.1-18.8-45.2zM568 868H456V664h112v204zm217.9-325.7V868H632V640c0-22.1-17.9-40-40-40H432c-22.1 0-40 17.9-40 40v228H238.1V542.3h-96l370-369.7 23.1 23.1L882 542.3h-96.1z')); exports.HeartOutline = getIcon('heart', outline, getNode(newViewBox, 'M923 283.6a260.04 260.04 0 0 0-56.9-82.8 264.4 264.4 0 0 0-84-55.5A265.34 265.34 0 0 0 679.7 125c-49.3 0-97.4 13.5-139.2 39-10 6.1-19.5 12.8-28.5 20.1-9-7.3-18.5-14-28.5-20.1-41.8-25.5-89.9-39-139.2-39-35.5 0-69.9 6.8-102.4 20.3-31.4 13-59.7 31.7-84 55.5a258.44 258.44 0 0 0-56.9 82.8c-13.9 32.3-21 66.6-21 101.9 0 33.3 6.8 68 20.3 103.3 11.3 29.5 27.5 60.1 48.2 91 32.8 48.9 77.9 99.9 133.9 151.6 92.8 85.7 184.7 144.9 188.6 147.3l23.7 15.2c10.5 6.7 24 6.7 34.5 0l23.7-15.2c3.9-2.5 95.7-61.6 188.6-147.3 56-51.7 101.1-102.7 133.9-151.6 20.7-30.9 37-61.5 48.2-91 13.5-35.3 20.3-70 20.3-103.3.1-35.3-7-69.6-20.9-101.9zM512 814.8S156 586.7 156 385.5C156 283.6 240.3 201 344.3 201c73.1 0 136.5 40.8 167.7 100.4C543.2 241.8 606.6 201 679.7 201c104 0 188.3 82.6 188.3 184.5 0 201.2-356 429.3-356 429.3z')); exports.HddOutline = getIcon('hdd', outline, getNode(newViewBox, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM496 208H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 544h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm328 244a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.HourglassOutline = getIcon('hourglass', outline, getNode(newViewBox, 'M742 318V184h86c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H196c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h86v134c0 81.5 42.4 153.2 106.4 194-64 40.8-106.4 112.5-106.4 194v134h-86c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h632c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-86V706c0-81.5-42.4-153.2-106.4-194 64-40.8 106.4-112.5 106.4-194zm-72 388v134H354V706c0-42.2 16.4-81.9 46.3-111.7C430.1 564.4 469.8 548 512 548s81.9 16.4 111.7 46.3C653.6 624.1 670 663.8 670 706zm0-388c0 42.2-16.4 81.9-46.3 111.7C593.9 459.6 554.2 476 512 476s-81.9-16.4-111.7-46.3A156.63 156.63 0 0 1 354 318V184h316v134z')); exports.HighlightOutline = getIcon('highlight', outline, getNode(newViewBox, 'M957.6 507.4L603.2 158.2a7.9 7.9 0 0 0-11.2 0L353.3 393.4a8.03 8.03 0 0 0-.1 11.3l.1.1 40 39.4-117.2 115.3a8.03 8.03 0 0 0-.1 11.3l.1.1 39.5 38.9-189.1 187H72.1c-4.4 0-8.1 3.6-8.1 8V860c0 4.4 3.6 8 8 8h344.9c2.1 0 4.1-.8 5.6-2.3l76.1-75.6 40.4 39.8a7.9 7.9 0 0 0 11.2 0l117.1-115.6 40.1 39.5a7.9 7.9 0 0 0 11.2 0l238.7-235.2c3.4-3 3.4-8 .3-11.2zM389.8 796.2H229.6l134.4-133 80.1 78.9-54.3 54.1zm154.8-62.1L373.2 565.2l68.6-67.6 171.4 168.9-68.6 67.6zM713.1 658L450.3 399.1 597.6 254l262.8 259-147.3 145z')); exports.IdcardOutline = getIcon('idcard', outline, getNode(newViewBox, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136V232h752v560zM610.3 476h123.4c1.3 0 2.3-3.6 2.3-8v-48c0-4.4-1-8-2.3-8H610.3c-1.3 0-2.3 3.6-2.3 8v48c0 4.4 1 8 2.3 8zm4.8 144h185.7c3.9 0 7.1-3.6 7.1-8v-48c0-4.4-3.2-8-7.1-8H615.1c-3.9 0-7.1 3.6-7.1 8v48c0 4.4 3.2 8 7.1 8zM224 673h43.9c4.2 0 7.6-3.3 7.9-7.5 3.8-50.5 46-90.5 97.2-90.5s93.4 40 97.2 90.5c.3 4.2 3.7 7.5 7.9 7.5H522a8 8 0 0 0 8-8.4c-2.8-53.3-32-99.7-74.6-126.1a111.8 111.8 0 0 0 29.1-75.5c0-61.9-49.9-112-111.4-112s-111.4 50.1-111.4 112c0 29.1 11 55.5 29.1 75.5a158.09 158.09 0 0 0-74.6 126.1c-.4 4.6 3.2 8.4 7.8 8.4zm149-262c28.5 0 51.7 23.3 51.7 52s-23.2 52-51.7 52-51.7-23.3-51.7-52 23.2-52 51.7-52z')); exports.Html5Outline = getIcon('html5', outline, getNode(newViewBox, 'M145 96l66 746.6L511.8 928l299.6-85.4L878.7 96H145zm610.9 700.6l-244.1 69.6-245.2-69.6-56.7-641.2h603.8l-57.8 641.2zM281 249l1.7 24.3 22.7 253.5h206.5v-.1h112.9l-11.4 118.5L511 672.9v.2h-.8l-102.4-27.7-6.5-73.2h-91l11.3 144.7 188.6 52h1.7v-.4l187.7-51.7 1.7-16.3 21.2-242.2 3.2-24.3H511v.2H389.9l-8.2-94.2h352.1l1.7-19.5 4.8-47.2L742 249H511z')); exports.InsuranceOutline = getIcon('insurance', outline, getNode(newViewBox, 'M441.6 306.8L403 288.6a6.1 6.1 0 0 0-8.4 3.7c-17.5 58.5-45.2 110.1-82.2 153.6a6.05 6.05 0 0 0-1.2 5.6l13.2 43.5c1.3 4.4 7 5.7 10.2 2.4 7.7-8.1 15.4-16.9 23.1-26V656c0 4.4 3.6 8 8 8H403c4.4 0 8-3.6 8-8V393.1a429.2 429.2 0 0 0 33.6-79c1-2.9-.3-6-3-7.3zm26.8 9.2v127.2c0 4.4 3.6 8 8 8h65.9v18.6h-94.9c-4.4 0-8 3.6-8 8v35.6c0 4.4 3.6 8 8 8h55.1c-19.1 30.8-42.4 55.7-71 76a6 6 0 0 0-1.6 8.1l22.8 36.5c1.9 3.1 6.2 3.8 8.9 1.4 31.6-26.8 58.7-62.9 80.6-107.6v120c0 4.4 3.6 8 8 8h36.2c4.4 0 8-3.6 8-8V536c21.3 41.7 47.5 77.5 78.1 106.9 2.6 2.5 6.8 2.1 8.9-.7l26.3-35.3c2-2.7 1.4-6.5-1.2-8.4-30.5-22.6-54.2-47.8-72.3-76.9h59c4.4 0 8-3.6 8-8V478c0-4.4-3.6-8-8-8h-98.8v-18.6h66.7c4.4 0 8-3.6 8-8V316c0-4.4-3.6-8-8-8H476.4c-4.4 0-8 3.6-8 8zm51.5 42.8h97.9v41.6h-97.9v-41.6zm347-188.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM810 654.3L512 886.5 214 654.3V226.7l298-101.6 298 101.6v427.6z')); exports.InstagramOutline = getIcon('instagram', outline, getNode(newViewBox, 'M512 306.9c-113.5 0-205.1 91.6-205.1 205.1S398.5 717.1 512 717.1 717.1 625.5 717.1 512 625.5 306.9 512 306.9zm0 338.4c-73.4 0-133.3-59.9-133.3-133.3S438.6 378.7 512 378.7 645.3 438.6 645.3 512 585.4 645.3 512 645.3zm213.5-394.6c-26.5 0-47.9 21.4-47.9 47.9s21.4 47.9 47.9 47.9 47.9-21.3 47.9-47.9a47.84 47.84 0 0 0-47.9-47.9zM911.8 512c0-55.2.5-109.9-2.6-165-3.1-64-17.7-120.8-64.5-167.6-46.9-46.9-103.6-61.4-167.6-64.5-55.2-3.1-109.9-2.6-165-2.6-55.2 0-109.9-.5-165 2.6-64 3.1-120.8 17.7-167.6 64.5C132.6 226.3 118.1 283 115 347c-3.1 55.2-2.6 109.9-2.6 165s-.5 109.9 2.6 165c3.1 64 17.7 120.8 64.5 167.6 46.9 46.9 103.6 61.4 167.6 64.5 55.2 3.1 109.9 2.6 165 2.6 55.2 0 109.9.5 165-2.6 64-3.1 120.8-17.7 167.6-64.5 46.9-46.9 61.4-103.6 64.5-167.6 3.2-55.1 2.6-109.8 2.6-165zm-88 235.8c-7.3 18.2-16.1 31.8-30.2 45.8-14.1 14.1-27.6 22.9-45.8 30.2C695.2 844.7 570.3 840 512 840c-58.3 0-183.3 4.7-235.9-16.1-18.2-7.3-31.8-16.1-45.8-30.2-14.1-14.1-22.9-27.6-30.2-45.8C179.3 695.2 184 570.3 184 512c0-58.3-4.7-183.3 16.1-235.9 7.3-18.2 16.1-31.8 30.2-45.8s27.6-22.9 45.8-30.2C328.7 179.3 453.7 184 512 184s183.3-4.7 235.9 16.1c18.2 7.3 31.8 16.1 45.8 30.2 14.1 14.1 22.9 27.6 30.2 45.8C844.7 328.7 840 453.7 840 512c0 58.3 4.7 183.2-16.2 235.8z')); exports.InterationOutline = getIcon('interation', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM304.8 524h50.7c3.7 0 6.8-3 6.8-6.8v-78.9c0-19.7 15.9-35.6 35.5-35.6h205.7v53.4c0 5.7 6.5 8.8 10.9 5.3l109.1-85.7c3.5-2.7 3.5-8 0-10.7l-109.1-85.7c-4.4-3.5-10.9-.3-10.9 5.3V338H397.7c-55.1 0-99.7 44.8-99.7 100.1V517c0 4 3 7 6.8 7zm-4.2 134.9l109.1 85.7c4.4 3.5 10.9.3 10.9-5.3v-53.4h205.7c55.1 0 99.7-44.8 99.7-100.1v-78.9c0-3.7-3-6.8-6.8-6.8h-50.7c-3.7 0-6.8 3-6.8 6.8v78.9c0 19.7-15.9 35.6-35.5 35.6H420.6V568c0-5.7-6.5-8.8-10.9-5.3l-109.1 85.7c-3.5 2.5-3.5 7.8 0 10.5z')); exports.LayoutOutline = getIcon('layout', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-696 72h136v656H184V184zm656 656H384V384h456v456zM384 320V184h456v136H384z')); exports.LeftSquareOutline = getIcon('left-square', outline, getNode(newViewBox, 'M365.3 518.5l246 178c5.3 3.8 12.7 0 12.7-6.5v-46.9c0-10.2-4.9-19.9-13.2-25.9L465.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5l-246 178a8.05 8.05 0 0 0 0 13z', 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.InfoCircleOutline = getIcon('info-circle', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z', 'M464 336a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z')); exports.LeftCircleOutline = getIcon('left-circle', outline, getNode(newViewBox, 'M603.3 327.5l-246 178a7.95 7.95 0 0 0 0 12.9l246 178c5.3 3.8 12.7 0 12.7-6.5V643c0-10.2-4.9-19.9-13.2-25.9L457.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5z', 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z')); exports.LikeOutline = getIcon('like', outline, getNode(newViewBox, 'M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z')); exports.LinkedinOutline = getIcon('linkedin', outline, getNode(newViewBox, 'M847.7 112H176.3c-35.5 0-64.3 28.8-64.3 64.3v671.4c0 35.5 28.8 64.3 64.3 64.3h671.4c35.5 0 64.3-28.8 64.3-64.3V176.3c0-35.5-28.8-64.3-64.3-64.3zm0 736c-447.8-.1-671.7-.2-671.7-.3.1-447.8.2-671.7.3-671.7 447.8.1 671.7.2 671.7.3-.1 447.8-.2 671.7-.3 671.7zM230.6 411.9h118.7v381.8H230.6zm59.4-52.2c37.9 0 68.8-30.8 68.8-68.8a68.8 68.8 0 1 0-137.6 0c-.1 38 30.7 68.8 68.8 68.8zm252.3 245.1c0-49.8 9.5-98 71.2-98 60.8 0 61.7 56.9 61.7 101.2v185.7h118.6V584.3c0-102.8-22.2-181.9-142.3-181.9-57.7 0-96.4 31.7-112.3 61.7h-1.6v-52.2H423.7v381.8h118.6V604.8z')); exports.MedicineBoxOutline = getIcon('medicine-box', outline, getNode(newViewBox, 'M839.2 278.1a32 32 0 0 0-30.4-22.1H736V144c0-17.7-14.3-32-32-32H320c-17.7 0-32 14.3-32 32v112h-72.8a31.9 31.9 0 0 0-30.4 22.1L112 502v378c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V502l-72.8-223.9zM360 184h304v72H360v-72zm480 656H184V513.4L244.3 328h535.4L840 513.4V840zM652 572H544V464c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v108H372c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h108v108c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V636h108c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z')); exports.MailOutline = getIcon('mail', outline, getNode(newViewBox, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 110.8V792H136V270.8l-27.6-21.5 39.3-50.5 42.8 33.3h643.1l42.8-33.3 39.3 50.5-27.7 21.5zM833.6 232L512 482 190.4 232l-42.8-33.3-39.3 50.5 27.6 21.5 341.6 265.6a55.99 55.99 0 0 0 68.7 0L888 270.8l27.6-21.5-39.3-50.5-42.7 33.2z')); exports.LockOutline = getIcon('lock', outline, getNode(newViewBox, 'M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 1 0-56 0z')); exports.MehOutline = getIcon('meh', outline, getNode(newViewBox, 'M288 421a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm352 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 0 1 248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 0 1 249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 0 1 775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 0 1 775 775zM664 565H360c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z')); exports.MessageOutline = getIcon('message', outline, getNode(newViewBox, 'M464 512a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm200 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm-400 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 0 0-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 0 0-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 0 0 112 714v152a46 46 0 0 0 46 46h152.1A449.4 449.4 0 0 0 510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 0 0 142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z')); exports.MobileOutline = getIcon('mobile', outline, getNode(newViewBox, 'M744 62H280c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h464c35.3 0 64-28.7 64-64V126c0-35.3-28.7-64-64-64zm-8 824H288V134h448v752zM472 784a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.MoneyCollectOutline = getIcon('money-collect', outline, getNode(newViewBox, 'M911.5 700.7a8 8 0 0 0-10.3-4.8L840 718.2V180c0-37.6-30.4-68-68-68H252c-37.6 0-68 30.4-68 68v538.2l-61.3-22.3c-.9-.3-1.8-.5-2.7-.5-4.4 0-8 3.6-8 8V763c0 3.3 2.1 6.3 5.3 7.5L501 910.1c7.1 2.6 14.8 2.6 21.9 0l383.8-139.5c3.2-1.2 5.3-4.2 5.3-7.5v-59.6c0-1-.2-1.9-.5-2.8zM512 837.5l-256-93.1V184h512v560.4l-256 93.1zM660.6 312h-54.5c-3 0-5.8 1.7-7.1 4.4l-84.7 168.8H511l-84.7-168.8a8 8 0 0 0-7.1-4.4h-55.7c-1.3 0-2.6.3-3.8 1-3.9 2.1-5.3 7-3.2 10.8l103.9 191.6h-57c-4.4 0-8 3.6-8 8v27.1c0 4.4 3.6 8 8 8h76v39h-76c-4.4 0-8 3.6-8 8v27.1c0 4.4 3.6 8 8 8h76V704c0 4.4 3.6 8 8 8h49.9c4.4 0 8-3.6 8-8v-63.5h76.3c4.4 0 8-3.6 8-8v-27.1c0-4.4-3.6-8-8-8h-76.3v-39h76.3c4.4 0 8-3.6 8-8v-27.1c0-4.4-3.6-8-8-8H564l103.7-191.6c.6-1.2 1-2.5 1-3.8-.1-4.3-3.7-7.9-8.1-7.9z')); exports.MinusCircleOutline = getIcon('minus-circle', outline, getNode(newViewBox, 'M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z', 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z')); exports.MinusSquareOutline = getIcon('minus-square', outline, getNode(newViewBox, 'M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z', 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.NotificationOutline = getIcon('notification', outline, getNode(newViewBox, 'M880 112c-3.8 0-7.7.7-11.6 2.3L292 345.9H128c-8.8 0-16 7.4-16 16.6v299c0 9.2 7.2 16.6 16 16.6h101.7c-3.7 11.6-5.7 23.9-5.7 36.4 0 65.9 53.8 119.5 120 119.5 55.4 0 102.1-37.6 115.9-88.4l408.6 164.2c3.9 1.5 7.8 2.3 11.6 2.3 16.9 0 32-14.2 32-33.2V145.2C912 126.2 897 112 880 112zM344 762.3c-26.5 0-48-21.4-48-47.8 0-11.2 3.9-21.9 11-30.4l84.9 34.1c-2 24.6-22.7 44.1-47.9 44.1zm496 58.4L318.8 611.3l-12.9-5.2H184V417.9h121.9l12.9-5.2L840 203.3v617.4z')); exports.PauseCircleOutline = getIcon('pause-circle', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm-88-532h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V360c0-4.4-3.6-8-8-8zm224 0h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V360c0-4.4-3.6-8-8-8z')); exports.PayCircleOutline = getIcon('pay-circle', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm159.6-585h-59.5c-3 0-5.8 1.7-7.1 4.4l-90.6 180H511l-90.6-180a8 8 0 0 0-7.1-4.4h-60.7c-1.3 0-2.6.3-3.8 1-3.9 2.1-5.3 7-3.2 10.9L457 515.7h-61.4c-4.4 0-8 3.6-8 8v29.9c0 4.4 3.6 8 8 8h81.7V603h-81.7c-4.4 0-8 3.6-8 8v29.9c0 4.4 3.6 8 8 8h81.7V717c0 4.4 3.6 8 8 8h54.3c4.4 0 8-3.6 8-8v-68.1h82c4.4 0 8-3.6 8-8V611c0-4.4-3.6-8-8-8h-82v-41.5h82c4.4 0 8-3.6 8-8v-29.9c0-4.4-3.6-8-8-8h-62l111.1-204.8c.6-1.2 1-2.5 1-3.8-.1-4.4-3.7-8-8.1-8z')); exports.PictureOutline = getIcon('picture', outline, getNode(newViewBox, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 1 0 0-176 88 88 0 0 0 0 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z')); exports.PieChartOutline = getIcon('pie-chart', outline, getNode(newViewBox, 'M864 518H506V160c0-4.4-3.6-8-8-8h-26a398.46 398.46 0 0 0-282.8 117.1 398.19 398.19 0 0 0-85.7 127.1A397.61 397.61 0 0 0 72 552a398.46 398.46 0 0 0 117.1 282.8c36.7 36.7 79.5 65.6 127.1 85.7A397.61 397.61 0 0 0 472 952a398.46 398.46 0 0 0 282.8-117.1c36.7-36.7 65.6-79.5 85.7-127.1A397.61 397.61 0 0 0 872 552v-26c0-4.4-3.6-8-8-8zM705.7 787.8A331.59 331.59 0 0 1 470.4 884c-88.1-.4-170.9-34.9-233.2-97.2C174.5 724.1 140 640.7 140 552c0-88.7 34.5-172.1 97.2-234.8 54.6-54.6 124.9-87.9 200.8-95.5V586h364.3c-7.7 76.3-41.3 147-96.6 201.8zM952 462.4l-2.6-28.2c-8.5-92.1-49.4-179-115.2-244.6A399.4 399.4 0 0 0 589 74.6L560.7 72c-4.7-.4-8.7 3.2-8.7 7.9V464c0 4.4 3.6 8 8 8l384-1c4.7 0 8.4-4 8-8.6zm-332.2-58.2V147.6a332.24 332.24 0 0 1 166.4 89.8c45.7 45.6 77 103.6 90 166.1l-256.4.7z')); exports.PhoneOutline = getIcon('phone', outline, getNode(newViewBox, 'M877.1 238.7L770.6 132.3c-13-13-30.4-20.3-48.8-20.3s-35.8 7.2-48.8 20.3L558.3 246.8c-13 13-20.3 30.5-20.3 48.9 0 18.5 7.2 35.8 20.3 48.9l89.6 89.7a405.46 405.46 0 0 1-86.4 127.3c-36.7 36.9-79.6 66-127.2 86.6l-89.6-89.7c-13-13-30.4-20.3-48.8-20.3a68.2 68.2 0 0 0-48.8 20.3L132.3 673c-13 13-20.3 30.5-20.3 48.9 0 18.5 7.2 35.8 20.3 48.9l106.4 106.4c22.2 22.2 52.8 34.9 84.2 34.9 6.5 0 12.8-.5 19.2-1.6 132.4-21.8 263.8-92.3 369.9-198.3C818 606 888.4 474.6 910.4 342.1c6.3-37.6-6.3-76.3-33.3-103.4zm-37.6 91.5c-19.5 117.9-82.9 235.5-178.4 331s-213 158.9-330.9 178.4c-14.8 2.5-30-2.5-40.8-13.2L184.9 721.9 295.7 611l119.8 120 .9.9 21.6-8a481.29 481.29 0 0 0 285.7-285.8l8-21.6-120.8-120.7 110.8-110.9 104.5 104.5c10.8 10.8 15.8 26 13.3 40.8z')); exports.PlaySquareOutline = getIcon('play-square', outline, getNode(newViewBox, 'M442.3 677.6l199.4-156.7a11.3 11.3 0 0 0 0-17.7L442.3 346.4c-7.4-5.8-18.3-.6-18.3 8.8v313.5c0 9.4 10.9 14.7 18.3 8.9z', 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.PlusCircleOutline = getIcon('plus-circle', outline, getNode(newViewBox, 'M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z', 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z')); exports.PlayCircleOutline = getIcon('play-circle', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z', 'M719.4 499.1l-296.1-215A15.9 15.9 0 0 0 398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 0 0 0-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z')); exports.PrinterOutline = getIcon('printer', outline, getNode(newViewBox, 'M820 436h-40c-4.4 0-8 3.6-8 8v40c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-40c0-4.4-3.6-8-8-8zm32-104H732V120c0-4.4-3.6-8-8-8H300c-4.4 0-8 3.6-8 8v212H172c-44.2 0-80 35.8-80 80v328c0 17.7 14.3 32 32 32h168v132c0 4.4 3.6 8 8 8h424c4.4 0 8-3.6 8-8V772h168c17.7 0 32-14.3 32-32V412c0-44.2-35.8-80-80-80zM360 180h304v152H360V180zm304 664H360V568h304v276zm200-140H732V500H292v204H160V412c0-6.6 5.4-12 12-12h680c6.6 0 12 5.4 12 12v292z')); exports.PlusSquareOutline = getIcon('plus-square', outline, getNode(newViewBox, 'M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z', 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.ProfileOutline = getIcon('profile', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM492 400h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zM340 368a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0 144a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0 144a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.ProjectOutline = getIcon('project', outline, getNode(newViewBox, 'M280 752h80c4.4 0 8-3.6 8-8V280c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8zm192-280h80c4.4 0 8-3.6 8-8V280c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8zm192 72h80c4.4 0 8-3.6 8-8V280c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v256c0 4.4 3.6 8 8 8zm216-432H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.PropertySafetyOutline = getIcon('property-safety', outline, getNode(newViewBox, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM810 654.3L512 886.5 214 654.3V226.7l298-101.6 298 101.6v427.6zM430.5 318h-46c-1.7 0-3.3.4-4.8 1.2a10.1 10.1 0 0 0-4 13.6l88 161.1h-45.2c-5.5 0-10 4.5-10 10v21.3c0 5.5 4.5 10 10 10h63.1v29.7h-63.1c-5.5 0-10 4.5-10 10v21.3c0 5.5 4.5 10 10 10h63.1V658c0 5.5 4.5 10 10 10h41.3c5.5 0 10-4.5 10-10v-51.8h63.4c5.5 0 10-4.5 10-10v-21.3c0-5.5-4.5-10-10-10h-63.4v-29.7h63.4c5.5 0 10-4.5 10-10v-21.3c0-5.5-4.5-10-10-10h-45.7l87.7-161.1a10.05 10.05 0 0 0-8.8-14.8h-45c-3.8 0-7.2 2.1-8.9 5.5l-73.2 144.3-72.9-144.3c-1.7-3.4-5.2-5.5-9-5.5z')); exports.ReadOutline = getIcon('read', outline, getNode(newViewBox, 'M928 161H699.2c-49.1 0-97.1 14.1-138.4 40.7L512 233l-48.8-31.3A255.2 255.2 0 0 0 324.8 161H96c-17.7 0-32 14.3-32 32v568c0 17.7 14.3 32 32 32h228.8c49.1 0 97.1 14.1 138.4 40.7l44.4 28.6c1.3.8 2.8 1.3 4.3 1.3s3-.4 4.3-1.3l44.4-28.6C602 807.1 650.1 793 699.2 793H928c17.7 0 32-14.3 32-32V193c0-17.7-14.3-32-32-32zM324.8 721H136V233h188.8c35.4 0 69.8 10.1 99.5 29.2l48.8 31.3 6.9 4.5v462c-47.6-25.6-100.8-39-155.2-39zm563.2 0H699.2c-54.4 0-107.6 13.4-155.2 39V298l6.9-4.5 48.8-31.3c29.7-19.1 64.1-29.2 99.5-29.2H888v488zM396.9 361H211.1c-3.9 0-7.1 3.4-7.1 7.5v45c0 4.1 3.2 7.5 7.1 7.5h185.7c3.9 0 7.1-3.4 7.1-7.5v-45c.1-4.1-3.1-7.5-7-7.5zm223.1 7.5v45c0 4.1 3.2 7.5 7.1 7.5h185.7c3.9 0 7.1-3.4 7.1-7.5v-45c0-4.1-3.2-7.5-7.1-7.5H627.1c-3.9 0-7.1 3.4-7.1 7.5zM396.9 501H211.1c-3.9 0-7.1 3.4-7.1 7.5v45c0 4.1 3.2 7.5 7.1 7.5h185.7c3.9 0 7.1-3.4 7.1-7.5v-45c.1-4.1-3.1-7.5-7-7.5zm416 0H627.1c-3.9 0-7.1 3.4-7.1 7.5v45c0 4.1 3.2 7.5 7.1 7.5h185.7c3.9 0 7.1-3.4 7.1-7.5v-45c.1-4.1-3.1-7.5-7-7.5z')); exports.PushpinOutline = getIcon('pushpin', outline, getNode(newViewBox, 'M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 0 0-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 0 0-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 0 1-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z')); exports.ReconciliationOutline = getIcon('reconciliation', outline, getNode(newViewBox, 'M676 565c-50.8 0-92 41.2-92 92s41.2 92 92 92 92-41.2 92-92-41.2-92-92-92zm0 126c-18.8 0-34-15.2-34-34s15.2-34 34-34 34 15.2 34 34-15.2 34-34 34zm204-523H668c0-30.9-25.1-56-56-56h-80c-30.9 0-56 25.1-56 56H264c-17.7 0-32 14.3-32 32v200h-88c-17.7 0-32 14.3-32 32v448c0 17.7 14.3 32 32 32h336c17.7 0 32-14.3 32-32v-16h368c17.7 0 32-14.3 32-32V200c0-17.7-14.3-32-32-32zm-412 64h72v-56h64v56h72v48H468v-48zm-20 616H176V616h272v232zm0-296H176v-88h272v88zm392 240H512V432c0-17.7-14.3-32-32-32H304V240h100v104h336V240h100v552zM704 408v96c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-96c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zM592 512h48c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8z')); exports.RedEnvelopeOutline = getIcon('red-envelope', outline, getNode(newViewBox, 'M440.6 462.6a8.38 8.38 0 0 0-7.5-4.6h-48.8c-1.3 0-2.6.4-3.9 1a8.4 8.4 0 0 0-3.4 11.4l87.4 161.1H419c-4.6 0-8.4 3.8-8.4 8.4V665c0 4.6 3.8 8.4 8.4 8.4h63V702h-63c-4.6 0-8.4 3.8-8.4 8.4v25.1c0 4.6 3.8 8.4 8.4 8.4h63v49.9c0 4.6 3.8 8.4 8.4 8.4h43.7c4.6 0 8.4-3.8 8.4-8.4v-49.9h63.3c4.7 0 8.4-3.8 8.2-8.5v-25c0-4.6-3.8-8.4-8.4-8.4h-63.3v-28.6h63.3c4.6 0 8.4-3.8 8.4-8.4v-25.1c0-4.6-3.8-8.4-8.4-8.4h-45.9l87.2-161a8.45 8.45 0 0 0-7.4-12.4h-47.8c-3.1 0-6 1.8-7.5 4.6l-71.9 141.9-71.7-142zM832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-40 824H232V193.1l260.3 204.1c11.6 9.1 27.9 9.1 39.5 0L792 193.1V888zm0-751.3h-31.7L512 331.3 263.7 136.7H232v-.7h560v.7z')); exports.QuestionCircleOutline = getIcon('question-circle', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z', 'M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0 1 30.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.RightCircleOutline = getIcon('right-circle', outline, getNode(newViewBox, 'M666.7 505.5l-246-178A8 8 0 0 0 408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z', 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z')); exports.RestOutline = getIcon('rest', outline, getNode(newViewBox, 'M508 704c79.5 0 144-64.5 144-144s-64.5-144-144-144-144 64.5-144 144 64.5 144 144 144zm0-224c44.2 0 80 35.8 80 80s-35.8 80-80 80-80-35.8-80-80 35.8-80 80-80z', 'M832 256h-28.1l-35.7-120.9c-4-13.7-16.5-23.1-30.7-23.1h-451c-14.3 0-26.8 9.4-30.7 23.1L220.1 256H192c-17.7 0-32 14.3-32 32v28c0 4.4 3.6 8 8 8h45.8l47.7 558.7a32 32 0 0 0 31.9 29.3h429.2a32 32 0 0 0 31.9-29.3L802.2 324H856c4.4 0 8-3.6 8-8v-28c0-17.7-14.3-32-32-32zm-518.6-76h397.2l22.4 76H291l22.4-76zm376.2 664H326.4L282 324h451.9l-44.3 520z')); exports.RocketOutline = getIcon('rocket', outline, getNode(newViewBox, 'M864 736c0-111.6-65.4-208-160-252.9V317.3c0-15.1-5.3-29.7-15.1-41.2L536.5 95.4C530.1 87.8 521 84 512 84s-18.1 3.8-24.5 11.4L335.1 276.1a63.97 63.97 0 0 0-15.1 41.2v165.8C225.4 528 160 624.4 160 736h156.5c-2.3 7.2-3.5 15-3.5 23.8 0 22.1 7.6 43.7 21.4 60.8a97.2 97.2 0 0 0 43.1 30.6c23.1 54 75.6 88.8 134.5 88.8 29.1 0 57.3-8.6 81.4-24.8 23.6-15.8 41.9-37.9 53-64a97 97 0 0 0 43.1-30.5 97.52 97.52 0 0 0 21.4-60.8c0-8.4-1.1-16.4-3.1-23.8H864zM762.3 621.4c9.4 14.6 17 30.3 22.5 46.6H700V558.7a211.6 211.6 0 0 1 62.3 62.7zM388 483.1V318.8l124-147 124 147V668H388V483.1zM239.2 668c5.5-16.3 13.1-32 22.5-46.6 16.3-25.2 37.5-46.5 62.3-62.7V668h-84.8zm388.9 116.2c-5.2 3-11.2 4.2-17.1 3.4l-19.5-2.4-2.8 19.4c-5.4 37.9-38.4 66.5-76.7 66.5-38.3 0-71.3-28.6-76.7-66.5l-2.8-19.5-19.5 2.5a27.7 27.7 0 0 1-17.1-3.5c-8.7-5-14.1-14.3-14.1-24.4 0-10.6 5.9-19.4 14.6-23.8h231.3c8.8 4.5 14.6 13.3 14.6 23.8-.1 10.2-5.5 19.6-14.2 24.5zM464 400a48 48 0 1 0 96 0 48 48 0 1 0-96 0z')); exports.SafetyCertificateOutline = getIcon('safety-certificate', outline, getNode(newViewBox, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM810 654.3L512 886.5 214 654.3V226.7l298-101.6 298 101.6v427.6zm-405.8-201c-3-4.1-7.8-6.6-13-6.6H336c-6.5 0-10.3 7.4-6.5 12.7l126.4 174a16.1 16.1 0 0 0 26 0l212.6-292.7c3.8-5.3 0-12.7-6.5-12.7h-55.2c-5.1 0-10 2.5-13 6.6L468.9 542.4l-64.7-89.1z')); exports.RightSquareOutline = getIcon('right-square', outline, getNode(newViewBox, 'M412.7 696.5l246-178c4.4-3.2 4.4-9.7 0-12.9l-246-178c-5.3-3.8-12.7 0-12.7 6.5V381c0 10.2 4.9 19.9 13.2 25.9L558.6 512 413.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5z', 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.ScheduleOutline = getIcon('schedule', outline, getNode(newViewBox, 'M928 224H768v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H548v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H328v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H96c-17.7 0-32 14.3-32 32v576c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V256c0-17.7-14.3-32-32-32zm-40 568H136V296h120v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h148v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h148v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h120v496zM416 496H232c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm0 136H232c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm308.2-177.4L620.6 598.3l-52.8-73.1c-3-4.2-7.8-6.6-12.9-6.6H500c-6.5 0-10.3 7.4-6.5 12.7l114.1 158.2a15.9 15.9 0 0 0 25.8 0l165-228.7c3.8-5.3 0-12.7-6.5-12.7H737c-5-.1-9.8 2.4-12.8 6.5z')); exports.SecurityScanOutline = getIcon('security-scan', outline, getNode(newViewBox, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM810 654.3L512 886.5 214 654.3V226.7l298-101.6 298 101.6v427.6zM402.9 528.8l-77.5 77.5a8.03 8.03 0 0 0 0 11.3l34 34c3.1 3.1 8.2 3.1 11.3 0l77.5-77.5c55.7 35.1 130.1 28.4 178.6-20.1 56.3-56.3 56.3-147.5 0-203.8-56.3-56.3-147.5-56.3-203.8 0-48.5 48.5-55.2 123-20.1 178.6zm65.4-133.3c31.3-31.3 82-31.3 113.2 0 31.3 31.3 31.3 82 0 113.2-31.3 31.3-82 31.3-113.2 0s-31.3-81.9 0-113.2z')); exports.SaveOutline = getIcon('save', outline, getNode(newViewBox, 'M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z')); exports.ShopOutline = getIcon('shop', outline, getNode(newViewBox, 'M882 272.1V144c0-17.7-14.3-32-32-32H174c-17.7 0-32 14.3-32 32v128.1c-16.7 1-30 14.9-30 31.9v131.7a177 177 0 0 0 14.4 70.4c4.3 10.2 9.6 19.8 15.6 28.9v345c0 17.6 14.3 32 32 32h676c17.7 0 32-14.3 32-32V535a175 175 0 0 0 15.6-28.9c9.5-22.3 14.4-46 14.4-70.4V304c0-17-13.3-30.9-30-31.9zM214 184h596v88H214v-88zm362 656.1H448V736h128v104.1zm234 0H640V704c0-17.7-14.3-32-32-32H416c-17.7 0-32 14.3-32 32v136.1H214V597.9c2.9 1.4 5.9 2.8 9 4 22.3 9.4 46 14.1 70.4 14.1s48-4.7 70.4-14.1c13.8-5.8 26.8-13.2 38.7-22.1.2-.1.4-.1.6 0a180.4 180.4 0 0 0 38.7 22.1c22.3 9.4 46 14.1 70.4 14.1 24.4 0 48-4.7 70.4-14.1 13.8-5.8 26.8-13.2 38.7-22.1.2-.1.4-.1.6 0a180.4 180.4 0 0 0 38.7 22.1c22.3 9.4 46 14.1 70.4 14.1 24.4 0 48-4.7 70.4-14.1 3-1.3 6-2.6 9-4v242.2zm30-404.4c0 59.8-49 108.3-109.3 108.3-40.8 0-76.4-22.1-95.2-54.9-2.9-5-8.1-8.1-13.9-8.1h-.6c-5.7 0-11 3.1-13.9 8.1A109.24 109.24 0 0 1 512 544c-40.7 0-76.2-22-95-54.7-3-5.1-8.4-8.3-14.3-8.3s-11.4 3.2-14.3 8.3a109.63 109.63 0 0 1-95.1 54.7C233 544 184 495.5 184 435.7v-91.2c0-.3.2-.5.5-.5h655c.3 0 .5.2.5.5v91.2z')); exports.SettingOutline = getIcon('setting', outline, getNode(newViewBox, 'M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a443.74 443.74 0 0 0-79.7-137.9l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.4a351.86 351.86 0 0 0-99 57.4l-81.9-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a446.02 446.02 0 0 0-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0 0 25.8 25.7l2.7.5a449.4 449.4 0 0 0 159 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-85a350 350 0 0 0 99.7-57.6l81.3 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 0 1-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 0 1-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 0 1 624 502c0 29.9-11.7 58-32.8 79.2z')); exports.ShoppingOutline = getIcon('shopping', outline, getNode(newViewBox, 'M832 312H696v-16c0-101.6-82.4-184-184-184s-184 82.4-184 184v16H192c-17.7 0-32 14.3-32 32v536c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V344c0-17.7-14.3-32-32-32zm-432-16c0-61.9 50.1-112 112-112s112 50.1 112 112v16H400v-16zm392 544H232V384h96v88c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-88h224v88c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-88h96v456z')); exports.SkypeOutline = getIcon('skype', outline, getNode(newViewBox, 'M883.7 578.6c4.1-22.5 6.3-45.5 6.3-68.5 0-51-10-100.5-29.7-147-19-45-46.3-85.4-81-120.1a375.79 375.79 0 0 0-120.1-80.9c-46.6-19.7-96-29.7-147-29.7-24 0-48.1 2.3-71.5 6.8A225.1 225.1 0 0 0 335.6 113c-59.7 0-115.9 23.3-158.1 65.5A222.25 222.25 0 0 0 112 336.6c0 38 9.8 75.4 28.1 108.4-3.7 21.4-5.7 43.3-5.7 65.1 0 51 10 100.5 29.7 147 19 45 46.2 85.4 80.9 120.1 34.7 34.7 75.1 61.9 120.1 80.9 46.6 19.7 96 29.7 147 29.7 22.2 0 44.4-2 66.2-5.9 33.5 18.9 71.3 29 110 29 59.7 0 115.9-23.2 158.1-65.5 42.3-42.2 65.5-98.4 65.5-158.1.1-38-9.7-75.5-28.2-108.7zm-88.1 216C766.9 823.4 729 839 688.4 839c-26.1 0-51.8-6.8-74.6-19.7l-22.5-12.7-25.5 4.5c-17.8 3.2-35.8 4.8-53.6 4.8-41.4 0-81.3-8.1-119.1-24.1-36.3-15.3-69-37.3-97.2-65.5a304.29 304.29 0 0 1-65.5-97.1c-16-37.7-24-77.6-24-119 0-17.4 1.6-35.2 4.6-52.8l4.4-25.1L203 410a151.02 151.02 0 0 1-19.1-73.4c0-40.6 15.7-78.5 44.4-107.2C257.1 200.7 295 185 335.6 185a153 153 0 0 1 71.4 17.9l22.4 11.8 24.8-4.8c18.9-3.6 38.4-5.5 58-5.5 41.4 0 81.3 8.1 119 24 36.5 15.4 69.1 37.4 97.2 65.5 28.2 28.1 50.2 60.8 65.6 97.2 16 37.7 24 77.6 24 119 0 18.4-1.7 37-5.1 55.5l-4.7 25.5 12.6 22.6c12.6 22.5 19.2 48 19.2 73.7 0 40.7-15.7 78.5-44.4 107.2zM583.4 466.2L495 446.6c-33.6-7.7-72.3-17.8-72.3-49.5s27.1-53.9 76.1-53.9c98.7 0 89.7 67.8 138.7 67.8 25.8 0 48.4-15.2 48.4-41.2 0-60.8-97.4-106.5-180-106.5-89.7 0-185.2 38.1-185.2 139.5 0 48.8 17.4 100.8 113.6 124.9l119.4 29.8c36.1 8.9 45.2 29.2 45.2 47.6 0 30.5-30.3 60.3-85.2 60.3-107.2 0-92.3-82.5-149.7-82.5-25.8 0-44.5 17.8-44.5 43.1 0 49.4 60 115.4 194.2 115.4 127.7 0 191-61.5 191-144 0-53.1-24.5-109.6-121.3-131.2z')); exports.SlidersOutline = getIcon('sliders', outline, getNode(newViewBox, 'M320 224h-66v-56c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v56h-66c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8h66v56c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-56h66c4.4 0 8-3.6 8-8V232c0-4.4-3.6-8-8-8zm-60 508h-80V292h80v440zm644-436h-66v-96c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v96h-66c-4.4 0-8 3.6-8 8v416c0 4.4 3.6 8 8 8h66v96c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-96h66c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8zm-60 364h-80V364h80v296zM612 404h-66V232c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v172h-66c-4.4 0-8 3.6-8 8v200c0 4.4 3.6 8 8 8h66v172c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V620h66c4.4 0 8-3.6 8-8V412c0-4.4-3.6-8-8-8zm-60 145a3 3 0 0 1-3 3h-74a3 3 0 0 1-3-3v-74a3 3 0 0 1 3-3h74a3 3 0 0 1 3 3v74z')); exports.SkinOutline = getIcon('skin', outline, getNode(newViewBox, 'M870 126H663.8c-17.4 0-32.9 11.9-37 29.3C614.3 208.1 567 246 512 246s-102.3-37.9-114.8-90.7a37.93 37.93 0 0 0-37-29.3H154a44 44 0 0 0-44 44v252a44 44 0 0 0 44 44h75v388a44 44 0 0 0 44 44h478a44 44 0 0 0 44-44V466h75a44 44 0 0 0 44-44V170a44 44 0 0 0-44-44zm-28 268H723v432H301V394H182V198h153.3c28.2 71.2 97.5 120 176.7 120s148.5-48.8 176.7-120H842v196z')); exports.SlackSquareOutline = getIcon('slack-square', outline, getNode(newViewBox, 'M893.1 397.6c-85.8-286-209.5-352.5-495.5-266.7S45.1 340.4 130.9 626.4s209.5 352.5 495.5 266.7 352.5-209.5 266.7-495.5zm-150 189.9l-50.3 16.3 16.5 50.6c7.7 23.6-5.3 49-28.9 56.7-23.6 7.7-49-5.3-56.7-28.9l-16.5-50.6L506 664.5l16.5 50.6c7.7 23.6-5.3 49-28.9 56.7-23.6 7.7-49-5.3-56.7-28.9l-16.5-50.6-51 16.6c-23.6 7.7-49-5.3-56.7-28.9s5.3-49 28.9-56.7l51-16.6-32.9-101.3-51 16.6c-23.6 7.7-49-5.3-56.7-28.9-7.7-23.6 5.3-49 28.9-56.7l51-16.6-16.5-50.6c-7.7-23.6 5.3-49 28.9-56.7 23.6-7.7 49 5.3 56.7 28.9l16.5 50.6 101.3-32.9-16.5-50.6c-7.7-23.6 5.3-49 28.9-56.7s49 5.3 56.7 28.9l16.5 50.6 50.3-16.3c23.6-7.7 49 5.3 56.7 28.9 7.7 23.6-5.3 49-28.9 56.7L632.1 417 665 518.3l50.3-16.3c23.6-7.7 49 5.3 56.7 28.9 7.7 23.6-5.3 48.9-28.9 56.6zM445.26 477.67l101.3-32.9 32.9 101.29-101.29 32.9z')); exports.SnippetsOutline = getIcon('snippets', outline, getNode(newViewBox, 'M832 112H724V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H500V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H320c-17.7 0-32 14.3-32 32v120h-96c-17.7 0-32 14.3-32 32v632c0 17.7 14.3 32 32 32h512c17.7 0 32-14.3 32-32v-96h96c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM664 888H232V336h218v174c0 22.1 17.9 40 40 40h174v338zm0-402H514V336h.2L664 485.8v.2zm128 274h-56V456L544 264H360v-80h68v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h152v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h68v576z')); exports.SmileOutline = getIcon('smile', outline, getNode(newViewBox, 'M288 421a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm352 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 0 1 248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 0 1 249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 0 1 775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 0 1 775 775zM664 533h-48.1c-4.2 0-7.8 3.2-8.1 7.4C604 589.9 562.5 629 512 629s-92.1-39.1-95.8-88.6c-.3-4.2-3.9-7.4-8.1-7.4H360a8 8 0 0 0-8 8.4c4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6a8 8 0 0 0-8-8.4z')); exports.StarOutline = getIcon('star', outline, getNode(newViewBox, 'M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 0 0 .6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0 0 46.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z')); exports.StepBackwardOutline = getIcon('step-backward', outline, getNode(normalViewBox, 'M347.6 528.95l383.2 301.02c14.25 11.2 35.2 1.1 35.2-16.95V210.97c0-18.05-20.95-28.14-35.2-16.94L347.6 495.05a21.53 21.53 0 0 0 0 33.9M330 864h-64a8 8 0 0 1-8-8V168a8 8 0 0 1 8-8h64a8 8 0 0 1 8 8v688a8 8 0 0 1-8 8')); exports.StepForwardOutline = getIcon('step-forward', outline, getNode(normalViewBox, 'M676.4 528.95L293.2 829.97c-14.25 11.2-35.2 1.1-35.2-16.95V210.97c0-18.05 20.95-28.14 35.2-16.94l383.2 301.02a21.53 21.53 0 0 1 0 33.9M694 864h64a8 8 0 0 0 8-8V168a8 8 0 0 0-8-8h-64a8 8 0 0 0-8 8v688a8 8 0 0 0 8 8')); exports.SoundOutline = getIcon('sound', outline, getNode(newViewBox, 'M625.9 115c-5.9 0-11.9 1.6-17.4 5.3L254 352H90c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h164l354.5 231.7c5.5 3.6 11.6 5.3 17.4 5.3 16.7 0 32.1-13.3 32.1-32.1V147.1c0-18.8-15.4-32.1-32.1-32.1zM586 803L293.4 611.7l-18-11.7H146V424h129.4l17.9-11.7L586 221v582zm348-327H806c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16h128c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16zm-41.9 261.8l-110.3-63.7a15.9 15.9 0 0 0-21.7 5.9l-19.9 34.5c-4.4 7.6-1.8 17.4 5.8 21.8L856.3 800a15.9 15.9 0 0 0 21.7-5.9l19.9-34.5c4.4-7.6 1.7-17.4-5.8-21.8zM760 344a15.9 15.9 0 0 0 21.7 5.9L892 286.2c7.6-4.4 10.2-14.2 5.8-21.8L878 230a15.9 15.9 0 0 0-21.7-5.9L746 287.8a15.99 15.99 0 0 0-5.8 21.8L760 344z')); exports.SwitcherOutline = getIcon('switcher', outline, getNode(newViewBox, 'M752 240H144c-17.7 0-32 14.3-32 32v608c0 17.7 14.3 32 32 32h608c17.7 0 32-14.3 32-32V272c0-17.7-14.3-32-32-32zm-40 600H184V312h528v528zm168-728H264c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h576v576c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32zM300 550h296v64H300z')); exports.TabletOutline = getIcon('tablet', outline, getNode(newViewBox, 'M800 64H224c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h576c35.3 0 64-28.7 64-64V128c0-35.3-28.7-64-64-64zm-8 824H232V136h560v752zM472 784a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.StopOutline = getIcon('stop', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z')); exports.TagOutline = getIcon('tag', outline, getNode(newViewBox, 'M938 458.8l-29.6-312.6c-1.5-16.2-14.4-29-30.6-30.6L565.2 86h-.4c-3.2 0-5.7 1-7.6 2.9L88.9 557.2a9.96 9.96 0 0 0 0 14.1l363.8 363.8c1.9 1.9 4.4 2.9 7.1 2.9s5.2-1 7.1-2.9l468.3-468.3c2-2.1 3-5 2.8-8zM459.7 834.7L189.3 564.3 589 164.6 836 188l23.4 247-399.7 399.7zM680 256c-48.5 0-88 39.5-88 88s39.5 88 88 88 88-39.5 88-88-39.5-88-88-88zm0 120c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z')); exports.TaobaoCircleOutline = getIcon('taobao-circle', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zM315.7 291.5c27.3 0 49.5 22.1 49.5 49.4s-22.1 49.4-49.5 49.4a49.4 49.4 0 1 1 0-98.8zM366.9 578c-13.6 42.3-10.2 26.7-64.4 144.5l-78.5-49s87.7-79.8 105.6-116.2c19.2-38.4-21.1-58.9-21.1-58.9l-60.2-37.5 32.7-50.2c45.4 33.7 48.7 36.6 79.2 67.2 23.8 23.9 20.7 56.8 6.7 100.1zm427.2 55c-15.3 143.8-202.4 90.3-202.4 90.3l10.2-41.1 43.3 9.3c80 5 72.3-64.9 72.3-64.9V423c.6-77.3-72.6-85.4-204.2-38.3l30.6 8.3c-2.5 9-12.5 23.2-25.2 38.6h176v35.6h-99.1v44.5h98.7v35.7h-98.7V622c14.9-4.8 28.6-11.5 40.5-20.5l-8.7-32.5 46.5-14.4 38.8 94.9-57.3 23.9-10.2-37.8c-25.6 19.5-78.8 48-171.8 45.4-99.2 2.6-73.7-112-73.7-112l2.5-1.3H472c-.5 14.7-6.6 38.7 1.7 51.8 6.8 10.8 24.2 12.6 35.3 13.1 1.3.1 2.6.1 3.9.1v-85.3h-101v-35.7h101v-44.5H487c-22.7 24.1-43.5 44.1-43.5 44.1l-30.6-26.7c21.7-22.9 43.3-59.1 56.8-83.2-10.9 4.4-22 9.2-33.6 14.2-11.2 14.3-24.2 29-38.7 43.5.5.8-50-28.4-50-28.4 52.2-44.4 81.4-139.9 81.4-139.9l72.5 20.4s-5.9 14-18.4 35.6c290.3-82.3 307.4 50.5 307.4 50.5s19.1 91.8 3.8 235.7z')); exports.TagsOutline = getIcon('tags', outline, getNode(newViewBox, 'M483.2 790.3L861.4 412c1.7-1.7 2.5-4 2.3-6.3l-25.5-301.4c-.7-7.8-6.8-13.9-14.6-14.6L522.2 64.3c-2.3-.2-4.7.6-6.3 2.3L137.7 444.8a8.03 8.03 0 0 0 0 11.3l334.2 334.2c3.1 3.2 8.2 3.2 11.3 0zm62.6-651.7l224.6 19 19 224.6L477.5 694 233.9 450.5l311.9-311.9zm60.16 186.23a48 48 0 1 0 67.88-67.89 48 48 0 1 0-67.88 67.89zM889.7 539.8l-39.6-39.5a8.03 8.03 0 0 0-11.3 0l-362 361.3-237.6-237a8.03 8.03 0 0 0-11.3 0l-39.6 39.5a8.03 8.03 0 0 0 0 11.3l243.2 242.8 39.6 39.5c3.1 3.1 8.2 3.1 11.3 0l407.3-406.6c3.1-3.1 3.1-8.2 0-11.3z')); exports.ToolOutline = getIcon('tool', outline, getNode(newViewBox, 'M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 0 1 144-53.5L537 318.9a32.05 32.05 0 0 0 0 45.3l124.5 124.5a32.05 32.05 0 0 0 45.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z')); exports.TrophyOutline = getIcon('trophy', outline, getNode(newViewBox, 'M868 160h-92v-40c0-4.4-3.6-8-8-8H256c-4.4 0-8 3.6-8 8v40h-92a44 44 0 0 0-44 44v148c0 81.7 60 149.6 138.2 162C265.7 630.2 359 721.7 476 734.5v105.2H280c-17.7 0-32 14.3-32 32V904c0 4.4 3.6 8 8 8h512c4.4 0 8-3.6 8-8v-32.3c0-17.7-14.3-32-32-32H548V734.5C665 721.7 758.3 630.2 773.8 514 852 501.6 912 433.7 912 352V204a44 44 0 0 0-44-44zM184 352V232h64v207.6a91.99 91.99 0 0 1-64-87.6zm520 128c0 49.1-19.1 95.4-53.9 130.1-34.8 34.8-81 53.9-130.1 53.9h-16c-49.1 0-95.4-19.1-130.1-53.9-34.8-34.8-53.9-81-53.9-130.1V184h384v296zm136-128c0 41-26.9 75.8-64 87.6V232h64v120z')); exports.ThunderboltOutline = getIcon('thunderbolt', outline, getNode(newViewBox, 'M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z')); exports.UnlockOutline = getIcon('unlock', outline, getNode(newViewBox, 'M832 464H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v68c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-68c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zm-40 376H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 1 0-56 0z')); exports.UpSquareOutline = getIcon('up-square', outline, getNode(newViewBox, 'M334 624h46.9c10.2 0 19.9-4.9 25.9-13.2L512 465.4l105.2 145.4c6 8.3 15.6 13.2 25.9 13.2H690c6.5 0 10.3-7.4 6.5-12.7l-178-246a7.95 7.95 0 0 0-12.9 0l-178 246A7.96 7.96 0 0 0 334 624z', 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.VideoCameraOutline = getIcon('video-camera', outline, getNode(newViewBox, 'M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226zM208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z')); exports.UpCircleOutline = getIcon('up-circle', outline, getNode(newViewBox, 'M518.5 360.3a7.95 7.95 0 0 0-12.9 0l-178 246c-3.8 5.3 0 12.7 6.5 12.7H381c10.2 0 19.9-4.9 25.9-13.2L512 460.4l105.2 145.4c6 8.3 15.6 13.2 25.9 13.2H690c6.5 0 10.3-7.4 6.5-12.7l-178-246z', 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z')); exports.WalletOutline = getIcon('wallet', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 464H528V448h312v128zm0 264H184V184h656v200H496c-17.7 0-32 14.3-32 32v192c0 17.7 14.3 32 32 32h344v200zM580 512a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.UsbOutline = getIcon('usb', outline, getNode(newViewBox, 'M760 432V144c0-17.7-14.3-32-32-32H296c-17.7 0-32 14.3-32 32v288c-66.2 0-120 52.1-120 116v356c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V548c0-24.3 21.6-44 48.1-44h495.8c26.5 0 48.1 19.7 48.1 44v356c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V548c0-63.9-53.8-116-120-116zm-424 0V184h352v248H336zm120-184h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm160 0h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z')); exports.WarningOutline = getIcon('warning', outline, getNode(newViewBox, 'M464 720a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z')); exports.WechatOutline = getIcon('wechat', outline, getNode(newViewBox, 'M690.1 377.4c5.9 0 11.8.2 17.6.5-24.4-128.7-158.3-227.1-319.9-227.1C209 150.8 64 271.4 64 420.2c0 81.1 43.6 154.2 111.9 203.6a21.5 21.5 0 0 1 9.1 17.6c0 2.4-.5 4.6-1.1 6.9-5.5 20.3-14.2 52.8-14.6 54.3-.7 2.6-1.7 5.2-1.7 7.9 0 5.9 4.8 10.8 10.8 10.8 2.3 0 4.2-.9 6.2-2l70.9-40.9c5.3-3.1 11-5 17.2-5 3.2 0 6.4.5 9.5 1.4 33.1 9.5 68.8 14.8 105.7 14.8 6 0 11.9-.1 17.8-.4-7.1-21-10.9-43.1-10.9-66 0-135.8 132.2-245.8 295.3-245.8zm-194.3-86.5c23.8 0 43.2 19.3 43.2 43.1s-19.3 43.1-43.2 43.1c-23.8 0-43.2-19.3-43.2-43.1s19.4-43.1 43.2-43.1zm-215.9 86.2c-23.8 0-43.2-19.3-43.2-43.1s19.3-43.1 43.2-43.1 43.2 19.3 43.2 43.1-19.4 43.1-43.2 43.1zm586.8 415.6c56.9-41.2 93.2-102 93.2-169.7 0-124-120.8-224.5-269.9-224.5-149 0-269.9 100.5-269.9 224.5S540.9 847.5 690 847.5c30.8 0 60.6-4.4 88.1-12.3 2.6-.8 5.2-1.2 7.9-1.2 5.2 0 9.9 1.6 14.3 4.1l59.1 34c1.7 1 3.3 1.7 5.2 1.7a9 9 0 0 0 6.4-2.6 9 9 0 0 0 2.6-6.4c0-2.2-.9-4.4-1.4-6.6-.3-1.2-7.6-28.3-12.2-45.3-.5-1.9-.9-3.8-.9-5.7.1-5.9 3.1-11.2 7.6-14.5zM600.2 587.2c-19.9 0-36-16.1-36-35.9 0-19.8 16.1-35.9 36-35.9s36 16.1 36 35.9c0 19.8-16.2 35.9-36 35.9zm179.9 0c-19.9 0-36-16.1-36-35.9 0-19.8 16.1-35.9 36-35.9s36 16.1 36 35.9a36.08 36.08 0 0 1-36 35.9z')); exports.WeiboCircleOutline = getIcon('weibo-circle', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-44.4 672C353.1 736 236 680.4 236 588.9c0-47.8 30.2-103.1 82.3-155.3 69.5-69.6 150.6-101.4 181.1-70.8 13.5 13.5 14.8 36.8 6.1 64.6-4.5 14 13.1 6.3 13.1 6.3 56.2-23.6 105.2-25 123.1.7 9.6 13.7 8.6 32.8-.2 55.1-4.1 10.2 1.3 11.8 9 14.1 31.7 9.8 66.9 33.6 66.9 75.5.2 69.5-99.7 156.9-249.8 156.9zm207.3-290.8a34.9 34.9 0 0 0-7.2-34.1 34.68 34.68 0 0 0-33.1-10.7 18.24 18.24 0 0 1-7.6-35.7c24.1-5.1 50.1 2.3 67.7 21.9 17.7 19.6 22.4 46.3 14.9 69.8a18.13 18.13 0 0 1-22.9 11.7 18.18 18.18 0 0 1-11.8-22.9zm106 34.3s0 .1 0 0a21.1 21.1 0 0 1-26.6 13.7 21.19 21.19 0 0 1-13.6-26.7c11-34.2 4-73.2-21.7-101.8a104.04 104.04 0 0 0-98.9-32.1 21.14 21.14 0 0 1-25.1-16.3 21.07 21.07 0 0 1 16.2-25.1c49.4-10.5 102.8 4.8 139.1 45.1 36.3 40.2 46.1 95.1 30.6 143.2zm-334.5 6.1c-91.4 9-160.7 65.1-154.7 125.2 5.9 60.1 84.8 101.5 176.2 92.5 91.4-9.1 160.7-65.1 154.7-125.3-5.9-60.1-84.8-101.5-176.2-92.4zm80.2 141.7c-18.7 42.3-72.3 64.8-117.8 50.1-43.9-14.2-62.5-57.7-43.3-96.8 18.9-38.4 68-60.1 111.5-48.8 45 11.7 68 54.2 49.6 95.5zm-93-32.2c-14.2-5.9-32.4.2-41.2 13.9-8.8 13.8-4.7 30.2 9.3 36.6 14.3 6.5 33.2.3 42-13.8 8.8-14.3 4.2-30.6-10.1-36.7zm34.9-14.5c-5.4-2.2-12.2.5-15.4 5.8-3.1 5.4-1.4 11.5 4.1 13.8 5.5 2.3 12.6-.3 15.8-5.8 3-5.6 1-11.8-4.5-13.8z')); exports.WindowsOutline = getIcon('windows', outline, getNode(newViewBox, 'M120.1 770.6L443 823.2V543.8H120.1v226.8zm63.4-163.5h196.2v141.6l-196.2-31.9V607.1zm340.3 226.5l382 62.2v-352h-382v289.8zm63.4-226.5h255.3v214.4l-255.3-41.6V607.1zm-63.4-415.7v288.8h382V128.1l-382 63.3zm318.7 225.5H587.3V245l255.3-42.3v214.2zm-722.4 63.3H443V201.9l-322.9 53.5v224.8zM183.5 309l196.2-32.5v140.4H183.5V309z')); exports.WeiboSquareOutline = getIcon('weibo-square', outline, getNode(newViewBox, 'M433.6 595.1c-14.2-5.9-32.4.2-41.2 13.9-8.8 13.8-4.7 30.2 9.3 36.6 14.3 6.5 33.2.3 42-13.8 8.8-14.3 4.2-30.6-10.1-36.7zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM467.6 736C353.1 736 236 680.4 236 588.9c0-47.8 30.2-103.1 82.3-155.3 69.5-69.6 150.6-101.4 181.1-70.8 13.5 13.5 14.8 36.8 6.1 64.6-4.5 14 13.1 6.3 13.1 6.3 56.2-23.6 105.2-25 123.1.7 9.6 13.7 8.6 32.8-.2 55.1-4.1 10.2 1.3 11.8 9 14.1 31.7 9.8 66.9 33.6 66.9 75.5.2 69.5-99.7 156.9-249.8 156.9zm207.3-290.8a34.9 34.9 0 0 0-7.2-34.1 34.68 34.68 0 0 0-33.1-10.7 18.24 18.24 0 0 1-7.6-35.7c24.1-5.1 50.1 2.3 67.7 21.9 17.7 19.6 22.4 46.3 14.9 69.8a18.13 18.13 0 0 1-22.9 11.7 18.18 18.18 0 0 1-11.8-22.9zm106 34.3s0 .1 0 0a21.1 21.1 0 0 1-26.6 13.7 21.19 21.19 0 0 1-13.6-26.7c11-34.2 4-73.2-21.7-101.8a104.04 104.04 0 0 0-98.9-32.1 21.14 21.14 0 0 1-25.1-16.3 21.07 21.07 0 0 1 16.2-25.1c49.4-10.5 102.8 4.8 139.1 45.1 36.3 40.2 46.1 95.1 30.6 143.2zm-334.5 6.1c-91.4 9-160.7 65.1-154.7 125.2 5.9 60.1 84.8 101.5 176.2 92.5 91.4-9.1 160.7-65.1 154.7-125.3-5.9-60.1-84.8-101.5-176.2-92.4zm80.2 141.7c-18.7 42.3-72.3 64.8-117.8 50.1-43.9-14.2-62.5-57.7-43.3-96.8 18.9-38.4 68-60.1 111.5-48.8 45 11.7 68 54.2 49.6 95.5zm-58.1-46.7c-5.4-2.2-12.2.5-15.4 5.8-3.1 5.4-1.4 11.5 4.1 13.8 5.5 2.3 12.6-.3 15.8-5.8 3-5.6 1-11.8-4.5-13.8z')); exports.YoutubeOutline = getIcon('youtube', outline, getNode(newViewBox, 'M960 509.2c0-2.2 0-4.7-.1-7.6-.1-8.1-.3-17.2-.5-26.9-.8-27.9-2.2-55.7-4.4-81.9-3-36.1-7.4-66.2-13.4-88.8a139.52 139.52 0 0 0-98.3-98.5c-28.3-7.6-83.7-12.3-161.7-15.2-37.1-1.4-76.8-2.3-116.5-2.8-13.9-.2-26.8-.3-38.4-.4h-29.4c-11.6.1-24.5.2-38.4.4-39.7.5-79.4 1.4-116.5 2.8-78 3-133.5 7.7-161.7 15.2A139.35 139.35 0 0 0 82.4 304C76.3 326.6 72 356.7 69 392.8c-2.2 26.2-3.6 54-4.4 81.9-.3 9.7-.4 18.8-.5 26.9 0 2.9-.1 5.4-.1 7.6v5.6c0 2.2 0 4.7.1 7.6.1 8.1.3 17.2.5 26.9.8 27.9 2.2 55.7 4.4 81.9 3 36.1 7.4 66.2 13.4 88.8 12.8 47.9 50.4 85.7 98.3 98.5 28.2 7.6 83.7 12.3 161.7 15.2 37.1 1.4 76.8 2.3 116.5 2.8 13.9.2 26.8.3 38.4.4h29.4c11.6-.1 24.5-.2 38.4-.4 39.7-.5 79.4-1.4 116.5-2.8 78-3 133.5-7.7 161.7-15.2 47.9-12.8 85.5-50.5 98.3-98.5 6.1-22.6 10.4-52.7 13.4-88.8 2.2-26.2 3.6-54 4.4-81.9.3-9.7.4-18.8.5-26.9 0-2.9.1-5.4.1-7.6v-5.6zm-72 5.2c0 2.1 0 4.4-.1 7.1-.1 7.8-.3 16.4-.5 25.7-.7 26.6-2.1 53.2-4.2 77.9-2.7 32.2-6.5 58.6-11.2 76.3-6.2 23.1-24.4 41.4-47.4 47.5-21 5.6-73.9 10.1-145.8 12.8-36.4 1.4-75.6 2.3-114.7 2.8-13.7.2-26.4.3-37.8.3h-28.6l-37.8-.3c-39.1-.5-78.2-1.4-114.7-2.8-71.9-2.8-124.9-7.2-145.8-12.8-23-6.2-41.2-24.4-47.4-47.5-4.7-17.7-8.5-44.1-11.2-76.3-2.1-24.7-3.4-51.3-4.2-77.9-.3-9.3-.4-18-.5-25.7 0-2.7-.1-5.1-.1-7.1v-4.8c0-2.1 0-4.4.1-7.1.1-7.8.3-16.4.5-25.7.7-26.6 2.1-53.2 4.2-77.9 2.7-32.2 6.5-58.6 11.2-76.3 6.2-23.1 24.4-41.4 47.4-47.5 21-5.6 73.9-10.1 145.8-12.8 36.4-1.4 75.6-2.3 114.7-2.8 13.7-.2 26.4-.3 37.8-.3h28.6l37.8.3c39.1.5 78.2 1.4 114.7 2.8 71.9 2.8 124.9 7.2 145.8 12.8 23 6.2 41.2 24.4 47.4 47.5 4.7 17.7 8.5 44.1 11.2 76.3 2.1 24.7 3.4 51.3 4.2 77.9.3 9.3.4 18 .5 25.7 0 2.7.1 5.1.1 7.1v4.8zM423 646l232-135-232-133z')); exports.YuqueOutline = getIcon('yuque', outline, getNode(newViewBox, 'M854.6 370.6c-9.9-39.4 9.9-102.2 73.4-124.4l-67.9-3.6s-25.7-90-143.6-98c-117.8-8.1-194.9-3-195-3 .1 0 87.4 55.6 52.4 154.7-25.6 52.5-65.8 95.6-108.8 144.7-1.3 1.3-2.5 2.6-3.5 3.7C319.4 605 96 860 96 860c245.9 64.4 410.7-6.3 508.2-91.1 20.5-.2 35.9-.3 46.3-.3 135.8 0 250.6-117.6 245.9-248.4-3.2-89.9-31.9-110.2-41.8-149.6zm-204.1 334c-10.6 0-26.2.1-46.8.3l-23.6.2-17.8 15.5c-47.1 41-104.4 71.5-171.4 87.6-52.5 12.6-110 16.2-172.7 9.6 18-20.5 36.5-41.6 55.4-63.1 92-104.6 173.8-197.5 236.9-268.5l1.4-1.4 1.3-1.5c4.1-4.6 20.6-23.3 24.7-28.1 9.7-11.1 17.3-19.9 24.5-28.6 30.7-36.7 52.2-67.8 69-102.2l1.6-3.3 1.2-3.4c13.7-38.8 15.4-76.9 6.2-112.8 22.5.7 46.5 1.9 71.7 3.6 33.3 2.3 55.5 12.9 71.1 29.2 5.8 6 10.2 12.5 13.4 18.7 1 2 1.7 3.6 2.3 5l5 17.7c-15.7 34.5-19.9 73.3-11.4 107.2 3 11.8 6.9 22.4 12.3 34.4 2.1 4.7 9.5 20.1 11 23.3 10.3 22.7 15.4 43 16.7 78.7 3.3 94.6-82.7 181.9-182 181.9z')); exports.YahooOutline = getIcon('yahoo', outline, getNode(newViewBox, 'M859.9 681.4h-14.1c-27.1 0-49.2 22.2-49.2 49.3v14.1c0 27.1 22.2 49.3 49.2 49.3h14.1c27.1 0 49.2-22.2 49.2-49.3v-14.1c0-27.1-22.2-49.3-49.2-49.3zM402.6 231C216.2 231 65 357 65 512.5S216.2 794 402.6 794s337.6-126 337.6-281.5S589.1 231 402.6 231zm0 507C245.1 738 121 634.6 121 512.5c0-62.3 32.3-119.7 84.9-161v48.4h37l159.8 159.9v65.3h-84.4v56.3h225.1v-56.3H459v-65.3l103.5-103.6h65.3v-56.3H459v65.3l-28.1 28.1-93.4-93.5h37v-56.3H216.4c49.4-35 114.3-56.6 186.2-56.6 157.6 0 281.6 103.4 281.6 225.5S560.2 738 402.6 738zm534.7-507H824.7c-15.5 0-27.7 12.6-27.1 28.1l13.1 366h84.4l65.4-366.4c2.7-15.2-7.8-27.7-23.2-27.7z')); exports.AlignLeftOutline = getIcon('align-left', outline, getNode(newViewBox, 'M120 230h496c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0 424h496c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm784 140H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-424H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.AlignCenterOutline = getIcon('align-center', outline, getNode(newViewBox, 'M264 230h496c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H264c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm496 424c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H264c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496zm144 140H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-424H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.AlibabaOutline = getIcon('alibaba', outline, getNode(newViewBox, 'M602.9 669.8c-37.2 2.6-33.6-17.3-11.5-46.2 50.4-67.2 143.7-158.5 147.9-225.2 5.8-86.6-81.3-113.4-171-113.4-62.4 1.6-127 18.9-171 34.6-151.6 53.5-246.6 137.5-306.9 232-62.4 93.4-43 183.2 91.8 185.8 101.8-4.2 170.5-32.5 239.7-68.2.5 0-192.5 55.1-263.9 14.7-7.9-4.2-15.7-10-17.8-26.2 0-33.1 54.6-67.7 86.6-78.7v-56.7c64.5 22.6 140.6 16.3 205.7-32 2.1 5.8 4.2 13.1 3.7 21h11c2.6-22.6-12.6-44.6-37.8-46.2 7.3 5.8 12.6 10.5 15.2 14.7l-1 1-.5.5c-83.9 58.8-165.3 31.5-173.1 29.9l46.7-45.7-13.1-33.1c92.9-32.5 169.5-56.2 296.9-78.7l-28.5-23 14.7-8.9c75.5 21 126.4 36.7 123.8 76.6-1 6.8-3.7 14.7-7.9 23.1C660.1 466.1 594 538 567.2 569c-17.3 20.5-34.6 39.4-46.7 58.3-13.6 19.4-20.5 37.3-21 53.5 2.6 131.8 391.4-61.9 468-112.9-111.7 47.8-232.9 93.5-364.6 101.9zm85-302.9c2.8 5.2 4.1 11.6 4.1 19.1-.1-6.8-1.4-13.3-4.1-19.1z')); exports.AlignRightOutline = getIcon('align-right', outline, getNode(newViewBox, 'M904 158H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 424H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 212H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-424H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.AliyunOutline = getIcon('aliyun', outline, getNode(newViewBox, 'M959.2 383.9c-.3-82.1-66.9-148.6-149.1-148.6H575.9l21.6 85.2 201 43.7a42.58 42.58 0 0 1 32.9 39.7c.1.5.1 216.1 0 216.6a42.58 42.58 0 0 1-32.9 39.7l-201 43.7-21.6 85.3h234.2c82.1 0 148.8-66.5 149.1-148.6V383.9zM225.5 660.4a42.58 42.58 0 0 1-32.9-39.7c-.1-.6-.1-216.1 0-216.6.8-19.4 14.6-35.5 32.9-39.7l201-43.7 21.6-85.2H213.8c-82.1 0-148.8 66.4-149.1 148.6V641c.3 82.1 67 148.6 149.1 148.6H448l-21.6-85.3-200.9-43.9zm200.9-158.8h171v21.3h-171z')); exports.AlipayOutline = getIcon('alipay', outline, getNode(newViewBox, 'M789 610.3c-38.7-12.9-90.7-32.7-148.5-53.6 34.8-60.3 62.5-129 80.7-203.6H530.5v-68.6h233.6v-38.3H530.5V132h-95.4c-16.7 0-16.7 16.5-16.7 16.5v97.8H182.2v38.3h236.3v68.6H223.4v38.3h378.4a667.18 667.18 0 0 1-54.5 132.9c-122.8-40.4-253.8-73.2-336.1-53-52.6 13-86.5 36.1-106.5 60.3-91.4 111-25.9 279.6 167.2 279.6C386 811.2 496 747.6 581.2 643 708.3 704 960 808.7 960 808.7V659.4s-31.6-2.5-171-49.1zM253.9 746.6c-150.5 0-195-118.3-120.6-183.1 24.8-21.9 70.2-32.6 94.4-35 89.4-8.8 172.2 25.2 269.9 72.8-68.8 89.5-156.3 145.3-243.7 145.3z')); exports.AntDesignOutline = getIcon('ant-design', outline, getNode(newViewBox, 'M716.3 313.8c19-18.9 19-49.7 0-68.6l-69.9-69.9.1.1c-18.5-18.5-50.3-50.3-95.3-95.2-21.2-20.7-55.5-20.5-76.5.5L80.9 474.2a53.84 53.84 0 0 0 0 76.4L474.6 944a54.14 54.14 0 0 0 76.5 0l165.1-165c19-18.9 19-49.7 0-68.6a48.7 48.7 0 0 0-68.7 0l-125 125.2c-5.2 5.2-13.3 5.2-18.5 0L189.5 521.4c-5.2-5.2-5.2-13.3 0-18.5l314.4-314.2c.4-.4.9-.7 1.3-1.1 5.2-4.1 12.4-3.7 17.2 1.1l125.2 125.1c19 19 49.8 19 68.7 0zM408.6 514.4a106.3 106.2 0 1 0 212.6 0 106.3 106.2 0 1 0-212.6 0zm536.2-38.6L821.9 353.5c-19-18.9-49.8-18.9-68.7.1a48.4 48.4 0 0 0 0 68.6l83 82.9c5.2 5.2 5.2 13.3 0 18.5l-81.8 81.7a48.4 48.4 0 0 0 0 68.6 48.7 48.7 0 0 0 68.7 0l121.8-121.7a53.93 53.93 0 0 0-.1-76.4z')); exports.ApartmentOutline = getIcon('apartment', outline, getNode(newViewBox, 'M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z')); exports.AntCloudOutline = getIcon('ant-cloud', outline, getNode(newViewBox, 'M378.9 738c-3.1 0-6.1-.5-8.8-1.5l4.4 30.7h26.3l-15.5-29.9c-2.1.5-4.2.7-6.4.7zm421-291.2c-12.6 0-24.8 1.5-36.5 4.2-21.4-38.4-62.3-64.3-109.3-64.3-6.9 0-13.6.6-20.2 1.6-35.4-77.4-113.4-131.1-203.9-131.1-112.3 0-205.3 82.6-221.6 190.4C127.3 455.5 64 523.8 64 607c0 88.4 71.6 160.1 160 160.2h50l13.2-27.6c-26.2-8.3-43.3-29-39.1-48.8 4.6-21.6 32.8-33.9 63.1-27.5 22.9 4.9 40.4 19.1 45.5 35.1a26.1 26.1 0 0 1 22.1-12.4h.2c-.8-3.2-1.2-6.5-1.2-9.9 0-20.1 14.8-36.7 34.1-39.6v-25.4c0-4.4 3.6-8 8-8s8 3.6 8 8v26.3c4.6 1.2 8.8 3.2 12.6 5.8l19.5-21.4c3-3.3 8-3.5 11.3-.5 3.3 3 3.5 8 .5 11.3l-20 22-.2.2a40 40 0 0 1-46.9 59.2c-.4 5.6-2.6 10.7-6 14.8l20 38.4H804v-.1c86.5-2.2 156-73 156-160.1 0-88.5-71.7-160.2-160.1-160.2zM338.2 737.2l-4.3 30h24.4l-5.9-41.5c-3.5 4.6-8.3 8.5-14.2 11.5zM797.5 305a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm-65.7 61.3a24 24 0 1 0 48 0 24 24 0 1 0-48 0zM303.4 742.9l-11.6 24.3h26l3.5-24.7c-5.7.8-11.7 1-17.9.4z')); exports.AmazonOutline = getIcon('amazon', outline, getNode(newViewBox, 'M825 768.9c-3.3-.9-7.3-.4-11.9 1.3-61.6 28.2-121.5 48.3-179.7 60.2C507.7 856 385.2 842.6 266 790.3c-33.1-14.6-79.1-39.2-138-74a9.36 9.36 0 0 0-5.3-2c-2-.1-3.7.1-5.3.9-1.6.8-2.8 1.8-3.7 3.1-.9 1.3-1.1 3.1-.4 5.4.6 2.2 2.1 4.7 4.6 7.4 10.4 12.2 23.3 25.2 38.6 39s35.6 29.4 60.9 46.8c25.3 17.4 51.8 32.9 79.3 46.4 27.6 13.5 59.6 24.9 96.1 34.1s73 13.8 109.4 13.8c36.2 0 71.4-3.7 105.5-10.9 34.2-7.3 63-15.9 86.5-25.9 23.4-9.9 45-21 64.8-33 19.8-12 34.4-22.2 43.9-30.3 9.5-8.2 16.3-14.6 20.2-19.4 4.6-5.7 6.9-10.6 6.9-14.9.1-4.5-1.7-7.1-5-7.9zM527.4 348.1c-15.2 1.3-33.5 4.1-55 8.3-21.5 4.1-41.4 9.3-59.8 15.4s-37.2 14.6-56.3 25.4c-19.2 10.8-35.5 23.2-49 37s-24.5 31.1-33.1 52c-8.6 20.8-12.9 43.7-12.9 68.7 0 27.1 4.7 51.2 14.3 72.5 9.5 21.3 22.2 38 38.2 50.4 15.9 12.4 34 22.1 54 29.2 20 7.1 41.2 10.3 63.2 9.4 22-.9 43.5-4.3 64.4-10.3 20.8-5.9 40.4-15.4 58.6-28.3 18.2-12.9 33.1-28.2 44.8-45.7 4.3 6.6 8.1 11.5 11.5 14.7l8.7 8.9c5.8 5.9 14.7 14.6 26.7 26.1 11.9 11.5 24.1 22.7 36.3 33.7l104.4-99.9-6-4.9c-4.3-3.3-9.4-8-15.2-14.3-5.8-6.2-11.6-13.1-17.2-20.5-5.7-7.4-10.6-16.1-14.7-25.9-4.1-9.8-6.2-19.3-6.2-28.5V258.7c0-10.1-1.9-21-5.7-32.8-3.9-11.7-10.7-24.5-20.7-38.3-10-13.8-22.4-26.2-37.2-37-14.9-10.8-34.7-20-59.6-27.4-24.8-7.4-52.6-11.1-83.2-11.1-31.3 0-60.4 3.7-87.6 10.9-27.1 7.3-50.3 17-69.7 29.2-19.3 12.2-35.9 26.3-49.7 42.4-13.8 16.1-24.1 32.9-30.8 50.4-6.7 17.5-10.1 35.2-10.1 53.1L408 310c5.5-16.4 12.9-30.6 22-42.8 9.2-12.2 17.9-21 25.8-26.5 8-5.5 16.6-9.9 25.7-13.2 9.2-3.3 15.4-5 18.6-5.4 3.2-.3 5.7-.4 7.6-.4 26.7 0 45.2 7.9 55.6 23.6 6.5 9.5 9.7 23.9 9.7 43.3v56.6c-15.2.6-30.4 1.6-45.6 2.9zM573.1 500c0 16.6-2.2 31.7-6.5 45-9.2 29.1-26.7 47.4-52.4 54.8-22.4 6.6-43.7 3.3-63.9-9.8-21.5-14-32.2-33.8-32.2-59.3 0-19.9 5-36.9 15-51.1 10-14.1 23.3-24.7 40-31.7s33-12 49-14.9c15.9-3 33-4.8 51-5.4V500zm335.2 218.9c-4.3-5.4-15.9-8.9-34.9-10.7-19-1.8-35.5-1.7-49.7.4-15.3 1.8-31.1 6.2-47.3 13.4-16.3 7.1-23.4 13.1-21.6 17.8l.7 1.3.9.7 1.4.2h4.6c.8 0 1.8-.1 3.2-.2 1.4-.1 2.7-.3 3.9-.4 1.2-.1 2.9-.3 5.1-.4 2.1-.1 4.1-.4 6-.7.3 0 3.7-.3 10.3-.9 6.6-.6 11.4-1 14.3-1.3 2.9-.3 7.8-.6 14.5-.9 6.7-.3 12.1-.3 16.1 0 4 .3 8.5.7 13.6 1.1 5.1.4 9.2 1.3 12.4 2.7 3.2 1.3 5.6 3 7.1 5.1 5.2 6.6 4.2 21.2-3 43.9s-14 40.8-20.4 54.2c-2.8 5.7-2.8 9.2 0 10.7s6.7.1 11.9-4c15.6-12.2 28.6-30.6 39.1-55.3 6.1-14.6 10.5-29.8 13.1-45.7 2.4-15.9 2-26.2-1.3-31z')); exports.AreaChartOutline = getIcon('area-chart', outline, getNode(newViewBox, 'M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-616-64h536c4.4 0 8-3.6 8-8V284c0-7.2-8.7-10.7-13.7-5.7L592 488.6l-125.4-124a8.03 8.03 0 0 0-11.3 0l-189 189.6a7.87 7.87 0 0 0-2.3 5.6V720c0 4.4 3.6 8 8 8z')); exports.ArrowRightOutline = getIcon('arrow-right', outline, getNode(newViewBox, 'M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 0 0 0-48.4z')); exports.ArrowLeftOutline = getIcon('arrow-left', outline, getNode(newViewBox, 'M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 0 0 0 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z')); exports.ArrowDownOutline = getIcon('arrow-down', outline, getNode(newViewBox, 'M862 465.3h-81c-4.6 0-9 2-12.1 5.5L550 723.1V160c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v563.1L255.1 470.8c-3-3.5-7.4-5.5-12.1-5.5h-81c-6.8 0-10.5 8.1-6 13.2L487.9 861a31.96 31.96 0 0 0 48.3 0L868 478.5c4.5-5.2.8-13.2-6-13.2z')); exports.ArrowUpOutline = getIcon('arrow-up', outline, getNode(newViewBox, 'M868 545.5L536.1 163a31.96 31.96 0 0 0-48.3 0L156 545.5a7.97 7.97 0 0 0 6 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z')); exports.ArrowsAltOutline = getIcon('arrows-alt', outline, getNode(newViewBox, 'M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z')); exports.BarChartOutline = getIcon('bar-chart', outline, getNode(newViewBox, 'M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z')); exports.AuditOutline = getIcon('audit', outline, getNode(newViewBox, 'M296 250c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm184 144H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm-48 458H208V148h560v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h264c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm440-88H728v-36.6c46.3-13.8 80-56.6 80-107.4 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 50.7 33.7 93.6 80 107.4V764H520c-8.8 0-16 7.2-16 16v152c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16V780c0-8.8-7.2-16-16-16zM646 620c0-27.6 22.4-50 50-50s50 22.4 50 50-22.4 50-50 50-50-22.4-50-50zm180 266H566v-60h260v60z')); exports.BarcodeOutline = getIcon('barcode', outline, getNode(newViewBox, 'M120 160H72c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V168c0-4.4-3.6-8-8-8zm833 0h-48c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V168c0-4.4-3.6-8-8-8zM200 736h112c4.4 0 8-3.6 8-8V168c0-4.4-3.6-8-8-8H200c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8zm321 0h48c4.4 0 8-3.6 8-8V168c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8zm126 0h178c4.4 0 8-3.6 8-8V168c0-4.4-3.6-8-8-8H647c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8zm-255 0h48c4.4 0 8-3.6 8-8V168c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8zm-79 64H201c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm257 0h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm256 0H648c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h178c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm-385 0h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z')); exports.BehanceOutline = getIcon('behance', outline, getNode(newViewBox, 'M634 294.3h199.5v48.4H634zM434.1 485.8c44.1-21.1 67.2-53.2 67.2-102.8 0-98.1-73-121.9-157.3-121.9H112v492.4h238.5c89.4 0 173.3-43 173.3-143 0-61.8-29.2-107.5-89.7-124.7zM220.2 345.1h101.5c39.1 0 74.2 10.9 74.2 56.3 0 41.8-27.3 58.6-66 58.6H220.2V345.1zm115.5 324.8H220.1V534.3H338c47.6 0 77.7 19.9 77.7 70.3 0 49.6-35.9 65.3-80 65.3zm575.8-89.5c0-105.5-61.7-193.4-173.3-193.4-108.5 0-182.3 81.7-182.3 188.8 0 111 69.9 187.2 182.3 187.2 85.1 0 140.2-38.3 166.7-120h-86.3c-9.4 30.5-47.6 46.5-77.3 46.5-57.4 0-87.4-33.6-87.4-90.7h256.9c.3-5.9.7-12.1.7-18.4zM653.9 537c3.1-46.9 34.4-76.2 81.2-76.2 49.2 0 73.8 28.9 78.1 76.2H653.9z')); exports.BarsOutline = getIcon('bars', outline, getNode(normalViewBox, 'M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z')); exports.BgColorsOutline = getIcon('bg-colors', outline, getNode(newViewBox, 'M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 0 0-12.8 0l-48 48a9.11 9.11 0 0 0 0 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z')); exports.BlockOutline = getIcon('block', outline, getNode(newViewBox, 'M856 376H648V168c0-8.8-7.2-16-16-16H168c-8.8 0-16 7.2-16 16v464c0 8.8 7.2 16 16 16h208v208c0 8.8 7.2 16 16 16h464c8.8 0 16-7.2 16-16V392c0-8.8-7.2-16-16-16zm-480 16v188H220V220h360v156H392c-8.8 0-16 7.2-16 16zm204 52v136H444V444h136zm224 360H444V648h188c8.8 0 16-7.2 16-16V444h156v360z')); exports.BoldOutline = getIcon('bold', outline, getNode(newViewBox, 'M697.8 481.4c33.6-35 54.2-82.3 54.2-134.3v-10.2C752 229.3 663.9 142 555.3 142H259.4c-15.1 0-27.4 12.3-27.4 27.4v679.1c0 16.3 13.2 29.5 29.5 29.5h318.7c117 0 211.8-94.2 211.8-210.5v-11c0-73-37.4-137.3-94.2-175.1zM328 238h224.7c57.1 0 103.3 44.4 103.3 99.3v9.5c0 54.8-46.3 99.3-103.3 99.3H328V238zm366.6 429.4c0 62.9-51.7 113.9-115.5 113.9H328V542.7h251.1c63.8 0 115.5 51 115.5 113.9v10.8z')); exports.BorderInnerOutline = getIcon('border-inner', outline, getNode(newViewBox, 'M872 476H548V144h-72v332H152c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h324v332h72V548h324c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-166h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 498h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-664h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 498h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM650 216h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm56 592h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-56-592h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-166 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm56 592h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-56-426h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm56 260h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.BorderBottomOutline = getIcon('border-bottom', outline, getNode(newViewBox, 'M872 808H152c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-720-94h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0-498h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0 332h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0-166h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm166 166h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0-332h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm332 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0 332h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm222-72h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-388 72h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm388-404h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-388 72h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm388 426h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-388 72h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm388-404h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-388 72h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8z')); exports.BorderLeftOutline = getIcon('border-left', outline, getNode(newViewBox, 'M208 144h-56c-4.4 0-8 3.6-8 8v720c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V152c0-4.4-3.6-8-8-8zm166 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm498 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm166 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM540 310h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 166h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM374 808h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.BorderOuterOutline = getIcon('border-outer', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM484 366h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zM302 548h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm364 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-182 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0 182h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8z')); exports.BorderHorizontalOutline = getIcon('border-horizontal', outline, getNode(newViewBox, 'M540 144h-56c-4.4 0-8 3.6-8 8v720c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V152c0-4.4-3.6-8-8-8zm-166 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm498 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-664 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm498 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM208 310h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm664 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-664 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 166h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm664 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM374 808h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.BorderTopOutline = getIcon('border-top', outline, getNode(newViewBox, 'M872 144H152c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM208 310h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 498h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 166h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm166-166h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm166 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332-498h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.BorderVerticleOutline = getIcon('border-verticle', outline, getNode(newViewBox, 'M872 476H152c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-166h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 498h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-664h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 498h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM650 216h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm56 592h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-56-592h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-166 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm332 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zM208 808h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM152 382h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm332 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zM208 642h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.BorderRightOutline = getIcon('border-right', outline, getNode(newViewBox, 'M872 144h-56c-4.4 0-8 3.6-8 8v720c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V152c0-4.4-3.6-8-8-8zm-166 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-498 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-166 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm166 166h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm332 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 166h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM208 808h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm498 332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM374 808h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-332h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.BorderOutline = getIcon('border', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z')); exports.BranchesOutline = getIcon('branches', outline, getNode(newViewBox, 'M740 161c-61.8 0-112 50.2-112 112 0 50.1 33.1 92.6 78.5 106.9v95.9L320 602.4V318.1c44.2-15 76-56.9 76-106.1 0-61.8-50.2-112-112-112s-112 50.2-112 112c0 49.2 31.8 91 76 106.1V706c-44.2 15-76 56.9-76 106.1 0 61.8 50.2 112 112 112s112-50.2 112-112c0-49.2-31.8-91-76-106.1v-27.8l423.5-138.7a50.52 50.52 0 0 0 34.9-48.2V378.2c42.9-15.8 73.6-57 73.6-105.2 0-61.8-50.2-112-112-112zm-504 51a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm96 600a48.01 48.01 0 0 1-96 0 48.01 48.01 0 0 1 96 0zm408-491a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z')); exports.CheckOutline = getIcon('check', outline, getNode(newViewBox, 'M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z')); exports.CloudServerOutline = getIcon('cloud-server', outline, getNode(newViewBox, 'M704 446H320c-4.4 0-8 3.6-8 8v402c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8V454c0-4.4-3.6-8-8-8zm-328 64h272v117H376V510zm272 290H376V683h272v117z', 'M424 748a32 32 0 1 0 64 0 32 32 0 1 0-64 0zm0-178a32 32 0 1 0 64 0 32 32 0 1 0-64 0z', 'M811.4 368.9C765.6 248 648.9 162 512.2 162S258.8 247.9 213 368.8C126.9 391.5 63.5 470.2 64 563.6 64.6 668 145.6 752.9 247.6 762c4.7.4 8.7-3.3 8.7-8v-60.4c0-4-3-7.4-7-7.9-27-3.4-52.5-15.2-72.1-34.5-24-23.5-37.2-55.1-37.2-88.6 0-28 9.1-54.4 26.2-76.4 16.7-21.4 40.2-36.9 66.1-43.7l37.9-10 13.9-36.7c8.6-22.8 20.6-44.2 35.7-63.5 14.9-19.2 32.6-36 52.4-50 41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.3c19.9 14 37.5 30.8 52.4 50 15.1 19.3 27.1 40.7 35.7 63.5l13.8 36.6 37.8 10c54.2 14.4 92.1 63.7 92.1 120 0 33.6-13.2 65.1-37.2 88.6-19.5 19.2-44.9 31.1-71.9 34.5-4 .5-6.9 3.9-6.9 7.9V754c0 4.7 4.1 8.4 8.8 8 101.7-9.2 182.5-94 183.2-198.2.6-93.4-62.7-172.1-148.6-194.9z')); exports.CloseOutline = getIcon('close', outline, getNode(newViewBox, 'M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z')); exports.CloudDownloadOutline = getIcon('cloud-download', outline, getNode(newViewBox, 'M624 706.3h-74.1V464c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v242.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.7a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9z', 'M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0 1 52.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 0 1-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z')); exports.CiOutline = getIcon('ci', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm218-572.1h-50.4c-4.4 0-8 3.6-8 8v384.2c0 4.4 3.6 8 8 8H730c4.4 0 8-3.6 8-8V319.9c0-4.4-3.6-8-8-8zm-281.4 49.6c49.5 0 83.1 31.5 87 77.6.4 4.2 3.8 7.4 8 7.4h52.6c2.4 0 4.4-2 4.4-4.4 0-81.2-64-138.1-152.3-138.1C345.4 304 286 373.5 286 488.4v49c0 114 59.4 182.6 162.3 182.6 88 0 152.3-55.1 152.3-132.5 0-2.4-2-4.4-4.4-4.4h-52.7c-4.2 0-7.6 3.2-8 7.3-4.2 43-37.7 72.4-87 72.4-61.1 0-95.6-44.9-95.6-125.2v-49.3c.1-81.4 34.6-126.8 95.7-126.8z')); exports.CloudSyncOutline = getIcon('cloud-sync', outline, getNode(newViewBox, 'M811.4 368.9C765.6 248 648.9 162 512.2 162S258.8 247.9 213 368.8C126.9 391.5 63.5 470.2 64 563.6 64.6 668 145.6 752.9 247.6 762c4.7.4 8.7-3.3 8.7-8v-60.4c0-4-3-7.4-7-7.9-27-3.4-52.5-15.2-72.1-34.5-24-23.5-37.2-55.1-37.2-88.6 0-28 9.1-54.4 26.2-76.4 16.7-21.4 40.2-36.9 66.1-43.7l37.9-10 13.9-36.7c8.6-22.8 20.6-44.2 35.7-63.5 14.9-19.2 32.6-36 52.4-50 41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.3c19.9 14 37.5 30.8 52.4 50 15.1 19.3 27.1 40.7 35.7 63.5l13.8 36.6 37.8 10c54.2 14.4 92.1 63.7 92.1 120 0 33.6-13.2 65.1-37.2 88.6-19.5 19.2-44.9 31.1-71.9 34.5-4 .5-6.9 3.9-6.9 7.9V754c0 4.7 4.1 8.4 8.8 8 101.7-9.2 182.5-94 183.2-198.2.6-93.4-62.7-172.1-148.6-194.9z', 'M376.9 656.4c1.8-33.5 15.7-64.7 39.5-88.6 25.4-25.5 60-39.8 96-39.8 36.2 0 70.3 14.1 96 39.8 1.4 1.4 2.7 2.8 4.1 4.3l-25 19.6a8 8 0 0 0 3 14.1l98.2 24c5 1.2 9.9-2.6 9.9-7.7l.5-101.3c0-6.7-7.6-10.5-12.9-6.3L663 532.7c-36.6-42-90.4-68.6-150.5-68.6-107.4 0-195 85.1-199.4 191.7-.2 4.5 3.4 8.3 8 8.3H369c4.2-.1 7.7-3.4 7.9-7.7zM703 664h-47.9c-4.2 0-7.7 3.3-8 7.6-1.8 33.5-15.7 64.7-39.5 88.6-25.4 25.5-60 39.8-96 39.8-36.2 0-70.3-14.1-96-39.8-1.4-1.4-2.7-2.8-4.1-4.3l25-19.6a8 8 0 0 0-3-14.1l-98.2-24c-5-1.2-9.9 2.6-9.9 7.7l-.4 101.4c0 6.7 7.6 10.5 12.9 6.3l23.2-18.2c36.6 42 90.4 68.6 150.5 68.6 107.4 0 195-85.1 199.4-191.7.2-4.5-3.4-8.3-8-8.3z')); exports.ClusterOutline = getIcon('cluster', outline, getNode(newViewBox, 'M888 680h-54V540H546v-92h238c8.8 0 16-7.2 16-16V168c0-8.8-7.2-16-16-16H240c-8.8 0-16 7.2-16 16v264c0 8.8 7.2 16 16 16h238v92H190v140h-54c-4.4 0-8 3.6-8 8v176c0 4.4 3.6 8 8 8h176c4.4 0 8-3.6 8-8V688c0-4.4-3.6-8-8-8h-54v-72h220v72h-54c-4.4 0-8 3.6-8 8v176c0 4.4 3.6 8 8 8h176c4.4 0 8-3.6 8-8V688c0-4.4-3.6-8-8-8h-54v-72h220v72h-54c-4.4 0-8 3.6-8 8v176c0 4.4 3.6 8 8 8h176c4.4 0 8-3.6 8-8V688c0-4.4-3.6-8-8-8zM256 805.3c0 1.5-1.2 2.7-2.7 2.7h-58.7c-1.5 0-2.7-1.2-2.7-2.7v-58.7c0-1.5 1.2-2.7 2.7-2.7h58.7c1.5 0 2.7 1.2 2.7 2.7v58.7zm288 0c0 1.5-1.2 2.7-2.7 2.7h-58.7c-1.5 0-2.7-1.2-2.7-2.7v-58.7c0-1.5 1.2-2.7 2.7-2.7h58.7c1.5 0 2.7 1.2 2.7 2.7v58.7zM288 384V216h448v168H288zm544 421.3c0 1.5-1.2 2.7-2.7 2.7h-58.7c-1.5 0-2.7-1.2-2.7-2.7v-58.7c0-1.5 1.2-2.7 2.7-2.7h58.7c1.5 0 2.7 1.2 2.7 2.7v58.7zM360 300a40 40 0 1 0 80 0 40 40 0 1 0-80 0z')); exports.CloudUploadOutline = getIcon('cloud-upload', outline, getNode(newViewBox, 'M518.3 459a8 8 0 0 0-12.6 0l-112 141.7a7.98 7.98 0 0 0 6.3 12.9h73.9V856c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V613.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 459z', 'M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0 1 52.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 0 1-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z')); exports.CodepenOutline = getIcon('codepen', outline, getNode(newViewBox, 'M911.7 385.3l-.3-1.5c-.2-1-.3-1.9-.6-2.9-.2-.6-.4-1.1-.5-1.7-.3-.8-.5-1.7-.9-2.5-.2-.6-.5-1.1-.8-1.7-.4-.8-.8-1.5-1.2-2.3-.3-.5-.6-1.1-1-1.6-.8-1.2-1.7-2.4-2.6-3.6-.5-.6-1.1-1.3-1.7-1.9-.4-.5-.9-.9-1.4-1.3-.6-.6-1.3-1.1-1.9-1.6-.5-.4-1-.8-1.6-1.2-.2-.1-.4-.3-.6-.4L531.1 117.8a34.3 34.3 0 0 0-38.1 0L127.3 361.3c-.2.1-.4.3-.6.4-.5.4-1 .8-1.6 1.2-.7.5-1.3 1.1-1.9 1.6-.5.4-.9.9-1.4 1.3-.6.6-1.2 1.2-1.7 1.9-1 1.1-1.8 2.3-2.6 3.6-.3.5-.7 1-1 1.6-.4.7-.8 1.5-1.2 2.3-.3.5-.5 1.1-.8 1.7-.3.8-.6 1.7-.9 2.5-.2.6-.4 1.1-.5 1.7-.2.9-.4 1.9-.6 2.9l-.3 1.5c-.2 1.5-.3 3-.3 4.5v243.5c0 1.5.1 3 .3 4.5l.3 1.5.6 2.9c.2.6.3 1.1.5 1.7.3.9.6 1.7.9 2.5.2.6.5 1.1.8 1.7.4.8.7 1.5 1.2 2.3.3.5.6 1.1 1 1.6.5.7.9 1.4 1.5 2.1l1.2 1.5c.5.6 1.1 1.3 1.7 1.9.4.5.9.9 1.4 1.3.6.6 1.3 1.1 1.9 1.6.5.4 1 .8 1.6 1.2.2.1.4.3.6.4L493 905.7c5.6 3.8 12.3 5.8 19.1 5.8 6.6 0 13.3-1.9 19.1-5.8l365.6-243.5c.2-.1.4-.3.6-.4.5-.4 1-.8 1.6-1.2.7-.5 1.3-1.1 1.9-1.6.5-.4.9-.9 1.4-1.3.6-.6 1.2-1.2 1.7-1.9l1.2-1.5 1.5-2.1c.3-.5.7-1 1-1.6.4-.8.8-1.5 1.2-2.3.3-.5.5-1.1.8-1.7.3-.8.6-1.7.9-2.5.2-.5.4-1.1.5-1.7.3-.9.4-1.9.6-2.9l.3-1.5c.2-1.5.3-3 .3-4.5V389.8c-.3-1.5-.4-3-.6-4.5zM546.4 210.5l269.4 179.4-120.3 80.4-149-99.6V210.5zm-68.8 0v160.2l-149 99.6-120.3-80.4 269.3-179.4zM180.7 454.1l86 57.5-86 57.5v-115zm296.9 358.5L208.3 633.2l120.3-80.4 149 99.6v160.2zM512 592.8l-121.6-81.2L512 430.3l121.6 81.2L512 592.8zm34.4 219.8V652.4l149-99.6 120.3 80.4-269.3 179.4zM843.3 569l-86-57.5 86-57.5v115z')); exports.CodeSandboxOutline = getIcon('code-sandbox', outline, getNode(newViewBox, 'M709.6 210l.4-.2h.2L512 96 313.9 209.8h-.2l.7.3L151.5 304v416L512 928l360.5-208V304l-162.9-94zM482.7 843.6L339.6 761V621.4L210 547.8V372.9l272.7 157.3v313.4zM238.2 321.5l134.7-77.8 138.9 79.7 139.1-79.9 135.2 78-273.9 158-274-158zM814 548.3l-128.8 73.1v139.1l-143.9 83V530.4L814 373.1v175.2z')); exports.CoffeeOutline = getIcon('coffee', outline, getNode(normalViewBox, 'M275 281c19.9 0 36-16.1 36-36V36c0-19.9-16.1-36-36-36s-36 16.1-36 36v209c0 19.9 16.1 36 36 36zm613 144H768c0-39.8-32.2-72-72-72H200c-39.8 0-72 32.2-72 72v248c0 3.4.2 6.7.7 9.9-.5 7-.7 14-.7 21.1 0 176.7 143.3 320 320 320 160.1 0 292.7-117.5 316.3-271H888c39.8 0 72-32.2 72-72V497c0-39.8-32.2-72-72-72zM696 681h-1.1c.7 7.6 1.1 15.2 1.1 23 0 137-111 248-248 248S200 841 200 704c0-7.8.4-15.4 1.1-23H200V425h496v256zm192-8H776V497h112v176zM613 281c19.9 0 36-16.1 36-36V36c0-19.9-16.1-36-36-36s-36 16.1-36 36v209c0 19.9 16.1 36 36 36zm-170 0c19.9 0 36-16.1 36-36V36c0-19.9-16.1-36-36-36s-36 16.1-36 36v209c0 19.9 16.1 36 36 36z')); exports.ColumnWidthOutline = getIcon('column-width', outline, getNode(newViewBox, 'M180 176h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zm724 0h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zM785.3 504.3L657.7 403.6a7.23 7.23 0 0 0-11.7 5.7V476H378v-62.8c0-6-7-9.4-11.7-5.7L238.7 508.3a7.14 7.14 0 0 0 0 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h268v62.8c0 6 7 9.4 11.7 5.7l127.5-100.8c3.8-2.9 3.8-8.5.2-11.4z')); exports.ColumHeightOutline = getIcon('colum-height', outline, getNode(newViewBox, 'M840 836H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm0-724H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM610.8 378c6 0 9.4-7 5.7-11.7L515.7 238.7a7.14 7.14 0 0 0-11.3 0L403.6 366.3a7.23 7.23 0 0 0 5.7 11.7H476v268h-62.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V378h62.8z')); exports.DashOutline = getIcon('dash', outline, getNode(newViewBox, 'M112 476h160v72H112zm320 0h160v72H432zm320 0h160v72H752z')); exports.DeploymentUnitOutline = getIcon('deployment-unit', outline, getNode(newViewBox, 'M888.3 693.2c-42.5-24.6-94.3-18-129.2 12.8l-53-30.7V523.6c0-15.7-8.4-30.3-22-38.1l-136-78.3v-67.1c44.2-15 76-56.8 76-106.1 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 49.3 31.8 91.1 76 106.1v67.1l-136 78.3c-13.6 7.8-22 22.4-22 38.1v151.6l-53 30.7c-34.9-30.8-86.8-37.4-129.2-12.8-53.5 31-71.7 99.4-41 152.9 30.8 53.5 98.9 71.9 152.2 41 42.5-24.6 62.7-73 53.6-118.8l48.7-28.3 140.6 81c6.8 3.9 14.4 5.9 22 5.9s15.2-2 22-5.9L674.5 740l48.7 28.3c-9.1 45.7 11.2 94.2 53.6 118.8 53.3 30.9 121.5 12.6 152.2-41 30.8-53.6 12.6-122-40.7-152.9zm-673 138.4a47.6 47.6 0 0 1-65.2-17.6c-13.2-22.9-5.4-52.3 17.5-65.5a47.6 47.6 0 0 1 65.2 17.6c13.2 22.9 5.4 52.3-17.5 65.5zM522 463.8zM464 234a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm170 446.2l-122 70.3-122-70.3V539.8l122-70.3 122 70.3v140.4zm239.9 133.9c-13.2 22.9-42.4 30.8-65.2 17.6-22.8-13.2-30.7-42.6-17.5-65.5s42.4-30.8 65.2-17.6c22.9 13.2 30.7 42.5 17.5 65.5z')); exports.CopyrightOutline = getIcon('copyright', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm5.6-532.7c53 0 89 33.8 93 83.4.3 4.2 3.8 7.4 8 7.4h56.7c2.6 0 4.7-2.1 4.7-4.7 0-86.7-68.4-147.4-162.7-147.4C407.4 290 344 364.2 344 486.8v52.3C344 660.8 407.4 734 517.3 734c94 0 162.7-58.8 162.7-141.4 0-2.6-2.1-4.7-4.7-4.7h-56.8c-4.2 0-7.6 3.2-8 7.3-4.2 46.1-40.1 77.8-93 77.8-65.3 0-102.1-47.9-102.1-133.6v-52.6c.1-87 37-135.5 102.2-135.5z')); exports.DingdingOutline = getIcon('dingding', outline, getNode(newViewBox, 'M573.7 252.5C422.5 197.4 201.3 96.7 201.3 96.7c-15.7-4.1-17.9 11.1-17.9 11.1-5 61.1 33.6 160.5 53.6 182.8 19.9 22.3 319.1 113.7 319.1 113.7S326 357.9 270.5 341.9c-55.6-16-37.9 17.8-37.9 17.8 11.4 61.7 64.9 131.8 107.2 138.4 42.2 6.6 220.1 4 220.1 4s-35.5 4.1-93.2 11.9c-42.7 5.8-97 12.5-111.1 17.8-33.1 12.5 24 62.6 24 62.6 84.7 76.8 129.7 50.5 129.7 50.5 33.3-10.7 61.4-18.5 85.2-24.2L565 743.1h84.6L603 928l205.3-271.9H700.8l22.3-38.7c.3.5.4.8.4.8S799.8 496.1 829 433.8l.6-1h-.1c5-10.8 8.6-19.7 10-25.8 17-71.3-114.5-99.4-265.8-154.5z')); exports.DesktopOutline = getIcon('desktop', outline, getNode(newViewBox, 'M928 140H96c-17.7 0-32 14.3-32 32v496c0 17.7 14.3 32 32 32h380v112H304c-8.8 0-16 7.2-16 16v48c0 4.4 3.6 8 8 8h432c4.4 0 8-3.6 8-8v-48c0-8.8-7.2-16-16-16H548V700h380c17.7 0 32-14.3 32-32V172c0-17.7-14.3-32-32-32zm-40 488H136V212h752v416z')); exports.DisconnectOutline = getIcon('disconnect', outline, getNode(newViewBox, 'M832.6 191.4c-84.6-84.6-221.5-84.6-306 0l-96.9 96.9 51 51 96.9-96.9c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204l-96.9 96.9 51.1 51.1 96.9-96.9c84.4-84.6 84.4-221.5-.1-306.1zM446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l96.9-96.9-51.1-51.1-96.9 96.9c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l96.9-96.9-51-51-96.8 97zM260.3 209.4a8.03 8.03 0 0 0-11.3 0L209.4 249a8.03 8.03 0 0 0 0 11.3l554.4 554.4c3.1 3.1 8.2 3.1 11.3 0l39.6-39.6c3.1-3.1 3.1-8.2 0-11.3L260.3 209.4z')); exports.DotChartOutline = getIcon('dot-chart', outline, getNode(newViewBox, 'M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM288 604a64 64 0 1 0 128 0 64 64 0 1 0-128 0zm118-224a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm158 228a96 96 0 1 0 192 0 96 96 0 1 0-192 0zm148-314a56 56 0 1 0 112 0 56 56 0 1 0-112 0z')); exports.DoubleRightOutline = getIcon('double-right', outline, getNode(newViewBox, 'M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 0 0 188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 0 0 492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z')); exports.DollarOutline = getIcon('dollar', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm47.7-395.2l-25.4-5.9V348.6c38 5.2 61.5 29 65.5 58.2.5 4 3.9 6.9 7.9 6.9h44.9c4.7 0 8.4-4.1 8-8.8-6.1-62.3-57.4-102.3-125.9-109.2V263c0-4.4-3.6-8-8-8h-28.1c-4.4 0-8 3.6-8 8v33c-70.8 6.9-126.2 46-126.2 119 0 67.6 49.8 100.2 102.1 112.7l24.7 6.3v142.7c-44.2-5.9-69-29.5-74.1-61.3-.6-3.8-4-6.6-7.9-6.6H363c-4.7 0-8.4 4-8 8.7 4.5 55 46.2 105.6 135.2 112.1V761c0 4.4 3.6 8 8 8h28.4c4.4 0 8-3.6 8-8.1l-.2-31.7c78.3-6.9 134.3-48.8 134.3-124-.1-69.4-44.2-100.4-109-116.4zm-68.6-16.2c-5.6-1.6-10.3-3.1-15-5-33.8-12.2-49.5-31.9-49.5-57.3 0-36.3 27.5-57 64.5-61.7v124zM534.3 677V543.3c3.1.9 5.9 1.6 8.8 2.2 47.3 14.4 63.2 34.4 63.2 65.1 0 39.1-29.4 62.6-72 66.4z')); exports.DoubleLeftOutline = getIcon('double-left', outline, getNode(newViewBox, 'M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 0 0 0 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 0 0 0 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z')); exports.DownOutline = getIcon('down', outline, getNode(newViewBox, 'M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z')); exports.DownloadOutline = getIcon('download', outline, getNode(newViewBox, 'M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z')); exports.DropboxOutline = getIcon('dropbox', outline, getNode(newViewBox, 'M64 556.9l264.2 173.5L512.5 577 246.8 412.7zm896-290.3zm0 0L696.8 95 512.5 248.5l265.2 164.2L512.5 577l184.3 153.4L960 558.8 777.7 412.7zM513 609.8L328.2 763.3l-79.4-51.5v57.8L513 928l263.7-158.4v-57.8l-78.9 51.5zM328.2 95L64 265.1l182.8 147.6 265.7-164.2zM64 556.9z')); exports.DribbbleOutline = getIcon('dribbble', outline, getNode(newViewBox, 'M512 96C282.6 96 96 282.6 96 512s186.6 416 416 416 416-186.6 416-416S741.4 96 512 96zm275.1 191.8c49.5 60.5 79.5 137.5 80.2 221.4-11.7-2.5-129.2-26.3-247.4-11.4-2.5-6.1-5-12.2-7.6-18.3-7.4-17.3-15.3-34.6-23.6-51.5C720 374.3 779.6 298 787.1 287.8zM512 157.2c90.3 0 172.8 33.9 235.5 89.5-6.4 9.1-59.9 81-186.2 128.4-58.2-107-122.7-194.8-132.6-208 27.3-6.6 55.2-9.9 83.3-9.9zM360.9 191c9.4 12.8 72.9 100.9 131.7 205.5C326.4 440.6 180 440 164.1 439.8c23.1-110.3 97.4-201.9 196.8-248.8zM156.7 512.5c0-3.6.1-7.3.2-10.9 15.5.3 187.7 2.5 365.2-50.6 10.2 19.9 19.9 40.1 28.8 60.3-4.7 1.3-9.4 2.7-14 4.2C353.6 574.9 256.1 736.4 248 750.1c-56.7-63-91.3-146.3-91.3-237.6zM512 867.8c-82.2 0-157.9-28-218.1-75 6.4-13.1 78.3-152 278.7-221.9l2.3-.8c49.9 129.6 70.5 238.3 75.8 269.5A350.46 350.46 0 0 1 512 867.8zm198.5-60.7c-3.6-21.6-22.5-125.6-69-253.3C752.9 536 850.7 565.2 862.8 569c-15.8 98.8-72.5 184.2-152.3 238.1z')); exports.DragOutline = getIcon('drag', outline, getNode(newViewBox, 'M909.3 506.3L781.7 405.6a7.23 7.23 0 0 0-11.7 5.7V476H548V254h64.8c6 0 9.4-7 5.7-11.7L517.7 114.7a7.14 7.14 0 0 0-11.3 0L405.6 242.3a7.23 7.23 0 0 0 5.7 11.7H476v222H254v-64.8c0-6-7-9.4-11.7-5.7L114.7 506.3a7.14 7.14 0 0 0 0 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h222v222h-64.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V548h222v64.8c0 6 7 9.4 11.7 5.7l127.5-100.8a7.3 7.3 0 0 0 .1-11.4z')); exports.EnterOutline = getIcon('enter', outline, getNode(newViewBox, 'M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 0 0 0 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z')); exports.EllipsisOutline = getIcon('ellipsis', outline, getNode(newViewBox, 'M176 511a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm280 0a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm280 0a56 56 0 1 0 112 0 56 56 0 1 0-112 0z')); exports.ExclamationOutline = getIcon('exclamation', outline, getNode(newViewBox, 'M448 804a64 64 0 1 0 128 0 64 64 0 1 0-128 0zm32-168h64c4.4 0 8-3.6 8-8V164c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8z')); exports.ExceptionOutline = getIcon('exception', outline, getNode(newViewBox, 'M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm376 116c-119.3 0-216 96.7-216 216s96.7 216 216 216 216-96.7 216-216-96.7-216-216-216zm107.5 323.5C750.8 868.2 712.6 884 672 884s-78.8-15.8-107.5-44.5C535.8 810.8 520 772.6 520 732s15.8-78.8 44.5-107.5C593.2 595.8 631.4 580 672 580s78.8 15.8 107.5 44.5C808.2 653.2 824 691.4 824 732s-15.8 78.8-44.5 107.5zM640 812a32 32 0 1 0 64 0 32 32 0 1 0-64 0zm12-64h40c4.4 0 8-3.6 8-8V628c0-4.4-3.6-8-8-8h-40c-4.4 0-8 3.6-8 8v112c0 4.4 3.6 8 8 8zM440 852H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.ExportOutline = getIcon('export', outline, getNode(newViewBox, 'M888.3 757.4h-53.8c-4.2 0-7.7 3.5-7.7 7.7v61.8H197.1V197.1h629.8v61.8c0 4.2 3.5 7.7 7.7 7.7h53.8c4.2 0 7.7-3.4 7.7-7.7V158.7c0-17-13.7-30.7-30.7-30.7H158.7c-17 0-30.7 13.7-30.7 30.7v706.6c0 17 13.7 30.7 30.7 30.7h706.6c17 0 30.7-13.7 30.7-30.7V765.1c0-4.3-3.5-7.7-7.7-7.7zm18.6-251.7L765 393.7c-5.3-4.2-13-.4-13 6.3v76H438c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h314v76c0 6.7 7.8 10.5 13 6.3l141.9-112a8 8 0 0 0 0-12.6z')); exports.EuroOutline = getIcon('euro', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm117.7-588.6c-15.9-3.5-34.4-5.4-55.3-5.4-106.7 0-178.9 55.7-198.6 149.9H344c-4.4 0-8 3.6-8 8v27.2c0 4.4 3.6 8 8 8h26.4c-.3 4.1-.3 8.4-.3 12.8v36.9H344c-4.4 0-8 3.6-8 8V568c0 4.4 3.6 8 8 8h30.2c17.2 99.2 90.4 158 200.2 158 20.9 0 39.4-1.7 55.3-5.1 3.7-.8 6.4-4 6.4-7.8v-42.8c0-5-4.6-8.8-9.5-7.8-14.7 2.8-31.9 4.1-51.8 4.1-68.5 0-114.5-36.6-129.8-98.6h130.6c4.4 0 8-3.6 8-8v-27.2c0-4.4-3.6-8-8-8H439.2v-36c0-4.7 0-9.4.3-13.8h135.9c4.4 0 8-3.6 8-8v-27.2c0-4.4-3.6-8-8-8H447.1c17.2-56.9 62.3-90.4 127.6-90.4 19.9 0 37.1 1.5 51.7 4.4a8 8 0 0 0 9.6-7.8v-42.8c0-3.8-2.6-7-6.3-7.8z')); exports.FallOutline = getIcon('fall', outline, getNode(newViewBox, 'M925.9 804l-24-199.2c-.8-6.6-8.9-9.4-13.6-4.7L829 659.5 557.7 388.3c-6.3-6.2-16.4-6.2-22.6 0L433.3 490 156.6 213.3a8.03 8.03 0 0 0-11.3 0l-45 45.2a8.03 8.03 0 0 0 0 11.3L422 591.7c6.2 6.3 16.4 6.3 22.6 0L546.4 490l226.1 226-59.3 59.3a8.01 8.01 0 0 0 4.7 13.6l199.2 24c5.1.7 9.5-3.7 8.8-8.9z')); exports.FileJpgOutline = getIcon('file-jpg', outline, getNode(normalViewBox, 'M874.6 301.8L596.8 21.3c-4.5-4.5-9.4-8.3-14.7-11.5-1.4-.8-2.8-1.6-4.3-2.3-.9-.5-1.9-.9-2.8-1.3-9-4-18.9-6.2-29-6.2H201c-39.8 0-73 32.2-73 72v880c0 39.8 33.2 72 73 72h623c39.8 0 71-32.2 71-72V352.5c0-19-7-37.2-20.4-50.7zM583 110.4L783.8 312H583V110.4zM823 952H200V72h311v240c0 39.8 33.2 72 73 72h239v568zM350 696.5c0 24.2-7.5 31.4-21.9 31.4-9 0-18.4-5.8-24.8-18.5L272.9 732c13.4 22.9 32.3 34.2 61.3 34.2 41.6 0 60.8-29.9 60.8-66.2V577h-45v119.5zM501.3 577H437v186h44v-62h21.6c39.1 0 73.1-19.6 73.1-63.6 0-45.8-33.5-60.4-74.4-60.4zm-.8 89H481v-53h18.2c21.5 0 33.4 6.2 33.4 24.9 0 18.1-10.5 28.1-32.1 28.1zm182.5-9v36h30v30.1c-4 2.9-11 4.7-17.7 4.7-34.3 0-50.7-21.4-50.7-58.2 0-36.1 19.7-57.4 47.1-57.4 15.3 0 25 6.2 34 14.4l23.7-28.3c-12.7-12.8-32.1-24.2-59.2-24.2-49.6 0-91.1 35.3-91.1 97 0 62.7 40 95.1 91.5 95.1 25.9 0 49.2-10.2 61.5-22.6V657H683z')); exports.FileDoneOutline = getIcon('file-done', outline, getNode(newViewBox, 'M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm376 116c-119.3 0-216 96.7-216 216s96.7 216 216 216 216-96.7 216-216-96.7-216-216-216zm107.5 323.5C750.8 868.2 712.6 884 672 884s-78.8-15.8-107.5-44.5C535.8 810.8 520 772.6 520 732s15.8-78.8 44.5-107.5C593.2 595.8 631.4 580 672 580s78.8 15.8 107.5 44.5C808.2 653.2 824 691.4 824 732s-15.8 78.8-44.5 107.5zM761 656h-44.3c-2.6 0-5 1.2-6.5 3.3l-63.5 87.8-23.1-31.9a7.92 7.92 0 0 0-6.5-3.3H573c-6.5 0-10.3 7.4-6.5 12.7l73.8 102.1c3.2 4.4 9.7 4.4 12.9 0l114.2-158c3.9-5.3.1-12.7-6.4-12.7zM440 852H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.FileSearchOutline = getIcon('file-search', outline, getNode(newViewBox, 'M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm144 452H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm445.7 51.5l-93.3-93.3C814.7 780.7 828 743.9 828 704c0-97.2-78.8-176-176-176s-176 78.8-176 176 78.8 176 176 176c35.8 0 69-10.7 96.8-29l94.7 94.7c1.6 1.6 3.6 2.3 5.6 2.3s4.1-.8 5.6-2.3l31-31a7.9 7.9 0 0 0 0-11.2zM652 816c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z')); exports.FileProtectOutline = getIcon('file-protect', outline, getNode(newViewBox, 'M644.7 669.2a7.92 7.92 0 0 0-6.5-3.3H594c-6.5 0-10.3 7.4-6.5 12.7l73.8 102.1c3.2 4.4 9.7 4.4 12.9 0l114.2-158c3.8-5.3 0-12.7-6.5-12.7h-44.3c-2.6 0-5 1.2-6.5 3.3l-63.5 87.8-22.9-31.9zM688 306v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm184 458H208V148h560v296c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h312c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm402.6-320.8l-192-66.7c-.9-.3-1.7-.4-2.6-.4s-1.8.1-2.6.4l-192 66.7a7.96 7.96 0 0 0-5.4 7.5v251.1c0 2.5 1.1 4.8 3.1 6.3l192 150.2c1.4 1.1 3.2 1.7 4.9 1.7s3.5-.6 4.9-1.7l192-150.2c1.9-1.5 3.1-3.8 3.1-6.3V538.7c0-3.4-2.2-6.4-5.4-7.5zM826 763.7L688 871.6 550 763.7V577l138-48 138 48v186.7z')); exports.FileSyncOutline = getIcon('file-sync', outline, getNode(newViewBox, 'M296 256c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm192 200v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8zm-48 396H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm104.1-115.6c1.8-34.5 16.2-66.8 40.8-91.4 26.2-26.2 62-41 99.1-41 37.4 0 72.6 14.6 99.1 41 3.2 3.2 6.3 6.6 9.2 10.1L769.2 673a8 8 0 0 0 3 14.1l93.3 22.5c5 1.2 9.8-2.6 9.9-7.7l.6-95.4a8 8 0 0 0-12.9-6.4l-20.3 15.8C805.4 569.6 748.1 540 684 540c-109.9 0-199.6 86.9-204 195.7-.2 4.5 3.5 8.3 8 8.3h48.1c4.3 0 7.8-3.3 8-7.6zM880 744h-48.1c-4.3 0-7.8 3.3-8 7.6-1.8 34.5-16.2 66.8-40.8 91.4-26.2 26.2-62 41-99.1 41-37.4 0-72.6-14.6-99.1-41-3.2-3.2-6.3-6.6-9.2-10.1l23.1-17.9a8 8 0 0 0-3-14.1l-93.3-22.5c-5-1.2-9.8 2.6-9.9 7.7l-.6 95.4a8 8 0 0 0 12.9 6.4l20.3-15.8C562.6 918.4 619.9 948 684 948c109.9 0 199.6-86.9 204-195.7.2-4.5-3.5-8.3-8-8.3z')); exports.FontSizeOutline = getIcon('font-size', outline, getNode(newViewBox, 'M920 416H616c-4.4 0-8 3.6-8 8v112c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-56h60v320h-46c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h164c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8h-46V480h60v56c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V424c0-4.4-3.6-8-8-8zM656 296V168c0-4.4-3.6-8-8-8H104c-4.4 0-8 3.6-8 8v128c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-64h168v560h-92c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h264c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-92V232h168v64c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8z')); exports.FontColorsOutline = getIcon('font-colors', outline, getNode(newViewBox, 'M904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8zm-650.3-80h85c4.2 0 8-2.7 9.3-6.8l53.7-166h219.2l53.2 166c1.3 4 5 6.8 9.3 6.8h89.1c1.1 0 2.2-.2 3.2-.5a9.7 9.7 0 0 0 6-12.4L573.6 118.6a9.9 9.9 0 0 0-9.2-6.6H462.1c-4.2 0-7.9 2.6-9.2 6.6L244.5 723.1c-.4 1-.5 2.1-.5 3.2-.1 5.3 4.3 9.7 9.7 9.7zm255.9-516.1h4.1l83.8 263.8H424.9l84.7-263.8z')); exports.FormOutline = getIcon('form', outline, getNode(newViewBox, 'M904 512h-56c-4.4 0-8 3.6-8 8v320H184V184h320c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V520c0-4.4-3.6-8-8-8z', 'M355.9 534.9L354 653.8c-.1 8.9 7.1 16.2 16 16.2h.4l118-2.9c2-.1 4-.9 5.4-2.3l415.9-415c3.1-3.1 3.1-8.2 0-11.3L785.4 114.3c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-415.8 415a8.3 8.3 0 0 0-2.3 5.6zm63.5 23.6L779.7 199l45.2 45.1-360.5 359.7-45.7 1.1.7-46.4z')); exports.FullscreenExitOutline = getIcon('fullscreen-exit', outline, getNode(newViewBox, 'M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 0 0 0 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 0 0 391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 0 0-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z')); exports.ForkOutline = getIcon('fork', outline, getNode(newViewBox, 'M752 100c-61.8 0-112 50.2-112 112 0 47.7 29.9 88.5 72 104.6v27.6L512 601.4 312 344.2v-27.6c42.1-16.1 72-56.9 72-104.6 0-61.8-50.2-112-112-112s-112 50.2-112 112c0 50.6 33.8 93.5 80 107.3v34.4c0 9.7 3.3 19.3 9.3 27L476 672.3v33.6c-44.2 15-76 56.9-76 106.1 0 61.8 50.2 112 112 112s112-50.2 112-112c0-49.2-31.8-91-76-106.1v-33.6l226.7-291.6c6-7.7 9.3-17.3 9.3-27v-34.4c46.2-13.8 80-56.7 80-107.3 0-61.8-50.2-112-112-112zM224 212a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm336 600a48.01 48.01 0 0 1-96 0 48.01 48.01 0 0 1 96 0zm192-552a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z')); exports.FullscreenOutline = getIcon('fullscreen', outline, getNode(newViewBox, 'M290 236.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0 0 13.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 0 0 0 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 0 0-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z')); exports.GlobalOutline = getIcon('global', outline, getNode(newViewBox, 'M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0 0 10-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 0 0 3.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 0 0-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 0 1 887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 0 1-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 0 1 115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 0 1 540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 0 0 540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 0 1-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 0 0-81.5 55.9A373.86 373.86 0 0 1 137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 0 1-107.6 69.2z')); exports.GatewayOutline = getIcon('gateway', outline, getNode(newViewBox, 'M928 392c8.8 0 16-7.2 16-16V192c0-8.8-7.2-16-16-16H744c-8.8 0-16 7.2-16 16v56H296v-56c0-8.8-7.2-16-16-16H96c-8.8 0-16 7.2-16 16v184c0 8.8 7.2 16 16 16h56v240H96c-8.8 0-16 7.2-16 16v184c0 8.8 7.2 16 16 16h184c8.8 0 16-7.2 16-16v-56h432v56c0 8.8 7.2 16 16 16h184c8.8 0 16-7.2 16-16V648c0-8.8-7.2-16-16-16h-56V392h56zM792 240h88v88h-88v-88zm-648 88v-88h88v88h-88zm88 456h-88v-88h88v88zm648-88v88h-88v-88h88zm-80-64h-56c-8.8 0-16 7.2-16 16v56H296v-56c0-8.8-7.2-16-16-16h-56V392h56c8.8 0 16-7.2 16-16v-56h432v56c0 8.8 7.2 16 16 16h56v240z')); exports.GoldOutline = getIcon('gold', outline, getNode(newViewBox, 'M342 472h342c.4 0 .9 0 1.3-.1 4.4-.7 7.3-4.8 6.6-9.2l-40.2-248c-.6-3.9-4-6.7-7.9-6.7H382.2c-3.9 0-7.3 2.8-7.9 6.7l-40.2 248c-.1.4-.1.9-.1 1.3 0 4.4 3.6 8 8 8zm91.2-196h159.5l20.7 128h-201l20.8-128zm2.5 282.7c-.6-3.9-4-6.7-7.9-6.7H166.2c-3.9 0-7.3 2.8-7.9 6.7l-40.2 248c-.1.4-.1.9-.1 1.3 0 4.4 3.6 8 8 8h342c.4 0 .9 0 1.3-.1 4.4-.7 7.3-4.8 6.6-9.2l-40.2-248zM196.5 748l20.7-128h159.5l20.7 128H196.5zm709.4 58.7l-40.2-248c-.6-3.9-4-6.7-7.9-6.7H596.2c-3.9 0-7.3 2.8-7.9 6.7l-40.2 248c-.1.4-.1.9-.1 1.3 0 4.4 3.6 8 8 8h342c.4 0 .9 0 1.3-.1 4.3-.7 7.3-4.8 6.6-9.2zM626.5 748l20.7-128h159.5l20.7 128H626.5z')); exports.GooglePlusOutline = getIcon('google-plus', outline, getNode(newViewBox, 'M879.5 470.4c-.3-27-.4-54.2-.5-81.3h-80.8c-.3 27-.5 54.1-.7 81.3-27.2.1-54.2.3-81.2.6v80.9c27 .3 54.2.5 81.2.8.3 27 .3 54.1.5 81.1h80.9c.1-27 .3-54.1.5-81.3 27.2-.3 54.2-.4 81.2-.7v-80.9c-26.9-.2-54.1-.2-81.1-.5zm-530 .4c-.1 32.3 0 64.7.1 97 54.2 1.8 108.5 1 162.7 1.8-23.9 120.3-187.4 159.3-273.9 80.7-89-68.9-84.8-220 7.7-284 64.7-51.6 156.6-38.9 221.3 5.8 25.4-23.5 49.2-48.7 72.1-74.7-53.8-42.9-119.8-73.5-190-70.3-146.6-4.9-281.3 123.5-283.7 270.2-9.4 119.9 69.4 237.4 180.6 279.8 110.8 42.7 252.9 13.6 323.7-86 46.7-62.9 56.8-143.9 51.3-220-90.7-.7-181.3-.6-271.9-.3z')); exports.GoogleOutline = getIcon('google', outline, getNode(newViewBox, 'M881 442.4H519.7v148.5h206.4c-8.9 48-35.9 88.6-76.6 115.8-34.4 23-78.3 36.6-129.9 36.6-99.9 0-184.4-67.5-214.6-158.2-7.6-23-12-47.6-12-72.9s4.4-49.9 12-72.9c30.3-90.6 114.8-158.1 214.7-158.1 56.3 0 106.8 19.4 146.6 57.4l110-110.1c-66.5-62-153.2-100-256.6-100-149.9 0-279.6 86-342.7 211.4-26 51.8-40.8 110.4-40.8 172.4S151 632.8 177 684.6C240.1 810 369.8 896 519.7 896c103.6 0 190.4-34.4 253.8-93 72.5-66.8 114.4-165.2 114.4-282.1 0-27.2-2.4-53.3-6.9-78.5z')); exports.IeOutline = getIcon('ie', outline, getNode(newViewBox, 'M852.6 367.6c16.3-36.9 32.1-90.7 32.1-131.8 0-109.1-119.5-147.6-314.5-57.9-161.4-10.8-316.8 110.5-355.6 279.7 46.3-52.3 117.4-123.4 183-151.7C316.1 378.3 246.7 470 194 565.6c-31.1 56.9-66 148.8-66 217.5 0 147.9 139.3 129.8 270.4 63 47.1 23.1 99.8 23.4 152.5 23.4 145.7 0 276.4-81.4 325.2-219H694.9c-78.8 132.9-295.2 79.5-295.2-71.2h493.2c9.6-65.4-2.5-143.6-40.3-211.7zM224.8 648.3c26.6 76.7 80.6 143.8 150.4 185-133.1 73.4-259.9 43.6-150.4-185zm174-163.3c3-82.7 75.4-142.3 156-142.3 80.1 0 153 59.6 156 142.3h-312zm276.8-281.4c32.1-15.4 72.8-33 108.8-33 47.1 0 81.4 32.6 81.4 80.6 0 30-11.1 73.5-21.9 101.8-39.3-63.5-98.9-122.4-168.3-149.4z')); exports.InboxOutline = getIcon('inbox', outline, getNode(normalViewBox, 'M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0 0 60.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z')); exports.HeatMapOutline = getIcon('heat-map', outline, getNode(newViewBox, 'M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-790.4-23.9L512 231.9 858.7 832H165.3zm319-474.1l-228 394c-12.3 21.3 3.1 48 27.7 48h455.8c24.7 0 40.1-26.7 27.7-48L539.7 358c-6.2-10.7-17-16-27.7-16-10.8 0-21.6 5.3-27.7 16zm214 386H325.7L512 422l186.3 322zm-214-194.1l-57 98.4C415 669.5 430.4 696 455 696h114c24.6 0 39.9-26.5 27.7-47.7l-57-98.4c-6.1-10.6-16.9-15.9-27.7-15.9s-21.5 5.3-27.7 15.9zm57.1 98.4h-58.7l29.4-50.7 29.3 50.7z')); exports.ImportOutline = getIcon('import', outline, getNode(newViewBox, 'M888.3 757.4h-53.8c-4.2 0-7.7 3.5-7.7 7.7v61.8H197.1V197.1h629.8v61.8c0 4.2 3.5 7.7 7.7 7.7h53.8c4.2 0 7.7-3.4 7.7-7.7V158.7c0-17-13.7-30.7-30.7-30.7H158.7c-17 0-30.7 13.7-30.7 30.7v706.6c0 17 13.7 30.7 30.7 30.7h706.6c17 0 30.7-13.7 30.7-30.7V765.1c0-4.3-3.5-7.7-7.7-7.7zM902 476H588v-76c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 0 0 0 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-76h314c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.InfoOutline = getIcon('info', outline, getNode(newViewBox, 'M448 224a64 64 0 1 0 128 0 64 64 0 1 0-128 0zm96 168h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z')); exports.IssuesCloseOutline = getIcon('issues-close', outline, getNode(newViewBox, 'M464 688a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm72-112c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48zm400-188h-59.3c-2.6 0-5 1.2-6.5 3.3L763.7 538.1l-49.9-68.8a7.92 7.92 0 0 0-6.5-3.3H648c-6.5 0-10.3 7.4-6.5 12.7l109.2 150.7a16.1 16.1 0 0 0 26 0l165.8-228.7c3.8-5.3 0-12.7-6.5-12.7zm-44 306h-64.2c-5.5 0-10.6 2.9-13.6 7.5a352.2 352.2 0 0 1-49.8 62.2A355.92 355.92 0 0 1 651.1 840a355 355 0 0 1-138.7 27.9c-48.1 0-94.8-9.4-138.7-27.9a355.92 355.92 0 0 1-113.3-76.3A353.06 353.06 0 0 1 184 650.5c-18.6-43.8-28-90.5-28-138.5s9.4-94.7 28-138.5c17.9-42.4 43.6-80.5 76.4-113.2 32.8-32.7 70.9-58.4 113.3-76.3a355 355 0 0 1 138.7-27.9c48.1 0 94.8 9.4 138.7 27.9 42.4 17.9 80.5 43.6 113.3 76.3 19 19 35.6 39.8 49.8 62.2 2.9 4.7 8.1 7.5 13.6 7.5H892c6 0 9.8-6.3 7.2-11.6C828.8 178.5 684.7 82 517.7 80 278.9 77.2 80.5 272.5 80 511.2 79.5 750.1 273.3 944 512.4 944c169.2 0 315.6-97 386.7-238.4A8 8 0 0 0 892 694z')); exports.LaptopOutline = getIcon('laptop', outline, getNode(newViewBox, 'M956.9 845.1L896.4 632V168c0-17.7-14.3-32-32-32h-704c-17.7 0-32 14.3-32 32v464L67.9 845.1C60.4 866 75.8 888 98 888h828.8c22.2 0 37.6-22 30.1-42.9zM200.4 208h624v395h-624V208zm228.3 608l8.1-37h150.3l8.1 37H428.7zm224 0l-19.1-86.7c-.8-3.7-4.1-6.3-7.8-6.3H398.2c-3.8 0-7 2.6-7.8 6.3L371.3 816H151l42.3-149h638.2l42.3 149H652.7z')); exports.ItalicOutline = getIcon('italic', outline, getNode(newViewBox, 'M798 160H366c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h181.2l-156 544H229c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h432c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8H474.4l156-544H798c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8z')); exports.LeftOutline = getIcon('left', outline, getNode(newViewBox, 'M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z')); exports.KeyOutline = getIcon('key', outline, getNode(newViewBox, 'M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5l-41.1 41.1-62.3-62.3a8.15 8.15 0 0 0-11.4 0l-39.8 39.8a8.15 8.15 0 0 0 0 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.15 8.15 0 0 0-11.4 0l-39.8 39.8a8.15 8.15 0 0 0 0 11.4l62.3 62.3-65.3 65.3a8.03 8.03 0 0 0 0 11.3l42.3 42.3c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.06 304.06 0 0 0 608 720c167.9 0 304-136.1 304-304S775.9 112 608 112zm161.2 465.2C726.2 620.3 668.9 644 608 644c-60.9 0-118.2-23.7-161.2-66.8-43.1-43-66.8-100.3-66.8-161.2 0-60.9 23.7-118.2 66.8-161.2 43-43.1 100.3-66.8 161.2-66.8 60.9 0 118.2 23.7 161.2 66.8 43.1 43 66.8 100.3 66.8 161.2 0 60.9-23.7 118.2-66.8 161.2z')); exports.LineHeightOutline = getIcon('line-height', outline, getNode(newViewBox, 'M648 160H104c-4.4 0-8 3.6-8 8v128c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-64h168v560h-92c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h264c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-92V232h168v64c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V168c0-4.4-3.6-8-8-8zm272.8 546H856V318h64.8c6 0 9.4-7 5.7-11.7L825.7 178.7a7.14 7.14 0 0 0-11.3 0L713.6 306.3a7.23 7.23 0 0 0 5.7 11.7H784v388h-64.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5a7.2 7.2 0 0 0-5.6-11.7z')); exports.LineOutline = getIcon('line', outline, getNode(newViewBox, 'M904 476H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.LineChartOutline = getIcon('line-chart', outline, getNode(newViewBox, 'M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM305.8 637.7c3.1 3.1 8.1 3.1 11.3 0l138.3-137.6L583 628.5c3.1 3.1 8.2 3.1 11.3 0l275.4-275.3c3.1-3.1 3.1-8.2 0-11.3l-39.6-39.6a8.03 8.03 0 0 0-11.3 0l-230 229.9L461.4 404a8.03 8.03 0 0 0-11.3 0L266.3 586.7a8.03 8.03 0 0 0 0 11.3l39.5 39.7z')); exports.Loading3QuartersOutline = getIcon('loading-3-quarters', outline, getNode(normalViewBox, 'M512 1024c-69.1 0-136.2-13.5-199.3-40.2C251.7 958 197 921 150 874c-47-47-84-101.7-109.8-162.7C13.5 648.2 0 581.1 0 512c0-19.9 16.1-36 36-36s36 16.1 36 36c0 59.4 11.6 117 34.6 171.3 22.2 52.4 53.9 99.5 94.3 139.9 40.4 40.4 87.5 72.2 139.9 94.3C395 940.4 452.6 952 512 952c59.4 0 117-11.6 171.3-34.6 52.4-22.2 99.5-53.9 139.9-94.3 40.4-40.4 72.2-87.5 94.3-139.9C940.4 629 952 571.4 952 512c0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.2C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3s-13.5 136.2-40.2 199.3C958 772.3 921 827 874 874c-47 47-101.8 83.9-162.7 109.7-63.1 26.8-130.2 40.3-199.3 40.3z')); exports.LoadingOutline = getIcon('loading', outline, getNode(normalViewBox, 'M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z')); exports.LinkOutline = getIcon('link', outline, getNode(newViewBox, 'M574 665.4a8.03 8.03 0 0 0-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 0 0-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 0 0 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 0 0 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 0 0-11.3 0L372.3 598.7a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z')); exports.LogoutOutline = getIcon('logout', outline, getNode(newViewBox, 'M868 732h-70.3c-4.8 0-9.3 2.1-12.3 5.8-7 8.5-14.5 16.7-22.4 24.5a353.84 353.84 0 0 1-112.7 75.9A352.8 352.8 0 0 1 512.4 866c-47.9 0-94.3-9.4-137.9-27.8a353.84 353.84 0 0 1-112.7-75.9 353.28 353.28 0 0 1-76-112.5C167.3 606.2 158 559.9 158 512s9.4-94.2 27.8-137.8c17.8-42.1 43.4-80 76-112.5s70.5-58.1 112.7-75.9c43.6-18.4 90-27.8 137.9-27.8 47.9 0 94.3 9.3 137.9 27.8 42.2 17.8 80.1 43.4 112.7 75.9 7.9 7.9 15.3 16.1 22.4 24.5 3 3.7 7.6 5.8 12.3 5.8H868c6.3 0 10.2-7 6.7-12.3C798 160.5 663.8 81.6 511.3 82 271.7 82.6 79.6 277.1 82 516.4 84.4 751.9 276.2 942 512.4 942c152.1 0 285.7-78.8 362.3-197.7 3.4-5.3-.4-12.3-6.7-12.3zm88.9-226.3L815 393.7c-5.3-4.2-13-.4-13 6.3v76H488c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h314v76c0 6.7 7.8 10.5 13 6.3l141.9-112a8 8 0 0 0 0-12.6z')); exports.ManOutline = getIcon('man', outline, getNode(newViewBox, 'M874 120H622c-3.3 0-6 2.7-6 6v56c0 3.3 2.7 6 6 6h160.4L583.1 387.3c-50-38.5-111-59.3-175.1-59.3-76.9 0-149.3 30-203.6 84.4S120 539.1 120 616s30 149.3 84.4 203.6C258.7 874 331.1 904 408 904s149.3-30 203.6-84.4C666 765.3 696 692.9 696 616c0-64.1-20.8-124.9-59.2-174.9L836 241.9V402c0 3.3 2.7 6 6 6h56c3.3 0 6-2.7 6-6V150c0-16.5-13.5-30-30-30zM408 828c-116.9 0-212-95.1-212-212s95.1-212 212-212 212 95.1 212 212-95.1 212-212 212z')); exports.MediumWorkmarkOutline = getIcon('medium-workmark', outline, getNode(normalViewBox, 'M517.2 590.55c0 3.55 0 4.36 2.4 6.55l13.43 13.25v.57h-59.57v-25.47a41.44 41.44 0 0 1-39.5 27.65c-30.61 0-52.84-24.25-52.84-68.87 0-41.8 23.99-69.69 57.65-69.69a35.15 35.15 0 0 1 34.61 21.67v-56.19a6.99 6.99 0 0 0-2.71-6.79l-12.8-12.45v-.56l59.33-7.04v177.37zm-43.74-8.09v-83.83a22.2 22.2 0 0 0-17.74-8.4c-14.48 0-28.47 13.25-28.47 52.62 0 36.86 12.07 49.88 27.1 49.88a23.91 23.91 0 0 0 19.11-10.27zm83.23 28.46V497.74a7.65 7.65 0 0 0-2.4-6.79l-13.19-13.74v-.57h59.56v114.8c0 3.55 0 4.36 2.4 6.54l13.12 12.45v.57l-59.49-.08zm-2.16-175.67c0-13.4 10.74-24.25 23.99-24.25 13.25 0 23.98 10.86 23.98 24.25 0 13.4-10.73 24.25-23.98 24.25s-23.99-10.85-23.99-24.25zm206.83 155.06c0 3.55 0 4.6 2.4 6.79l13.43 13.25v.57h-59.88V581.9a43.4 43.4 0 0 1-41.01 31.2c-26.55 0-40.78-19.56-40.78-56.59 0-17.86 0-37.43.56-59.41a6.91 6.91 0 0 0-2.4-6.55L620.5 477.2v-.57h59.09v73.81c0 24.25 3.51 40.42 18.54 40.42a23.96 23.96 0 0 0 19.35-12.2v-80.85a7.65 7.65 0 0 0-2.4-6.79l-13.27-13.82v-.57h59.56V590.3zm202.76 20.6c0-4.36.8-59.97.8-72.75 0-24.25-3.76-40.98-20.63-40.98a26.7 26.7 0 0 0-21.19 11.64 99.68 99.68 0 0 1 2.4 23.04c0 16.81-.56 38.23-.8 59.66a6.91 6.91 0 0 0 2.4 6.55l13.43 12.45v.56h-60.12c0-4.04.8-59.98.8-72.76 0-24.65-3.76-40.98-20.39-40.98-8.2.3-15.68 4.8-19.83 11.96v82.46c0 3.56 0 4.37 2.4 6.55l13.11 12.45v.56h-59.48V498.15a7.65 7.65 0 0 0-2.4-6.8l-13.19-14.14v-.57H841v28.78c5.53-19 23.13-31.76 42.7-30.96 19.82 0 33.26 11.16 38.93 32.34a46.41 46.41 0 0 1 44.77-32.34c26.55 0 41.58 19.8 41.58 57.23 0 17.87-.56 38.24-.8 59.66a6.5 6.5 0 0 0 2.72 6.55l13.11 12.45v.57h-59.88zM215.87 593.3l17.66 17.05v.57h-89.62v-.57l17.99-17.05a6.91 6.91 0 0 0 2.4-6.55V477.69c0-4.6 0-10.83.8-16.16L104.66 613.1h-.72l-62.6-139.45c-1.37-3.47-1.77-3.72-2.65-6.06v91.43a32.08 32.08 0 0 0 2.96 17.87l25.19 33.46v.57H0v-.57l25.18-33.55a32.16 32.16 0 0 0 2.96-17.78V457.97A19.71 19.71 0 0 0 24 444.15L6.16 420.78v-.56h63.96l53.56 118.1 47.17-118.1h62.6v.56l-17.58 19.8a6.99 6.99 0 0 0-2.72 6.8v139.37a6.5 6.5 0 0 0 2.72 6.55zm70.11-54.65v.56c0 34.6 17.67 48.5 38.38 48.5a43.5 43.5 0 0 0 40.77-24.97h.56c-7.2 34.2-28.14 50.36-59.48 50.36-33.82 0-65.72-20.61-65.72-68.39 0-50.2 31.98-70.25 67.32-70.25 28.46 0 58.76 13.58 58.76 57.24v6.95h-80.59zm0-6.95h39.42v-7.04c0-35.57-7.28-45.03-18.23-45.03-13.27 0-21.35 14.15-21.35 52.07h.16z')); exports.MenuFoldOutline = getIcon('menu-fold', outline, getNode(newViewBox, 'M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z')); exports.MenuUnfoldOutline = getIcon('menu-unfold', outline, getNode(newViewBox, 'M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z')); exports.MediumOutline = getIcon('medium', outline, getNode(newViewBox, 'M834.7 279.8l61.3-58.9V208H683.7L532.4 586.4 360.3 208H137.7v12.9l71.6 86.6c7 6.4 10.6 15.8 9.7 25.2V673c2.2 12.3-1.7 24.8-10.3 33.7L128 805v12.7h228.6v-12.9l-80.6-98a39.99 39.99 0 0 1-11.1-33.7V378.7l200.7 439.2h23.3l172.6-439.2v349.9c0 9.2 0 11.1-6 17.2l-62.1 60.3V819h301.2v-12.9l-59.9-58.9c-5.2-4-7.9-10.7-6.8-17.2V297a18.1 18.1 0 0 1 6.8-17.2z')); exports.LoginOutline = getIcon('login', outline, getNode(newViewBox, 'M521.7 82c-152.5-.4-286.7 78.5-363.4 197.7-3.4 5.3.4 12.3 6.7 12.3h70.3c4.8 0 9.3-2.1 12.3-5.8 7-8.5 14.5-16.7 22.4-24.5 32.6-32.5 70.5-58.1 112.7-75.9 43.6-18.4 90-27.8 137.9-27.8 47.9 0 94.3 9.3 137.9 27.8 42.2 17.8 80.1 43.4 112.7 75.9 32.6 32.5 58.1 70.4 76 112.5C865.7 417.8 875 464.1 875 512c0 47.9-9.4 94.2-27.8 137.8-17.8 42.1-43.4 80-76 112.5s-70.5 58.1-112.7 75.9A352.8 352.8 0 0 1 520.6 866c-47.9 0-94.3-9.4-137.9-27.8A353.84 353.84 0 0 1 270 762.3c-7.9-7.9-15.3-16.1-22.4-24.5-3-3.7-7.6-5.8-12.3-5.8H165c-6.3 0-10.2 7-6.7 12.3C234.9 863.2 368.5 942 520.6 942c236.2 0 428-190.1 430.4-425.6C953.4 277.1 761.3 82.6 521.7 82zM395.02 624v-76h-314c-4.4 0-8-3.6-8-8v-56c0-4.4 3.6-8 8-8h314v-76c0-6.7 7.8-10.5 13-6.3l141.9 112a8 8 0 0 1 0 12.6l-141.9 112c-5.2 4.1-13 .4-13-6.3z')); exports.MenuOutline = getIcon('menu', outline, getNode(newViewBox, 'M904 160H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0 624H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0-312H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8z')); exports.MinusOutline = getIcon('minus', outline, getNode(newViewBox, 'M872 474H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z')); exports.NumberOutline = getIcon('number', outline, getNode(newViewBox, 'M872 394c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H400V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v236H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h228v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h164c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V394h164zM628 630H400V394h228v236z')); exports.MrOutline = getIcon('mr', outline, getNode(newViewBox, 'M788 705.9V192c0-8.8-7.2-16-16-16H602v-68.8c0-6-7-9.4-11.7-5.7L462.7 202.3a7.14 7.14 0 0 0 0 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V240h114v465.9c-44.2 15-76 56.9-76 106.1 0 61.8 50.2 112 112 112s112-50.2 112-112c.1-49.2-31.7-91-75.9-106.1zM752 860a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96zM384 212c0-61.8-50.2-112-112-112s-112 50.2-112 112c0 49.2 31.8 91 76 106.1V706c-44.2 15-76 56.9-76 106.1 0 61.8 50.2 112 112 112s112-50.2 112-112c0-49.2-31.8-91-76-106.1V318.1c44.2-15.1 76-56.9 76-106.1zm-160 0a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm96 600a48.01 48.01 0 0 1-96 0 48.01 48.01 0 0 1 96 0z')); exports.MonitorOutline = getIcon('monitor', outline, getNode(newViewBox, 'M692.8 412.7l.2-.2-34.6-44.3a7.97 7.97 0 0 0-11.2-1.4l-50.4 39.3-70.5-90.1a7.97 7.97 0 0 0-11.2-1.4l-37.9 29.7a7.97 7.97 0 0 0-1.4 11.2l70.5 90.2-.2.1 34.6 44.3c2.7 3.5 7.7 4.1 11.2 1.4l50.4-39.3 64.1 82c2.7 3.5 7.7 4.1 11.2 1.4l37.9-29.6c3.5-2.7 4.1-7.7 1.4-11.2l-64.1-82.1zM608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5L114.3 856.1a8.03 8.03 0 0 0 0 11.3l42.3 42.3c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6C473 696.1 537.7 720 608 720c167.9 0 304-136.1 304-304S775.9 112 608 112zm161.2 465.2C726.2 620.3 668.9 644 608 644s-118.2-23.7-161.2-66.8C403.7 534.2 380 476.9 380 416s23.7-118.2 66.8-161.2c43-43.1 100.3-66.8 161.2-66.8s118.2 23.7 161.2 66.8c43.1 43 66.8 100.3 66.8 161.2s-23.7 118.2-66.8 161.2z')); exports.OrderedListOutline = getIcon('ordered-list', outline, getNode(newViewBox, 'M920 760H336c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-568H336c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H336c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM216 712H100c-2.2 0-4 1.8-4 4v34c0 2.2 1.8 4 4 4h72.4v20.5h-35.7c-2.2 0-4 1.8-4 4v34c0 2.2 1.8 4 4 4h35.7V838H100c-2.2 0-4 1.8-4 4v34c0 2.2 1.8 4 4 4h116c2.2 0 4-1.8 4-4V716c0-2.2-1.8-4-4-4zM100 188h38v120c0 2.2 1.8 4 4 4h40c2.2 0 4-1.8 4-4V152c0-4.4-3.6-8-8-8h-78c-2.2 0-4 1.8-4 4v36c0 2.2 1.8 4 4 4zm116 240H100c-2.2 0-4 1.8-4 4v36c0 2.2 1.8 4 4 4h68.4l-70.3 77.7a8.3 8.3 0 0 0-2.1 5.4V592c0 2.2 1.8 4 4 4h116c2.2 0 4-1.8 4-4v-36c0-2.2-1.8-4-4-4h-68.4l70.3-77.7a8.3 8.3 0 0 0 2.1-5.4V432c0-2.2-1.8-4-4-4z')); exports.PaperClipOutline = getIcon('paper-clip', outline, getNode(newViewBox, 'M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0 0 12.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0 0 12.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 0 0 174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z')); exports.PauseOutline = getIcon('pause', outline, getNode(newViewBox, 'M304 176h80v672h-80zm408 0h-64c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8z')); exports.PicCenterOutline = getIcon('pic-center', outline, getNode(newViewBox, 'M952 792H72c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h880c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-632H72c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h880c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM848 660c8.8 0 16-7.2 16-16V380c0-8.8-7.2-16-16-16H176c-8.8 0-16 7.2-16 16v264c0 8.8 7.2 16 16 16h672zM232 436h560v152H232V436z')); exports.PicLeftOutline = getIcon('pic-left', outline, getNode(newViewBox, 'M952 792H72c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h880c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-632H72c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h880c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM608 660c8.8 0 16-7.2 16-16V380c0-8.8-7.2-16-16-16H96c-8.8 0-16 7.2-16 16v264c0 8.8 7.2 16 16 16h512zM152 436h400v152H152V436zm552 210c0 4.4 3.6 8 8 8h224c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H712c-4.4 0-8 3.6-8 8v56zm8-204h224c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H712c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8z')); exports.PercentageOutline = getIcon('percentage', outline, getNode(newViewBox, 'M855.7 210.8l-42.4-42.4a8.03 8.03 0 0 0-11.3 0L168.3 801.9a8.03 8.03 0 0 0 0 11.3l42.4 42.4c3.1 3.1 8.2 3.1 11.3 0L855.6 222c3.2-3 3.2-8.1.1-11.2zM304 448c79.4 0 144-64.6 144-144s-64.6-144-144-144-144 64.6-144 144 64.6 144 144 144zm0-216c39.7 0 72 32.3 72 72s-32.3 72-72 72-72-32.3-72-72 32.3-72 72-72zm416 344c-79.4 0-144 64.6-144 144s64.6 144 144 144 144-64.6 144-144-64.6-144-144-144zm0 216c-39.7 0-72-32.3-72-72s32.3-72 72-72 72 32.3 72 72-32.3 72-72 72z')); exports.PlusOutline = getIcon('plus', outline, getNode(newViewBox, 'M848 474H550V152h-76v322H176c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h298v322h76V550h298c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z')); exports.PoundOutline = getIcon('pound', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm138-209.8H469.8v-4.7c27.4-17.2 43.9-50.4 43.9-91.1 0-14.1-2.2-27.9-5.3-41H607c4.4 0 8-3.6 8-8v-30c0-4.4-3.6-8-8-8H495c-7.2-22.6-13.4-45.7-13.4-70.5 0-43.5 34-70.2 87.3-70.2 21.5 0 42.5 4.1 60.4 10.5 5.2 1.9 10.6-2 10.6-7.6v-39.5c0-3.3-2.1-6.3-5.2-7.5-18.8-7.2-43.8-12.7-70.3-12.7-92.9 0-151.5 44.5-151.5 120.3 0 26.3 6.9 52 14.6 77.1H374c-4.4 0-8 3.6-8 8v30c0 4.4 3.6 8 8 8h67.1c3.4 14.7 5.9 29.4 5.9 44.2 0 45.2-28.8 83.3-72.8 94.2-3.6.9-6.1 4.1-6.1 7.8V722c0 4.4 3.6 8 8 8H650c4.4 0 8-3.6 8-8v-39.8c0-4.4-3.6-8-8-8z')); exports.PicRightOutline = getIcon('pic-right', outline, getNode(newViewBox, 'M952 792H72c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h880c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-632H72c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h880c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-24 500c8.8 0 16-7.2 16-16V380c0-8.8-7.2-16-16-16H416c-8.8 0-16 7.2-16 16v264c0 8.8 7.2 16 16 16h512zM472 436h400v152H472V436zM80 646c0 4.4 3.6 8 8 8h224c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H88c-4.4 0-8 3.6-8 8v56zm8-204h224c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H88c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8z')); exports.QqOutline = getIcon('qq', outline, getNode(newViewBox, 'M824.8 613.2c-16-51.4-34.4-94.6-62.7-165.3C766.5 262.2 689.3 112 511.5 112 331.7 112 256.2 265.2 261 447.9c-28.4 70.8-46.7 113.7-62.7 165.3-34 109.5-23 154.8-14.6 155.8 18 2.2 70.1-82.4 70.1-82.4 0 49 25.2 112.9 79.8 159-26.4 8.1-85.7 29.9-71.6 53.8 11.4 19.3 196.2 12.3 249.5 6.3 53.3 6 238.1 13 249.5-6.3 14.1-23.8-45.3-45.7-71.6-53.8 54.6-46.2 79.8-110.1 79.8-159 0 0 52.1 84.6 70.1 82.4 8.5-1.1 19.5-46.4-14.5-155.8z')); exports.QrcodeOutline = getIcon('qrcode', outline, getNode(newViewBox, 'M468 128H160c-17.7 0-32 14.3-32 32v308c0 4.4 3.6 8 8 8h332c4.4 0 8-3.6 8-8V136c0-4.4-3.6-8-8-8zm-56 284H192V192h220v220zm-138-74h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm194 210H136c-4.4 0-8 3.6-8 8v308c0 17.7 14.3 32 32 32h308c4.4 0 8-3.6 8-8V556c0-4.4-3.6-8-8-8zm-56 284H192V612h220v220zm-138-74h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm590-630H556c-4.4 0-8 3.6-8 8v332c0 4.4 3.6 8 8 8h332c4.4 0 8-3.6 8-8V160c0-17.7-14.3-32-32-32zm-32 284H612V192h220v220zm-138-74h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm194 210h-48c-4.4 0-8 3.6-8 8v134h-78V556c0-4.4-3.6-8-8-8H556c-4.4 0-8 3.6-8 8v332c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V644h78v102c0 4.4 3.6 8 8 8h190c4.4 0 8-3.6 8-8V556c0-4.4-3.6-8-8-8zM746 832h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm142 0h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z')); exports.PoweroffOutline = getIcon('poweroff', outline, getNode(newViewBox, 'M705.6 124.9a8 8 0 0 0-11.6 7.2v64.2c0 5.5 2.9 10.6 7.5 13.6a352.2 352.2 0 0 1 62.2 49.8c32.7 32.8 58.4 70.9 76.3 113.3a355 355 0 0 1 27.9 138.7c0 48.1-9.4 94.8-27.9 138.7a355.92 355.92 0 0 1-76.3 113.3 353.06 353.06 0 0 1-113.2 76.4c-43.8 18.6-90.5 28-138.5 28s-94.7-9.4-138.5-28a353.06 353.06 0 0 1-113.2-76.4A355.92 355.92 0 0 1 184 650.4a355 355 0 0 1-27.9-138.7c0-48.1 9.4-94.8 27.9-138.7 17.9-42.4 43.6-80.5 76.3-113.3 19-19 39.8-35.6 62.2-49.8 4.7-2.9 7.5-8.1 7.5-13.6V132c0-6-6.3-9.8-11.6-7.2C178.5 195.2 82 339.3 80 506.3 77.2 745.1 272.5 943.5 511.2 944c239 .5 432.8-193.3 432.8-432.4 0-169.2-97-315.7-238.4-386.7zM480 560h64c4.4 0 8-3.6 8-8V88c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8z')); exports.QuestionOutline = getIcon('question', outline, getNode(newViewBox, 'M764 280.9c-14-30.6-33.9-58.1-59.3-81.6C653.1 151.4 584.6 125 512 125s-141.1 26.4-192.7 74.2c-25.4 23.6-45.3 51-59.3 81.7-14.6 32-22 65.9-22 100.9v27c0 6.2 5 11.2 11.2 11.2h54c6.2 0 11.2-5 11.2-11.2v-27c0-99.5 88.6-180.4 197.6-180.4s197.6 80.9 197.6 180.4c0 40.8-14.5 79.2-42 111.2-27.2 31.7-65.6 54.4-108.1 64-24.3 5.5-46.2 19.2-61.7 38.8a110.85 110.85 0 0 0-23.9 68.6v31.4c0 6.2 5 11.2 11.2 11.2h54c6.2 0 11.2-5 11.2-11.2v-31.4c0-15.7 10.9-29.5 26-32.9 58.4-13.2 111.4-44.7 149.3-88.7 19.1-22.3 34-47.1 44.3-74 10.7-27.9 16.1-57.2 16.1-87 0-35-7.4-69-22-100.9zM512 787c-30.9 0-56 25.1-56 56s25.1 56 56 56 56-25.1 56-56-25.1-56-56-56z')); exports.RadarChartOutline = getIcon('radar-chart', outline, getNode(newViewBox, 'M926.8 397.1l-396-288a31.81 31.81 0 0 0-37.6 0l-396 288a31.99 31.99 0 0 0-11.6 35.8l151.3 466a32 32 0 0 0 30.4 22.1h489.5c13.9 0 26.1-8.9 30.4-22.1l151.3-466c4.2-13.2-.5-27.6-11.7-35.8zM838.6 417l-98.5 32-200-144.7V199.9L838.6 417zM466 567.2l-89.1 122.3-55.2-169.2L466 567.2zm-116.3-96.8L484 373.3v140.8l-134.3-43.7zM512 599.2l93.9 128.9H418.1L512 599.2zm28.1-225.9l134.2 97.1L540.1 514V373.3zM558 567.2l144.3-46.9-55.2 169.2L558 567.2zm-74-367.3v104.4L283.9 449l-98.5-32L484 199.9zM169.3 470.8l86.5 28.1 80.4 246.4-53.8 73.9-113.1-348.4zM327.1 853l50.3-69h269.3l50.3 69H327.1zm414.5-33.8l-53.8-73.9 80.4-246.4 86.5-28.1-113.1 348.4z')); exports.RadiusBottomleftOutline = getIcon('radius-bottomleft', outline, getNode(newViewBox, 'M712 824h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm2-696h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM136 374h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0-174h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm752 624h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-348 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-230 72h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm230 624H358c-87.3 0-158-70.7-158-158V484c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v182c0 127 103 230 230 230h182c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.RadiusUpleftOutline = getIcon('radius-upleft', outline, getNode(newViewBox, 'M656 200h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm58 624h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM192 650h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm696-696h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-348 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-174 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm174-696H358c-127 0-230 103-230 230v182c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V358c0-87.3 70.7-158 158-158h182c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.RadiusSettingOutline = getIcon('radius-setting', outline, getNode(newViewBox, 'M396 140h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-44 684h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm524-204h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM192 344h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 160h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 160h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 160h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm320 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm160 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm140-284c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V370c0-127-103-230-230-230H484c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h170c87.3 0 158 70.7 158 158v170zM236 96H92c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8h144c4.4 0 8-3.6 8-8V104c0-4.4-3.6-8-8-8zm-48 101.6c0 1.3-1.1 2.4-2.4 2.4h-43.2c-1.3 0-2.4-1.1-2.4-2.4v-43.2c0-1.3 1.1-2.4 2.4-2.4h43.2c1.3 0 2.4 1.1 2.4 2.4v43.2zM920 780H776c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8h144c4.4 0 8-3.6 8-8V788c0-4.4-3.6-8-8-8zm-48 101.6c0 1.3-1.1 2.4-2.4 2.4h-43.2c-1.3 0-2.4-1.1-2.4-2.4v-43.2c0-1.3 1.1-2.4 2.4-2.4h43.2c1.3 0 2.4 1.1 2.4 2.4v43.2z')); exports.RadiusUprightOutline = getIcon('radius-upright', outline, getNode(newViewBox, 'M368 128h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-2 696h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm522-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM192 128h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm348 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm174 0h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-48-696H484c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h182c87.3 0 158 70.7 158 158v182c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V358c0-127-103-230-230-230z')); exports.RadiusBottomrightOutline = getIcon('radius-bottomright', outline, getNode(newViewBox, 'M368 824h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-58-624h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm578 102h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM192 824h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-174h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm292 72h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm174 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm230 276h-56c-4.4 0-8 3.6-8 8v182c0 87.3-70.7 158-158 158H484c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h182c127 0 230-103 230-230V484c0-4.4-3.6-8-8-8z')); exports.RedditOutline = getIcon('reddit', outline, getNode(newViewBox, 'M288 568a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm338.7 119.7c-23.1 18.2-68.9 37.8-114.7 37.8s-91.6-19.6-114.7-37.8c-14.4-11.3-35.3-8.9-46.7 5.5s-8.9 35.3 5.5 46.7C396.3 771.6 457.5 792 512 792s115.7-20.4 155.9-52.1a33.25 33.25 0 1 0-41.2-52.2zM960 456c0-61.9-50.1-112-112-112-42.1 0-78.7 23.2-97.9 57.6-57.6-31.5-127.7-51.8-204.1-56.5L612.9 195l127.9 36.9c11.5 32.6 42.6 56.1 79.2 56.1 46.4 0 84-37.6 84-84s-37.6-84-84-84c-32 0-59.8 17.9-74 44.2L603.5 123a33.2 33.2 0 0 0-39.6 18.4l-90.8 203.9c-74.5 5.2-142.9 25.4-199.2 56.2A111.94 111.94 0 0 0 176 344c-61.9 0-112 50.1-112 112 0 45.8 27.5 85.1 66.8 102.5-7.1 21-10.8 43-10.8 65.5 0 154.6 175.5 280 392 280s392-125.4 392-280c0-22.6-3.8-44.5-10.8-65.5C932.5 541.1 960 501.8 960 456zM820 172.5a31.5 31.5 0 1 1 0 63 31.5 31.5 0 0 1 0-63zM120 456c0-30.9 25.1-56 56-56a56 56 0 0 1 50.6 32.1c-29.3 22.2-53.5 47.8-71.5 75.9a56.23 56.23 0 0 1-35.1-52zm392 381.5c-179.8 0-325.5-95.6-325.5-213.5S332.2 410.5 512 410.5 837.5 506.1 837.5 624 691.8 837.5 512 837.5zM868.8 508c-17.9-28.1-42.2-53.7-71.5-75.9 9-18.9 28.3-32.1 50.6-32.1 30.9 0 56 25.1 56 56 .1 23.5-14.5 43.7-35.1 52zM624 568a56 56 0 1 0 112 0 56 56 0 1 0-112 0z')); exports.RedoOutline = getIcon('redo', outline, getNode(newViewBox, 'M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 0 0-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z')); exports.ReloadTimeOutline = getIcon('reload-time', outline, getNode(newViewBox, 'M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 0 0 3 14.1zm167.7 301.1l-56.7-19.5a8 8 0 0 0-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 0 1-112.5 75.9 352.18 352.18 0 0 1-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 0 1-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 0 1 171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 0 1 112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 0 1 775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z')); exports.RetweetOutline = getIcon('retweet', outline, getNode(normalViewBox, 'M136 552h63.6c4.4 0 8-3.6 8-8V288.7h528.6v72.6c0 1.9.6 3.7 1.8 5.2a8.3 8.3 0 0 0 11.7 1.4L893 255.4c4.3-5 3.6-10.3 0-13.2L749.7 129.8a8.22 8.22 0 0 0-5.2-1.8c-4.6 0-8.4 3.8-8.4 8.4V209H199.7c-39.5 0-71.7 32.2-71.7 71.8V544c0 4.4 3.6 8 8 8zm752-80h-63.6c-4.4 0-8 3.6-8 8v255.3H287.8v-72.6c0-1.9-.6-3.7-1.8-5.2a8.3 8.3 0 0 0-11.7-1.4L131 768.6c-4.3 5-3.6 10.3 0 13.2l143.3 112.4c1.5 1.2 3.3 1.8 5.2 1.8 4.6 0 8.4-3.8 8.4-8.4V815h536.6c39.5 0 71.7-32.2 71.7-71.8V480c-.2-4.4-3.8-8-8.2-8z')); exports.ReloadOutline = getIcon('reload', outline, getNode(newViewBox, 'M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 0 0-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 0 1 655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 0 1 279 755.2a342.16 342.16 0 0 1-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 0 1 109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 0 0 3 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z')); exports.RiseOutline = getIcon('rise', outline, getNode(newViewBox, 'M917 211.1l-199.2 24c-6.6.8-9.4 8.9-4.7 13.6l59.3 59.3-226 226-101.8-101.7c-6.3-6.3-16.4-6.2-22.6 0L100.3 754.1a8.03 8.03 0 0 0 0 11.3l45 45.2c3.1 3.1 8.2 3.1 11.3 0L433.3 534 535 635.7c6.3 6.2 16.4 6.2 22.6 0L829 364.5l59.3 59.3a8.01 8.01 0 0 0 13.6-4.7l24-199.2c.7-5.1-3.7-9.5-8.9-8.8z')); exports.RobotOutline = getIcon('robot', outline, getNode(newViewBox, 'M300 328a60 60 0 1 0 120 0 60 60 0 1 0-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 1 0 120 0 60 60 0 1 0-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z')); exports.RollbackOutline = getIcon('rollback', outline, getNode(newViewBox, 'M793 242H366v-74c0-6.7-7.7-10.4-12.9-6.3l-142 112a8 8 0 0 0 0 12.6l142 112c5.2 4.1 12.9.4 12.9-6.3v-74h415v470H175c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h618c35.3 0 64-28.7 64-64V306c0-35.3-28.7-64-64-64z')); exports.RightOutline = getIcon('right', outline, getNode(newViewBox, 'M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z')); exports.ScanOutline = getIcon('scan', outline, getNode(newViewBox, 'M136 384h56c4.4 0 8-3.6 8-8V200h176c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H196c-37.6 0-68 30.4-68 68v180c0 4.4 3.6 8 8 8zm512-184h176v176c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V196c0-37.6-30.4-68-68-68H648c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zM376 824H200V648c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v180c0 37.6 30.4 68 68 68h180c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm512-184h-56c-4.4 0-8 3.6-8 8v176H648c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h180c37.6 0 68-30.4 68-68V648c0-4.4-3.6-8-8-8zm16-164H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.SafetyOutline = getIcon('safety', outline, getNode(normalViewBox, 'M512 64L128 192v384c0 212.1 171.9 384 384 384s384-171.9 384-384V192L512 64zm312 512c0 172.3-139.7 312-312 312S200 748.3 200 576V246l312-110 312 110v330z', 'M378.4 475.1a35.91 35.91 0 0 0-50.9 0 35.91 35.91 0 0 0 0 50.9l129.4 129.4 2.1 2.1a33.98 33.98 0 0 0 48.1 0L730.6 434a33.98 33.98 0 0 0 0-48.1l-2.8-2.8a33.98 33.98 0 0 0-48.1 0L483 579.7 378.4 475.1z')); exports.ScissorOutline = getIcon('scissor', outline, getNode(newViewBox, 'M567.1 512l318.5-319.3c5-5 1.5-13.7-5.6-13.7h-90.5c-2.1 0-4.2.8-5.6 2.3l-273.3 274-90.2-90.5c12.5-22.1 19.7-47.6 19.7-74.8 0-83.9-68.1-152-152-152s-152 68.1-152 152 68.1 152 152 152c27.7 0 53.6-7.4 75.9-20.3l90 90.3-90.1 90.3A151.04 151.04 0 0 0 288 582c-83.9 0-152 68.1-152 152s68.1 152 152 152 152-68.1 152-152c0-27.2-7.2-52.7-19.7-74.8l90.2-90.5 273.3 274c1.5 1.5 3.5 2.3 5.6 2.3H880c7.1 0 10.7-8.6 5.6-13.7L567.1 512zM288 370c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80zm0 444c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z')); exports.SearchOutline = getIcon('search', outline, getNode(newViewBox, 'M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0 0 11.6 0l43.6-43.5a8.2 8.2 0 0 0 0-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z')); exports.ShakeOutline = getIcon('shake', outline, getNode(newViewBox, 'M324 666a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm616.7-309.6L667.6 83.2C655.2 70.9 638.7 64 621.1 64s-34.1 6.8-46.5 19.2L83.3 574.5a65.85 65.85 0 0 0 0 93.1l273.2 273.2c12.3 12.3 28.9 19.2 46.5 19.2s34.1-6.8 46.5-19.2l491.3-491.3c25.6-25.7 25.6-67.5-.1-93.1zM403 880.1L143.9 621l477.2-477.2 259 259.2L403 880.1zM152.8 373.7a7.9 7.9 0 0 0 11.2 0L373.7 164a7.9 7.9 0 0 0 0-11.2l-38.4-38.4a7.9 7.9 0 0 0-11.2 0L114.3 323.9a7.9 7.9 0 0 0 0 11.2l38.5 38.6zm718.6 276.6a7.9 7.9 0 0 0-11.2 0L650.3 860.1a7.9 7.9 0 0 0 0 11.2l38.4 38.4a7.9 7.9 0 0 0 11.2 0L909.7 700a7.9 7.9 0 0 0 0-11.2l-38.3-38.5z')); exports.ShareAltOutline = getIcon('share-alt', outline, getNode(newViewBox, 'M752 664c-28.5 0-54.8 10-75.4 26.7L469.4 540.8a160.68 160.68 0 0 0 0-57.6l207.2-149.9C697.2 350 723.5 360 752 360c66.2 0 120-53.8 120-120s-53.8-120-120-120-120 53.8-120 120c0 11.6 1.6 22.7 4.7 33.3L439.9 415.8C410.7 377.1 364.3 352 312 352c-88.4 0-160 71.6-160 160s71.6 160 160 160c52.3 0 98.7-25.1 127.9-63.8l196.8 142.5c-3.1 10.6-4.7 21.8-4.7 33.3 0 66.2 53.8 120 120 120s120-53.8 120-120-53.8-120-120-120zm0-476c28.7 0 52 23.3 52 52s-23.3 52-52 52-52-23.3-52-52 23.3-52 52-52zM312 600c-48.5 0-88-39.5-88-88s39.5-88 88-88 88 39.5 88 88-39.5 88-88 88zm440 236c-28.7 0-52-23.3-52-52s23.3-52 52-52 52 23.3 52 52-23.3 52-52 52z')); exports.SelectOutline = getIcon('select', outline, getNode(newViewBox, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h360c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H184V184h656v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32zM653.3 599.4l52.2-52.2a8.01 8.01 0 0 0-4.7-13.6l-179.4-21c-5.1-.6-9.5 3.7-8.9 8.9l21 179.4c.8 6.6 8.9 9.4 13.6 4.7l52.4-52.4 256.2 256.2c3.1 3.1 8.2 3.1 11.3 0l42.4-42.4c3.1-3.1 3.1-8.2 0-11.3L653.3 599.4z')); exports.ShrinkOutline = getIcon('shrink', outline, getNode(newViewBox, 'M881.7 187.4l-45.1-45.1a8.03 8.03 0 0 0-11.3 0L667.8 299.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L576.1 439c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 157.6-157.6c3-3 3-8.1-.1-11.2zM439 576.1l-189.2 23.5c-6.6.8-9.3 8.9-4.7 13.5l54.7 54.7-157.5 157.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l157.6-157.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L447.9 585a7.9 7.9 0 0 0-8.9-8.9z')); exports.ShoppingCartOutline = getIcon('shopping-cart', outline, getNode(normalViewBox, 'M922.9 701.9H327.4l29.9-60.9 496.8-.9c16.8 0 31.2-12 34.2-28.6l68.8-385.1c1.8-10.1-.9-20.5-7.5-28.4a34.99 34.99 0 0 0-26.6-12.5l-632-2.1-5.4-25.4c-3.4-16.2-18-28-34.6-28H96.5a35.3 35.3 0 1 0 0 70.6h125.9L246 312.8l58.1 281.3-74.8 122.1a34.96 34.96 0 0 0-3 36.8c6 11.9 18.1 19.4 31.5 19.4h62.8a102.43 102.43 0 0 0-20.6 61.7c0 56.6 46 102.6 102.6 102.6s102.6-46 102.6-102.6c0-22.3-7.4-44-20.6-61.7h161.1a102.43 102.43 0 0 0-20.6 61.7c0 56.6 46 102.6 102.6 102.6s102.6-46 102.6-102.6c0-22.3-7.4-44-20.6-61.7H923c19.4 0 35.3-15.8 35.3-35.3a35.42 35.42 0 0 0-35.4-35.2zM305.7 253l575.8 1.9-56.4 315.8-452.3.8L305.7 253zm96.9 612.7c-17.4 0-31.6-14.2-31.6-31.6 0-17.4 14.2-31.6 31.6-31.6s31.6 14.2 31.6 31.6a31.6 31.6 0 0 1-31.6 31.6zm325.1 0c-17.4 0-31.6-14.2-31.6-31.6 0-17.4 14.2-31.6 31.6-31.6s31.6 14.2 31.6 31.6a31.6 31.6 0 0 1-31.6 31.6z')); exports.SketchOutline = getIcon('sketch', outline, getNode(newViewBox, 'M925.6 405.1l-203-253.7a6.5 6.5 0 0 0-5-2.4H306.4c-1.9 0-3.8.9-5 2.4l-203 253.7a6.5 6.5 0 0 0 .2 8.3l408.6 459.5c1.2 1.4 3 2.1 4.8 2.1 1.8 0 3.5-.8 4.8-2.1l408.6-459.5a6.5 6.5 0 0 0 .2-8.3zM645.2 206.4l34.4 133.9-132.5-133.9h98.1zm8.2 178.5H370.6L512 242l141.4 142.9zM378.8 206.4h98.1L344.3 340.3l34.5-133.9zm-53.4 7l-44.1 171.5h-93.1l137.2-171.5zM194.6 434.9H289l125.8 247.7-220.2-247.7zM512 763.4L345.1 434.9h333.7L512 763.4zm97.1-80.8L735 434.9h94.4L609.1 682.6zm133.6-297.7l-44.1-171.5 137.2 171.5h-93.1z')); exports.SmallDashOutline = getIcon('small-dash', outline, getNode(newViewBox, 'M112 476h72v72h-72zm182 0h72v72h-72zm364 0h72v72h-72zm182 0h72v72h-72zm-364 0h72v72h-72z')); exports.SortAscendingOutline = getIcon('sort-ascending', outline, getNode(newViewBox, 'M839.6 433.8L749 150.5a9.24 9.24 0 0 0-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 0 0-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 0 0-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0 0 12.6 0l112-141.9c4.1-5.2.4-13-6.3-13z')); exports.SlackOutline = getIcon('slack', outline, getNode(newViewBox, 'M925.5 541.9a71.49 71.49 0 0 0-90.1-45.9l-80 26L703 360.9l80-26a71.49 71.49 0 0 0 45.9-90.1 71.49 71.49 0 0 0-90.1-45.9l-80 26-26.2-80.6a71.49 71.49 0 1 0-136 44.2l26.2 80.6-161.1 52.4-26.2-80.6a71.49 71.49 0 1 0-136 44.2l26.2 80.6-81.1 26.4a71.49 71.49 0 0 0-45.9 90.1 71.49 71.49 0 0 0 90.1 45.9l81.1-26.4 52.4 161.1-81.3 26.3a71.49 71.49 0 0 0-45.9 90.1 71.49 71.49 0 0 0 90.1 45.9l81.1-26.4 26.2 80.6a71.49 71.49 0 0 0 90.1 45.9 71.49 71.49 0 0 0 45.9-90.1l-26.2-80.6 161.1-52.4 26.2 80.6a71.49 71.49 0 0 0 90.1 45.9 71.49 71.49 0 0 0 45.9-90.1l-26-80.5 80-26c37.5-12.1 58.1-52.5 45.9-90.1zm-467.3 76.7l-52.4-161.1L567 405.1l52.4 161.1-161.2 52.4z')); exports.SolutionOutline = getIcon('solution', outline, getNode(newViewBox, 'M688 264c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48zm-8 136H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM480 544H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm-48 308H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h264c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm356.8-74.4c29-26.3 47.2-64.3 47.2-106.6 0-79.5-64.5-144-144-144s-144 64.5-144 144c0 42.3 18.2 80.3 47.2 106.6-57 32.5-96.2 92.7-99.2 162.1-.2 4.5 3.5 8.3 8 8.3h48.1c4.2 0 7.7-3.3 8-7.6C564 871.2 621.7 816 692 816s128 55.2 131.9 124.4c.2 4.2 3.7 7.6 8 7.6H880c4.6 0 8.2-3.8 8-8.3-2.9-69.5-42.2-129.6-99.2-162.1zM692 591c44.2 0 80 35.8 80 80s-35.8 80-80 80-80-35.8-80-80 35.8-80 80-80z')); exports.StockOutline = getIcon('stock', outline, getNode(newViewBox, 'M904 747H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM165.7 621.8l39.7 39.5c3.1 3.1 8.2 3.1 11.3 0l234.7-233.9 97.6 97.3a32.11 32.11 0 0 0 45.2 0l264.2-263.2c3.1-3.1 3.1-8.2 0-11.3l-39.7-39.6a8.03 8.03 0 0 0-11.3 0l-235.7 235-97.7-97.3a32.11 32.11 0 0 0-45.2 0L165.7 610.5a7.94 7.94 0 0 0 0 11.3z')); exports.SortDescendingOutline = getIcon('sort-descending', outline, getNode(newViewBox, 'M839.6 433.8L749 150.5a9.24 9.24 0 0 0-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 0 0-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 0 0-9.2-9.3zM310.3 167.1a8 8 0 0 0-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z')); exports.SwapRightOutline = getIcon('swap-right', outline, getNode(normalViewBox, 'M873.1 596.2l-164-208A32 32 0 0 0 684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z')); exports.SwapLeftOutline = getIcon('swap-left', outline, getNode(normalViewBox, 'M872 572H266.8l144.3-183c4.1-5.2.4-13-6.3-13H340c-9.8 0-19.1 4.5-25.1 12.2l-164 208c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z')); exports.SwapOutline = getIcon('swap', outline, getNode(newViewBox, 'M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z')); exports.StrikethroughOutline = getIcon('strikethrough', outline, getNode(newViewBox, 'M952 474H569.9c-10-2-20.5-4-31.6-6-15.9-2.9-22.2-4.1-30.8-5.8-51.3-10-82.2-20-106.8-34.2-35.1-20.5-52.2-48.3-52.2-85.1 0-37 15.2-67.7 44-89 28.4-21 68.8-32.1 116.8-32.1 54.8 0 97.1 14.4 125.8 42.8 14.6 14.4 25.3 32.1 31.8 52.6 1.3 4.1 2.8 10 4.3 17.8.9 4.8 5.2 8.2 9.9 8.2h72.8c5.6 0 10.1-4.6 10.1-10.1v-1c-.7-6.8-1.3-12.1-2-16-7.3-43.5-28-81.7-59.7-110.3-44.4-40.5-109.7-61.8-188.7-61.8-72.3 0-137.4 18.1-183.3 50.9-25.6 18.4-45.4 41.2-58.6 67.7-13.5 27.1-20.3 58.4-20.3 92.9 0 29.5 5.7 54.5 17.3 76.5 8.3 15.7 19.6 29.5 34.1 42H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h433.2c2.1.4 3.9.8 5.9 1.2 30.9 6.2 49.5 10.4 66.6 15.2 23 6.5 40.6 13.3 55.2 21.5 35.8 20.2 53.3 49.2 53.3 89 0 35.3-15.5 66.8-43.6 88.8-30.5 23.9-75.6 36.4-130.5 36.4-43.7 0-80.7-8.5-110.2-25-29.1-16.3-49.1-39.8-59.7-69.5-.8-2.2-1.7-5.2-2.7-9-1.2-4.4-5.3-7.5-9.7-7.5h-79.7c-5.6 0-10.1 4.6-10.1 10.1v1c.2 2.3.4 4.2.6 5.7 6.5 48.8 30.3 88.8 70.7 118.8 47.1 34.8 113.4 53.2 191.8 53.2 84.2 0 154.8-19.8 204.2-57.3 25-18.9 44.2-42.2 57.1-69 13-27.1 19.7-57.9 19.7-91.5 0-31.8-5.8-58.4-17.8-81.4-5.8-11.2-13.1-21.5-21.8-30.8H952c4.4 0 8-3.6 8-8v-60a8 8 0 0 0-8-7.9z')); exports.SyncOutline = getIcon('sync', outline, getNode(newViewBox, 'M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 0 1 755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 0 0 3 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 0 1 512.1 856a342.24 342.24 0 0 1-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 0 0-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 0 0-8-8.2z')); exports.TaobaoOutline = getIcon('taobao', outline, getNode(newViewBox, 'M168.5 273.7a68.7 68.7 0 1 0 137.4 0 68.7 68.7 0 1 0-137.4 0zm730 79.2s-23.7-184.4-426.9-70.1c17.3-30 25.6-49.5 25.6-49.5L396.4 205s-40.6 132.6-113 194.4c0 0 70.1 40.6 69.4 39.4 20.1-20.1 38.2-40.6 53.7-60.4 16.1-7 31.5-13.6 46.7-19.8-18.6 33.5-48.7 83.8-78.8 115.6l42.4 37s28.8-27.7 60.4-61.2h36v61.8H372.9v49.5h140.3v118.5c-1.7 0-3.6 0-5.4-.2-15.4-.7-39.5-3.3-49-18.2-11.5-18.1-3-51.5-2.4-71.9h-97l-3.4 1.8s-35.5 159.1 102.3 155.5c129.1 3.6 203-36 238.6-63.1l14.2 52.6 79.6-33.2-53.9-131.9-64.6 20.1 12.1 45.2c-16.6 12.4-35.6 21.7-56.2 28.4V561.3h137.1v-49.5H628.1V450h137.6v-49.5H521.3c17.6-21.4 31.5-41.1 35-53.6l-42.5-11.6c182.8-65.5 284.5-54.2 283.6 53.2v282.8s10.8 97.1-100.4 90.1l-60.2-12.9-14.2 57.1S882.5 880 903.7 680.2c21.3-200-5.2-327.3-5.2-327.3zm-707.4 18.3l-45.4 69.7 83.6 52.1s56 28.5 29.4 81.9C233.8 625.5 112 736.3 112 736.3l109 68.1c75.4-163.7 70.5-142 89.5-200.7 19.5-60.1 23.7-105.9-9.4-139.1-42.4-42.6-47-46.6-110-93.4z')); exports.TableOutline = getIcon('table', outline, getNode(newViewBox, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 208H676V232h212v136zm0 224H676V432h212v160zM412 432h200v160H412V432zm200-64H412V232h200v136zm-476 64h212v160H136V432zm0-200h212v136H136V232zm0 424h212v136H136V656zm276 0h200v136H412V656zm476 136H676V656h212v136z')); exports.ToTopOutline = getIcon('to-top', outline, getNode(newViewBox, 'M885 780H165c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM400 325.7h73.9V664c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V325.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 171a8 8 0 0 0-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13z')); exports.TeamOutline = getIcon('team', outline, getNode(newViewBox, 'M824.2 699.9a301.55 301.55 0 0 0-86.4-60.4C783.1 602.8 812 546.8 812 484c0-110.8-92.4-201.7-203.2-200-109.1 1.7-197 90.6-197 200 0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 0 0-86.4 60.4C345 754.6 314 826.8 312 903.8a8 8 0 0 0 8 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5A226.62 226.62 0 0 1 612 684c60.9 0 118.2 23.7 161.3 66.8C814.5 792 838 846.3 840 904.3c.1 4.3 3.7 7.7 8 7.7h56a8 8 0 0 0 8-8.2c-2-77-33-149.2-87.8-203.9zM612 612c-34.2 0-66.4-13.3-90.5-37.5a126.86 126.86 0 0 1-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4 0 34.2-13.3 66.3-37.5 90.5A127.3 127.3 0 0 1 612 612zM361.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 0 1-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 0 0 8 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7z')); exports.TrademarkOutline = getIcon('trademark', outline, getNode(newViewBox, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm87.5-334.7c34.8-12.8 78.4-49 78.4-119.2 0-71.2-45.5-131.1-144.2-131.1H378c-4.4 0-8 3.6-8 8v410c0 4.4 3.6 8 8 8h54.5c4.4 0 8-3.6 8-8V561.2h88.7l74.6 159.2c1.3 2.8 4.1 4.6 7.2 4.6h62a7.9 7.9 0 0 0 7.1-11.5l-80.6-164.2zM522 505h-81.5V357h83.4c48 0 80.9 25.3 80.9 75.5 0 46.9-29.8 72.5-82.8 72.5z')); exports.TransactionOutline = getIcon('transaction', outline, getNode(newViewBox, 'M668.6 320c0-4.4-3.6-8-8-8h-54.5c-3 0-5.8 1.7-7.1 4.4l-84.7 168.8H511l-84.7-168.8a8 8 0 0 0-7.1-4.4h-55.7c-1.3 0-2.6.3-3.8 1-3.9 2.1-5.3 7-3.2 10.8l103.9 191.6h-57c-4.4 0-8 3.6-8 8v27.1c0 4.4 3.6 8 8 8h76v39h-76c-4.4 0-8 3.6-8 8v27.1c0 4.4 3.6 8 8 8h76V704c0 4.4 3.6 8 8 8h49.9c4.4 0 8-3.6 8-8v-63.5h76.3c4.4 0 8-3.6 8-8v-27.1c0-4.4-3.6-8-8-8h-76.3v-39h76.3c4.4 0 8-3.6 8-8v-27.1c0-4.4-3.6-8-8-8H564l103.7-191.6c.5-1.1.9-2.4.9-3.7zM157.9 504.2a352.7 352.7 0 0 1 103.5-242.4c32.5-32.5 70.3-58.1 112.4-75.9 43.6-18.4 89.9-27.8 137.6-27.8 47.8 0 94.1 9.3 137.6 27.8 42.1 17.8 79.9 43.4 112.4 75.9 10 10 19.3 20.5 27.9 31.4l-50 39.1a8 8 0 0 0 3 14.1l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3l-47.8 37.4C770.7 146.3 648.6 82 511.5 82 277 82 86.3 270.1 82 503.8a8 8 0 0 0 8 8.2h60c4.3 0 7.8-3.5 7.9-7.8zM934 512h-60c-4.3 0-7.9 3.5-8 7.8a352.7 352.7 0 0 1-103.5 242.4 352.57 352.57 0 0 1-112.4 75.9c-43.6 18.4-89.9 27.8-137.6 27.8s-94.1-9.3-137.6-27.8a352.57 352.57 0 0 1-112.4-75.9c-10-10-19.3-20.5-27.9-31.4l49.9-39.1a8 8 0 0 0-3-14.1l-156.8-38.3c-5-1.2-9.9 2.6-9.9 7.7l-.8 161.7c0 6.7 7.7 10.5 12.9 6.3l47.8-37.4C253.3 877.7 375.4 942 512.5 942 747 942 937.7 753.9 942 520.2a8 8 0 0 0-8-8.2z')); exports.TwitterOutline = getIcon('twitter', outline, getNode(newViewBox, 'M928 254.3c-30.6 13.2-63.9 22.7-98.2 26.4a170.1 170.1 0 0 0 75-94 336.64 336.64 0 0 1-108.2 41.2A170.1 170.1 0 0 0 672 174c-94.5 0-170.5 76.6-170.5 170.6 0 13.2 1.6 26.4 4.2 39.1-141.5-7.4-267.7-75-351.6-178.5a169.32 169.32 0 0 0-23.2 86.1c0 59.2 30.1 111.4 76 142.1a172 172 0 0 1-77.1-21.7v2.1c0 82.9 58.6 151.6 136.7 167.4a180.6 180.6 0 0 1-44.9 5.8c-11.1 0-21.6-1.1-32.2-2.6C211 652 273.9 701.1 348.8 702.7c-58.6 45.9-132 72.9-211.7 72.9-14.3 0-27.5-.5-41.2-2.1C171.5 822 261.2 850 357.8 850 671.4 850 843 590.2 843 364.7c0-7.4 0-14.8-.5-22.2 33.2-24.3 62.3-54.4 85.5-88.2z')); exports.UndoOutline = getIcon('undo', outline, getNode(newViewBox, 'M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 0 0-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 0 0-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z')); exports.UnderlineOutline = getIcon('underline', outline, getNode(newViewBox, 'M824 804H200c-4.4 0-8 3.4-8 7.6v60.8c0 4.2 3.6 7.6 8 7.6h624c4.4 0 8-3.4 8-7.6v-60.8c0-4.2-3.6-7.6-8-7.6zm-312-76c69.4 0 134.6-27.1 183.8-76.2C745 602.7 772 537.4 772 468V156c0-6.6-5.4-12-12-12h-60c-6.6 0-12 5.4-12 12v312c0 97-79 176-176 176s-176-79-176-176V156c0-6.6-5.4-12-12-12h-60c-6.6 0-12 5.4-12 12v312c0 69.4 27.1 134.6 76.2 183.8C377.3 701 442.6 728 512 728z')); exports.UpOutline = getIcon('up', outline, getNode(newViewBox, 'M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 0 0 140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z')); exports.UserAddOutline = getIcon('user-add', outline, getNode(newViewBox, 'M678.3 642.4c24.2-13 51.9-20.4 81.4-20.4h.1c3 0 4.4-3.6 2.2-5.6a371.67 371.67 0 0 0-103.7-65.8c-.4-.2-.8-.3-1.2-.5C719.2 505 759.6 431.7 759.6 349c0-137-110.8-248-247.5-248S264.7 212 264.7 349c0 82.7 40.4 156 102.6 201.1-.4.2-.8.3-1.2.5-44.7 18.9-84.8 46-119.3 80.6a373.42 373.42 0 0 0-80.4 119.5A373.6 373.6 0 0 0 137 888.8a8 8 0 0 0 8 8.2h59.9c4.3 0 7.9-3.5 8-7.8 2-77.2 32.9-149.5 87.6-204.3C357 628.2 432.2 597 512.2 597c56.7 0 111.1 15.7 158 45.1a8.1 8.1 0 0 0 8.1.3zM512.2 521c-45.8 0-88.9-17.9-121.4-50.4A171.2 171.2 0 0 1 340.5 349c0-45.9 17.9-89.1 50.3-121.6S466.3 177 512.2 177s88.9 17.9 121.4 50.4A171.2 171.2 0 0 1 683.9 349c0 45.9-17.9 89.1-50.3 121.6C601.1 503.1 558 521 512.2 521zM880 759h-84v-84c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v84h-84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h84v84c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-84h84c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.UnorderedListOutline = getIcon('unordered-list', outline, getNode(newViewBox, 'M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z')); exports.UserOutline = getIcon('user', outline, getNode(newViewBox, 'M858.5 763.6a374 374 0 0 0-80.6-119.5 375.63 375.63 0 0 0-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 0 0-80.6 119.5A371.7 371.7 0 0 0 136 901.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 0 0 8-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z')); exports.UploadOutline = getIcon('upload', outline, getNode(newViewBox, 'M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 0 0-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z')); exports.UserDeleteOutline = getIcon('user-delete', outline, getNode(newViewBox, 'M678.3 655.4c24.2-13 51.9-20.4 81.4-20.4h.1c3 0 4.4-3.6 2.2-5.6a371.67 371.67 0 0 0-103.7-65.8c-.4-.2-.8-.3-1.2-.5C719.2 518 759.6 444.7 759.6 362c0-137-110.8-248-247.5-248S264.7 225 264.7 362c0 82.7 40.4 156 102.6 201.1-.4.2-.8.3-1.2.5-44.7 18.9-84.8 46-119.3 80.6a373.42 373.42 0 0 0-80.4 119.5A373.6 373.6 0 0 0 137 901.8a8 8 0 0 0 8 8.2h59.9c4.3 0 7.9-3.5 8-7.8 2-77.2 32.9-149.5 87.6-204.3C357 641.2 432.2 610 512.2 610c56.7 0 111.1 15.7 158 45.1a8.1 8.1 0 0 0 8.1.3zM512.2 534c-45.8 0-88.9-17.9-121.4-50.4A171.2 171.2 0 0 1 340.5 362c0-45.9 17.9-89.1 50.3-121.6S466.3 190 512.2 190s88.9 17.9 121.4 50.4A171.2 171.2 0 0 1 683.9 362c0 45.9-17.9 89.1-50.3 121.6C601.1 516.1 558 534 512.2 534zM880 772H640c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h240c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z')); exports.UsergroupAddOutline = getIcon('usergroup-add', outline, getNode(newViewBox, 'M892 772h-80v-80c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v80h-80c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h80v80c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-80h80c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM373.5 498.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 0 1-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.8-1.7-203.2 89.2-203.2 200 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 0 0 8 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.8-1.1 6.4-4.8 5.9-8.8zM824 472c0-109.4-87.9-198.3-196.9-200C516.3 270.3 424 361.2 424 472c0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 0 0-86.4 60.4C357 742.6 326 814.8 324 891.8a8 8 0 0 0 8 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5C505.8 695.7 563 672 624 672c110.4 0 200-89.5 200-200zm-109.5 90.5C690.3 586.7 658.2 600 624 600s-66.3-13.3-90.5-37.5a127.26 127.26 0 0 1-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4-.1 34.2-13.4 66.3-37.6 90.5z')); exports.UsergroupDeleteOutline = getIcon('usergroup-delete', outline, getNode(newViewBox, 'M888 784H664c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h224c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM373.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 0 1-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 0 0 8 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7zM824 484c0-109.4-87.9-198.3-196.9-200C516.3 282.3 424 373.2 424 484c0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 0 0-86.4 60.4C357 754.6 326 826.8 324 903.8a8 8 0 0 0 8 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5C505.8 707.7 563 684 624 684c110.4 0 200-89.5 200-200zm-109.5 90.5C690.3 598.7 658.2 612 624 612s-66.3-13.3-90.5-37.5a127.26 127.26 0 0 1-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4-.1 34.2-13.4 66.3-37.6 90.5z')); exports.VerticalAlignMiddleOutline = getIcon('vertical-align-middle', outline, getNode(newViewBox, 'M859.9 474H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zm-353.6-74.7c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H550V104c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v156h-62.8c-6 0-9.4 7-5.7 11.7l100.8 127.6zm11.4 225.4a7.14 7.14 0 0 0-11.3 0L405.6 752.3a7.23 7.23 0 0 0 5.7 11.7H474v156c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V764h62.8c6 0 9.4-7 5.7-11.7L517.7 624.7z')); exports.VerticalAlignBottomOutline = getIcon('vertical-align-bottom', outline, getNode(newViewBox, 'M859.9 780H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM505.7 669a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V176c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8z')); exports.VerticalLeftOutline = getIcon('vertical-left', outline, getNode(newViewBox, 'M762 164h-64c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V172c0-4.4-3.6-8-8-8zm-508 0v72.4c0 9.5 4.2 18.4 11.4 24.5L564.6 512 265.4 763.1c-7.2 6.1-11.4 15-11.4 24.5V860c0 6.8 7.9 10.5 13.1 6.1L689 512 267.1 157.9A7.95 7.95 0 0 0 254 164z')); exports.VerticalRightOutline = getIcon('vertical-right', outline, getNode(newViewBox, 'M326 164h-64c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V172c0-4.4-3.6-8-8-8zm444 72.4V164c0-6.8-7.9-10.5-13.1-6.1L335 512l421.9 354.1c5.2 4.4 13.1.7 13.1-6.1v-72.4c0-9.4-4.2-18.4-11.4-24.5L459.4 512l299.2-251.1c7.2-6.1 11.4-15.1 11.4-24.5z')); exports.VerticalAlignTopOutline = getIcon('vertical-align-top', outline, getNode(newViewBox, 'M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 0 0-12.6 0l-112 141.7a7.98 7.98 0 0 0 6.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z')); exports.WifiOutline = getIcon('wifi', outline, getNode(newViewBox, 'M723 620.5C666.8 571.6 593.4 542 513 542s-153.8 29.6-210.1 78.6a8.1 8.1 0 0 0-.8 11.2l36 42.9c2.9 3.4 8 3.8 11.4.9C393.1 637.2 450.3 614 513 614s119.9 23.2 163.5 61.5c3.4 2.9 8.5 2.5 11.4-.9l36-42.9c2.8-3.3 2.4-8.3-.9-11.2zm117.4-140.1C751.7 406.5 637.6 362 513 362s-238.7 44.5-327.5 118.4a8.05 8.05 0 0 0-1 11.3l36 42.9c2.8 3.4 7.9 3.8 11.2 1C308 472.2 406.1 434 513 434s205 38.2 281.2 101.6c3.4 2.8 8.4 2.4 11.2-1l36-42.9c2.8-3.4 2.4-8.5-1-11.3zm116.7-139C835.7 241.8 680.3 182 511 182c-168.2 0-322.6 59-443.7 157.4a8 8 0 0 0-1.1 11.4l36 42.9c2.8 3.3 7.8 3.8 11.1 1.1C222 306.7 360.3 254 511 254c151.8 0 291 53.5 400 142.7 3.4 2.8 8.4 2.3 11.2-1.1l36-42.9c2.9-3.4 2.4-8.5-1.1-11.3zM448 778a64 64 0 1 0 128 0 64 64 0 1 0-128 0z')); exports.WomanOutline = getIcon('woman', outline, getNode(newViewBox, 'M712.8 548.8c53.6-53.6 83.2-125 83.2-200.8 0-75.9-29.5-147.2-83.2-200.8C659.2 93.6 587.8 64 512 64s-147.2 29.5-200.8 83.2C257.6 200.9 228 272.1 228 348c0 63.8 20.9 124.4 59.4 173.9 7.3 9.4 15.2 18.3 23.7 26.9 8.5 8.5 17.5 16.4 26.8 23.7 39.6 30.8 86.3 50.4 136.1 57V736H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h114v140c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V812h114c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H550V629.5c61.5-8.2 118.2-36.1 162.8-80.7zM512 556c-55.6 0-107.7-21.6-147.1-60.9C325.6 455.8 304 403.6 304 348s21.6-107.7 60.9-147.1C404.2 161.5 456.4 140 512 140s107.7 21.6 147.1 60.9C698.4 240.2 720 292.4 720 348s-21.6 107.7-60.9 147.1C619.7 534.4 567.6 556 512 556z')); exports.WeiboOutline = getIcon('weibo', outline, getNode(newViewBox, 'M457.3 543c-68.1-17.7-145 16.2-174.6 76.2-30.1 61.2-1 129.1 67.8 151.3 71.2 23 155.2-12.2 184.4-78.3 28.7-64.6-7.2-131-77.6-149.2zm-52 156.2c-13.8 22.1-43.5 31.7-65.8 21.6-22-10-28.5-35.7-14.6-57.2 13.7-21.4 42.3-31 64.4-21.7 22.4 9.5 29.6 35 16 57.3zm45.5-58.5c-5 8.6-16.1 12.7-24.7 9.1-8.5-3.5-11.2-13.1-6.4-21.5 5-8.4 15.6-12.4 24.1-9.1 8.7 3.2 11.8 12.9 7 21.5zm334.5-197.2c15 4.8 31-3.4 35.9-18.3 11.8-36.6 4.4-78.4-23.2-109a111.39 111.39 0 0 0-106-34.3 28.45 28.45 0 0 0-21.9 33.8 28.39 28.39 0 0 0 33.8 21.8c18.4-3.9 38.3 1.8 51.9 16.7a54.2 54.2 0 0 1 11.3 53.3 28.45 28.45 0 0 0 18.2 36zm99.8-206c-56.7-62.9-140.4-86.9-217.7-70.5a32.98 32.98 0 0 0-25.4 39.3 33.12 33.12 0 0 0 39.3 25.5c55-11.7 114.4 5.4 154.8 50.1 40.3 44.7 51.2 105.7 34 159.1-5.6 17.4 3.9 36 21.3 41.7 17.4 5.6 36-3.9 41.6-21.2v-.1c24.1-75.4 8.9-161.1-47.9-223.9zM729 499c-12.2-3.6-20.5-6.1-14.1-22.1 13.8-34.7 15.2-64.7.3-86-28-40.1-104.8-37.9-192.8-1.1 0 0-27.6 12.1-20.6-9.8 13.5-43.5 11.5-79.9-9.6-101-47.7-47.8-174.6 1.8-283.5 110.6C127.3 471.1 80 557.5 80 632.2 80 775.1 263.2 862 442.5 862c235 0 391.3-136.5 391.3-245 0-65.5-55.2-102.6-104.8-118zM443 810.8c-143 14.1-266.5-50.5-275.8-144.5-9.3-93.9 99.2-181.5 242.2-195.6 143-14.2 266.5 50.5 275.8 144.4C694.4 709 586 796.6 443 810.8z')); exports.ZoomInOutline = getIcon('zoom-in', outline, getNode(newViewBox, 'M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z')); exports.ZoomOutOutline = getIcon('zoom-out', outline, getNode(newViewBox, 'M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z')); exports.ZhihuOutline = getIcon('zhihu', outline, getNode(newViewBox, 'M564.7 230.1V803h60l25.2 71.4L756.3 803h131.5V230.1H564.7zm247.7 497h-59.9l-75.1 50.4-17.8-50.4h-18V308.3h170.7v418.8zM526.1 486.9H393.3c2.1-44.9 4.3-104.3 6.6-172.9h130.9l-.1-8.1c0-.6-.2-14.7-2.3-29.1-2.1-15-6.6-34.9-21-34.9H287.8c4.4-20.6 15.7-69.7 29.4-93.8l6.4-11.2-12.9-.7c-.8 0-19.6-.9-41.4 10.6-35.7 19-51.7 56.4-58.7 84.4-18.4 73.1-44.6 123.9-55.7 145.6-3.3 6.4-5.3 10.2-6.2 12.8-1.8 4.9-.8 9.8 2.8 13 10.5 9.5 38.2-2.9 38.5-3 .6-.3 1.3-.6 2.2-1 13.9-6.3 55.1-25 69.8-84.5h56.7c.7 32.2 3.1 138.4 2.9 172.9h-141l-2.1 1.5c-23.1 16.9-30.5 63.2-30.8 65.2l-1.4 9.2h167c-12.3 78.3-26.5 113.4-34 127.4-3.7 7-7.3 14-10.7 20.8-21.3 42.2-43.4 85.8-126.3 153.6-3.6 2.8-7 8-4.8 13.7 2.4 6.3 9.3 9.1 24.6 9.1 5.4 0 11.8-.3 19.4-1 49.9-4.4 100.8-18 135.1-87.6 17-35.1 31.7-71.7 43.9-108.9L497 850l5-12c.8-1.9 19-46.3 5.1-95.9l-.5-1.8-108.1-123-22 16.6c6.4-26.1 10.6-49.9 12.5-71.1h158.7v-8c0-40.1-18.5-63.9-19.2-64.9l-2.4-3z')); exports.AlertTwoTone = getIcon('alert', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M340 585c0-5.5 4.5-10 10-10h44c5.5 0 10 4.5 10 10v171h355V563c0-136.4-110.6-247-247-247S265 426.6 265 563v193h75V585z' ], [ primaryColor, 'M216.9 310.5l39.6-39.6c3.1-3.1 3.1-8.2 0-11.3l-67.9-67.9a8.03 8.03 0 0 0-11.3 0l-39.6 39.6a8.03 8.03 0 0 0 0 11.3l67.9 67.9c3.1 3.1 8.1 3.1 11.3 0zm669.6-79.2l-39.6-39.6a8.03 8.03 0 0 0-11.3 0l-67.9 67.9a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l67.9-67.9c3.1-3.2 3.1-8.2 0-11.3zM484 180h56c4.4 0 8-3.6 8-8V76c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v96c0 4.4 3.6 8 8 8zm348 712H192c-17.7 0-32 14.3-32 32v24c0 4.4 3.6 8 8 8h688c4.4 0 8-3.6 8-8v-24c0-17.7-14.3-32-32-32zm-639-96c0 17.7 14.3 32 32 32h574c17.7 0 32-14.3 32-32V563c0-176.2-142.8-319-319-319S193 386.8 193 563v233zm72-233c0-136.4 110.6-247 247-247s247 110.6 247 247v193H404V585c0-5.5-4.5-10-10-10h-44c-5.5 0-10 4.5-10 10v171h-75V563z' ]); }); exports.ApiTwoTone = getIcon('api', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M148.2 674.6zm106.7-92.3c-25 25-38.7 58.1-38.7 93.4s13.8 68.5 38.7 93.4c25 25 58.1 38.7 93.4 38.7 35.3 0 68.5-13.8 93.4-38.7l59.4-59.4-186.8-186.8-59.4 59.4zm420.8-366.1c-35.3 0-68.5 13.8-93.4 38.7l-59.4 59.4 186.8 186.8 59.4-59.4c24.9-25 38.7-58.1 38.7-93.4s-13.8-68.5-38.7-93.4c-25-25-58.1-38.7-93.4-38.7z' ], [ primaryColor, 'M578.9 546.7a8.03 8.03 0 0 0-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 0 0-11.3 0L363 475.3l-43-43a7.85 7.85 0 0 0-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2a199.45 199.45 0 0 0-58.6 140.4c-.2 39.5 11.2 79.1 34.3 113.1l-76.1 76.1a8.03 8.03 0 0 0 0 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 0 1-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7-24.9-24.9-38.7-58.1-38.7-93.4s13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4zm476-620.3l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 0 0-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 0 0 0 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7s68.4 13.7 93.4 38.7c24.9 24.9 38.7 58.1 38.7 93.4s-13.8 68.4-38.7 93.4z' ]); }); exports.AccountBookTwoTone = getIcon('account-book', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M712 304c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-48H384v48c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-48H184v584h656V256H712v48zm-65.6 121.8l-89.3 164.1h49.1c4.4 0 8 3.6 8 8v21.3c0 4.4-3.6 8-8 8h-65.4v33.7h65.4c4.4 0 8 3.6 8 8v21.3c0 4.4-3.6 8-8 8h-65.4V752c0 4.4-3.6 8-8 8h-41.3c-4.4 0-8-3.6-8-8v-53.8h-65.1c-4.4 0-8-3.6-8-8v-21.3c0-4.4 3.6-8 8-8h65.1v-33.7h-65.1c-4.4 0-8-3.6-8-8v-21.3c0-4.4 3.6-8 8-8H467l-89.3-164c-2.1-3.9-.7-8.8 3.2-10.9 1.1-.7 2.5-1 3.8-1h46a8 8 0 0 1 7.1 4.4l73.4 145.4h2.8l73.4-145.4c1.3-2.7 4.1-4.4 7.1-4.4h45c4.5 0 8 3.6 7.9 8 0 1.3-.4 2.6-1 3.8z' ], [ primaryColor, 'M639.5 414h-45c-3 0-5.8 1.7-7.1 4.4L514 563.8h-2.8l-73.4-145.4a8 8 0 0 0-7.1-4.4h-46c-1.3 0-2.7.3-3.8 1-3.9 2.1-5.3 7-3.2 10.9l89.3 164h-48.6c-4.4 0-8 3.6-8 8v21.3c0 4.4 3.6 8 8 8h65.1v33.7h-65.1c-4.4 0-8 3.6-8 8v21.3c0 4.4 3.6 8 8 8h65.1V752c0 4.4 3.6 8 8 8h41.3c4.4 0 8-3.6 8-8v-53.8h65.4c4.4 0 8-3.6 8-8v-21.3c0-4.4-3.6-8-8-8h-65.4v-33.7h65.4c4.4 0 8-3.6 8-8v-21.3c0-4.4-3.6-8-8-8h-49.1l89.3-164.1c.6-1.2 1-2.5 1-3.8.1-4.4-3.4-8-7.9-8z' ], [ primaryColor, 'M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v584z' ]); }); exports.AudioTwoTone = getIcon('audio', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 552c54.3 0 98-43.2 98-96V232c0-52.8-43.7-96-98-96s-98 43.2-98 96v224c0 52.8 43.7 96 98 96z' ], [ primaryColor, 'M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1z' ], [ primaryColor, 'M512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-98-392c0-52.8 43.7-96 98-96s98 43.2 98 96v224c0 52.8-43.7 96-98 96s-98-43.2-98-96V232z' ]); }); exports.AppstoreTwoTone = getIcon('appstore', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M864 144H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm52-668H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452 132H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z' ], [ secondaryColor, 'M212 212h200v200H212zm400 0h200v200H612zM212 612h200v200H212zm400 0h200v200H612z' ]); }); exports.BankTwoTone = getIcon('bank', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M240.9 393.9h542.2L512 196.7z'], [ primaryColor, 'M894 462c30.9 0 43.8-39.7 18.7-58L530.8 126.2a31.81 31.81 0 0 0-37.6 0L111.3 404c-25.1 18.2-12.2 58 18.8 58H192v374h-72c-4.4 0-8 3.6-8 8v52c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-52c0-4.4-3.6-8-8-8h-72V462h62zM381 836H264V462h117v374zm189 0H453V462h117v374zm190 0H642V462h118v374zM240.9 393.9L512 196.7l271.1 197.2H240.9z' ]); }); exports.BellTwoTone = getIcon('bell', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 220c-55.6 0-107.8 21.6-147.1 60.9S304 372.4 304 428v340h416V428c0-55.6-21.6-107.8-60.9-147.1S567.6 220 512 220zm280 208c0-141.1-104.3-257.8-240-277.2v.1c135.7 19.4 240 136 240 277.1zM472 150.9v-.1C336.3 170.2 232 286.9 232 428c0-141.1 104.3-257.7 240-277.1z' ], [ primaryColor, 'M816 768h-24V428c0-141.1-104.3-257.7-240-277.1V112c0-22.1-17.9-40-40-40s-40 17.9-40 40v38.9c-135.7 19.4-240 136-240 277.1v340h-24c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h216c0 61.8 50.2 112 112 112s112-50.2 112-112h216c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM512 888c-26.5 0-48-21.5-48-48h96c0 26.5-21.5 48-48 48zm208-120H304V428c0-55.6 21.6-107.8 60.9-147.1S456.4 220 512 220c55.6 0 107.8 21.6 147.1 60.9S720 372.4 720 428v340z' ]); }); exports.BookTwoTone = getIcon('book', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zM232 888V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0 0 22.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752H232z' ], [secondaryColor, 'M668 345.9V136h-96v211.4l49.5-35.4z'], [ secondaryColor, 'M727.9 136v296.5c0 8.8-7.2 16-16 16-3.4 0-6.7-1.1-9.4-3.1L621.1 386l-83.8 59.9a15.9 15.9 0 0 1-22.3-3.7c-2-2.7-3-6-3-9.3V136H232v752h559.9V136h-64z' ]); }); exports.BuildTwoTone = getIcon('build', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M144 546h200v200H144zm268-268h200v200H412z'], [ primaryColor, 'M916 210H376c-17.7 0-32 14.3-32 32v236H108c-17.7 0-32 14.3-32 32v272c0 17.7 14.3 32 32 32h540c17.7 0 32-14.3 32-32V546h236c17.7 0 32-14.3 32-32V242c0-17.7-14.3-32-32-32zM344 746H144V546h200v200zm268 0H412V546h200v200zm0-268H412V278h200v200zm268 0H680V278h200v200z' ]); }); exports.BoxPlotTwoTone = getIcon('box-plot', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M296 368h88v288h-88zm152 0h280v288H448z'], [ primaryColor, 'M952 224h-52c-4.4 0-8 3.6-8 8v248h-92V304c0-4.4-3.6-8-8-8H232c-4.4 0-8 3.6-8 8v176h-92V232c0-4.4-3.6-8-8-8H72c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V548h92v172c0 4.4 3.6 8 8 8h560c4.4 0 8-3.6 8-8V548h92v244c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V232c0-4.4-3.6-8-8-8zM384 656h-88V368h88v288zm344 0H448V368h280v288z' ]); }); exports.BulbTwoTone = getIcon('bulb', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 136c-141.4 0-256 114.6-256 256 0 92.5 49.4 176.3 128.1 221.8l35.9 20.8V752h184V634.6l35.9-20.8C718.6 568.3 768 484.5 768 392c0-141.4-114.6-256-256-256z' ], [ primaryColor, 'M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z' ]); }); exports.CameraTwoTone = getIcon('camera', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M864 320H677.2l-17.1-47.8-22.9-64.2H386.7l-22.9 64.2-17.1 47.8H160c-4.4 0-8 3.6-8 8v456c0 4.4 3.6 8 8 8h704c4.4 0 8-3.6 8-8V328c0-4.4-3.6-8-8-8zM512 704c-88.4 0-160-71.6-160-160s71.6-160 160-160 160 71.6 160 160-71.6 160-160 160z' ], [ primaryColor, 'M512 384c-88.4 0-160 71.6-160 160s71.6 160 160 160 160-71.6 160-160-71.6-160-160-160zm0 256c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96z' ], [ primaryColor, 'M864 248H728l-32.4-90.8a32.07 32.07 0 0 0-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 248H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V328c0-44.2-35.8-80-80-80zm8 536c0 4.4-3.6 8-8 8H160c-4.4 0-8-3.6-8-8V328c0-4.4 3.6-8 8-8h186.7l17.1-47.8 22.9-64.2h250.5l22.9 64.2 17.1 47.8H864c4.4 0 8 3.6 8 8v456z' ]); }); exports.CarryOutTwoTone = getIcon('carry-out', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v584z' ], [ secondaryColor, 'M712 304c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-48H384v48c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-48H184v584h656V256H712v48zm-17.5 128.8L481.9 725.5a16.1 16.1 0 0 1-26 0l-126.4-174c-3.8-5.3 0-12.7 6.5-12.7h55.2c5.2 0 10 2.5 13 6.6l64.7 89 150.9-207.8c3-4.1 7.9-6.6 13-6.6H688c6.5 0 10.3 7.4 6.5 12.8z' ], [ primaryColor, 'M688 420h-55.2c-5.1 0-10 2.5-13 6.6L468.9 634.4l-64.7-89c-3-4.1-7.8-6.6-13-6.6H336c-6.5 0-10.3 7.4-6.5 12.7l126.4 174a16.1 16.1 0 0 0 26 0l212.6-292.7c3.8-5.4 0-12.8-6.5-12.8z' ]); }); exports.CalculatorTwoTone = getIcon('calculator', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm256.2-75h-50.8c-2.2 0-4.5-1.1-5.9-2.9L348 718.6l-35.5 43.5a7.38 7.38 0 0 1-5.9 2.9h-50.8c-6.6 0-10.2-7.9-5.8-13.1l62.7-76.8-61.2-74.9c-4.3-5.2-.7-13.1 5.9-13.1h50.9c2.2 0 4.5 1.1 5.9 2.9l34 41.6 34-41.6c1.5-1.9 3.6-2.9 5.9-2.9h50.8c6.6 0 10.2 7.9 5.9 13.1L383.5 675l62.7 76.8c4.2 5.3.6 13.2-6 13.2zM576 335c0-2.2 1.4-4 3.2-4h193.5c1.9 0 3.3 1.8 3.3 4v48c0 2.2-1.4 4-3.2 4H579.2c-1.8 0-3.2-1.8-3.2-4v-48zm0 265c0-2.2 1.4-4 3.2-4h193.5c1.9 0 3.3 1.8 3.3 4v48c0 2.2-1.4 4-3.2 4H579.2c-1.8 0-3.2-1.8-3.2-4v-48zm0 104c0-2.2 1.4-4 3.2-4h193.5c1.9 0 3.3 1.8 3.3 4v48c0 2.2-1.4 4-3.2 4H579.2c-1.8 0-3.2-1.8-3.2-4v-48zM248 335c0-2.2 1.4-4 3.2-4H320v-68.8c0-1.8 1.8-3.2 4-3.2h48c2.2 0 4 1.4 4 3.2V331h68.7c1.9 0 3.3 1.8 3.3 4v48c0 2.2-1.4 4-3.2 4H376v68.7c0 1.9-1.8 3.3-4 3.3h-48c-2.2 0-4-1.4-4-3.2V387h-68.8c-1.8 0-3.2-1.8-3.2-4v-48z' ], [ primaryColor, 'M383.5 675l61.3-74.8c4.3-5.2.7-13.1-5.9-13.1h-50.8c-2.3 0-4.4 1-5.9 2.9l-34 41.6-34-41.6a7.69 7.69 0 0 0-5.9-2.9h-50.9c-6.6 0-10.2 7.9-5.9 13.1l61.2 74.9-62.7 76.8c-4.4 5.2-.8 13.1 5.8 13.1h50.8c2.3 0 4.4-1 5.9-2.9l35.5-43.5 35.5 43.5c1.4 1.8 3.7 2.9 5.9 2.9h50.8c6.6 0 10.2-7.9 6-13.2L383.5 675zM251.2 387H320v68.8c0 1.8 1.8 3.2 4 3.2h48c2.2 0 4-1.4 4-3.3V387h68.8c1.8 0 3.2-1.8 3.2-4v-48c0-2.2-1.4-4-3.3-4H376v-68.8c0-1.8-1.8-3.2-4-3.2h-48c-2.2 0-4 1.4-4 3.2V331h-68.8c-1.8 0-3.2 1.8-3.2 4v48c0 2.2 1.4 4 3.2 4zm328 369h193.6c1.8 0 3.2-1.8 3.2-4v-48c0-2.2-1.4-4-3.3-4H579.2c-1.8 0-3.2 1.8-3.2 4v48c0 2.2 1.4 4 3.2 4zm0-104h193.6c1.8 0 3.2-1.8 3.2-4v-48c0-2.2-1.4-4-3.3-4H579.2c-1.8 0-3.2 1.8-3.2 4v48c0 2.2 1.4 4 3.2 4zm0-265h193.6c1.8 0 3.2-1.8 3.2-4v-48c0-2.2-1.4-4-3.3-4H579.2c-1.8 0-3.2 1.8-3.2 4v48c0 2.2 1.4 4 3.2 4z' ]); }); exports.CarTwoTone = getIcon('car', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M199.6 474L184 517v237h656V517l-15.6-43H199.6zM264 621c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm388 75c0 4.4-3.6 8-8 8H380c-4.4 0-8-3.6-8-8v-84c0-4.4 3.6-8 8-8h40c4.4 0 8 3.6 8 8v36h168v-36c0-4.4 3.6-8 8-8h40c4.4 0 8 3.6 8 8v84zm108-75c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40z' ], [primaryColor, 'M720 581a40 40 0 1 0 80 0 40 40 0 1 0-80 0z'], [ primaryColor, 'M959 413.4L935.3 372a8 8 0 0 0-10.9-2.9l-50.7 29.6-78.3-216.2a63.9 63.9 0 0 0-60.9-44.4H301.2c-34.7 0-65.5 22.4-76.2 55.5l-74.6 205.2-50.8-29.6a8 8 0 0 0-10.9 2.9L65 413.4c-2.2 3.8-.9 8.6 2.9 10.8l60.4 35.2-14.5 40c-1.2 3.2-1.8 6.6-1.8 10v348.2c0 15.7 11.8 28.4 26.3 28.4h67.6c12.3 0 23-9.3 25.6-22.3l7.7-37.7h545.6l7.7 37.7c2.7 13 13.3 22.3 25.6 22.3h67.6c14.5 0 26.3-12.7 26.3-28.4V509.4c0-3.4-.6-6.8-1.8-10l-14.5-40 60.3-35.2a8 8 0 0 0 3-10.8zM292.7 218.1l.5-1.3.4-1.3c1.1-3.3 4.1-5.5 7.6-5.5h427.6l75.4 208H220l72.7-199.9zM840 754H184V517l15.6-43h624.8l15.6 43v237z' ], [ primaryColor, 'M224 581a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm420 23h-40c-4.4 0-8 3.6-8 8v36H428v-36c0-4.4-3.6-8-8-8h-40c-4.4 0-8 3.6-8 8v84c0 4.4 3.6 8 8 8h264c4.4 0 8-3.6 8-8v-84c0-4.4-3.6-8-8-8z' ]); }); exports.CheckCircleTwoTone = getIcon('check-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm193.4 225.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.3 0 19.9 5 25.9 13.3l71.2 98.8 157.2-218c6-8.4 15.7-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.4 12.7z' ], [ primaryColor, 'M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0 0 51.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z' ]); }); exports.CheckSquareTwoTone = getIcon('check-square', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm130-367.8h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H688c6.5 0 10.3 7.4 6.5 12.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L307.5 484.9c-3.8-5.3 0-12.7 6.5-12.7z' ], [ primaryColor, 'M432.2 657.7a31.8 31.8 0 0 0 51.7 0l210.6-292c3.8-5.3 0-12.7-6.5-12.7h-46.9c-10.3 0-19.9 5-25.9 13.3L458 584.3l-71.2-98.8c-6-8.4-15.7-13.3-25.9-13.3H314c-6.5 0-10.3 7.4-6.5 12.7l124.7 172.8z' ]); }); exports.CloseSquareTwoTone = getIcon('close-square', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm163.9-473.9A7.95 7.95 0 0 1 354 353h58.9c4.7 0 9.2 2.1 12.3 5.7L512 462.2l86.8-103.5c3-3.6 7.5-5.7 12.3-5.7H670c6.8 0 10.5 7.9 6.1 13.1L553.8 512l122.3 145.9c4.4 5.2.7 13.1-6.1 13.1h-58.9c-4.7 0-9.2-2.1-12.3-5.7L512 561.8l-86.8 103.5c-3 3.6-7.5 5.7-12.3 5.7H354c-6.8 0-10.5-7.9-6.1-13.1L470.2 512 347.9 366.1z' ], [ primaryColor, 'M354 671h58.9c4.8 0 9.3-2.1 12.3-5.7L512 561.8l86.8 103.5c3.1 3.6 7.6 5.7 12.3 5.7H670c6.8 0 10.5-7.9 6.1-13.1L553.8 512l122.3-145.9c4.4-5.2.7-13.1-6.1-13.1h-58.9c-4.8 0-9.3 2.1-12.3 5.7L512 462.2l-86.8-103.5c-3.1-3.6-7.6-5.7-12.3-5.7H354c-6.8 0-10.5 7.9-6.1 13.1L470.2 512 347.9 657.9A7.95 7.95 0 0 0 354 671z' ]); }); exports.CloseCircleTwoTone = getIcon('close-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm171.8 527.1c1.2 1.5 1.9 3.3 1.9 5.2 0 4.5-3.6 8-8 8l-66-.3-99.3-118.4-99.3 118.5-66.1.3c-4.4 0-8-3.6-8-8 0-1.9.7-3.7 1.9-5.2L471 512.3l-130.1-155a8.32 8.32 0 0 1-1.9-5.2c0-4.5 3.6-8 8-8l66.1.3 99.3 118.4 99.4-118.5 66-.3c4.4 0 8 3.6 8 8 0 1.9-.6 3.8-1.8 5.2l-130.1 155 129.9 154.9z' ], [ primaryColor, 'M685.8 352c0-4.4-3.6-8-8-8l-66 .3-99.4 118.5-99.3-118.4-66.1-.3c-4.4 0-8 3.5-8 8 0 1.9.7 3.7 1.9 5.2l130.1 155-130.1 154.9a8.32 8.32 0 0 0-1.9 5.2c0 4.4 3.6 8 8 8l66.1-.3 99.3-118.5L611.7 680l66 .3c4.4 0 8-3.5 8-8 0-1.9-.7-3.7-1.9-5.2L553.9 512.2l130.1-155c1.2-1.4 1.8-3.3 1.8-5.2z' ]); }); exports.ClockCircleTwoTone = getIcon('clock-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm176.5 509.7l-28.6 39a7.99 7.99 0 0 1-11.2 1.7L483.3 569.8a7.92 7.92 0 0 1-3.3-6.5V288c0-4.4 3.6-8 8-8h48.1c4.4 0 8 3.6 8 8v247.5l142.6 103.1c3.6 2.5 4.4 7.5 1.8 11.1z' ], [ primaryColor, 'M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.6-3.6 1.8-8.6-1.8-11.1z' ]); }); exports.CloudTwoTone = getIcon('cloud', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M791.9 492l-37.8-10-13.8-36.5c-8.6-22.7-20.6-44.1-35.7-63.4a245.73 245.73 0 0 0-52.4-49.9c-41.1-28.9-89.5-44.2-140-44.2s-98.9 15.3-140 44.2a245.6 245.6 0 0 0-52.4 49.9 240.47 240.47 0 0 0-35.7 63.4l-13.9 36.6-37.9 9.9a125.7 125.7 0 0 0-66.1 43.7A123.1 123.1 0 0 0 140 612c0 33.1 12.9 64.3 36.3 87.7 23.4 23.4 54.5 36.3 87.6 36.3h496.2c33.1 0 64.2-12.9 87.6-36.3A123.3 123.3 0 0 0 884 612c0-56.2-37.8-105.5-92.1-120z' ], [ primaryColor, 'M811.4 418.7C765.6 297.9 648.9 212 512.2 212S258.8 297.8 213 418.6C127.3 441.1 64 519.1 64 612c0 110.5 89.5 200 199.9 200h496.2C870.5 812 960 722.5 960 612c0-92.7-63.1-170.7-148.6-193.3zm36.3 281a123.07 123.07 0 0 1-87.6 36.3H263.9c-33.1 0-64.2-12.9-87.6-36.3A123.3 123.3 0 0 1 140 612c0-28 9.1-54.3 26.2-76.3a125.7 125.7 0 0 1 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0 1 52.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10c54.3 14.5 92.1 63.8 92.1 120 0 33.1-12.9 64.3-36.3 87.7z' ]); }); exports.CodeTwoTone = getIcon('code', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm339.5-223h185c4.1 0 7.5 3.6 7.5 8v48c0 4.4-3.4 8-7.5 8h-185c-4.1 0-7.5-3.6-7.5-8v-48c0-4.4 3.4-8 7.5-8zM308 610.3c0-2.3 1.1-4.6 2.9-6.1L420.7 512l-109.8-92.2a7.63 7.63 0 0 1-2.9-6.1V351c0-6.8 7.9-10.5 13.1-6.1l192 160.9c3.9 3.2 3.9 9.1 0 12.3l-192 161c-5.2 4.4-13.1.7-13.1-6.1v-62.7z' ], [ primaryColor, 'M321.1 679.1l192-161c3.9-3.2 3.9-9.1 0-12.3l-192-160.9A7.95 7.95 0 0 0 308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 0 0-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48z' ]); }); exports.ContainerTwoTone = getIcon('container', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M635 771.7c-34.5 28.6-78.2 44.3-123 44.3s-88.5-15.8-123-44.3a194.02 194.02 0 0 1-59.1-84.7H232v201h560V687h-97.9c-11.6 32.8-32 62.3-59.1 84.7z' ], [ primaryColor, 'M320 501h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z' ], [ primaryColor, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-40 824H232V687h97.9c11.6 32.8 32 62.3 59.1 84.7 34.5 28.5 78.2 44.3 123 44.3s88.5-15.7 123-44.3c27.1-22.4 47.5-51.9 59.1-84.7H792v201zm0-264H643.6l-5.2 24.7C626.4 708.5 573.2 752 512 752s-114.4-43.5-126.5-103.3l-5.2-24.7H232V136h560v488z' ], [ primaryColor, 'M320 341h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z' ]); }); exports.ControlTwoTone = getIcon('control', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M616 440a36 36 0 1 0 72 0 36 36 0 1 0-72 0zM340.4 601.5l1.5 2.4c0 .1.1.1.1.2l.9 1.2c.1.1.2.2.2.3 1 1.3 2 2.5 3.2 3.6l.2.2c.4.4.8.8 1.2 1.1.8.8 1.7 1.5 2.6 2.1h.1l1.2.9c.1.1.3.2.4.3 1.2.8 2.5 1.6 3.9 2.2.2.1.5.2.7.4.4.2.7.3 1.1.5.3.1.7.3 1 .4.5.2 1 .4 1.5.5.4.1.9.3 1.3.4l.9.3 1.4.3c.2.1.5.1.7.2.7.1 1.4.3 2.1.4.2 0 .4 0 .6.1.6.1 1.1.1 1.7.2.2 0 .4 0 .7.1.8 0 1.5.1 2.3.1s1.5 0 2.3-.1c.2 0 .4 0 .7-.1.6 0 1.2-.1 1.7-.2.2 0 .4 0 .6-.1.7-.1 1.4-.2 2.1-.4.2-.1.5-.1.7-.2l1.4-.3.9-.3c.4-.1.9-.3 1.3-.4.5-.2 1-.4 1.5-.5.3-.1.7-.3 1-.4.4-.2.7-.3 1.1-.5.2-.1.5-.2.7-.4 1.3-.7 2.6-1.4 3.9-2.2.1-.1.3-.2.4-.3l1.2-.9h.1c.9-.7 1.8-1.4 2.6-2.1.4-.4.8-.7 1.2-1.1l.2-.2c1.1-1.1 2.2-2.4 3.2-3.6.1-.1.2-.2.2-.3l.9-1.2c0-.1.1-.1.1-.2l1.5-2.4c.1-.2.2-.3.3-.5 2.7-5.1 4.3-10.9 4.3-17s-1.6-12-4.3-17c-.1-.2-.2-.4-.3-.5l-1.5-2.4c0-.1-.1-.1-.1-.2l-.9-1.2c-.1-.1-.2-.2-.2-.3-1-1.3-2-2.5-3.2-3.6l-.2-.2c-.4-.4-.8-.8-1.2-1.1-.8-.8-1.7-1.5-2.6-2.1h-.1l-1.2-.9c-.1-.1-.3-.2-.4-.3-1.2-.8-2.5-1.6-3.9-2.2-.2-.1-.5-.2-.7-.4-.4-.2-.7-.3-1.1-.5-.3-.1-.7-.3-1-.4-.5-.2-1-.4-1.5-.5-.4-.1-.9-.3-1.3-.4l-.9-.3-1.4-.3c-.2-.1-.5-.1-.7-.2-.7-.1-1.4-.3-2.1-.4-.2 0-.4 0-.6-.1-.6-.1-1.1-.1-1.7-.2-.2 0-.4 0-.7-.1-.8 0-1.5-.1-2.3-.1s-1.5 0-2.3.1c-.2 0-.4 0-.7.1-.6 0-1.2.1-1.7.2-.2 0-.4 0-.6.1-.7.1-1.4.2-2.1.4-.2.1-.5.1-.7.2l-1.4.3-.9.3c-.4.1-.9.3-1.3.4-.5.2-1 .4-1.5.5-.3.1-.7.3-1 .4-.4.2-.7.3-1.1.5-.2.1-.5.2-.7.4-1.3.7-2.6 1.4-3.9 2.2-.1.1-.3.2-.4.3l-1.2.9h-.1c-.9.7-1.8 1.4-2.6 2.1-.4.4-.8.7-1.2 1.1l-.2.2a54.8 54.8 0 0 0-3.2 3.6c-.1.1-.2.2-.2.3l-.9 1.2c0 .1-.1.1-.1.2l-1.5 2.4c-.1.2-.2.3-.3.5-2.7 5.1-4.3 10.9-4.3 17s1.6 12 4.3 17c.1.2.2.3.3.5z' ], [ secondaryColor, 'M184 840h656V184H184v656zm436.4-499.1c-.2 0-.3.1-.4.1v-77c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v77c-.2 0-.3-.1-.4-.1 42 13.4 72.4 52.7 72.4 99.1 0 46.4-30.4 85.7-72.4 99.1.2 0 .3-.1.4-.1v221c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V539c.2 0 .3.1.4.1-42-13.4-72.4-52.7-72.4-99.1 0-46.4 30.4-85.7 72.4-99.1zM340 485V264c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v221c41.7 13.6 72 52.8 72 99s-30.3 85.5-72 99v77c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-77c-41.7-13.6-72-52.8-72-99s30.3-85.5 72-99z' ], [ primaryColor, 'M340 683v77c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-77c41.7-13.5 72-52.8 72-99s-30.3-85.4-72-99V264c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v221c-41.7 13.5-72 52.8-72 99s30.3 85.4 72 99zm.1-116c.1-.2.2-.3.3-.5l1.5-2.4c0-.1.1-.1.1-.2l.9-1.2c0-.1.1-.2.2-.3 1-1.2 2.1-2.5 3.2-3.6l.2-.2c.4-.4.8-.7 1.2-1.1.8-.7 1.7-1.4 2.6-2.1h.1l1.2-.9c.1-.1.3-.2.4-.3 1.3-.8 2.6-1.5 3.9-2.2.2-.2.5-.3.7-.4.4-.2.7-.3 1.1-.5.3-.1.7-.3 1-.4.5-.1 1-.3 1.5-.5.4-.1.9-.3 1.3-.4l.9-.3 1.4-.3c.2-.1.5-.1.7-.2.7-.2 1.4-.3 2.1-.4.2-.1.4-.1.6-.1.5-.1 1.1-.2 1.7-.2.3-.1.5-.1.7-.1.8-.1 1.5-.1 2.3-.1s1.5.1 2.3.1c.3.1.5.1.7.1.6.1 1.1.1 1.7.2.2.1.4.1.6.1.7.1 1.4.3 2.1.4.2.1.5.1.7.2l1.4.3.9.3c.4.1.9.3 1.3.4.5.1 1 .3 1.5.5.3.1.7.3 1 .4.4.2.7.3 1.1.5.2.2.5.3.7.4 1.4.6 2.7 1.4 3.9 2.2.1.1.3.2.4.3l1.2.9h.1c.9.6 1.8 1.3 2.6 2.1.4.3.8.7 1.2 1.1l.2.2c1.2 1.1 2.2 2.3 3.2 3.6 0 .1.1.2.2.3l.9 1.2c0 .1.1.1.1.2l1.5 2.4A36.03 36.03 0 0 1 408 584c0 6.1-1.6 11.9-4.3 17-.1.2-.2.3-.3.5l-1.5 2.4c0 .1-.1.1-.1.2l-.9 1.2c0 .1-.1.2-.2.3-1 1.2-2.1 2.5-3.2 3.6l-.2.2c-.4.4-.8.7-1.2 1.1-.8.7-1.7 1.4-2.6 2.1h-.1l-1.2.9c-.1.1-.3.2-.4.3-1.3.8-2.6 1.5-3.9 2.2-.2.2-.5.3-.7.4-.4.2-.7.3-1.1.5-.3.1-.7.3-1 .4-.5.1-1 .3-1.5.5-.4.1-.9.3-1.3.4l-.9.3-1.4.3c-.2.1-.5.1-.7.2-.7.2-1.4.3-2.1.4-.2.1-.4.1-.6.1-.5.1-1.1.2-1.7.2-.3.1-.5.1-.7.1-.8.1-1.5.1-2.3.1s-1.5-.1-2.3-.1c-.3-.1-.5-.1-.7-.1-.6-.1-1.1-.1-1.7-.2-.2-.1-.4-.1-.6-.1-.7-.1-1.4-.3-2.1-.4-.2-.1-.5-.1-.7-.2l-1.4-.3-.9-.3c-.4-.1-.9-.3-1.3-.4-.5-.1-1-.3-1.5-.5-.3-.1-.7-.3-1-.4-.4-.2-.7-.3-1.1-.5-.2-.2-.5-.3-.7-.4-1.4-.6-2.7-1.4-3.9-2.2-.1-.1-.3-.2-.4-.3l-1.2-.9h-.1c-.9-.6-1.8-1.3-2.6-2.1-.4-.3-.8-.7-1.2-1.1l-.2-.2c-1.2-1.1-2.2-2.3-3.2-3.6 0-.1-.1-.2-.2-.3l-.9-1.2c0-.1-.1-.1-.1-.2l-1.5-2.4c-.1-.2-.2-.3-.3-.5-2.7-5-4.3-10.9-4.3-17s1.6-11.9 4.3-17zm280.3-27.9c-.1 0-.2-.1-.4-.1v221c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V539c-.1 0-.2.1-.4.1 42-13.4 72.4-52.7 72.4-99.1 0-46.4-30.4-85.7-72.4-99.1.1 0 .2.1.4.1v-77c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v77c.1 0 .2-.1.4-.1-42 13.4-72.4 52.7-72.4 99.1 0 46.4 30.4 85.7 72.4 99.1zM652 404c19.9 0 36 16.1 36 36s-16.1 36-36 36-36-16.1-36-36 16.1-36 36-36z' ]); }); exports.CompassTwoTone = getIcon('compass', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zM327.6 701.7c-2 .9-4.4 0-5.3-2.1-.4-1-.4-2.2 0-3.2L421 470.9 553.1 603l-225.5 98.7zm375.1-375.1L604 552.1 471.9 420l225.5-98.7c2-.9 4.4 0 5.3 2.1.4 1 .4 2.1 0 3.2z' ], [ primaryColor, 'M322.3 696.4c-.4 1-.4 2.2 0 3.2.9 2.1 3.3 3 5.3 2.1L553.1 603 421 470.9l-98.7 225.5zm375.1-375.1L471.9 420 604 552.1l98.7-225.5c.4-1.1.4-2.2 0-3.2-.9-2.1-3.3-3-5.3-2.1z' ], [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ]); }); exports.ContactsTwoTone = getIcon('contacts', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M460.3 526a51.7 52 0 1 0 103.4 0 51.7 52 0 1 0-103.4 0z' ], [ secondaryColor, 'M768 352c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-56H548v56c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-56H328v56c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-56H136v496h752V296H768v56zM661 736h-43.8c-4.2 0-7.6-3.3-7.9-7.5-3.8-50.5-46-90.5-97.2-90.5s-93.4 39.9-97.2 90.5c-.3 4.2-3.7 7.5-7.9 7.5h-43.9a8 8 0 0 1-8-8.4c2.8-53.3 31.9-99.6 74.6-126.1-18.1-20-29.1-46.4-29.1-75.5 0-61.9 49.9-112 111.4-112s111.4 50.1 111.4 112c0 29.1-11 55.6-29.1 75.5 42.7 26.4 71.9 72.8 74.7 126.1a8 8 0 0 1-8 8.4z' ], [ primaryColor, 'M594.3 601.5a111.8 111.8 0 0 0 29.1-75.5c0-61.9-49.9-112-111.4-112s-111.4 50.1-111.4 112c0 29.1 11 55.5 29.1 75.5a158.09 158.09 0 0 0-74.6 126.1 8 8 0 0 0 8 8.4H407c4.2 0 7.6-3.3 7.9-7.5 3.8-50.6 46-90.5 97.2-90.5s93.4 40 97.2 90.5c.3 4.2 3.7 7.5 7.9 7.5H661a8 8 0 0 0 8-8.4c-2.8-53.3-32-99.7-74.7-126.1zM512 578c-28.5 0-51.7-23.3-51.7-52s23.2-52 51.7-52 51.7 23.3 51.7 52-23.2 52-51.7 52z' ], [ primaryColor, 'M928 224H768v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H548v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H328v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H96c-17.7 0-32 14.3-32 32v576c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V256c0-17.7-14.3-32-32-32zm-40 568H136V296h120v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h148v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h148v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h120v496z' ]); }); exports.CopyTwoTone = getIcon('copy', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M232 706h142c22.1 0 40 17.9 40 40v142h250V264H232v442z'], [ primaryColor, 'M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32z' ], [ primaryColor, 'M704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z' ]); }); exports.CreditCardTwoTone = getIcon('credit-card', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M136 792h752V440H136v352zm507-144c0-4.4 3.6-8 8-8h165c4.4 0 8 3.6 8 8v72c0 4.4-3.6 8-8 8H651c-4.4 0-8-3.6-8-8v-72zM136 232h752v120H136z' ], [ primaryColor, 'M651 728h165c4.4 0 8-3.6 8-8v-72c0-4.4-3.6-8-8-8H651c-4.4 0-8 3.6-8 8v72c0 4.4 3.6 8 8 8z' ], [ primaryColor, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136V440h752v352zm0-440H136V232h752v120z' ]); }); exports.DashboardTwoTone = getIcon('dashboard', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 188c-99.3 0-192.7 38.7-263 109-70.3 70.2-109 163.6-109 263 0 105.6 44.5 205.5 122.6 276h498.8A371.12 371.12 0 0 0 884 560c0-99.3-38.7-192.7-109-263-70.2-70.3-163.6-109-263-109zm-30 44c0-4.4 3.6-8 8-8h44c4.4 0 8 3.6 8 8v80c0 4.4-3.6 8-8 8h-44c-4.4 0-8-3.6-8-8v-80zM270 582c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8v-44c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8v44zm90.7-204.4l-31.1 31.1a8.03 8.03 0 0 1-11.3 0l-56.6-56.6a8.03 8.03 0 0 1 0-11.3l31.1-31.1c3.1-3.1 8.2-3.1 11.3 0l56.6 56.6c3.1 3.1 3.1 8.2 0 11.3zm291.1 83.5l-84.5 84.5c5 18.7.2 39.4-14.5 54.1a55.95 55.95 0 0 1-79.2 0 55.95 55.95 0 0 1 0-79.2 55.87 55.87 0 0 1 54.1-14.5l84.5-84.5c3.1-3.1 8.2-3.1 11.3 0l28.3 28.3c3.1 3.1 3.1 8.2 0 11.3zm43-52.4l-31.1-31.1a8.03 8.03 0 0 1 0-11.3l56.6-56.6c3.1-3.1 8.2-3.1 11.3 0l31.1 31.1c3.1 3.1 3.1 8.2 0 11.3l-56.6 56.6a8.03 8.03 0 0 1-11.3 0zM846 538v44c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8v-44c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8z' ], [ primaryColor, 'M623.5 421.5a8.03 8.03 0 0 0-11.3 0L527.7 506c-18.7-5-39.4-.2-54.1 14.5a55.95 55.95 0 0 0 0 79.2 55.95 55.95 0 0 0 79.2 0 55.87 55.87 0 0 0 14.5-54.1l84.5-84.5c3.1-3.1 3.1-8.2 0-11.3l-28.3-28.3zM490 320h44c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8h-44c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8z' ], [ primaryColor, 'M924.8 385.6a446.7 446.7 0 0 0-96-142.4 446.7 446.7 0 0 0-142.4-96C631.1 123.8 572.5 112 512 112s-119.1 11.8-174.4 35.2a446.7 446.7 0 0 0-142.4 96 446.7 446.7 0 0 0-96 142.4C75.8 440.9 64 499.5 64 560c0 132.7 58.3 257.7 159.9 343.1l1.7 1.4c5.8 4.8 13.1 7.5 20.6 7.5h531.7c7.5 0 14.8-2.7 20.6-7.5l1.7-1.4C901.7 817.7 960 692.7 960 560c0-60.5-11.9-119.1-35.2-174.4zM761.4 836H262.6A371.12 371.12 0 0 1 140 560c0-99.4 38.7-192.8 109-263 70.3-70.3 163.7-109 263-109 99.4 0 192.8 38.7 263 109 70.3 70.3 109 163.7 109 263 0 105.6-44.5 205.5-122.6 276z' ], [ primaryColor, 'M762.7 340.8l-31.1-31.1a8.03 8.03 0 0 0-11.3 0l-56.6 56.6a8.03 8.03 0 0 0 0 11.3l31.1 31.1c3.1 3.1 8.2 3.1 11.3 0l56.6-56.6c3.1-3.1 3.1-8.2 0-11.3zM750 538v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8zM304.1 309.7a8.03 8.03 0 0 0-11.3 0l-31.1 31.1a8.03 8.03 0 0 0 0 11.3l56.6 56.6c3.1 3.1 8.2 3.1 11.3 0l31.1-31.1c3.1-3.1 3.1-8.2 0-11.3l-56.6-56.6zM262 530h-80c-4.4 0-8 3.6-8 8v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8z' ]); }); exports.CrownTwoTone = getIcon('crown', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M911.9 283.9v.5L835.5 865c-1 8-7.9 14-15.9 14H204.5c-8.1 0-14.9-6.1-16-14l-76.4-580.6v-.6 1.6L188.5 866c1.1 7.9 7.9 14 16 14h615.1c8 0 14.9-6 15.9-14l76.4-580.6c.1-.5.1-1 0-1.5z' ], [ secondaryColor, 'M773.6 810.6l53.9-409.4-139.8 86.1L512 252.9 336.3 487.3l-139.8-86.1 53.8 409.4h523.3zm-374.2-189c0-62.1 50.5-112.6 112.6-112.6s112.6 50.5 112.6 112.6v1c0 62.1-50.5 112.6-112.6 112.6s-112.6-50.5-112.6-112.6v-1z' ], [ primaryColor, 'M512 734.2c61.9 0 112.3-50.2 112.6-112.1v-.5c0-62.1-50.5-112.6-112.6-112.6s-112.6 50.5-112.6 112.6v.5c.3 61.9 50.7 112.1 112.6 112.1zm0-160.9c26.6 0 48.2 21.6 48.2 48.3 0 26.6-21.6 48.3-48.2 48.3s-48.2-21.6-48.2-48.3c0-26.6 21.6-48.3 48.2-48.3z' ], [ primaryColor, 'M188.5 865c1.1 7.9 7.9 14 16 14h615.1c8 0 14.9-6 15.9-14l76.4-580.6v-.5c.3-6.4-6.7-10.8-12.3-7.4L705 396.4 518.4 147.5a8.06 8.06 0 0 0-12.9 0L319 396.4 124.3 276.5c-5.5-3.4-12.6.9-12.2 7.3v.6L188.5 865zm147.8-377.7L512 252.9l175.7 234.4 139.8-86.1-53.9 409.4H250.3l-53.8-409.4 139.8 86.1z' ]); }); exports.DatabaseTwoTone = getIcon('database', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M232 616h560V408H232v208zm112-144c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM232 888h560V680H232v208zm112-144c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM232 344h560V136H232v208zm112-144c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z' ], [ primaryColor, 'M304 512a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0 272a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0-544a40 40 0 1 0 80 0 40 40 0 1 0-80 0z' ], [ primaryColor, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-40 824H232V680h560v208zm0-272H232V408h560v208zm0-272H232V136h560v208z' ]); }); exports.CustomerServiceTwoTone = getIcon('customer-service', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M696 632h128v192H696zm-496 0h128v192H200z'], [ primaryColor, 'M512 128c-212.1 0-384 171.9-384 384v360c0 13.3 10.7 24 24 24h184c35.3 0 64-28.7 64-64V624c0-35.3-28.7-64-64-64H200v-48c0-172.3 139.7-312 312-312s312 139.7 312 312v48H688c-35.3 0-64 28.7-64 64v208c0 35.3 28.7 64 64 64h184c13.3 0 24-10.7 24-24V512c0-212.1-171.9-384-384-384zM328 632v192H200V632h128zm496 192H696V632h128v192z' ]); }); exports.DeleteTwoTone = getIcon('delete', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M292.7 840h438.6l24.2-512h-487z'], [ primaryColor, 'M864 256H736v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zm-504-72h304v72H360v-72zm371.3 656H292.7l-24.2-512h487l-24.2 512z' ]); }); exports.DislikeTwoTone = getIcon('dislike', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M273 100.1v428h.3l-.3-428zM820.4 525l-21.9-19 14-25.5a56.2 56.2 0 0 0 6.9-27.3c0-16.5-7.1-32.2-19.6-43l-21.9-19 13.9-25.4a56.2 56.2 0 0 0 6.9-27.3c0-16.5-7.1-32.2-19.6-43l-21.9-19 13.9-25.4a56.2 56.2 0 0 0 6.9-27.3c0-22.4-13.2-42.6-33.6-51.8H345v345.2c18.6 67.2 46.4 168 83.5 302.5a44.28 44.28 0 0 0 42.2 32.3c7.5.1 15-2.2 21.1-6.7 9.9-7.4 15.2-18.6 14.6-30.5l-9.6-198.4h314.4C829 605.5 840 587.1 840 568c0-16.5-7.1-32.2-19.6-43z' ], [ primaryColor, 'M112 132v364c0 17.7 14.3 32 32 32h65V100h-65c-17.7 0-32 14.3-32 32zm773.9 358.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H273l.3 428 85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zm-74.7 126.1H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3c-37.1-134.4-64.9-235.2-83.5-302.5V172h399.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z' ]); }); exports.DiffTwoTone = getIcon('diff', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M232 264v624h432V413.8L514.2 264H232zm336 489c0 3.8-3.4 7-7.5 7h-225c-4.1 0-7.5-3.2-7.5-7v-42c0-3.8 3.4-7 7.5-7h225c4.1 0 7.5 3.2 7.5 7v42zm0-262v42c0 3.8-3.4 7-7.5 7H476v84.9c0 3.9-3.1 7.1-7 7.1h-42c-3.8 0-7-3.2-7-7.1V540h-84.5c-4.1 0-7.5-3.2-7.5-7v-42c0-3.9 3.4-7 7.5-7H420v-84.9c0-3.9 3.2-7.1 7-7.1h42c3.9 0 7 3.2 7 7.1V484h84.5c4.1 0 7.5 3.1 7.5 7z' ], [ primaryColor, 'M854.2 306.6L611.3 72.9c-6-5.7-13.9-8.9-22.2-8.9H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h277l219 210.6V824c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V329.6c0-8.7-3.5-17-9.8-23z' ], [ primaryColor, 'M553.4 201.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v704c0 17.7 14.3 32 32 32h512c17.7 0 32-14.3 32-32V397.3c0-8.5-3.4-16.6-9.4-22.6L553.4 201.4zM664 888H232V264h282.2L664 413.8V888z' ], [ primaryColor, 'M476 399.1c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1V484h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H420v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V540h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H476v-84.9zM560.5 704h-225c-4.1 0-7.5 3.2-7.5 7v42c0 3.8 3.4 7 7.5 7h225c4.1 0 7.5-3.2 7.5-7v-42c0-3.8-3.4-7-7.5-7z' ]); }); exports.DownSquareTwoTone = getIcon('down-square', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm150-440h46.9c10.3 0 19.9 4.9 25.9 13.2L512 558.6l105.2-145.4c6-8.3 15.7-13.2 25.9-13.2H690c6.5 0 10.3 7.4 6.4 12.7l-178 246a7.95 7.95 0 0 1-12.9 0l-178-246c-3.8-5.3 0-12.7 6.5-12.7z' ], [ primaryColor, 'M505.5 658.7c3.2 4.4 9.7 4.4 12.9 0l178-246c3.9-5.3.1-12.7-6.4-12.7h-46.9c-10.2 0-19.9 4.9-25.9 13.2L512 558.6 406.8 413.2c-6-8.3-15.6-13.2-25.9-13.2H334c-6.5 0-10.3 7.4-6.5 12.7l178 246z' ]); }); exports.EnvironmentTwoTone = getIcon('environment', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M724.4 224.9C667.7 169.5 592.3 139 512 139s-155.7 30.5-212.4 85.8C243.1 280 212 353.2 212 431.1c0 241.3 234.1 407.2 300 449.1 65.9-41.9 300-207.8 300-449.1 0-77.9-31.1-151.1-87.6-206.2zM512 615c-97.2 0-176-78.8-176-176s78.8-176 176-176 176 78.8 176 176-78.8 176-176 176z' ], [ primaryColor, 'M512 263c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 551c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 439c0-29.9 11.7-58 32.8-79.2C454 338.6 482.1 327 512 327c29.9 0 58 11.6 79.2 32.8S624 409.1 624 439c0 29.9-11.6 58-32.8 79.2z' ], [ primaryColor, 'M854.6 289.1a362.49 362.49 0 0 0-79.9-115.7 370.83 370.83 0 0 0-118.2-77.8C610.7 76.6 562.1 67 512 67c-50.1 0-98.7 9.6-144.5 28.5-44.3 18.3-84 44.5-118.2 77.8A363.6 363.6 0 0 0 169.4 289c-19.5 45-29.4 92.8-29.4 142 0 70.6 16.9 140.9 50.1 208.7 26.7 54.5 64 107.6 111 158.1 80.3 86.2 164.5 138.9 188.4 153a43.9 43.9 0 0 0 22.4 6.1c7.8 0 15.5-2 22.4-6.1 23.9-14.1 108.1-66.8 188.4-153 47-50.4 84.3-103.6 111-158.1C867.1 572 884 501.8 884 431.1c0-49.2-9.9-97-29.4-142zM512 880.2c-65.9-41.9-300-207.8-300-449.1 0-77.9 31.1-151.1 87.6-206.3C356.3 169.5 431.7 139 512 139s155.7 30.5 212.4 85.9C780.9 280 812 353.2 812 431.1c0 241.3-234.1 407.2-300 449.1z' ]); }); exports.DownCircleTwoTone = getIcon('down-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm184.4 277.7l-178 246a7.95 7.95 0 0 1-12.9 0l-178-246c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.3 0 19.9 4.9 25.9 13.2L512 563.6l105.2-145.4c6-8.3 15.7-13.2 25.9-13.2H690c6.5 0 10.3 7.4 6.4 12.7z' ], [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ primaryColor, 'M690 405h-46.9c-10.2 0-19.9 4.9-25.9 13.2L512 563.6 406.8 418.2c-6-8.3-15.6-13.2-25.9-13.2H334c-6.5 0-10.3 7.4-6.5 12.7l178 246c3.2 4.4 9.7 4.4 12.9 0l178-246c3.9-5.3.1-12.7-6.4-12.7z' ]); }); exports.EyeInvisibleTwoTone = getIcon('eye-invisible', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M254.89 758.85l125.57-125.57a176 176 0 0 1 248.82-248.82L757 256.72Q651.69 186.07 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 0 0 0 51.5q69.27 145.91 173.09 221.05zM942.2 486.2Q889.46 375.11 816.7 305L672.48 449.27a176.09 176.09 0 0 1-227.22 227.21L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 0 0 0-51.5z' ], [ primaryColor, 'M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 0 0 0-51.5zM878.63 165.56L836 122.88a8 8 0 0 0-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 0 0 0 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 0 0 0 11.31L155.17 889a8 8 0 0 0 11.31 0l712.15-712.12a8 8 0 0 0 0-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 0 0-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 0 1 146.2-106.69L401.31 546.2A112 112 0 0 1 396 512z' ], [ primaryColor, 'M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 0 0 227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 0 1-112 112z' ]); }); exports.EditTwoTone = getIcon('edit', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M761.1 288.3L687.8 215 325.1 577.6l-15.6 89 88.9-15.7z'], [ primaryColor, 'M880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32zm-622.3-84c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 0 0 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 0 0 9.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89z' ]); }); exports.ExclamationCircleTwoTone = getIcon('exclamation-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm-32 156c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z' ], [ primaryColor, 'M488 576h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8zm-24 112a48 48 0 1 0 96 0 48 48 0 1 0-96 0z' ]); }); exports.EyeTwoTone = getIcon('eye', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M81.8 537.8a60.3 60.3 0 0 1 0-51.5C176.6 286.5 319.8 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c-192.1 0-335.4-100.5-430.2-300.2z' ], [ secondaryColor, 'M512 258c-161.3 0-279.4 81.8-362.7 254C232.6 684.2 350.7 766 512 766c161.4 0 279.5-81.8 362.7-254C791.4 339.8 673.3 258 512 258zm-4 430c-97.2 0-176-78.8-176-176s78.8-176 176-176 176 78.8 176 176-78.8 176-176 176z' ], [ primaryColor, 'M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258s279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766z' ], [ primaryColor, 'M508 336c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z' ]); }); exports.ExperimentTwoTone = getIcon('experiment', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M551.9 513c19.6 0 35.9-14.2 39.3-32.8A40.02 40.02 0 0 1 552 512a40 40 0 0 1-40-39.4v.5c0 22 17.9 39.9 39.9 39.9zM752 687.8l-.3-.3c-29-17.5-62.3-26.8-97-26.8-44.9 0-87.2 15.7-121 43.8a256.27 256.27 0 0 1-164.9 59.9c-41.2 0-81-9.8-116.7-28L210.5 844h603l-59.9-155.2-1.6-1z' ], [ primaryColor, 'M879 824.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 0 1-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.6-107.6.1-.2c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1l.6 1.6L813.5 844h-603z' ], [ primaryColor, 'M552 512c19.3 0 35.4-13.6 39.2-31.8.6-2.7.8-5.4.8-8.2 0-22.1-17.9-40-40-40s-40 17.9-40 40v.6a40 40 0 0 0 40 39.4z' ]); }); exports.FileExcelTwoTone = getIcon('file-excel', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm51.6 120h35.7a12.04 12.04 0 0 1 10.1 18.5L546.1 623l84 130.4c3.6 5.6 2 13-3.6 16.6-2 1.2-4.2 1.9-6.5 1.9h-37.5c-4.1 0-8-2.1-10.2-5.7L510 664.8l-62.7 101.5c-2.2 3.5-6 5.7-10.2 5.7h-34.5a12.04 12.04 0 0 1-10.2-18.4l83.4-132.8-82.3-130.4c-3.6-5.7-1.9-13.1 3.7-16.6 1.9-1.3 4.1-1.9 6.4-1.9H442c4.2 0 8.1 2.2 10.3 5.8l61.8 102.4 61.2-102.3c2.2-3.6 6.1-5.8 10.3-5.8z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0 0 10.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 0 0-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z' ]); }); exports.FileAddTwoTone = getIcon('file-add', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm126 236v48c0 4.4-3.6 8-8 8H544v108c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V644H372c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h108V472c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v108h108c4.4 0 8 3.6 8 8z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M544 472c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v108H372c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h108v108c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V644h108c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V472z' ]); }); exports.FileExclamationTwoTone = getIcon('file-exclamation', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm-54 96c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V448zm32 336c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M488 640h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8zm-16 104a40 40 0 1 0 80 0 40 40 0 1 0-80 0z' ]); }); exports.FileMarkdownTwoTone = getIcon('file-markdown', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm72.3 122H641c6.6 0 12 5.4 12 12v272c0 6.6-5.4 12-12 12h-27.2c-6.6 0-12-5.4-12-12V581.7L535 732.3c-2 4.3-6.3 7.1-11 7.1h-24.1a12 12 0 0 1-11-7.1l-66.8-150.2V758c0 6.6-5.4 12-12 12H383c-6.6 0-12-5.4-12-12V486c0-6.6 5.4-12 12-12h35c4.8 0 9.1 2.8 11 7.2l83.2 191 83.1-191c1.9-4.4 6.2-7.2 11-7.2z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M429 481.2c-1.9-4.4-6.2-7.2-11-7.2h-35c-6.6 0-12 5.4-12 12v272c0 6.6 5.4 12 12 12h27.1c6.6 0 12-5.4 12-12V582.1l66.8 150.2a12 12 0 0 0 11 7.1H524c4.7 0 9-2.8 11-7.1l66.8-150.6V758c0 6.6 5.4 12 12 12H641c6.6 0 12-5.4 12-12V486c0-6.6-5.4-12-12-12h-34.7c-4.8 0-9.1 2.8-11 7.2l-83.1 191-83.2-191z' ]); }); exports.FileImageTwoTone = getIcon('file-image', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm-134 50c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zm296 294H328.1c-6.7 0-10.4-7.7-6.3-12.9l99.8-127.2a8 8 0 0 1 12.6 0l41.1 52.4 77.8-99.2a8.1 8.1 0 0 1 12.7 0l136.5 174c4.1 5.2.4 12.9-6.3 12.9z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 0 0-12.6 0l-99.8 127.2a7.98 7.98 0 0 0 6.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 0 0-12.7 0zM360 442a40 40 0 1 0 80 0 40 40 0 1 0-80 0z' ]); }); exports.FilePptTwoTone = getIcon('file-ppt', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M464.5 516.2v108.4h38.9c44.7 0 71.2-10.9 71.2-54.3 0-34.4-20.1-54.1-53.9-54.1h-56.2z' ], [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm90 218.4c0 55.2-36.8 94.1-96.2 94.1h-63.3V760c0 4.4-3.6 8-8 8H424c-4.4 0-8-3.6-8-8V484c0-4.4 3.6-8 8-8v.1h104c59.7 0 96 39.8 96 94.3z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M424 476.1c-4.4-.1-8 3.5-8 7.9v276c0 4.4 3.6 8 8 8h32.5c4.4 0 8-3.6 8-8v-95.5h63.3c59.4 0 96.2-38.9 96.2-94.1 0-54.5-36.3-94.3-96-94.3H424zm150.6 94.2c0 43.4-26.5 54.3-71.2 54.3h-38.9V516.2h56.2c33.8 0 53.9 19.7 53.9 54.1z' ]); }); exports.FilePdfTwoTone = getIcon('file-pdf', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M509.2 490.8c-.7-1.3-1.4-1.9-2.2-2-2.9 3.3-2.2 31.5 2.7 51.4 4-13.6 4.7-40.5-.5-49.4zm-1.6 120.5c-7.7 20-18.8 47.3-32.1 71.4 4-1.6 8.1-3.3 12.3-5 17.6-7.2 37.3-15.3 58.9-20.2-14.9-11.8-28.4-27.7-39.1-46.2z' ], [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm55 287.6c16.1-1.9 30.6-2.8 44.3-2.3 12.8.4 23.6 2 32 5.1.2.1.3.1.5.2.4.2.8.3 1.2.5.5.2 1.1.4 1.6.7.1.1.3.1.4.2 4.1 1.8 7.5 4 10.1 6.6 9.1 9.1 11.8 26.1 6.2 39.6-3.2 7.7-11.7 20.5-33.3 20.5-21.8 0-53.9-9.7-82.1-24.8-25.5 4.3-53.7 13.9-80.9 23.1-5.8 2-11.8 4-17.6 5.9-38 65.2-66.5 79.4-84.1 79.4-4.2 0-7.8-.9-10.8-2-6.9-2.6-12.8-8-16.5-15-.9-1.7-1.6-3.4-2.2-5.2-1.6-4.8-2.1-9.6-1.3-13.6l.6-2.7c.1-.2.1-.4.2-.6.2-.7.4-1.4.7-2.1 0-.1.1-.2.1-.3 4.1-11.9 13.6-23.4 27.7-34.6 12.3-9.8 27.1-18.7 45.9-28.4 15.9-28 37.6-75.1 51.2-107.4-10.8-41.8-16.7-74.6-10.1-98.6.9-3.3 2.5-6.4 4.6-9.1.2-.2.3-.4.5-.6.1-.1.1-.2.2-.2 6.3-7.5 16.9-11.9 28.1-11.5 16.6.7 29.7 11.5 33 30.1 1.7 8 2.2 16.5 1.9 25.7v.7c0 .5 0 1-.1 1.5-.7 13.3-3 26.6-7.3 44.7-.4 1.6-.8 3.2-1.2 5.2l-1 4.1-.1.3c.1.2.1.3.2.5l1.8 4.5c.1.3.3.7.4 1 .7 1.6 1.4 3.3 2.1 4.8v.1c8.7 18.8 19.7 33.4 33.9 45.1 4.3 3.5 8.9 6.7 13.9 9.8 1.8-.5 3.5-.7 5.3-.9z' ], [ secondaryColor, 'M391.5 761c5.7-4.4 16.2-14.5 30.1-34.7-10.3 9.4-23.4 22.4-30.1 34.7zm270.9-83l.2-.3h.2c.6-.4.5-.7.4-.9-.1-.1-4.5-9.3-45.1-7.4 35.3 13.9 43.5 9.1 44.3 8.6z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M535.9 585.3c-.8-1.7-1.5-3.3-2.2-4.9-.1-.3-.3-.7-.4-1l-1.8-4.5c-.1-.2-.1-.3-.2-.5l.1-.3.2-1.1c4-16.3 8.6-35.3 9.4-54.4v-.7c.3-8.6-.2-17.2-2-25.6-3.8-21.3-19.5-29.6-32.9-30.2-11.3-.5-21.8 4-28.1 11.4-.1.1-.1.2-.2.2-.2.2-.4.4-.5.6-2.1 2.7-3.7 5.8-4.6 9.1-6.6 24-.7 56.8 10.1 98.6-13.6 32.4-35.3 79.4-51.2 107.4v.1c-27.7 14.3-64.1 35.8-73.6 62.9 0 .1-.1.2-.1.3-.2.7-.5 1.4-.7 2.1-.1.2-.1.4-.2.6-.2.9-.5 1.8-.6 2.7-.9 4-.4 8.8 1.3 13.6.6 1.8 1.3 3.5 2.2 5.2 3.7 7 9.6 12.4 16.5 15 3 1.1 6.6 2 10.8 2 17.6 0 46.1-14.2 84.1-79.4 5.8-1.9 11.8-3.9 17.6-5.9 27.2-9.2 55.4-18.8 80.9-23.1 28.2 15.1 60.3 24.8 82.1 24.8 21.6 0 30.1-12.8 33.3-20.5 5.6-13.5 2.9-30.5-6.2-39.6-2.6-2.6-6-4.8-10.1-6.6-.1-.1-.3-.1-.4-.2-.5-.2-1.1-.4-1.6-.7-.4-.2-.8-.3-1.2-.5-.2-.1-.3-.1-.5-.2-16.2-5.8-41.7-6.7-76.3-2.8l-5.3.6c-5-3-9.6-6.3-13.9-9.8-14.2-11.3-25.1-25.8-33.8-44.7zM391.5 761c6.7-12.3 19.8-25.3 30.1-34.7-13.9 20.2-24.4 30.3-30.1 34.7zM507 488.8c.8.1 1.5.7 2.2 2 5.2 8.9 4.5 35.8.5 49.4-4.9-19.9-5.6-48.1-2.7-51.4zm-19.2 188.9c-4.2 1.7-8.3 3.4-12.3 5 13.3-24.1 24.4-51.4 32.1-71.4 10.7 18.5 24.2 34.4 39.1 46.2-21.6 4.9-41.3 13-58.9 20.2zm175.4-.9c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6 40.6-1.9 45 7.3 45.1 7.4z' ]); }); exports.FileUnknownTwoTone = getIcon('file-unknown', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm-22 424c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm110-228.4c.7 44.9-29.7 84.5-74.3 98.9-5.7 1.8-9.7 7.3-9.7 13.3V672c0 5.5-4.5 10-10 10h-32c-5.5 0-10-4.5-10-10v-32c.2-19.8 15.4-37.3 34.7-40.1C549 596.2 570 574.3 570 549c0-28.1-25.8-51.5-58-51.5s-58 23.4-58 51.6c0 5.2-4.4 9.4-9.8 9.4h-32.4c-5.4 0-9.8-4.1-9.8-9.5 0-57.4 50.1-103.7 111.5-103 59.3.8 107.7 46.1 108.5 101.6z' ], [ primaryColor, 'M854.6 288.7L639.4 73.4c-6-6-14.2-9.4-22.7-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.6-9.4-22.6zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M480 744a32 32 0 1 0 64 0 32 32 0 1 0-64 0zm-78-195c0 5.4 4.4 9.5 9.8 9.5h32.4c5.4 0 9.8-4.2 9.8-9.4 0-28.2 25.8-51.6 58-51.6s58 23.4 58 51.5c0 25.3-21 47.2-49.3 50.9-19.3 2.8-34.5 20.3-34.7 40.1v32c0 5.5 4.5 10 10 10h32c5.5 0 10-4.5 10-10v-12.2c0-6 4-11.5 9.7-13.3 44.6-14.4 75-54 74.3-98.9-.8-55.5-49.2-100.8-108.5-101.6-61.4-.7-111.5 45.6-111.5 103z' ]); }); exports.FileWordTwoTone = getIcon('file-word', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm101.3 129.3c1.3-5.4 6.1-9.3 11.7-9.3h35.6a12.04 12.04 0 0 1 11.6 15.1l-74.4 276c-1.4 5.3-6.2 8.9-11.6 8.9h-31.8c-5.4 0-10.2-3.7-11.6-8.9l-52.8-197-52.8 197c-1.4 5.3-6.2 8.9-11.6 8.9h-32c-5.4 0-10.2-3.7-11.6-8.9l-74.2-276a12.02 12.02 0 0 1 11.6-15.1h35.4c5.6 0 10.4 3.9 11.7 9.3L434.6 680l49.7-198.9c1.3-5.4 6.1-9.1 11.6-9.1h32.2c5.5 0 10.3 3.7 11.6 9.1l49.8 199.3 45.8-199.1z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 0 0-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 0 0-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z' ]); }); exports.FilterTwoTone = getIcon('filter', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M420.6 798h182.9V642H420.6zM411 561.4l9.5 16.6h183l9.5-16.6L811.3 226H212.7z' ], [ primaryColor, 'M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.5 798H420.6V642h182.9v156zm9.5-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z' ]); }); exports.FileZipTwoTone = getIcon('file-zip', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M344 630h32v2h-32z'], [ secondaryColor, 'M534 352V136H360v64h64v64h-64v64h64v64h-64v64h64v64h-64v62h64v160H296V520h64v-64h-64v-64h64v-64h-64v-64h64v-64h-64v-64h-64v752h560V394H576a42 42 0 0 1-42-42z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h64v64h64v-64h174v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M296 392h64v64h-64zm0-128h64v64h-64zm0 318v160h128V582h-64v-62h-64v62zm48 50v-2h32v64h-32v-62zm16-432h64v64h-64zm0 256h64v64h-64zm0-128h64v64h-64z' ]); }); exports.FileTextTwoTone = getIcon('file-text', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42zm-22 322c0 4.4-3.6 8-8 8H320c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48zm200-184v48c0 4.4-3.6 8-8 8H320c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h384c4.4 0 8 3.6 8 8z' ], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ], [ primaryColor, 'M312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8zm192 128H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z' ]); }); exports.FileTwoTone = getIcon('file', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M534 352V136H232v752h560V394H576a42 42 0 0 1-42-42z'], [ primaryColor, 'M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0 0 42 42h216v494z' ]); }); exports.FireTwoTone = getIcon('fire', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M737 438.6c-9.6 15.5-21.1 30.7-34.4 45.6a73.1 73.1 0 0 1-51 24.4 73.36 73.36 0 0 1-53.4-18.8 74.01 74.01 0 0 1-24.4-59.8c3-47.4-12.4-103.1-45.8-165.7-16.9-31.4-37.1-58.2-61.2-80.4a240 240 0 0 1-12.1 46.5 354.26 354.26 0 0 1-58.2 101 349.6 349.6 0 0 1-58.6 56.8c-34 26.1-62 60-80.8 97.9a275.96 275.96 0 0 0-29.1 124c0 74.9 29.5 145.3 83 198.4 53.7 53.2 125 82.4 201 82.4s147.3-29.2 201-82.4c53.5-53 83-123.5 83-198.4 0-39.2-8.1-77.3-24-113.1-9.3-21-21-40.5-35-58.4z' ], [ primaryColor, 'M834.1 469.2A347.49 347.49 0 0 0 751.2 354l-29.1-26.7a8.09 8.09 0 0 0-13 3.3l-13 37.3c-8.1 23.4-23 47.3-44.1 70.8-1.4 1.5-3 1.9-4.1 2-1.1.1-2.8-.1-4.3-1.5-1.4-1.2-2.1-3-2-4.8 3.7-60.2-14.3-128.1-53.7-202C555.3 171 510 123.1 453.4 89.7l-41.3-24.3c-5.4-3.2-12.3 1-12 7.3l2.2 48c1.5 32.8-2.3 61.8-11.3 85.9-11 29.5-26.8 56.9-47 81.5a295.64 295.64 0 0 1-47.5 46.1 352.6 352.6 0 0 0-100.3 121.5A347.75 347.75 0 0 0 160 610c0 47.2 9.3 92.9 27.7 136a349.4 349.4 0 0 0 75.5 110.9c32.4 32 70 57.2 111.9 74.7C418.5 949.8 464.5 959 512 959s93.5-9.2 136.9-27.3A348.6 348.6 0 0 0 760.8 857c32.4-32 57.8-69.4 75.5-110.9a344.2 344.2 0 0 0 27.7-136c0-48.8-10-96.2-29.9-140.9zM713 808.5c-53.7 53.2-125 82.4-201 82.4s-147.3-29.2-201-82.4c-53.5-53.1-83-123.5-83-198.4 0-43.5 9.8-85.2 29.1-124 18.8-37.9 46.8-71.8 80.8-97.9a349.6 349.6 0 0 0 58.6-56.8c25-30.5 44.6-64.5 58.2-101a240 240 0 0 0 12.1-46.5c24.1 22.2 44.3 49 61.2 80.4 33.4 62.6 48.8 118.3 45.8 165.7a74.01 74.01 0 0 0 24.4 59.8 73.36 73.36 0 0 0 53.4 18.8c19.7-1 37.8-9.7 51-24.4 13.3-14.9 24.8-30.1 34.4-45.6 14 17.9 25.7 37.4 35 58.4 15.9 35.8 24 73.9 24 113.1 0 74.9-29.5 145.4-83 198.4z' ]); }); exports.FlagTwoTone = getIcon('flag', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M184 232h368v336H184z'], [secondaryColor, 'M624 632c0 4.4-3.6 8-8 8H504v73h336V377H624v255z'], [ primaryColor, 'M880 305H624V192c0-17.7-14.3-32-32-32H184v-40c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v784c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V640h248v113c0 17.7 14.3 32 32 32h416c17.7 0 32-14.3 32-32V337c0-17.7-14.3-32-32-32zM184 568V232h368v336H184zm656 145H504v-73h112c4.4 0 8-3.6 8-8V377h216v336z' ]); }); exports.FolderAddTwoTone = getIcon('folder-add', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M372.5 256H184v512h656V370.4H492.1L372.5 256zM540 443.1V528h84.5c4.1 0 7.5 3.1 7.5 7v42c0 3.8-3.4 7-7.5 7H540v84.9c0 3.9-3.1 7.1-7 7.1h-42c-3.8 0-7-3.2-7-7.1V584h-84.5c-4.1 0-7.5-3.2-7.5-7v-42c0-3.9 3.4-7 7.5-7H484v-84.9c0-3.9 3.2-7.1 7-7.1h42c3.9 0 7 3.2 7 7.1z' ], [ primaryColor, 'M880 298.4H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z' ], [ primaryColor, 'M484 443.1V528h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H484v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V584h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H540v-84.9c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1z' ]); }); exports.FolderOpenTwoTone = getIcon('folder-open', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M159 768h612.3l103.4-256H262.3z'], [ primaryColor, 'M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 0 0-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z' ]); }); exports.FolderTwoTone = getIcon('folder', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 298.4H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z' ], [secondaryColor, 'M372.5 256H184v512h656V370.4H492.1z']); }); exports.FrownTwoTone = getIcon('frown', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zM288 421a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm376 272h-48.1c-4.2 0-7.8-3.2-8.1-7.4C604 636.1 562.5 597 512 597s-92.1 39.1-95.8 88.6c-.3 4.2-3.9 7.4-8.1 7.4H360a8 8 0 0 1-8-8.4c4.4-84.3 74.5-151.6 160-151.6s155.6 67.3 160 151.6a8 8 0 0 1-8 8.4zm24-224a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z' ], [ primaryColor, 'M288 421a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm224 112c-85.5 0-155.6 67.3-160 151.6a8 8 0 0 0 8 8.4h48.1c4.2 0 7.8-3.2 8.1-7.4 3.7-49.5 45.3-88.6 95.8-88.6s92 39.1 95.8 88.6c.3 4.2 3.9 7.4 8.1 7.4H664a8 8 0 0 0 8-8.4C667.6 600.3 597.5 533 512 533zm128-112a48 48 0 1 0 96 0 48 48 0 1 0-96 0z' ]); }); exports.FunnelPlotTwoTone = getIcon('funnel-plot', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M420.6 798h182.9V650H420.6zM297.7 374h428.6l85-148H212.7zm113.2 197.4l8.4 14.6h185.3l8.4-14.6L689.6 438H334.4z' ], [ primaryColor, 'M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 607.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V607.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.5 798H420.6V650h182.9v148zm9.5-226.6l-8.4 14.6H419.3l-8.4-14.6L334.4 438h355.2L613 571.4zM726.3 374H297.7l-85-148h598.6l-85 148z' ]); }); exports.FundTwoTone = getIcon('fund', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136V232h752v560z' ], [ secondaryColor, 'M136 792h752V232H136v560zm56.4-130.5l214.9-215c3.1-3.1 8.2-3.1 11.3 0L533 561l254.5-254.6c3.1-3.1 8.2-3.1 11.3 0l36.8 36.8c3.1 3.1 3.1 8.2 0 11.3l-297 297.2a8.03 8.03 0 0 1-11.3 0L412.9 537.2 240.4 709.7a8.03 8.03 0 0 1-11.3 0l-36.7-36.9a8.03 8.03 0 0 1 0-11.3z' ], [ primaryColor, 'M229.1 709.7c3.1 3.1 8.2 3.1 11.3 0l172.5-172.5 114.4 114.5c3.1 3.1 8.2 3.1 11.3 0l297-297.2c3.1-3.1 3.1-8.2 0-11.3l-36.8-36.8a8.03 8.03 0 0 0-11.3 0L533 561 418.6 446.5a8.03 8.03 0 0 0-11.3 0l-214.9 215a8.03 8.03 0 0 0 0 11.3l36.7 36.9z' ]); }); exports.GiftTwoTone = getIcon('gift', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M546 378h298v104H546zM228 550h250v308H228zm-48-172h298v104H180zm366 172h250v308H546z' ], [ primaryColor, 'M880 310H732.4c13.6-21.4 21.6-46.8 21.6-74 0-76.1-61.9-138-138-138-41.4 0-78.7 18.4-104 47.4-25.3-29-62.6-47.4-104-47.4-76.1 0-138 61.9-138 138 0 27.2 7.9 52.6 21.6 74H144c-17.7 0-32 14.3-32 32v200c0 4.4 3.6 8 8 8h40v344c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V550h40c4.4 0 8-3.6 8-8V342c0-17.7-14.3-32-32-32zM478 858H228V550h250v308zm0-376H180V378h298v104zm0-176h-70c-38.6 0-70-31.4-70-70s31.4-70 70-70 70 31.4 70 70v70zm68-70c0-38.6 31.4-70 70-70s70 31.4 70 70-31.4 70-70 70h-70v-70zm250 622H546V550h250v308zm48-376H546V378h298v104z' ]); }); exports.HddTwoTone = getIcon('hdd', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M232 888h560V680H232v208zm448-140c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM232 616h560V408H232v208zm72-128c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H312c-4.4 0-8-3.6-8-8v-48zm-72-144h560V136H232v208zm72-128c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H312c-4.4 0-8-3.6-8-8v-48z' ], [ primaryColor, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-40 824H232V680h560v208zm0-272H232V408h560v208zm0-272H232V136h560v208z' ], [ primaryColor, 'M312 544h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0-272h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm328 516a40 40 0 1 0 80 0 40 40 0 1 0-80 0z' ]); }); exports.HeartTwoTone = getIcon('heart', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M923 283.6a260.04 260.04 0 0 0-56.9-82.8 264.4 264.4 0 0 0-84-55.5A265.34 265.34 0 0 0 679.7 125c-49.3 0-97.4 13.5-139.2 39-10 6.1-19.5 12.8-28.5 20.1-9-7.3-18.5-14-28.5-20.1-41.8-25.5-89.9-39-139.2-39-35.5 0-69.9 6.8-102.4 20.3-31.4 13-59.7 31.7-84 55.5a258.44 258.44 0 0 0-56.9 82.8c-13.9 32.3-21 66.6-21 101.9 0 33.3 6.8 68 20.3 103.3 11.3 29.5 27.5 60.1 48.2 91 32.8 48.9 77.9 99.9 133.9 151.6 92.8 85.7 184.7 144.9 188.6 147.3l23.7 15.2c10.5 6.7 24 6.7 34.5 0l23.7-15.2c3.9-2.5 95.7-61.6 188.6-147.3 56-51.7 101.1-102.7 133.9-151.6 20.7-30.9 37-61.5 48.2-91 13.5-35.3 20.3-70 20.3-103.3.1-35.3-7-69.6-20.9-101.9zM512 814.8S156 586.7 156 385.5C156 283.6 240.3 201 344.3 201c73.1 0 136.5 40.8 167.7 100.4C543.2 241.8 606.6 201 679.7 201c104 0 188.3 82.6 188.3 184.5 0 201.2-356 429.3-356 429.3z' ], [ secondaryColor, 'M679.7 201c-73.1 0-136.5 40.8-167.7 100.4C480.8 241.8 417.4 201 344.3 201c-104 0-188.3 82.6-188.3 184.5 0 201.2 356 429.3 356 429.3s356-228.1 356-429.3C868 283.6 783.7 201 679.7 201z' ]); }); exports.HighlightTwoTone = getIcon('highlight', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M229.6 796.3h160.2l54.3-54.1-80.1-78.9zm220.7-397.1l262.8 258.9 147.3-145-262.8-259zm-77.1 166.1l171.4 168.9 68.6-67.6-171.4-168.9z' ], [ primaryColor, 'M957.6 507.5L603.2 158.3a7.9 7.9 0 0 0-11.2 0L353.3 393.5a8.03 8.03 0 0 0-.1 11.3l.1.1 40 39.4-117.2 115.3a8.03 8.03 0 0 0-.1 11.3l.1.1 39.5 38.9-189.1 187H72.1c-4.4 0-8.1 3.6-8.1 8v55.2c0 4.4 3.6 8 8 8h344.9c2.1 0 4.1-.8 5.6-2.3l76.1-75.6L539 830a7.9 7.9 0 0 0 11.2 0l117.1-115.6 40.1 39.5a7.9 7.9 0 0 0 11.2 0l238.7-235.2c3.4-3 3.4-8 .3-11.2zM389.8 796.3H229.6l134.4-133 80.1 78.9-54.3 54.1zm154.8-62.1L373.2 565.3l68.6-67.6 171.4 168.9-68.6 67.6zm168.5-76.1L450.3 399.2l147.3-145.1 262.8 259-147.3 145z' ]); }); exports.HomeTwoTone = getIcon('home', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512.1 172.6l-370 369.7h96V868H392V640c0-22.1 17.9-40 40-40h160c22.1 0 40 17.9 40 40v228h153.9V542.3H882L535.2 195.7l-23.1-23.1zm434.5 422.9c-6 6-13.1 10.8-20.8 13.9 7.7-3.2 14.8-7.9 20.8-13.9zm-887-34.7c5 30.3 31.4 53.5 63.1 53.5h.9c-31.9 0-58.9-23-64-53.5zm-.9-10.5v-1.9 1.9zm.1-2.6c.1-3.1.5-6.1 1-9.1-.6 2.9-.9 6-1 9.1z' ], [ primaryColor, 'M951 510c0-.1-.1-.1-.1-.2l-1.8-2.1c-.1-.1-.2-.3-.4-.4-.7-.8-1.5-1.6-2.2-2.4L560.1 118.8l-25.9-25.9a31.5 31.5 0 0 0-44.4 0L77.5 505a63.6 63.6 0 0 0-16 26.6l-.6 2.1-.3 1.1-.3 1.2c-.2.7-.3 1.4-.4 2.1 0 .1 0 .3-.1.4-.6 3-.9 6-1 9.1v3.3c0 .5 0 1 .1 1.5 0 .5 0 .9.1 1.4 0 .5.1 1 .1 1.5 0 .6.1 1.2.2 1.8 0 .3.1.6.1.9l.3 2.5v.1c5.1 30.5 32.2 53.5 64 53.5h42.5V940h691.7V614.3h43.4c8.6 0 16.9-1.7 24.5-4.9s14.7-7.9 20.8-13.9a63.6 63.6 0 0 0 18.7-45.3c0-14.7-5-28.8-14.3-40.2zM568 868H456V664h112v204zm217.9-325.7V868H632V640c0-22.1-17.9-40-40-40H432c-22.1 0-40 17.9-40 40v228H238.1V542.3h-96l370-369.7 23.1 23.1L882 542.3h-96.1z' ]); }); exports.HourglassTwoTone = getIcon('hourglass', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 548c-42.2 0-81.9 16.4-111.7 46.3A156.63 156.63 0 0 0 354 706v134h316V706c0-42.2-16.4-81.9-46.3-111.7A156.63 156.63 0 0 0 512 548zM354 318c0 42.2 16.4 81.9 46.3 111.7C430.1 459.6 469.8 476 512 476s81.9-16.4 111.7-46.3C653.6 399.9 670 360.2 670 318V184H354v134z' ], [ primaryColor, 'M742 318V184h86c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H196c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h86v134c0 81.5 42.4 153.2 106.4 194-64 40.8-106.4 112.5-106.4 194v134h-86c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h632c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-86V706c0-81.5-42.4-153.2-106.4-194 64-40.8 106.4-112.5 106.4-194zm-72 388v134H354V706c0-42.2 16.4-81.9 46.3-111.7C430.1 564.4 469.8 548 512 548s81.9 16.4 111.7 46.3C653.6 624.1 670 663.8 670 706zm0-388c0 42.2-16.4 81.9-46.3 111.7C593.9 459.6 554.2 476 512 476s-81.9-16.4-111.7-46.3A156.63 156.63 0 0 1 354 318V184h316v134z' ]); }); exports.Html5TwoTone = getIcon('html5', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M145 96l66 746.6L511.8 928l299.6-85.4L878.7 96H145zm610.9 700.6l-244.1 69.6-245.2-69.6-56.7-641.2h603.8l-57.8 641.2z' ], [ secondaryColor, 'M209.9 155.4l56.7 641.2 245.2 69.6 244.1-69.6 57.8-641.2H209.9zm530.4 117.9l-4.8 47.2-1.7 19.5H381.7l8.2 94.2H511v-.2h214.7l-3.2 24.3-21.2 242.2-1.7 16.3-187.7 51.7v.4h-1.7l-188.6-52-11.3-144.7h91l6.5 73.2 102.4 27.7h.8v-.2l102.4-27.7 11.4-118.5H511.9v.1H305.4l-22.7-253.5L281 249h461l-1.7 24.3z' ], [ primaryColor, 'M281 249l1.7 24.3 22.7 253.5h206.5v-.1h112.9l-11.4 118.5L511 672.9v.2h-.8l-102.4-27.7-6.5-73.2h-91l11.3 144.7 188.6 52h1.7v-.4l187.7-51.7 1.7-16.3 21.2-242.2 3.2-24.3H511v.2H389.9l-8.2-94.2h352.1l1.7-19.5 4.8-47.2L742 249H511z' ]); }); exports.IdcardTwoTone = getIcon('idcard', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136V232h752v560z' ], [ secondaryColor, 'M136 792h752V232H136v560zm472-372c0-4.4 1-8 2.3-8h123.4c1.3 0 2.3 3.6 2.3 8v48c0 4.4-1 8-2.3 8H610.3c-1.3 0-2.3-3.6-2.3-8v-48zm0 144c0-4.4 3.2-8 7.1-8h185.7c3.9 0 7.1 3.6 7.1 8v48c0 4.4-3.2 8-7.1 8H615.1c-3.9 0-7.1-3.6-7.1-8v-48zM216.2 664.6c2.8-53.3 31.9-99.6 74.6-126.1-18.1-20-29.1-46.4-29.1-75.5 0-61.9 49.9-112 111.4-112s111.4 50.1 111.4 112c0 29.1-11 55.6-29.1 75.5 42.6 26.4 71.8 72.8 74.6 126.1a8 8 0 0 1-8 8.4h-43.9c-4.2 0-7.6-3.3-7.9-7.5-3.8-50.5-46-90.5-97.2-90.5s-93.4 40-97.2 90.5c-.3 4.2-3.7 7.5-7.9 7.5H224c-4.6 0-8.2-3.8-7.8-8.4z' ], [ secondaryColor, 'M321.3 463a51.7 52 0 1 0 103.4 0 51.7 52 0 1 0-103.4 0z' ], [ primaryColor, 'M610.3 476h123.4c1.3 0 2.3-3.6 2.3-8v-48c0-4.4-1-8-2.3-8H610.3c-1.3 0-2.3 3.6-2.3 8v48c0 4.4 1 8 2.3 8zm4.8 144h185.7c3.9 0 7.1-3.6 7.1-8v-48c0-4.4-3.2-8-7.1-8H615.1c-3.9 0-7.1 3.6-7.1 8v48c0 4.4 3.2 8 7.1 8zM224 673h43.9c4.2 0 7.6-3.3 7.9-7.5 3.8-50.5 46-90.5 97.2-90.5s93.4 40 97.2 90.5c.3 4.2 3.7 7.5 7.9 7.5H522a8 8 0 0 0 8-8.4c-2.8-53.3-32-99.7-74.6-126.1a111.8 111.8 0 0 0 29.1-75.5c0-61.9-49.9-112-111.4-112s-111.4 50.1-111.4 112c0 29.1 11 55.5 29.1 75.5a158.09 158.09 0 0 0-74.6 126.1c-.4 4.6 3.2 8.4 7.8 8.4zm149-262c28.5 0 51.7 23.3 51.7 52s-23.2 52-51.7 52-51.7-23.3-51.7-52 23.2-52 51.7-52z' ]); }); exports.InfoCircleTwoTone = getIcon('info-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm32 588c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z' ], [ primaryColor, 'M464 336a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z' ]); }); exports.InterationTwoTone = getIcon('interation', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm114-401.9c0-55.3 44.6-100.1 99.7-100.1h205.8v-53.4c0-5.6 6.5-8.8 10.9-5.3L723.5 365c3.5 2.7 3.5 8 0 10.7l-109.1 85.7c-4.4 3.5-10.9.4-10.9-5.3v-53.4H397.8c-19.6 0-35.5 15.9-35.5 35.6v78.9c0 3.8-3.1 6.8-6.8 6.8h-50.7c-3.8 0-6.8-3-6.8-7v-78.9zm2.6 210.3l109.1-85.7c4.4-3.5 10.9-.4 10.9 5.3v53.4h205.6c19.6 0 35.5-15.9 35.5-35.6v-78.9c0-3.8 3.1-6.8 6.8-6.8h50.7c3.8 0 6.8 3.1 6.8 6.8v78.9c0 55.3-44.6 100.1-99.7 100.1H420.6v53.4c0 5.6-6.5 8.8-10.9 5.3l-109.1-85.7c-3.5-2.7-3.5-8 0-10.5z' ], [ primaryColor, 'M304.8 524h50.7c3.7 0 6.8-3 6.8-6.8v-78.9c0-19.7 15.9-35.6 35.5-35.6h205.7v53.4c0 5.7 6.5 8.8 10.9 5.3l109.1-85.7c3.5-2.7 3.5-8 0-10.7l-109.1-85.7c-4.4-3.5-10.9-.3-10.9 5.3V338H397.7c-55.1 0-99.7 44.8-99.7 100.1V517c0 4 3 7 6.8 7zm-4.2 134.9l109.1 85.7c4.4 3.5 10.9.3 10.9-5.3v-53.4h205.7c55.1 0 99.7-44.8 99.7-100.1v-78.9c0-3.7-3-6.8-6.8-6.8h-50.7c-3.7 0-6.8 3-6.8 6.8v78.9c0 19.7-15.9 35.6-35.5 35.6H420.6V568c0-5.7-6.5-8.8-10.9-5.3l-109.1 85.7c-3.5 2.5-3.5 7.8 0 10.5z' ]); }); exports.InsuranceTwoTone = getIcon('insurance', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM810 654.3L512 886.5 214 654.3V226.7l298-101.6 298 101.6v427.6z' ], [secondaryColor, 'M521.9 358.8h97.9v41.6h-97.9z'], [ secondaryColor, 'M214 226.7v427.6l298 232.2 298-232.2V226.7L512 125.1 214 226.7zM413.3 656h-.2c0 4.4-3.6 8-8 8h-37.3c-4.4 0-8-3.6-8-8V471.4c-7.7 9.2-15.4 17.9-23.1 26a6.04 6.04 0 0 1-10.2-2.4l-13.2-43.5c-.6-2-.2-4.1 1.2-5.6 37-43.4 64.7-95.1 82.2-153.6 1.1-3.5 5-5.3 8.4-3.7l38.6 18.3c2.7 1.3 4.1 4.4 3.2 7.2a429.2 429.2 0 0 1-33.6 79V656zm257.9-340v127.2c0 4.4-3.6 8-8 8h-66.7v18.6h98.8c4.4 0 8 3.6 8 8v35.6c0 4.4-3.6 8-8 8h-59c18.1 29.1 41.8 54.3 72.3 76.9 2.6 2.1 3.2 5.9 1.2 8.5l-26.3 35.3a5.92 5.92 0 0 1-8.9.7c-30.6-29.3-56.8-65.2-78.1-106.9V656c0 4.4-3.6 8-8 8h-36.2c-4.4 0-8-3.6-8-8V536c-22 44.7-49 80.8-80.6 107.6a6.38 6.38 0 0 1-4.8 1.4c-1.7-.3-3.2-1.3-4.1-2.8L432 605.7a6 6 0 0 1 1.6-8.1c28.6-20.3 51.9-45.2 71-76h-55.1c-4.4 0-8-3.6-8-8V478c0-4.4 3.6-8 8-8h94.9v-18.6h-65.9c-4.4 0-8-3.6-8-8V316c0-4.4 3.6-8 8-8h184.7c4.4 0 8 3.6 8 8z' ], [ primaryColor, 'M443.7 306.9l-38.6-18.3c-3.4-1.6-7.3.2-8.4 3.7-17.5 58.5-45.2 110.2-82.2 153.6a5.7 5.7 0 0 0-1.2 5.6l13.2 43.5c1.4 4.5 7 5.8 10.2 2.4 7.7-8.1 15.4-16.8 23.1-26V656c0 4.4 3.6 8 8 8h37.3c4.4 0 8-3.6 8-8h.2V393.1a429.2 429.2 0 0 0 33.6-79c.9-2.8-.5-5.9-3.2-7.2zm26.8 9.1v127.4c0 4.4 3.6 8 8 8h65.9V470h-94.9c-4.4 0-8 3.6-8 8v35.6c0 4.4 3.6 8 8 8h55.1c-19.1 30.8-42.4 55.7-71 76a6 6 0 0 0-1.6 8.1l22.8 36.5c.9 1.5 2.4 2.5 4.1 2.8 1.7.3 3.5-.2 4.8-1.4 31.6-26.8 58.6-62.9 80.6-107.6v120c0 4.4 3.6 8 8 8h36.2c4.4 0 8-3.6 8-8V535.9c21.3 41.7 47.5 77.6 78.1 106.9 2.6 2.5 6.7 2.2 8.9-.7l26.3-35.3c2-2.6 1.4-6.4-1.2-8.5-30.5-22.6-54.2-47.8-72.3-76.9h59c4.4 0 8-3.6 8-8v-35.6c0-4.4-3.6-8-8-8h-98.8v-18.6h66.7c4.4 0 8-3.6 8-8V316c0-4.4-3.6-8-8-8H478.5c-4.4 0-8 3.6-8 8zm51.4 42.8h97.9v41.6h-97.9v-41.6z' ]); }); exports.LayoutTwoTone = getIcon('layout', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M384 185h456v136H384zm-200 0h136v656H184zm696-73H144c-17.7 0-32 14.3-32 32v1c0-17.7 14.3-32 32-32h736c17.7 0 32 14.3 32 32v-1c0-17.7-14.3-32-32-32zM384 385h456v456H384z' ], [ primaryColor, 'M880 113H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V145c0-17.7-14.3-32-32-32zM320 841H184V185h136v656zm520 0H384V385h456v456zm0-520H384V185h456v136z' ]); }); exports.LeftCircleTwoTone = getIcon('left-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm104 240.9c0 10.3-4.9 19.9-13.2 25.9L457.4 512l145.4 105.1c8.3 6 13.2 15.7 13.2 25.9v46.9c0 6.5-7.4 10.3-12.7 6.5l-246-178a7.95 7.95 0 0 1 0-12.9l246-178c5.3-3.8 12.7 0 12.7 6.5v46.9z' ], [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ primaryColor, 'M603.3 327.5l-246 178a7.95 7.95 0 0 0 0 12.9l246 178c5.3 3.8 12.7 0 12.7-6.5V643c0-10.2-4.9-19.9-13.2-25.9L457.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5z' ]); }); exports.LikeTwoTone = getIcon('like', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M273 495.9v428l.3-428zm538.2-88.3H496.8l9.6-198.4c.6-11.9-4.7-23.1-14.6-30.5-6.1-4.5-13.6-6.8-21.1-6.7-19.6.1-36.9 13.4-42.2 32.3-37.1 134.4-64.9 235.2-83.5 302.5V852h399.4a56.85 56.85 0 0 0 33.6-51.8c0-9.7-2.3-18.9-6.9-27.3l-13.9-25.4 21.9-19a56.76 56.76 0 0 0 19.6-43c0-9.7-2.3-18.9-6.9-27.3l-13.9-25.4 21.9-19a56.76 56.76 0 0 0 19.6-43c0-9.7-2.3-18.9-6.9-27.3l-14-25.5 21.9-19a56.76 56.76 0 0 0 19.6-43c0-19.1-11-37.5-28.8-48.4z' ], [ primaryColor, 'M112 528v364c0 17.7 14.3 32 32 32h65V496h-65c-17.7 0-32 14.3-32 32zm773.9 5.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.5-65.5-111a67.67 67.67 0 0 0-34.3-9.3H572.3l6-122.9c1.5-29.7-9-57.9-29.5-79.4a106.4 106.4 0 0 0-77.9-33.4c-52 0-98 35-111.8 85.1l-85.8 310.8-.3 428h472.1c9.3 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37zM820.4 499l-21.9 19 14 25.5a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.1 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.1 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H345V506.8c18.6-67.2 46.4-168 83.5-302.5a44.28 44.28 0 0 1 42.2-32.3c7.5-.1 15 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.1 32.2-19.6 43z' ]); }); exports.LeftSquareTwoTone = getIcon('left-square', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm181.3-334.5l246-178c5.3-3.8 12.7 0 12.7 6.5v46.9c0 10.3-4.9 19.9-13.2 25.9L465.4 512l145.4 105.2c8.3 6 13.2 15.7 13.2 25.9V690c0 6.5-7.4 10.3-12.7 6.4l-246-178a7.95 7.95 0 0 1 0-12.9z' ], [ primaryColor, 'M365.3 518.4l246 178c5.3 3.9 12.7.1 12.7-6.4v-46.9c0-10.2-4.9-19.9-13.2-25.9L465.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5l-246 178a7.95 7.95 0 0 0 0 12.9z' ]); }); exports.LockTwoTone = getIcon('lock', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304z' ], [ secondaryColor, 'M232 840h560V536H232v304zm280-226a48.01 48.01 0 0 1 28 87v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 0 1 28-87z' ], [ primaryColor, 'M484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 1 0-56 0z' ]); }); exports.MailTwoTone = getIcon('mail', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M477.5 536.3L135.9 270.7l-27.5-21.4 27.6 21.5V792h752V270.8L546.2 536.3a55.99 55.99 0 0 1-68.7 0z' ], [secondaryColor, 'M876.3 198.8l39.3 50.5-27.6 21.5 27.7-21.5-39.3-50.5z'], [ primaryColor, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-94.5 72.1L512 482 190.5 232.1h643zm54.5 38.7V792H136V270.8l-27.6-21.5 27.5 21.4 341.6 265.6a55.99 55.99 0 0 0 68.7 0L888 270.8l27.6-21.5-39.3-50.5h.1l39.3 50.5-27.7 21.5z' ]); }); exports.MedicineBoxTwoTone = getIcon('medicine-box', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M244.3 328L184 513.4V840h656V513.4L779.7 328H244.3zM660 628c0 4.4-3.6 8-8 8H544v108c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V636H372c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h108V464c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v108h108c4.4 0 8 3.6 8 8v48z' ], [ primaryColor, 'M652 572H544V464c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v108H372c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h108v108c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V636h108c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z' ], [ primaryColor, 'M839.2 278.1a32 32 0 0 0-30.4-22.1H736V144c0-17.7-14.3-32-32-32H320c-17.7 0-32 14.3-32 32v112h-72.8a31.9 31.9 0 0 0-30.4 22.1L112 502v378c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V502l-72.8-223.9zM360 184h304v72H360v-72zm480 656H184V513.4L244.3 328h535.4L840 513.4V840z' ]); }); exports.MessageTwoTone = getIcon('message', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M775.3 248.9a369.62 369.62 0 0 0-119-80A370.2 370.2 0 0 0 512.1 140h-1.7c-99.7.4-193 39.4-262.8 109.9-69.9 70.5-108 164.1-107.6 263.8.3 60.3 15.3 120.2 43.5 173.1l4.5 8.4V836h140.8l8.4 4.5c52.9 28.2 112.8 43.2 173.1 43.5h1.7c99 0 192-38.2 262.1-107.6 70.4-69.8 109.5-163.1 110.1-262.7.2-50.6-9.5-99.6-28.9-145.8a370.15 370.15 0 0 0-80-119zM312 560a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96zm200 0a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96zm200 0a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z' ], [ primaryColor, 'M664 512a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm-400 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0z' ], [ primaryColor, 'M925.2 338.4c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 0 0-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 0 0-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 0 0 112 714v152a46 46 0 0 0 46 46h152.1A449.4 449.4 0 0 0 510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 0 0 142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z' ], [primaryColor, 'M464 512a48 48 0 1 0 96 0 48 48 0 1 0-96 0z']); }); exports.MehTwoTone = getIcon('meh', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zM288 421a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm384 200c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h304c4.4 0 8 3.6 8 8v48zm16-152a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z' ], [ primaryColor, 'M288 421a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm376 144H360c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm-24-144a48 48 0 1 0 96 0 48 48 0 1 0-96 0z' ]); }); exports.MinusCircleTwoTone = getIcon('minus-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm192 396c0 4.4-3.6 8-8 8H328c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h368c4.4 0 8 3.6 8 8v48z' ], [ primaryColor, 'M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z' ]); }); exports.MinusSquareTwoTone = getIcon('minus-square', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm136-352c0-4.4 3.6-8 8-8h368c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H328c-4.4 0-8-3.6-8-8v-48z' ], [ primaryColor, 'M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z' ]); }); exports.MobileTwoTone = getIcon('mobile', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M744 64H280c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h464c35.3 0 64-28.7 64-64V128c0-35.3-28.7-64-64-64zm-8 824H288V136h448v752z' ], [ secondaryColor, 'M288 888h448V136H288v752zm224-142c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z' ], [primaryColor, 'M472 786a40 40 0 1 0 80 0 40 40 0 1 0-80 0z']); }); exports.MoneyCollectTwoTone = getIcon('money-collect', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M256 744.4l256 93.1 256-93.1V184H256v560.4zM359.7 313c1.2-.7 2.5-1 3.8-1h55.7a8 8 0 0 1 7.1 4.4L511 485.2h3.3L599 316.4c1.3-2.7 4.1-4.4 7.1-4.4h54.5c4.4 0 8 3.6 8.1 7.9 0 1.3-.4 2.6-1 3.8L564 515.3h57.6c4.4 0 8 3.6 8 8v27.1c0 4.4-3.6 8-8 8h-76.3v39h76.3c4.4 0 8 3.6 8 8v27.1c0 4.4-3.6 8-8 8h-76.3V704c0 4.4-3.6 8-8 8h-49.9c-4.4 0-8-3.6-8-8v-63.4h-76c-4.4 0-8-3.6-8-8v-27.1c0-4.4 3.6-8 8-8h76v-39h-76c-4.4 0-8-3.6-8-8v-27.1c0-4.4 3.6-8 8-8h57L356.5 323.8c-2.1-3.8-.7-8.7 3.2-10.8z' ], [ primaryColor, 'M911.5 700.7a8 8 0 0 0-10.3-4.8L840 718.2V180c0-37.6-30.4-68-68-68H252c-37.6 0-68 30.4-68 68v538.2l-61.3-22.3c-.9-.3-1.8-.5-2.7-.5-4.4 0-8 3.6-8 8V763c0 3.3 2.1 6.3 5.3 7.5L501 910.1c7.1 2.6 14.8 2.6 21.9 0l383.8-139.5c3.2-1.2 5.3-4.2 5.3-7.5v-59.6c0-1-.2-1.9-.5-2.8zM768 744.4l-256 93.1-256-93.1V184h512v560.4z' ], [ primaryColor, 'M460.4 515.4h-57c-4.4 0-8 3.6-8 8v27.1c0 4.4 3.6 8 8 8h76v39h-76c-4.4 0-8 3.6-8 8v27.1c0 4.4 3.6 8 8 8h76V704c0 4.4 3.6 8 8 8h49.9c4.4 0 8-3.6 8-8v-63.5h76.3c4.4 0 8-3.6 8-8v-27.1c0-4.4-3.6-8-8-8h-76.3v-39h76.3c4.4 0 8-3.6 8-8v-27.1c0-4.4-3.6-8-8-8H564l103.7-191.6c.6-1.2 1-2.5 1-3.8-.1-4.3-3.7-7.9-8.1-7.9h-54.5c-3 0-5.8 1.7-7.1 4.4l-84.7 168.8H511l-84.7-168.8a8 8 0 0 0-7.1-4.4h-55.7c-1.3 0-2.6.3-3.8 1-3.9 2.1-5.3 7-3.2 10.8l103.9 191.6z' ]); }); exports.NotificationTwoTone = getIcon('notification', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M229.6 678.1c-3.7 11.6-5.6 23.9-5.6 36.4 0-12.5 2-24.8 5.7-36.4h-.1zm76.3-260.2H184v188.2h121.9l12.9 5.2L840 820.7V203.3L318.8 412.7z' ], [ primaryColor, 'M880 112c-3.8 0-7.7.7-11.6 2.3L292 345.9H128c-8.8 0-16 7.4-16 16.6v299c0 9.2 7.2 16.6 16 16.6h101.7c-3.7 11.6-5.7 23.9-5.7 36.4 0 65.9 53.8 119.5 120 119.5 55.4 0 102.1-37.6 115.9-88.4l408.6 164.2c3.9 1.5 7.8 2.3 11.6 2.3 16.9 0 32-14.2 32-33.2V145.2C912 126.2 897 112 880 112zM344 762.3c-26.5 0-48-21.4-48-47.8 0-11.2 3.9-21.9 11-30.4l84.9 34.1c-2 24.6-22.7 44.1-47.9 44.1zm496 58.4L318.8 611.3l-12.9-5.2H184V417.9h121.9l12.9-5.2L840 203.3v617.4z' ]); }); exports.PhoneTwoTone = getIcon('phone', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M721.7 184.9L610.9 295.8l120.8 120.7-8 21.6A481.29 481.29 0 0 1 438 723.9l-21.6 8-.9-.9-119.8-120-110.8 110.9 104.5 104.5c10.8 10.7 26 15.7 40.8 13.2 117.9-19.5 235.4-82.9 330.9-178.4s158.9-213.1 178.4-331c2.5-14.8-2.5-30-13.3-40.8L721.7 184.9z' ], [ primaryColor, 'M877.1 238.7L770.6 132.3c-13-13-30.4-20.3-48.8-20.3s-35.8 7.2-48.8 20.3L558.3 246.8c-13 13-20.3 30.5-20.3 48.9 0 18.5 7.2 35.8 20.3 48.9l89.6 89.7a405.46 405.46 0 0 1-86.4 127.3c-36.7 36.9-79.6 66-127.2 86.6l-89.6-89.7c-13-13-30.4-20.3-48.8-20.3a68.2 68.2 0 0 0-48.8 20.3L132.3 673c-13 13-20.3 30.5-20.3 48.9 0 18.5 7.2 35.8 20.3 48.9l106.4 106.4c22.2 22.2 52.8 34.9 84.2 34.9 6.5 0 12.8-.5 19.2-1.6 132.4-21.8 263.8-92.3 369.9-198.3C818 606 888.4 474.6 910.4 342.1c6.3-37.6-6.3-76.3-33.3-103.4zm-37.6 91.5c-19.5 117.9-82.9 235.5-178.4 331s-213 158.9-330.9 178.4c-14.8 2.5-30-2.5-40.8-13.2L184.9 721.9 295.7 611l119.8 120 .9.9 21.6-8a481.29 481.29 0 0 0 285.7-285.8l8-21.6-120.8-120.7 110.8-110.9 104.5 104.5c10.8 10.8 15.8 26 13.3 40.8z' ]); }); exports.PauseCircleTwoTone = getIcon('pause-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm-80 524c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V360c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v304zm224 0c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V360c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v304z' ], [ primaryColor, 'M424 352h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V360c0-4.4-3.6-8-8-8zm224 0h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V360c0-4.4-3.6-8-8-8z' ]); }); exports.PictureTwoTone = getIcon('picture', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z' ], [ secondaryColor, 'M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z' ], [ secondaryColor, 'M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 1 1 0 176 88 88 0 0 1 0-176z' ], [secondaryColor, 'M276 368a28 28 0 1 0 56 0 28 28 0 1 0-56 0z'], [ primaryColor, 'M304 456a88 88 0 1 0 0-176 88 88 0 0 0 0 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z' ]); }); exports.PieChartTwoTone = getIcon('pie-chart', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M316.2 920.5c-47.6-20.1-90.4-49-127.1-85.7a398.19 398.19 0 0 1-85.7-127.1A397.12 397.12 0 0 1 72 552.2v.2a398.57 398.57 0 0 0 117 282.5c36.7 36.7 79.4 65.5 127 85.6A396.64 396.64 0 0 0 471.6 952c27 0 53.6-2.7 79.7-7.9-25.9 5.2-52.4 7.8-79.3 7.8-54 .1-106.4-10.5-155.8-31.4zM560 472c-4.4 0-8-3.6-8-8V79.9c0-1.3.3-2.5.9-3.6-.9 1.3-1.5 2.9-1.5 4.6v383.7c0 4.4 3.6 8 8 8l383.6-1c1.6 0 3.1-.5 4.4-1.3-1 .5-2.2.7-3.4.7l-384 1z' ], [ secondaryColor, 'M619.8 147.6v256.6l256.4-.7c-13-62.5-44.3-120.5-90-166.1a332.24 332.24 0 0 0-166.4-89.8z' ], [ secondaryColor, 'M438 221.7c-75.9 7.6-146.2 40.9-200.8 95.5C174.5 379.9 140 463.3 140 552s34.5 172.1 97.2 234.8c62.3 62.3 145.1 96.8 233.2 97.2 88.2.4 172.7-34.1 235.3-96.2C761 733 794.6 662.3 802.3 586H438V221.7z' ], [ primaryColor, 'M864 518H506V160c0-4.4-3.6-8-8-8h-26a398.46 398.46 0 0 0-282.8 117.1 398.19 398.19 0 0 0-85.7 127.1A397.61 397.61 0 0 0 72 552v.2c0 53.9 10.6 106.2 31.4 155.5 20.1 47.6 49 90.4 85.7 127.1 36.7 36.7 79.5 65.6 127.1 85.7A397.61 397.61 0 0 0 472 952c26.9 0 53.4-2.6 79.3-7.8 26.1-5.3 51.7-13.1 76.4-23.6 47.6-20.1 90.4-49 127.1-85.7 36.7-36.7 65.6-79.5 85.7-127.1A397.61 397.61 0 0 0 872 552v-26c0-4.4-3.6-8-8-8zM705.7 787.8A331.59 331.59 0 0 1 470.4 884c-88.1-.4-170.9-34.9-233.2-97.2C174.5 724.1 140 640.7 140 552s34.5-172.1 97.2-234.8c54.6-54.6 124.9-87.9 200.8-95.5V586h364.3c-7.7 76.3-41.3 147-96.6 201.8z' ], [ primaryColor, 'M952 462.4l-2.6-28.2c-8.5-92.1-49.4-179-115.2-244.6A399.4 399.4 0 0 0 589 74.6L560.7 72c-3.4-.3-6.4 1.5-7.8 4.3a8.7 8.7 0 0 0-.9 3.6V464c0 4.4 3.6 8 8 8l384-1c1.2 0 2.3-.3 3.4-.7a8.1 8.1 0 0 0 4.6-7.9zm-332.2-58.2V147.6a332.24 332.24 0 0 1 166.4 89.8c45.7 45.6 77 103.6 90 166.1l-256.4.7z' ]); }); exports.PlayCircleTwoTone = getIcon('play-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm164.1 378.2L457.7 677.1a8.02 8.02 0 0 1-12.7-6.5V353a8 8 0 0 1 12.7-6.5l218.4 158.8a7.9 7.9 0 0 1 0 12.9z' ], [ primaryColor, 'M676.1 505.3L457.7 346.5A8 8 0 0 0 445 353v317.6a8.02 8.02 0 0 0 12.7 6.5l218.4-158.9a7.9 7.9 0 0 0 0-12.9z' ]); }); exports.PlaySquareTwoTone = getIcon('play-square', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm240-484.7c0-9.4 10.9-14.7 18.3-8.8l199.4 156.7a11.2 11.2 0 0 1 0 17.6L442.3 677.6c-7.4 5.8-18.3.6-18.3-8.8V355.3z' ], [ primaryColor, 'M442.3 677.6l199.4-156.8a11.2 11.2 0 0 0 0-17.6L442.3 346.5c-7.4-5.9-18.3-.6-18.3 8.8v313.5c0 9.4 10.9 14.6 18.3 8.8z' ]); }); exports.PlusCircleTwoTone = getIcon('plus-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm192 396c0 4.4-3.6 8-8 8H544v152c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V544H328c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h152V328c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v152h152c4.4 0 8 3.6 8 8v48z' ], [ primaryColor, 'M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z' ]); }); exports.PlusSquareTwoTone = getIcon('plus-square', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm136-352c0-4.4 3.6-8 8-8h152V328c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v152h152c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H544v152c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V544H328c-4.4 0-8-3.6-8-8v-48z' ], [ primaryColor, 'M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z' ]); }); exports.PoundCircleTwoTone = getIcon('pound-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm146 582.1c0 4.4-3.6 8-8 8H376.2c-4.4 0-8-3.6-8-8v-38.5c0-3.7 2.5-6.9 6.1-7.8 44-10.9 72.8-49 72.8-94.2 0-14.7-2.5-29.4-5.9-44.2H374c-4.4 0-8-3.6-8-8v-30c0-4.4 3.6-8 8-8h53.7c-7.8-25.1-14.6-50.7-14.6-77.1 0-75.8 58.6-120.3 151.5-120.3 26.5 0 51.4 5.5 70.3 12.7 3.1 1.2 5.2 4.2 5.2 7.5v39.5a8 8 0 0 1-10.6 7.6c-17.9-6.4-39-10.5-60.4-10.5-53.3 0-87.3 26.6-87.3 70.2 0 24.7 6.2 47.9 13.4 70.5h112c4.4 0 8 3.6 8 8v30c0 4.4-3.6 8-8 8h-98.6c3.1 13.2 5.3 26.9 5.3 41 0 40.7-16.5 73.9-43.9 91.1v4.7h180c4.4 0 8 3.6 8 8v39.8z' ], [ primaryColor, 'M650 674.3H470v-4.7c27.4-17.2 43.9-50.4 43.9-91.1 0-14.1-2.2-27.8-5.3-41h98.6c4.4 0 8-3.6 8-8v-30c0-4.4-3.6-8-8-8h-112c-7.2-22.6-13.4-45.8-13.4-70.5 0-43.6 34-70.2 87.3-70.2 21.4 0 42.5 4.1 60.4 10.5a8 8 0 0 0 10.6-7.6v-39.5c0-3.3-2.1-6.3-5.2-7.5-18.9-7.2-43.8-12.7-70.3-12.7-92.9 0-151.5 44.5-151.5 120.3 0 26.4 6.8 52 14.6 77.1H374c-4.4 0-8 3.6-8 8v30c0 4.4 3.6 8 8 8h67.2c3.4 14.8 5.9 29.5 5.9 44.2 0 45.2-28.8 83.3-72.8 94.2-3.6.9-6.1 4.1-6.1 7.8v38.5c0 4.4 3.6 8 8 8H650c4.4 0 8-3.6 8-8v-39.8c0-4.4-3.6-8-8-8z' ]); }); exports.PrinterTwoTone = getIcon('printer', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M360 180h304v152H360zm492 220H172c-6.6 0-12 5.4-12 12v292h132V500h440v204h132V412c0-6.6-5.4-12-12-12zm-24 84c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-40c0-4.4 3.6-8 8-8h40c4.4 0 8 3.6 8 8v40z' ], [ primaryColor, 'M852 332H732V120c0-4.4-3.6-8-8-8H300c-4.4 0-8 3.6-8 8v212H172c-44.2 0-80 35.8-80 80v328c0 17.7 14.3 32 32 32h168v132c0 4.4 3.6 8 8 8h424c4.4 0 8-3.6 8-8V772h168c17.7 0 32-14.3 32-32V412c0-44.2-35.8-80-80-80zM360 180h304v152H360V180zm304 664H360V568h304v276zm200-140H732V500H292v204H160V412c0-6.6 5.4-12 12-12h680c6.6 0 12 5.4 12 12v292z' ], [ primaryColor, 'M820 436h-40c-4.4 0-8 3.6-8 8v40c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-40c0-4.4-3.6-8-8-8z' ]); }); exports.ProfileTwoTone = getIcon('profile', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm300-496c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H492c-4.4 0-8-3.6-8-8v-48zm0 144c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H492c-4.4 0-8-3.6-8-8v-48zm0 144c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H492c-4.4 0-8-3.6-8-8v-48zM380 328c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zm0 144c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zm0 144c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z' ], [ primaryColor, 'M340 656a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0-144a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0-144a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm152 320h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0-144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0-144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z' ]); }); exports.ProjectTwoTone = getIcon('project', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm472-560c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8v256c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8V280zm-192 0c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8V280zm-192 0c0-4.4 3.6-8 8-8h80c4.4 0 8 3.6 8 8v464c0 4.4-3.6 8-8 8h-80c-4.4 0-8-3.6-8-8V280z' ], [ primaryColor, 'M280 752h80c4.4 0 8-3.6 8-8V280c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8zm192-280h80c4.4 0 8-3.6 8-8V280c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8zm192 72h80c4.4 0 8-3.6 8-8V280c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v256c0 4.4 3.6 8 8 8z' ]); }); exports.PropertySafetyTwoTone = getIcon('property-safety', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM810 654.3L512 886.5 214 654.3V226.7l298-101.6 298 101.6v427.6z' ], [ secondaryColor, 'M214 226.7v427.6l298 232.2 298-232.2V226.7L512 125.1 214 226.7zM593.9 318h45c5.5 0 10 4.5 10 10 .1 1.7-.3 3.3-1.1 4.8l-87.7 161.1h45.7c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4v29.7h63.4c5.5 0 10 4.5 10 10v21.3c0 5.5-4.5 10-10 10h-63.4V658c0 5.5-4.5 10-10 10h-41.3c-5.5 0-10-4.5-10-10v-51.8H418c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h63.1v-29.7H418c-5.5 0-10-4.5-10-10v-21.3c0-5.5 4.5-10 10-10h45.2l-88-161.1c-2.6-4.8-.9-10.9 4-13.6 1.5-.8 3.1-1.2 4.8-1.2h46c3.8 0 7.2 2.1 8.9 5.5l72.9 144.3L585 323.5a10 10 0 0 1 8.9-5.5z' ], [ primaryColor, 'M438.9 323.5a9.88 9.88 0 0 0-8.9-5.5h-46c-1.7 0-3.3.4-4.8 1.2-4.9 2.7-6.6 8.8-4 13.6l88 161.1H418c-5.5 0-10 4.5-10 10v21.3c0 5.5 4.5 10 10 10h63.1v29.7H418c-5.5 0-10 4.5-10 10v21.3c0 5.5 4.5 10 10 10h63.1V658c0 5.5 4.5 10 10 10h41.3c5.5 0 10-4.5 10-10v-51.8h63.4c5.5 0 10-4.5 10-10v-21.3c0-5.5-4.5-10-10-10h-63.4v-29.7h63.4c5.5 0 10-4.5 10-10v-21.3c0-5.5-4.5-10-10-10h-45.7l87.7-161.1c.8-1.5 1.2-3.1 1.1-4.8 0-5.5-4.5-10-10-10h-45a10 10 0 0 0-8.9 5.5l-73.2 144.3-72.9-144.3z' ]); }); exports.QuestionCircleTwoTone = getIcon('question-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm0 632c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm62.9-219.5a48.3 48.3 0 0 0-30.9 44.8V620c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-21.5c0-23.1 6.7-45.9 19.9-64.9 12.9-18.6 30.9-32.8 52.1-40.9 34-13.1 56-41.6 56-72.7 0-44.1-43.1-80-96-80s-96 35.9-96 80v7.6c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V420c0-39.3 17.2-76 48.4-103.3C430.4 290.4 470 276 512 276s81.6 14.5 111.6 40.7C654.8 344 672 380.7 672 420c0 57.8-38.1 109.8-97.1 132.5z' ], [ primaryColor, 'M472 732a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm151.6-415.3C593.6 290.5 554 276 512 276s-81.6 14.4-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.2 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0 1 30.9-44.8c59-22.7 97.1-74.7 97.1-132.5 0-39.3-17.2-76-48.4-103.3z' ]); }); exports.PushpinTwoTone = getIcon('pushpin', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M474.8 357.7l-24.5 24.5-34.4-3.8c-9.6-1.1-19.3-1.6-28.9-1.6-29 0-57.5 4.7-84.7 14.1-14 4.8-27.4 10.8-40.3 17.9l353.1 353.3a259.92 259.92 0 0 0 30.4-153.9l-3.8-34.4 24.5-24.5L800 415.5 608.5 224 474.8 357.7z' ], [ primaryColor, 'M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 0 0-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 0 0-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 0 1-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z' ]); }); exports.ReconciliationTwoTone = getIcon('reconciliation', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M740 344H404V240H304v160h176c17.7 0 32 14.3 32 32v360h328V240H740v104zM584 448c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-56zm92 301c-50.8 0-92-41.2-92-92s41.2-92 92-92 92 41.2 92 92-41.2 92-92 92zm92-341v96c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-96c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8z' ], [secondaryColor, 'M642 657a34 34 0 1 0 68 0 34 34 0 1 0-68 0z'], [ primaryColor, 'M592 512h48c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm112-104v96c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-96c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8z' ], [ primaryColor, 'M880 168H668c0-30.9-25.1-56-56-56h-80c-30.9 0-56 25.1-56 56H264c-17.7 0-32 14.3-32 32v200h-88c-17.7 0-32 14.3-32 32v448c0 17.7 14.3 32 32 32h336c17.7 0 32-14.3 32-32v-16h368c17.7 0 32-14.3 32-32V200c0-17.7-14.3-32-32-32zm-412 64h72v-56h64v56h72v48H468v-48zm-20 616H176V616h272v232zm0-296H176v-88h272v88zm392 240H512V432c0-17.7-14.3-32-32-32H304V240h100v104h336V240h100v552z' ], [ primaryColor, 'M676 565c-50.8 0-92 41.2-92 92s41.2 92 92 92 92-41.2 92-92-41.2-92-92-92zm0 126c-18.8 0-34-15.2-34-34s15.2-34 34-34 34 15.2 34 34-15.2 34-34 34z' ]); }); exports.RedEnvelopeTwoTone = getIcon('red-envelope', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-40 824H232V193.1l260.3 204.1c11.6 9.1 27.9 9.1 39.5 0L792 193.1V888zm0-751.3h-31.7L512 331.3 263.7 136.7H232v-.7h560v.7z' ], [ secondaryColor, 'M492.3 397.2L232 193.1V888h560V193.1L531.8 397.2a31.99 31.99 0 0 1-39.5 0zm99.4 60.9h47.8a8.45 8.45 0 0 1 7.4 12.4l-87.2 161h45.9c4.6 0 8.4 3.8 8.4 8.4V665c0 4.6-3.8 8.4-8.4 8.4h-63.3V702h63.3c4.6 0 8.4 3.8 8.4 8.4v25c.2 4.7-3.5 8.5-8.2 8.5h-63.3v49.9c0 4.6-3.8 8.4-8.4 8.4h-43.7c-4.6 0-8.4-3.8-8.4-8.4v-49.9h-63c-4.6 0-8.4-3.8-8.4-8.4v-25.1c0-4.6 3.8-8.4 8.4-8.4h63v-28.6h-63c-4.6 0-8.4-3.8-8.4-8.4v-25.1c0-4.6 3.8-8.4 8.4-8.4h45.4L377 470.4a8.4 8.4 0 0 1 3.4-11.4c1.3-.6 2.6-1 3.9-1h48.8c3.2 0 6.1 1.8 7.5 4.6l71.7 142 71.9-141.9a8.6 8.6 0 0 1 7.5-4.6z' ], [secondaryColor, 'M232 136.7h31.7L512 331.3l248.3-194.6H792v-.7H232z'], [ primaryColor, 'M440.6 462.6a8.38 8.38 0 0 0-7.5-4.6h-48.8c-1.3 0-2.6.4-3.9 1a8.4 8.4 0 0 0-3.4 11.4l87.4 161.1H419c-4.6 0-8.4 3.8-8.4 8.4V665c0 4.6 3.8 8.4 8.4 8.4h63V702h-63c-4.6 0-8.4 3.8-8.4 8.4v25.1c0 4.6 3.8 8.4 8.4 8.4h63v49.9c0 4.6 3.8 8.4 8.4 8.4h43.7c4.6 0 8.4-3.8 8.4-8.4v-49.9h63.3c4.7 0 8.4-3.8 8.2-8.5v-25c0-4.6-3.8-8.4-8.4-8.4h-63.3v-28.6h63.3c4.6 0 8.4-3.8 8.4-8.4v-25.1c0-4.6-3.8-8.4-8.4-8.4h-45.9l87.2-161a8.45 8.45 0 0 0-7.4-12.4h-47.8c-3.1 0-6 1.8-7.5 4.6l-71.9 141.9-71.7-142z' ]); }); exports.RightCircleTwoTone = getIcon('right-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm154.7 378.4l-246 178c-5.3 3.8-12.7 0-12.7-6.5V643c0-10.2 4.9-19.9 13.2-25.9L566.6 512 421.2 406.8c-8.3-6-13.2-15.6-13.2-25.9V334c0-6.5 7.4-10.3 12.7-6.5l246 178c4.4 3.2 4.4 9.7 0 12.9z' ], [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ primaryColor, 'M666.7 505.5l-246-178c-5.3-3.8-12.7 0-12.7 6.5v46.9c0 10.3 4.9 19.9 13.2 25.9L566.6 512 421.2 617.1c-8.3 6-13.2 15.7-13.2 25.9v46.9c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.7 0-12.9z' ]); }); exports.RestTwoTone = getIcon('rest', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M326.4 844h363.2l44.3-520H282l44.4 520zM508 416c79.5 0 144 64.5 144 144s-64.5 144-144 144-144-64.5-144-144 64.5-144 144-144z' ], [ primaryColor, 'M508 704c79.5 0 144-64.5 144-144s-64.5-144-144-144-144 64.5-144 144 64.5 144 144 144zm0-224c44.2 0 80 35.8 80 80s-35.8 80-80 80-80-35.8-80-80 35.8-80 80-80z' ], [ primaryColor, 'M832 256h-28.1l-35.7-120.9c-4-13.7-16.5-23.1-30.7-23.1h-451c-14.3 0-26.8 9.4-30.7 23.1L220.1 256H192c-17.7 0-32 14.3-32 32v28c0 4.4 3.6 8 8 8h45.8l47.7 558.7a32 32 0 0 0 31.9 29.3h429.2a32 32 0 0 0 31.9-29.3L802.2 324H856c4.4 0 8-3.6 8-8v-28c0-17.7-14.3-32-32-32zm-518.6-76h397.2l22.4 76H291l22.4-76zm376.2 664H326.4L282 324h451.9l-44.3 520z' ]); }); exports.RocketTwoTone = getIcon('rocket', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M261.7 621.4c-9.4 14.6-17 30.3-22.5 46.6H324V558.7c-24.8 16.2-46 37.5-62.3 62.7zM700 558.7V668h84.8c-5.5-16.3-13.1-32-22.5-46.6a211.6 211.6 0 0 0-62.3-62.7zm-64-239.9l-124-147-124 147V668h248V318.8zM512 448a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z' ], [ primaryColor, 'M864 736c0-111.6-65.4-208-160-252.9V317.3c0-15.1-5.3-29.7-15.1-41.2L536.5 95.4C530.1 87.8 521 84 512 84s-18.1 3.8-24.5 11.4L335.1 276.1a63.97 63.97 0 0 0-15.1 41.2v165.8C225.4 528 160 624.4 160 736h156.5c-2.3 7.2-3.5 15-3.5 23.8 0 22.1 7.6 43.7 21.4 60.8a97.2 97.2 0 0 0 43.1 30.6c23.1 54 75.6 88.8 134.5 88.8 29.1 0 57.3-8.6 81.4-24.8 23.6-15.8 41.9-37.9 53-64a97 97 0 0 0 43.1-30.5 97.52 97.52 0 0 0 21.4-60.8c0-8.4-1.1-16.4-3.1-23.8L864 736zm-540-68h-84.8c5.5-16.3 13.1-32 22.5-46.6 16.3-25.2 37.5-46.5 62.3-62.7V668zm64-184.9V318.8l124-147 124 147V668H388V483.1zm240.1 301.1c-5.2 3-11.2 4.2-17.1 3.4l-19.5-2.4-2.8 19.4c-5.4 37.9-38.4 66.5-76.7 66.5s-71.3-28.6-76.7-66.5l-2.8-19.5-19.5 2.5a27.7 27.7 0 0 1-17.1-3.5c-8.7-5-14.1-14.3-14.1-24.4 0-10.6 5.9-19.4 14.6-23.8h231.3c8.8 4.5 14.6 13.3 14.6 23.8-.1 10.2-5.5 19.6-14.2 24.5zM700 668V558.7a211.6 211.6 0 0 1 62.3 62.7c9.4 14.6 17 30.3 22.5 46.6H700z' ], [primaryColor, 'M464 400a48 48 0 1 0 96 0 48 48 0 1 0-96 0z']); }); exports.RightSquareTwoTone = getIcon('right-square', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm216-196.9c0-10.2 4.9-19.9 13.2-25.9L558.6 512 413.2 406.8c-8.3-6-13.2-15.6-13.2-25.9V334c0-6.5 7.4-10.3 12.7-6.5l246 178c4.4 3.2 4.4 9.7 0 12.9l-246 178c-5.3 3.9-12.7.1-12.7-6.4v-46.9z' ], [ primaryColor, 'M412.7 696.4l246-178c4.4-3.2 4.4-9.7 0-12.9l-246-178c-5.3-3.8-12.7 0-12.7 6.5v46.9c0 10.3 4.9 19.9 13.2 25.9L558.6 512 413.2 617.2c-8.3 6-13.2 15.7-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.4z' ]); }); exports.SaveTwoTone = getIcon('save', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M704 320c0 17.7-14.3 32-32 32H352c-17.7 0-32-14.3-32-32V184H184v656h656V341.8l-136-136V320zM512 730c-79.5 0-144-64.5-144-144s64.5-144 144-144 144 64.5 144 144-64.5 144-144 144z' ], [ primaryColor, 'M512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z' ], [ primaryColor, 'M893.3 293.3L730.7 130.7c-.7-.7-1.4-1.3-2.1-2-.1-.1-.3-.2-.4-.3-.7-.7-1.5-1.3-2.2-1.9a64 64 0 0 0-22-11.7V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840z' ]); }); exports.ScheduleTwoTone = getIcon('schedule', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M768 352c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-56H548v56c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-56H328v56c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-56H136v496h752V296H768v56zM424 688c0 4.4-3.6 8-8 8H232c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48zm0-136c0 4.4-3.6 8-8 8H232c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48zm374.4-91.2l-165 228.7a15.9 15.9 0 0 1-25.8 0L493.5 531.3c-3.8-5.3 0-12.7 6.5-12.7h54.9c5.1 0 9.9 2.4 12.9 6.6l52.8 73.1 103.6-143.7c3-4.1 7.8-6.6 12.8-6.5h54.9c6.5 0 10.3 7.4 6.5 12.7z' ], [ primaryColor, 'M724.2 454.6L620.6 598.3l-52.8-73.1c-3-4.2-7.8-6.6-12.9-6.6H500c-6.5 0-10.3 7.4-6.5 12.7l114.1 158.2a15.9 15.9 0 0 0 25.8 0l165-228.7c3.8-5.3 0-12.7-6.5-12.7H737c-5-.1-9.8 2.4-12.8 6.5zM416 496H232c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z' ], [ primaryColor, 'M928 224H768v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H548v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H328v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H96c-17.7 0-32 14.3-32 32v576c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V256c0-17.7-14.3-32-32-32zm-40 568H136V296h120v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h148v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h148v56c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-56h120v496z' ], [ primaryColor, 'M416 632H232c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z' ]); }); exports.SafetyCertificateTwoTone = getIcon('safety-certificate', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM810 654.3L512 886.5 214 654.3V226.7l298-101.6 298 101.6v427.6z' ], [ secondaryColor, 'M214 226.7v427.6l298 232.2 298-232.2V226.7L512 125.1 214 226.7zM632.8 328H688c6.5 0 10.3 7.4 6.5 12.7L481.9 633.4a16.1 16.1 0 0 1-26 0l-126.4-174c-3.8-5.3 0-12.7 6.5-12.7h55.2c5.2 0 10 2.5 13 6.6l64.7 89.1 150.9-207.8c3-4.1 7.9-6.6 13-6.6z' ], [ primaryColor, 'M404.2 453.3c-3-4.1-7.8-6.6-13-6.6H336c-6.5 0-10.3 7.4-6.5 12.7l126.4 174a16.1 16.1 0 0 0 26 0l212.6-292.7c3.8-5.3 0-12.7-6.5-12.7h-55.2c-5.1 0-10 2.5-13 6.6L468.9 542.4l-64.7-89.1z' ]); }); exports.SecurityScanTwoTone = getIcon('security-scan', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M866.9 169.9L527.1 54.1C523 52.7 517.5 52 512 52s-11 .7-15.1 2.1L157.1 169.9c-8.3 2.8-15.1 12.4-15.1 21.2v482.4c0 8.8 5.7 20.4 12.6 25.9L499.3 968c3.5 2.7 8 4.1 12.6 4.1s9.2-1.4 12.6-4.1l344.7-268.6c6.9-5.4 12.6-17 12.6-25.9V191.1c.2-8.8-6.6-18.3-14.9-21.2zM810 654.3L512 886.5 214 654.3V226.7l298-101.6 298 101.6v427.6z' ], [ secondaryColor, 'M460.7 451.1a80.1 80.1 0 1 0 160.2 0 80.1 80.1 0 1 0-160.2 0z' ], [ secondaryColor, 'M214 226.7v427.6l298 232.2 298-232.2V226.7L512 125.1 214 226.7zm428.7 122.5c56.3 56.3 56.3 147.5 0 203.8-48.5 48.5-123 55.2-178.6 20.1l-77.5 77.5a8.03 8.03 0 0 1-11.3 0l-34-34a8.03 8.03 0 0 1 0-11.3l77.5-77.5c-35.1-55.7-28.4-130.1 20.1-178.6 56.3-56.3 147.5-56.3 203.8 0z' ], [ primaryColor, 'M418.8 527.8l-77.5 77.5a8.03 8.03 0 0 0 0 11.3l34 34c3.1 3.1 8.2 3.1 11.3 0l77.5-77.5c55.6 35.1 130.1 28.4 178.6-20.1 56.3-56.3 56.3-147.5 0-203.8-56.3-56.3-147.5-56.3-203.8 0-48.5 48.5-55.2 122.9-20.1 178.6zm65.4-133.3a80.1 80.1 0 0 1 113.3 0 80.1 80.1 0 0 1 0 113.3c-31.3 31.3-82 31.3-113.3 0s-31.3-82 0-113.3z' ]); }); exports.SettingTwoTone = getIcon('setting', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M859.3 569.7l.2.1c3.1-18.9 4.6-38.2 4.6-57.3 0-17.1-1.3-34.3-3.7-51.1 2.4 16.7 3.6 33.6 3.6 50.5 0 19.4-1.6 38.8-4.7 57.8zM99 398.1c-.5-.4-.9-.8-1.4-1.3.7.7 1.4 1.4 2.2 2.1l65.5 55.9v-.1L99 398.1zm536.6-216h.1l-15.5-83.8c-.2-1-.4-1.9-.7-2.8.1.5.3 1.1.4 1.6l15.7 85zm54 546.5l31.4-25.8 92.8 32.9c17-22.9 31.3-47.5 42.6-73.6l-74.7-63.9 6.6-40.1c2.5-15.1 3.8-30.6 3.8-46.1s-1.3-31-3.8-46.1l-6.5-39.9 74.7-63.9c-11.4-26-25.6-50.7-42.6-73.6l-92.8 32.9-31.4-25.8c-23.9-19.6-50.6-35-79.3-45.8l-38.1-14.3-17.9-97a377.5 377.5 0 0 0-85 0l-17.9 97.2-37.9 14.3c-28.5 10.8-55 26.2-78.7 45.7l-31.4 25.9-93.4-33.2c-17 22.9-31.3 47.5-42.6 73.6l75.5 64.5-6.5 40c-2.5 14.9-3.7 30.2-3.7 45.5 0 15.2 1.3 30.6 3.7 45.5l6.5 40-75.5 64.5c11.4 26 25.6 50.7 42.6 73.6l93.4-33.2 31.4 25.9c23.7 19.5 50.2 34.9 78.7 45.7l37.8 14.5 17.9 97.2c28.2 3.2 56.9 3.2 85 0l17.9-97 38.1-14.3c28.8-10.8 55.4-26.2 79.3-45.8zm-177.1-50.3c-30.5 0-59.2-7.8-84.3-21.5C373.3 627 336 568.9 336 502c0-97.2 78.8-176 176-176 66.9 0 125 37.3 154.8 92.2 13.7 25 21.5 53.7 21.5 84.3 0 97.1-78.7 175.8-175.8 175.8zM207.2 812.8c-5.5 1.9-11.2 2.3-16.6 1.2 5.7 1.2 11.7 1 17.5-1l81.4-29c-.1-.1-.3-.2-.4-.3l-81.9 29.1zm717.6-414.7l-65.5 56c0 .2.1.5.1.7l65.4-55.9c7.1-6.1 11.1-14.9 11.2-24-.3 8.8-4.3 17.3-11.2 23.2z' ], [ secondaryColor, 'M935.8 646.6c.5 4.7 0 9.5-1.7 14.1l-.9 2.6a446.02 446.02 0 0 1-79.7 137.9l-1.8 2.1a32 32 0 0 1-35.1 9.5l-81.3-28.9a350 350 0 0 1-99.7 57.6l-15.7 85a32.05 32.05 0 0 1-25.8 25.7l-2.7.5a445.2 445.2 0 0 1-79.2 7.1h.3c26.7 0 53.4-2.4 79.4-7.1l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-84.9c36.2-13.6 69.6-32.9 99.6-57.5l81.2 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.5-87.4 79.6-137.7l.9-2.6c1.6-4.7 2.1-9.7 1.5-14.5z' ], [ primaryColor, 'M688 502c0-30.3-7.7-58.9-21.2-83.8C637 363.3 578.9 326 512 326c-97.2 0-176 78.8-176 176 0 66.9 37.3 125 92.2 154.8 24.9 13.5 53.4 21.2 83.8 21.2 97.2 0 176-78.8 176-176zm-288 0c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 0 1 624 502c0 29.9-11.7 58-32.8 79.2A111.6 111.6 0 0 1 512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 502z' ], [ primaryColor, 'M594.1 952.2a32.05 32.05 0 0 0 25.8-25.7l15.7-85a350 350 0 0 0 99.7-57.6l81.3 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c1.7-4.6 2.2-9.4 1.7-14.1-.9-7.9-4.7-15.4-11-20.9l-65.3-55.9-.2-.1c3.1-19 4.7-38.4 4.7-57.8 0-16.9-1.2-33.9-3.6-50.5-.3-2.2-.7-4.4-1-6.6 0-.2-.1-.5-.1-.7l65.5-56c6.9-5.9 10.9-14.4 11.2-23.2.1-4-.5-8.1-1.9-12l-.9-2.6a443.74 443.74 0 0 0-79.7-137.9l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.3 28.9c-30-24.6-63.4-44-99.6-57.6h-.1l-15.7-85c-.1-.5-.2-1.1-.4-1.6a32.08 32.08 0 0 0-25.4-24.1l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.4a351.86 351.86 0 0 0-99 57.4l-81.9-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a446.02 446.02 0 0 0-79.7 137.9l-.9 2.6a32.09 32.09 0 0 0 7.9 33.9c.5.4.9.9 1.4 1.3l66.3 56.6v.1c-3.1 18.8-4.6 37.9-4.6 57 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1c4.9 5.7 11.4 9.4 18.5 10.7 5.4 1 11.1.7 16.6-1.2l81.9-29.1c.1.1.3.2.4.3 29.7 24.3 62.8 43.6 98.6 57.1l15.8 85.4a32.05 32.05 0 0 0 25.8 25.7l2.7.5c26.1 4.7 52.8 7.1 79.5 7.1h.3c26.6 0 53.3-2.4 79.2-7.1l2.7-.5zm-39.8-66.5a377.5 377.5 0 0 1-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 0 1-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97z' ]); }); exports.ShopTwoTone = getIcon('shop', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M839.5 344h-655c-.3 0-.5.2-.5.5v91.2c0 59.8 49 108.3 109.3 108.3 40.7 0 76.2-22 95.1-54.7 2.9-5.1 8.4-8.3 14.3-8.3s11.3 3.2 14.3 8.3c18.8 32.7 54.3 54.7 95 54.7 40.8 0 76.4-22.1 95.1-54.9 2.9-5 8.2-8.1 13.9-8.1h.6c5.8 0 11 3.1 13.9 8.1 18.8 32.8 54.4 54.9 95.2 54.9C791 544 840 495.5 840 435.7v-91.2c0-.3-.2-.5-.5-.5z' ], [ primaryColor, 'M882 272.1V144c0-17.7-14.3-32-32-32H174c-17.7 0-32 14.3-32 32v128.1c-16.7 1-30 14.9-30 31.9v131.7a177 177 0 0 0 14.4 70.4c4.3 10.2 9.6 19.8 15.6 28.9v345c0 17.6 14.3 32 32 32h676c17.7 0 32-14.3 32-32V535a175 175 0 0 0 15.6-28.9c9.5-22.3 14.4-46 14.4-70.4V304c0-17-13.3-30.9-30-31.9zM214 184h596v88H214v-88zm362 656.1H448V736h128v104.1zm234.4 0H640V704c0-17.7-14.3-32-32-32H416c-17.7 0-32 14.3-32 32v136.1H214V597.9c2.9 1.4 5.9 2.8 9 4 22.3 9.4 46 14.1 70.4 14.1 24.4 0 48-4.7 70.4-14.1 13.8-5.8 26.8-13.2 38.7-22.1.2-.1.4-.1.6 0a180.4 180.4 0 0 0 38.7 22.1c22.3 9.4 46 14.1 70.4 14.1s48-4.7 70.4-14.1c13.8-5.8 26.8-13.2 38.7-22.1.2-.1.4-.1.6 0a180.4 180.4 0 0 0 38.7 22.1c22.3 9.4 46 14.1 70.4 14.1s48-4.7 70.4-14.1c3-1.3 6-2.6 9-4v242.2zM840 435.7c0 59.8-49 108.3-109.3 108.3-40.8 0-76.4-22.1-95.2-54.9-2.9-5-8.1-8.1-13.9-8.1h-.6c-5.7 0-11 3.1-13.9 8.1A109.24 109.24 0 0 1 512 544c-40.7 0-76.2-22-95-54.7-3-5.1-8.4-8.3-14.3-8.3s-11.4 3.2-14.3 8.3a109.63 109.63 0 0 1-95.1 54.7C233 544 184 495.5 184 435.7v-91.2c0-.3.2-.5.5-.5h655c.3 0 .5.2.5.5v91.2z' ]); }); exports.ShoppingTwoTone = getIcon('shopping', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M696 472c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-88H400v88c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-88h-96v456h560V384h-96v88z' ], [ primaryColor, 'M832 312H696v-16c0-101.6-82.4-184-184-184s-184 82.4-184 184v16H192c-17.7 0-32 14.3-32 32v536c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V344c0-17.7-14.3-32-32-32zm-432-16c0-61.9 50.1-112 112-112s112 50.1 112 112v16H400v-16zm392 544H232V384h96v88c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-88h224v88c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-88h96v456z' ]); }); exports.SlidersTwoTone = getIcon('sliders', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M180 292h80v440h-80zm369 180h-74a3 3 0 0 0-3 3v74a3 3 0 0 0 3 3h74a3 3 0 0 0 3-3v-74a3 3 0 0 0-3-3zm215-108h80v296h-80z' ], [ primaryColor, 'M904 296h-66v-96c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v96h-66c-4.4 0-8 3.6-8 8v416c0 4.4 3.6 8 8 8h66v96c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-96h66c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8zm-60 364h-80V364h80v296zM612 404h-66V232c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v172h-66c-4.4 0-8 3.6-8 8v200c0 4.4 3.6 8 8 8h66v172c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8V620h66c4.4 0 8-3.6 8-8V412c0-4.4-3.6-8-8-8zm-60 145a3 3 0 0 1-3 3h-74a3 3 0 0 1-3-3v-74a3 3 0 0 1 3-3h74a3 3 0 0 1 3 3v74zM320 224h-66v-56c0-4.4-3.6-8-8-8h-52c-4.4 0-8 3.6-8 8v56h-66c-4.4 0-8 3.6-8 8v560c0 4.4 3.6 8 8 8h66v56c0 4.4 3.6 8 8 8h52c4.4 0 8-3.6 8-8v-56h66c4.4 0 8-3.6 8-8V232c0-4.4-3.6-8-8-8zm-60 508h-80V292h80v440z' ]); }); exports.SmileTwoTone = getIcon('smile', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zM288 421a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm224 272c-85.5 0-155.6-67.3-160-151.6a8 8 0 0 1 8-8.4h48.1c4.2 0 7.8 3.2 8.1 7.4C420 589.9 461.5 629 512 629s92.1-39.1 95.8-88.6c.3-4.2 3.9-7.4 8.1-7.4H664a8 8 0 0 1 8 8.4C667.6 625.7 597.5 693 512 693zm176-224a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z' ], [ primaryColor, 'M288 421a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm376 112h-48.1c-4.2 0-7.8 3.2-8.1 7.4-3.7 49.5-45.3 88.6-95.8 88.6s-92-39.1-95.8-88.6c-.3-4.2-3.9-7.4-8.1-7.4H360a8 8 0 0 0-8 8.4c4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6a8 8 0 0 0-8-8.4zm-24-112a48 48 0 1 0 96 0 48 48 0 1 0-96 0z' ]); }); exports.SkinTwoTone = getIcon('skin', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 318c-79.2 0-148.5-48.8-176.7-120H182v196h119v432h422V394h119V198H688.7c-28.2 71.2-97.5 120-176.7 120z' ], [ primaryColor, 'M870 126H663.8c-17.4 0-32.9 11.9-37 29.3C614.3 208.1 567 246 512 246s-102.3-37.9-114.8-90.7a37.93 37.93 0 0 0-37-29.3H154a44 44 0 0 0-44 44v252a44 44 0 0 0 44 44h75v388a44 44 0 0 0 44 44h478a44 44 0 0 0 44-44V466h75a44 44 0 0 0 44-44V170a44 44 0 0 0-44-44zm-28 268H723v432H301V394H182V198h153.3c28.2 71.2 97.5 120 176.7 120s148.5-48.8 176.7-120H842v196z' ]); }); exports.SoundTwoTone = getIcon('sound', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M275.4 424H146v176h129.4l18 11.7L586 803V221L293.3 412.3z' ], [ primaryColor, 'M892.1 737.8l-110.3-63.7a15.9 15.9 0 0 0-21.7 5.9l-19.9 34.5c-4.4 7.6-1.8 17.4 5.8 21.8L856.3 800a15.9 15.9 0 0 0 21.7-5.9l19.9-34.5c4.4-7.6 1.7-17.4-5.8-21.8zM934 476H806c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16h128c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16zM760 344a15.9 15.9 0 0 0 21.7 5.9L892 286.2c7.6-4.4 10.2-14.2 5.8-21.8L878 230a15.9 15.9 0 0 0-21.7-5.9L746 287.8a15.99 15.99 0 0 0-5.8 21.8L760 344zM625.9 115c-5.9 0-11.9 1.6-17.4 5.3L254 352H90c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h164l354.5 231.7c5.5 3.6 11.6 5.3 17.4 5.3 16.7 0 32.1-13.3 32.1-32.1V147.1c0-18.8-15.4-32.1-32.1-32.1zM586 803L293.4 611.7l-18-11.7H146V424h129.4l17.9-11.7L586 221v582z' ]); }); exports.StarTwoTone = getIcon('star', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512.5 190.4l-94.4 191.3-211.2 30.7 152.8 149-36.1 210.3 188.9-99.3 188.9 99.2-36.1-210.3 152.8-148.9-211.2-30.7z' ], [ primaryColor, 'M908.6 352.8l-253.9-36.9L541.2 85.8c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L370.3 315.9l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 0 0 .6 45.3l183.7 179.1L239 839.4a31.95 31.95 0 0 0 46.4 33.7l227.1-119.4 227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM665.3 561.3l36.1 210.3-188.9-99.2-188.9 99.3 36.1-210.3-152.8-149 211.2-30.7 94.4-191.3 94.4 191.3 211.2 30.7-152.8 148.9z' ]); }); exports.SnippetsTwoTone = getIcon('snippets', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M450 510V336H232v552h432V550H490c-22.1 0-40-17.9-40-40z' ], [ primaryColor, 'M832 112H724V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H500V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H320c-17.7 0-32 14.3-32 32v120h-96c-17.7 0-32 14.3-32 32v632c0 17.7 14.3 32 32 32h512c17.7 0 32-14.3 32-32v-96h96c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM664 888H232V336h218v174c0 22.1 17.9 40 40 40h174v338zm0-402H514V336h.2L664 485.8v.2zm128 274h-56V456L544 264H360v-80h68v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h152v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h68v576z' ]); }); exports.SwitcherTwoTone = getIcon('switcher', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [secondaryColor, 'M184 840h528V312H184v528zm116-290h296v64H300v-64z'], [ primaryColor, 'M880 112H264c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h576v576c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32z' ], [ primaryColor, 'M752 240H144c-17.7 0-32 14.3-32 32v608c0 17.7 14.3 32 32 32h608c17.7 0 32-14.3 32-32V272c0-17.7-14.3-32-32-32zm-40 600H184V312h528v528z' ], [primaryColor, 'M300 550h296v64H300z']); }); exports.TabletTwoTone = getIcon('tablet', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M800 64H224c-35.3 0-64 28.7-64 64v768c0 35.3 28.7 64 64 64h576c35.3 0 64-28.7 64-64V128c0-35.3-28.7-64-64-64zm-8 824H232V136h560v752z' ], [ secondaryColor, 'M232 888h560V136H232v752zm280-144c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z' ], [primaryColor, 'M472 784a40 40 0 1 0 80 0 40 40 0 1 0-80 0z']); }); exports.StopTwoTone = getIcon('stop', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm288.5 682.8L277.7 224C258 240 240 258 224 277.7l522.8 522.8C682.8 852.7 601 884 512 884c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372c0 89-31.3 170.8-83.5 234.8z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372c89 0 170.8-31.3 234.8-83.5L224 277.7c16-19.7 34-37.7 53.7-53.7l522.8 522.8C852.7 682.8 884 601 884 512c0-205.4-166.6-372-372-372z' ]); }); exports.TagsTwoTone = getIcon('tags', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M477.5 694l311.9-311.8-19-224.6-224.6-19-311.9 311.9L477.5 694zm116-415.5a47.81 47.81 0 0 1 33.9-33.9c16.6-4.4 34.2.3 46.4 12.4a47.93 47.93 0 0 1 12.4 46.4 47.81 47.81 0 0 1-33.9 33.9c-16.6 4.4-34.2-.3-46.4-12.4a48.3 48.3 0 0 1-12.4-46.4z' ], [ secondaryColor, 'M476.6 792.6c-1.7-.2-3.4-1-4.7-2.3L137.7 456.1a8.03 8.03 0 0 1 0-11.3L515.9 66.6c1.2-1.3 2.9-2.1 4.7-2.3h-.4c-2.3-.2-4.7.6-6.3 2.3L135.7 444.8a8.03 8.03 0 0 0 0 11.3l334.2 334.2c1.8 1.9 4.3 2.6 6.7 2.3z' ], [ primaryColor, 'M889.7 539.8l-39.6-39.5a8.03 8.03 0 0 0-11.3 0l-362 361.3-237.6-237a8.03 8.03 0 0 0-11.3 0l-39.6 39.5a8.03 8.03 0 0 0 0 11.3l243.2 242.8 39.6 39.5c3.1 3.1 8.2 3.1 11.3 0l407.3-406.6c3.1-3.1 3.1-8.2 0-11.3zM652.3 337.3a47.81 47.81 0 0 0 33.9-33.9c4.4-16.6-.3-34.2-12.4-46.4a47.93 47.93 0 0 0-46.4-12.4 47.81 47.81 0 0 0-33.9 33.9c-4.4 16.6.3 34.2 12.4 46.4a48.3 48.3 0 0 0 46.4 12.4z' ], [ primaryColor, 'M137.7 444.8a8.03 8.03 0 0 0 0 11.3l334.2 334.2c1.3 1.3 2.9 2.1 4.7 2.3 2.4.3 4.8-.5 6.6-2.3L861.4 412c1.7-1.7 2.5-4 2.3-6.3l-25.5-301.4c-.7-7.8-6.8-13.9-14.6-14.6L522.2 64.3h-1.6c-1.8.2-3.4 1-4.7 2.3L137.7 444.8zm408.1-306.2l224.6 19 19 224.6L477.5 694 233.9 450.5l311.9-311.9z' ]); }); exports.ToolTwoTone = getIcon('tool', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M706.8 488.7a32.05 32.05 0 0 1-45.3 0L537 364.2a32.05 32.05 0 0 1 0-45.3l132.9-132.8a184.2 184.2 0 0 0-144 53.5c-58.1 58.1-69.3 145.3-33.6 214.6L439.5 507c-.1 0-.1-.1-.1-.1L209.3 737l79.2 79.2 274-274.1.1.1 8.8-8.8c69.3 35.7 156.5 24.5 214.6-33.6 39.2-39.1 57.3-92.1 53.6-143.9L706.8 488.7z' ], [ primaryColor, 'M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 0 1 144-53.5L537 318.9a32.05 32.05 0 0 0 0 45.3l124.5 124.5a32.05 32.05 0 0 0 45.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z' ]); }); exports.TagTwoTone = getIcon('tag', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M589 164.6L189.3 564.3l270.4 270.4L859.4 435 836 188l-247-23.4zM680 432c-48.5 0-88-39.5-88-88s39.5-88 88-88 88 39.5 88 88-39.5 88-88 88z' ], [ primaryColor, 'M680 256c-48.5 0-88 39.5-88 88s39.5 88 88 88 88-39.5 88-88-39.5-88-88-88zm0 120c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z' ], [ primaryColor, 'M938 458.8l-29.6-312.6c-1.5-16.2-14.4-29-30.6-30.6L565.2 86h-.4c-3.2 0-5.7 1-7.6 2.9L88.9 557.2a9.96 9.96 0 0 0 0 14.1l363.8 363.8a9.9 9.9 0 0 0 7.1 2.9c2.7 0 5.2-1 7.1-2.9l468.3-468.3c2-2.1 3-5 2.8-8zM459.7 834.7L189.3 564.3 589 164.6 836 188l23.4 247-399.7 399.7z' ]); }); exports.ThunderboltTwoTone = getIcon('thunderbolt', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M695.4 164.1H470.8L281.2 491.5h157.4l-60.3 241 319.8-305.1h-211z' ], [ primaryColor, 'M848.1 359.3H627.8L825.9 109c4.1-5.3.4-13-6.3-13H436.1c-2.8 0-5.5 1.5-6.9 4L170.1 547.5c-3.1 5.3.7 12 6.9 12h174.4L262 917.1c-1.9 7.8 7.5 13.3 13.3 7.7L853.6 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.3 732.5l60.3-241H281.2l189.6-327.4h224.6L487.1 427.4h211L378.3 732.5z' ]); }); exports.TrademarkCircleTwoTone = getIcon('trademark-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm170.7 584.2c-1.1.5-2.3.8-3.5.8h-62c-3.1 0-5.9-1.8-7.2-4.6l-74.6-159.2h-88.7V717c0 4.4-3.6 8-8 8H384c-4.4 0-8-3.6-8-8V307c0-4.4 3.6-8 8-8h155.6c98.8 0 144.2 59.9 144.2 131.1 0 70.2-43.6 106.4-78.4 119.2l80.8 164.2c2.1 3.9.4 8.7-3.5 10.7z' ], [ secondaryColor, 'M529.9 357h-83.4v148H528c53 0 82.8-25.6 82.8-72.4 0-50.3-32.9-75.6-80.9-75.6z' ], [ primaryColor, 'M605.4 549.3c34.8-12.8 78.4-49 78.4-119.2 0-71.2-45.4-131.1-144.2-131.1H384c-4.4 0-8 3.6-8 8v410c0 4.4 3.6 8 8 8h54.7c4.4 0 8-3.6 8-8V561.2h88.7L610 720.4c1.3 2.8 4.1 4.6 7.2 4.6h62c1.2 0 2.4-.3 3.5-.8 3.9-2 5.6-6.8 3.5-10.7l-80.8-164.2zM528 505h-81.5V357h83.4c48 0 80.9 25.3 80.9 75.6 0 46.8-29.8 72.4-82.8 72.4z' ]); }); exports.TrophyTwoTone = getIcon('trophy', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M320 480c0 49.1 19.1 95.3 53.9 130.1 34.7 34.8 81 53.9 130.1 53.9h16c49.1 0 95.3-19.1 130.1-53.9 34.8-34.7 53.9-81 53.9-130.1V184H320v296zM184 352c0 41 26.9 75.8 64 87.6-37.1-11.9-64-46.7-64-87.6zm364 382.5C665 721.8 758.4 630.2 773.8 514 758.3 630.2 665 721.7 548 734.5zM250.2 514C265.6 630.2 359 721.8 476 734.5 359 721.7 265.7 630.2 250.2 514z' ], [ primaryColor, 'M868 160h-92v-40c0-4.4-3.6-8-8-8H256c-4.4 0-8 3.6-8 8v40h-92a44 44 0 0 0-44 44v148c0 81.7 60 149.6 138.2 162C265.7 630.2 359 721.7 476 734.5v105.2H280c-17.7 0-32 14.3-32 32V904c0 4.4 3.6 8 8 8h512c4.4 0 8-3.6 8-8v-32.3c0-17.7-14.3-32-32-32H548V734.5C665 721.7 758.3 630.2 773.8 514 852 501.6 912 433.7 912 352V204a44 44 0 0 0-44-44zM248 439.6a91.99 91.99 0 0 1-64-87.6V232h64v207.6zM704 480c0 49.1-19.1 95.4-53.9 130.1-34.8 34.8-81 53.9-130.1 53.9h-16c-49.1 0-95.4-19.1-130.1-53.9-34.8-34.8-53.9-81-53.9-130.1V184h384v296zm136-128c0 41-26.9 75.8-64 87.6V232h64v120z' ]); }); exports.UpSquareTwoTone = getIcon('up-square', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z' ], [ secondaryColor, 'M184 840h656V184H184v656zm143.5-228.7l178-246c3.2-4.4 9.7-4.4 12.9 0l178 246c3.9 5.3.1 12.7-6.4 12.7h-46.9c-10.2 0-19.9-4.9-25.9-13.2L512 465.4 406.8 610.8c-6 8.3-15.6 13.2-25.9 13.2H334c-6.5 0-10.3-7.4-6.5-12.7z' ], [ primaryColor, 'M334 624h46.9c10.3 0 19.9-4.9 25.9-13.2L512 465.4l105.2 145.4c6 8.3 15.7 13.2 25.9 13.2H690c6.5 0 10.3-7.4 6.4-12.7l-178-246a7.95 7.95 0 0 0-12.9 0l-178 246c-3.8 5.3 0 12.7 6.5 12.7z' ]); }); exports.UnlockTwoTone = getIcon('unlock', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M232 840h560V536H232v304zm280-226a48.01 48.01 0 0 1 28 87v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 0 1 28-87z' ], [ primaryColor, 'M484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 1 0-56 0z' ], [ primaryColor, 'M832 464H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v68c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-68c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zm-40 376H232V536h560v304z' ]); }); exports.UpCircleTwoTone = getIcon('up-circle', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm178 479h-46.9c-10.2 0-19.9-4.9-25.9-13.2L512 460.4 406.8 605.8c-6 8.3-15.6 13.2-25.9 13.2H334c-6.5 0-10.3-7.4-6.5-12.7l178-246c3.2-4.4 9.7-4.4 12.9 0l178 246c3.9 5.3.1 12.7-6.4 12.7z' ], [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ primaryColor, 'M518.4 360.3a7.95 7.95 0 0 0-12.9 0l-178 246c-3.8 5.3 0 12.7 6.5 12.7h46.9c10.3 0 19.9-4.9 25.9-13.2L512 460.4l105.2 145.4c6 8.3 15.7 13.2 25.9 13.2H690c6.5 0 10.3-7.4 6.4-12.7l-178-246z' ]); }); exports.UsbTwoTone = getIcon('usb', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M759.9 504H264.1c-26.5 0-48.1 19.7-48.1 44v292h592V548c0-24.3-21.6-44-48.1-44z' ], [ primaryColor, 'M456 248h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm160 0h-48c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z' ], [ primaryColor, 'M760 432V144c0-17.7-14.3-32-32-32H296c-17.7 0-32 14.3-32 32v288c-66.2 0-120 52.1-120 116v356c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8V548c0-63.9-53.8-116-120-116zM336 184h352v248H336V184zm472 656H216V548c0-24.3 21.6-44 48.1-44h495.8c26.5 0 48.1 19.7 48.1 44v292z' ]); }); exports.VideoCameraTwoTone = getIcon('video-camera', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M136 792h576V232H136v560zm64-488c0-4.4 3.6-8 8-8h112c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H208c-4.4 0-8-3.6-8-8v-48z' ], [ primaryColor, 'M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226z' ], [ primaryColor, 'M208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z' ]); }); exports.WalletTwoTone = getIcon('wallet', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 464H528V448h312v128zm0-192H496c-17.7 0-32 14.3-32 32v192c0 17.7 14.3 32 32 32h344v200H184V184h656v200z' ], [ secondaryColor, 'M528 576h312V448H528v128zm92-104c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z' ], [primaryColor, 'M580 512a40 40 0 1 0 80 0 40 40 0 1 0-80 0z'], [ secondaryColor, 'M184 840h656V640H496c-17.7 0-32-14.3-32-32V416c0-17.7 14.3-32 32-32h344V184H184v656z' ]); }); exports.CopyrightTwoTone = getIcon('copyright', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm5.5 533c52.9 0 88.8-31.7 93-77.8.4-4.1 3.8-7.3 8-7.3h56.8c2.6 0 4.7 2.1 4.7 4.7 0 82.6-68.7 141.4-162.7 141.4C407.4 734 344 660.8 344 539.1v-52.3C344 364.2 407.4 290 517.3 290c94.3 0 162.7 60.7 162.7 147.4 0 2.6-2.1 4.7-4.7 4.7h-56.7c-4.2 0-7.7-3.2-8-7.4-4-49.6-40-83.4-93-83.4-65.2 0-102.1 48.5-102.2 135.5v52.6c0 85.7 36.8 133.6 102.1 133.6z' ], [ primaryColor, 'M517.6 351.3c53 0 89 33.8 93 83.4.3 4.2 3.8 7.4 8 7.4h56.7c2.6 0 4.7-2.1 4.7-4.7 0-86.7-68.4-147.4-162.7-147.4C407.4 290 344 364.2 344 486.8v52.3C344 660.8 407.4 734 517.3 734c94 0 162.7-58.8 162.7-141.4 0-2.6-2.1-4.7-4.7-4.7h-56.8c-4.2 0-7.6 3.2-8 7.3-4.2 46.1-40.1 77.8-93 77.8-65.3 0-102.1-47.9-102.1-133.6v-52.6c.1-87 37-135.5 102.2-135.5z' ]); }); exports.CiTwoTone = getIcon('ci', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm-63.5 522.8c49.3 0 82.8-29.4 87-72.4.4-4.1 3.8-7.3 8-7.3h52.7c2.4 0 4.4 2 4.4 4.4 0 77.4-64.3 132.5-152.3 132.5C345.4 720 286 651.4 286 537.4v-49C286 373.5 345.4 304 448.3 304c88.3 0 152.3 56.9 152.3 138.1 0 2.4-2 4.4-4.4 4.4h-52.6c-4.2 0-7.6-3.2-8-7.4-3.9-46.1-37.5-77.6-87-77.6-61.1 0-95.6 45.4-95.7 126.8v49.3c0 80.3 34.5 125.2 95.6 125.2zM738 704.1c0 4.4-3.6 8-8 8h-50.4c-4.4 0-8-3.6-8-8V319.9c0-4.4 3.6-8 8-8H730c4.4 0 8 3.6 8 8v384.2z' ], [ primaryColor, 'M730 311.9h-50.4c-4.4 0-8 3.6-8 8v384.2c0 4.4 3.6 8 8 8H730c4.4 0 8-3.6 8-8V319.9c0-4.4-3.6-8-8-8zm-281.4 49.6c49.5 0 83.1 31.5 87 77.6.4 4.2 3.8 7.4 8 7.4h52.6c2.4 0 4.4-2 4.4-4.4 0-81.2-64-138.1-152.3-138.1C345.4 304 286 373.5 286 488.4v49c0 114 59.4 182.6 162.3 182.6 88 0 152.3-55.1 152.3-132.5 0-2.4-2-4.4-4.4-4.4h-52.7c-4.2 0-7.6 3.2-8 7.3-4.2 43-37.7 72.4-87 72.4-61.1 0-95.6-44.9-95.6-125.2v-49.3c.1-81.4 34.6-126.8 95.7-126.8z' ]); }); exports.DollarTwoTone = getIcon('dollar', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M426.6 410.3c0 25.4 15.7 45.1 49.5 57.3 4.7 1.9 9.4 3.4 15 5v-124c-37 4.7-64.5 25.4-64.5 61.7zm116.5 135.2c-2.9-.6-5.7-1.3-8.8-2.2V677c42.6-3.8 72-27.3 72-66.4 0-30.7-15.9-50.7-63.2-65.1z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm22.4 589.2l.2 31.7c0 4.5-3.6 8.1-8 8.1h-28.4c-4.4 0-8-3.6-8-8v-31.4c-89-6.5-130.7-57.1-135.2-112.1-.4-4.7 3.3-8.7 8-8.7h46.2c3.9 0 7.3 2.8 7.9 6.6 5.1 31.8 29.9 55.4 74.1 61.3V534l-24.7-6.3c-52.3-12.5-102.1-45.1-102.1-112.7 0-73 55.4-112.1 126.2-119v-33c0-4.4 3.6-8 8-8h28.1c4.4 0 8 3.6 8 8v32.7c68.5 6.9 119.8 46.9 125.9 109.2a8.1 8.1 0 0 1-8 8.8h-44.9c-4 0-7.4-2.9-7.9-6.9-4-29.2-27.5-53-65.5-58.2v134.3l25.4 5.9c64.8 16 108.9 47 109 116.4 0 75.2-56 117.1-134.3 124z' ], [ primaryColor, 'M559.7 488.8l-25.4-5.9V348.6c38 5.2 61.5 29 65.5 58.2.5 4 3.9 6.9 7.9 6.9h44.9c4.7 0 8.4-4.1 8-8.8-6.1-62.3-57.4-102.3-125.9-109.2V263c0-4.4-3.6-8-8-8h-28.1c-4.4 0-8 3.6-8 8v33c-70.8 6.9-126.2 46-126.2 119 0 67.6 49.8 100.2 102.1 112.7l24.7 6.3v142.7c-44.2-5.9-69-29.5-74.1-61.3-.6-3.8-4-6.6-7.9-6.6H363c-4.7 0-8.4 4-8 8.7 4.5 55 46.2 105.6 135.2 112.1V761c0 4.4 3.6 8 8 8h28.4c4.4 0 8-3.6 8-8.1l-.2-31.7c78.3-6.9 134.3-48.8 134.3-124-.1-69.4-44.2-100.4-109-116.4zm-68.6-16.2c-5.6-1.6-10.3-3.1-15-5-33.8-12.2-49.5-31.9-49.5-57.3 0-36.3 27.5-57 64.5-61.7v124zM534.3 677V543.3c3.1.9 5.9 1.6 8.8 2.2 47.3 14.4 63.2 34.4 63.2 65.1 0 39.1-29.4 62.6-72 66.4z' ]); }); exports.WarningTwoTone = getIcon('warning', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z' ], [ secondaryColor, 'M172.2 828.1h679.6L512 239.9 172.2 828.1zM560 720a48.01 48.01 0 0 1-96 0 48.01 48.01 0 0 1 96 0zm-16-304v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8z' ], [ primaryColor, 'M464 720a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8z' ]); }); exports.EuroTwoTone = getIcon('euro', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z' ], [ secondaryColor, 'M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm117.1 581.1c0 3.8-2.7 7-6.4 7.8-15.9 3.4-34.4 5.1-55.3 5.1-109.8 0-183-58.8-200.2-158H337c-4.4 0-8-3.6-8-8v-27.2c0-4.4 3.6-8 8-8h26.1v-36.9c0-4.4 0-8.7.3-12.8H337c-4.4 0-8-3.6-8-8v-27.2c0-4.4 3.6-8 8-8h31.8C388.5 345.7 460.7 290 567.4 290c20.9 0 39.4 1.9 55.3 5.4 3.7.8 6.3 4 6.3 7.8V346a8 8 0 0 1-9.6 7.8c-14.6-2.9-31.8-4.4-51.7-4.4-65.3 0-110.4 33.5-127.6 90.4h128.3c4.4 0 8 3.6 8 8V475c0 4.4-3.6 8-8 8H432.5c-.3 4.4-.3 9.1-.3 13.8v36h136.4c4.4 0 8 3.6 8 8V568c0 4.4-3.6 8-8 8H438c15.3 62 61.3 98.6 129.8 98.6 19.9 0 37.1-1.3 51.8-4.1 4.9-1 9.5 2.8 9.5 7.8v42.8z' ], [ primaryColor, 'M619.6 670.5c-14.7 2.8-31.9 4.1-51.8 4.1-68.5 0-114.5-36.6-129.8-98.6h130.6c4.4 0 8-3.6 8-8v-27.2c0-4.4-3.6-8-8-8H432.2v-36c0-4.7 0-9.4.3-13.8h135.9c4.4 0 8-3.6 8-8v-27.2c0-4.4-3.6-8-8-8H440.1c17.2-56.9 62.3-90.4 127.6-90.4 19.9 0 37.1 1.5 51.7 4.4a8 8 0 0 0 9.6-7.8v-42.8c0-3.8-2.6-7-6.3-7.8-15.9-3.5-34.4-5.4-55.3-5.4-106.7 0-178.9 55.7-198.6 149.9H337c-4.4 0-8 3.6-8 8v27.2c0 4.4 3.6 8 8 8h26.4c-.3 4.1-.3 8.4-.3 12.8v36.9H337c-4.4 0-8 3.6-8 8V568c0 4.4 3.6 8 8 8h30.2c17.2 99.2 90.4 158 200.2 158 20.9 0 39.4-1.7 55.3-5.1 3.7-.8 6.4-4 6.4-7.8v-42.8c0-5-4.6-8.8-9.5-7.8z' ]); }); exports.GoldTwoTone = getIcon('gold', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ primaryColor, 'M435.7 558.7c-.6-3.9-4-6.7-7.9-6.7H166.2c-3.9 0-7.3 2.8-7.9 6.7l-40.2 248c-.1.4-.1.9-.1 1.3 0 4.4 3.6 8 8 8h342c.4 0 .9 0 1.3-.1 4.4-.7 7.3-4.8 6.6-9.2l-40.2-248zM196.5 748l20.7-128h159.5l20.7 128H196.5zm709.4 58.7l-40.2-248c-.6-3.9-4-6.7-7.9-6.7H596.2c-3.9 0-7.3 2.8-7.9 6.7l-40.2 248c-.1.4-.1.9-.1 1.3 0 4.4 3.6 8 8 8h342c.4 0 .9 0 1.3-.1 4.3-.7 7.3-4.8 6.6-9.2zM626.5 748l20.7-128h159.5l20.7 128H626.5zM342 472h342c.4 0 .9 0 1.3-.1 4.4-.7 7.3-4.8 6.6-9.2l-40.2-248c-.6-3.9-4-6.7-7.9-6.7H382.2c-3.9 0-7.3 2.8-7.9 6.7l-40.2 248c-.1.4-.1.9-.1 1.3 0 4.4 3.6 8 8 8zm91.2-196h159.5l20.7 128h-201l20.8-128z' ], [ secondaryColor, 'M592.7 276H433.2l-20.8 128h201zM217.2 620l-20.7 128h200.9l-20.7-128zm430 0l-20.7 128h200.9l-20.7-128z' ]); }); exports.CanlendarTwoTone = getIcon('canlendar', twotone, function (primaryColor, secondaryColor) { return getNode(newViewBox, [ secondaryColor, 'M712 304c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-48H384v48c0 4.4-3.6 8-8 8h-56c-4.4 0-8-3.6-8-8v-48H184v136h656V256H712v48z' ], [ primaryColor, 'M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zm0-448H184V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136z' ]); }); /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js": /*!********************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js ***! \********************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](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['define' + 'Property'](target, property, desc); desc = null; } return desc; } module.exports = _applyDecoratedDescriptor; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/arrayWithHoles.js": /*!**********************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/arrayWithHoles.js ***! \**********************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } module.exports = _arrayWithHoles; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js": /*!*************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***! \*************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { 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; } } module.exports = _arrayWithoutHoles; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js": /*!*****************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/assertThisInitialized.js ***! \*****************************************************************************************************************************************/ /*! no static exports found */ /***/ (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; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/asyncToGenerator.js": /*!************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/asyncToGenerator.js ***! \************************************************************************************************************************************/ /*! no static exports found */ /***/ (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; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/classCallCheck.js": /*!**********************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/classCallCheck.js ***! \**********************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } module.exports = _classCallCheck; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/createClass.js": /*!*******************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/createClass.js ***! \*******************************************************************************************************************************/ /*! no static exports found */ /***/ (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; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/defineProperty.js": /*!**********************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/defineProperty.js ***! \**********************************************************************************************************************************/ /*! no static exports found */ /***/ (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; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/extends.js": /*!***************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/extends.js ***! \***************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _extends() { module.exports = _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } module.exports = _extends; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js": /*!**********************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/getPrototypeOf.js ***! \**********************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _getPrototypeOf(o) { module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } module.exports = _getPrototypeOf; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/inherits.js": /*!****************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/inherits.js ***! \****************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ "../../node_modules/@babel/runtime/helpers/setPrototypeOf.js"); 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 } }); if (superClass) setPrototypeOf(subClass, superClass); } module.exports = _inherits; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/initializerDefineProperty.js": /*!*********************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/initializerDefineProperty.js ***! \*********************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } module.exports = _initializerDefineProperty; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/initializerWarningHelper.js": /*!********************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/initializerWarningHelper.js ***! \********************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); } module.exports = _initializerWarningHelper; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/interopRequireDefault.js": /*!*****************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/interopRequireDefault.js ***! \*****************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } module.exports = _interopRequireDefault; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/iterableToArray.js": /*!***********************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/iterableToArray.js ***! \***********************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } module.exports = _iterableToArray; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js": /*!****************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***! \****************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/nonIterableRest.js": /*!***********************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/nonIterableRest.js ***! \***********************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } module.exports = _nonIterableRest; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/nonIterableSpread.js": /*!*************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/nonIterableSpread.js ***! \*************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } module.exports = _nonIterableSpread; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/objectSpread.js": /*!********************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/objectSpread.js ***! \********************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var defineProperty = __webpack_require__(/*! ./defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js"); function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { defineProperty(target, key, source[key]); }); } return target; } module.exports = _objectSpread; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js": /*!*******************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/objectWithoutProperties.js ***! \*******************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var objectWithoutPropertiesLoose = __webpack_require__(/*! ./objectWithoutPropertiesLoose */ "../../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js"); 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; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js": /*!************************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js ***! \************************************************************************************************************************************************/ /*! no static exports found */ /***/ (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; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js": /*!*********************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***! \*********************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var _typeof = __webpack_require__(/*! ../helpers/typeof */ "../../node_modules/@babel/runtime/helpers/typeof.js"); var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized */ "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js"); function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return assertThisInitialized(self); } module.exports = _possibleConstructorReturn; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/setPrototypeOf.js": /*!**********************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/setPrototypeOf.js ***! \**********************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _setPrototypeOf(o, p) { module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } module.exports = _setPrototypeOf; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/slicedToArray.js": /*!*********************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/slicedToArray.js ***! \*********************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ "../../node_modules/@babel/runtime/helpers/arrayWithHoles.js"); var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ "../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js"); var nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ "../../node_modules/@babel/runtime/helpers/nonIterableRest.js"); function _slicedToArray(arr, i) { return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest(); } module.exports = _slicedToArray; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/toConsumableArray.js": /*!*************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/toConsumableArray.js ***! \*************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles */ "../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js"); var iterableToArray = __webpack_require__(/*! ./iterableToArray */ "../../node_modules/@babel/runtime/helpers/iterableToArray.js"); var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread */ "../../node_modules/@babel/runtime/helpers/nonIterableSpread.js"); function _toConsumableArray(arr) { return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); } module.exports = _toConsumableArray; /***/ }), /***/ "../../node_modules/@babel/runtime/helpers/typeof.js": /*!**************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/helpers/typeof.js ***! \**************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } function _typeof(obj) { if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { module.exports = _typeof = function _typeof(obj) { return _typeof2(obj); }; } else { module.exports = _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); }; } return _typeof(obj); } module.exports = _typeof; /***/ }), /***/ "../../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime-module.js": /*!***********************************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime-module.js ***! \***********************************************************************************************************************************************************/ /*! no static exports found */ /***/ (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. */ // This method of obtaining a reference to the global object needs to be // kept identical to the way it is obtained in runtime.js var g = (function() { return this || (typeof self === "object" && self); })() || Function("return this")(); // Use `getOwnPropertyNames` because not all browsers support calling // `hasOwnProperty` on the global `self` object in a worker. See #183. var hadRuntime = g.regeneratorRuntime && Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; // Save the old regeneratorRuntime in case it needs to be restored later. var oldRuntime = hadRuntime && g.regeneratorRuntime; // Force reevalutation of runtime.js. g.regeneratorRuntime = undefined; module.exports = __webpack_require__(/*! ./runtime */ "../../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js"); if (hadRuntime) { // Restore the original runtime. g.regeneratorRuntime = oldRuntime; } else { // Remove the global property added by runtime.js. try { delete g.regeneratorRuntime; } catch(e) { g.regeneratorRuntime = undefined; } } /***/ }), /***/ "../../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js": /*!****************************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js ***! \****************************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { /** * 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. */ !(function(global) { "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"; var inModule = typeof module === "object"; var runtime = global.regeneratorRuntime; if (runtime) { if (inModule) { // If regeneratorRuntime is defined globally and we're in a module, // make the exports object identical to regeneratorRuntime. module.exports = runtime; } // Don't bother evaluating the rest of this file if the runtime was // already defined globally. return; } // Define the runtime globally (as expected by generated code) as either // module.exports (if we're in a module) or a new, empty object. runtime = global.regeneratorRuntime = inModule ? module.exports : {}; 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; } runtime.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; GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "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) { prototype[method] = function(arg) { return this._invoke(method, arg); }; }); } runtime.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; }; runtime.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; if (!(toStringTagSymbol in genFun)) { 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. runtime.awrap = function(arg) { return { __await: arg }; }; function AsyncIterator(generator) { 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 Promise.resolve(value.__await).then(function(value) { invoke("next", value, resolve, reject); }, function(err) { invoke("throw", err, resolve, reject); }); } return Promise.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 Promise(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; }; runtime.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. runtime.async = function(innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator( wrap(innerFn, outerFn, self, tryLocsList) ); return runtime.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") { 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); 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); } runtime.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 }; } runtime.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; } }; })( // In sloppy mode, unbound `this` refers to the global object, fallback to // Function constructor if we're in global strict mode. That is sadly a form // of indirect eval which violates Content Security Policy. (function() { return this || (typeof self === "object" && self); })() || Function("return this")() ); /***/ }), /***/ "../../node_modules/@babel/runtime/regenerator/index.js": /*!*****************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@babel/runtime/regenerator/index.js ***! \*****************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! regenerator-runtime */ "../../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime-module.js"); /***/ }), /***/ "../../node_modules/@firebase/app/dist/index.cjs.js": /*!*************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/app/dist/index.cjs.js ***! \*************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(console) { Object.defineProperty(exports, '__esModule', { value: true }); var util = __webpack_require__(/*! @firebase/util */ "../../node_modules/@firebase/util/dist/index.cjs.js"); /** * Copyright 2017 Google Inc. * * 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. */ var contains = function (obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); }; var DEFAULT_ENTRY_NAME = '[DEFAULT]'; // An array to capture listeners before the true auth functions // exist var tokenListeners = []; /** * Global context object for a collection of services using * a shared authentication state. */ var FirebaseAppImpl = /** @class */ (function () { function FirebaseAppImpl(options, config, firebase_) { this.firebase_ = firebase_; this.isDeleted_ = false; this.services_ = {}; this.name_ = config.name; this._automaticDataCollectionEnabled = config.automaticDataCollectionEnabled || false; this.options_ = util.deepCopy(options); this.INTERNAL = { getUid: function () { return null; }, getToken: function () { return Promise.resolve(null); }, addAuthTokenListener: function (callback) { tokenListeners.push(callback); // Make sure callback is called, asynchronously, in the absence of the auth module setTimeout(function () { return callback(null); }, 0); }, removeAuthTokenListener: function (callback) { tokenListeners = tokenListeners.filter(function (listener) { return listener !== callback; }); } }; } Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", { get: function () { this.checkDestroyed_(); return this._automaticDataCollectionEnabled; }, set: function (val) { this.checkDestroyed_(); this._automaticDataCollectionEnabled = val; }, enumerable: true, configurable: true }); Object.defineProperty(FirebaseAppImpl.prototype, "name", { get: function () { this.checkDestroyed_(); return this.name_; }, enumerable: true, configurable: true }); Object.defineProperty(FirebaseAppImpl.prototype, "options", { get: function () { this.checkDestroyed_(); return this.options_; }, enumerable: true, configurable: true }); FirebaseAppImpl.prototype.delete = function () { var _this = this; return new Promise(function (resolve) { _this.checkDestroyed_(); resolve(); }) .then(function () { _this.firebase_.INTERNAL.removeApp(_this.name_); var services = []; Object.keys(_this.services_).forEach(function (serviceKey) { Object.keys(_this.services_[serviceKey]).forEach(function (instanceKey) { services.push(_this.services_[serviceKey][instanceKey]); }); }); return Promise.all(services.map(function (service) { return service.INTERNAL.delete(); })); }) .then(function () { _this.isDeleted_ = true; _this.services_ = {}; }); }; /** * Return a service instance associated with this app (creating it * on demand), identified by the passed instanceIdentifier. * * NOTE: Currently storage is the only one that is leveraging this * functionality. They invoke it by calling: * * ```javascript * firebase.app().storage('STORAGE BUCKET ID') * ``` * * The service name is passed to this already * @internal */ FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) { if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; } this.checkDestroyed_(); if (!this.services_[name]) { this.services_[name] = {}; } if (!this.services_[name][instanceIdentifier]) { /** * If a custom instance has been defined (i.e. not '[DEFAULT]') * then we will pass that instance on, otherwise we pass `null` */ var instanceSpecifier = instanceIdentifier !== DEFAULT_ENTRY_NAME ? instanceIdentifier : undefined; var service = this.firebase_.INTERNAL.factories[name](this, this.extendApp.bind(this), instanceSpecifier); this.services_[name][instanceIdentifier] = service; } return this.services_[name][instanceIdentifier]; }; /** * Callback function used to extend an App instance at the time * of service instance creation. */ FirebaseAppImpl.prototype.extendApp = function (props) { var _this = this; // Copy the object onto the FirebaseAppImpl prototype util.deepExtend(this, props); /** * If the app has overwritten the addAuthTokenListener stub, forward * the active token listeners on to the true fxn. * * TODO: This function is required due to our current module * structure. Once we are able to rely strictly upon a single module * implementation, this code should be refactored and Auth should * provide these stubs and the upgrade logic */ if (props.INTERNAL && props.INTERNAL.addAuthTokenListener) { tokenListeners.forEach(function (listener) { _this.INTERNAL.addAuthTokenListener(listener); }); tokenListeners = []; } }; /** * This function will throw an Error if the App has already been deleted - * use before performing API actions on the App. */ FirebaseAppImpl.prototype.checkDestroyed_ = function () { if (this.isDeleted_) { error('app-deleted', { name: this.name_ }); } }; return FirebaseAppImpl; }()); // Prevent dead-code elimination of these methods w/o invalid property // copying. (FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) || FirebaseAppImpl.prototype.delete || console.log('dc'); /** * Return a firebase namespace object. * * In production, this will be called exactly once and the result * assigned to the 'firebase' global. It may be called multiple times * in unit tests. */ function createFirebaseNamespace() { var apps_ = {}; var factories = {}; var appHooks = {}; // A namespace is a plain JavaScript Object. var namespace = { // Hack to prevent Babel from modifying the object returned // as the firebase namespace. __esModule: true, initializeApp: initializeApp, app: app, apps: null, Promise: Promise, SDK_VERSION: '5.5.9', INTERNAL: { registerService: registerService, createFirebaseNamespace: createFirebaseNamespace, extendNamespace: extendNamespace, createSubscribe: util.createSubscribe, ErrorFactory: util.ErrorFactory, removeApp: removeApp, factories: factories, useAsService: useAsService, Promise: Promise, deepExtend: util.deepExtend } }; // Inject a circular default export to allow Babel users who were previously // using: // // import firebase from 'firebase'; // which becomes: var firebase = require('firebase').default; // // instead of // // import * as firebase from 'firebase'; // which becomes: var firebase = require('firebase'); util.patchProperty(namespace, 'default', namespace); // firebase.apps is a read-only getter. Object.defineProperty(namespace, 'apps', { get: getApps }); /** * Called by App.delete() - but before any services associated with the App * are deleted. */ function removeApp(name) { var app = apps_[name]; callAppHooks(app, 'delete'); delete apps_[name]; } /** * Get the App object for a given name (or DEFAULT). */ function app(name) { name = name || DEFAULT_ENTRY_NAME; if (!contains(apps_, name)) { error('no-app', { name: name }); } return apps_[name]; } util.patchProperty(app, 'App', FirebaseAppImpl); function initializeApp(options, rawConfig) { if (rawConfig === void 0) { rawConfig = {}; } if (typeof rawConfig !== 'object' || rawConfig === null) { var name_1 = rawConfig; rawConfig = { name: name_1 }; } var config = rawConfig; if (config.name === undefined) { config.name = DEFAULT_ENTRY_NAME; } var name = config.name; if (typeof name !== 'string' || !name) { error('bad-app-name', { name: name + '' }); } if (contains(apps_, name)) { error('duplicate-app', { name: name }); } var app = new FirebaseAppImpl(options, config, namespace); apps_[name] = app; callAppHooks(app, 'create'); return app; } /* * Return an array of all the non-deleted FirebaseApps. */ function getApps() { // Make a copy so caller cannot mutate the apps list. return Object.keys(apps_).map(function (name) { return apps_[name]; }); } /* * Register a Firebase Service. * * firebase.INTERNAL.registerService() * * TODO: Implement serviceProperties. */ function registerService(name, createService, serviceProperties, appHook, allowMultipleInstances) { // Cannot re-register a service that already exists if (factories[name]) { error('duplicate-service', { name: name }); } // Capture the service factory for later service instantiation factories[name] = createService; // Capture the appHook, if passed if (appHook) { appHooks[name] = appHook; // Run the **new** app hook on all existing apps getApps().forEach(function (app) { appHook('create', app); }); } // The Service namespace is an accessor function ... var serviceNamespace = function (appArg) { if (appArg === void 0) { appArg = app(); } if (typeof appArg[name] !== 'function') { // Invalid argument. // This happens in the following case: firebase.storage('gs:/') error('invalid-app-argument', { name: name }); } // Forward service instance lookup to the FirebaseApp. return appArg[name](); }; // ... and a container for service-level properties. if (serviceProperties !== undefined) { util.deepExtend(serviceNamespace, serviceProperties); } // Monkey-patch the serviceNamespace onto the firebase namespace namespace[name] = serviceNamespace; // Patch the FirebaseAppImpl prototype FirebaseAppImpl.prototype[name] = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var serviceFxn = this._getService.bind(this, name); return serviceFxn.apply(this, allowMultipleInstances ? args : []); }; return serviceNamespace; } /** * Patch the top-level firebase namespace with additional properties. * * firebase.INTERNAL.extendNamespace() */ function extendNamespace(props) { util.deepExtend(namespace, props); } function callAppHooks(app, eventName) { Object.keys(factories).forEach(function (serviceName) { // Ignore virtual services var factoryName = useAsService(app, serviceName); if (factoryName === null) { return; } if (appHooks[factoryName]) { appHooks[factoryName](eventName, app); } }); } // Map the requested service to a registered service name // (used to map auth to serverAuth service when needed). function useAsService(app, name) { if (name === 'serverAuth') { return null; } var useService = name; var options = app.options; return useService; } return namespace; } function error(code, args) { throw appErrors.create(code, args); } // TypeScript does not support non-string indexes! // let errors: {[code: AppError: string} = { var errors = { 'no-app': "No Firebase App '{$name}' has been created - " + 'call Firebase App.initializeApp()', 'bad-app-name': "Illegal App name: '{$name}", 'duplicate-app': "Firebase App named '{$name}' already exists", 'app-deleted': "Firebase App named '{$name}' already deleted", 'duplicate-service': "Firebase service named '{$name}' already registered", 'sa-not-supported': 'Initializing the Firebase SDK with a service ' + 'account is only allowed in a Node.js environment. On client ' + 'devices, you should instead initialize the SDK with an api key and ' + 'auth domain', 'invalid-app-argument': 'firebase.{$name}() takes either no argument or a ' + 'Firebase App instance.' }; var appErrors = new util.ErrorFactory('app', 'Firebase', errors); /** * Copyright 2017 Google Inc. * * 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. */ var firebase = createFirebaseNamespace(); exports.firebase = firebase; exports.default = firebase; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../console-browserify/index.js */ "../../node_modules/console-browserify/index.js"))) /***/ }), /***/ "../../node_modules/@firebase/auth/dist/auth.esm.js": /*!*************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/auth/dist/auth.esm.js ***! \*************************************************************************************************************************/ /*! no exports provided */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* WEBPACK VAR INJECTION */(function(console, global) {/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "../../node_modules/@firebase/app/dist/index.cjs.js"); /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_app__WEBPACK_IMPORTED_MODULE_0__); (function() {var g,aa=aa||{},k=this;function l(a){return"string"==typeof a}function ba(a){return"boolean"==typeof a}function ca(){} function da(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ea(a){return null===a}function fa(a){return"array"==da(a)}function ha(a){var b=da(a);return"array"==b||"object"==b&&"number"==typeof a.length}function n(a){return"function"==da(a)}function q(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}var ia="closure_uid_"+(1E9*Math.random()>>>0),ja=0;function ka(a,b,c){return a.call.apply(a.bind,arguments)} function ma(a,b,c){if(!a)throw Error();if(2a.b&&(a.b++,b.next=a.a,a.a=b)};function va(){this.b=this.a=null}var xa=new ta(function(){return new wa},function(a){a.reset()});va.prototype.add=function(a,b){var c=xa.get();c.set(a,b);this.b?this.b.next=c:this.a=c;this.b=c};function ya(){var a=za,b=null;a.a&&(b=a.a,a.a=a.a.next,a.a||(a.b=null),b.next=null);return b}function wa(){this.next=this.b=this.a=null}wa.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};wa.prototype.reset=function(){this.next=this.b=this.a=null};var Aa=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if(l(a))return l(b)&&1==b.length?a.indexOf(b,0):-1;for(var c=0;cb?null:l(a)?a.charAt(b):a[b]}function Ga(a,b){return 0<=Aa(a,b)}function Ha(a,b){b=Aa(a,b);var c;(c=0<=b)&&Array.prototype.splice.call(a,b,1);return c}function w(a,b){var c=0;Ba(a,function(d,e){b.call(void 0,d,e,a)&&1==Array.prototype.splice.call(a,e,1).length&&c++})}function Ia(a){return Array.prototype.concat.apply([],arguments)} function Ja(a){var b=a.length;if(0")&&(a=a.replace(Qa,">"));-1!=a.indexOf('"')&&(a=a.replace(Ra,"""));-1!=a.indexOf("'")&&(a=a.replace(Sa,"'"));-1!=a.indexOf("\x00")&&(a=a.replace(Ta,"�"));return a}var Oa=/&/g,Pa=//g,Ra=/"/g,Sa=/'/g,Ta=/\x00/g,Na=/[\x00&<>"']/;function y(a,b){return-1!=a.indexOf(b)}function Ua(a,b){return ab?1:0};var Va;a:{var Wa=k.navigator;if(Wa){var Xa=Wa.userAgent;if(Xa){Va=Xa;break a}}Va=""}function z(a){return y(Va,a)};function Ya(a,b){for(var c in a)b.call(void 0,a[c],c,a)}function Za(a){for(var b in a)return!1;return!0}function $a(a){var b={},c;for(c in a)b[c]=a[c];return b}var ab="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function bb(a,b){for(var c,d,e=1;eparseFloat(Wb)){Vb=String(Yb);break a}}Vb=Wb}var Nb={}; function Zb(a){return Mb(a,function(){for(var b=0,c=La(String(Vb)).split("."),d=La(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f=a.keyCode)a.keyCode=-1}catch(b){}};fc.prototype.f=function(){return this.a};var hc="closure_listenable_"+(1E6*Math.random()|0),ic=0;function jc(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.La=e;this.key=++ic;this.na=this.Ia=!1}function kc(a){a.na=!0;a.listener=null;a.proxy=null;a.src=null;a.La=null};function lc(a){this.src=a;this.a={};this.b=0}lc.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var h=mc(a,b,d,e);-1d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(h){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.b;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;0<=e;e--){b.b=d[e];var f=Cc(d[e],a,!0,b);c=c&&f}for(e=0;e>>0);function tc(a){if(n(a))return a;a[Ec]||(a[Ec]=function(b){return a.handleEvent(b)});return a[Ec]};function F(){Hb.call(this);this.l=new lc(this);this.Qb=this;this.Ua=null}t(F,Hb);F.prototype[hc]=!0;F.prototype.addEventListener=function(a,b,c,d){rc(this,a,b,c,d)};F.prototype.removeEventListener=function(a,b,c,d){E(this,a,b,c,d)}; F.prototype.dispatchEvent=function(a){var b,c=this.Ua;if(c)for(b=[];c;c=c.Ua)b.push(c);c=this.Qb;var d=a.type||a;if(l(a))a=new D(a,c);else if(a instanceof D)a.target=a.target||c;else{var e=a;a=new D(d,c);bb(a,e)}e=!0;if(b)for(var f=b.length-1;0<=f;f--){var h=a.b=b[f];e=Fc(h,d,!0,a)&&e}h=a.b=c;e=Fc(h,d,!0,a)&&e;e=Fc(h,d,!1,a)&&e;if(b)for(f=0;fb)throw Error("Bad port number "+b);a.i=b}else a.i=null}function Uc(a,b,c){b instanceof Tc?(a.a=b,ad(a.a,a.f)):(c||(b=Wc(b,bd)),a.a=new Tc(b,a.f))}function G(a,b,c){a.a.set(b,c)}function cd(a,b){return a.a.get(b)}function dd(a){return a instanceof Qc?new Qc(a):new Qc(a,void 0)}function ed(a,b){var c=new Qc(null,void 0);Rc(c,"https");a&&(c.b=a);b&&(c.g=b);return c} function Vc(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function Wc(a,b,c){return l(a)?(a=encodeURI(a).replace(b,fd),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function fd(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var Xc=/[#\/\?@]/g,Zc=/[#\?:]/g,Yc=/[#\?]/g,bd=/[#\?@]/g,$c=/#/g;function Tc(a,b){this.b=this.a=null;this.c=a||null;this.f=!!b} function gd(a){a.a||(a.a=new Lc,a.b=0,a.c&&Pc(a.c,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))}function hd(a){var b=Jc(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new Tc(null,void 0);a=Ic(a);for(var d=0;d2*a.c&&Mc(a)))}g.clear=function(){this.a=this.c=null;this.b=0};function ld(a,b){gd(a);b=jd(a,b);return Nc(a.a.b,b)}g.forEach=function(a,b){gd(this);this.a.forEach(function(c,d){v(c,function(c){a.call(b,c,d,this)},this)},this)};g.U=function(){gd(this);for(var a=this.a.S(),b=this.a.U(),c=[],d=0;d");Hd("");Hd("
");function Id(a){var b=document;return l(a)?b.getElementById(a):a}function Jd(a,b){Ya(b,function(b,d){b&&b.ma&&(b=b.la());"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:Kd.hasOwnProperty(d)?a.setAttribute(Kd[d],b):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,b):a[d]=b})} var Kd={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"}; function Ld(a,b,c){var d=arguments,e=document,f=String(d[0]),h=d[1];if(!md&&h&&(h.name||h.type)){f=["<",f];h.name&&f.push(' name="',Ma(h.name),'"');if(h.type){f.push(' type="',Ma(h.type),'"');var m={};bb(m,h);delete m.type;h=m}f.push(">");f=f.join("")}f=e.createElement(f);h&&(l(h)?f.className=h:fa(h)?f.className=h.join(" "):Jd(f,h));2a?!1:!Pb||!$b||9<$b}function ae(a){a=(a||H()).toLowerCase();return a.match(/android/)||a.match(/webos/)||a.match(/iphone|ipad|ipod/)||a.match(/blackberry/)||a.match(/windows phone/)||a.match(/iemobile/)?!0:!1}function be(a){a=a||k.window;try{a.close()}catch(b){}} function ce(a,b,c){var d=Math.floor(1E9*Math.random()).toString();b=b||500;c=c||600;var e=(window.screen.availHeight-c)/2,f=(window.screen.availWidth-b)/2;b={width:b,height:c,top:0',a=Hd(a),h.document.write(Gd(a)),h.document.close())):(h=d.open(Ad(b),c,h))&&a.noopener&&(h.opener=null);if(h)try{h.focus()}catch(m){}return h} function ee(a){return new A(function(b){function c(){Hc(2E3).then(function(){if(!a||a.closed)b();else return c()})}return c()})}var fe=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;function ge(){var a=null;return(new A(function(b){"complete"==k.document.readyState?b():(a=function(){b()},sc(window,"load",a))})).s(function(b){E(window,"load",a);throw b;})} function he(){return ie(void 0)?ge().then(function(){return new A(function(a,b){var c=k.document,d=setTimeout(function(){b(Error("Cordova framework is not ready."))},1E3);c.addEventListener("deviceready",function(){clearTimeout(d);a()},!1)})}):C(Error("Cordova must run in an Android or iOS file scheme."))}function ie(a){a=a||H();return!("file:"!==je()||!a.toLowerCase().match(/iphone|ipad|ipod|android/))}function ke(){var a=k.window;try{return!(!a||a==a.top)}catch(b){return!1}} function le(){return"object"!==typeof k.window&&"function"===typeof k.importScripts}function me(){return _firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.INTERNAL.hasOwnProperty("node")?"Node":le()?"Worker":"Browser"}function ne(){var a=me();return"ReactNative"===a||"Node"===a}function oe(){for(var a=50,b=[];0b)throw Error("Short delay should be less than long delay!");this.a=a;this.c=b;a=H();b=me();this.b=ae(a)||"ReactNative"===b} Be.prototype.get=function(){var a=k.navigator;return(a&&"boolean"===typeof a.onLine&&(ue()||"chrome-extension:"===je()||"undefined"!==typeof a.connection)?a.onLine:1)?this.b?this.c:this.a:Math.min(5E3,this.a)};function Ce(){var a=k.document;return a&&"undefined"!==typeof a.visibilityState?"visible"==a.visibilityState:!0} function De(){var a=k.document,b=null;return Ce()||!a?B():(new A(function(c){b=function(){Ce()&&(a.removeEventListener("visibilitychange",b,!1),c())};a.addEventListener("visibilitychange",b,!1)})).s(function(c){a.removeEventListener("visibilitychange",b,!1);throw c;})}function Ee(a){try{var b=new Date(parseInt(a,10));if(!isNaN(b.getTime())&&!/[^0-9]/.test(a))return b.toUTCString()}catch(c){}return null}function Fe(){return!(!I("fireauth.oauthhelper",k)&&!I("fireauth.iframe",k))} function Ge(){var a=k.navigator;return a&&a.serviceWorker&&a.serviceWorker.controller||null}function He(){var a=k.navigator;return a&&a.serviceWorker?B().then(function(){return a.serviceWorker.ready}).then(function(a){return a.active||null}).s(function(){return null}):B(null)};var Ie={};function Je(a){Ie[a]||(Ie[a]=!0,"undefined"!==typeof console&&"function"===typeof console.warn&&console.warn(a))};var Ke;try{var Le={};Object.defineProperty(Le,"abcd",{configurable:!0,enumerable:!0,value:1});Object.defineProperty(Le,"abcd",{configurable:!0,enumerable:!0,value:2});Ke=2==Le.abcd}catch(a){Ke=!1}function J(a,b,c){Ke?Object.defineProperty(a,b,{configurable:!0,enumerable:!0,value:c}):a[b]=c}function K(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&J(a,c,b[c])}function Me(a){var b={};K(b,a);return b}function Ne(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b} function Oe(a,b){if(!b||!b.length)return!0;if(!a)return!1;for(var c=0;c>4);64!=h&&(b(f<<4&240|h>>2),64!=m&&b(h<<6&192|m))}} function sf(){if(!of){of={};pf={};for(var a=0;65>a;a++)of[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),pf[of[a]]=a,62<=a&&(pf["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};function tf(a){this.c=a.sub;oa();this.a=a.provider_id||a.firebase&&a.firebase.sign_in_provider||null;this.b=!!a.is_anonymous||"anonymous"==this.a}tf.prototype.f=function(){return this.b};function uf(a){return(a=vf(a))&&a.sub&&a.iss&&a.aud&&a.exp?new tf(a):null}function vf(a){if(!a)return null;a=a.split(".");if(3!=a.length)return null;a=a[1];for(var b=(4-a.length%4)%4,c=0;c Auth section -> Sign in method tab.",a):"http"==d||"https"==d?c=Ka("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",a):b="operation-not-supported-in-this-environment"; L.call(this,b,c)}t(tg,L);function ug(a,b,c){L.call(this,a,c);a=b||{};a.yb&&J(this,"email",a.yb);a.$&&J(this,"phoneNumber",a.$);a.credential&&J(this,"credential",a.credential)}t(ug,L);ug.prototype.D=function(){var a={code:this.code,message:this.message};this.email&&(a.email=this.email);this.phoneNumber&&(a.phoneNumber=this.phoneNumber);var b=this.credential&&this.credential.D();b&&bb(a,b);return a};ug.prototype.toJSON=function(){return this.D()}; function vg(a){if(a.code){var b=a.code||"";0==b.indexOf(Ze)&&(b=b.substring(Ze.length));var c={credential:ng(a)};if(a.email)c.yb=a.email;else if(a.phoneNumber)c.$=a.phoneNumber;else if(!c.credential)return new L(b,a.message||void 0);return new ug(b,c,a.message)}return null};var wg=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;function xg(){}xg.prototype.c=null;function yg(a){return a.c||(a.c=a.b())};var zg;function Ag(){}t(Ag,xg);Ag.prototype.a=function(){var a=Bg(this);return a?new ActiveXObject(a):new XMLHttpRequest};Ag.prototype.b=function(){var a={};Bg(this)&&(a[0]=!0,a[1]=!0);return a}; function Bg(a){if(!a.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c=Ng(this).value)for(n(b)&&(b=b()),a=new Fg(a,String(b),this.f),c&&(a.a=c),c=this;c;)c=c.a};var Og={},Pg=null; function Qg(a){Pg||(Pg=new Hg(""),Og[""]=Pg,Pg.c=Lg);var b;if(!(b=Og[a])){b=new Hg(a);var c=a.lastIndexOf("."),d=a.substr(c+1);c=Qg(a.substr(0,c));c.b||(c.b={});c.b[d]=b;b.a=c;Og[a]=b}return b};function Rg(a,b){a&&a.log(Mg,b,void 0)};function Sg(a){this.f=a}t(Sg,xg);Sg.prototype.a=function(){return new Tg(this.f)};Sg.prototype.b=function(a){return function(){return a}}({});function Tg(a){F.call(this);this.i=a;this.readyState=Ug;this.status=0;this.responseText=this.statusText="";this.onreadystatechange=null;this.g=new Headers;this.b=null;this.h="GET";this.c="";this.a=!1;this.f=Qg("goog.net.FetchXmlHttp")}t(Tg,F);var Ug=0;g=Tg.prototype; g.open=function(a,b){if(this.readyState!=Ug)throw this.abort(),Error("Error reopening a connection");this.h=a;this.c=b;this.readyState=1;Vg(this)};g.send=function(a){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var b={headers:this.g,method:this.h,credentials:void 0,cache:void 0};a&&(b.body=a);this.i.fetch(new Request(this.c,b)).then(this.gc.bind(this),this.Fb.bind(this))}; g.abort=function(){this.responseText="";this.g=new Headers;this.status=0;1<=this.readyState&&this.a&&4!=this.readyState&&(this.readyState=4,this.a=!1,Vg(this));this.readyState=Ug};g.gc=function(a){this.a&&(this.b||(this.b=a.headers,this.readyState=2,Vg(this)),this.a&&(this.readyState=3,Vg(this),this.a&&a.text().then(this.fc.bind(this,a),this.Fb.bind(this))))};g.fc=function(a,b){this.a&&(this.status=a.status,this.statusText=a.statusText,this.responseText=b,this.readyState=4,Vg(this))}; g.Fb=function(a){var b=this.f;b&&b.log(Kg,"Failed to fetch url "+this.c,a instanceof Error?a:Error(a));this.a&&(this.readyState=4,Vg(this))};g.setRequestHeader=function(a,b){this.g.append(a,b)};g.getResponseHeader=function(a){return this.b?this.b.get(a.toLowerCase())||"":((a=this.f)&&a.log(Kg,"Attempting to get response header but no headers have been received for url: "+this.c,void 0),"")}; g.getAllResponseHeaders=function(){if(!this.b){var a=this.f;a&&a.log(Kg,"Attempting to get all response headers but no headers have been received for url: "+this.c,void 0);return""}a=[];for(var b=this.b.entries(),c=b.next();!c.done;)c=c.value,a.push(c[0]+": "+c[1]),c=b.next();return a.join("\r\n")};function Vg(a){a.onreadystatechange&&a.onreadystatechange.call(a)};function Wg(a){F.call(this);this.headers=new Lc;this.C=a||null;this.c=!1;this.w=this.a=null;this.h=this.N=this.m="";this.f=this.I=this.i=this.G=!1;this.g=0;this.u=null;this.o=Xg;this.v=this.O=!1}t(Wg,F);var Xg="";Wg.prototype.b=Qg("goog.net.XhrIo");var Yg=/^https?$/i,Zg=["POST","PUT"]; function $g(a,b,c,d,e){if(a.a)throw Error("[goog.net.XhrIo] Object is active with another request="+a.m+"; newUri="+b);c=c?c.toUpperCase():"GET";a.m=b;a.h="";a.N=c;a.G=!1;a.c=!0;a.a=a.C?a.C.a():zg.a();a.w=a.C?yg(a.C):yg(zg);a.a.onreadystatechange=r(a.Ib,a);try{Rg(a.b,ah(a,"Opening Xhr")),a.I=!0,a.a.open(c,String(b),!0),a.I=!1}catch(h){Rg(a.b,ah(a,"Error opening Xhr: "+h.message));bh(a,h);return}b=d||"";var f=new Lc(a.headers);e&&Kc(e,function(a,b){f.set(b,a)});e=Ea(f.U());d=k.FormData&&b instanceof k.FormData;!Ga(Zg,c)||e||d||f.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");f.forEach(function(a,b){this.a.setRequestHeader(b,a)},a);a.o&&(a.a.responseType=a.o);"withCredentials"in a.a&&a.a.withCredentials!==a.O&&(a.a.withCredentials=a.O);try{ch(a),0=b.l&&b.cancel())}this.v?this.v.call(this.u,this):this.m=!0;this.a||(a=new lh(this),mh(this),nh(this,!1,a))}};kh.prototype.o=function(a,b){this.i=!1;nh(this,a,b)};function nh(a,b,c){a.a=!0;a.c=c;a.f=!b;oh(a)} function mh(a){if(a.a){if(!a.m)throw new ph(a);a.m=!1}}kh.prototype.C=function(){mh(this);nh(this,!0,null)};function qh(a,b){rh(a,null,b,void 0)}function rh(a,b,c,d){a.g.push([b,c,d]);a.a&&oh(a)}kh.prototype.then=function(a,b,c){var d,e,f=new A(function(a,b){d=a;e=b});rh(this,d,function(a){a instanceof lh?f.cancel():e(a)});return f.then(a,b,c)};pa(kh);function sh(a){return Da(a.g,function(a){return n(a[1])})} function oh(a){if(a.h&&a.a&&sh(a)){var b=a.h,c=th[b];c&&(k.clearTimeout(c.a),delete th[b]);a.h=0}a.b&&(a.b.l--,delete a.b);b=a.c;for(var d=c=!1;a.g.length&&!a.i;){var e=a.g.shift(),f=e[0],h=e[1];e=e[2];if(f=a.f?h:f)try{var m=f.call(e||a.u,b);void 0!==m&&(a.f=a.f&&(m==b||m instanceof Error),a.c=b=m);if(qa(b)||"function"===typeof k.Promise&&b instanceof k.Promise)d=!0,a.i=!0}catch(p){b=p,a.f=!0,sh(a)||(c=!0)}}a.c=b;d&&(m=r(a.o,a,!0),d=r(a.o,a,!1),b instanceof kh?(rh(b,m,d),b.w=!0):b.then(m,d));c&&(b= new uh(b),th[b.a]=b,a.h=b.a)}function ph(){u.call(this)}t(ph,u);ph.prototype.message="Deferred has already fired";ph.prototype.name="AlreadyCalledError";function lh(){u.call(this)}t(lh,u);lh.prototype.message="Deferred was canceled";lh.prototype.name="CanceledError";function uh(a){this.a=k.setTimeout(r(this.c,this),0);this.b=a}uh.prototype.c=function(){delete th[this.a];throw this.b;};var th={};function vh(a){var b={},c=b.document||document,d=td(a),e=document.createElement("SCRIPT"),f={Kb:e,Ga:void 0},h=new kh(wh,f),m=null,p=null!=b.timeout?b.timeout:5E3;0b;b++){e=c[b-15]|0;d=c[b-2]|0;var f=(c[b-16]|0)+((e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3)|0,h=(c[b-7]|0)+((d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10)|0;c[b]=f+h|0}d=a.a[0]|0;e=a.a[1]|0;var m=a.a[2]|0,p=a.a[3]|0,x=a.a[4]|0,db=a.a[5]|0,la=a.a[6]|0;f=a.a[7]|0;for(b=0;64>b;b++){var Nl=((d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10))+(d&e^d&m^e&m)|0;h=x&db^~x&la;f=f+((x>>>6|x<<26)^(x>>>11|x<<21)^(x>>> 25|x<<7))|0;h=h+(Wj[b]|0)|0;h=f+(h+(c[b]|0)|0)|0;f=la;la=db;db=x;x=p+h|0;p=m;m=e;e=d;d=h+Nl|0}a.a[0]=a.a[0]+d|0;a.a[1]=a.a[1]+e|0;a.a[2]=a.a[2]+m|0;a.a[3]=a.a[3]+p|0;a.a[4]=a.a[4]+x|0;a.a[5]=a.a[5]+db|0;a.a[6]=a.a[6]+la|0;a.a[7]=a.a[7]+f|0} function dk(a,b,c){void 0===c&&(c=b.length);var d=0,e=a.c;if(l(b))for(;d=f&&f==(f|0)))throw Error("message must be a byte array");a.f[e++]=f;e==a.b&&(ck(a),e=0)}else throw Error("message must be string or array");a.c=e;a.g+=c} var Xj=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804, 4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function ek(){Uj.call(this,8,fk)}t(ek,Uj);var fk=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function gk(a,b,c,d,e){this.m=a;this.i=b;this.l=c;this.o=d||null;this.u=e||null;this.h=b+":"+c;this.v=new Sj;this.g=new Pj(this.h);this.f=null;this.b=[];this.a=this.c=null}function hk(a){return new L("invalid-cordova-configuration",a)}g=gk.prototype; g.ga=function(){return this.za?this.za:this.za=he().then(function(){if("function"!==typeof I("universalLinks.subscribe",k))throw hk("cordova-universal-links-plugin-fix is not installed");if("undefined"===typeof I("BuildInfo.packageName",k))throw hk("cordova-plugin-buildinfo is not installed");if("function"!==typeof I("cordova.plugins.browsertab.openUrl",k))throw hk("cordova-plugin-browsertab is not installed");if("function"!==typeof I("cordova.InAppBrowser.open",k))throw hk("cordova-plugin-inappbrowser is not installed"); },function(){throw new L("cordova-not-ready");})};function ik(){for(var a=20,b=[];0b.c?dk(b,bk,56-b.c):dk(b,bk,b.b-(b.c-56));for(var d=63;56<=d;d--)b.f[d]=c&255,c/=256;ck(b);for(d=c=0;d>e&255;return nf(a)} g.Ea=function(a,b){b(new L("operation-not-supported-in-this-environment"));return B()};g.Bb=function(){return C(new L("operation-not-supported-in-this-environment"))};g.Pb=function(){return!1};g.Lb=function(){return!0};g.Gb=function(){return!0}; g.Ca=function(a,b,c){if(this.c)return C(new L("redirect-operation-pending"));var d=this,e=k.document,f=null,h=null,m=null,p=null;return this.c=B().then(function(){og(b);return kk(d)}).then(function(){return lk(d,a,b,c)}).then(function(){return(new A(function(a,b){h=function(){var b=I("cordova.plugins.browsertab.close",k);a();"function"===typeof b&&b();d.a&&"function"===typeof d.a.close&&(d.a.close(),d.a=null);return!1};d.va(h);m=function(){f||(f=Hc(2E3).then(function(){b(new L("redirect-cancelled-by-user"))}))}; p=function(){Ce()&&m()};e.addEventListener("resume",m,!1);H().toLowerCase().match(/android/)||e.addEventListener("visibilitychange",p,!1)})).s(function(a){return mk(d).then(function(){throw a;})})}).ia(function(){m&&e.removeEventListener("resume",m,!1);p&&e.removeEventListener("visibilitychange",p,!1);f&&f.cancel();h&&d.Ka(h);d.c=null})}; function lk(a,b,c,d){var e=ik(),f=new pg(b,d,null,e,new L("no-auth-event")),h=I("BuildInfo.packageName",k);if("string"!==typeof h)throw new L("invalid-cordova-configuration");var m=I("BuildInfo.displayName",k),p={};if(H().toLowerCase().match(/iphone|ipad|ipod/))p.ibi=h;else if(H().toLowerCase().match(/android/))p.apn=h;else return C(new L("operation-not-supported-in-this-environment"));m&&(p.appDisplayName=m);e=jk(e);p.sessionId=e;var x=Ui(a.m,a.i,a.l,b,c,null,d,a.o,p,a.u);return a.ga().then(function(){var b= a.h;return a.v.a.set(Qj,f.D(),b)}).then(function(){var b=I("cordova.plugins.browsertab.isAvailable",k);if("function"!==typeof b)throw new L("invalid-cordova-configuration");var c=null;b(function(b){if(b){c=I("cordova.plugins.browsertab.openUrl",k);if("function"!==typeof c)throw new L("invalid-cordova-configuration");c(x)}else{c=I("cordova.InAppBrowser.open",k);if("function"!==typeof c)throw new L("invalid-cordova-configuration");b=H();b=!(!b.match(/(iPad|iPhone|iPod).*OS 7_\d/i)&&!b.match(/(iPad|iPhone|iPod).*OS 8_\d/i)); a.a=c(x,b?"_blank":"_system","location=yes")}})})}function nk(a,b){for(var c=0;ca.f&&(a.a=a.f);return b}function Sk(a,b){a.stop();a.b=Hc(Tk(a,b)).then(function(){return De()}).then(function(){return a.h()}).then(function(){Sk(a,!0)}).s(function(b){a.i(b)&&Sk(a,!1)})} Rk.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)};function Uk(a){this.f=a;this.b=this.a=null;this.c=0}Uk.prototype.D=function(){return{apiKey:this.f.b,refreshToken:this.a,accessToken:this.b,expirationTime:this.c}};function Vk(a,b){var c=b[M],d=b.refreshToken;b=Wk(b.expiresIn);a.b=c;a.c=b;a.a=d}function Xk(a,b){a.b=b.b;a.a=b.a;a.c=b.c}function Wk(a){return oa()+1E3*parseInt(a,10)} function Yk(a,b){return Ph(a.f,b).then(function(b){a.b=b.access_token;a.c=Wk(b.expires_in);a.a=b.refresh_token;return{accessToken:a.b,expirationTime:a.c,refreshToken:a.a}}).s(function(b){"auth/user-token-expired"==b.code&&(a.a=null);throw b;})}Uk.prototype.getToken=function(a){a=!!a;return this.b&&!this.a?C(new L("user-token-expired")):a||!this.b||oa()>this.c-3E4?this.a?Yk(this,{grant_type:"refresh_token",refresh_token:this.a}):B(null):B({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})};function Zk(a,b){this.a=a||null;this.b=b||null;K(this,{lastSignInTime:Ee(b||null),creationTime:Ee(a||null)})}function $k(a){return new Zk(a.a,a.b)}Zk.prototype.D=function(){return{lastLoginAt:this.b,createdAt:this.a}};function al(a,b,c,d,e,f){K(this,{uid:a,displayName:d||null,photoURL:e||null,email:c||null,phoneNumber:f||null,providerId:b})}function bl(a,b){D.call(this,a);for(var c in b)this[c]=b[c]}t(bl,D); function Q(a,b,c){this.G=[];this.m=a.apiKey;this.o=a.appName;this.u=a.authDomain||null;a=_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.SDK_VERSION?qe(_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.SDK_VERSION):null;this.b=new Dh(this.m,Ai(Bi),a);this.h=new Uk(this.b);cl(this,b[M]);Vk(this.h,b);J(this,"refreshToken",this.h.a);dl(this,c||{});F.call(this);this.I=!1;this.u&&te()&&(this.a=Gk(this.u,this.m,this.o));this.N=[];this.i=null;this.w=el(this);this.V=r(this.Ha,this);var d=this;this.ka=null;this.sa=function(a){d.oa(a.g)};this.X=null;this.O=[];this.ra=function(a){fl(d, a.c)};this.W=null}t(Q,F);Q.prototype.oa=function(a){this.ka=a;Jh(this.b,a)};Q.prototype.ea=function(){return this.ka};function gl(a,b){a.X&&E(a.X,"languageCodeChanged",a.sa);(a.X=b)&&rc(b,"languageCodeChanged",a.sa)}function fl(a,b){a.O=b;Kh(a.b,_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.SDK_VERSION?qe(_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.SDK_VERSION,a.O):null)}Q.prototype.xa=function(){return Ja(this.O)};function hl(a,b){a.W&&E(a.W,"frameworkChanged",a.ra);(a.W=b)&&rc(b,"frameworkChanged",a.ra)}Q.prototype.Ha=function(){this.w.b&&(this.w.stop(),this.w.start())}; function il(a){try{return _firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.app(a.o).auth()}catch(b){throw new L("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+a.o+"'!");}}function el(a){return new Rk(function(){return a.F(!0)},function(a){return a&&"auth/network-request-failed"==a.code?!0:!1},function(){var b=a.h.c-oa()-3E5;return 0this.u&&(this.u=0);0==this.u&&U(this)&&kl(U(this));this.removeAuthTokenListener(a)}; g.addAuthTokenListener=function(a){var b=this;this.o.push(a);T(this,this.i.then(function(){b.m||Ga(b.o,a)&&a(lm(b))}))};g.removeAuthTokenListener=function(a){w(this.o,function(b){return b==a})};function km(a,b){a.I.push(b);T(a,a.i.then(function(){!a.m&&Ga(a.I,b)&&a.O!==a.getUid()&&(a.O=a.getUid(),b(lm(a)))}))} g.delete=function(){this.m=!0;for(var a=0;ae||e>=Km.length)throw new L("internal-error", "Argument validator received an unsupported number of arguments.");c=Km[e];d=(d?"":c+" argument ")+(b.name?'"'+b.name+'" ':"")+"must be "+b.K+".";break a}d=null}}if(d)throw new L("argument-error",a+" failed: "+d);}var Km="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function V(a,b){return{name:a||"",K:"a valid string",optional:!!b,M:l}}function Lm(a,b){return{name:a||"",K:"a boolean",optional:!!b,M:ba}} function W(a,b){return{name:a||"",K:"a valid object",optional:!!b,M:q}}function Mm(a,b){return{name:a||"",K:"a function",optional:!!b,M:n}}function Nm(a,b){return{name:a||"",K:"null",optional:!!b,M:ea}}function Om(){return{name:"",K:"an HTML element",optional:!1,M:function(a){return!!(a&&a instanceof Element)}}}function Pm(){return{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(a){return!!(a&&a instanceof Yl)}}} function Qm(){return{name:"app",K:"an instance of Firebase App",optional:!0,M:function(a){return!!(a&&a instanceof _firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.app.App)}}}function Rm(a){return{name:a?a+"Credential":"credential",K:a?"a valid "+a+" credential":"a valid credential",optional:!1,M:function(b){if(!b)return!1;var c=!a||b.providerId===a;return!(!b.ya||!c)}}} function Sm(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(a){return!!(a&&a.providerId&&a.hasOwnProperty&&a.hasOwnProperty("isOAuthProvider"))}}}function Tm(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(a){return!!(a&&l(a.type)&&n(a.verify))}}}function X(a,b,c,d){return{name:c||"",K:a.K+" or "+b.K,optional:!!d,M:function(c){return a.M(c)||b.M(c)}}};function Y(a,b){for(var c in b){var d=b[c].name;a[d]=Um(d,a[c],b[c].j)}}function Vm(a,b){for(var c in b){var d=b[c].name;d!==c&&Object.defineProperty(a,d,{get:na(function(a){return this[a]},c),set:na(function(a,b,c,d){Jm(a,[c],[d],!0);this[b]=d},d,c,b[c].sb),enumerable:!0})}}function Z(a,b,c,d){a[b]=Um(b,c,d)} function Um(a,b,c){function d(){var a=Array.prototype.slice.call(arguments);Jm(e,c,a);return b.apply(this,a)}if(!c)return b;var e=Wm(a),f;for(f in b)d[f]=b[f];for(f in b.prototype)d.prototype[f]=b.prototype[f];return d}function Wm(a){a=a.split(".");return a[a.length-1]};Y(Yl.prototype,{Va:{name:"applyActionCode",j:[V("code")]},Ja:{name:"checkActionCode",j:[V("code")]},Ya:{name:"confirmPasswordReset",j:[V("code"),V("newPassword")]},wb:{name:"createUserWithEmailAndPassword",j:[V("email"),V("password")]},Vb:{name:"createUserAndRetrieveDataWithEmailAndPassword",j:[V("email"),V("password")]},Yb:{name:"fetchProvidersForEmail",j:[V("email")]},Zb:{name:"fetchSignInMethodsForEmail",j:[V("email")]},fa:{name:"getRedirectResult",j:[]},nc:{name:"isSignInWithEmailLink",j:[V("emailLink")]}, tc:{name:"onAuthStateChanged",j:[X(W(),Mm(),"nextOrObserver"),Mm("opt_error",!0),Mm("opt_completed",!0)]},uc:{name:"onIdTokenChanged",j:[X(W(),Mm(),"nextOrObserver"),Mm("opt_error",!0),Mm("opt_completed",!0)]},jb:{name:"sendPasswordResetEmail",j:[V("email"),X(W("opt_actionCodeSettings",!0),Nm(null,!0),"opt_actionCodeSettings",!0)]},kb:{name:"sendSignInLinkToEmail",j:[V("email"),W("actionCodeSettings")]},lb:{name:"setPersistence",j:[V("persistence")]},Oa:{name:"signInAndRetrieveDataWithCredential", j:[Rm()]},Pa:{name:"signInAnonymously",j:[]},Fc:{name:"signInAnonymouslyAndRetrieveData",j:[]},Gc:{name:"signInWithCredential",j:[Rm()]},Mb:{name:"signInWithCustomToken",j:[V("token")]},Dc:{name:"signInAndRetrieveDataWithCustomToken",j:[V("token")]},Nb:{name:"signInWithEmailAndPassword",j:[V("email"),V("password")]},Hc:{name:"signInWithEmailLink",j:[V("email"),V("emailLink",!0)]},Ec:{name:"signInAndRetrieveDataWithEmailAndPassword",j:[V("email"),V("password")]},Ic:{name:"signInWithPhoneNumber",j:[V("phoneNumber"), Tm()]},Jc:{name:"signInWithPopup",j:[Sm()]},Kc:{name:"signInWithRedirect",j:[Sm()]},Pc:{name:"updateCurrentUser",j:[X(function(a){return{name:"user",K:"an instance of Firebase User",optional:!!a,M:function(a){return!!(a&&a instanceof Q)}}}(),Nm(),"user")]},mb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[V(null,!0)]},Rc:{name:"useDeviceLanguage",j:[]},Sc:{name:"verifyPasswordResetCode",j:[V("code")]}});Vm(Yl.prototype,{lc:{name:"languageCode",sb:X(V(),Nm(),"languageCode")}});Yl.Persistence=Ej; Yl.Persistence.LOCAL="local";Yl.Persistence.SESSION="session";Yl.Persistence.NONE="none"; Y(Q.prototype,{"delete":{name:"delete",j:[]},cc:{name:"getIdTokenResult",j:[Lm("opt_forceRefresh",!0)]},F:{name:"getIdToken",j:[Lm("opt_forceRefresh",!0)]},cb:{name:"linkAndRetrieveDataWithCredential",j:[Rm()]},oc:{name:"linkWithCredential",j:[Rm()]},pc:{name:"linkWithPhoneNumber",j:[V("phoneNumber"),Tm()]},qc:{name:"linkWithPopup",j:[Sm()]},rc:{name:"linkWithRedirect",j:[Sm()]},fb:{name:"reauthenticateAndRetrieveDataWithCredential",j:[Rm()]},xc:{name:"reauthenticateWithCredential",j:[Rm()]},yc:{name:"reauthenticateWithPhoneNumber", j:[V("phoneNumber"),Tm()]},zc:{name:"reauthenticateWithPopup",j:[Sm()]},Ac:{name:"reauthenticateWithRedirect",j:[Sm()]},reload:{name:"reload",j:[]},ib:{name:"sendEmailVerification",j:[X(W("opt_actionCodeSettings",!0),Nm(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[V(null,!0)]},Oc:{name:"unlink",j:[V("provider")]},ob:{name:"updateEmail",j:[V("email")]},pb:{name:"updatePassword",j:[V("password")]},Qc:{name:"updatePhoneNumber",j:[Rm("phone")]},qb:{name:"updateProfile",j:[W("profile")]}}); Y(nm.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}});Y(mm.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}});Y(A.prototype,{ia:{name:"finally"},s:{name:"catch"},then:{name:"then"}});Vm(Nk.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",sb:Lm("appVerificationDisabledForTesting")}});Y(Ok.prototype,{confirm:{name:"confirm",j:[V("verificationCode")]}}); Z(O,"credential",function(a,b){return new $f(a,b)},[V("email"),V("password")]);Y(Sf.prototype,{ta:{name:"addScope",j:[V("scope")]},Da:{name:"setCustomParameters",j:[W("customOAuthParameters")]}});Z(Sf,"credential",Tf,[X(V(),W(),"token")]);Z(O,"credentialWithLink",eg,[V("email"),V("emailLink")]);Y(Uf.prototype,{ta:{name:"addScope",j:[V("scope")]},Da:{name:"setCustomParameters",j:[W("customOAuthParameters")]}});Z(Uf,"credential",Vf,[X(V(),W(),"token")]); Y(Wf.prototype,{ta:{name:"addScope",j:[V("scope")]},Da:{name:"setCustomParameters",j:[W("customOAuthParameters")]}});Z(Wf,"credential",Xf,[X(V(),X(W(),Nm()),"idToken"),X(V(),Nm(),"accessToken",!0)]);Y(Yf.prototype,{Da:{name:"setCustomParameters",j:[W("customOAuthParameters")]}});Z(Yf,"credential",Zf,[X(V(),W(),"token"),V("secret",!0)]); Y(N.prototype,{ta:{name:"addScope",j:[V("scope")]},credential:{name:"credential",j:[X(V(),Nm(),"idToken",!0),X(V(),Nm(),"accessToken",!0)]},Da:{name:"setCustomParameters",j:[W("customOAuthParameters")]}});Z(kg,"credential",mg,[V("verificationId"),V("verificationCode")]);Y(kg.prototype,{Ta:{name:"verifyPhoneNumber",j:[V("phoneNumber"),Tm()]}});Y(L.prototype,{toJSON:{name:"toJSON",j:[V(null,!0)]}});Y(ug.prototype,{toJSON:{name:"toJSON",j:[V(null,!0)]}}); Y(tg.prototype,{toJSON:{name:"toJSON",j:[V(null,!0)]}});Y(Im.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}); (function(){if("undefined"!==typeof _firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a&&_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.INTERNAL&&_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.INTERNAL.registerService){var a={Auth:Yl,Error:L};Z(a,"EmailAuthProvider",O,[]);Z(a,"FacebookAuthProvider",Sf,[]);Z(a,"GithubAuthProvider",Uf,[]);Z(a,"GoogleAuthProvider",Wf,[]);Z(a,"TwitterAuthProvider",Yf,[]);Z(a,"OAuthProvider",N,[V("providerId")]);Z(a,"PhoneAuthProvider",kg,[Pm()]);Z(a,"RecaptchaVerifier",Im,[X(V(),Om(),"recaptchaContainer"),W("recaptchaParameters",!0),Qm()]);_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.INTERNAL.registerService("auth",function(a, c){a=new Yl(a);c({INTERNAL:{getUid:r(a.getUid,a),getToken:r(a.bc,a),addAuthTokenListener:r(a.Ub,a),removeAuthTokenListener:r(a.Bc,a)}});return a},a,function(a,c){if("create"===a)try{c.auth()}catch(d){}});_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.INTERNAL.extendNamespace({User:Q})}else throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");})();}).apply(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {}); //# sourceMappingURL=auth.esm.js.map /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../console-browserify/index.js */ "../../node_modules/console-browserify/index.js"), __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "../../node_modules/@firebase/database/dist/index.cjs.js": /*!******************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/database/dist/index.cjs.js ***! \******************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process, console) { Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var util = __webpack_require__(/*! @firebase/util */ "../../node_modules/@firebase/util/dist/index.cjs.js"); var logger = __webpack_require__(/*! @firebase/logger */ "../../node_modules/@firebase/logger/dist/index.esm.js"); var tslib_1 = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); var firebase = _interopDefault(__webpack_require__(/*! @firebase/app */ "../../node_modules/@firebase/app/dist/index.cjs.js")); /** * Copyright 2017 Google Inc. * * 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. */ /** * Wraps a DOM Storage object and: * - automatically encode objects as JSON strings before storing them to allow us to store arbitrary types. * - prefixes names with "firebase:" to avoid collisions with app data. * * We automatically (see storage.js) create two such wrappers, one for sessionStorage, * and one for localStorage. * * @constructor */ var DOMStorageWrapper = /** @class */ (function () { /** * @param {Storage} domStorage_ The underlying storage object (e.g. localStorage or sessionStorage) */ function DOMStorageWrapper(domStorage_) { this.domStorage_ = domStorage_; // Use a prefix to avoid collisions with other stuff saved by the app. this.prefix_ = 'firebase:'; } /** * @param {string} key The key to save the value under * @param {?Object} value The value being stored, or null to remove the key. */ DOMStorageWrapper.prototype.set = function (key, value) { if (value == null) { this.domStorage_.removeItem(this.prefixedName_(key)); } else { this.domStorage_.setItem(this.prefixedName_(key), util.stringify(value)); } }; /** * @param {string} key * @return {*} The value that was stored under this key, or null */ DOMStorageWrapper.prototype.get = function (key) { var storedVal = this.domStorage_.getItem(this.prefixedName_(key)); if (storedVal == null) { return null; } else { return util.jsonEval(storedVal); } }; /** * @param {string} key */ DOMStorageWrapper.prototype.remove = function (key) { this.domStorage_.removeItem(this.prefixedName_(key)); }; /** * @param {string} name * @return {string} */ DOMStorageWrapper.prototype.prefixedName_ = function (name) { return this.prefix_ + name; }; DOMStorageWrapper.prototype.toString = function () { return this.domStorage_.toString(); }; return DOMStorageWrapper; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * An in-memory storage implementation that matches the API of DOMStorageWrapper * (TODO: create interface for both to implement). * * @constructor */ var MemoryStorage = /** @class */ (function () { function MemoryStorage() { this.cache_ = {}; this.isInMemoryStorage = true; } MemoryStorage.prototype.set = function (key, value) { if (value == null) { delete this.cache_[key]; } else { this.cache_[key] = value; } }; MemoryStorage.prototype.get = function (key) { if (util.contains(this.cache_, key)) { return this.cache_[key]; } return null; }; MemoryStorage.prototype.remove = function (key) { delete this.cache_[key]; }; return MemoryStorage; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Helper to create a DOMStorageWrapper or else fall back to MemoryStorage. * TODO: Once MemoryStorage and DOMStorageWrapper have a shared interface this method annotation should change * to reflect this type * * @param {string} domStorageName Name of the underlying storage object * (e.g. 'localStorage' or 'sessionStorage'). * @return {?} Turning off type information until a common interface is defined. */ var createStoragefor = function (domStorageName) { try { // NOTE: just accessing "localStorage" or "window['localStorage']" may throw a security exception, // so it must be inside the try/catch. if (typeof window !== 'undefined' && typeof window[domStorageName] !== 'undefined') { // Need to test cache. Just because it's here doesn't mean it works var domStorage = window[domStorageName]; domStorage.setItem('firebase:sentinel', 'cache'); domStorage.removeItem('firebase:sentinel'); return new DOMStorageWrapper(domStorage); } } catch (e) { } // Failed to create wrapper. Just return in-memory storage. // TODO: log? return new MemoryStorage(); }; /** A storage object that lasts across sessions */ var PersistentStorage = createStoragefor('localStorage'); /** A storage object that only lasts one session */ var SessionStorage = createStoragefor('sessionStorage'); /** * Copyright 2017 Google Inc. * * 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. */ var logClient = new logger.Logger('@firebase/database'); /** * Returns a locally-unique ID (generated by just incrementing up from 0 each time its called). * @type {function(): number} Generated ID. */ var LUIDGenerator = (function () { var id = 1; return function () { return id++; }; })(); /** * Sha1 hash of the input string * @param {!string} str The string to hash * @return {!string} The resulting hash */ var sha1 = function (str) { var utf8Bytes = util.stringToByteArray(str); var sha1 = new util.Sha1(); sha1.update(utf8Bytes); var sha1Bytes = sha1.digest(); return util.base64.encodeByteArray(sha1Bytes); }; /** * @param {...*} var_args * @return {string} * @private */ var buildLogMessage_ = function () { var var_args = []; for (var _i = 0; _i < arguments.length; _i++) { var_args[_i] = arguments[_i]; } var message = ''; for (var i = 0; i < var_args.length; i++) { if (Array.isArray(var_args[i]) || (var_args[i] && typeof var_args[i] === 'object' && typeof var_args[i].length === 'number')) { message += buildLogMessage_.apply(null, var_args[i]); } else if (typeof var_args[i] === 'object') { message += util.stringify(var_args[i]); } else { message += var_args[i]; } message += ' '; } return message; }; /** * Use this for all debug messages in Firebase. * @type {?function(string)} */ var logger$1 = null; /** * Flag to check for log availability on first log message * @type {boolean} * @private */ var firstLog_ = true; /** * The implementation of Firebase.enableLogging (defined here to break dependencies) * @param {boolean|?function(string)} logger_ A flag to turn on logging, or a custom logger * @param {boolean=} persistent Whether or not to persist logging settings across refreshes */ var enableLogging = function (logger_, persistent) { util.assert(!persistent || (logger_ === true || logger_ === false), "Can't turn on custom loggers persistently."); if (logger_ === true) { logClient.logLevel = logger.LogLevel.VERBOSE; logger$1 = logClient.log.bind(logClient); if (persistent) SessionStorage.set('logging_enabled', true); } else if (typeof logger_ === 'function') { logger$1 = logger_; } else { logger$1 = null; SessionStorage.remove('logging_enabled'); } }; /** * * @param {...(string|Arguments)} var_args */ var log = function () { var var_args = []; for (var _i = 0; _i < arguments.length; _i++) { var_args[_i] = arguments[_i]; } if (firstLog_ === true) { firstLog_ = false; if (logger$1 === null && SessionStorage.get('logging_enabled') === true) enableLogging(true); } if (logger$1) { var message = buildLogMessage_.apply(null, var_args); logger$1(message); } }; /** * @param {!string} prefix * @return {function(...[*])} */ var logWrapper = function (prefix) { return function () { var var_args = []; for (var _i = 0; _i < arguments.length; _i++) { var_args[_i] = arguments[_i]; } log.apply(void 0, [prefix].concat(var_args)); }; }; /** * @param {...string} var_args */ var error = function () { var var_args = []; for (var _i = 0; _i < arguments.length; _i++) { var_args[_i] = arguments[_i]; } var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, var_args); logClient.error(message); }; /** * @param {...string} var_args */ var fatal = function () { var var_args = []; for (var _i = 0; _i < arguments.length; _i++) { var_args[_i] = arguments[_i]; } var message = "FIREBASE FATAL ERROR: " + buildLogMessage_.apply(void 0, var_args); logClient.error(message); throw new Error(message); }; /** * @param {...*} var_args */ var warn = function () { var var_args = []; for (var _i = 0; _i < arguments.length; _i++) { var_args[_i] = arguments[_i]; } var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, var_args); logClient.warn(message); }; /** * Logs a warning if the containing page uses https. Called when a call to new Firebase * does not use https. */ var warnIfPageIsSecure = function () { // Be very careful accessing browser globals. Who knows what may or may not exist. if (typeof window !== 'undefined' && window.location && window.location.protocol && window.location.protocol.indexOf('https:') !== -1) { warn('Insecure Firebase access from a secure page. ' + 'Please use https in calls to new Firebase().'); } }; /** * Returns true if data is NaN, or +/- Infinity. * @param {*} data * @return {boolean} */ var isInvalidJSONNumber = function (data) { return (typeof data === 'number' && (data != data || // NaN data == Number.POSITIVE_INFINITY || data == Number.NEGATIVE_INFINITY)); }; /** * @param {function()} fn */ var executeWhenDOMReady = function (fn) { if (util.isNodeSdk() || document.readyState === 'complete') { fn(); } else { // Modeled after jQuery. Try DOMContentLoaded and onreadystatechange (which // fire before onload), but fall back to onload. var called_1 = false; var wrappedFn_1 = function () { if (!document.body) { setTimeout(wrappedFn_1, Math.floor(10)); return; } if (!called_1) { called_1 = true; fn(); } }; if (document.addEventListener) { document.addEventListener('DOMContentLoaded', wrappedFn_1, false); // fallback to onload. window.addEventListener('load', wrappedFn_1, false); } else if (document.attachEvent) { // IE. document.attachEvent('onreadystatechange', function () { if (document.readyState === 'complete') wrappedFn_1(); }); // fallback to onload. window.attachEvent('onload', wrappedFn_1); // jQuery has an extra hack for IE that we could employ (based on // http://javascript.nwbox.com/IEContentLoaded/) But it looks really old. // I'm hoping we don't need it. } } }; /** * Minimum key name. Invalid for actual data, used as a marker to sort before any valid names * @type {!string} */ var MIN_NAME = '[MIN_NAME]'; /** * Maximum key name. Invalid for actual data, used as a marker to sort above any valid names * @type {!string} */ var MAX_NAME = '[MAX_NAME]'; /** * Compares valid Firebase key names, plus min and max name * @param {!string} a * @param {!string} b * @return {!number} */ var nameCompare = function (a, b) { if (a === b) { return 0; } else if (a === MIN_NAME || b === MAX_NAME) { return -1; } else if (b === MIN_NAME || a === MAX_NAME) { return 1; } else { var aAsInt = tryParseInt(a), bAsInt = tryParseInt(b); if (aAsInt !== null) { if (bAsInt !== null) { return aAsInt - bAsInt == 0 ? a.length - b.length : aAsInt - bAsInt; } else { return -1; } } else if (bAsInt !== null) { return 1; } else { return a < b ? -1 : 1; } } }; /** * @param {!string} a * @param {!string} b * @return {!number} comparison result. */ var stringCompare = function (a, b) { if (a === b) { return 0; } else if (a < b) { return -1; } else { return 1; } }; /** * @param {string} key * @param {Object} obj * @return {*} */ var requireKey = function (key, obj) { if (obj && key in obj) { return obj[key]; } else { throw new Error('Missing required key (' + key + ') in object: ' + util.stringify(obj)); } }; /** * @param {*} obj * @return {string} */ var ObjectToUniqueKey = function (obj) { if (typeof obj !== 'object' || obj === null) return util.stringify(obj); var keys = []; for (var k in obj) { keys.push(k); } // Export as json, but with the keys sorted. keys.sort(); var key = '{'; for (var i = 0; i < keys.length; i++) { if (i !== 0) key += ','; key += util.stringify(keys[i]); key += ':'; key += ObjectToUniqueKey(obj[keys[i]]); } key += '}'; return key; }; /** * Splits a string into a number of smaller segments of maximum size * @param {!string} str The string * @param {!number} segsize The maximum number of chars in the string. * @return {Array.} The string, split into appropriately-sized chunks */ var splitStringBySize = function (str, segsize) { var len = str.length; if (len <= segsize) { return [str]; } var dataSegs = []; for (var c = 0; c < len; c += segsize) { if (c + segsize > len) { dataSegs.push(str.substring(c, len)); } else { dataSegs.push(str.substring(c, c + segsize)); } } return dataSegs; }; /** * Apply a function to each (key, value) pair in an object or * apply a function to each (index, value) pair in an array * @param {!(Object|Array)} obj The object or array to iterate over * @param {function(?, ?)} fn The function to apply */ var each = function (obj, fn) { if (Array.isArray(obj)) { for (var i = 0; i < obj.length; ++i) { fn(i, obj[i]); } } else { /** * in the conversion of code we removed the goog.object.forEach * function which did a value,key callback. We standardized on * a single impl that does a key, value callback. So we invert * to not have to touch the `each` code points */ util.forEach(obj, function (key, val) { return fn(val, key); }); } }; /** * Borrowed from http://hg.secondlife.com/llsd/src/tip/js/typedarray.js (MIT License) * I made one modification at the end and removed the NaN / Infinity * handling (since it seemed broken [caused an overflow] and we don't need it). See MJL comments. * @param {!number} v A double * @return {string} */ var doubleToIEEE754String = function (v) { util.assert(!isInvalidJSONNumber(v), 'Invalid JSON number'); // MJL var ebits = 11, fbits = 52; var bias = (1 << (ebits - 1)) - 1, s, e, f, ln, i, bits, str; // Compute sign, exponent, fraction // Skip NaN / Infinity handling --MJL. if (v === 0) { e = 0; f = 0; s = 1 / v === -Infinity ? 1 : 0; } else { s = v < 0; v = Math.abs(v); if (v >= Math.pow(2, 1 - bias)) { // Normalized ln = Math.min(Math.floor(Math.log(v) / Math.LN2), bias); e = ln + bias; f = Math.round(v * Math.pow(2, fbits - ln) - Math.pow(2, fbits)); } else { // Denormalized e = 0; f = Math.round(v / Math.pow(2, 1 - bias - fbits)); } } // Pack sign, exponent, fraction bits = []; for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = Math.floor(f / 2); } for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = Math.floor(e / 2); } bits.push(s ? 1 : 0); bits.reverse(); str = bits.join(''); // Return the data as a hex string. --MJL var hexByteString = ''; for (i = 0; i < 64; i += 8) { var hexByte = parseInt(str.substr(i, 8), 2).toString(16); if (hexByte.length === 1) hexByte = '0' + hexByte; hexByteString = hexByteString + hexByte; } return hexByteString.toLowerCase(); }; /** * Used to detect if we're in a Chrome content script (which executes in an * isolated environment where long-polling doesn't work). * @return {boolean} */ var isChromeExtensionContentScript = function () { return !!(typeof window === 'object' && window['chrome'] && window['chrome']['extension'] && !/^chrome/.test(window.location.href)); }; /** * Used to detect if we're in a Windows 8 Store app. * @return {boolean} */ var isWindowsStoreApp = function () { // Check for the presence of a couple WinRT globals return typeof Windows === 'object' && typeof Windows.UI === 'object'; }; /** * Converts a server error code to a Javascript Error * @param {!string} code * @param {!Query} query * @return {Error} */ var errorForServerCode = function (code, query) { var reason = 'Unknown Error'; if (code === 'too_big') { reason = 'The data requested exceeds the maximum size ' + 'that can be accessed with a single request.'; } else if (code == 'permission_denied') { reason = "Client doesn't have permission to access the desired data."; } else if (code == 'unavailable') { reason = 'The service is unavailable'; } var error = new Error(code + ' at ' + query.path.toString() + ': ' + reason); error.code = code.toUpperCase(); return error; }; /** * Used to test for integer-looking strings * @type {RegExp} * @private */ var INTEGER_REGEXP_ = new RegExp('^-?\\d{1,10}$'); /** * If the string contains a 32-bit integer, return it. Else return null. * @param {!string} str * @return {?number} */ var tryParseInt = function (str) { if (INTEGER_REGEXP_.test(str)) { var intVal = Number(str); if (intVal >= -2147483648 && intVal <= 2147483647) { return intVal; } } return null; }; /** * Helper to run some code but catch any exceptions and re-throw them later. * Useful for preventing user callbacks from breaking internal code. * * Re-throwing the exception from a setTimeout is a little evil, but it's very * convenient (we don't have to try to figure out when is a safe point to * re-throw it), and the behavior seems reasonable: * * * If you aren't pausing on exceptions, you get an error in the console with * the correct stack trace. * * If you're pausing on all exceptions, the debugger will pause on your * exception and then again when we rethrow it. * * If you're only pausing on uncaught exceptions, the debugger will only pause * on us re-throwing it. * * @param {!function()} fn The code to guard. */ var exceptionGuard = function (fn) { try { fn(); } catch (e) { // Re-throw exception when it's safe. setTimeout(function () { // It used to be that "throw e" would result in a good console error with // relevant context, but as of Chrome 39, you just get the firebase.js // file/line number where we re-throw it, which is useless. So we log // e.stack explicitly. var stack = e.stack || ''; warn('Exception was thrown by user callback.', stack); throw e; }, Math.floor(0)); } }; /** * @return {boolean} true if we think we're currently being crawled. */ var beingCrawled = function () { var userAgent = (typeof window === 'object' && window['navigator'] && window['navigator']['userAgent']) || ''; // For now we whitelist the most popular crawlers. We should refine this to be the set of crawlers we // believe to support JavaScript/AJAX rendering. // NOTE: Google Webmaster Tools doesn't really belong, but their "This is how a visitor to your website // would have seen the page" is flaky if we don't treat it as a crawler. return (userAgent.search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i) >= 0); }; /** * Same as setTimeout() except on Node.JS it will /not/ prevent the process from exiting. * * It is removed with clearTimeout() as normal. * * @param {Function} fn Function to run. * @param {number} time Milliseconds to wait before running. * @return {number|Object} The setTimeout() return value. */ var setTimeoutNonBlocking = function (fn, time) { var timeout = setTimeout(fn, time); if (typeof timeout === 'object' && timeout['unref']) { timeout['unref'](); } return timeout; }; /** * Copyright 2017 Google Inc. * * 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. */ /** * An immutable object representing a parsed path. It's immutable so that you * can pass them around to other functions without worrying about them changing * it. */ var Path = /** @class */ (function () { /** * @param {string|Array.} pathOrString Path string to parse, * or another path, or the raw tokens array * @param {number=} pieceNum */ function Path(pathOrString, pieceNum) { if (pieceNum === void 0) { this.pieces_ = pathOrString.split('/'); // Remove empty pieces. var copyTo = 0; for (var i = 0; i < this.pieces_.length; i++) { if (this.pieces_[i].length > 0) { this.pieces_[copyTo] = this.pieces_[i]; copyTo++; } } this.pieces_.length = copyTo; this.pieceNum_ = 0; } else { this.pieces_ = pathOrString; this.pieceNum_ = pieceNum; } } Object.defineProperty(Path, "Empty", { /** * Singleton to represent an empty path * * @const */ get: function () { return new Path(''); }, enumerable: true, configurable: true }); Path.prototype.getFront = function () { if (this.pieceNum_ >= this.pieces_.length) return null; return this.pieces_[this.pieceNum_]; }; /** * @return {number} The number of segments in this path */ Path.prototype.getLength = function () { return this.pieces_.length - this.pieceNum_; }; /** * @return {!Path} */ Path.prototype.popFront = function () { var pieceNum = this.pieceNum_; if (pieceNum < this.pieces_.length) { pieceNum++; } return new Path(this.pieces_, pieceNum); }; /** * @return {?string} */ Path.prototype.getBack = function () { if (this.pieceNum_ < this.pieces_.length) return this.pieces_[this.pieces_.length - 1]; return null; }; Path.prototype.toString = function () { var pathString = ''; for (var i = this.pieceNum_; i < this.pieces_.length; i++) { if (this.pieces_[i] !== '') pathString += '/' + this.pieces_[i]; } return pathString || '/'; }; Path.prototype.toUrlEncodedString = function () { var pathString = ''; for (var i = this.pieceNum_; i < this.pieces_.length; i++) { if (this.pieces_[i] !== '') pathString += '/' + encodeURIComponent(String(this.pieces_[i])); } return pathString || '/'; }; /** * Shallow copy of the parts of the path. * * @param {number=} begin * @return {!Array} */ Path.prototype.slice = function (begin) { if (begin === void 0) { begin = 0; } return this.pieces_.slice(this.pieceNum_ + begin); }; /** * @return {?Path} */ Path.prototype.parent = function () { if (this.pieceNum_ >= this.pieces_.length) return null; var pieces = []; for (var i = this.pieceNum_; i < this.pieces_.length - 1; i++) pieces.push(this.pieces_[i]); return new Path(pieces, 0); }; /** * @param {string|!Path} childPathObj * @return {!Path} */ Path.prototype.child = function (childPathObj) { var pieces = []; for (var i = this.pieceNum_; i < this.pieces_.length; i++) pieces.push(this.pieces_[i]); if (childPathObj instanceof Path) { for (var i = childPathObj.pieceNum_; i < childPathObj.pieces_.length; i++) { pieces.push(childPathObj.pieces_[i]); } } else { var childPieces = childPathObj.split('/'); for (var i = 0; i < childPieces.length; i++) { if (childPieces[i].length > 0) pieces.push(childPieces[i]); } } return new Path(pieces, 0); }; /** * @return {boolean} True if there are no segments in this path */ Path.prototype.isEmpty = function () { return this.pieceNum_ >= this.pieces_.length; }; /** * @param {!Path} outerPath * @param {!Path} innerPath * @return {!Path} The path from outerPath to innerPath */ Path.relativePath = function (outerPath, innerPath) { var outer = outerPath.getFront(), inner = innerPath.getFront(); if (outer === null) { return innerPath; } else if (outer === inner) { return Path.relativePath(outerPath.popFront(), innerPath.popFront()); } else { throw new Error('INTERNAL ERROR: innerPath (' + innerPath + ') is not within ' + 'outerPath (' + outerPath + ')'); } }; /** * @param {!Path} left * @param {!Path} right * @return {number} -1, 0, 1 if left is less, equal, or greater than the right. */ Path.comparePaths = function (left, right) { var leftKeys = left.slice(); var rightKeys = right.slice(); for (var i = 0; i < leftKeys.length && i < rightKeys.length; i++) { var cmp = nameCompare(leftKeys[i], rightKeys[i]); if (cmp !== 0) return cmp; } if (leftKeys.length === rightKeys.length) return 0; return leftKeys.length < rightKeys.length ? -1 : 1; }; /** * * @param {Path} other * @return {boolean} true if paths are the same. */ Path.prototype.equals = function (other) { if (this.getLength() !== other.getLength()) { return false; } for (var i = this.pieceNum_, j = other.pieceNum_; i <= this.pieces_.length; i++, j++) { if (this.pieces_[i] !== other.pieces_[j]) { return false; } } return true; }; /** * * @param {!Path} other * @return {boolean} True if this path is a parent (or the same as) other */ Path.prototype.contains = function (other) { var i = this.pieceNum_; var j = other.pieceNum_; if (this.getLength() > other.getLength()) { return false; } while (i < this.pieces_.length) { if (this.pieces_[i] !== other.pieces_[j]) { return false; } ++i; ++j; } return true; }; return Path; }()); // end Path /** * Dynamic (mutable) path used to count path lengths. * * This class is used to efficiently check paths for valid * length (in UTF8 bytes) and depth (used in path validation). * * Throws Error exception if path is ever invalid. * * The definition of a path always begins with '/'. */ var ValidationPath = /** @class */ (function () { /** * @param {!Path} path Initial Path. * @param {string} errorPrefix_ Prefix for any error messages. */ function ValidationPath(path, errorPrefix_) { this.errorPrefix_ = errorPrefix_; /** @type {!Array} */ this.parts_ = path.slice(); /** @type {number} Initialize to number of '/' chars needed in path. */ this.byteLength_ = Math.max(1, this.parts_.length); for (var i = 0; i < this.parts_.length; i++) { this.byteLength_ += util.stringLength(this.parts_[i]); } this.checkValid_(); } Object.defineProperty(ValidationPath, "MAX_PATH_DEPTH", { /** @const {number} Maximum key depth. */ get: function () { return 32; }, enumerable: true, configurable: true }); Object.defineProperty(ValidationPath, "MAX_PATH_LENGTH_BYTES", { /** @const {number} Maximum number of (UTF8) bytes in a Firebase path. */ get: function () { return 768; }, enumerable: true, configurable: true }); /** @param {string} child */ ValidationPath.prototype.push = function (child) { // Count the needed '/' if (this.parts_.length > 0) { this.byteLength_ += 1; } this.parts_.push(child); this.byteLength_ += util.stringLength(child); this.checkValid_(); }; ValidationPath.prototype.pop = function () { var last = this.parts_.pop(); this.byteLength_ -= util.stringLength(last); // Un-count the previous '/' if (this.parts_.length > 0) { this.byteLength_ -= 1; } }; ValidationPath.prototype.checkValid_ = function () { if (this.byteLength_ > ValidationPath.MAX_PATH_LENGTH_BYTES) { throw new Error(this.errorPrefix_ + 'has a key path longer than ' + ValidationPath.MAX_PATH_LENGTH_BYTES + ' bytes (' + this.byteLength_ + ').'); } if (this.parts_.length > ValidationPath.MAX_PATH_DEPTH) { throw new Error(this.errorPrefix_ + 'path specified exceeds the maximum depth that can be written (' + ValidationPath.MAX_PATH_DEPTH + ') or object contains a cycle ' + this.toErrorString()); } }; /** * String for use in error messages - uses '.' notation for path. * * @return {string} */ ValidationPath.prototype.toErrorString = function () { if (this.parts_.length == 0) { return ''; } return "in property '" + this.parts_.join('.') + "'"; }; return ValidationPath; }()); /** * Copyright 2017 Google Inc. * * 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. */ var PROTOCOL_VERSION = '5'; var VERSION_PARAM = 'v'; var TRANSPORT_SESSION_PARAM = 's'; var REFERER_PARAM = 'r'; var FORGE_REF = 'f'; var FORGE_DOMAIN = 'firebaseio.com'; var LAST_SESSION_PARAM = 'ls'; var WEBSOCKET = 'websocket'; var LONG_POLLING = 'long_polling'; /** * Copyright 2017 Google Inc. * * 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. */ /** * A class that holds metadata about a Repo object * * @constructor */ var RepoInfo = /** @class */ (function () { /** * @param {string} host Hostname portion of the url for the repo * @param {boolean} secure Whether or not this repo is accessed over ssl * @param {string} namespace The namespace represented by the repo * @param {boolean} webSocketOnly Whether to prefer websockets over all other transports (used by Nest). * @param {string=} persistenceKey Override the default session persistence storage key */ function RepoInfo(host, secure, namespace, webSocketOnly, persistenceKey) { if (persistenceKey === void 0) { persistenceKey = ''; } this.secure = secure; this.namespace = namespace; this.webSocketOnly = webSocketOnly; this.persistenceKey = persistenceKey; this.host = host.toLowerCase(); this.domain = this.host.substr(this.host.indexOf('.') + 1); this.internalHost = PersistentStorage.get('host:' + host) || this.host; } RepoInfo.prototype.needsQueryParam = function () { return this.host !== this.internalHost || this.isCustomHost(); }; RepoInfo.prototype.isCacheableHost = function () { return this.internalHost.substr(0, 2) === 's-'; }; RepoInfo.prototype.isDemoHost = function () { return this.domain === 'firebaseio-demo.com'; }; RepoInfo.prototype.isCustomHost = function () { return (this.domain !== 'firebaseio.com' && this.domain !== 'firebaseio-demo.com'); }; RepoInfo.prototype.updateHost = function (newHost) { if (newHost !== this.internalHost) { this.internalHost = newHost; if (this.isCacheableHost()) { PersistentStorage.set('host:' + this.host, this.internalHost); } } }; /** * Returns the websocket URL for this repo * @param {string} type of connection * @param {Object} params list * @return {string} The URL for this repo */ RepoInfo.prototype.connectionURL = function (type, params) { util.assert(typeof type === 'string', 'typeof type must == string'); util.assert(typeof params === 'object', 'typeof params must == object'); var connURL; if (type === WEBSOCKET) { connURL = (this.secure ? 'wss://' : 'ws://') + this.internalHost + '/.ws?'; } else if (type === LONG_POLLING) { connURL = (this.secure ? 'https://' : 'http://') + this.internalHost + '/.lp?'; } else { throw new Error('Unknown connection type: ' + type); } if (this.needsQueryParam()) { params['ns'] = this.namespace; } var pairs = []; util.forEach(params, function (key, value) { pairs.push(key + '=' + value); }); return connURL + pairs.join('&'); }; /** @return {string} */ RepoInfo.prototype.toString = function () { var str = this.toURLString(); if (this.persistenceKey) { str += '<' + this.persistenceKey + '>'; } return str; }; /** @return {string} */ RepoInfo.prototype.toURLString = function () { return (this.secure ? 'https://' : 'http://') + this.host; }; return RepoInfo; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @param {!string} pathString * @return {string} */ function decodePath(pathString) { var pathStringDecoded = ''; var pieces = pathString.split('/'); for (var i = 0; i < pieces.length; i++) { if (pieces[i].length > 0) { var piece = pieces[i]; try { piece = decodeURIComponent(piece.replace(/\+/g, ' ')); } catch (e) { } pathStringDecoded += '/' + piece; } } return pathStringDecoded; } /** * @param {!string} queryString * @return {!{[key:string]:string}} key value hash */ function decodeQuery(queryString) { var results = {}; if (queryString.charAt(0) === '?') { queryString = queryString.substring(1); } for (var _i = 0, _a = queryString.split('&'); _i < _a.length; _i++) { var segment = _a[_i]; if (segment.length === 0) { continue; } var kv = segment.split('='); if (kv.length === 2) { results[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]); } else { warn("Invalid query segment '" + segment + "' in query '" + queryString + "'"); } } return results; } /** * * @param {!string} dataURL * @return {{repoInfo: !RepoInfo, path: !Path}} */ var parseRepoInfo = function (dataURL) { var parsedUrl = parseURL(dataURL), namespace = parsedUrl.subdomain; if (parsedUrl.domain === 'firebase') { fatal(parsedUrl.host + ' is no longer supported. ' + 'Please use .firebaseio.com instead'); } // Catch common error of uninitialized namespace value. if ((!namespace || namespace == 'undefined') && parsedUrl.domain !== 'localhost') { fatal('Cannot parse Firebase url. Please use https://.firebaseio.com'); } if (!parsedUrl.secure) { warnIfPageIsSecure(); } var webSocketOnly = parsedUrl.scheme === 'ws' || parsedUrl.scheme === 'wss'; return { repoInfo: new RepoInfo(parsedUrl.host, parsedUrl.secure, namespace, webSocketOnly), path: new Path(parsedUrl.pathString) }; }; /** * * @param {!string} dataURL * @return {{host: string, port: number, domain: string, subdomain: string, secure: boolean, scheme: string, pathString: string}} */ var parseURL = function (dataURL) { // Default to empty strings in the event of a malformed string. var host = '', domain = '', subdomain = '', pathString = ''; // Always default to SSL, unless otherwise specified. var secure = true, scheme = 'https', port = 443; // Don't do any validation here. The caller is responsible for validating the result of parsing. if (typeof dataURL === 'string') { // Parse scheme. var colonInd = dataURL.indexOf('//'); if (colonInd >= 0) { scheme = dataURL.substring(0, colonInd - 1); dataURL = dataURL.substring(colonInd + 2); } // Parse host, path, and query string. var slashInd = dataURL.indexOf('/'); if (slashInd === -1) { slashInd = dataURL.length; } var questionMarkInd = dataURL.indexOf('?'); if (questionMarkInd === -1) { questionMarkInd = dataURL.length; } host = dataURL.substring(0, Math.min(slashInd, questionMarkInd)); if (slashInd < questionMarkInd) { // For pathString, questionMarkInd will always come after slashInd pathString = decodePath(dataURL.substring(slashInd, questionMarkInd)); } var queryParams = decodeQuery(dataURL.substring(Math.min(dataURL.length, questionMarkInd))); // If we have a port, use scheme for determining if it's secure. colonInd = host.indexOf(':'); if (colonInd >= 0) { secure = scheme === 'https' || scheme === 'wss'; port = parseInt(host.substring(colonInd + 1), 10); } else { colonInd = dataURL.length; } var parts = host.split('.'); if (parts.length === 3) { // Normalize namespaces to lowercase to share storage / connection. domain = parts[1]; subdomain = parts[0].toLowerCase(); } else if (parts.length === 2) { domain = parts[0]; } else if (parts[0].slice(0, colonInd).toLowerCase() === 'localhost') { domain = 'localhost'; } // Support `ns` query param if subdomain not already set if (subdomain === '' && 'ns' in queryParams) { subdomain = queryParams['ns']; } } return { host: host, port: port, domain: domain, subdomain: subdomain, secure: secure, scheme: scheme, pathString: pathString }; }; /** * Copyright 2017 Google Inc. * * 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. */ /** * True for invalid Firebase keys * @type {RegExp} * @private */ var INVALID_KEY_REGEX_ = /[\[\].#$\/\u0000-\u001F\u007F]/; /** * True for invalid Firebase paths. * Allows '/' in paths. * @type {RegExp} * @private */ var INVALID_PATH_REGEX_ = /[\[\].#$\u0000-\u001F\u007F]/; /** * Maximum number of characters to allow in leaf value * @type {number} * @private */ var MAX_LEAF_SIZE_ = 10 * 1024 * 1024; /** * @param {*} key * @return {boolean} */ var isValidKey = function (key) { return (typeof key === 'string' && key.length !== 0 && !INVALID_KEY_REGEX_.test(key)); }; /** * @param {string} pathString * @return {boolean} */ var isValidPathString = function (pathString) { return (typeof pathString === 'string' && pathString.length !== 0 && !INVALID_PATH_REGEX_.test(pathString)); }; /** * @param {string} pathString * @return {boolean} */ var isValidRootPathString = function (pathString) { if (pathString) { // Allow '/.info/' at the beginning. pathString = pathString.replace(/^\/*\.info(\/|$)/, '/'); } return isValidPathString(pathString); }; /** * @param {*} priority * @return {boolean} */ var isValidPriority = function (priority) { return (priority === null || typeof priority === 'string' || (typeof priority === 'number' && !isInvalidJSONNumber(priority)) || (priority && typeof priority === 'object' && util.contains(priority, '.sv'))); }; /** * Pre-validate a datum passed as an argument to Firebase function. * * @param {string} fnName * @param {number} argumentNumber * @param {*} data * @param {!Path} path * @param {boolean} optional */ var validateFirebaseDataArg = function (fnName, argumentNumber, data, path, optional) { if (optional && data === undefined) return; validateFirebaseData(util.errorPrefix(fnName, argumentNumber, optional), data, path); }; /** * Validate a data object client-side before sending to server. * * @param {string} errorPrefix * @param {*} data * @param {!Path|!ValidationPath} path_ */ var validateFirebaseData = function (errorPrefix, data, path_) { var path = path_ instanceof Path ? new ValidationPath(path_, errorPrefix) : path_; if (data === undefined) { throw new Error(errorPrefix + 'contains undefined ' + path.toErrorString()); } if (typeof data === 'function') { throw new Error(errorPrefix + 'contains a function ' + path.toErrorString() + ' with contents = ' + data.toString()); } if (isInvalidJSONNumber(data)) { throw new Error(errorPrefix + 'contains ' + data.toString() + ' ' + path.toErrorString()); } // Check max leaf size, but try to avoid the utf8 conversion if we can. if (typeof data === 'string' && data.length > MAX_LEAF_SIZE_ / 3 && util.stringLength(data) > MAX_LEAF_SIZE_) { throw new Error(errorPrefix + 'contains a string greater than ' + MAX_LEAF_SIZE_ + ' utf8 bytes ' + path.toErrorString() + " ('" + data.substring(0, 50) + "...')"); } // TODO = Perf = Consider combining the recursive validation of keys into NodeFromJSON // to save extra walking of large objects. if (data && typeof data === 'object') { var hasDotValue_1 = false, hasActualChild_1 = false; util.forEach(data, function (key, value) { if (key === '.value') { hasDotValue_1 = true; } else if (key !== '.priority' && key !== '.sv') { hasActualChild_1 = true; if (!isValidKey(key)) { throw new Error(errorPrefix + ' contains an invalid key (' + key + ') ' + path.toErrorString() + '. Keys must be non-empty strings ' + 'and can\'t contain ".", "#", "$", "/", "[", or "]"'); } } path.push(key); validateFirebaseData(errorPrefix, value, path); path.pop(); }); if (hasDotValue_1 && hasActualChild_1) { throw new Error(errorPrefix + ' contains ".value" child ' + path.toErrorString() + ' in addition to actual children.'); } } }; /** * Pre-validate paths passed in the firebase function. * * @param {string} errorPrefix * @param {Array} mergePaths */ var validateFirebaseMergePaths = function (errorPrefix, mergePaths) { var i, curPath; for (i = 0; i < mergePaths.length; i++) { curPath = mergePaths[i]; var keys = curPath.slice(); for (var j = 0; j < keys.length; j++) { if (keys[j] === '.priority' && j === keys.length - 1) { // .priority is OK } else if (!isValidKey(keys[j])) { throw new Error(errorPrefix + 'contains an invalid key (' + keys[j] + ') in path ' + curPath.toString() + '. Keys must be non-empty strings ' + 'and can\'t contain ".", "#", "$", "/", "[", or "]"'); } } } // Check that update keys are not descendants of each other. // We rely on the property that sorting guarantees that ancestors come // right before descendants. mergePaths.sort(Path.comparePaths); var prevPath = null; for (i = 0; i < mergePaths.length; i++) { curPath = mergePaths[i]; if (prevPath !== null && prevPath.contains(curPath)) { throw new Error(errorPrefix + 'contains a path ' + prevPath.toString() + ' that is ancestor of another path ' + curPath.toString()); } prevPath = curPath; } }; /** * pre-validate an object passed as an argument to firebase function ( * must be an object - e.g. for firebase.update()). * * @param {string} fnName * @param {number} argumentNumber * @param {*} data * @param {!Path} path * @param {boolean} optional */ var validateFirebaseMergeDataArg = function (fnName, argumentNumber, data, path, optional) { if (optional && data === undefined) return; var errorPrefix = util.errorPrefix(fnName, argumentNumber, optional); if (!(data && typeof data === 'object') || Array.isArray(data)) { throw new Error(errorPrefix + ' must be an object containing the children to replace.'); } var mergePaths = []; util.forEach(data, function (key, value) { var curPath = new Path(key); validateFirebaseData(errorPrefix, value, path.child(curPath)); if (curPath.getBack() === '.priority') { if (!isValidPriority(value)) { throw new Error(errorPrefix + "contains an invalid value for '" + curPath.toString() + "', which must be a valid " + 'Firebase priority (a string, finite number, server value, or null).'); } } mergePaths.push(curPath); }); validateFirebaseMergePaths(errorPrefix, mergePaths); }; var validatePriority = function (fnName, argumentNumber, priority, optional) { if (optional && priority === undefined) return; if (isInvalidJSONNumber(priority)) throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'is ' + priority.toString() + ', but must be a valid Firebase priority (a string, finite number, ' + 'server value, or null).'); // Special case to allow importing data with a .sv. if (!isValidPriority(priority)) throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'must be a valid Firebase priority ' + '(a string, finite number, server value, or null).'); }; var validateEventType = function (fnName, argumentNumber, eventType, optional) { if (optional && eventType === undefined) return; switch (eventType) { case 'value': case 'child_added': case 'child_removed': case 'child_changed': case 'child_moved': break; default: throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'must be a valid event type = "value", "child_added", "child_removed", ' + '"child_changed", or "child_moved".'); } }; var validateKey = function (fnName, argumentNumber, key, optional) { if (optional && key === undefined) return; if (!isValidKey(key)) throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'was an invalid key = "' + key + '". Firebase keys must be non-empty strings and ' + 'can\'t contain ".", "#", "$", "/", "[", or "]").'); }; var validatePathString = function (fnName, argumentNumber, pathString, optional) { if (optional && pathString === undefined) return; if (!isValidPathString(pathString)) throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'was an invalid path = "' + pathString + '". Paths must be non-empty strings and ' + 'can\'t contain ".", "#", "$", "[", or "]"'); }; var validateRootPathString = function (fnName, argumentNumber, pathString, optional) { if (pathString) { // Allow '/.info/' at the beginning. pathString = pathString.replace(/^\/*\.info(\/|$)/, '/'); } validatePathString(fnName, argumentNumber, pathString, optional); }; var validateWritablePath = function (fnName, path) { if (path.getFront() === '.info') { throw new Error(fnName + " failed = Can't modify data under /.info/"); } }; var validateUrl = function (fnName, argumentNumber, parsedUrl) { // TODO = Validate server better. var pathString = parsedUrl.path.toString(); if (!(typeof parsedUrl.repoInfo.host === 'string') || parsedUrl.repoInfo.host.length === 0 || (!isValidKey(parsedUrl.repoInfo.namespace) && parsedUrl.repoInfo.host.split(':')[0] !== 'localhost') || (pathString.length !== 0 && !isValidRootPathString(pathString))) { throw new Error(util.errorPrefix(fnName, argumentNumber, false) + 'must be a valid firebase URL and ' + 'the path can\'t contain ".", "#", "$", "[", or "]".'); } }; var validateBoolean = function (fnName, argumentNumber, bool, optional) { if (optional && bool === undefined) return; if (typeof bool !== 'boolean') throw new Error(util.errorPrefix(fnName, argumentNumber, optional) + 'must be a boolean.'); }; /** * Copyright 2017 Google Inc. * * 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. */ /** * @constructor */ var OnDisconnect = /** @class */ (function () { /** * @param {!Repo} repo_ * @param {!Path} path_ */ function OnDisconnect(repo_, path_) { this.repo_ = repo_; this.path_ = path_; } /** * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.cancel = function (onComplete) { util.validateArgCount('OnDisconnect.cancel', 0, 1, arguments.length); util.validateCallback('OnDisconnect.cancel', 1, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectCancel(this.path_, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.remove = function (onComplete) { util.validateArgCount('OnDisconnect.remove', 0, 1, arguments.length); validateWritablePath('OnDisconnect.remove', this.path_); util.validateCallback('OnDisconnect.remove', 1, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectSet(this.path_, null, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {*} value * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.set = function (value, onComplete) { util.validateArgCount('OnDisconnect.set', 1, 2, arguments.length); validateWritablePath('OnDisconnect.set', this.path_); validateFirebaseDataArg('OnDisconnect.set', 1, value, this.path_, false); util.validateCallback('OnDisconnect.set', 2, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectSet(this.path_, value, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {*} value * @param {number|string|null} priority * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.setWithPriority = function (value, priority, onComplete) { util.validateArgCount('OnDisconnect.setWithPriority', 2, 3, arguments.length); validateWritablePath('OnDisconnect.setWithPriority', this.path_); validateFirebaseDataArg('OnDisconnect.setWithPriority', 1, value, this.path_, false); validatePriority('OnDisconnect.setWithPriority', 2, priority, false); util.validateCallback('OnDisconnect.setWithPriority', 3, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectSetWithPriority(this.path_, value, priority, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {!Object} objectToMerge * @param {function(?Error)=} onComplete * @return {!firebase.Promise} */ OnDisconnect.prototype.update = function (objectToMerge, onComplete) { util.validateArgCount('OnDisconnect.update', 1, 2, arguments.length); validateWritablePath('OnDisconnect.update', this.path_); if (Array.isArray(objectToMerge)) { var newObjectToMerge = {}; for (var i = 0; i < objectToMerge.length; ++i) { newObjectToMerge['' + i] = objectToMerge[i]; } objectToMerge = newObjectToMerge; warn('Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the ' + 'existing data, or an Object with integer keys if you really do want to only update some of the children.'); } validateFirebaseMergeDataArg('OnDisconnect.update', 1, objectToMerge, this.path_, false); util.validateCallback('OnDisconnect.update', 2, onComplete, true); var deferred = new util.Deferred(); this.repo_.onDisconnectUpdate(this.path_, objectToMerge, deferred.wrapCallback(onComplete)); return deferred.promise; }; return OnDisconnect; }()); /** * Copyright 2017 Google Inc. * * 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. */ var TransactionResult = /** @class */ (function () { /** * A type for the resolve value of Firebase.transaction. * @constructor * @dict * @param {boolean} committed * @param {DataSnapshot} snapshot */ function TransactionResult(committed, snapshot) { this.committed = committed; this.snapshot = snapshot; } // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary // for end-users TransactionResult.prototype.toJSON = function () { util.validateArgCount('TransactionResult.toJSON', 0, 1, arguments.length); return { committed: this.committed, snapshot: this.snapshot.toJSON() }; }; return TransactionResult; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Fancy ID generator that creates 20-character string identifiers with the * following properties: * * 1. They're based on timestamp so that they sort *after* any existing ids. * 2. They contain 72-bits of random data after the timestamp so that IDs won't * collide with other clients' IDs. * 3. They sort *lexicographically* (so the timestamp is converted to characters * that will sort properly). * 4. They're monotonically increasing. Even if you generate more than one in * the same timestamp, the latter ones will sort after the former ones. We do * this by using the previous random bits but "incrementing" them by 1 (only * in the case of a timestamp collision). */ var nextPushId = (function () { // Modeled after base64 web-safe chars, but ordered by ASCII. var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; // Timestamp of last push, used to prevent local collisions if you push twice // in one ms. var lastPushTime = 0; // We generate 72-bits of randomness which get turned into 12 characters and // appended to the timestamp to prevent collisions with other clients. We // store the last characters we generated because in the event of a collision, // we'll use those same characters except "incremented" by one. var lastRandChars = []; return function (now) { var duplicateTime = now === lastPushTime; lastPushTime = now; var i; var timeStampChars = new Array(8); for (i = 7; i >= 0; i--) { timeStampChars[i] = PUSH_CHARS.charAt(now % 64); // NOTE: Can't use << here because javascript will convert to int and lose // the upper bits. now = Math.floor(now / 64); } util.assert(now === 0, 'Cannot push at time == 0'); var id = timeStampChars.join(''); if (!duplicateTime) { for (i = 0; i < 12; i++) { lastRandChars[i] = Math.floor(Math.random() * 64); } } else { // If the timestamp hasn't changed since last push, use the same random // number, except incremented by 1. for (i = 11; i >= 0 && lastRandChars[i] === 63; i--) { lastRandChars[i] = 0; } lastRandChars[i]++; } for (i = 0; i < 12; i++) { id += PUSH_CHARS.charAt(lastRandChars[i]); } util.assert(id.length === 20, 'nextPushId: Length should be 20.'); return id; }; })(); /** * Copyright 2017 Google Inc. * * 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. */ /** * * @param {!string} name * @param {!Node} node * @constructor * @struct */ var NamedNode = /** @class */ (function () { function NamedNode(name, node) { this.name = name; this.node = node; } /** * * @param {!string} name * @param {!Node} node * @return {NamedNode} */ NamedNode.Wrap = function (name, node) { return new NamedNode(name, node); }; return NamedNode; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * * @constructor */ var Index = /** @class */ (function () { function Index() { } /** * @return {function(!NamedNode, !NamedNode):number} A standalone comparison function for * this index */ Index.prototype.getCompare = function () { return this.compare.bind(this); }; /** * Given a before and after value for a node, determine if the indexed value has changed. Even if they are different, * it's possible that the changes are isolated to parts of the snapshot that are not indexed. * * @param {!Node} oldNode * @param {!Node} newNode * @return {boolean} True if the portion of the snapshot being indexed changed between oldNode and newNode */ Index.prototype.indexedValueChanged = function (oldNode, newNode) { var oldWrapped = new NamedNode(MIN_NAME, oldNode); var newWrapped = new NamedNode(MIN_NAME, newNode); return this.compare(oldWrapped, newWrapped) !== 0; }; /** * @return {!NamedNode} a node wrapper that will sort equal to or less than * any other node wrapper, using this index */ Index.prototype.minPost = function () { return NamedNode.MIN; }; return Index; }()); /** * Copyright 2017 Google Inc. * * 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. */ var __EMPTY_NODE; var KeyIndex = /** @class */ (function (_super) { tslib_1.__extends(KeyIndex, _super); function KeyIndex() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(KeyIndex, "__EMPTY_NODE", { get: function () { return __EMPTY_NODE; }, set: function (val) { __EMPTY_NODE = val; }, enumerable: true, configurable: true }); /** * @inheritDoc */ KeyIndex.prototype.compare = function (a, b) { return nameCompare(a.name, b.name); }; /** * @inheritDoc */ KeyIndex.prototype.isDefinedOn = function (node) { // We could probably return true here (since every node has a key), but it's never called // so just leaving unimplemented for now. throw util.assertionError('KeyIndex.isDefinedOn not expected to be called.'); }; /** * @inheritDoc */ KeyIndex.prototype.indexedValueChanged = function (oldNode, newNode) { return false; // The key for a node never changes. }; /** * @inheritDoc */ KeyIndex.prototype.minPost = function () { return NamedNode.MIN; }; /** * @inheritDoc */ KeyIndex.prototype.maxPost = function () { // TODO: This should really be created once and cached in a static property, but // NamedNode isn't defined yet, so I can't use it in a static. Bleh. return new NamedNode(MAX_NAME, __EMPTY_NODE); }; /** * @param {*} indexValue * @param {string} name * @return {!NamedNode} */ KeyIndex.prototype.makePost = function (indexValue, name) { util.assert(typeof indexValue === 'string', 'KeyIndex indexValue must always be a string.'); // We just use empty node, but it'll never be compared, since our comparator only looks at name. return new NamedNode(indexValue, __EMPTY_NODE); }; /** * @return {!string} String representation for inclusion in a query spec */ KeyIndex.prototype.toString = function () { return '.key'; }; return KeyIndex; }(Index)); var KEY_INDEX = new KeyIndex(); /** * Copyright 2017 Google Inc. * * 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. */ var MAX_NODE; function setMaxNode(val) { MAX_NODE = val; } /** * @param {(!string|!number)} priority * @return {!string} */ var priorityHashText = function (priority) { if (typeof priority === 'number') return 'number:' + doubleToIEEE754String(priority); else return 'string:' + priority; }; /** * Validates that a priority snapshot Node is valid. * * @param {!Node} priorityNode */ var validatePriorityNode = function (priorityNode) { if (priorityNode.isLeafNode()) { var val = priorityNode.val(); util.assert(typeof val === 'string' || typeof val === 'number' || (typeof val === 'object' && util.contains(val, '.sv')), 'Priority must be a string or number.'); } else { util.assert(priorityNode === MAX_NODE || priorityNode.isEmpty(), 'priority of unexpected type.'); } // Don't call getPriority() on MAX_NODE to avoid hitting assertion. util.assert(priorityNode === MAX_NODE || priorityNode.getPriority().isEmpty(), "Priority nodes can't have a priority of their own."); }; /** * Copyright 2017 Google Inc. * * 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. */ var __childrenNodeConstructor; /** * LeafNode is a class for storing leaf nodes in a DataSnapshot. It * implements Node and stores the value of the node (a string, * number, or boolean) accessible via getValue(). */ var LeafNode = /** @class */ (function () { /** * @implements {Node} * @param {!(string|number|boolean|Object)} value_ The value to store in this leaf node. * The object type is possible in the event of a deferred value * @param {!Node=} priorityNode_ The priority of this node. */ function LeafNode(value_, priorityNode_) { if (priorityNode_ === void 0) { priorityNode_ = LeafNode.__childrenNodeConstructor.EMPTY_NODE; } this.value_ = value_; this.priorityNode_ = priorityNode_; this.lazyHash_ = null; util.assert(this.value_ !== undefined && this.value_ !== null, "LeafNode shouldn't be created with null/undefined value."); validatePriorityNode(this.priorityNode_); } Object.defineProperty(LeafNode, "__childrenNodeConstructor", { get: function () { return __childrenNodeConstructor; }, set: function (val) { __childrenNodeConstructor = val; }, enumerable: true, configurable: true }); /** @inheritDoc */ LeafNode.prototype.isLeafNode = function () { return true; }; /** @inheritDoc */ LeafNode.prototype.getPriority = function () { return this.priorityNode_; }; /** @inheritDoc */ LeafNode.prototype.updatePriority = function (newPriorityNode) { return new LeafNode(this.value_, newPriorityNode); }; /** @inheritDoc */ LeafNode.prototype.getImmediateChild = function (childName) { // Hack to treat priority as a regular child if (childName === '.priority') { return this.priorityNode_; } else { return LeafNode.__childrenNodeConstructor.EMPTY_NODE; } }; /** @inheritDoc */ LeafNode.prototype.getChild = function (path) { if (path.isEmpty()) { return this; } else if (path.getFront() === '.priority') { return this.priorityNode_; } else { return LeafNode.__childrenNodeConstructor.EMPTY_NODE; } }; /** * @inheritDoc */ LeafNode.prototype.hasChild = function () { return false; }; /** @inheritDoc */ LeafNode.prototype.getPredecessorChildName = function (childName, childNode) { return null; }; /** @inheritDoc */ LeafNode.prototype.updateImmediateChild = function (childName, newChildNode) { if (childName === '.priority') { return this.updatePriority(newChildNode); } else if (newChildNode.isEmpty() && childName !== '.priority') { return this; } else { return LeafNode.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(childName, newChildNode).updatePriority(this.priorityNode_); } }; /** @inheritDoc */ LeafNode.prototype.updateChild = function (path, newChildNode) { var front = path.getFront(); if (front === null) { return newChildNode; } else if (newChildNode.isEmpty() && front !== '.priority') { return this; } else { util.assert(front !== '.priority' || path.getLength() === 1, '.priority must be the last token in a path'); return this.updateImmediateChild(front, LeafNode.__childrenNodeConstructor.EMPTY_NODE.updateChild(path.popFront(), newChildNode)); } }; /** @inheritDoc */ LeafNode.prototype.isEmpty = function () { return false; }; /** @inheritDoc */ LeafNode.prototype.numChildren = function () { return 0; }; /** @inheritDoc */ LeafNode.prototype.forEachChild = function (index, action) { return false; }; /** * @inheritDoc */ LeafNode.prototype.val = function (exportFormat) { if (exportFormat && !this.getPriority().isEmpty()) return { '.value': this.getValue(), '.priority': this.getPriority().val() }; else return this.getValue(); }; /** @inheritDoc */ LeafNode.prototype.hash = function () { if (this.lazyHash_ === null) { var toHash = ''; if (!this.priorityNode_.isEmpty()) toHash += 'priority:' + priorityHashText(this.priorityNode_.val()) + ':'; var type = typeof this.value_; toHash += type + ':'; if (type === 'number') { toHash += doubleToIEEE754String(this.value_); } else { toHash += this.value_; } this.lazyHash_ = sha1(toHash); } return this.lazyHash_; }; /** * Returns the value of the leaf node. * @return {Object|string|number|boolean} The value of the node. */ LeafNode.prototype.getValue = function () { return this.value_; }; /** * @inheritDoc */ LeafNode.prototype.compareTo = function (other) { if (other === LeafNode.__childrenNodeConstructor.EMPTY_NODE) { return 1; } else if (other instanceof LeafNode.__childrenNodeConstructor) { return -1; } else { util.assert(other.isLeafNode(), 'Unknown node type'); return this.compareToLeafNode_(other); } }; /** * Comparison specifically for two leaf nodes * @param {!LeafNode} otherLeaf * @return {!number} * @private */ LeafNode.prototype.compareToLeafNode_ = function (otherLeaf) { var otherLeafType = typeof otherLeaf.value_; var thisLeafType = typeof this.value_; var otherIndex = LeafNode.VALUE_TYPE_ORDER.indexOf(otherLeafType); var thisIndex = LeafNode.VALUE_TYPE_ORDER.indexOf(thisLeafType); util.assert(otherIndex >= 0, 'Unknown leaf type: ' + otherLeafType); util.assert(thisIndex >= 0, 'Unknown leaf type: ' + thisLeafType); if (otherIndex === thisIndex) { // Same type, compare values if (thisLeafType === 'object') { // Deferred value nodes are all equal, but we should also never get to this point... return 0; } else { // Note that this works because true > false, all others are number or string comparisons if (this.value_ < otherLeaf.value_) { return -1; } else if (this.value_ === otherLeaf.value_) { return 0; } else { return 1; } } } else { return thisIndex - otherIndex; } }; /** * @inheritDoc */ LeafNode.prototype.withIndex = function () { return this; }; /** * @inheritDoc */ LeafNode.prototype.isIndexed = function () { return true; }; /** * @inheritDoc */ LeafNode.prototype.equals = function (other) { /** * @inheritDoc */ if (other === this) { return true; } else if (other.isLeafNode()) { var otherLeaf = other; return (this.value_ === otherLeaf.value_ && this.priorityNode_.equals(otherLeaf.priorityNode_)); } else { return false; } }; /** * The sort order for comparing leaf nodes of different types. If two leaf nodes have * the same type, the comparison falls back to their value * @type {Array.} * @const */ LeafNode.VALUE_TYPE_ORDER = ['object', 'boolean', 'number', 'string']; return LeafNode; }()); /** * Copyright 2017 Google Inc. * * 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. */ var nodeFromJSON; var MAX_NODE$1; function setNodeFromJSON(val) { nodeFromJSON = val; } function setMaxNode$1(val) { MAX_NODE$1 = val; } /** * @constructor * @extends {Index} * @private */ var PriorityIndex = /** @class */ (function (_super) { tslib_1.__extends(PriorityIndex, _super); function PriorityIndex() { return _super !== null && _super.apply(this, arguments) || this; } /** * @inheritDoc */ PriorityIndex.prototype.compare = function (a, b) { var aPriority = a.node.getPriority(); var bPriority = b.node.getPriority(); var indexCmp = aPriority.compareTo(bPriority); if (indexCmp === 0) { return nameCompare(a.name, b.name); } else { return indexCmp; } }; /** * @inheritDoc */ PriorityIndex.prototype.isDefinedOn = function (node) { return !node.getPriority().isEmpty(); }; /** * @inheritDoc */ PriorityIndex.prototype.indexedValueChanged = function (oldNode, newNode) { return !oldNode.getPriority().equals(newNode.getPriority()); }; /** * @inheritDoc */ PriorityIndex.prototype.minPost = function () { return NamedNode.MIN; }; /** * @inheritDoc */ PriorityIndex.prototype.maxPost = function () { return new NamedNode(MAX_NAME, new LeafNode('[PRIORITY-POST]', MAX_NODE$1)); }; /** * @param {*} indexValue * @param {string} name * @return {!NamedNode} */ PriorityIndex.prototype.makePost = function (indexValue, name) { var priorityNode = nodeFromJSON(indexValue); return new NamedNode(name, new LeafNode('[PRIORITY-POST]', priorityNode)); }; /** * @return {!string} String representation for inclusion in a query spec */ PriorityIndex.prototype.toString = function () { return '.priority'; }; return PriorityIndex; }(Index)); var PRIORITY_INDEX = new PriorityIndex(); /** * Copyright 2017 Google Inc. * * 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. */ /** * An iterator over an LLRBNode. */ var SortedMapIterator = /** @class */ (function () { /** * @template K, V, T * @param {LLRBNode|LLRBEmptyNode} node Node to iterate. * @param {?K} startKey * @param {function(K, K): number} comparator * @param {boolean} isReverse_ Whether or not to iterate in reverse * @param {(function(K, V):T)=} resultGenerator_ */ function SortedMapIterator(node, startKey, comparator, isReverse_, resultGenerator_) { if (resultGenerator_ === void 0) { resultGenerator_ = null; } this.isReverse_ = isReverse_; this.resultGenerator_ = resultGenerator_; /** @private * @type {Array.} */ this.nodeStack_ = []; var cmp = 1; while (!node.isEmpty()) { node = node; cmp = startKey ? comparator(node.key, startKey) : 1; // flip the comparison if we're going in reverse if (isReverse_) cmp *= -1; if (cmp < 0) { // This node is less than our start key. ignore it if (this.isReverse_) { node = node.left; } else { node = node.right; } } else if (cmp === 0) { // This node is exactly equal to our start key. Push it on the stack, but stop iterating; this.nodeStack_.push(node); break; } else { // This node is greater than our start key, add it to the stack and move to the next one this.nodeStack_.push(node); if (this.isReverse_) { node = node.right; } else { node = node.left; } } } } SortedMapIterator.prototype.getNext = function () { if (this.nodeStack_.length === 0) return null; var node = this.nodeStack_.pop(); var result; if (this.resultGenerator_) result = this.resultGenerator_(node.key, node.value); else result = { key: node.key, value: node.value }; if (this.isReverse_) { node = node.left; while (!node.isEmpty()) { this.nodeStack_.push(node); node = node.right; } } else { node = node.right; while (!node.isEmpty()) { this.nodeStack_.push(node); node = node.left; } } return result; }; SortedMapIterator.prototype.hasNext = function () { return this.nodeStack_.length > 0; }; SortedMapIterator.prototype.peek = function () { if (this.nodeStack_.length === 0) return null; var node = this.nodeStack_[this.nodeStack_.length - 1]; if (this.resultGenerator_) { return this.resultGenerator_(node.key, node.value); } else { return { key: node.key, value: node.value }; } }; return SortedMapIterator; }()); /** * Represents a node in a Left-leaning Red-Black tree. */ var LLRBNode = /** @class */ (function () { /** * @template K, V * @param {!K} key Key associated with this node. * @param {!V} value Value associated with this node. * @param {?boolean} color Whether this node is red. * @param {?(LLRBNode|LLRBEmptyNode)=} left Left child. * @param {?(LLRBNode|LLRBEmptyNode)=} right Right child. */ function LLRBNode(key, value, color, left, right) { this.key = key; this.value = value; this.color = color != null ? color : LLRBNode.RED; this.left = left != null ? left : SortedMap.EMPTY_NODE; this.right = right != null ? right : SortedMap.EMPTY_NODE; } /** * Returns a copy of the current node, optionally replacing pieces of it. * * @param {?K} key New key for the node, or null. * @param {?V} value New value for the node, or null. * @param {?boolean} color New color for the node, or null. * @param {?LLRBNode|LLRBEmptyNode} left New left child for the node, or null. * @param {?LLRBNode|LLRBEmptyNode} right New right child for the node, or null. * @return {!LLRBNode} The node copy. */ LLRBNode.prototype.copy = function (key, value, color, left, right) { return new LLRBNode(key != null ? key : this.key, value != null ? value : this.value, color != null ? color : this.color, left != null ? left : this.left, right != null ? right : this.right); }; /** * @return {number} The total number of nodes in the tree. */ LLRBNode.prototype.count = function () { return this.left.count() + 1 + this.right.count(); }; /** * @return {boolean} True if the tree is empty. */ LLRBNode.prototype.isEmpty = function () { return false; }; /** * Traverses the tree in key order and calls the specified action function * for each node. * * @param {function(!K, !V):*} action Callback function to be called for each * node. If it returns true, traversal is aborted. * @return {*} The first truthy value returned by action, or the last falsey * value returned by action */ LLRBNode.prototype.inorderTraversal = function (action) { return (this.left.inorderTraversal(action) || action(this.key, this.value) || this.right.inorderTraversal(action)); }; /** * Traverses the tree in reverse key order and calls the specified action function * for each node. * * @param {function(!Object, !Object)} action Callback function to be called for each * node. If it returns true, traversal is aborted. * @return {*} True if traversal was aborted. */ LLRBNode.prototype.reverseTraversal = function (action) { return (this.right.reverseTraversal(action) || action(this.key, this.value) || this.left.reverseTraversal(action)); }; /** * @return {!Object} The minimum node in the tree. * @private */ LLRBNode.prototype.min_ = function () { if (this.left.isEmpty()) { return this; } else { return this.left.min_(); } }; /** * @return {!K} The maximum key in the tree. */ LLRBNode.prototype.minKey = function () { return this.min_().key; }; /** * @return {!K} The maximum key in the tree. */ LLRBNode.prototype.maxKey = function () { if (this.right.isEmpty()) { return this.key; } else { return this.right.maxKey(); } }; /** * * @param {!Object} key Key to insert. * @param {!Object} value Value to insert. * @param {Comparator} comparator Comparator. * @return {!LLRBNode} New tree, with the key/value added. */ LLRBNode.prototype.insert = function (key, value, comparator) { var cmp, n; n = this; cmp = comparator(key, n.key); if (cmp < 0) { n = n.copy(null, null, null, n.left.insert(key, value, comparator), null); } else if (cmp === 0) { n = n.copy(null, value, null, null, null); } else { n = n.copy(null, null, null, null, n.right.insert(key, value, comparator)); } return n.fixUp_(); }; /** * @private * @return {!LLRBNode|LLRBEmptyNode} New tree, with the minimum key removed. */ LLRBNode.prototype.removeMin_ = function () { if (this.left.isEmpty()) { return SortedMap.EMPTY_NODE; } var n = this; if (!n.left.isRed_() && !n.left.left.isRed_()) n = n.moveRedLeft_(); n = n.copy(null, null, null, n.left.removeMin_(), null); return n.fixUp_(); }; /** * @param {!Object} key The key of the item to remove. * @param {Comparator} comparator Comparator. * @return {!LLRBNode|LLRBEmptyNode} New tree, with the specified item removed. */ LLRBNode.prototype.remove = function (key, comparator) { var n, smallest; n = this; if (comparator(key, n.key) < 0) { if (!n.left.isEmpty() && !n.left.isRed_() && !n.left.left.isRed_()) { n = n.moveRedLeft_(); } n = n.copy(null, null, null, n.left.remove(key, comparator), null); } else { if (n.left.isRed_()) n = n.rotateRight_(); if (!n.right.isEmpty() && !n.right.isRed_() && !n.right.left.isRed_()) { n = n.moveRedRight_(); } if (comparator(key, n.key) === 0) { if (n.right.isEmpty()) { return SortedMap.EMPTY_NODE; } else { smallest = n.right.min_(); n = n.copy(smallest.key, smallest.value, null, null, n.right.removeMin_()); } } n = n.copy(null, null, null, null, n.right.remove(key, comparator)); } return n.fixUp_(); }; /** * @private * @return {boolean} Whether this is a RED node. */ LLRBNode.prototype.isRed_ = function () { return this.color; }; /** * @private * @return {!LLRBNode} New tree after performing any needed rotations. */ LLRBNode.prototype.fixUp_ = function () { var n = this; if (n.right.isRed_() && !n.left.isRed_()) n = n.rotateLeft_(); if (n.left.isRed_() && n.left.left.isRed_()) n = n.rotateRight_(); if (n.left.isRed_() && n.right.isRed_()) n = n.colorFlip_(); return n; }; /** * @private * @return {!LLRBNode} New tree, after moveRedLeft. */ LLRBNode.prototype.moveRedLeft_ = function () { var n = this.colorFlip_(); if (n.right.left.isRed_()) { n = n.copy(null, null, null, null, n.right.rotateRight_()); n = n.rotateLeft_(); n = n.colorFlip_(); } return n; }; /** * @private * @return {!LLRBNode} New tree, after moveRedRight. */ LLRBNode.prototype.moveRedRight_ = function () { var n = this.colorFlip_(); if (n.left.left.isRed_()) { n = n.rotateRight_(); n = n.colorFlip_(); } return n; }; /** * @private * @return {!LLRBNode} New tree, after rotateLeft. */ LLRBNode.prototype.rotateLeft_ = function () { var nl = this.copy(null, null, LLRBNode.RED, null, this.right.left); return this.right.copy(null, null, this.color, nl, null); }; /** * @private * @return {!LLRBNode} New tree, after rotateRight. */ LLRBNode.prototype.rotateRight_ = function () { var nr = this.copy(null, null, LLRBNode.RED, this.left.right, null); return this.left.copy(null, null, this.color, null, nr); }; /** * @private * @return {!LLRBNode} New tree, after colorFlip. */ LLRBNode.prototype.colorFlip_ = function () { var left = this.left.copy(null, null, !this.left.color, null, null); var right = this.right.copy(null, null, !this.right.color, null, null); return this.copy(null, null, !this.color, left, right); }; /** * For testing. * * @private * @return {boolean} True if all is well. */ LLRBNode.prototype.checkMaxDepth_ = function () { var blackDepth = this.check_(); return Math.pow(2.0, blackDepth) <= this.count() + 1; }; /** * @private * @return {number} Not sure what this returns exactly. :-). */ LLRBNode.prototype.check_ = function () { var blackDepth; if (this.isRed_() && this.left.isRed_()) { throw new Error('Red node has red child(' + this.key + ',' + this.value + ')'); } if (this.right.isRed_()) { throw new Error('Right child of (' + this.key + ',' + this.value + ') is red'); } blackDepth = this.left.check_(); if (blackDepth !== this.right.check_()) { throw new Error('Black depths differ'); } else { return blackDepth + (this.isRed_() ? 0 : 1); } }; LLRBNode.RED = true; LLRBNode.BLACK = false; return LLRBNode; }()); /** * Represents an empty node (a leaf node in the Red-Black Tree). */ var LLRBEmptyNode = /** @class */ (function () { function LLRBEmptyNode() { } /** * Returns a copy of the current node. * * @return {!LLRBEmptyNode} The node copy. */ LLRBEmptyNode.prototype.copy = function (key, value, color, left, right) { return this; }; /** * Returns a copy of the tree, with the specified key/value added. * * @param {!K} key Key to be added. * @param {!V} value Value to be added. * @param {Comparator} comparator Comparator. * @return {!LLRBNode} New tree, with item added. */ LLRBEmptyNode.prototype.insert = function (key, value, comparator) { return new LLRBNode(key, value, null); }; /** * Returns a copy of the tree, with the specified key removed. * * @param {!K} key The key to remove. * @param {Comparator} comparator Comparator. * @return {!LLRBEmptyNode} New tree, with item removed. */ LLRBEmptyNode.prototype.remove = function (key, comparator) { return this; }; /** * @return {number} The total number of nodes in the tree. */ LLRBEmptyNode.prototype.count = function () { return 0; }; /** * @return {boolean} True if the tree is empty. */ LLRBEmptyNode.prototype.isEmpty = function () { return true; }; /** * Traverses the tree in key order and calls the specified action function * for each node. * * @param {function(!K, !V):*} action Callback function to be called for each * node. If it returns true, traversal is aborted. * @return {boolean} True if traversal was aborted. */ LLRBEmptyNode.prototype.inorderTraversal = function (action) { return false; }; /** * Traverses the tree in reverse key order and calls the specified action function * for each node. * * @param {function(!K, !V)} action Callback function to be called for each * node. If it returns true, traversal is aborted. * @return {boolean} True if traversal was aborted. */ LLRBEmptyNode.prototype.reverseTraversal = function (action) { return false; }; /** * @return {null} */ LLRBEmptyNode.prototype.minKey = function () { return null; }; /** * @return {null} */ LLRBEmptyNode.prototype.maxKey = function () { return null; }; /** * @private * @return {number} Not sure what this returns exactly. :-). */ LLRBEmptyNode.prototype.check_ = function () { return 0; }; /** * @private * @return {boolean} Whether this node is red. */ LLRBEmptyNode.prototype.isRed_ = function () { return false; }; return LLRBEmptyNode; }()); /** * An immutable sorted map implementation, based on a Left-leaning Red-Black * tree. */ var SortedMap = /** @class */ (function () { /** * @template K, V * @param {function(K, K):number} comparator_ Key comparator. * @param {LLRBNode=} root_ (Optional) Root node for the map. */ function SortedMap(comparator_, root_) { if (root_ === void 0) { root_ = SortedMap.EMPTY_NODE; } this.comparator_ = comparator_; this.root_ = root_; } /** * Returns a copy of the map, with the specified key/value added or replaced. * (TODO: We should perhaps rename this method to 'put') * * @param {!K} key Key to be added. * @param {!V} value Value to be added. * @return {!SortedMap.} New map, with item added. */ SortedMap.prototype.insert = function (key, value) { return new SortedMap(this.comparator_, this.root_ .insert(key, value, this.comparator_) .copy(null, null, LLRBNode.BLACK, null, null)); }; /** * Returns a copy of the map, with the specified key removed. * * @param {!K} key The key to remove. * @return {!SortedMap.} New map, with item removed. */ SortedMap.prototype.remove = function (key) { return new SortedMap(this.comparator_, this.root_ .remove(key, this.comparator_) .copy(null, null, LLRBNode.BLACK, null, null)); }; /** * Returns the value of the node with the given key, or null. * * @param {!K} key The key to look up. * @return {?V} The value of the node with the given key, or null if the * key doesn't exist. */ SortedMap.prototype.get = function (key) { var cmp; var node = this.root_; while (!node.isEmpty()) { cmp = this.comparator_(key, node.key); if (cmp === 0) { return node.value; } else if (cmp < 0) { node = node.left; } else if (cmp > 0) { node = node.right; } } return null; }; /** * Returns the key of the item *before* the specified key, or null if key is the first item. * @param {K} key The key to find the predecessor of * @return {?K} The predecessor key. */ SortedMap.prototype.getPredecessorKey = function (key) { var cmp, node = this.root_, rightParent = null; while (!node.isEmpty()) { cmp = this.comparator_(key, node.key); if (cmp === 0) { if (!node.left.isEmpty()) { node = node.left; while (!node.right.isEmpty()) node = node.right; return node.key; } else if (rightParent) { return rightParent.key; } else { return null; // first item. } } else if (cmp < 0) { node = node.left; } else if (cmp > 0) { rightParent = node; node = node.right; } } throw new Error('Attempted to find predecessor key for a nonexistent key. What gives?'); }; /** * @return {boolean} True if the map is empty. */ SortedMap.prototype.isEmpty = function () { return this.root_.isEmpty(); }; /** * @return {number} The total number of nodes in the map. */ SortedMap.prototype.count = function () { return this.root_.count(); }; /** * @return {?K} The minimum key in the map. */ SortedMap.prototype.minKey = function () { return this.root_.minKey(); }; /** * @return {?K} The maximum key in the map. */ SortedMap.prototype.maxKey = function () { return this.root_.maxKey(); }; /** * Traverses the map in key order and calls the specified action function * for each key/value pair. * * @param {function(!K, !V):*} action Callback function to be called * for each key/value pair. If action returns true, traversal is aborted. * @return {*} The first truthy value returned by action, or the last falsey * value returned by action */ SortedMap.prototype.inorderTraversal = function (action) { return this.root_.inorderTraversal(action); }; /** * Traverses the map in reverse key order and calls the specified action function * for each key/value pair. * * @param {function(!Object, !Object)} action Callback function to be called * for each key/value pair. If action returns true, traversal is aborted. * @return {*} True if the traversal was aborted. */ SortedMap.prototype.reverseTraversal = function (action) { return this.root_.reverseTraversal(action); }; /** * Returns an iterator over the SortedMap. * @template T * @param {(function(K, V):T)=} resultGenerator * @return {SortedMapIterator.} The iterator. */ SortedMap.prototype.getIterator = function (resultGenerator) { return new SortedMapIterator(this.root_, null, this.comparator_, false, resultGenerator); }; SortedMap.prototype.getIteratorFrom = function (key, resultGenerator) { return new SortedMapIterator(this.root_, key, this.comparator_, false, resultGenerator); }; SortedMap.prototype.getReverseIteratorFrom = function (key, resultGenerator) { return new SortedMapIterator(this.root_, key, this.comparator_, true, resultGenerator); }; SortedMap.prototype.getReverseIterator = function (resultGenerator) { return new SortedMapIterator(this.root_, null, this.comparator_, true, resultGenerator); }; /** * Always use the same empty node, to reduce memory. * @const */ SortedMap.EMPTY_NODE = new LLRBEmptyNode(); return SortedMap; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_2 = Math.log(2); /** * @constructor */ var Base12Num = /** @class */ (function () { /** * @param {number} length */ function Base12Num(length) { var logBase2 = function (num) { return parseInt((Math.log(num) / LOG_2), 10); }; var bitMask = function (bits) { return parseInt(Array(bits + 1).join('1'), 2); }; this.count = logBase2(length + 1); this.current_ = this.count - 1; var mask = bitMask(this.count); this.bits_ = (length + 1) & mask; } /** * @return {boolean} */ Base12Num.prototype.nextBitIsOne = function () { //noinspection JSBitwiseOperatorUsage var result = !(this.bits_ & (0x1 << this.current_)); this.current_--; return result; }; return Base12Num; }()); /** * Takes a list of child nodes and constructs a SortedSet using the given comparison * function * * Uses the algorithm described in the paper linked here: * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.46.1458 * * @template K, V * @param {Array.} childList Unsorted list of children * @param {function(!NamedNode, !NamedNode):number} cmp The comparison method to be used * @param {(function(NamedNode):K)=} keyFn An optional function to extract K from a node wrapper, if K's * type is not NamedNode * @param {(function(K, K):number)=} mapSortFn An optional override for comparator used by the generated sorted map * @return {SortedMap.} */ var buildChildSet = function (childList, cmp, keyFn, mapSortFn) { childList.sort(cmp); var buildBalancedTree = function (low, high) { var length = high - low; var namedNode; var key; if (length == 0) { return null; } else if (length == 1) { namedNode = childList[low]; key = keyFn ? keyFn(namedNode) : namedNode; return new LLRBNode(key, namedNode.node, LLRBNode.BLACK, null, null); } else { var middle = parseInt((length / 2), 10) + low; var left = buildBalancedTree(low, middle); var right = buildBalancedTree(middle + 1, high); namedNode = childList[middle]; key = keyFn ? keyFn(namedNode) : namedNode; return new LLRBNode(key, namedNode.node, LLRBNode.BLACK, left, right); } }; var buildFrom12Array = function (base12) { var node = null; var root = null; var index = childList.length; var buildPennant = function (chunkSize, color) { var low = index - chunkSize; var high = index; index -= chunkSize; var childTree = buildBalancedTree(low + 1, high); var namedNode = childList[low]; var key = keyFn ? keyFn(namedNode) : namedNode; attachPennant(new LLRBNode(key, namedNode.node, color, null, childTree)); }; var attachPennant = function (pennant) { if (node) { node.left = pennant; node = pennant; } else { root = pennant; node = pennant; } }; for (var i = 0; i < base12.count; ++i) { var isOne = base12.nextBitIsOne(); // The number of nodes taken in each slice is 2^(arr.length - (i + 1)) var chunkSize = Math.pow(2, base12.count - (i + 1)); if (isOne) { buildPennant(chunkSize, LLRBNode.BLACK); } else { // current == 2 buildPennant(chunkSize, LLRBNode.BLACK); buildPennant(chunkSize, LLRBNode.RED); } } return root; }; var base12 = new Base12Num(childList.length); var root = buildFrom12Array(base12); return new SortedMap(mapSortFn || cmp, root); }; /** * Copyright 2017 Google Inc. * * 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. */ var _defaultIndexMap; var fallbackObject = {}; /** * * @param {Object.>} indexes * @param {Object.} indexSet * @constructor */ var IndexMap = /** @class */ (function () { function IndexMap(indexes_, indexSet_) { this.indexes_ = indexes_; this.indexSet_ = indexSet_; } Object.defineProperty(IndexMap, "Default", { /** * The default IndexMap for nodes without a priority * @type {!IndexMap} * @const */ get: function () { util.assert(fallbackObject && PRIORITY_INDEX, 'ChildrenNode.ts has not been loaded'); _defaultIndexMap = _defaultIndexMap || new IndexMap({ '.priority': fallbackObject }, { '.priority': PRIORITY_INDEX }); return _defaultIndexMap; }, enumerable: true, configurable: true }); /** * * @param {!string} indexKey * @return {?SortedMap.} */ IndexMap.prototype.get = function (indexKey) { var sortedMap = util.safeGet(this.indexes_, indexKey); if (!sortedMap) throw new Error('No index defined for ' + indexKey); if (sortedMap === fallbackObject) { // The index exists, but it falls back to just name comparison. Return null so that the calling code uses the // regular child map return null; } else { return sortedMap; } }; /** * @param {!Index} indexDefinition * @return {boolean} */ IndexMap.prototype.hasIndex = function (indexDefinition) { return util.contains(this.indexSet_, indexDefinition.toString()); }; /** * @param {!Index} indexDefinition * @param {!SortedMap.} existingChildren * @return {!IndexMap} */ IndexMap.prototype.addIndex = function (indexDefinition, existingChildren) { util.assert(indexDefinition !== KEY_INDEX, "KeyIndex always exists and isn't meant to be added to the IndexMap."); var childList = []; var sawIndexedValue = false; var iter = existingChildren.getIterator(NamedNode.Wrap); var next = iter.getNext(); while (next) { sawIndexedValue = sawIndexedValue || indexDefinition.isDefinedOn(next.node); childList.push(next); next = iter.getNext(); } var newIndex; if (sawIndexedValue) { newIndex = buildChildSet(childList, indexDefinition.getCompare()); } else { newIndex = fallbackObject; } var indexName = indexDefinition.toString(); var newIndexSet = util.clone(this.indexSet_); newIndexSet[indexName] = indexDefinition; var newIndexes = util.clone(this.indexes_); newIndexes[indexName] = newIndex; return new IndexMap(newIndexes, newIndexSet); }; /** * Ensure that this node is properly tracked in any indexes that we're maintaining * @param {!NamedNode} namedNode * @param {!SortedMap.} existingChildren * @return {!IndexMap} */ IndexMap.prototype.addToIndexes = function (namedNode, existingChildren) { var _this = this; var newIndexes = util.map(this.indexes_, function (indexedChildren, indexName) { var index = util.safeGet(_this.indexSet_, indexName); util.assert(index, 'Missing index implementation for ' + indexName); if (indexedChildren === fallbackObject) { // Check to see if we need to index everything if (index.isDefinedOn(namedNode.node)) { // We need to build this index var childList = []; var iter = existingChildren.getIterator(NamedNode.Wrap); var next = iter.getNext(); while (next) { if (next.name != namedNode.name) { childList.push(next); } next = iter.getNext(); } childList.push(namedNode); return buildChildSet(childList, index.getCompare()); } else { // No change, this remains a fallback return fallbackObject; } } else { var existingSnap = existingChildren.get(namedNode.name); var newChildren = indexedChildren; if (existingSnap) { newChildren = newChildren.remove(new NamedNode(namedNode.name, existingSnap)); } return newChildren.insert(namedNode, namedNode.node); } }); return new IndexMap(newIndexes, this.indexSet_); }; /** * Create a new IndexMap instance with the given value removed * @param {!NamedNode} namedNode * @param {!SortedMap.} existingChildren * @return {!IndexMap} */ IndexMap.prototype.removeFromIndexes = function (namedNode, existingChildren) { var newIndexes = util.map(this.indexes_, function (indexedChildren) { if (indexedChildren === fallbackObject) { // This is the fallback. Just return it, nothing to do in this case return indexedChildren; } else { var existingSnap = existingChildren.get(namedNode.name); if (existingSnap) { return indexedChildren.remove(new NamedNode(namedNode.name, existingSnap)); } else { // No record of this child return indexedChildren; } } }); return new IndexMap(newIndexes, this.indexSet_); }; return IndexMap; }()); /** * Copyright 2017 Google Inc. * * 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. */ function NAME_ONLY_COMPARATOR(left, right) { return nameCompare(left.name, right.name); } function NAME_COMPARATOR(left, right) { return nameCompare(left, right); } /** * Copyright 2017 Google Inc. * * 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. */ // TODO: For memory savings, don't store priorityNode_ if it's empty. var EMPTY_NODE; /** * ChildrenNode is a class for storing internal nodes in a DataSnapshot * (i.e. nodes with children). It implements Node and stores the * list of children in the children property, sorted by child name. * * @constructor * @implements {Node} */ var ChildrenNode = /** @class */ (function () { /** * * @param {!SortedMap.} children_ List of children * of this node.. * @param {?Node} priorityNode_ The priority of this node (as a snapshot node). * @param {!IndexMap} indexMap_ */ function ChildrenNode(children_, priorityNode_, indexMap_) { this.children_ = children_; this.priorityNode_ = priorityNode_; this.indexMap_ = indexMap_; this.lazyHash_ = null; /** * Note: The only reason we allow null priority is for EMPTY_NODE, since we can't use * EMPTY_NODE as the priority of EMPTY_NODE. We might want to consider making EMPTY_NODE its own * class instead of an empty ChildrenNode. */ if (this.priorityNode_) { validatePriorityNode(this.priorityNode_); } if (this.children_.isEmpty()) { util.assert(!this.priorityNode_ || this.priorityNode_.isEmpty(), 'An empty node cannot have a priority'); } } Object.defineProperty(ChildrenNode, "EMPTY_NODE", { get: function () { return (EMPTY_NODE || (EMPTY_NODE = new ChildrenNode(new SortedMap(NAME_COMPARATOR), null, IndexMap.Default))); }, enumerable: true, configurable: true }); /** @inheritDoc */ ChildrenNode.prototype.isLeafNode = function () { return false; }; /** @inheritDoc */ ChildrenNode.prototype.getPriority = function () { return this.priorityNode_ || EMPTY_NODE; }; /** @inheritDoc */ ChildrenNode.prototype.updatePriority = function (newPriorityNode) { if (this.children_.isEmpty()) { // Don't allow priorities on empty nodes return this; } else { return new ChildrenNode(this.children_, newPriorityNode, this.indexMap_); } }; /** @inheritDoc */ ChildrenNode.prototype.getImmediateChild = function (childName) { // Hack to treat priority as a regular child if (childName === '.priority') { return this.getPriority(); } else { var child = this.children_.get(childName); return child === null ? EMPTY_NODE : child; } }; /** @inheritDoc */ ChildrenNode.prototype.getChild = function (path) { var front = path.getFront(); if (front === null) return this; return this.getImmediateChild(front).getChild(path.popFront()); }; /** @inheritDoc */ ChildrenNode.prototype.hasChild = function (childName) { return this.children_.get(childName) !== null; }; /** @inheritDoc */ ChildrenNode.prototype.updateImmediateChild = function (childName, newChildNode) { util.assert(newChildNode, 'We should always be passing snapshot nodes'); if (childName === '.priority') { return this.updatePriority(newChildNode); } else { var namedNode = new NamedNode(childName, newChildNode); var newChildren = void 0, newIndexMap = void 0, newPriority = void 0; if (newChildNode.isEmpty()) { newChildren = this.children_.remove(childName); newIndexMap = this.indexMap_.removeFromIndexes(namedNode, this.children_); } else { newChildren = this.children_.insert(childName, newChildNode); newIndexMap = this.indexMap_.addToIndexes(namedNode, this.children_); } newPriority = newChildren.isEmpty() ? EMPTY_NODE : this.priorityNode_; return new ChildrenNode(newChildren, newPriority, newIndexMap); } }; /** @inheritDoc */ ChildrenNode.prototype.updateChild = function (path, newChildNode) { var front = path.getFront(); if (front === null) { return newChildNode; } else { util.assert(path.getFront() !== '.priority' || path.getLength() === 1, '.priority must be the last token in a path'); var newImmediateChild = this.getImmediateChild(front).updateChild(path.popFront(), newChildNode); return this.updateImmediateChild(front, newImmediateChild); } }; /** @inheritDoc */ ChildrenNode.prototype.isEmpty = function () { return this.children_.isEmpty(); }; /** @inheritDoc */ ChildrenNode.prototype.numChildren = function () { return this.children_.count(); }; /** @inheritDoc */ ChildrenNode.prototype.val = function (exportFormat) { if (this.isEmpty()) return null; var obj = {}; var numKeys = 0, maxKey = 0, allIntegerKeys = true; this.forEachChild(PRIORITY_INDEX, function (key, childNode) { obj[key] = childNode.val(exportFormat); numKeys++; if (allIntegerKeys && ChildrenNode.INTEGER_REGEXP_.test(key)) { maxKey = Math.max(maxKey, Number(key)); } else { allIntegerKeys = false; } }); if (!exportFormat && allIntegerKeys && maxKey < 2 * numKeys) { // convert to array. var array = []; for (var key in obj) array[key] = obj[key]; return array; } else { if (exportFormat && !this.getPriority().isEmpty()) { obj['.priority'] = this.getPriority().val(); } return obj; } }; /** @inheritDoc */ ChildrenNode.prototype.hash = function () { if (this.lazyHash_ === null) { var toHash_1 = ''; if (!this.getPriority().isEmpty()) toHash_1 += 'priority:' + priorityHashText(this.getPriority().val()) + ':'; this.forEachChild(PRIORITY_INDEX, function (key, childNode) { var childHash = childNode.hash(); if (childHash !== '') toHash_1 += ':' + key + ':' + childHash; }); this.lazyHash_ = toHash_1 === '' ? '' : sha1(toHash_1); } return this.lazyHash_; }; /** @inheritDoc */ ChildrenNode.prototype.getPredecessorChildName = function (childName, childNode, index) { var idx = this.resolveIndex_(index); if (idx) { var predecessor = idx.getPredecessorKey(new NamedNode(childName, childNode)); return predecessor ? predecessor.name : null; } else { return this.children_.getPredecessorKey(childName); } }; /** * @param {!Index} indexDefinition * @return {?string} */ ChildrenNode.prototype.getFirstChildName = function (indexDefinition) { var idx = this.resolveIndex_(indexDefinition); if (idx) { var minKey = idx.minKey(); return minKey && minKey.name; } else { return this.children_.minKey(); } }; /** * @param {!Index} indexDefinition * @return {?NamedNode} */ ChildrenNode.prototype.getFirstChild = function (indexDefinition) { var minKey = this.getFirstChildName(indexDefinition); if (minKey) { return new NamedNode(minKey, this.children_.get(minKey)); } else { return null; } }; /** * Given an index, return the key name of the largest value we have, according to that index * @param {!Index} indexDefinition * @return {?string} */ ChildrenNode.prototype.getLastChildName = function (indexDefinition) { var idx = this.resolveIndex_(indexDefinition); if (idx) { var maxKey = idx.maxKey(); return maxKey && maxKey.name; } else { return this.children_.maxKey(); } }; /** * @param {!Index} indexDefinition * @return {?NamedNode} */ ChildrenNode.prototype.getLastChild = function (indexDefinition) { var maxKey = this.getLastChildName(indexDefinition); if (maxKey) { return new NamedNode(maxKey, this.children_.get(maxKey)); } else { return null; } }; /** * @inheritDoc */ ChildrenNode.prototype.forEachChild = function (index, action) { var idx = this.resolveIndex_(index); if (idx) { return idx.inorderTraversal(function (wrappedNode) { return action(wrappedNode.name, wrappedNode.node); }); } else { return this.children_.inorderTraversal(action); } }; /** * @param {!Index} indexDefinition * @return {SortedMapIterator} */ ChildrenNode.prototype.getIterator = function (indexDefinition) { return this.getIteratorFrom(indexDefinition.minPost(), indexDefinition); }; /** * * @param {!NamedNode} startPost * @param {!Index} indexDefinition * @return {!SortedMapIterator} */ ChildrenNode.prototype.getIteratorFrom = function (startPost, indexDefinition) { var idx = this.resolveIndex_(indexDefinition); if (idx) { return idx.getIteratorFrom(startPost, function (key) { return key; }); } else { var iterator = this.children_.getIteratorFrom(startPost.name, NamedNode.Wrap); var next = iterator.peek(); while (next != null && indexDefinition.compare(next, startPost) < 0) { iterator.getNext(); next = iterator.peek(); } return iterator; } }; /** * @param {!Index} indexDefinition * @return {!SortedMapIterator} */ ChildrenNode.prototype.getReverseIterator = function (indexDefinition) { return this.getReverseIteratorFrom(indexDefinition.maxPost(), indexDefinition); }; /** * @param {!NamedNode} endPost * @param {!Index} indexDefinition * @return {!SortedMapIterator} */ ChildrenNode.prototype.getReverseIteratorFrom = function (endPost, indexDefinition) { var idx = this.resolveIndex_(indexDefinition); if (idx) { return idx.getReverseIteratorFrom(endPost, function (key) { return key; }); } else { var iterator = this.children_.getReverseIteratorFrom(endPost.name, NamedNode.Wrap); var next = iterator.peek(); while (next != null && indexDefinition.compare(next, endPost) > 0) { iterator.getNext(); next = iterator.peek(); } return iterator; } }; /** * @inheritDoc */ ChildrenNode.prototype.compareTo = function (other) { if (this.isEmpty()) { if (other.isEmpty()) { return 0; } else { return -1; } } else if (other.isLeafNode() || other.isEmpty()) { return 1; } else if (other === MAX_NODE$2) { return -1; } else { // Must be another node with children. return 0; } }; /** * @inheritDoc */ ChildrenNode.prototype.withIndex = function (indexDefinition) { if (indexDefinition === KEY_INDEX || this.indexMap_.hasIndex(indexDefinition)) { return this; } else { var newIndexMap = this.indexMap_.addIndex(indexDefinition, this.children_); return new ChildrenNode(this.children_, this.priorityNode_, newIndexMap); } }; /** * @inheritDoc */ ChildrenNode.prototype.isIndexed = function (index) { return index === KEY_INDEX || this.indexMap_.hasIndex(index); }; /** * @inheritDoc */ ChildrenNode.prototype.equals = function (other) { if (other === this) { return true; } else if (other.isLeafNode()) { return false; } else { var otherChildrenNode = other; if (!this.getPriority().equals(otherChildrenNode.getPriority())) { return false; } else if (this.children_.count() === otherChildrenNode.children_.count()) { var thisIter = this.getIterator(PRIORITY_INDEX); var otherIter = otherChildrenNode.getIterator(PRIORITY_INDEX); var thisCurrent = thisIter.getNext(); var otherCurrent = otherIter.getNext(); while (thisCurrent && otherCurrent) { if (thisCurrent.name !== otherCurrent.name || !thisCurrent.node.equals(otherCurrent.node)) { return false; } thisCurrent = thisIter.getNext(); otherCurrent = otherIter.getNext(); } return thisCurrent === null && otherCurrent === null; } else { return false; } } }; /** * Returns a SortedMap ordered by index, or null if the default (by-key) ordering can be used * instead. * * @private * @param {!Index} indexDefinition * @return {?SortedMap.} */ ChildrenNode.prototype.resolveIndex_ = function (indexDefinition) { if (indexDefinition === KEY_INDEX) { return null; } else { return this.indexMap_.get(indexDefinition.toString()); } }; /** * @private * @type {RegExp} */ ChildrenNode.INTEGER_REGEXP_ = /^(0|[1-9]\d*)$/; return ChildrenNode; }()); /** * @constructor * @extends {ChildrenNode} * @private */ var MaxNode = /** @class */ (function (_super) { tslib_1.__extends(MaxNode, _super); function MaxNode() { return _super.call(this, new SortedMap(NAME_COMPARATOR), ChildrenNode.EMPTY_NODE, IndexMap.Default) || this; } MaxNode.prototype.compareTo = function (other) { if (other === this) { return 0; } else { return 1; } }; MaxNode.prototype.equals = function (other) { // Not that we every compare it, but MAX_NODE is only ever equal to itself return other === this; }; MaxNode.prototype.getPriority = function () { return this; }; MaxNode.prototype.getImmediateChild = function (childName) { return ChildrenNode.EMPTY_NODE; }; MaxNode.prototype.isEmpty = function () { return false; }; return MaxNode; }(ChildrenNode)); /** * Marker that will sort higher than any other snapshot. * @type {!MAX_NODE} * @const */ var MAX_NODE$2 = new MaxNode(); Object.defineProperties(NamedNode, { MIN: { value: new NamedNode(MIN_NAME, ChildrenNode.EMPTY_NODE) }, MAX: { value: new NamedNode(MAX_NAME, MAX_NODE$2) } }); /** * Reference Extensions */ KeyIndex.__EMPTY_NODE = ChildrenNode.EMPTY_NODE; LeafNode.__childrenNodeConstructor = ChildrenNode; setMaxNode(MAX_NODE$2); setMaxNode$1(MAX_NODE$2); /** * Copyright 2017 Google Inc. * * 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. */ var USE_HINZE = true; /** * Constructs a snapshot node representing the passed JSON and returns it. * @param {*} json JSON to create a node for. * @param {?string|?number=} priority Optional priority to use. This will be ignored if the * passed JSON contains a .priority property. * @return {!Node} */ function nodeFromJSON$1(json, priority) { if (priority === void 0) { priority = null; } if (json === null) { return ChildrenNode.EMPTY_NODE; } if (typeof json === 'object' && '.priority' in json) { priority = json['.priority']; } util.assert(priority === null || typeof priority === 'string' || typeof priority === 'number' || (typeof priority === 'object' && '.sv' in priority), 'Invalid priority type found: ' + typeof priority); if (typeof json === 'object' && '.value' in json && json['.value'] !== null) { json = json['.value']; } // Valid leaf nodes include non-objects or server-value wrapper objects if (typeof json !== 'object' || '.sv' in json) { var jsonLeaf = json; return new LeafNode(jsonLeaf, nodeFromJSON$1(priority)); } if (!(json instanceof Array) && USE_HINZE) { var children_1 = []; var childrenHavePriority_1 = false; var hinzeJsonObj_1 = json; util.forEach(hinzeJsonObj_1, function (key, child) { if (typeof key !== 'string' || key.substring(0, 1) !== '.') { // Ignore metadata nodes var childNode = nodeFromJSON$1(hinzeJsonObj_1[key]); if (!childNode.isEmpty()) { childrenHavePriority_1 = childrenHavePriority_1 || !childNode.getPriority().isEmpty(); children_1.push(new NamedNode(key, childNode)); } } }); if (children_1.length == 0) { return ChildrenNode.EMPTY_NODE; } var childSet = buildChildSet(children_1, NAME_ONLY_COMPARATOR, function (namedNode) { return namedNode.name; }, NAME_COMPARATOR); if (childrenHavePriority_1) { var sortedChildSet = buildChildSet(children_1, PRIORITY_INDEX.getCompare()); return new ChildrenNode(childSet, nodeFromJSON$1(priority), new IndexMap({ '.priority': sortedChildSet }, { '.priority': PRIORITY_INDEX })); } else { return new ChildrenNode(childSet, nodeFromJSON$1(priority), IndexMap.Default); } } else { var node_1 = ChildrenNode.EMPTY_NODE; var jsonObj_1 = json; util.forEach(jsonObj_1, function (key, childData) { if (util.contains(jsonObj_1, key)) { if (key.substring(0, 1) !== '.') { // ignore metadata nodes. var childNode = nodeFromJSON$1(childData); if (childNode.isLeafNode() || !childNode.isEmpty()) node_1 = node_1.updateImmediateChild(key, childNode); } } }); return node_1.updatePriority(nodeFromJSON$1(priority)); } } setNodeFromJSON(nodeFromJSON$1); /** * Copyright 2017 Google Inc. * * 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. */ /** * @constructor * @extends {Index} * @private */ var ValueIndex = /** @class */ (function (_super) { tslib_1.__extends(ValueIndex, _super); function ValueIndex() { return _super !== null && _super.apply(this, arguments) || this; } /** * @inheritDoc */ ValueIndex.prototype.compare = function (a, b) { var indexCmp = a.node.compareTo(b.node); if (indexCmp === 0) { return nameCompare(a.name, b.name); } else { return indexCmp; } }; /** * @inheritDoc */ ValueIndex.prototype.isDefinedOn = function (node) { return true; }; /** * @inheritDoc */ ValueIndex.prototype.indexedValueChanged = function (oldNode, newNode) { return !oldNode.equals(newNode); }; /** * @inheritDoc */ ValueIndex.prototype.minPost = function () { return NamedNode.MIN; }; /** * @inheritDoc */ ValueIndex.prototype.maxPost = function () { return NamedNode.MAX; }; /** * @param {*} indexValue * @param {string} name * @return {!NamedNode} */ ValueIndex.prototype.makePost = function (indexValue, name) { var valueNode = nodeFromJSON$1(indexValue); return new NamedNode(name, valueNode); }; /** * @return {!string} String representation for inclusion in a query spec */ ValueIndex.prototype.toString = function () { return '.value'; }; return ValueIndex; }(Index)); var VALUE_INDEX = new ValueIndex(); /** * Copyright 2017 Google Inc. * * 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. */ /** * @param {!Path} indexPath * @constructor * @extends {Index} */ var PathIndex = /** @class */ (function (_super) { tslib_1.__extends(PathIndex, _super); function PathIndex(indexPath_) { var _this = _super.call(this) || this; _this.indexPath_ = indexPath_; util.assert(!indexPath_.isEmpty() && indexPath_.getFront() !== '.priority', "Can't create PathIndex with empty path or .priority key"); return _this; } /** * @param {!Node} snap * @return {!Node} * @protected */ PathIndex.prototype.extractChild = function (snap) { return snap.getChild(this.indexPath_); }; /** * @inheritDoc */ PathIndex.prototype.isDefinedOn = function (node) { return !node.getChild(this.indexPath_).isEmpty(); }; /** * @inheritDoc */ PathIndex.prototype.compare = function (a, b) { var aChild = this.extractChild(a.node); var bChild = this.extractChild(b.node); var indexCmp = aChild.compareTo(bChild); if (indexCmp === 0) { return nameCompare(a.name, b.name); } else { return indexCmp; } }; /** * @inheritDoc */ PathIndex.prototype.makePost = function (indexValue, name) { var valueNode = nodeFromJSON$1(indexValue); var node = ChildrenNode.EMPTY_NODE.updateChild(this.indexPath_, valueNode); return new NamedNode(name, node); }; /** * @inheritDoc */ PathIndex.prototype.maxPost = function () { var node = ChildrenNode.EMPTY_NODE.updateChild(this.indexPath_, MAX_NODE$2); return new NamedNode(MAX_NAME, node); }; /** * @inheritDoc */ PathIndex.prototype.toString = function () { return this.indexPath_.slice().join('/'); }; return PathIndex; }(Index)); /** * Copyright 2017 Google Inc. * * 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. */ /** * Class representing a firebase data snapshot. It wraps a SnapshotNode and * surfaces the public methods (val, forEach, etc.) we want to expose. */ var DataSnapshot = /** @class */ (function () { /** * @param {!Node} node_ A SnapshotNode to wrap. * @param {!Reference} ref_ The ref of the location this snapshot came from. * @param {!Index} index_ The iteration order for this snapshot */ function DataSnapshot(node_, ref_, index_) { this.node_ = node_; this.ref_ = ref_; this.index_ = index_; } /** * Retrieves the snapshot contents as JSON. Returns null if the snapshot is * empty. * * @return {*} JSON representation of the DataSnapshot contents, or null if empty. */ DataSnapshot.prototype.val = function () { util.validateArgCount('DataSnapshot.val', 0, 0, arguments.length); return this.node_.val(); }; /** * Returns the snapshot contents as JSON, including priorities of node. Suitable for exporting * the entire node contents. * @return {*} JSON representation of the DataSnapshot contents, or null if empty. */ DataSnapshot.prototype.exportVal = function () { util.validateArgCount('DataSnapshot.exportVal', 0, 0, arguments.length); return this.node_.val(true); }; // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary // for end-users DataSnapshot.prototype.toJSON = function () { // Optional spacer argument is unnecessary because we're depending on recursion rather than stringifying the content util.validateArgCount('DataSnapshot.toJSON', 0, 1, arguments.length); return this.exportVal(); }; /** * Returns whether the snapshot contains a non-null value. * * @return {boolean} Whether the snapshot contains a non-null value, or is empty. */ DataSnapshot.prototype.exists = function () { util.validateArgCount('DataSnapshot.exists', 0, 0, arguments.length); return !this.node_.isEmpty(); }; /** * Returns a DataSnapshot of the specified child node's contents. * * @param {!string} childPathString Path to a child. * @return {!DataSnapshot} DataSnapshot for child node. */ DataSnapshot.prototype.child = function (childPathString) { util.validateArgCount('DataSnapshot.child', 0, 1, arguments.length); // Ensure the childPath is a string (can be a number) childPathString = String(childPathString); validatePathString('DataSnapshot.child', 1, childPathString, false); var childPath = new Path(childPathString); var childRef = this.ref_.child(childPath); return new DataSnapshot(this.node_.getChild(childPath), childRef, PRIORITY_INDEX); }; /** * Returns whether the snapshot contains a child at the specified path. * * @param {!string} childPathString Path to a child. * @return {boolean} Whether the child exists. */ DataSnapshot.prototype.hasChild = function (childPathString) { util.validateArgCount('DataSnapshot.hasChild', 1, 1, arguments.length); validatePathString('DataSnapshot.hasChild', 1, childPathString, false); var childPath = new Path(childPathString); return !this.node_.getChild(childPath).isEmpty(); }; /** * Returns the priority of the object, or null if no priority was set. * * @return {string|number|null} The priority. */ DataSnapshot.prototype.getPriority = function () { util.validateArgCount('DataSnapshot.getPriority', 0, 0, arguments.length); // typecast here because we never return deferred values or internal priorities (MAX_PRIORITY) return this.node_.getPriority().val(); }; /** * Iterates through child nodes and calls the specified action for each one. * * @param {function(!DataSnapshot)} action Callback function to be called * for each child. * @return {boolean} True if forEach was canceled by action returning true for * one of the child nodes. */ DataSnapshot.prototype.forEach = function (action) { var _this = this; util.validateArgCount('DataSnapshot.forEach', 1, 1, arguments.length); util.validateCallback('DataSnapshot.forEach', 1, action, false); if (this.node_.isLeafNode()) return false; var childrenNode = this.node_; // Sanitize the return value to a boolean. ChildrenNode.forEachChild has a weird return type... return !!childrenNode.forEachChild(this.index_, function (key, node) { return action(new DataSnapshot(node, _this.ref_.child(key), PRIORITY_INDEX)); }); }; /** * Returns whether this DataSnapshot has children. * @return {boolean} True if the DataSnapshot contains 1 or more child nodes. */ DataSnapshot.prototype.hasChildren = function () { util.validateArgCount('DataSnapshot.hasChildren', 0, 0, arguments.length); if (this.node_.isLeafNode()) return false; else return !this.node_.isEmpty(); }; Object.defineProperty(DataSnapshot.prototype, "key", { get: function () { return this.ref_.getKey(); }, enumerable: true, configurable: true }); /** * Returns the number of children for this DataSnapshot. * @return {number} The number of children that this DataSnapshot contains. */ DataSnapshot.prototype.numChildren = function () { util.validateArgCount('DataSnapshot.numChildren', 0, 0, arguments.length); return this.node_.numChildren(); }; /** * @return {Reference} The Firebase reference for the location this snapshot's data came from. */ DataSnapshot.prototype.getRef = function () { util.validateArgCount('DataSnapshot.ref', 0, 0, arguments.length); return this.ref_; }; Object.defineProperty(DataSnapshot.prototype, "ref", { get: function () { return this.getRef(); }, enumerable: true, configurable: true }); return DataSnapshot; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Encapsulates the data needed to raise an event * @implements {Event} */ var DataEvent = /** @class */ (function () { /** * @param {!string} eventType One of: value, child_added, child_changed, child_moved, child_removed * @param {!EventRegistration} eventRegistration The function to call to with the event data. User provided * @param {!DataSnapshot} snapshot The data backing the event * @param {?string=} prevName Optional, the name of the previous child for child_* events. */ function DataEvent(eventType, eventRegistration, snapshot, prevName) { this.eventType = eventType; this.eventRegistration = eventRegistration; this.snapshot = snapshot; this.prevName = prevName; } /** * @inheritDoc */ DataEvent.prototype.getPath = function () { var ref = this.snapshot.getRef(); if (this.eventType === 'value') { return ref.path; } else { return ref.getParent().path; } }; /** * @inheritDoc */ DataEvent.prototype.getEventType = function () { return this.eventType; }; /** * @inheritDoc */ DataEvent.prototype.getEventRunner = function () { return this.eventRegistration.getEventRunner(this); }; /** * @inheritDoc */ DataEvent.prototype.toString = function () { return (this.getPath().toString() + ':' + this.eventType + ':' + util.stringify(this.snapshot.exportVal())); }; return DataEvent; }()); var CancelEvent = /** @class */ (function () { /** * @param {EventRegistration} eventRegistration * @param {Error} error * @param {!Path} path */ function CancelEvent(eventRegistration, error, path) { this.eventRegistration = eventRegistration; this.error = error; this.path = path; } /** * @inheritDoc */ CancelEvent.prototype.getPath = function () { return this.path; }; /** * @inheritDoc */ CancelEvent.prototype.getEventType = function () { return 'cancel'; }; /** * @inheritDoc */ CancelEvent.prototype.getEventRunner = function () { return this.eventRegistration.getEventRunner(this); }; /** * @inheritDoc */ CancelEvent.prototype.toString = function () { return this.path.toString() + ':cancel'; }; return CancelEvent; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Represents registration for 'value' events. */ var ValueEventRegistration = /** @class */ (function () { /** * @param {?function(!DataSnapshot)} callback_ * @param {?function(Error)} cancelCallback_ * @param {?Object} context_ */ function ValueEventRegistration(callback_, cancelCallback_, context_) { this.callback_ = callback_; this.cancelCallback_ = cancelCallback_; this.context_ = context_; } /** * @inheritDoc */ ValueEventRegistration.prototype.respondsTo = function (eventType) { return eventType === 'value'; }; /** * @inheritDoc */ ValueEventRegistration.prototype.createEvent = function (change, query) { var index = query.getQueryParams().getIndex(); return new DataEvent('value', this, new DataSnapshot(change.snapshotNode, query.getRef(), index)); }; /** * @inheritDoc */ ValueEventRegistration.prototype.getEventRunner = function (eventData) { var ctx = this.context_; if (eventData.getEventType() === 'cancel') { util.assert(this.cancelCallback_, 'Raising a cancel event on a listener with no cancel callback'); var cancelCB_1 = this.cancelCallback_; return function () { // We know that error exists, we checked above that this is a cancel event cancelCB_1.call(ctx, eventData.error); }; } else { var cb_1 = this.callback_; return function () { cb_1.call(ctx, eventData.snapshot); }; } }; /** * @inheritDoc */ ValueEventRegistration.prototype.createCancelEvent = function (error, path) { if (this.cancelCallback_) { return new CancelEvent(this, error, path); } else { return null; } }; /** * @inheritDoc */ ValueEventRegistration.prototype.matches = function (other) { if (!(other instanceof ValueEventRegistration)) { return false; } else if (!other.callback_ || !this.callback_) { // If no callback specified, we consider it to match any callback. return true; } else { return (other.callback_ === this.callback_ && other.context_ === this.context_); } }; /** * @inheritDoc */ ValueEventRegistration.prototype.hasAnyCallback = function () { return this.callback_ !== null; }; return ValueEventRegistration; }()); /** * Represents the registration of 1 or more child_xxx events. * * Currently, it is always exactly 1 child_xxx event, but the idea is we might let you * register a group of callbacks together in the future. * * @constructor * @implements {EventRegistration} */ var ChildEventRegistration = /** @class */ (function () { /** * @param {?Object.} callbacks_ * @param {?function(Error)} cancelCallback_ * @param {Object=} context_ */ function ChildEventRegistration(callbacks_, cancelCallback_, context_) { this.callbacks_ = callbacks_; this.cancelCallback_ = cancelCallback_; this.context_ = context_; } /** * @inheritDoc */ ChildEventRegistration.prototype.respondsTo = function (eventType) { var eventToCheck = eventType === 'children_added' ? 'child_added' : eventType; eventToCheck = eventToCheck === 'children_removed' ? 'child_removed' : eventToCheck; return util.contains(this.callbacks_, eventToCheck); }; /** * @inheritDoc */ ChildEventRegistration.prototype.createCancelEvent = function (error, path) { if (this.cancelCallback_) { return new CancelEvent(this, error, path); } else { return null; } }; /** * @inheritDoc */ ChildEventRegistration.prototype.createEvent = function (change, query) { util.assert(change.childName != null, 'Child events should have a childName.'); var ref = query.getRef().child(/** @type {!string} */ (change.childName)); var index = query.getQueryParams().getIndex(); return new DataEvent(change.type, this, new DataSnapshot(change.snapshotNode, ref, index), change.prevName); }; /** * @inheritDoc */ ChildEventRegistration.prototype.getEventRunner = function (eventData) { var ctx = this.context_; if (eventData.getEventType() === 'cancel') { util.assert(this.cancelCallback_, 'Raising a cancel event on a listener with no cancel callback'); var cancelCB_2 = this.cancelCallback_; return function () { // We know that error exists, we checked above that this is a cancel event cancelCB_2.call(ctx, eventData.error); }; } else { var cb_2 = this.callbacks_[eventData.eventType]; return function () { cb_2.call(ctx, eventData.snapshot, eventData.prevName); }; } }; /** * @inheritDoc */ ChildEventRegistration.prototype.matches = function (other) { if (other instanceof ChildEventRegistration) { if (!this.callbacks_ || !other.callbacks_) { return true; } else if (this.context_ === other.context_) { var otherCount = util.getCount(other.callbacks_); var thisCount = util.getCount(this.callbacks_); if (otherCount === thisCount) { // If count is 1, do an exact match on eventType, if either is defined but null, it's a match. // If event types don't match, not a match // If count is not 1, exact match across all if (otherCount === 1) { var otherKey /** @type {!string} */ = util.getAnyKey(other.callbacks_); var thisKey /** @type {!string} */ = util.getAnyKey(this.callbacks_); return (thisKey === otherKey && (!other.callbacks_[otherKey] || !this.callbacks_[thisKey] || other.callbacks_[otherKey] === this.callbacks_[thisKey])); } else { // Exact match on each key. return util.every(this.callbacks_, function (eventType, cb) { return other.callbacks_[eventType] === cb; }); } } } } return false; }; /** * @inheritDoc */ ChildEventRegistration.prototype.hasAnyCallback = function () { return this.callbacks_ !== null; }; return ChildEventRegistration; }()); /** * Copyright 2017 Google Inc. * * 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. */ var __referenceConstructor; /** * A Query represents a filter to be applied to a firebase location. This object purely represents the * query expression (and exposes our public API to build the query). The actual query logic is in ViewBase.js. * * Since every Firebase reference is a query, Firebase inherits from this object. */ var Query = /** @class */ (function () { function Query(repo, path, queryParams_, orderByCalled_) { this.repo = repo; this.path = path; this.queryParams_ = queryParams_; this.orderByCalled_ = orderByCalled_; } Object.defineProperty(Query, "__referenceConstructor", { get: function () { util.assert(__referenceConstructor, 'Reference.ts has not been loaded'); return __referenceConstructor; }, set: function (val) { __referenceConstructor = val; }, enumerable: true, configurable: true }); /** * Validates start/end values for queries. * @param {!QueryParams} params * @private */ Query.validateQueryEndpoints_ = function (params) { var startNode = null; var endNode = null; if (params.hasStart()) { startNode = params.getIndexStartValue(); } if (params.hasEnd()) { endNode = params.getIndexEndValue(); } if (params.getIndex() === KEY_INDEX) { var tooManyArgsError = 'Query: When ordering by key, you may only pass one argument to ' + 'startAt(), endAt(), or equalTo().'; var wrongArgTypeError = 'Query: When ordering by key, the argument passed to startAt(), endAt(),' + 'or equalTo() must be a string.'; if (params.hasStart()) { var startName = params.getIndexStartName(); if (startName != MIN_NAME) { throw new Error(tooManyArgsError); } else if (typeof startNode !== 'string') { throw new Error(wrongArgTypeError); } } if (params.hasEnd()) { var endName = params.getIndexEndName(); if (endName != MAX_NAME) { throw new Error(tooManyArgsError); } else if (typeof endNode !== 'string') { throw new Error(wrongArgTypeError); } } } else if (params.getIndex() === PRIORITY_INDEX) { if ((startNode != null && !isValidPriority(startNode)) || (endNode != null && !isValidPriority(endNode))) { throw new Error('Query: When ordering by priority, the first argument passed to startAt(), ' + 'endAt(), or equalTo() must be a valid priority value (null, a number, or a string).'); } } else { util.assert(params.getIndex() instanceof PathIndex || params.getIndex() === VALUE_INDEX, 'unknown index type.'); if ((startNode != null && typeof startNode === 'object') || (endNode != null && typeof endNode === 'object')) { throw new Error('Query: First argument passed to startAt(), endAt(), or equalTo() cannot be ' + 'an object.'); } } }; /** * Validates that limit* has been called with the correct combination of parameters * @param {!QueryParams} params * @private */ Query.validateLimit_ = function (params) { if (params.hasStart() && params.hasEnd() && params.hasLimit() && !params.hasAnchoredLimit()) { throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead."); } }; /** * Validates that no other order by call has been made * @param {!string} fnName * @private */ Query.prototype.validateNoPreviousOrderByCall_ = function (fnName) { if (this.orderByCalled_ === true) { throw new Error(fnName + ": You can't combine multiple orderBy calls."); } }; /** * @return {!QueryParams} */ Query.prototype.getQueryParams = function () { return this.queryParams_; }; /** * @return {!Reference} */ Query.prototype.getRef = function () { util.validateArgCount('Query.ref', 0, 0, arguments.length); // This is a slight hack. We cannot goog.require('fb.api.Firebase'), since Firebase requires fb.api.Query. // However, we will always export 'Firebase' to the global namespace, so it's guaranteed to exist by the time this // method gets called. return new Query.__referenceConstructor(this.repo, this.path); }; /** * @param {!string} eventType * @param {!function(DataSnapshot, string=)} callback * @param {(function(Error)|Object)=} cancelCallbackOrContext * @param {Object=} context * @return {!function(DataSnapshot, string=)} */ Query.prototype.on = function (eventType, callback, cancelCallbackOrContext, context) { util.validateArgCount('Query.on', 2, 4, arguments.length); validateEventType('Query.on', 1, eventType, false); util.validateCallback('Query.on', 2, callback, false); var ret = Query.getCancelAndContextArgs_('Query.on', cancelCallbackOrContext, context); if (eventType === 'value') { this.onValueEvent(callback, ret.cancel, ret.context); } else { var callbacks = {}; callbacks[eventType] = callback; this.onChildEvent(callbacks, ret.cancel, ret.context); } return callback; }; /** * @param {!function(!DataSnapshot)} callback * @param {?function(Error)} cancelCallback * @param {?Object} context * @protected */ Query.prototype.onValueEvent = function (callback, cancelCallback, context) { var container = new ValueEventRegistration(callback, cancelCallback || null, context || null); this.repo.addEventCallbackForQuery(this, container); }; /** * @param {!Object.} callbacks * @param {?function(Error)} cancelCallback * @param {?Object} context * @protected */ Query.prototype.onChildEvent = function (callbacks, cancelCallback, context) { var container = new ChildEventRegistration(callbacks, cancelCallback, context); this.repo.addEventCallbackForQuery(this, container); }; /** * @param {string=} eventType * @param {(function(!DataSnapshot, ?string=))=} callback * @param {Object=} context */ Query.prototype.off = function (eventType, callback, context) { util.validateArgCount('Query.off', 0, 3, arguments.length); validateEventType('Query.off', 1, eventType, true); util.validateCallback('Query.off', 2, callback, true); util.validateContextObject('Query.off', 3, context, true); var container = null; var callbacks = null; if (eventType === 'value') { var valueCallback = callback || null; container = new ValueEventRegistration(valueCallback, null, context || null); } else if (eventType) { if (callback) { callbacks = {}; callbacks[eventType] = callback; } container = new ChildEventRegistration(callbacks, null, context || null); } this.repo.removeEventCallbackForQuery(this, container); }; /** * Attaches a listener, waits for the first event, and then removes the listener * @param {!string} eventType * @param {!function(!DataSnapshot, string=)} userCallback * @param cancelOrContext * @param context * @return {!firebase.Promise} */ Query.prototype.once = function (eventType, userCallback, cancelOrContext, context) { var _this = this; util.validateArgCount('Query.once', 1, 4, arguments.length); validateEventType('Query.once', 1, eventType, false); util.validateCallback('Query.once', 2, userCallback, true); var ret = Query.getCancelAndContextArgs_('Query.once', cancelOrContext, context); // TODO: Implement this more efficiently (in particular, use 'get' wire protocol for 'value' event) // TODO: consider actually wiring the callbacks into the promise. We cannot do this without a breaking change // because the API currently expects callbacks will be called synchronously if the data is cached, but this is // against the Promise specification. var firstCall = true; var deferred = new util.Deferred(); // A dummy error handler in case a user wasn't expecting promises deferred.promise.catch(function () { }); var onceCallback = function (snapshot) { // NOTE: Even though we unsubscribe, we may get called multiple times if a single action (e.g. set() with JSON) // triggers multiple events (e.g. child_added or child_changed). if (firstCall) { firstCall = false; _this.off(eventType, onceCallback); if (userCallback) { userCallback.bind(ret.context)(snapshot); } deferred.resolve(snapshot); } }; this.on(eventType, onceCallback, /*cancel=*/ function (err) { _this.off(eventType, onceCallback); if (ret.cancel) ret.cancel.bind(ret.context)(err); deferred.reject(err); }); return deferred.promise; }; /** * Set a limit and anchor it to the start of the window. * @param {!number} limit * @return {!Query} */ Query.prototype.limitToFirst = function (limit) { util.validateArgCount('Query.limitToFirst', 1, 1, arguments.length); if (typeof limit !== 'number' || Math.floor(limit) !== limit || limit <= 0) { throw new Error('Query.limitToFirst: First argument must be a positive integer.'); } if (this.queryParams_.hasLimit()) { throw new Error('Query.limitToFirst: Limit was already set (by another call to limit, ' + 'limitToFirst, or limitToLast).'); } return new Query(this.repo, this.path, this.queryParams_.limitToFirst(limit), this.orderByCalled_); }; /** * Set a limit and anchor it to the end of the window. * @param {!number} limit * @return {!Query} */ Query.prototype.limitToLast = function (limit) { util.validateArgCount('Query.limitToLast', 1, 1, arguments.length); if (typeof limit !== 'number' || Math.floor(limit) !== limit || limit <= 0) { throw new Error('Query.limitToLast: First argument must be a positive integer.'); } if (this.queryParams_.hasLimit()) { throw new Error('Query.limitToLast: Limit was already set (by another call to limit, ' + 'limitToFirst, or limitToLast).'); } return new Query(this.repo, this.path, this.queryParams_.limitToLast(limit), this.orderByCalled_); }; /** * Given a child path, return a new query ordered by the specified grandchild path. * @param {!string} path * @return {!Query} */ Query.prototype.orderByChild = function (path) { util.validateArgCount('Query.orderByChild', 1, 1, arguments.length); if (path === '$key') { throw new Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.'); } else if (path === '$priority') { throw new Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.'); } else if (path === '$value') { throw new Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.'); } validatePathString('Query.orderByChild', 1, path, false); this.validateNoPreviousOrderByCall_('Query.orderByChild'); var parsedPath = new Path(path); if (parsedPath.isEmpty()) { throw new Error('Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.'); } var index = new PathIndex(parsedPath); var newParams = this.queryParams_.orderBy(index); Query.validateQueryEndpoints_(newParams); return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); }; /** * Return a new query ordered by the KeyIndex * @return {!Query} */ Query.prototype.orderByKey = function () { util.validateArgCount('Query.orderByKey', 0, 0, arguments.length); this.validateNoPreviousOrderByCall_('Query.orderByKey'); var newParams = this.queryParams_.orderBy(KEY_INDEX); Query.validateQueryEndpoints_(newParams); return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); }; /** * Return a new query ordered by the PriorityIndex * @return {!Query} */ Query.prototype.orderByPriority = function () { util.validateArgCount('Query.orderByPriority', 0, 0, arguments.length); this.validateNoPreviousOrderByCall_('Query.orderByPriority'); var newParams = this.queryParams_.orderBy(PRIORITY_INDEX); Query.validateQueryEndpoints_(newParams); return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); }; /** * Return a new query ordered by the ValueIndex * @return {!Query} */ Query.prototype.orderByValue = function () { util.validateArgCount('Query.orderByValue', 0, 0, arguments.length); this.validateNoPreviousOrderByCall_('Query.orderByValue'); var newParams = this.queryParams_.orderBy(VALUE_INDEX); Query.validateQueryEndpoints_(newParams); return new Query(this.repo, this.path, newParams, /*orderByCalled=*/ true); }; /** * @param {number|string|boolean|null} value * @param {?string=} name * @return {!Query} */ Query.prototype.startAt = function (value, name) { if (value === void 0) { value = null; } util.validateArgCount('Query.startAt', 0, 2, arguments.length); validateFirebaseDataArg('Query.startAt', 1, value, this.path, true); validateKey('Query.startAt', 2, name, true); var newParams = this.queryParams_.startAt(value, name); Query.validateLimit_(newParams); Query.validateQueryEndpoints_(newParams); if (this.queryParams_.hasStart()) { throw new Error('Query.startAt: Starting point was already set (by another call to startAt ' + 'or equalTo).'); } // Calling with no params tells us to start at the beginning. if (value === undefined) { value = null; name = null; } return new Query(this.repo, this.path, newParams, this.orderByCalled_); }; /** * @param {number|string|boolean|null} value * @param {?string=} name * @return {!Query} */ Query.prototype.endAt = function (value, name) { if (value === void 0) { value = null; } util.validateArgCount('Query.endAt', 0, 2, arguments.length); validateFirebaseDataArg('Query.endAt', 1, value, this.path, true); validateKey('Query.endAt', 2, name, true); var newParams = this.queryParams_.endAt(value, name); Query.validateLimit_(newParams); Query.validateQueryEndpoints_(newParams); if (this.queryParams_.hasEnd()) { throw new Error('Query.endAt: Ending point was already set (by another call to endAt or ' + 'equalTo).'); } return new Query(this.repo, this.path, newParams, this.orderByCalled_); }; /** * Load the selection of children with exactly the specified value, and, optionally, * the specified name. * @param {number|string|boolean|null} value * @param {string=} name * @return {!Query} */ Query.prototype.equalTo = function (value, name) { util.validateArgCount('Query.equalTo', 1, 2, arguments.length); validateFirebaseDataArg('Query.equalTo', 1, value, this.path, false); validateKey('Query.equalTo', 2, name, true); if (this.queryParams_.hasStart()) { throw new Error('Query.equalTo: Starting point was already set (by another call to startAt or ' + 'equalTo).'); } if (this.queryParams_.hasEnd()) { throw new Error('Query.equalTo: Ending point was already set (by another call to endAt or ' + 'equalTo).'); } return this.startAt(value, name).endAt(value, name); }; /** * @return {!string} URL for this location. */ Query.prototype.toString = function () { util.validateArgCount('Query.toString', 0, 0, arguments.length); return this.repo.toString() + this.path.toUrlEncodedString(); }; // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary // for end-users. Query.prototype.toJSON = function () { // An optional spacer argument is unnecessary for a string. util.validateArgCount('Query.toJSON', 0, 1, arguments.length); return this.toString(); }; /** * An object representation of the query parameters used by this Query. * @return {!Object} */ Query.prototype.queryObject = function () { return this.queryParams_.getQueryObject(); }; /** * @return {!string} */ Query.prototype.queryIdentifier = function () { var obj = this.queryObject(); var id = ObjectToUniqueKey(obj); return id === '{}' ? 'default' : id; }; /** * Return true if this query and the provided query are equivalent; otherwise, return false. * @param {Query} other * @return {boolean} */ Query.prototype.isEqual = function (other) { util.validateArgCount('Query.isEqual', 1, 1, arguments.length); if (!(other instanceof Query)) { var error$$1 = 'Query.isEqual failed: First argument must be an instance of firebase.database.Query.'; throw new Error(error$$1); } var sameRepo = this.repo === other.repo; var samePath = this.path.equals(other.path); var sameQueryIdentifier = this.queryIdentifier() === other.queryIdentifier(); return sameRepo && samePath && sameQueryIdentifier; }; /** * Helper used by .on and .once to extract the context and or cancel arguments. * @param {!string} fnName The function name (on or once) * @param {(function(Error)|Object)=} cancelOrContext * @param {Object=} context * @return {{cancel: ?function(Error), context: ?Object}} * @private */ Query.getCancelAndContextArgs_ = function (fnName, cancelOrContext, context) { var ret = { cancel: null, context: null }; if (cancelOrContext && context) { ret.cancel = cancelOrContext; util.validateCallback(fnName, 3, ret.cancel, true); ret.context = context; util.validateContextObject(fnName, 4, ret.context, true); } else if (cancelOrContext) { // we have either a cancel callback or a context. if (typeof cancelOrContext === 'object' && cancelOrContext !== null) { // it's a context! ret.context = cancelOrContext; } else if (typeof cancelOrContext === 'function') { ret.cancel = cancelOrContext; } else { throw new Error(util.errorPrefix(fnName, 3, true) + ' must either be a cancel callback or a context object.'); } } return ret; }; Object.defineProperty(Query.prototype, "ref", { get: function () { return this.getRef(); }, enumerable: true, configurable: true }); return Query; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Implements a set with a count of elements. * * @template K, V */ var CountedSet = /** @class */ (function () { function CountedSet() { this.set = {}; } /** * @param {!K} item * @param {V} val */ CountedSet.prototype.add = function (item, val) { this.set[item] = val !== null ? val : true; }; /** * @param {!K} key * @return {boolean} */ CountedSet.prototype.contains = function (key) { return util.contains(this.set, key); }; /** * @param {!K} item * @return {V} */ CountedSet.prototype.get = function (item) { return this.contains(item) ? this.set[item] : undefined; }; /** * @param {!K} item */ CountedSet.prototype.remove = function (item) { delete this.set[item]; }; /** * Deletes everything in the set */ CountedSet.prototype.clear = function () { this.set = {}; }; /** * True if there's nothing in the set * @return {boolean} */ CountedSet.prototype.isEmpty = function () { return util.isEmpty(this.set); }; /** * @return {number} The number of items in the set */ CountedSet.prototype.count = function () { return util.getCount(this.set); }; /** * Run a function on each k,v pair in the set * @param {function(K, V)} fn */ CountedSet.prototype.each = function (fn) { util.forEach(this.set, function (k, v) { return fn(k, v); }); }; /** * Mostly for debugging * @return {Array.} The keys present in this CountedSet */ CountedSet.prototype.keys = function () { var keys = []; util.forEach(this.set, function (k) { keys.push(k); }); return keys; }; return CountedSet; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Helper class to store a sparse set of snapshots. * * @constructor */ var SparseSnapshotTree = /** @class */ (function () { function SparseSnapshotTree() { /** * @private * @type {Node} */ this.value_ = null; /** * @private * @type {CountedSet} */ this.children_ = null; } /** * Gets the node stored at the given path if one exists. * * @param {!Path} path Path to look up snapshot for. * @return {?Node} The retrieved node, or null. */ SparseSnapshotTree.prototype.find = function (path) { if (this.value_ != null) { return this.value_.getChild(path); } else if (!path.isEmpty() && this.children_ != null) { var childKey = path.getFront(); path = path.popFront(); if (this.children_.contains(childKey)) { var childTree = this.children_.get(childKey); return childTree.find(path); } else { return null; } } else { return null; } }; /** * Stores the given node at the specified path. If there is already a node * at a shallower path, it merges the new data into that snapshot node. * * @param {!Path} path Path to look up snapshot for. * @param {!Node} data The new data, or null. */ SparseSnapshotTree.prototype.remember = function (path, data) { if (path.isEmpty()) { this.value_ = data; this.children_ = null; } else if (this.value_ !== null) { this.value_ = this.value_.updateChild(path, data); } else { if (this.children_ == null) { this.children_ = new CountedSet(); } var childKey = path.getFront(); if (!this.children_.contains(childKey)) { this.children_.add(childKey, new SparseSnapshotTree()); } var child = this.children_.get(childKey); path = path.popFront(); child.remember(path, data); } }; /** * Purge the data at path from the cache. * * @param {!Path} path Path to look up snapshot for. * @return {boolean} True if this node should now be removed. */ SparseSnapshotTree.prototype.forget = function (path) { if (path.isEmpty()) { this.value_ = null; this.children_ = null; return true; } else { if (this.value_ !== null) { if (this.value_.isLeafNode()) { // We're trying to forget a node that doesn't exist return false; } else { var value = this.value_; this.value_ = null; var self_1 = this; value.forEachChild(PRIORITY_INDEX, function (key, tree) { self_1.remember(new Path(key), tree); }); return this.forget(path); } } else if (this.children_ !== null) { var childKey = path.getFront(); path = path.popFront(); if (this.children_.contains(childKey)) { var safeToRemove = this.children_.get(childKey).forget(path); if (safeToRemove) { this.children_.remove(childKey); } } if (this.children_.isEmpty()) { this.children_ = null; return true; } else { return false; } } else { return true; } } }; /** * Recursively iterates through all of the stored tree and calls the * callback on each one. * * @param {!Path} prefixPath Path to look up node for. * @param {!Function} func The function to invoke for each tree. */ SparseSnapshotTree.prototype.forEachTree = function (prefixPath, func) { if (this.value_ !== null) { func(prefixPath, this.value_); } else { this.forEachChild(function (key, tree) { var path = new Path(prefixPath.toString() + '/' + key); tree.forEachTree(path, func); }); } }; /** * Iterates through each immediate child and triggers the callback. * * @param {!Function} func The function to invoke for each child. */ SparseSnapshotTree.prototype.forEachChild = function (func) { if (this.children_ !== null) { this.children_.each(function (key, tree) { func(key, tree); }); } }; return SparseSnapshotTree; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Generate placeholders for deferred values. * @param {?Object} values * @return {!Object} */ var generateWithValues = function (values) { values = values || {}; values['timestamp'] = values['timestamp'] || new Date().getTime(); return values; }; /** * Value to use when firing local events. When writing server values, fire * local events with an approximate value, otherwise return value as-is. * @param {(Object|string|number|boolean)} value * @param {!Object} serverValues * @return {!(string|number|boolean)} */ var resolveDeferredValue = function (value, serverValues) { if (!value || typeof value !== 'object') { return value; } else { util.assert('.sv' in value, 'Unexpected leaf node or priority contents'); return serverValues[value['.sv']]; } }; /** * Recursively replace all deferred values and priorities in the tree with the * specified generated replacement values. * @param {!SparseSnapshotTree} tree * @param {!Object} serverValues * @return {!SparseSnapshotTree} */ var resolveDeferredValueTree = function (tree, serverValues) { var resolvedTree = new SparseSnapshotTree(); tree.forEachTree(new Path(''), function (path, node) { resolvedTree.remember(path, resolveDeferredValueSnapshot(node, serverValues)); }); return resolvedTree; }; /** * Recursively replace all deferred values and priorities in the node with the * specified generated replacement values. If there are no server values in the node, * it'll be returned as-is. * @param {!Node} node * @param {!Object} serverValues * @return {!Node} */ var resolveDeferredValueSnapshot = function (node, serverValues) { var rawPri = node.getPriority().val(); var priority = resolveDeferredValue(rawPri, serverValues); var newNode; if (node.isLeafNode()) { var leafNode = node; var value = resolveDeferredValue(leafNode.getValue(), serverValues); if (value !== leafNode.getValue() || priority !== leafNode.getPriority().val()) { return new LeafNode(value, nodeFromJSON$1(priority)); } else { return node; } } else { var childrenNode = node; newNode = childrenNode; if (priority !== childrenNode.getPriority().val()) { newNode = newNode.updatePriority(new LeafNode(priority)); } childrenNode.forEachChild(PRIORITY_INDEX, function (childName, childNode) { var newChildNode = resolveDeferredValueSnapshot(childNode, serverValues); if (newChildNode !== childNode) { newNode = newNode.updateImmediateChild(childName, newChildNode); } }); return newNode; } }; /** * Copyright 2017 Google Inc. * * 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. */ /** * * @enum */ var OperationType; (function (OperationType) { OperationType[OperationType["OVERWRITE"] = 0] = "OVERWRITE"; OperationType[OperationType["MERGE"] = 1] = "MERGE"; OperationType[OperationType["ACK_USER_WRITE"] = 2] = "ACK_USER_WRITE"; OperationType[OperationType["LISTEN_COMPLETE"] = 3] = "LISTEN_COMPLETE"; })(OperationType || (OperationType = {})); /** * @param {boolean} fromUser * @param {boolean} fromServer * @param {?string} queryId * @param {boolean} tagged * @constructor */ var OperationSource = /** @class */ (function () { function OperationSource(fromUser, fromServer, queryId, tagged) { this.fromUser = fromUser; this.fromServer = fromServer; this.queryId = queryId; this.tagged = tagged; util.assert(!tagged || fromServer, 'Tagged queries must be from server.'); } /** * @const * @type {!OperationSource} */ OperationSource.User = new OperationSource( /*fromUser=*/ true, false, null, /*tagged=*/ false); /** * @const * @type {!OperationSource} */ OperationSource.Server = new OperationSource(false, /*fromServer=*/ true, null, /*tagged=*/ false); /** * @param {string} queryId * @return {!OperationSource} */ OperationSource.forServerTaggedQuery = function (queryId) { return new OperationSource(false, /*fromServer=*/ true, queryId, /*tagged=*/ true); }; return OperationSource; }()); /** * Copyright 2017 Google Inc. * * 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. */ var AckUserWrite = /** @class */ (function () { /** * * @param {!Path} path * @param {!ImmutableTree} affectedTree A tree containing true for each affected path. Affected paths can't overlap. * @param {!boolean} revert */ function AckUserWrite( /**@inheritDoc */ path, /**@inheritDoc */ affectedTree, /**@inheritDoc */ revert) { this.path = path; this.affectedTree = affectedTree; this.revert = revert; /** @inheritDoc */ this.type = OperationType.ACK_USER_WRITE; /** @inheritDoc */ this.source = OperationSource.User; } /** * @inheritDoc */ AckUserWrite.prototype.operationForChild = function (childName) { if (!this.path.isEmpty()) { util.assert(this.path.getFront() === childName, 'operationForChild called for unrelated child.'); return new AckUserWrite(this.path.popFront(), this.affectedTree, this.revert); } else if (this.affectedTree.value != null) { util.assert(this.affectedTree.children.isEmpty(), 'affectedTree should not have overlapping affected paths.'); // All child locations are affected as well; just return same operation. return this; } else { var childTree = this.affectedTree.subtree(new Path(childName)); return new AckUserWrite(Path.Empty, childTree, this.revert); } }; return AckUserWrite; }()); /** * Copyright 2017 Google Inc. * * 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. */ var emptyChildrenSingleton; /** * Singleton empty children collection. * * @const * @type {!SortedMap.>} */ var EmptyChildren = function () { if (!emptyChildrenSingleton) { emptyChildrenSingleton = new SortedMap(stringCompare); } return emptyChildrenSingleton; }; /** * A tree with immutable elements. */ var ImmutableTree = /** @class */ (function () { /** * @template T * @param {?T} value * @param {SortedMap.>=} children */ function ImmutableTree(value, children) { if (children === void 0) { children = EmptyChildren(); } this.value = value; this.children = children; } /** * @template T * @param {!Object.} obj * @return {!ImmutableTree.} */ ImmutableTree.fromObject = function (obj) { var tree = ImmutableTree.Empty; util.forEach(obj, function (childPath, childSnap) { tree = tree.set(new Path(childPath), childSnap); }); return tree; }; /** * True if the value is empty and there are no children * @return {boolean} */ ImmutableTree.prototype.isEmpty = function () { return this.value === null && this.children.isEmpty(); }; /** * Given a path and predicate, return the first node and the path to that node * where the predicate returns true. * * TODO Do a perf test -- If we're creating a bunch of {path: value:} objects * on the way back out, it may be better to pass down a pathSoFar obj. * * @param {!Path} relativePath The remainder of the path * @param {function(T):boolean} predicate The predicate to satisfy to return a * node * @return {?{path:!Path, value:!T}} */ ImmutableTree.prototype.findRootMostMatchingPathAndValue = function (relativePath, predicate) { if (this.value != null && predicate(this.value)) { return { path: Path.Empty, value: this.value }; } else { if (relativePath.isEmpty()) { return null; } else { var front = relativePath.getFront(); var child = this.children.get(front); if (child !== null) { var childExistingPathAndValue = child.findRootMostMatchingPathAndValue(relativePath.popFront(), predicate); if (childExistingPathAndValue != null) { var fullPath = new Path(front).child(childExistingPathAndValue.path); return { path: fullPath, value: childExistingPathAndValue.value }; } else { return null; } } else { return null; } } } }; /** * Find, if it exists, the shortest subpath of the given path that points a defined * value in the tree * @param {!Path} relativePath * @return {?{path: !Path, value: !T}} */ ImmutableTree.prototype.findRootMostValueAndPath = function (relativePath) { return this.findRootMostMatchingPathAndValue(relativePath, function () { return true; }); }; /** * @param {!Path} relativePath * @return {!ImmutableTree.} The subtree at the given path */ ImmutableTree.prototype.subtree = function (relativePath) { if (relativePath.isEmpty()) { return this; } else { var front = relativePath.getFront(); var childTree = this.children.get(front); if (childTree !== null) { return childTree.subtree(relativePath.popFront()); } else { return ImmutableTree.Empty; } } }; /** * Sets a value at the specified path. * * @param {!Path} relativePath Path to set value at. * @param {?T} toSet Value to set. * @return {!ImmutableTree.} Resulting tree. */ ImmutableTree.prototype.set = function (relativePath, toSet) { if (relativePath.isEmpty()) { return new ImmutableTree(toSet, this.children); } else { var front = relativePath.getFront(); var child = this.children.get(front) || ImmutableTree.Empty; var newChild = child.set(relativePath.popFront(), toSet); var newChildren = this.children.insert(front, newChild); return new ImmutableTree(this.value, newChildren); } }; /** * Removes the value at the specified path. * * @param {!Path} relativePath Path to value to remove. * @return {!ImmutableTree.} Resulting tree. */ ImmutableTree.prototype.remove = function (relativePath) { if (relativePath.isEmpty()) { if (this.children.isEmpty()) { return ImmutableTree.Empty; } else { return new ImmutableTree(null, this.children); } } else { var front = relativePath.getFront(); var child = this.children.get(front); if (child) { var newChild = child.remove(relativePath.popFront()); var newChildren = void 0; if (newChild.isEmpty()) { newChildren = this.children.remove(front); } else { newChildren = this.children.insert(front, newChild); } if (this.value === null && newChildren.isEmpty()) { return ImmutableTree.Empty; } else { return new ImmutableTree(this.value, newChildren); } } else { return this; } } }; /** * Gets a value from the tree. * * @param {!Path} relativePath Path to get value for. * @return {?T} Value at path, or null. */ ImmutableTree.prototype.get = function (relativePath) { if (relativePath.isEmpty()) { return this.value; } else { var front = relativePath.getFront(); var child = this.children.get(front); if (child) { return child.get(relativePath.popFront()); } else { return null; } } }; /** * Replace the subtree at the specified path with the given new tree. * * @param {!Path} relativePath Path to replace subtree for. * @param {!ImmutableTree} newTree New tree. * @return {!ImmutableTree} Resulting tree. */ ImmutableTree.prototype.setTree = function (relativePath, newTree) { if (relativePath.isEmpty()) { return newTree; } else { var front = relativePath.getFront(); var child = this.children.get(front) || ImmutableTree.Empty; var newChild = child.setTree(relativePath.popFront(), newTree); var newChildren = void 0; if (newChild.isEmpty()) { newChildren = this.children.remove(front); } else { newChildren = this.children.insert(front, newChild); } return new ImmutableTree(this.value, newChildren); } }; /** * Performs a depth first fold on this tree. Transforms a tree into a single * value, given a function that operates on the path to a node, an optional * current value, and a map of child names to folded subtrees * @template V * @param {function(Path, ?T, Object.):V} fn * @return {V} */ ImmutableTree.prototype.fold = function (fn) { return this.fold_(Path.Empty, fn); }; /** * Recursive helper for public-facing fold() method * @template V * @param {!Path} pathSoFar * @param {function(Path, ?T, Object.):V} fn * @return {V} * @private */ ImmutableTree.prototype.fold_ = function (pathSoFar, fn) { var accum = {}; this.children.inorderTraversal(function (childKey, childTree) { accum[childKey] = childTree.fold_(pathSoFar.child(childKey), fn); }); return fn(pathSoFar, this.value, accum); }; /** * Find the first matching value on the given path. Return the result of applying f to it. * @template V * @param {!Path} path * @param {!function(!Path, !T):?V} f * @return {?V} */ ImmutableTree.prototype.findOnPath = function (path, f) { return this.findOnPath_(path, Path.Empty, f); }; ImmutableTree.prototype.findOnPath_ = function (pathToFollow, pathSoFar, f) { var result = this.value ? f(pathSoFar, this.value) : false; if (result) { return result; } else { if (pathToFollow.isEmpty()) { return null; } else { var front = pathToFollow.getFront(); var nextChild = this.children.get(front); if (nextChild) { return nextChild.findOnPath_(pathToFollow.popFront(), pathSoFar.child(front), f); } else { return null; } } } }; /** * * @param {!Path} path * @param {!function(!Path, !T)} f * @returns {!ImmutableTree.} */ ImmutableTree.prototype.foreachOnPath = function (path, f) { return this.foreachOnPath_(path, Path.Empty, f); }; ImmutableTree.prototype.foreachOnPath_ = function (pathToFollow, currentRelativePath, f) { if (pathToFollow.isEmpty()) { return this; } else { if (this.value) { f(currentRelativePath, this.value); } var front = pathToFollow.getFront(); var nextChild = this.children.get(front); if (nextChild) { return nextChild.foreachOnPath_(pathToFollow.popFront(), currentRelativePath.child(front), f); } else { return ImmutableTree.Empty; } } }; /** * Calls the given function for each node in the tree that has a value. * * @param {function(!Path, !T)} f A function to be called with * the path from the root of the tree to a node, and the value at that node. * Called in depth-first order. */ ImmutableTree.prototype.foreach = function (f) { this.foreach_(Path.Empty, f); }; ImmutableTree.prototype.foreach_ = function (currentRelativePath, f) { this.children.inorderTraversal(function (childName, childTree) { childTree.foreach_(currentRelativePath.child(childName), f); }); if (this.value) { f(currentRelativePath, this.value); } }; /** * * @param {function(string, !T)} f */ ImmutableTree.prototype.foreachChild = function (f) { this.children.inorderTraversal(function (childName, childTree) { if (childTree.value) { f(childName, childTree.value); } }); }; ImmutableTree.Empty = new ImmutableTree(null); return ImmutableTree; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @param {!OperationSource} source * @param {!Path} path * @constructor * @implements {Operation} */ var ListenComplete = /** @class */ (function () { function ListenComplete(source, path) { this.source = source; this.path = path; /** @inheritDoc */ this.type = OperationType.LISTEN_COMPLETE; } ListenComplete.prototype.operationForChild = function (childName) { if (this.path.isEmpty()) { return new ListenComplete(this.source, Path.Empty); } else { return new ListenComplete(this.source, this.path.popFront()); } }; return ListenComplete; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @param {!OperationSource} source * @param {!Path} path * @param {!Node} snap * @constructor * @implements {Operation} */ var Overwrite = /** @class */ (function () { function Overwrite(source, path, snap) { this.source = source; this.path = path; this.snap = snap; /** @inheritDoc */ this.type = OperationType.OVERWRITE; } Overwrite.prototype.operationForChild = function (childName) { if (this.path.isEmpty()) { return new Overwrite(this.source, Path.Empty, this.snap.getImmediateChild(childName)); } else { return new Overwrite(this.source, this.path.popFront(), this.snap); } }; return Overwrite; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @param {!OperationSource} source * @param {!Path} path * @param {!ImmutableTree.} children * @constructor * @implements {Operation} */ var Merge = /** @class */ (function () { function Merge( /**@inheritDoc */ source, /**@inheritDoc */ path, /**@inheritDoc */ children) { this.source = source; this.path = path; this.children = children; /** @inheritDoc */ this.type = OperationType.MERGE; } /** * @inheritDoc */ Merge.prototype.operationForChild = function (childName) { if (this.path.isEmpty()) { var childTree = this.children.subtree(new Path(childName)); if (childTree.isEmpty()) { // This child is unaffected return null; } else if (childTree.value) { // We have a snapshot for the child in question. This becomes an overwrite of the child. return new Overwrite(this.source, Path.Empty, childTree.value); } else { // This is a merge at a deeper level return new Merge(this.source, Path.Empty, childTree); } } else { util.assert(this.path.getFront() === childName, "Can't get a merge for a child not on the path of the operation"); return new Merge(this.source, this.path.popFront(), this.children); } }; /** * @inheritDoc */ Merge.prototype.toString = function () { return ('Operation(' + this.path + ': ' + this.source.toString() + ' merge: ' + this.children.toString() + ')'); }; return Merge; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * A cache node only stores complete children. Additionally it holds a flag whether the node can be considered fully * initialized in the sense that we know at one point in time this represented a valid state of the world, e.g. * initialized with data from the server, or a complete overwrite by the client. The filtered flag also tracks * whether a node potentially had children removed due to a filter. */ var CacheNode = /** @class */ (function () { /** * @param {!Node} node_ * @param {boolean} fullyInitialized_ * @param {boolean} filtered_ */ function CacheNode(node_, fullyInitialized_, filtered_) { this.node_ = node_; this.fullyInitialized_ = fullyInitialized_; this.filtered_ = filtered_; } /** * Returns whether this node was fully initialized with either server data or a complete overwrite by the client * @return {boolean} */ CacheNode.prototype.isFullyInitialized = function () { return this.fullyInitialized_; }; /** * Returns whether this node is potentially missing children due to a filter applied to the node * @return {boolean} */ CacheNode.prototype.isFiltered = function () { return this.filtered_; }; /** * @param {!Path} path * @return {boolean} */ CacheNode.prototype.isCompleteForPath = function (path) { if (path.isEmpty()) { return this.isFullyInitialized() && !this.filtered_; } var childKey = path.getFront(); return this.isCompleteForChild(childKey); }; /** * @param {!string} key * @return {boolean} */ CacheNode.prototype.isCompleteForChild = function (key) { return ((this.isFullyInitialized() && !this.filtered_) || this.node_.hasChild(key)); }; /** * @return {!Node} */ CacheNode.prototype.getNode = function () { return this.node_; }; return CacheNode; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Stores the data we have cached for a view. * * serverSnap is the cached server data, eventSnap is the cached event data (server data plus any local writes). * * @constructor */ var ViewCache = /** @class */ (function () { /** * * @param {!CacheNode} eventCache_ * @param {!CacheNode} serverCache_ */ function ViewCache(eventCache_, serverCache_) { this.eventCache_ = eventCache_; this.serverCache_ = serverCache_; } /** * @param {!Node} eventSnap * @param {boolean} complete * @param {boolean} filtered * @return {!ViewCache} */ ViewCache.prototype.updateEventSnap = function (eventSnap, complete, filtered) { return new ViewCache(new CacheNode(eventSnap, complete, filtered), this.serverCache_); }; /** * @param {!Node} serverSnap * @param {boolean} complete * @param {boolean} filtered * @return {!ViewCache} */ ViewCache.prototype.updateServerSnap = function (serverSnap, complete, filtered) { return new ViewCache(this.eventCache_, new CacheNode(serverSnap, complete, filtered)); }; /** * @return {!CacheNode} */ ViewCache.prototype.getEventCache = function () { return this.eventCache_; }; /** * @return {?Node} */ ViewCache.prototype.getCompleteEventSnap = function () { return this.eventCache_.isFullyInitialized() ? this.eventCache_.getNode() : null; }; /** * @return {!CacheNode} */ ViewCache.prototype.getServerCache = function () { return this.serverCache_; }; /** * @return {?Node} */ ViewCache.prototype.getCompleteServerSnap = function () { return this.serverCache_.isFullyInitialized() ? this.serverCache_.getNode() : null; }; /** * @const * @type {ViewCache} */ ViewCache.Empty = new ViewCache(new CacheNode(ChildrenNode.EMPTY_NODE, /*fullyInitialized=*/ false, /*filtered=*/ false), new CacheNode(ChildrenNode.EMPTY_NODE, /*fullyInitialized=*/ false, /*filtered=*/ false)); return ViewCache; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @constructor * @struct * @param {!string} type The event type * @param {!Node} snapshotNode The data * @param {string=} childName The name for this child, if it's a child event * @param {Node=} oldSnap Used for intermediate processing of child changed events * @param {string=} prevName The name for the previous child, if applicable */ var Change = /** @class */ (function () { function Change(type, snapshotNode, childName, oldSnap, prevName) { this.type = type; this.snapshotNode = snapshotNode; this.childName = childName; this.oldSnap = oldSnap; this.prevName = prevName; } /** * @param {!Node} snapshot * @return {!Change} */ Change.valueChange = function (snapshot) { return new Change(Change.VALUE, snapshot); }; /** * @param {string} childKey * @param {!Node} snapshot * @return {!Change} */ Change.childAddedChange = function (childKey, snapshot) { return new Change(Change.CHILD_ADDED, snapshot, childKey); }; /** * @param {string} childKey * @param {!Node} snapshot * @return {!Change} */ Change.childRemovedChange = function (childKey, snapshot) { return new Change(Change.CHILD_REMOVED, snapshot, childKey); }; /** * @param {string} childKey * @param {!Node} newSnapshot * @param {!Node} oldSnapshot * @return {!Change} */ Change.childChangedChange = function (childKey, newSnapshot, oldSnapshot) { return new Change(Change.CHILD_CHANGED, newSnapshot, childKey, oldSnapshot); }; /** * @param {string} childKey * @param {!Node} snapshot * @return {!Change} */ Change.childMovedChange = function (childKey, snapshot) { return new Change(Change.CHILD_MOVED, snapshot, childKey); }; //event types /** Event type for a child added */ Change.CHILD_ADDED = 'child_added'; /** Event type for a child removed */ Change.CHILD_REMOVED = 'child_removed'; /** Event type for a child changed */ Change.CHILD_CHANGED = 'child_changed'; /** Event type for a child moved */ Change.CHILD_MOVED = 'child_moved'; /** Event type for a value change */ Change.VALUE = 'value'; return Change; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Doesn't really filter nodes but applies an index to the node and keeps track of any changes * * @constructor * @implements {NodeFilter} * @param {!Index} index */ var IndexedFilter = /** @class */ (function () { function IndexedFilter(index_) { this.index_ = index_; } IndexedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) { util.assert(snap.isIndexed(this.index_), 'A node must be indexed if only a child is updated'); var oldChild = snap.getImmediateChild(key); // Check if anything actually changed. if (oldChild.getChild(affectedPath).equals(newChild.getChild(affectedPath))) { // There's an edge case where a child can enter or leave the view because affectedPath was set to null. // In this case, affectedPath will appear null in both the old and new snapshots. So we need // to avoid treating these cases as "nothing changed." if (oldChild.isEmpty() == newChild.isEmpty()) { // Nothing changed. // This assert should be valid, but it's expensive (can dominate perf testing) so don't actually do it. //assert(oldChild.equals(newChild), 'Old and new snapshots should be equal.'); return snap; } } if (optChangeAccumulator != null) { if (newChild.isEmpty()) { if (snap.hasChild(key)) { optChangeAccumulator.trackChildChange(Change.childRemovedChange(key, oldChild)); } else { util.assert(snap.isLeafNode(), 'A child remove without an old child only makes sense on a leaf node'); } } else if (oldChild.isEmpty()) { optChangeAccumulator.trackChildChange(Change.childAddedChange(key, newChild)); } else { optChangeAccumulator.trackChildChange(Change.childChangedChange(key, newChild, oldChild)); } } if (snap.isLeafNode() && newChild.isEmpty()) { return snap; } else { // Make sure the node is indexed return snap.updateImmediateChild(key, newChild).withIndex(this.index_); } }; /** * @inheritDoc */ IndexedFilter.prototype.updateFullNode = function (oldSnap, newSnap, optChangeAccumulator) { if (optChangeAccumulator != null) { if (!oldSnap.isLeafNode()) { oldSnap.forEachChild(PRIORITY_INDEX, function (key, childNode) { if (!newSnap.hasChild(key)) { optChangeAccumulator.trackChildChange(Change.childRemovedChange(key, childNode)); } }); } if (!newSnap.isLeafNode()) { newSnap.forEachChild(PRIORITY_INDEX, function (key, childNode) { if (oldSnap.hasChild(key)) { var oldChild = oldSnap.getImmediateChild(key); if (!oldChild.equals(childNode)) { optChangeAccumulator.trackChildChange(Change.childChangedChange(key, childNode, oldChild)); } } else { optChangeAccumulator.trackChildChange(Change.childAddedChange(key, childNode)); } }); } } return newSnap.withIndex(this.index_); }; /** * @inheritDoc */ IndexedFilter.prototype.updatePriority = function (oldSnap, newPriority) { if (oldSnap.isEmpty()) { return ChildrenNode.EMPTY_NODE; } else { return oldSnap.updatePriority(newPriority); } }; /** * @inheritDoc */ IndexedFilter.prototype.filtersNodes = function () { return false; }; /** * @inheritDoc */ IndexedFilter.prototype.getIndexedFilter = function () { return this; }; /** * @inheritDoc */ IndexedFilter.prototype.getIndex = function () { return this.index_; }; return IndexedFilter; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @constructor */ var ChildChangeAccumulator = /** @class */ (function () { function ChildChangeAccumulator() { this.changeMap_ = {}; } /** * @param {!Change} change */ ChildChangeAccumulator.prototype.trackChildChange = function (change) { var type = change.type; var childKey /** @type {!string} */ = change.childName; util.assert(type == Change.CHILD_ADDED || type == Change.CHILD_CHANGED || type == Change.CHILD_REMOVED, 'Only child changes supported for tracking'); util.assert(childKey !== '.priority', 'Only non-priority child changes can be tracked.'); var oldChange = util.safeGet(this.changeMap_, childKey); if (oldChange) { var oldType = oldChange.type; if (type == Change.CHILD_ADDED && oldType == Change.CHILD_REMOVED) { this.changeMap_[childKey] = Change.childChangedChange(childKey, change.snapshotNode, oldChange.snapshotNode); } else if (type == Change.CHILD_REMOVED && oldType == Change.CHILD_ADDED) { delete this.changeMap_[childKey]; } else if (type == Change.CHILD_REMOVED && oldType == Change.CHILD_CHANGED) { this.changeMap_[childKey] = Change.childRemovedChange(childKey, oldChange.oldSnap); } else if (type == Change.CHILD_CHANGED && oldType == Change.CHILD_ADDED) { this.changeMap_[childKey] = Change.childAddedChange(childKey, change.snapshotNode); } else if (type == Change.CHILD_CHANGED && oldType == Change.CHILD_CHANGED) { this.changeMap_[childKey] = Change.childChangedChange(childKey, change.snapshotNode, oldChange.oldSnap); } else { throw util.assertionError('Illegal combination of changes: ' + change + ' occurred after ' + oldChange); } } else { this.changeMap_[childKey] = change; } }; /** * @return {!Array.} */ ChildChangeAccumulator.prototype.getChanges = function () { return util.getValues(this.changeMap_); }; return ChildChangeAccumulator; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * An implementation of CompleteChildSource that never returns any additional children * * @private * @constructor * @implements CompleteChildSource */ var NoCompleteChildSource_ = /** @class */ (function () { function NoCompleteChildSource_() { } /** * @inheritDoc */ NoCompleteChildSource_.prototype.getCompleteChild = function (childKey) { return null; }; /** * @inheritDoc */ NoCompleteChildSource_.prototype.getChildAfterChild = function (index, child, reverse) { return null; }; return NoCompleteChildSource_; }()); /** * Singleton instance. * @const * @type {!CompleteChildSource} */ var NO_COMPLETE_CHILD_SOURCE = new NoCompleteChildSource_(); /** * An implementation of CompleteChildSource that uses a WriteTree in addition to any other server data or * old event caches available to calculate complete children. * * * @implements CompleteChildSource */ var WriteTreeCompleteChildSource = /** @class */ (function () { /** * @param {!WriteTreeRef} writes_ * @param {!ViewCache} viewCache_ * @param {?Node} optCompleteServerCache_ */ function WriteTreeCompleteChildSource(writes_, viewCache_, optCompleteServerCache_) { if (optCompleteServerCache_ === void 0) { optCompleteServerCache_ = null; } this.writes_ = writes_; this.viewCache_ = viewCache_; this.optCompleteServerCache_ = optCompleteServerCache_; } /** * @inheritDoc */ WriteTreeCompleteChildSource.prototype.getCompleteChild = function (childKey) { var node = this.viewCache_.getEventCache(); if (node.isCompleteForChild(childKey)) { return node.getNode().getImmediateChild(childKey); } else { var serverNode = this.optCompleteServerCache_ != null ? new CacheNode(this.optCompleteServerCache_, true, false) : this.viewCache_.getServerCache(); return this.writes_.calcCompleteChild(childKey, serverNode); } }; /** * @inheritDoc */ WriteTreeCompleteChildSource.prototype.getChildAfterChild = function (index, child, reverse) { var completeServerData = this.optCompleteServerCache_ != null ? this.optCompleteServerCache_ : this.viewCache_.getCompleteServerSnap(); var nodes = this.writes_.calcIndexedSlice(completeServerData, child, 1, reverse, index); if (nodes.length === 0) { return null; } else { return nodes[0]; } }; return WriteTreeCompleteChildSource; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @constructor * @struct */ var ProcessorResult = /** @class */ (function () { /** * @param {!ViewCache} viewCache * @param {!Array.} changes */ function ProcessorResult(viewCache, changes) { this.viewCache = viewCache; this.changes = changes; } return ProcessorResult; }()); /** * @constructor */ var ViewProcessor = /** @class */ (function () { /** * @param {!NodeFilter} filter_ */ function ViewProcessor(filter_) { this.filter_ = filter_; } /** * @param {!ViewCache} viewCache */ ViewProcessor.prototype.assertIndexed = function (viewCache) { util.assert(viewCache .getEventCache() .getNode() .isIndexed(this.filter_.getIndex()), 'Event snap not indexed'); util.assert(viewCache .getServerCache() .getNode() .isIndexed(this.filter_.getIndex()), 'Server snap not indexed'); }; /** * @param {!ViewCache} oldViewCache * @param {!Operation} operation * @param {!WriteTreeRef} writesCache * @param {?Node} completeCache * @return {!ProcessorResult} */ ViewProcessor.prototype.applyOperation = function (oldViewCache, operation, writesCache, completeCache) { var accumulator = new ChildChangeAccumulator(); var newViewCache, filterServerNode; if (operation.type === OperationType.OVERWRITE) { var overwrite = operation; if (overwrite.source.fromUser) { newViewCache = this.applyUserOverwrite_(oldViewCache, overwrite.path, overwrite.snap, writesCache, completeCache, accumulator); } else { util.assert(overwrite.source.fromServer, 'Unknown source.'); // We filter the node if it's a tagged update or the node has been previously filtered and the // update is not at the root in which case it is ok (and necessary) to mark the node unfiltered // again filterServerNode = overwrite.source.tagged || (oldViewCache.getServerCache().isFiltered() && !overwrite.path.isEmpty()); newViewCache = this.applyServerOverwrite_(oldViewCache, overwrite.path, overwrite.snap, writesCache, completeCache, filterServerNode, accumulator); } } else if (operation.type === OperationType.MERGE) { var merge = operation; if (merge.source.fromUser) { newViewCache = this.applyUserMerge_(oldViewCache, merge.path, merge.children, writesCache, completeCache, accumulator); } else { util.assert(merge.source.fromServer, 'Unknown source.'); // We filter the node if it's a tagged update or the node has been previously filtered filterServerNode = merge.source.tagged || oldViewCache.getServerCache().isFiltered(); newViewCache = this.applyServerMerge_(oldViewCache, merge.path, merge.children, writesCache, completeCache, filterServerNode, accumulator); } } else if (operation.type === OperationType.ACK_USER_WRITE) { var ackUserWrite = operation; if (!ackUserWrite.revert) { newViewCache = this.ackUserWrite_(oldViewCache, ackUserWrite.path, ackUserWrite.affectedTree, writesCache, completeCache, accumulator); } else { newViewCache = this.revertUserWrite_(oldViewCache, ackUserWrite.path, writesCache, completeCache, accumulator); } } else if (operation.type === OperationType.LISTEN_COMPLETE) { newViewCache = this.listenComplete_(oldViewCache, operation.path, writesCache, accumulator); } else { throw util.assertionError('Unknown operation type: ' + operation.type); } var changes = accumulator.getChanges(); ViewProcessor.maybeAddValueEvent_(oldViewCache, newViewCache, changes); return new ProcessorResult(newViewCache, changes); }; /** * @param {!ViewCache} oldViewCache * @param {!ViewCache} newViewCache * @param {!Array.} accumulator * @private */ ViewProcessor.maybeAddValueEvent_ = function (oldViewCache, newViewCache, accumulator) { var eventSnap = newViewCache.getEventCache(); if (eventSnap.isFullyInitialized()) { var isLeafOrEmpty = eventSnap.getNode().isLeafNode() || eventSnap.getNode().isEmpty(); var oldCompleteSnap = oldViewCache.getCompleteEventSnap(); if (accumulator.length > 0 || !oldViewCache.getEventCache().isFullyInitialized() || (isLeafOrEmpty && !eventSnap .getNode() .equals(/** @type {!Node} */ (oldCompleteSnap))) || !eventSnap .getNode() .getPriority() .equals(oldCompleteSnap.getPriority())) { accumulator.push(Change.valueChange( /** @type {!Node} */ newViewCache.getCompleteEventSnap())); } } }; /** * @param {!ViewCache} viewCache * @param {!Path} changePath * @param {!WriteTreeRef} writesCache * @param {!CompleteChildSource} source * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.generateEventCacheAfterServerEvent_ = function (viewCache, changePath, writesCache, source, accumulator) { var oldEventSnap = viewCache.getEventCache(); if (writesCache.shadowingWrite(changePath) != null) { // we have a shadowing write, ignore changes return viewCache; } else { var newEventCache = void 0, serverNode = void 0; if (changePath.isEmpty()) { // TODO: figure out how this plays with "sliding ack windows" util.assert(viewCache.getServerCache().isFullyInitialized(), 'If change path is empty, we must have complete server data'); if (viewCache.getServerCache().isFiltered()) { // We need to special case this, because we need to only apply writes to complete children, or // we might end up raising events for incomplete children. If the server data is filtered deep // writes cannot be guaranteed to be complete var serverCache = viewCache.getCompleteServerSnap(); var completeChildren = serverCache instanceof ChildrenNode ? serverCache : ChildrenNode.EMPTY_NODE; var completeEventChildren = writesCache.calcCompleteEventChildren(completeChildren); newEventCache = this.filter_.updateFullNode(viewCache.getEventCache().getNode(), completeEventChildren, accumulator); } else { var completeNode = writesCache.calcCompleteEventCache(viewCache.getCompleteServerSnap()); newEventCache = this.filter_.updateFullNode(viewCache.getEventCache().getNode(), completeNode, accumulator); } } else { var childKey = changePath.getFront(); if (childKey == '.priority') { util.assert(changePath.getLength() == 1, "Can't have a priority with additional path components"); var oldEventNode = oldEventSnap.getNode(); serverNode = viewCache.getServerCache().getNode(); // we might have overwrites for this priority var updatedPriority = writesCache.calcEventCacheAfterServerOverwrite(changePath, oldEventNode, serverNode); if (updatedPriority != null) { newEventCache = this.filter_.updatePriority(oldEventNode, updatedPriority); } else { // priority didn't change, keep old node newEventCache = oldEventSnap.getNode(); } } else { var childChangePath = changePath.popFront(); // update child var newEventChild = void 0; if (oldEventSnap.isCompleteForChild(childKey)) { serverNode = viewCache.getServerCache().getNode(); var eventChildUpdate = writesCache.calcEventCacheAfterServerOverwrite(changePath, oldEventSnap.getNode(), serverNode); if (eventChildUpdate != null) { newEventChild = oldEventSnap .getNode() .getImmediateChild(childKey) .updateChild(childChangePath, eventChildUpdate); } else { // Nothing changed, just keep the old child newEventChild = oldEventSnap .getNode() .getImmediateChild(childKey); } } else { newEventChild = writesCache.calcCompleteChild(childKey, viewCache.getServerCache()); } if (newEventChild != null) { newEventCache = this.filter_.updateChild(oldEventSnap.getNode(), childKey, newEventChild, childChangePath, source, accumulator); } else { // no complete child available or no change newEventCache = oldEventSnap.getNode(); } } } return viewCache.updateEventSnap(newEventCache, oldEventSnap.isFullyInitialized() || changePath.isEmpty(), this.filter_.filtersNodes()); } }; /** * @param {!ViewCache} oldViewCache * @param {!Path} changePath * @param {!Node} changedSnap * @param {!WriteTreeRef} writesCache * @param {?Node} completeCache * @param {boolean} filterServerNode * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.applyServerOverwrite_ = function (oldViewCache, changePath, changedSnap, writesCache, completeCache, filterServerNode, accumulator) { var oldServerSnap = oldViewCache.getServerCache(); var newServerCache; var serverFilter = filterServerNode ? this.filter_ : this.filter_.getIndexedFilter(); if (changePath.isEmpty()) { newServerCache = serverFilter.updateFullNode(oldServerSnap.getNode(), changedSnap, null); } else if (serverFilter.filtersNodes() && !oldServerSnap.isFiltered()) { // we want to filter the server node, but we didn't filter the server node yet, so simulate a full update var newServerNode = oldServerSnap .getNode() .updateChild(changePath, changedSnap); newServerCache = serverFilter.updateFullNode(oldServerSnap.getNode(), newServerNode, null); } else { var childKey = changePath.getFront(); if (!oldServerSnap.isCompleteForPath(changePath) && changePath.getLength() > 1) { // We don't update incomplete nodes with updates intended for other listeners return oldViewCache; } var childChangePath = changePath.popFront(); var childNode = oldServerSnap.getNode().getImmediateChild(childKey); var newChildNode = childNode.updateChild(childChangePath, changedSnap); if (childKey == '.priority') { newServerCache = serverFilter.updatePriority(oldServerSnap.getNode(), newChildNode); } else { newServerCache = serverFilter.updateChild(oldServerSnap.getNode(), childKey, newChildNode, childChangePath, NO_COMPLETE_CHILD_SOURCE, null); } } var newViewCache = oldViewCache.updateServerSnap(newServerCache, oldServerSnap.isFullyInitialized() || changePath.isEmpty(), serverFilter.filtersNodes()); var source = new WriteTreeCompleteChildSource(writesCache, newViewCache, completeCache); return this.generateEventCacheAfterServerEvent_(newViewCache, changePath, writesCache, source, accumulator); }; /** * @param {!ViewCache} oldViewCache * @param {!Path} changePath * @param {!Node} changedSnap * @param {!WriteTreeRef} writesCache * @param {?Node} completeCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.applyUserOverwrite_ = function (oldViewCache, changePath, changedSnap, writesCache, completeCache, accumulator) { var oldEventSnap = oldViewCache.getEventCache(); var newViewCache, newEventCache; var source = new WriteTreeCompleteChildSource(writesCache, oldViewCache, completeCache); if (changePath.isEmpty()) { newEventCache = this.filter_.updateFullNode(oldViewCache.getEventCache().getNode(), changedSnap, accumulator); newViewCache = oldViewCache.updateEventSnap(newEventCache, true, this.filter_.filtersNodes()); } else { var childKey = changePath.getFront(); if (childKey === '.priority') { newEventCache = this.filter_.updatePriority(oldViewCache.getEventCache().getNode(), changedSnap); newViewCache = oldViewCache.updateEventSnap(newEventCache, oldEventSnap.isFullyInitialized(), oldEventSnap.isFiltered()); } else { var childChangePath = changePath.popFront(); var oldChild = oldEventSnap.getNode().getImmediateChild(childKey); var newChild = void 0; if (childChangePath.isEmpty()) { // Child overwrite, we can replace the child newChild = changedSnap; } else { var childNode = source.getCompleteChild(childKey); if (childNode != null) { if (childChangePath.getBack() === '.priority' && childNode.getChild(childChangePath.parent()).isEmpty()) { // This is a priority update on an empty node. If this node exists on the server, the // server will send down the priority in the update, so ignore for now newChild = childNode; } else { newChild = childNode.updateChild(childChangePath, changedSnap); } } else { // There is no complete child node available newChild = ChildrenNode.EMPTY_NODE; } } if (!oldChild.equals(newChild)) { var newEventSnap = this.filter_.updateChild(oldEventSnap.getNode(), childKey, newChild, childChangePath, source, accumulator); newViewCache = oldViewCache.updateEventSnap(newEventSnap, oldEventSnap.isFullyInitialized(), this.filter_.filtersNodes()); } else { newViewCache = oldViewCache; } } } return newViewCache; }; /** * @param {!ViewCache} viewCache * @param {string} childKey * @return {boolean} * @private */ ViewProcessor.cacheHasChild_ = function (viewCache, childKey) { return viewCache.getEventCache().isCompleteForChild(childKey); }; /** * @param {!ViewCache} viewCache * @param {!Path} path * @param {ImmutableTree.} changedChildren * @param {!WriteTreeRef} writesCache * @param {?Node} serverCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.applyUserMerge_ = function (viewCache, path, changedChildren, writesCache, serverCache, accumulator) { var _this = this; // HACK: In the case of a limit query, there may be some changes that bump things out of the // window leaving room for new items. It's important we process these changes first, so we // iterate the changes twice, first processing any that affect items currently in view. // TODO: I consider an item "in view" if cacheHasChild is true, which checks both the server // and event snap. I'm not sure if this will result in edge cases when a child is in one but // not the other. var curViewCache = viewCache; changedChildren.foreach(function (relativePath, childNode) { var writePath = path.child(relativePath); if (ViewProcessor.cacheHasChild_(viewCache, writePath.getFront())) { curViewCache = _this.applyUserOverwrite_(curViewCache, writePath, childNode, writesCache, serverCache, accumulator); } }); changedChildren.foreach(function (relativePath, childNode) { var writePath = path.child(relativePath); if (!ViewProcessor.cacheHasChild_(viewCache, writePath.getFront())) { curViewCache = _this.applyUserOverwrite_(curViewCache, writePath, childNode, writesCache, serverCache, accumulator); } }); return curViewCache; }; /** * @param {!Node} node * @param {ImmutableTree.} merge * @return {!Node} * @private */ ViewProcessor.prototype.applyMerge_ = function (node, merge) { merge.foreach(function (relativePath, childNode) { node = node.updateChild(relativePath, childNode); }); return node; }; /** * @param {!ViewCache} viewCache * @param {!Path} path * @param {!ImmutableTree.} changedChildren * @param {!WriteTreeRef} writesCache * @param {?Node} serverCache * @param {boolean} filterServerNode * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.applyServerMerge_ = function (viewCache, path, changedChildren, writesCache, serverCache, filterServerNode, accumulator) { var _this = this; // If we don't have a cache yet, this merge was intended for a previously listen in the same location. Ignore it and // wait for the complete data update coming soon. if (viewCache .getServerCache() .getNode() .isEmpty() && !viewCache.getServerCache().isFullyInitialized()) { return viewCache; } // HACK: In the case of a limit query, there may be some changes that bump things out of the // window leaving room for new items. It's important we process these changes first, so we // iterate the changes twice, first processing any that affect items currently in view. // TODO: I consider an item "in view" if cacheHasChild is true, which checks both the server // and event snap. I'm not sure if this will result in edge cases when a child is in one but // not the other. var curViewCache = viewCache; var viewMergeTree; if (path.isEmpty()) { viewMergeTree = changedChildren; } else { viewMergeTree = ImmutableTree.Empty.setTree(path, changedChildren); } var serverNode = viewCache.getServerCache().getNode(); viewMergeTree.children.inorderTraversal(function (childKey, childTree) { if (serverNode.hasChild(childKey)) { var serverChild = viewCache .getServerCache() .getNode() .getImmediateChild(childKey); var newChild = _this.applyMerge_(serverChild, childTree); curViewCache = _this.applyServerOverwrite_(curViewCache, new Path(childKey), newChild, writesCache, serverCache, filterServerNode, accumulator); } }); viewMergeTree.children.inorderTraversal(function (childKey, childMergeTree) { var isUnknownDeepMerge = !viewCache.getServerCache().isCompleteForChild(childKey) && childMergeTree.value == null; if (!serverNode.hasChild(childKey) && !isUnknownDeepMerge) { var serverChild = viewCache .getServerCache() .getNode() .getImmediateChild(childKey); var newChild = _this.applyMerge_(serverChild, childMergeTree); curViewCache = _this.applyServerOverwrite_(curViewCache, new Path(childKey), newChild, writesCache, serverCache, filterServerNode, accumulator); } }); return curViewCache; }; /** * @param {!ViewCache} viewCache * @param {!Path} ackPath * @param {!ImmutableTree} affectedTree * @param {!WriteTreeRef} writesCache * @param {?Node} completeCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.ackUserWrite_ = function (viewCache, ackPath, affectedTree, writesCache, completeCache, accumulator) { if (writesCache.shadowingWrite(ackPath) != null) { return viewCache; } // Only filter server node if it is currently filtered var filterServerNode = viewCache.getServerCache().isFiltered(); // Essentially we'll just get our existing server cache for the affected paths and re-apply it as a server update // now that it won't be shadowed. var serverCache = viewCache.getServerCache(); if (affectedTree.value != null) { // This is an overwrite. if ((ackPath.isEmpty() && serverCache.isFullyInitialized()) || serverCache.isCompleteForPath(ackPath)) { return this.applyServerOverwrite_(viewCache, ackPath, serverCache.getNode().getChild(ackPath), writesCache, completeCache, filterServerNode, accumulator); } else if (ackPath.isEmpty()) { // This is a goofy edge case where we are acking data at this location but don't have full data. We // should just re-apply whatever we have in our cache as a merge. var changedChildren_1 = ImmutableTree.Empty; serverCache.getNode().forEachChild(KEY_INDEX, function (name, node) { changedChildren_1 = changedChildren_1.set(new Path(name), node); }); return this.applyServerMerge_(viewCache, ackPath, changedChildren_1, writesCache, completeCache, filterServerNode, accumulator); } else { return viewCache; } } else { // This is a merge. var changedChildren_2 = ImmutableTree.Empty; affectedTree.foreach(function (mergePath, value) { var serverCachePath = ackPath.child(mergePath); if (serverCache.isCompleteForPath(serverCachePath)) { changedChildren_2 = changedChildren_2.set(mergePath, serverCache.getNode().getChild(serverCachePath)); } }); return this.applyServerMerge_(viewCache, ackPath, changedChildren_2, writesCache, completeCache, filterServerNode, accumulator); } }; /** * @param {!ViewCache} viewCache * @param {!Path} path * @param {!WriteTreeRef} writesCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.listenComplete_ = function (viewCache, path, writesCache, accumulator) { var oldServerNode = viewCache.getServerCache(); var newViewCache = viewCache.updateServerSnap(oldServerNode.getNode(), oldServerNode.isFullyInitialized() || path.isEmpty(), oldServerNode.isFiltered()); return this.generateEventCacheAfterServerEvent_(newViewCache, path, writesCache, NO_COMPLETE_CHILD_SOURCE, accumulator); }; /** * @param {!ViewCache} viewCache * @param {!Path} path * @param {!WriteTreeRef} writesCache * @param {?Node} completeServerCache * @param {!ChildChangeAccumulator} accumulator * @return {!ViewCache} * @private */ ViewProcessor.prototype.revertUserWrite_ = function (viewCache, path, writesCache, completeServerCache, accumulator) { var complete; if (writesCache.shadowingWrite(path) != null) { return viewCache; } else { var source = new WriteTreeCompleteChildSource(writesCache, viewCache, completeServerCache); var oldEventCache = viewCache.getEventCache().getNode(); var newEventCache = void 0; if (path.isEmpty() || path.getFront() === '.priority') { var newNode = void 0; if (viewCache.getServerCache().isFullyInitialized()) { newNode = writesCache.calcCompleteEventCache(viewCache.getCompleteServerSnap()); } else { var serverChildren = viewCache.getServerCache().getNode(); util.assert(serverChildren instanceof ChildrenNode, 'serverChildren would be complete if leaf node'); newNode = writesCache.calcCompleteEventChildren(serverChildren); } newNode = newNode; newEventCache = this.filter_.updateFullNode(oldEventCache, newNode, accumulator); } else { var childKey = path.getFront(); var newChild = writesCache.calcCompleteChild(childKey, viewCache.getServerCache()); if (newChild == null && viewCache.getServerCache().isCompleteForChild(childKey)) { newChild = oldEventCache.getImmediateChild(childKey); } if (newChild != null) { newEventCache = this.filter_.updateChild(oldEventCache, childKey, newChild, path.popFront(), source, accumulator); } else if (viewCache .getEventCache() .getNode() .hasChild(childKey)) { // No complete child available, delete the existing one, if any newEventCache = this.filter_.updateChild(oldEventCache, childKey, ChildrenNode.EMPTY_NODE, path.popFront(), source, accumulator); } else { newEventCache = oldEventCache; } if (newEventCache.isEmpty() && viewCache.getServerCache().isFullyInitialized()) { // We might have reverted all child writes. Maybe the old event was a leaf node complete = writesCache.calcCompleteEventCache(viewCache.getCompleteServerSnap()); if (complete.isLeafNode()) { newEventCache = this.filter_.updateFullNode(newEventCache, complete, accumulator); } } } complete = viewCache.getServerCache().isFullyInitialized() || writesCache.shadowingWrite(Path.Empty) != null; return viewCache.updateEventSnap(newEventCache, complete, this.filter_.filtersNodes()); } }; return ViewProcessor; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * An EventGenerator is used to convert "raw" changes (Change) as computed by the * CacheDiffer into actual events (Event) that can be raised. See generateEventsForChanges() * for details. * * @constructor */ var EventGenerator = /** @class */ (function () { /** * * @param {!Query} query_ */ function EventGenerator(query_) { this.query_ = query_; /** * @private * @type {!Index} */ this.index_ = this.query_.getQueryParams().getIndex(); } /** * Given a set of raw changes (no moved events and prevName not specified yet), and a set of * EventRegistrations that should be notified of these changes, generate the actual events to be raised. * * Notes: * - child_moved events will be synthesized at this time for any child_changed events that affect * our index. * - prevName will be calculated based on the index ordering. * * @param {!Array.} changes * @param {!Node} eventCache * @param {!Array.} eventRegistrations * @return {!Array.} */ EventGenerator.prototype.generateEventsForChanges = function (changes, eventCache, eventRegistrations) { var _this = this; var events = []; var moves = []; changes.forEach(function (change) { if (change.type === Change.CHILD_CHANGED && _this.index_.indexedValueChanged(change.oldSnap, change.snapshotNode)) { moves.push(Change.childMovedChange(change.childName, change.snapshotNode)); } }); this.generateEventsForType_(events, Change.CHILD_REMOVED, changes, eventRegistrations, eventCache); this.generateEventsForType_(events, Change.CHILD_ADDED, changes, eventRegistrations, eventCache); this.generateEventsForType_(events, Change.CHILD_MOVED, moves, eventRegistrations, eventCache); this.generateEventsForType_(events, Change.CHILD_CHANGED, changes, eventRegistrations, eventCache); this.generateEventsForType_(events, Change.VALUE, changes, eventRegistrations, eventCache); return events; }; /** * Given changes of a single change type, generate the corresponding events. * * @param {!Array.} events * @param {!string} eventType * @param {!Array.} changes * @param {!Array.} registrations * @param {!Node} eventCache * @private */ EventGenerator.prototype.generateEventsForType_ = function (events, eventType, changes, registrations, eventCache) { var _this = this; var filteredChanges = changes.filter(function (change) { return change.type === eventType; }); filteredChanges.sort(this.compareChanges_.bind(this)); filteredChanges.forEach(function (change) { var materializedChange = _this.materializeSingleChange_(change, eventCache); registrations.forEach(function (registration) { if (registration.respondsTo(change.type)) { events.push(registration.createEvent(materializedChange, _this.query_)); } }); }); }; /** * @param {!Change} change * @param {!Node} eventCache * @return {!Change} * @private */ EventGenerator.prototype.materializeSingleChange_ = function (change, eventCache) { if (change.type === 'value' || change.type === 'child_removed') { return change; } else { change.prevName = eventCache.getPredecessorChildName( /** @type {!string} */ change.childName, change.snapshotNode, this.index_); return change; } }; /** * @param {!Change} a * @param {!Change} b * @return {number} * @private */ EventGenerator.prototype.compareChanges_ = function (a, b) { if (a.childName == null || b.childName == null) { throw util.assertionError('Should only compare child_ events.'); } var aWrapped = new NamedNode(a.childName, a.snapshotNode); var bWrapped = new NamedNode(b.childName, b.snapshotNode); return this.index_.compare(aWrapped, bWrapped); }; return EventGenerator; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * A view represents a specific location and query that has 1 or more event registrations. * * It does several things: * - Maintains the list of event registrations for this location/query. * - Maintains a cache of the data visible for this location/query. * - Applies new operations (via applyOperation), updates the cache, and based on the event * registrations returns the set of events to be raised. * @constructor */ var View = /** @class */ (function () { /** * * @param {!Query} query_ * @param {!ViewCache} initialViewCache */ function View(query_, initialViewCache) { this.query_ = query_; this.eventRegistrations_ = []; var params = this.query_.getQueryParams(); var indexFilter = new IndexedFilter(params.getIndex()); var filter = params.getNodeFilter(); /** * @type {ViewProcessor} * @private */ this.processor_ = new ViewProcessor(filter); var initialServerCache = initialViewCache.getServerCache(); var initialEventCache = initialViewCache.getEventCache(); // Don't filter server node with other filter than index, wait for tagged listen var serverSnap = indexFilter.updateFullNode(ChildrenNode.EMPTY_NODE, initialServerCache.getNode(), null); var eventSnap = filter.updateFullNode(ChildrenNode.EMPTY_NODE, initialEventCache.getNode(), null); var newServerCache = new CacheNode(serverSnap, initialServerCache.isFullyInitialized(), indexFilter.filtersNodes()); var newEventCache = new CacheNode(eventSnap, initialEventCache.isFullyInitialized(), filter.filtersNodes()); /** * @type {!ViewCache} * @private */ this.viewCache_ = new ViewCache(newEventCache, newServerCache); /** * @type {!EventGenerator} * @private */ this.eventGenerator_ = new EventGenerator(this.query_); } /** * @return {!Query} */ View.prototype.getQuery = function () { return this.query_; }; /** * @return {?Node} */ View.prototype.getServerCache = function () { return this.viewCache_.getServerCache().getNode(); }; /** * @param {!Path} path * @return {?Node} */ View.prototype.getCompleteServerCache = function (path) { var cache = this.viewCache_.getCompleteServerSnap(); if (cache) { // If this isn't a "loadsAllData" view, then cache isn't actually a complete cache and // we need to see if it contains the child we're interested in. if (this.query_.getQueryParams().loadsAllData() || (!path.isEmpty() && !cache.getImmediateChild(path.getFront()).isEmpty())) { return cache.getChild(path); } } return null; }; /** * @return {boolean} */ View.prototype.isEmpty = function () { return this.eventRegistrations_.length === 0; }; /** * @param {!EventRegistration} eventRegistration */ View.prototype.addEventRegistration = function (eventRegistration) { this.eventRegistrations_.push(eventRegistration); }; /** * @param {?EventRegistration} eventRegistration If null, remove all callbacks. * @param {Error=} cancelError If a cancelError is provided, appropriate cancel events will be returned. * @return {!Array.} Cancel events, if cancelError was provided. */ View.prototype.removeEventRegistration = function (eventRegistration, cancelError) { var cancelEvents = []; if (cancelError) { util.assert(eventRegistration == null, 'A cancel should cancel all event registrations.'); var path_1 = this.query_.path; this.eventRegistrations_.forEach(function (registration) { cancelError /** @type {!Error} */ = cancelError; var maybeEvent = registration.createCancelEvent(cancelError, path_1); if (maybeEvent) { cancelEvents.push(maybeEvent); } }); } if (eventRegistration) { var remaining = []; for (var i = 0; i < this.eventRegistrations_.length; ++i) { var existing = this.eventRegistrations_[i]; if (!existing.matches(eventRegistration)) { remaining.push(existing); } else if (eventRegistration.hasAnyCallback()) { // We're removing just this one remaining = remaining.concat(this.eventRegistrations_.slice(i + 1)); break; } } this.eventRegistrations_ = remaining; } else { this.eventRegistrations_ = []; } return cancelEvents; }; /** * Applies the given Operation, updates our cache, and returns the appropriate events. * * @param {!Operation} operation * @param {!WriteTreeRef} writesCache * @param {?Node} completeServerCache * @return {!Array.} */ View.prototype.applyOperation = function (operation, writesCache, completeServerCache) { if (operation.type === OperationType.MERGE && operation.source.queryId !== null) { util.assert(this.viewCache_.getCompleteServerSnap(), 'We should always have a full cache before handling merges'); util.assert(this.viewCache_.getCompleteEventSnap(), 'Missing event cache, even though we have a server cache'); } var oldViewCache = this.viewCache_; var result = this.processor_.applyOperation(oldViewCache, operation, writesCache, completeServerCache); this.processor_.assertIndexed(result.viewCache); util.assert(result.viewCache.getServerCache().isFullyInitialized() || !oldViewCache.getServerCache().isFullyInitialized(), 'Once a server snap is complete, it should never go back'); this.viewCache_ = result.viewCache; return this.generateEventsForChanges_(result.changes, result.viewCache.getEventCache().getNode(), null); }; /** * @param {!EventRegistration} registration * @return {!Array.} */ View.prototype.getInitialEvents = function (registration) { var eventSnap = this.viewCache_.getEventCache(); var initialChanges = []; if (!eventSnap.getNode().isLeafNode()) { var eventNode = eventSnap.getNode(); eventNode.forEachChild(PRIORITY_INDEX, function (key, childNode) { initialChanges.push(Change.childAddedChange(key, childNode)); }); } if (eventSnap.isFullyInitialized()) { initialChanges.push(Change.valueChange(eventSnap.getNode())); } return this.generateEventsForChanges_(initialChanges, eventSnap.getNode(), registration); }; /** * @private * @param {!Array.} changes * @param {!Node} eventCache * @param {EventRegistration=} eventRegistration * @return {!Array.} */ View.prototype.generateEventsForChanges_ = function (changes, eventCache, eventRegistration) { var registrations = eventRegistration ? [eventRegistration] : this.eventRegistrations_; return this.eventGenerator_.generateEventsForChanges(changes, eventCache, registrations); }; return View; }()); /** * Copyright 2017 Google Inc. * * 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. */ var __referenceConstructor$1; /** * SyncPoint represents a single location in a SyncTree with 1 or more event registrations, meaning we need to * maintain 1 or more Views at this location to cache server data and raise appropriate events for server changes * and user writes (set, transaction, update). * * It's responsible for: * - Maintaining the set of 1 or more views necessary at this location (a SyncPoint with 0 views should be removed). * - Proxying user / server operations to the views as appropriate (i.e. applyServerOverwrite, * applyUserOverwrite, etc.) */ var SyncPoint = /** @class */ (function () { function SyncPoint() { /** * The Views being tracked at this location in the tree, stored as a map where the key is a * queryId and the value is the View for that query. * * NOTE: This list will be quite small (usually 1, but perhaps 2 or 3; any more is an odd use case). * * @type {!Object.} * @private */ this.views_ = {}; } Object.defineProperty(SyncPoint, "__referenceConstructor", { get: function () { util.assert(__referenceConstructor$1, 'Reference.ts has not been loaded'); return __referenceConstructor$1; }, set: function (val) { util.assert(!__referenceConstructor$1, '__referenceConstructor has already been defined'); __referenceConstructor$1 = val; }, enumerable: true, configurable: true }); /** * @return {boolean} */ SyncPoint.prototype.isEmpty = function () { return util.isEmpty(this.views_); }; /** * * @param {!Operation} operation * @param {!WriteTreeRef} writesCache * @param {?Node} optCompleteServerCache * @return {!Array.} */ SyncPoint.prototype.applyOperation = function (operation, writesCache, optCompleteServerCache) { var queryId = operation.source.queryId; if (queryId !== null) { var view = util.safeGet(this.views_, queryId); util.assert(view != null, 'SyncTree gave us an op for an invalid query.'); return view.applyOperation(operation, writesCache, optCompleteServerCache); } else { var events_1 = []; util.forEach(this.views_, function (key, view) { events_1 = events_1.concat(view.applyOperation(operation, writesCache, optCompleteServerCache)); }); return events_1; } }; /** * Add an event callback for the specified query. * * @param {!Query} query * @param {!EventRegistration} eventRegistration * @param {!WriteTreeRef} writesCache * @param {?Node} serverCache Complete server cache, if we have it. * @param {boolean} serverCacheComplete * @return {!Array.} Events to raise. */ SyncPoint.prototype.addEventRegistration = function (query, eventRegistration, writesCache, serverCache, serverCacheComplete) { var queryId = query.queryIdentifier(); var view = util.safeGet(this.views_, queryId); if (!view) { // TODO: make writesCache take flag for complete server node var eventCache = writesCache.calcCompleteEventCache(serverCacheComplete ? serverCache : null); var eventCacheComplete = false; if (eventCache) { eventCacheComplete = true; } else if (serverCache instanceof ChildrenNode) { eventCache = writesCache.calcCompleteEventChildren(serverCache); eventCacheComplete = false; } else { eventCache = ChildrenNode.EMPTY_NODE; eventCacheComplete = false; } var viewCache = new ViewCache(new CacheNode( /** @type {!Node} */ (eventCache), eventCacheComplete, false), new CacheNode( /** @type {!Node} */ (serverCache), serverCacheComplete, false)); view = new View(query, viewCache); this.views_[queryId] = view; } // This is guaranteed to exist now, we just created anything that was missing view.addEventRegistration(eventRegistration); return view.getInitialEvents(eventRegistration); }; /** * Remove event callback(s). Return cancelEvents if a cancelError is specified. * * If query is the default query, we'll check all views for the specified eventRegistration. * If eventRegistration is null, we'll remove all callbacks for the specified view(s). * * @param {!Query} query * @param {?EventRegistration} eventRegistration If null, remove all callbacks. * @param {Error=} cancelError If a cancelError is provided, appropriate cancel events will be returned. * @return {{removed:!Array., events:!Array.}} removed queries and any cancel events */ SyncPoint.prototype.removeEventRegistration = function (query, eventRegistration, cancelError) { var queryId = query.queryIdentifier(); var removed = []; var cancelEvents = []; var hadCompleteView = this.hasCompleteView(); if (queryId === 'default') { // When you do ref.off(...), we search all views for the registration to remove. var self_1 = this; util.forEach(this.views_, function (viewQueryId, view) { cancelEvents = cancelEvents.concat(view.removeEventRegistration(eventRegistration, cancelError)); if (view.isEmpty()) { delete self_1.views_[viewQueryId]; // We'll deal with complete views later. if (!view .getQuery() .getQueryParams() .loadsAllData()) { removed.push(view.getQuery()); } } }); } else { // remove the callback from the specific view. var view = util.safeGet(this.views_, queryId); if (view) { cancelEvents = cancelEvents.concat(view.removeEventRegistration(eventRegistration, cancelError)); if (view.isEmpty()) { delete this.views_[queryId]; // We'll deal with complete views later. if (!view .getQuery() .getQueryParams() .loadsAllData()) { removed.push(view.getQuery()); } } } } if (hadCompleteView && !this.hasCompleteView()) { // We removed our last complete view. removed.push(new SyncPoint.__referenceConstructor(query.repo, query.path)); } return { removed: removed, events: cancelEvents }; }; /** * @return {!Array.} */ SyncPoint.prototype.getQueryViews = function () { var _this = this; var values = Object.keys(this.views_).map(function (key) { return _this.views_[key]; }); return values.filter(function (view) { return !view .getQuery() .getQueryParams() .loadsAllData(); }); }; /** * * @param {!Path} path The path to the desired complete snapshot * @return {?Node} A complete cache, if it exists */ SyncPoint.prototype.getCompleteServerCache = function (path) { var serverCache = null; util.forEach(this.views_, function (key, view) { serverCache = serverCache || view.getCompleteServerCache(path); }); return serverCache; }; /** * @param {!Query} query * @return {?View} */ SyncPoint.prototype.viewForQuery = function (query) { var params = query.getQueryParams(); if (params.loadsAllData()) { return this.getCompleteView(); } else { var queryId = query.queryIdentifier(); return util.safeGet(this.views_, queryId); } }; /** * @param {!Query} query * @return {boolean} */ SyncPoint.prototype.viewExistsForQuery = function (query) { return this.viewForQuery(query) != null; }; /** * @return {boolean} */ SyncPoint.prototype.hasCompleteView = function () { return this.getCompleteView() != null; }; /** * @return {?View} */ SyncPoint.prototype.getCompleteView = function () { var completeView = util.findValue(this.views_, function (view) { return view .getQuery() .getQueryParams() .loadsAllData(); }); return completeView || null; }; return SyncPoint; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * This class holds a collection of writes that can be applied to nodes in unison. It abstracts away the logic with * dealing with priority writes and multiple nested writes. At any given path there is only allowed to be one write * modifying that path. Any write to an existing path or shadowing an existing path will modify that existing write * to reflect the write added. * * @constructor * @param {!ImmutableTree.} writeTree */ var CompoundWrite = /** @class */ (function () { function CompoundWrite(writeTree_) { this.writeTree_ = writeTree_; } /** * @param {!Path} path * @param {!Node} node * @return {!CompoundWrite} */ CompoundWrite.prototype.addWrite = function (path, node) { if (path.isEmpty()) { return new CompoundWrite(new ImmutableTree(node)); } else { var rootmost = this.writeTree_.findRootMostValueAndPath(path); if (rootmost != null) { var rootMostPath = rootmost.path; var value = rootmost.value; var relativePath = Path.relativePath(rootMostPath, path); value = value.updateChild(relativePath, node); return new CompoundWrite(this.writeTree_.set(rootMostPath, value)); } else { var subtree = new ImmutableTree(node); var newWriteTree = this.writeTree_.setTree(path, subtree); return new CompoundWrite(newWriteTree); } } }; /** * @param {!Path} path * @param {!Object.} updates * @return {!CompoundWrite} */ CompoundWrite.prototype.addWrites = function (path, updates) { var newWrite = this; util.forEach(updates, function (childKey, node) { newWrite = newWrite.addWrite(path.child(childKey), node); }); return newWrite; }; /** * Will remove a write at the given path and deeper paths. This will not modify a write at a higher * location, which must be removed by calling this method with that path. * * @param {!Path} path The path at which a write and all deeper writes should be removed * @return {!CompoundWrite} The new CompoundWrite with the removed path */ CompoundWrite.prototype.removeWrite = function (path) { if (path.isEmpty()) { return CompoundWrite.Empty; } else { var newWriteTree = this.writeTree_.setTree(path, ImmutableTree.Empty); return new CompoundWrite(newWriteTree); } }; /** * Returns whether this CompoundWrite will fully overwrite a node at a given location and can therefore be * considered "complete". * * @param {!Path} path The path to check for * @return {boolean} Whether there is a complete write at that path */ CompoundWrite.prototype.hasCompleteWrite = function (path) { return this.getCompleteNode(path) != null; }; /** * Returns a node for a path if and only if the node is a "complete" overwrite at that path. This will not aggregate * writes from deeper paths, but will return child nodes from a more shallow path. * * @param {!Path} path The path to get a complete write * @return {?Node} The node if complete at that path, or null otherwise. */ CompoundWrite.prototype.getCompleteNode = function (path) { var rootmost = this.writeTree_.findRootMostValueAndPath(path); if (rootmost != null) { return this.writeTree_ .get(rootmost.path) .getChild(Path.relativePath(rootmost.path, path)); } else { return null; } }; /** * Returns all children that are guaranteed to be a complete overwrite. * * @return {!Array.} A list of all complete children. */ CompoundWrite.prototype.getCompleteChildren = function () { var children = []; var node = this.writeTree_.value; if (node != null) { // If it's a leaf node, it has no children; so nothing to do. if (!node.isLeafNode()) { node.forEachChild(PRIORITY_INDEX, function (childName, childNode) { children.push(new NamedNode(childName, childNode)); }); } } else { this.writeTree_.children.inorderTraversal(function (childName, childTree) { if (childTree.value != null) { children.push(new NamedNode(childName, childTree.value)); } }); } return children; }; /** * @param {!Path} path * @return {!CompoundWrite} */ CompoundWrite.prototype.childCompoundWrite = function (path) { if (path.isEmpty()) { return this; } else { var shadowingNode = this.getCompleteNode(path); if (shadowingNode != null) { return new CompoundWrite(new ImmutableTree(shadowingNode)); } else { return new CompoundWrite(this.writeTree_.subtree(path)); } } }; /** * Returns true if this CompoundWrite is empty and therefore does not modify any nodes. * @return {boolean} Whether this CompoundWrite is empty */ CompoundWrite.prototype.isEmpty = function () { return this.writeTree_.isEmpty(); }; /** * Applies this CompoundWrite to a node. The node is returned with all writes from this CompoundWrite applied to the * node * @param {!Node} node The node to apply this CompoundWrite to * @return {!Node} The node with all writes applied */ CompoundWrite.prototype.apply = function (node) { return CompoundWrite.applySubtreeWrite_(Path.Empty, this.writeTree_, node); }; /** * @type {!CompoundWrite} */ CompoundWrite.Empty = new CompoundWrite(new ImmutableTree(null)); /** * @param {!Path} relativePath * @param {!ImmutableTree.} writeTree * @param {!Node} node * @return {!Node} * @private */ CompoundWrite.applySubtreeWrite_ = function (relativePath, writeTree, node) { if (writeTree.value != null) { // Since there a write is always a leaf, we're done here return node.updateChild(relativePath, writeTree.value); } else { var priorityWrite_1 = null; writeTree.children.inorderTraversal(function (childKey, childTree) { if (childKey === '.priority') { // Apply priorities at the end so we don't update priorities for either empty nodes or forget // to apply priorities to empty nodes that are later filled util.assert(childTree.value !== null, 'Priority writes must always be leaf nodes'); priorityWrite_1 = childTree.value; } else { node = CompoundWrite.applySubtreeWrite_(relativePath.child(childKey), childTree, node); } }); // If there was a priority write, we only apply it if the node is not empty if (!node.getChild(relativePath).isEmpty() && priorityWrite_1 !== null) { node = node.updateChild(relativePath.child('.priority'), priorityWrite_1); } return node; } }; return CompoundWrite; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * WriteTree tracks all pending user-initiated writes and has methods to calculate the result of merging them * with underlying server data (to create "event cache" data). Pending writes are added with addOverwrite() * and addMerge(), and removed with removeWrite(). * * @constructor */ var WriteTree = /** @class */ (function () { function WriteTree() { /** * A tree tracking the result of applying all visible writes. This does not include transactions with * applyLocally=false or writes that are completely shadowed by other writes. * * @type {!CompoundWrite} * @private */ this.visibleWrites_ = CompoundWrite.Empty; /** * A list of all pending writes, regardless of visibility and shadowed-ness. Used to calculate arbitrary * sets of the changed data, such as hidden writes (from transactions) or changes with certain writes excluded (also * used by transactions). * * @type {!Array.} * @private */ this.allWrites_ = []; this.lastWriteId_ = -1; } /** * Create a new WriteTreeRef for the given path. For use with a new sync point at the given path. * * @param {!Path} path * @return {!WriteTreeRef} */ WriteTree.prototype.childWrites = function (path) { return new WriteTreeRef(path, this); }; /** * Record a new overwrite from user code. * * @param {!Path} path * @param {!Node} snap * @param {!number} writeId * @param {boolean=} visible This is set to false by some transactions. It should be excluded from event caches */ WriteTree.prototype.addOverwrite = function (path, snap, writeId, visible) { util.assert(writeId > this.lastWriteId_, 'Stacking an older write on top of newer ones'); if (visible === undefined) { visible = true; } this.allWrites_.push({ path: path, snap: snap, writeId: writeId, visible: visible }); if (visible) { this.visibleWrites_ = this.visibleWrites_.addWrite(path, snap); } this.lastWriteId_ = writeId; }; /** * Record a new merge from user code. * * @param {!Path} path * @param {!Object.} changedChildren * @param {!number} writeId */ WriteTree.prototype.addMerge = function (path, changedChildren, writeId) { util.assert(writeId > this.lastWriteId_, 'Stacking an older merge on top of newer ones'); this.allWrites_.push({ path: path, children: changedChildren, writeId: writeId, visible: true }); this.visibleWrites_ = this.visibleWrites_.addWrites(path, changedChildren); this.lastWriteId_ = writeId; }; /** * @param {!number} writeId * @return {?WriteRecord} */ WriteTree.prototype.getWrite = function (writeId) { for (var i = 0; i < this.allWrites_.length; i++) { var record = this.allWrites_[i]; if (record.writeId === writeId) { return record; } } return null; }; /** * Remove a write (either an overwrite or merge) that has been successfully acknowledge by the server. Recalculates * the tree if necessary. We return true if it may have been visible, meaning views need to reevaluate. * * @param {!number} writeId * @return {boolean} true if the write may have been visible (meaning we'll need to reevaluate / raise * events as a result). */ WriteTree.prototype.removeWrite = function (writeId) { // Note: disabling this check. It could be a transaction that preempted another transaction, and thus was applied // out of order. //const validClear = revert || this.allWrites_.length === 0 || writeId <= this.allWrites_[0].writeId; //assert(validClear, "Either we don't have this write, or it's the first one in the queue"); var _this = this; var idx = this.allWrites_.findIndex(function (s) { return s.writeId === writeId; }); util.assert(idx >= 0, 'removeWrite called with nonexistent writeId.'); var writeToRemove = this.allWrites_[idx]; this.allWrites_.splice(idx, 1); var removedWriteWasVisible = writeToRemove.visible; var removedWriteOverlapsWithOtherWrites = false; var i = this.allWrites_.length - 1; while (removedWriteWasVisible && i >= 0) { var currentWrite = this.allWrites_[i]; if (currentWrite.visible) { if (i >= idx && this.recordContainsPath_(currentWrite, writeToRemove.path)) { // The removed write was completely shadowed by a subsequent write. removedWriteWasVisible = false; } else if (writeToRemove.path.contains(currentWrite.path)) { // Either we're covering some writes or they're covering part of us (depending on which came first). removedWriteOverlapsWithOtherWrites = true; } } i--; } if (!removedWriteWasVisible) { return false; } else if (removedWriteOverlapsWithOtherWrites) { // There's some shadowing going on. Just rebuild the visible writes from scratch. this.resetTree_(); return true; } else { // There's no shadowing. We can safely just remove the write(s) from visibleWrites. if (writeToRemove.snap) { this.visibleWrites_ = this.visibleWrites_.removeWrite(writeToRemove.path); } else { var children = writeToRemove.children; util.forEach(children, function (childName) { _this.visibleWrites_ = _this.visibleWrites_.removeWrite(writeToRemove.path.child(childName)); }); } return true; } }; /** * Return a complete snapshot for the given path if there's visible write data at that path, else null. * No server data is considered. * * @param {!Path} path * @return {?Node} */ WriteTree.prototype.getCompleteWriteData = function (path) { return this.visibleWrites_.getCompleteNode(path); }; /** * Given optional, underlying server data, and an optional set of constraints (exclude some sets, include hidden * writes), attempt to calculate a complete snapshot for the given path * * @param {!Path} treePath * @param {?Node} completeServerCache * @param {Array.=} writeIdsToExclude An optional set to be excluded * @param {boolean=} includeHiddenWrites Defaults to false, whether or not to layer on writes with visible set to false * @return {?Node} */ WriteTree.prototype.calcCompleteEventCache = function (treePath, completeServerCache, writeIdsToExclude, includeHiddenWrites) { if (!writeIdsToExclude && !includeHiddenWrites) { var shadowingNode = this.visibleWrites_.getCompleteNode(treePath); if (shadowingNode != null) { return shadowingNode; } else { var subMerge = this.visibleWrites_.childCompoundWrite(treePath); if (subMerge.isEmpty()) { return completeServerCache; } else if (completeServerCache == null && !subMerge.hasCompleteWrite(Path.Empty)) { // We wouldn't have a complete snapshot, since there's no underlying data and no complete shadow return null; } else { var layeredCache = completeServerCache || ChildrenNode.EMPTY_NODE; return subMerge.apply(layeredCache); } } } else { var merge = this.visibleWrites_.childCompoundWrite(treePath); if (!includeHiddenWrites && merge.isEmpty()) { return completeServerCache; } else { // If the server cache is null, and we don't have a complete cache, we need to return null if (!includeHiddenWrites && completeServerCache == null && !merge.hasCompleteWrite(Path.Empty)) { return null; } else { var filter = function (write) { return ((write.visible || includeHiddenWrites) && (!writeIdsToExclude || !~writeIdsToExclude.indexOf(write.writeId)) && (write.path.contains(treePath) || treePath.contains(write.path))); }; var mergeAtPath = WriteTree.layerTree_(this.allWrites_, filter, treePath); var layeredCache = completeServerCache || ChildrenNode.EMPTY_NODE; return mergeAtPath.apply(layeredCache); } } } }; /** * With optional, underlying server data, attempt to return a children node of children that we have complete data for. * Used when creating new views, to pre-fill their complete event children snapshot. * * @param {!Path} treePath * @param {?ChildrenNode} completeServerChildren * @return {!ChildrenNode} */ WriteTree.prototype.calcCompleteEventChildren = function (treePath, completeServerChildren) { var completeChildren = ChildrenNode.EMPTY_NODE; var topLevelSet = this.visibleWrites_.getCompleteNode(treePath); if (topLevelSet) { if (!topLevelSet.isLeafNode()) { // we're shadowing everything. Return the children. topLevelSet.forEachChild(PRIORITY_INDEX, function (childName, childSnap) { completeChildren = completeChildren.updateImmediateChild(childName, childSnap); }); } return completeChildren; } else if (completeServerChildren) { // Layer any children we have on top of this // We know we don't have a top-level set, so just enumerate existing children var merge_1 = this.visibleWrites_.childCompoundWrite(treePath); completeServerChildren.forEachChild(PRIORITY_INDEX, function (childName, childNode) { var node = merge_1 .childCompoundWrite(new Path(childName)) .apply(childNode); completeChildren = completeChildren.updateImmediateChild(childName, node); }); // Add any complete children we have from the set merge_1.getCompleteChildren().forEach(function (namedNode) { completeChildren = completeChildren.updateImmediateChild(namedNode.name, namedNode.node); }); return completeChildren; } else { // We don't have anything to layer on top of. Layer on any children we have // Note that we can return an empty snap if we have a defined delete var merge = this.visibleWrites_.childCompoundWrite(treePath); merge.getCompleteChildren().forEach(function (namedNode) { completeChildren = completeChildren.updateImmediateChild(namedNode.name, namedNode.node); }); return completeChildren; } }; /** * Given that the underlying server data has updated, determine what, if anything, needs to be * applied to the event cache. * * Possibilities: * * 1. No writes are shadowing. Events should be raised, the snap to be applied comes from the server data * * 2. Some write is completely shadowing. No events to be raised * * 3. Is partially shadowed. Events * * Either existingEventSnap or existingServerSnap must exist * * @param {!Path} treePath * @param {!Path} childPath * @param {?Node} existingEventSnap * @param {?Node} existingServerSnap * @return {?Node} */ WriteTree.prototype.calcEventCacheAfterServerOverwrite = function (treePath, childPath, existingEventSnap, existingServerSnap) { util.assert(existingEventSnap || existingServerSnap, 'Either existingEventSnap or existingServerSnap must exist'); var path = treePath.child(childPath); if (this.visibleWrites_.hasCompleteWrite(path)) { // At this point we can probably guarantee that we're in case 2, meaning no events // May need to check visibility while doing the findRootMostValueAndPath call return null; } else { // No complete shadowing. We're either partially shadowing or not shadowing at all. var childMerge = this.visibleWrites_.childCompoundWrite(path); if (childMerge.isEmpty()) { // We're not shadowing at all. Case 1 return existingServerSnap.getChild(childPath); } else { // This could be more efficient if the serverNode + updates doesn't change the eventSnap // However this is tricky to find out, since user updates don't necessary change the server // snap, e.g. priority updates on empty nodes, or deep deletes. Another special case is if the server // adds nodes, but doesn't change any existing writes. It is therefore not enough to // only check if the updates change the serverNode. // Maybe check if the merge tree contains these special cases and only do a full overwrite in that case? return childMerge.apply(existingServerSnap.getChild(childPath)); } } }; /** * Returns a complete child for a given server snap after applying all user writes or null if there is no * complete child for this ChildKey. * * @param {!Path} treePath * @param {!string} childKey * @param {!CacheNode} existingServerSnap * @return {?Node} */ WriteTree.prototype.calcCompleteChild = function (treePath, childKey, existingServerSnap) { var path = treePath.child(childKey); var shadowingNode = this.visibleWrites_.getCompleteNode(path); if (shadowingNode != null) { return shadowingNode; } else { if (existingServerSnap.isCompleteForChild(childKey)) { var childMerge = this.visibleWrites_.childCompoundWrite(path); return childMerge.apply(existingServerSnap.getNode().getImmediateChild(childKey)); } else { return null; } } }; /** * Returns a node if there is a complete overwrite for this path. More specifically, if there is a write at * a higher path, this will return the child of that write relative to the write and this path. * Returns null if there is no write at this path. * * @param {!Path} path * @return {?Node} */ WriteTree.prototype.shadowingWrite = function (path) { return this.visibleWrites_.getCompleteNode(path); }; /** * This method is used when processing child remove events on a query. If we can, we pull in children that were outside * the window, but may now be in the window. * * @param {!Path} treePath * @param {?Node} completeServerData * @param {!NamedNode} startPost * @param {!number} count * @param {boolean} reverse * @param {!Index} index * @return {!Array.} */ WriteTree.prototype.calcIndexedSlice = function (treePath, completeServerData, startPost, count, reverse, index) { var toIterate; var merge = this.visibleWrites_.childCompoundWrite(treePath); var shadowingNode = merge.getCompleteNode(Path.Empty); if (shadowingNode != null) { toIterate = shadowingNode; } else if (completeServerData != null) { toIterate = merge.apply(completeServerData); } else { // no children to iterate on return []; } toIterate = toIterate.withIndex(index); if (!toIterate.isEmpty() && !toIterate.isLeafNode()) { var nodes = []; var cmp = index.getCompare(); var iter = reverse ? toIterate.getReverseIteratorFrom(startPost, index) : toIterate.getIteratorFrom(startPost, index); var next = iter.getNext(); while (next && nodes.length < count) { if (cmp(next, startPost) !== 0) { nodes.push(next); } next = iter.getNext(); } return nodes; } else { return []; } }; /** * @param {!WriteRecord} writeRecord * @param {!Path} path * @return {boolean} * @private */ WriteTree.prototype.recordContainsPath_ = function (writeRecord, path) { if (writeRecord.snap) { return writeRecord.path.contains(path); } else { // findKey can return undefined, so use !! to coerce to boolean return !!util.findKey(writeRecord.children, function (childSnap, childName) { return writeRecord.path.child(childName).contains(path); }); } }; /** * Re-layer the writes and merges into a tree so we can efficiently calculate event snapshots * @private */ WriteTree.prototype.resetTree_ = function () { this.visibleWrites_ = WriteTree.layerTree_(this.allWrites_, WriteTree.DefaultFilter_, Path.Empty); if (this.allWrites_.length > 0) { this.lastWriteId_ = this.allWrites_[this.allWrites_.length - 1].writeId; } else { this.lastWriteId_ = -1; } }; /** * The default filter used when constructing the tree. Keep everything that's visible. * * @param {!WriteRecord} write * @return {boolean} * @private */ WriteTree.DefaultFilter_ = function (write) { return write.visible; }; /** * Static method. Given an array of WriteRecords, a filter for which ones to include, and a path, construct the tree of * event data at that path. * * @param {!Array.} writes * @param {!function(!WriteRecord):boolean} filter * @param {!Path} treeRoot * @return {!CompoundWrite} * @private */ WriteTree.layerTree_ = function (writes, filter, treeRoot) { var compoundWrite = CompoundWrite.Empty; for (var i = 0; i < writes.length; ++i) { var write = writes[i]; // Theory, a later set will either: // a) abort a relevant transaction, so no need to worry about excluding it from calculating that transaction // b) not be relevant to a transaction (separate branch), so again will not affect the data for that transaction if (filter(write)) { var writePath = write.path; var relativePath = void 0; if (write.snap) { if (treeRoot.contains(writePath)) { relativePath = Path.relativePath(treeRoot, writePath); compoundWrite = compoundWrite.addWrite(relativePath, write.snap); } else if (writePath.contains(treeRoot)) { relativePath = Path.relativePath(writePath, treeRoot); compoundWrite = compoundWrite.addWrite(Path.Empty, write.snap.getChild(relativePath)); } else { // There is no overlap between root path and write path, ignore write } } else if (write.children) { if (treeRoot.contains(writePath)) { relativePath = Path.relativePath(treeRoot, writePath); compoundWrite = compoundWrite.addWrites(relativePath, write.children); } else if (writePath.contains(treeRoot)) { relativePath = Path.relativePath(writePath, treeRoot); if (relativePath.isEmpty()) { compoundWrite = compoundWrite.addWrites(Path.Empty, write.children); } else { var child = util.safeGet(write.children, relativePath.getFront()); if (child) { // There exists a child in this node that matches the root path var deepNode = child.getChild(relativePath.popFront()); compoundWrite = compoundWrite.addWrite(Path.Empty, deepNode); } } } else { // There is no overlap between root path and write path, ignore write } } else { throw util.assertionError('WriteRecord should have .snap or .children'); } } } return compoundWrite; }; return WriteTree; }()); /** * A WriteTreeRef wraps a WriteTree and a path, for convenient access to a particular subtree. All of the methods * just proxy to the underlying WriteTree. * * @constructor */ var WriteTreeRef = /** @class */ (function () { /** * @param {!Path} path * @param {!WriteTree} writeTree */ function WriteTreeRef(path, writeTree) { this.treePath_ = path; this.writeTree_ = writeTree; } /** * If possible, returns a complete event cache, using the underlying server data if possible. In addition, can be used * to get a cache that includes hidden writes, and excludes arbitrary writes. Note that customizing the returned node * can lead to a more expensive calculation. * * @param {?Node} completeServerCache * @param {Array.=} writeIdsToExclude Optional writes to exclude. * @param {boolean=} includeHiddenWrites Defaults to false, whether or not to layer on writes with visible set to false * @return {?Node} */ WriteTreeRef.prototype.calcCompleteEventCache = function (completeServerCache, writeIdsToExclude, includeHiddenWrites) { return this.writeTree_.calcCompleteEventCache(this.treePath_, completeServerCache, writeIdsToExclude, includeHiddenWrites); }; /** * If possible, returns a children node containing all of the complete children we have data for. The returned data is a * mix of the given server data and write data. * * @param {?ChildrenNode} completeServerChildren * @return {!ChildrenNode} */ WriteTreeRef.prototype.calcCompleteEventChildren = function (completeServerChildren) { return this.writeTree_.calcCompleteEventChildren(this.treePath_, completeServerChildren); }; /** * Given that either the underlying server data has updated or the outstanding writes have updated, determine what, * if anything, needs to be applied to the event cache. * * Possibilities: * * 1. No writes are shadowing. Events should be raised, the snap to be applied comes from the server data * * 2. Some write is completely shadowing. No events to be raised * * 3. Is partially shadowed. Events should be raised * * Either existingEventSnap or existingServerSnap must exist, this is validated via an assert * * @param {!Path} path * @param {?Node} existingEventSnap * @param {?Node} existingServerSnap * @return {?Node} */ WriteTreeRef.prototype.calcEventCacheAfterServerOverwrite = function (path, existingEventSnap, existingServerSnap) { return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_, path, existingEventSnap, existingServerSnap); }; /** * Returns a node if there is a complete overwrite for this path. More specifically, if there is a write at * a higher path, this will return the child of that write relative to the write and this path. * Returns null if there is no write at this path. * * @param {!Path} path * @return {?Node} */ WriteTreeRef.prototype.shadowingWrite = function (path) { return this.writeTree_.shadowingWrite(this.treePath_.child(path)); }; /** * This method is used when processing child remove events on a query. If we can, we pull in children that were outside * the window, but may now be in the window * * @param {?Node} completeServerData * @param {!NamedNode} startPost * @param {!number} count * @param {boolean} reverse * @param {!Index} index * @return {!Array.} */ WriteTreeRef.prototype.calcIndexedSlice = function (completeServerData, startPost, count, reverse, index) { return this.writeTree_.calcIndexedSlice(this.treePath_, completeServerData, startPost, count, reverse, index); }; /** * Returns a complete child for a given server snap after applying all user writes or null if there is no * complete child for this ChildKey. * * @param {!string} childKey * @param {!CacheNode} existingServerCache * @return {?Node} */ WriteTreeRef.prototype.calcCompleteChild = function (childKey, existingServerCache) { return this.writeTree_.calcCompleteChild(this.treePath_, childKey, existingServerCache); }; /** * Return a WriteTreeRef for a child. * * @param {string} childName * @return {!WriteTreeRef} */ WriteTreeRef.prototype.child = function (childName) { return new WriteTreeRef(this.treePath_.child(childName), this.writeTree_); }; return WriteTreeRef; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * SyncTree is the central class for managing event callback registration, data caching, views * (query processing), and event generation. There are typically two SyncTree instances for * each Repo, one for the normal Firebase data, and one for the .info data. * * It has a number of responsibilities, including: * - Tracking all user event callbacks (registered via addEventRegistration() and removeEventRegistration()). * - Applying and caching data changes for user set(), transaction(), and update() calls * (applyUserOverwrite(), applyUserMerge()). * - Applying and caching data changes for server data changes (applyServerOverwrite(), * applyServerMerge()). * - Generating user-facing events for server and user changes (all of the apply* methods * return the set of events that need to be raised as a result). * - Maintaining the appropriate set of server listens to ensure we are always subscribed * to the correct set of paths and queries to satisfy the current set of user event * callbacks (listens are started/stopped using the provided listenProvider). * * NOTE: Although SyncTree tracks event callbacks and calculates events to raise, the actual * events are returned to the caller rather than raised synchronously. * * @constructor */ var SyncTree = /** @class */ (function () { /** * @param {!ListenProvider} listenProvider_ Used by SyncTree to start / stop listening * to server data. */ function SyncTree(listenProvider_) { this.listenProvider_ = listenProvider_; /** * Tree of SyncPoints. There's a SyncPoint at any location that has 1 or more views. * @type {!ImmutableTree.} * @private */ this.syncPointTree_ = ImmutableTree.Empty; /** * A tree of all pending user writes (user-initiated set()'s, transaction()'s, update()'s, etc.). * @type {!WriteTree} * @private */ this.pendingWriteTree_ = new WriteTree(); this.tagToQueryMap_ = {}; this.queryToTagMap_ = {}; } /** * Apply the data changes for a user-generated set() or transaction() call. * * @param {!Path} path * @param {!Node} newData * @param {number} writeId * @param {boolean=} visible * @return {!Array.} Events to raise. */ SyncTree.prototype.applyUserOverwrite = function (path, newData, writeId, visible) { // Record pending write. this.pendingWriteTree_.addOverwrite(path, newData, writeId, visible); if (!visible) { return []; } else { return this.applyOperationToSyncPoints_(new Overwrite(OperationSource.User, path, newData)); } }; /** * Apply the data from a user-generated update() call * * @param {!Path} path * @param {!Object.} changedChildren * @param {!number} writeId * @return {!Array.} Events to raise. */ SyncTree.prototype.applyUserMerge = function (path, changedChildren, writeId) { // Record pending merge. this.pendingWriteTree_.addMerge(path, changedChildren, writeId); var changeTree = ImmutableTree.fromObject(changedChildren); return this.applyOperationToSyncPoints_(new Merge(OperationSource.User, path, changeTree)); }; /** * Acknowledge a pending user write that was previously registered with applyUserOverwrite() or applyUserMerge(). * * @param {!number} writeId * @param {boolean=} revert True if the given write failed and needs to be reverted * @return {!Array.} Events to raise. */ SyncTree.prototype.ackUserWrite = function (writeId, revert) { if (revert === void 0) { revert = false; } var write = this.pendingWriteTree_.getWrite(writeId); var needToReevaluate = this.pendingWriteTree_.removeWrite(writeId); if (!needToReevaluate) { return []; } else { var affectedTree_1 = ImmutableTree.Empty; if (write.snap != null) { // overwrite affectedTree_1 = affectedTree_1.set(Path.Empty, true); } else { util.forEach(write.children, function (pathString, node) { affectedTree_1 = affectedTree_1.set(new Path(pathString), node); }); } return this.applyOperationToSyncPoints_(new AckUserWrite(write.path, affectedTree_1, revert)); } }; /** * Apply new server data for the specified path.. * * @param {!Path} path * @param {!Node} newData * @return {!Array.} Events to raise. */ SyncTree.prototype.applyServerOverwrite = function (path, newData) { return this.applyOperationToSyncPoints_(new Overwrite(OperationSource.Server, path, newData)); }; /** * Apply new server data to be merged in at the specified path. * * @param {!Path} path * @param {!Object.} changedChildren * @return {!Array.} Events to raise. */ SyncTree.prototype.applyServerMerge = function (path, changedChildren) { var changeTree = ImmutableTree.fromObject(changedChildren); return this.applyOperationToSyncPoints_(new Merge(OperationSource.Server, path, changeTree)); }; /** * Apply a listen complete for a query * * @param {!Path} path * @return {!Array.} Events to raise. */ SyncTree.prototype.applyListenComplete = function (path) { return this.applyOperationToSyncPoints_(new ListenComplete(OperationSource.Server, path)); }; /** * Apply new server data for the specified tagged query. * * @param {!Path} path * @param {!Node} snap * @param {!number} tag * @return {!Array.} Events to raise. */ SyncTree.prototype.applyTaggedQueryOverwrite = function (path, snap, tag) { var queryKey = this.queryKeyForTag_(tag); if (queryKey != null) { var r = SyncTree.parseQueryKey_(queryKey); var queryPath = r.path, queryId = r.queryId; var relativePath = Path.relativePath(queryPath, path); var op = new Overwrite(OperationSource.forServerTaggedQuery(queryId), relativePath, snap); return this.applyTaggedOperation_(queryPath, op); } else { // Query must have been removed already return []; } }; /** * Apply server data to be merged in for the specified tagged query. * * @param {!Path} path * @param {!Object.} changedChildren * @param {!number} tag * @return {!Array.} Events to raise. */ SyncTree.prototype.applyTaggedQueryMerge = function (path, changedChildren, tag) { var queryKey = this.queryKeyForTag_(tag); if (queryKey) { var r = SyncTree.parseQueryKey_(queryKey); var queryPath = r.path, queryId = r.queryId; var relativePath = Path.relativePath(queryPath, path); var changeTree = ImmutableTree.fromObject(changedChildren); var op = new Merge(OperationSource.forServerTaggedQuery(queryId), relativePath, changeTree); return this.applyTaggedOperation_(queryPath, op); } else { // We've already removed the query. No big deal, ignore the update return []; } }; /** * Apply a listen complete for a tagged query * * @param {!Path} path * @param {!number} tag * @return {!Array.} Events to raise. */ SyncTree.prototype.applyTaggedListenComplete = function (path, tag) { var queryKey = this.queryKeyForTag_(tag); if (queryKey) { var r = SyncTree.parseQueryKey_(queryKey); var queryPath = r.path, queryId = r.queryId; var relativePath = Path.relativePath(queryPath, path); var op = new ListenComplete(OperationSource.forServerTaggedQuery(queryId), relativePath); return this.applyTaggedOperation_(queryPath, op); } else { // We've already removed the query. No big deal, ignore the update return []; } }; /** * Add an event callback for the specified query. * * @param {!Query} query * @param {!EventRegistration} eventRegistration * @return {!Array.} Events to raise. */ SyncTree.prototype.addEventRegistration = function (query, eventRegistration) { var path = query.path; var serverCache = null; var foundAncestorDefaultView = false; // Any covering writes will necessarily be at the root, so really all we need to find is the server cache. // Consider optimizing this once there's a better understanding of what actual behavior will be. this.syncPointTree_.foreachOnPath(path, function (pathToSyncPoint, sp) { var relativePath = Path.relativePath(pathToSyncPoint, path); serverCache = serverCache || sp.getCompleteServerCache(relativePath); foundAncestorDefaultView = foundAncestorDefaultView || sp.hasCompleteView(); }); var syncPoint = this.syncPointTree_.get(path); if (!syncPoint) { syncPoint = new SyncPoint(); this.syncPointTree_ = this.syncPointTree_.set(path, syncPoint); } else { foundAncestorDefaultView = foundAncestorDefaultView || syncPoint.hasCompleteView(); serverCache = serverCache || syncPoint.getCompleteServerCache(Path.Empty); } var serverCacheComplete; if (serverCache != null) { serverCacheComplete = true; } else { serverCacheComplete = false; serverCache = ChildrenNode.EMPTY_NODE; var subtree = this.syncPointTree_.subtree(path); subtree.foreachChild(function (childName, childSyncPoint) { var completeCache = childSyncPoint.getCompleteServerCache(Path.Empty); if (completeCache) { serverCache = serverCache.updateImmediateChild(childName, completeCache); } }); } var viewAlreadyExists = syncPoint.viewExistsForQuery(query); if (!viewAlreadyExists && !query.getQueryParams().loadsAllData()) { // We need to track a tag for this query var queryKey = SyncTree.makeQueryKey_(query); util.assert(!(queryKey in this.queryToTagMap_), 'View does not exist, but we have a tag'); var tag = SyncTree.getNextQueryTag_(); this.queryToTagMap_[queryKey] = tag; // Coerce to string to avoid sparse arrays. this.tagToQueryMap_['_' + tag] = queryKey; } var writesCache = this.pendingWriteTree_.childWrites(path); var events = syncPoint.addEventRegistration(query, eventRegistration, writesCache, serverCache, serverCacheComplete); if (!viewAlreadyExists && !foundAncestorDefaultView) { var view /** @type !View */ = syncPoint.viewForQuery(query); events = events.concat(this.setupListener_(query, view)); } return events; }; /** * Remove event callback(s). * * If query is the default query, we'll check all queries for the specified eventRegistration. * If eventRegistration is null, we'll remove all callbacks for the specified query/queries. * * @param {!Query} query * @param {?EventRegistration} eventRegistration If null, all callbacks are removed. * @param {Error=} cancelError If a cancelError is provided, appropriate cancel events will be returned. * @return {!Array.} Cancel events, if cancelError was provided. */ SyncTree.prototype.removeEventRegistration = function (query, eventRegistration, cancelError) { var _this = this; // Find the syncPoint first. Then deal with whether or not it has matching listeners var path = query.path; var maybeSyncPoint = this.syncPointTree_.get(path); var cancelEvents = []; // A removal on a default query affects all queries at that location. A removal on an indexed query, even one without // other query constraints, does *not* affect all queries at that location. So this check must be for 'default', and // not loadsAllData(). if (maybeSyncPoint && (query.queryIdentifier() === 'default' || maybeSyncPoint.viewExistsForQuery(query))) { /** * @type {{removed: !Array., events: !Array.}} */ var removedAndEvents = maybeSyncPoint.removeEventRegistration(query, eventRegistration, cancelError); if (maybeSyncPoint.isEmpty()) { this.syncPointTree_ = this.syncPointTree_.remove(path); } var removed = removedAndEvents.removed; cancelEvents = removedAndEvents.events; // We may have just removed one of many listeners and can short-circuit this whole process // We may also not have removed a default listener, in which case all of the descendant listeners should already be // properly set up. // // Since indexed queries can shadow if they don't have other query constraints, check for loadsAllData(), instead of // queryId === 'default' var removingDefault = -1 !== removed.findIndex(function (query) { return query.getQueryParams().loadsAllData(); }); var covered = this.syncPointTree_.findOnPath(path, function (relativePath, parentSyncPoint) { return parentSyncPoint.hasCompleteView(); }); if (removingDefault && !covered) { var subtree = this.syncPointTree_.subtree(path); // There are potentially child listeners. Determine what if any listens we need to send before executing the // removal if (!subtree.isEmpty()) { // We need to fold over our subtree and collect the listeners to send var newViews = this.collectDistinctViewsForSubTree_(subtree); // Ok, we've collected all the listens we need. Set them up. for (var i = 0; i < newViews.length; ++i) { var view = newViews[i], newQuery = view.getQuery(); var listener = this.createListenerForView_(view); this.listenProvider_.startListening(SyncTree.queryForListening_(newQuery), this.tagForQuery_(newQuery), listener.hashFn, listener.onComplete); } } else { // There's nothing below us, so nothing we need to start listening on } } // If we removed anything and we're not covered by a higher up listen, we need to stop listening on this query // The above block has us covered in terms of making sure we're set up on listens lower in the tree. // Also, note that if we have a cancelError, it's already been removed at the provider level. if (!covered && removed.length > 0 && !cancelError) { // If we removed a default, then we weren't listening on any of the other queries here. Just cancel the one // default. Otherwise, we need to iterate through and cancel each individual query if (removingDefault) { // We don't tag default listeners var defaultTag = null; this.listenProvider_.stopListening(SyncTree.queryForListening_(query), defaultTag); } else { removed.forEach(function (queryToRemove) { var tagToRemove = _this.queryToTagMap_[SyncTree.makeQueryKey_(queryToRemove)]; _this.listenProvider_.stopListening(SyncTree.queryForListening_(queryToRemove), tagToRemove); }); } } // Now, clear all of the tags we're tracking for the removed listens this.removeTags_(removed); } else { // No-op, this listener must've been already removed } return cancelEvents; }; /** * Returns a complete cache, if we have one, of the data at a particular path. The location must have a listener above * it, but as this is only used by transaction code, that should always be the case anyways. * * Note: this method will *include* hidden writes from transaction with applyLocally set to false. * @param {!Path} path The path to the data we want * @param {Array.=} writeIdsToExclude A specific set to be excluded * @return {?Node} */ SyncTree.prototype.calcCompleteEventCache = function (path, writeIdsToExclude) { var includeHiddenSets = true; var writeTree = this.pendingWriteTree_; var serverCache = this.syncPointTree_.findOnPath(path, function (pathSoFar, syncPoint) { var relativePath = Path.relativePath(pathSoFar, path); var serverCache = syncPoint.getCompleteServerCache(relativePath); if (serverCache) { return serverCache; } }); return writeTree.calcCompleteEventCache(path, serverCache, writeIdsToExclude, includeHiddenSets); }; /** * This collapses multiple unfiltered views into a single view, since we only need a single * listener for them. * * @param {!ImmutableTree.} subtree * @return {!Array.} * @private */ SyncTree.prototype.collectDistinctViewsForSubTree_ = function (subtree) { return subtree.fold(function (relativePath, maybeChildSyncPoint, childMap) { if (maybeChildSyncPoint && maybeChildSyncPoint.hasCompleteView()) { var completeView = maybeChildSyncPoint.getCompleteView(); return [completeView]; } else { // No complete view here, flatten any deeper listens into an array var views_1 = []; if (maybeChildSyncPoint) { views_1 = maybeChildSyncPoint.getQueryViews(); } util.forEach(childMap, function (key, childViews) { views_1 = views_1.concat(childViews); }); return views_1; } }); }; /** * @param {!Array.} queries * @private */ SyncTree.prototype.removeTags_ = function (queries) { for (var j = 0; j < queries.length; ++j) { var removedQuery = queries[j]; if (!removedQuery.getQueryParams().loadsAllData()) { // We should have a tag for this var removedQueryKey = SyncTree.makeQueryKey_(removedQuery); var removedQueryTag = this.queryToTagMap_[removedQueryKey]; delete this.queryToTagMap_[removedQueryKey]; delete this.tagToQueryMap_['_' + removedQueryTag]; } } }; /** * Normalizes a query to a query we send the server for listening * @param {!Query} query * @return {!Query} The normalized query * @private */ SyncTree.queryForListening_ = function (query) { if (query.getQueryParams().loadsAllData() && !query.getQueryParams().isDefault()) { // We treat queries that load all data as default queries // Cast is necessary because ref() technically returns Firebase which is actually fb.api.Firebase which inherits // from Query return /** @type {!Query} */ query.getRef(); } else { return query; } }; /** * For a given new listen, manage the de-duplication of outstanding subscriptions. * * @param {!Query} query * @param {!View} view * @return {!Array.} This method can return events to support synchronous data sources * @private */ SyncTree.prototype.setupListener_ = function (query, view) { var path = query.path; var tag = this.tagForQuery_(query); var listener = this.createListenerForView_(view); var events = this.listenProvider_.startListening(SyncTree.queryForListening_(query), tag, listener.hashFn, listener.onComplete); var subtree = this.syncPointTree_.subtree(path); // The root of this subtree has our query. We're here because we definitely need to send a listen for that, but we // may need to shadow other listens as well. if (tag) { util.assert(!subtree.value.hasCompleteView(), "If we're adding a query, it shouldn't be shadowed"); } else { // Shadow everything at or below this location, this is a default listener. var queriesToStop = subtree.fold(function (relativePath, maybeChildSyncPoint, childMap) { if (!relativePath.isEmpty() && maybeChildSyncPoint && maybeChildSyncPoint.hasCompleteView()) { return [maybeChildSyncPoint.getCompleteView().getQuery()]; } else { // No default listener here, flatten any deeper queries into an array var queries_1 = []; if (maybeChildSyncPoint) { queries_1 = queries_1.concat(maybeChildSyncPoint.getQueryViews().map(function (view) { return view.getQuery(); })); } util.forEach(childMap, function (key, childQueries) { queries_1 = queries_1.concat(childQueries); }); return queries_1; } }); for (var i = 0; i < queriesToStop.length; ++i) { var queryToStop = queriesToStop[i]; this.listenProvider_.stopListening(SyncTree.queryForListening_(queryToStop), this.tagForQuery_(queryToStop)); } } return events; }; /** * * @param {!View} view * @return {{hashFn: function(), onComplete: function(!string, *)}} * @private */ SyncTree.prototype.createListenerForView_ = function (view) { var _this = this; var query = view.getQuery(); var tag = this.tagForQuery_(query); return { hashFn: function () { var cache = view.getServerCache() || ChildrenNode.EMPTY_NODE; return cache.hash(); }, onComplete: function (status) { if (status === 'ok') { if (tag) { return _this.applyTaggedListenComplete(query.path, tag); } else { return _this.applyListenComplete(query.path); } } else { // If a listen failed, kill all of the listeners here, not just the one that triggered the error. // Note that this may need to be scoped to just this listener if we change permissions on filtered children var error$$1 = errorForServerCode(status, query); return _this.removeEventRegistration(query, /*eventRegistration*/ null, error$$1); } } }; }; /** * Given a query, computes a "queryKey" suitable for use in our queryToTagMap_. * @private * @param {!Query} query * @return {string} */ SyncTree.makeQueryKey_ = function (query) { return query.path.toString() + '$' + query.queryIdentifier(); }; /** * Given a queryKey (created by makeQueryKey), parse it back into a path and queryId. * @private * @param {!string} queryKey * @return {{queryId: !string, path: !Path}} */ SyncTree.parseQueryKey_ = function (queryKey) { var splitIndex = queryKey.indexOf('$'); util.assert(splitIndex !== -1 && splitIndex < queryKey.length - 1, 'Bad queryKey.'); return { queryId: queryKey.substr(splitIndex + 1), path: new Path(queryKey.substr(0, splitIndex)) }; }; /** * Return the query associated with the given tag, if we have one * @param {!number} tag * @return {?string} * @private */ SyncTree.prototype.queryKeyForTag_ = function (tag) { return this.tagToQueryMap_['_' + tag]; }; /** * Return the tag associated with the given query. * @param {!Query} query * @return {?number} * @private */ SyncTree.prototype.tagForQuery_ = function (query) { var queryKey = SyncTree.makeQueryKey_(query); return util.safeGet(this.queryToTagMap_, queryKey); }; /** * Static accessor for query tags. * @return {number} * @private */ SyncTree.getNextQueryTag_ = function () { return SyncTree.nextQueryTag_++; }; /** * A helper method to apply tagged operations * * @param {!Path} queryPath * @param {!Operation} operation * @return {!Array.} * @private */ SyncTree.prototype.applyTaggedOperation_ = function (queryPath, operation) { var syncPoint = this.syncPointTree_.get(queryPath); util.assert(syncPoint, "Missing sync point for query tag that we're tracking"); var writesCache = this.pendingWriteTree_.childWrites(queryPath); return syncPoint.applyOperation(operation, writesCache, /*serverCache=*/ null); }; /** * A helper method that visits all descendant and ancestor SyncPoints, applying the operation. * * NOTES: * - Descendant SyncPoints will be visited first (since we raise events depth-first). * - We call applyOperation() on each SyncPoint passing three things: * 1. A version of the Operation that has been made relative to the SyncPoint location. * 2. A WriteTreeRef of any writes we have cached at the SyncPoint location. * 3. A snapshot Node with cached server data, if we have it. * - We concatenate all of the events returned by each SyncPoint and return the result. * * @param {!Operation} operation * @return {!Array.} * @private */ SyncTree.prototype.applyOperationToSyncPoints_ = function (operation) { return this.applyOperationHelper_(operation, this.syncPointTree_, /*serverCache=*/ null, this.pendingWriteTree_.childWrites(Path.Empty)); }; /** * Recursive helper for applyOperationToSyncPoints_ * * @private * @param {!Operation} operation * @param {ImmutableTree.} syncPointTree * @param {?Node} serverCache * @param {!WriteTreeRef} writesCache * @return {!Array.} */ SyncTree.prototype.applyOperationHelper_ = function (operation, syncPointTree, serverCache, writesCache) { if (operation.path.isEmpty()) { return this.applyOperationDescendantsHelper_(operation, syncPointTree, serverCache, writesCache); } else { var syncPoint = syncPointTree.get(Path.Empty); // If we don't have cached server data, see if we can get it from this SyncPoint. if (serverCache == null && syncPoint != null) { serverCache = syncPoint.getCompleteServerCache(Path.Empty); } var events = []; var childName = operation.path.getFront(); var childOperation = operation.operationForChild(childName); var childTree = syncPointTree.children.get(childName); if (childTree && childOperation) { var childServerCache = serverCache ? serverCache.getImmediateChild(childName) : null; var childWritesCache = writesCache.child(childName); events = events.concat(this.applyOperationHelper_(childOperation, childTree, childServerCache, childWritesCache)); } if (syncPoint) { events = events.concat(syncPoint.applyOperation(operation, writesCache, serverCache)); } return events; } }; /** * Recursive helper for applyOperationToSyncPoints_ * * @private * @param {!Operation} operation * @param {ImmutableTree.} syncPointTree * @param {?Node} serverCache * @param {!WriteTreeRef} writesCache * @return {!Array.} */ SyncTree.prototype.applyOperationDescendantsHelper_ = function (operation, syncPointTree, serverCache, writesCache) { var _this = this; var syncPoint = syncPointTree.get(Path.Empty); // If we don't have cached server data, see if we can get it from this SyncPoint. if (serverCache == null && syncPoint != null) { serverCache = syncPoint.getCompleteServerCache(Path.Empty); } var events = []; syncPointTree.children.inorderTraversal(function (childName, childTree) { var childServerCache = serverCache ? serverCache.getImmediateChild(childName) : null; var childWritesCache = writesCache.child(childName); var childOperation = operation.operationForChild(childName); if (childOperation) { events = events.concat(_this.applyOperationDescendantsHelper_(childOperation, childTree, childServerCache, childWritesCache)); } }); if (syncPoint) { events = events.concat(syncPoint.applyOperation(operation, writesCache, serverCache)); } return events; }; /** * Static tracker for next query tag. * @type {number} * @private */ SyncTree.nextQueryTag_ = 1; return SyncTree; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Mutable object which basically just stores a reference to the "latest" immutable snapshot. * * @constructor */ var SnapshotHolder = /** @class */ (function () { function SnapshotHolder() { this.rootNode_ = ChildrenNode.EMPTY_NODE; } SnapshotHolder.prototype.getNode = function (path) { return this.rootNode_.getChild(path); }; SnapshotHolder.prototype.updateSnapshot = function (path, newSnapshotNode) { this.rootNode_ = this.rootNode_.updateChild(path, newSnapshotNode); }; return SnapshotHolder; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Abstraction around FirebaseApp's token fetching capabilities. */ var AuthTokenProvider = /** @class */ (function () { /** * @param {!FirebaseApp} app_ */ function AuthTokenProvider(app_) { this.app_ = app_; } /** * @param {boolean} forceRefresh * @return {!Promise} */ AuthTokenProvider.prototype.getToken = function (forceRefresh) { return this.app_['INTERNAL']['getToken'](forceRefresh).then(null, // .catch function (error$$1) { // TODO: Need to figure out all the cases this is raised and whether // this makes sense. if (error$$1 && error$$1.code === 'auth/token-not-initialized') { log('Got auth/token-not-initialized error. Treating as null token.'); return null; } else { return Promise.reject(error$$1); } }); }; AuthTokenProvider.prototype.addTokenChangeListener = function (listener) { // TODO: We might want to wrap the listener and call it with no args to // avoid a leaky abstraction, but that makes removing the listener harder. this.app_['INTERNAL']['addAuthTokenListener'](listener); }; AuthTokenProvider.prototype.removeTokenChangeListener = function (listener) { this.app_['INTERNAL']['removeAuthTokenListener'](listener); }; AuthTokenProvider.prototype.notifyForInvalidToken = function () { var errorMessage = 'Provided authentication credentials for the app named "' + this.app_.name + '" are invalid. This usually indicates your app was not ' + 'initialized correctly. '; if ('credential' in this.app_.options) { errorMessage += 'Make sure the "credential" property provided to initializeApp() ' + 'is authorized to access the specified "databaseURL" and is from the correct ' + 'project.'; } else if ('serviceAccount' in this.app_.options) { errorMessage += 'Make sure the "serviceAccount" property provided to initializeApp() ' + 'is authorized to access the specified "databaseURL" and is from the correct ' + 'project.'; } else { errorMessage += 'Make sure the "apiKey" and "databaseURL" properties provided to ' + 'initializeApp() match the values provided for your app at ' + 'https://console.firebase.google.com/.'; } warn(errorMessage); }; return AuthTokenProvider; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Tracks a collection of stats. * * @constructor */ var StatsCollection = /** @class */ (function () { function StatsCollection() { this.counters_ = {}; } StatsCollection.prototype.incrementCounter = function (name, amount) { if (amount === void 0) { amount = 1; } if (!util.contains(this.counters_, name)) this.counters_[name] = 0; this.counters_[name] += amount; }; StatsCollection.prototype.get = function () { return util.deepCopy(this.counters_); }; return StatsCollection; }()); /** * Copyright 2017 Google Inc. * * 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. */ var StatsManager = /** @class */ (function () { function StatsManager() { } StatsManager.getCollection = function (repoInfo) { var hashString = repoInfo.toString(); if (!this.collections_[hashString]) { this.collections_[hashString] = new StatsCollection(); } return this.collections_[hashString]; }; StatsManager.getOrCreateReporter = function (repoInfo, creatorFunction) { var hashString = repoInfo.toString(); if (!this.reporters_[hashString]) { this.reporters_[hashString] = creatorFunction(); } return this.reporters_[hashString]; }; StatsManager.collections_ = {}; StatsManager.reporters_ = {}; return StatsManager; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Returns the delta from the previous call to get stats. * * @param collection_ The collection to "listen" to. * @constructor */ var StatsListener = /** @class */ (function () { function StatsListener(collection_) { this.collection_ = collection_; this.last_ = null; } StatsListener.prototype.get = function () { var newStats = this.collection_.get(); var delta = util.clone(newStats); if (this.last_) { util.forEach(this.last_, function (stat, value) { delta[stat] = delta[stat] - value; }); } this.last_ = newStats; return delta; }; return StatsListener; }()); /** * Copyright 2017 Google Inc. * * 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. */ // Assuming some apps may have a short amount of time on page, and a bulk of firebase operations probably // happen on page load, we try to report our first set of stats pretty quickly, but we wait at least 10 // seconds to try to ensure the Firebase connection is established / settled. var FIRST_STATS_MIN_TIME = 10 * 1000; var FIRST_STATS_MAX_TIME = 30 * 1000; // We'll continue to report stats on average every 5 minutes. var REPORT_STATS_INTERVAL = 5 * 60 * 1000; /** * @constructor */ var StatsReporter = /** @class */ (function () { /** * @param collection * @param server_ */ function StatsReporter(collection, server_) { this.server_ = server_; this.statsToReport_ = {}; this.statsListener_ = new StatsListener(collection); var timeout = FIRST_STATS_MIN_TIME + (FIRST_STATS_MAX_TIME - FIRST_STATS_MIN_TIME) * Math.random(); setTimeoutNonBlocking(this.reportStats_.bind(this), Math.floor(timeout)); } StatsReporter.prototype.includeStat = function (stat) { this.statsToReport_[stat] = true; }; StatsReporter.prototype.reportStats_ = function () { var _this = this; var stats = this.statsListener_.get(); var reportedStats = {}; var haveStatsToReport = false; util.forEach(stats, function (stat, value) { if (value > 0 && util.contains(_this.statsToReport_, stat)) { reportedStats[stat] = value; haveStatsToReport = true; } }); if (haveStatsToReport) { this.server_.reportStats(reportedStats); } // queue our next run. setTimeoutNonBlocking(this.reportStats_.bind(this), Math.floor(Math.random() * 2 * REPORT_STATS_INTERVAL)); }; return StatsReporter; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * The event queue serves a few purposes: * 1. It ensures we maintain event order in the face of event callbacks doing operations that result in more * events being queued. * 2. raiseQueuedEvents() handles being called reentrantly nicely. That is, if in the course of raising events, * raiseQueuedEvents() is called again, the "inner" call will pick up raising events where the "outer" call * left off, ensuring that the events are still raised synchronously and in order. * 3. You can use raiseEventsAtPath and raiseEventsForChangedPath to ensure only relevant previously-queued * events are raised synchronously. * * NOTE: This can all go away if/when we move to async events. * * @constructor */ var EventQueue = /** @class */ (function () { function EventQueue() { /** * @private * @type {!Array.} */ this.eventLists_ = []; /** * Tracks recursion depth of raiseQueuedEvents_, for debugging purposes. * @private * @type {!number} */ this.recursionDepth_ = 0; } /** * @param {!Array.} eventDataList The new events to queue. */ EventQueue.prototype.queueEvents = function (eventDataList) { // We group events by path, storing them in a single EventList, to make it easier to skip over them quickly. var currList = null; for (var i = 0; i < eventDataList.length; i++) { var eventData = eventDataList[i]; var eventPath = eventData.getPath(); if (currList !== null && !eventPath.equals(currList.getPath())) { this.eventLists_.push(currList); currList = null; } if (currList === null) { currList = new EventList(eventPath); } currList.add(eventData); } if (currList) { this.eventLists_.push(currList); } }; /** * Queues the specified events and synchronously raises all events (including previously queued ones) * for the specified path. * * It is assumed that the new events are all for the specified path. * * @param {!Path} path The path to raise events for. * @param {!Array.} eventDataList The new events to raise. */ EventQueue.prototype.raiseEventsAtPath = function (path, eventDataList) { this.queueEvents(eventDataList); this.raiseQueuedEventsMatchingPredicate_(function (eventPath) { return eventPath.equals(path); }); }; /** * Queues the specified events and synchronously raises all events (including previously queued ones) for * locations related to the specified change path (i.e. all ancestors and descendants). * * It is assumed that the new events are all related (ancestor or descendant) to the specified path. * * @param {!Path} changedPath The path to raise events for. * @param {!Array.} eventDataList The events to raise */ EventQueue.prototype.raiseEventsForChangedPath = function (changedPath, eventDataList) { this.queueEvents(eventDataList); this.raiseQueuedEventsMatchingPredicate_(function (eventPath) { return eventPath.contains(changedPath) || changedPath.contains(eventPath); }); }; /** * @param {!function(!Path):boolean} predicate * @private */ EventQueue.prototype.raiseQueuedEventsMatchingPredicate_ = function (predicate) { this.recursionDepth_++; var sentAll = true; for (var i = 0; i < this.eventLists_.length; i++) { var eventList = this.eventLists_[i]; if (eventList) { var eventPath = eventList.getPath(); if (predicate(eventPath)) { this.eventLists_[i].raise(); this.eventLists_[i] = null; } else { sentAll = false; } } } if (sentAll) { this.eventLists_ = []; } this.recursionDepth_--; }; return EventQueue; }()); /** * @param {!Path} path * @constructor */ var EventList = /** @class */ (function () { function EventList(path_) { this.path_ = path_; /** * @type {!Array.} * @private */ this.events_ = []; } /** * @param {!Event} eventData */ EventList.prototype.add = function (eventData) { this.events_.push(eventData); }; /** * Iterates through the list and raises each event */ EventList.prototype.raise = function () { for (var i = 0; i < this.events_.length; i++) { var eventData = this.events_[i]; if (eventData !== null) { this.events_[i] = null; var eventFn = eventData.getEventRunner(); if (logger$1) { log('event: ' + eventData.toString()); } exceptionGuard(eventFn); } } }; /** * @return {!Path} */ EventList.prototype.getPath = function () { return this.path_; }; return EventList; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Base class to be used if you want to emit events. Call the constructor with * the set of allowed event names. */ var EventEmitter = /** @class */ (function () { /** * @param {!Array.} allowedEvents_ */ function EventEmitter(allowedEvents_) { this.allowedEvents_ = allowedEvents_; this.listeners_ = {}; util.assert(Array.isArray(allowedEvents_) && allowedEvents_.length > 0, 'Requires a non-empty array'); } /** * To be called by derived classes to trigger events. * @param {!string} eventType * @param {...*} var_args */ EventEmitter.prototype.trigger = function (eventType) { var var_args = []; for (var _i = 1; _i < arguments.length; _i++) { var_args[_i - 1] = arguments[_i]; } if (Array.isArray(this.listeners_[eventType])) { // Clone the list, since callbacks could add/remove listeners. var listeners = this.listeners_[eventType].slice(); for (var i = 0; i < listeners.length; i++) { listeners[i].callback.apply(listeners[i].context, var_args); } } }; EventEmitter.prototype.on = function (eventType, callback, context) { this.validateEventType_(eventType); this.listeners_[eventType] = this.listeners_[eventType] || []; this.listeners_[eventType].push({ callback: callback, context: context }); var eventData = this.getInitialEvent(eventType); if (eventData) { callback.apply(context, eventData); } }; EventEmitter.prototype.off = function (eventType, callback, context) { this.validateEventType_(eventType); var listeners = this.listeners_[eventType] || []; for (var i = 0; i < listeners.length; i++) { if (listeners[i].callback === callback && (!context || context === listeners[i].context)) { listeners.splice(i, 1); return; } } }; EventEmitter.prototype.validateEventType_ = function (eventType) { util.assert(this.allowedEvents_.find(function (et) { return et === eventType; }), 'Unknown event: ' + eventType); }; return EventEmitter; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @extends {EventEmitter} */ var VisibilityMonitor = /** @class */ (function (_super) { tslib_1.__extends(VisibilityMonitor, _super); function VisibilityMonitor() { var _this = _super.call(this, ['visible']) || this; var hidden; var visibilityChange; if (typeof document !== 'undefined' && typeof document.addEventListener !== 'undefined') { if (typeof document['hidden'] !== 'undefined') { // Opera 12.10 and Firefox 18 and later support visibilityChange = 'visibilitychange'; hidden = 'hidden'; } else if (typeof document['mozHidden'] !== 'undefined') { visibilityChange = 'mozvisibilitychange'; hidden = 'mozHidden'; } else if (typeof document['msHidden'] !== 'undefined') { visibilityChange = 'msvisibilitychange'; hidden = 'msHidden'; } else if (typeof document['webkitHidden'] !== 'undefined') { visibilityChange = 'webkitvisibilitychange'; hidden = 'webkitHidden'; } } // Initially, we always assume we are visible. This ensures that in browsers // without page visibility support or in cases where we are never visible // (e.g. chrome extension), we act as if we are visible, i.e. don't delay // reconnects _this.visible_ = true; if (visibilityChange) { document.addEventListener(visibilityChange, function () { var visible = !document[hidden]; if (visible !== _this.visible_) { _this.visible_ = visible; _this.trigger('visible', visible); } }, false); } return _this; } VisibilityMonitor.getInstance = function () { return new VisibilityMonitor(); }; /** * @param {!string} eventType * @return {Array.} */ VisibilityMonitor.prototype.getInitialEvent = function (eventType) { util.assert(eventType === 'visible', 'Unknown event type: ' + eventType); return [this.visible_]; }; return VisibilityMonitor; }(EventEmitter)); /** * Copyright 2017 Google Inc. * * 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. */ /** * Monitors online state (as reported by window.online/offline events). * * The expectation is that this could have many false positives (thinks we are online * when we're not), but no false negatives. So we can safely use it to determine when * we definitely cannot reach the internet. * * @extends {EventEmitter} */ var OnlineMonitor = /** @class */ (function (_super) { tslib_1.__extends(OnlineMonitor, _super); function OnlineMonitor() { var _this = _super.call(this, ['online']) || this; _this.online_ = true; // We've had repeated complaints that Cordova apps can get stuck "offline", e.g. // https://forum.ionicframework.com/t/firebase-connection-is-lost-and-never-come-back/43810 // It would seem that the 'online' event does not always fire consistently. So we disable it // for Cordova. if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined' && !util.isMobileCordova()) { window.addEventListener('online', function () { if (!_this.online_) { _this.online_ = true; _this.trigger('online', true); } }, false); window.addEventListener('offline', function () { if (_this.online_) { _this.online_ = false; _this.trigger('online', false); } }, false); } return _this; } OnlineMonitor.getInstance = function () { return new OnlineMonitor(); }; /** * @param {!string} eventType * @return {Array.} */ OnlineMonitor.prototype.getInitialEvent = function (eventType) { util.assert(eventType === 'online', 'Unknown event type: ' + eventType); return [this.online_]; }; /** * @return {boolean} */ OnlineMonitor.prototype.currentlyOnline = function () { return this.online_; }; return OnlineMonitor; }(EventEmitter)); /** * Copyright 2017 Google Inc. * * 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. */ /** * This class ensures the packets from the server arrive in order * This class takes data from the server and ensures it gets passed into the callbacks in order. * @constructor */ var PacketReceiver = /** @class */ (function () { /** * @param onMessage_ */ function PacketReceiver(onMessage_) { this.onMessage_ = onMessage_; this.pendingResponses = []; this.currentResponseNum = 0; this.closeAfterResponse = -1; this.onClose = null; } PacketReceiver.prototype.closeAfter = function (responseNum, callback) { this.closeAfterResponse = responseNum; this.onClose = callback; if (this.closeAfterResponse < this.currentResponseNum) { this.onClose(); this.onClose = null; } }; /** * Each message from the server comes with a response number, and an array of data. The responseNumber * allows us to ensure that we process them in the right order, since we can't be guaranteed that all * browsers will respond in the same order as the requests we sent * @param {number} requestNum * @param {Array} data */ PacketReceiver.prototype.handleResponse = function (requestNum, data) { var _this = this; this.pendingResponses[requestNum] = data; var _loop_1 = function () { var toProcess = this_1.pendingResponses[this_1.currentResponseNum]; delete this_1.pendingResponses[this_1.currentResponseNum]; var _loop_2 = function (i) { if (toProcess[i]) { exceptionGuard(function () { _this.onMessage_(toProcess[i]); }); } }; for (var i = 0; i < toProcess.length; ++i) { _loop_2(i); } if (this_1.currentResponseNum === this_1.closeAfterResponse) { if (this_1.onClose) { this_1.onClose(); this_1.onClose = null; } return "break"; } this_1.currentResponseNum++; }; var this_1 = this; while (this.pendingResponses[this.currentResponseNum]) { var state_1 = _loop_1(); if (state_1 === "break") break; } }; return PacketReceiver; }()); /** * Copyright 2017 Google Inc. * * 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. */ // URL query parameters associated with longpolling var FIREBASE_LONGPOLL_START_PARAM = 'start'; var FIREBASE_LONGPOLL_CLOSE_COMMAND = 'close'; var FIREBASE_LONGPOLL_COMMAND_CB_NAME = 'pLPCommand'; var FIREBASE_LONGPOLL_DATA_CB_NAME = 'pRTLPCB'; var FIREBASE_LONGPOLL_ID_PARAM = 'id'; var FIREBASE_LONGPOLL_PW_PARAM = 'pw'; var FIREBASE_LONGPOLL_SERIAL_PARAM = 'ser'; var FIREBASE_LONGPOLL_CALLBACK_ID_PARAM = 'cb'; var FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM = 'seg'; var FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET = 'ts'; var FIREBASE_LONGPOLL_DATA_PARAM = 'd'; var FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM = 'disconn'; var FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM = 'dframe'; //Data size constants. //TODO: Perf: the maximum length actually differs from browser to browser. // We should check what browser we're on and set accordingly. var MAX_URL_DATA_SIZE = 1870; var SEG_HEADER_SIZE = 30; //ie: &seg=8299234&ts=982389123&d= var MAX_PAYLOAD_SIZE = MAX_URL_DATA_SIZE - SEG_HEADER_SIZE; /** * Keepalive period * send a fresh request at minimum every 25 seconds. Opera has a maximum request * length of 30 seconds that we can't exceed. * @const * @type {number} */ var KEEPALIVE_REQUEST_INTERVAL = 25000; /** * How long to wait before aborting a long-polling connection attempt. * @const * @type {number} */ var LP_CONNECT_TIMEOUT = 30000; /** * This class manages a single long-polling connection. * * @constructor * @implements {Transport} */ var BrowserPollConnection = /** @class */ (function () { /** * @param {string} connId An identifier for this connection, used for logging * @param {RepoInfo} repoInfo The info for the endpoint to send data to. * @param {string=} transportSessionId Optional transportSessionid if we are reconnecting for an existing * transport session * @param {string=} lastSessionId Optional lastSessionId if the PersistentConnection has already created a * connection previously */ function BrowserPollConnection(connId, repoInfo, transportSessionId, lastSessionId) { this.connId = connId; this.repoInfo = repoInfo; this.transportSessionId = transportSessionId; this.lastSessionId = lastSessionId; this.bytesSent = 0; this.bytesReceived = 0; this.everConnected_ = false; this.log_ = logWrapper(connId); this.stats_ = StatsManager.getCollection(repoInfo); this.urlFn = function (params) { return repoInfo.connectionURL(LONG_POLLING, params); }; } /** * * @param {function(Object)} onMessage Callback when messages arrive * @param {function()} onDisconnect Callback with connection lost. */ BrowserPollConnection.prototype.open = function (onMessage, onDisconnect) { var _this = this; this.curSegmentNum = 0; this.onDisconnect_ = onDisconnect; this.myPacketOrderer = new PacketReceiver(onMessage); this.isClosed_ = false; this.connectTimeoutTimer_ = setTimeout(function () { _this.log_('Timed out trying to connect.'); // Make sure we clear the host cache _this.onClosed_(); _this.connectTimeoutTimer_ = null; }, Math.floor(LP_CONNECT_TIMEOUT)); // Ensure we delay the creation of the iframe until the DOM is loaded. executeWhenDOMReady(function () { if (_this.isClosed_) return; //Set up a callback that gets triggered once a connection is set up. _this.scriptTagHolder = new FirebaseIFrameScriptHolder(function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var command = args[0], arg1 = args[1], arg2 = args[2]; _this.incrementIncomingBytes_(args); if (!_this.scriptTagHolder) return; // we closed the connection. if (_this.connectTimeoutTimer_) { clearTimeout(_this.connectTimeoutTimer_); _this.connectTimeoutTimer_ = null; } _this.everConnected_ = true; if (command == FIREBASE_LONGPOLL_START_PARAM) { _this.id = arg1; _this.password = arg2; } else if (command === FIREBASE_LONGPOLL_CLOSE_COMMAND) { // Don't clear the host cache. We got a response from the server, so we know it's reachable if (arg1) { // We aren't expecting any more data (other than what the server's already in the process of sending us // through our already open polls), so don't send any more. _this.scriptTagHolder.sendNewPolls = false; // arg1 in this case is the last response number sent by the server. We should try to receive // all of the responses up to this one before closing _this.myPacketOrderer.closeAfter(arg1, function () { _this.onClosed_(); }); } else { _this.onClosed_(); } } else { throw new Error('Unrecognized command received: ' + command); } }, function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var pN = args[0], data = args[1]; _this.incrementIncomingBytes_(args); _this.myPacketOrderer.handleResponse(pN, data); }, function () { _this.onClosed_(); }, _this.urlFn); //Send the initial request to connect. The serial number is simply to keep the browser from pulling previous results //from cache. var urlParams = {}; urlParams[FIREBASE_LONGPOLL_START_PARAM] = 't'; urlParams[FIREBASE_LONGPOLL_SERIAL_PARAM] = Math.floor(Math.random() * 100000000); if (_this.scriptTagHolder.uniqueCallbackIdentifier) urlParams[FIREBASE_LONGPOLL_CALLBACK_ID_PARAM] = _this.scriptTagHolder.uniqueCallbackIdentifier; urlParams[VERSION_PARAM] = PROTOCOL_VERSION; if (_this.transportSessionId) { urlParams[TRANSPORT_SESSION_PARAM] = _this.transportSessionId; } if (_this.lastSessionId) { urlParams[LAST_SESSION_PARAM] = _this.lastSessionId; } if (!util.isNodeSdk() && typeof location !== 'undefined' && location.href && location.href.indexOf(FORGE_DOMAIN) !== -1) { urlParams[REFERER_PARAM] = FORGE_REF; } var connectURL = _this.urlFn(urlParams); _this.log_('Connecting via long-poll to ' + connectURL); _this.scriptTagHolder.addTag(connectURL, function () { /* do nothing */ }); }); }; /** * Call this when a handshake has completed successfully and we want to consider the connection established */ BrowserPollConnection.prototype.start = function () { this.scriptTagHolder.startLongPoll(this.id, this.password); this.addDisconnectPingFrame(this.id, this.password); }; /** * Forces long polling to be considered as a potential transport */ BrowserPollConnection.forceAllow = function () { BrowserPollConnection.forceAllow_ = true; }; /** * Forces longpolling to not be considered as a potential transport */ BrowserPollConnection.forceDisallow = function () { BrowserPollConnection.forceDisallow_ = true; }; // Static method, use string literal so it can be accessed in a generic way BrowserPollConnection.isAvailable = function () { // NOTE: In React-Native there's normally no 'document', but if you debug a React-Native app in // the Chrome debugger, 'document' is defined, but document.createElement is null (2015/06/08). return (BrowserPollConnection.forceAllow_ || (!BrowserPollConnection.forceDisallow_ && typeof document !== 'undefined' && document.createElement != null && !isChromeExtensionContentScript() && !isWindowsStoreApp() && !util.isNodeSdk())); }; /** * No-op for polling */ BrowserPollConnection.prototype.markConnectionHealthy = function () { }; /** * Stops polling and cleans up the iframe * @private */ BrowserPollConnection.prototype.shutdown_ = function () { this.isClosed_ = true; if (this.scriptTagHolder) { this.scriptTagHolder.close(); this.scriptTagHolder = null; } //remove the disconnect frame, which will trigger an XHR call to the server to tell it we're leaving. if (this.myDisconnFrame) { document.body.removeChild(this.myDisconnFrame); this.myDisconnFrame = null; } if (this.connectTimeoutTimer_) { clearTimeout(this.connectTimeoutTimer_); this.connectTimeoutTimer_ = null; } }; /** * Triggered when this transport is closed * @private */ BrowserPollConnection.prototype.onClosed_ = function () { if (!this.isClosed_) { this.log_('Longpoll is closing itself'); this.shutdown_(); if (this.onDisconnect_) { this.onDisconnect_(this.everConnected_); this.onDisconnect_ = null; } } }; /** * External-facing close handler. RealTime has requested we shut down. Kill our connection and tell the server * that we've left. */ BrowserPollConnection.prototype.close = function () { if (!this.isClosed_) { this.log_('Longpoll is being closed.'); this.shutdown_(); } }; /** * Send the JSON object down to the server. It will need to be stringified, base64 encoded, and then * broken into chunks (since URLs have a small maximum length). * @param {!Object} data The JSON data to transmit. */ BrowserPollConnection.prototype.send = function (data) { var dataStr = util.stringify(data); this.bytesSent += dataStr.length; this.stats_.incrementCounter('bytes_sent', dataStr.length); //first, lets get the base64-encoded data var base64data = util.base64Encode(dataStr); //We can only fit a certain amount in each URL, so we need to split this request //up into multiple pieces if it doesn't fit in one request. var dataSegs = splitStringBySize(base64data, MAX_PAYLOAD_SIZE); //Enqueue each segment for transmission. We assign each chunk a sequential ID and a total number //of segments so that we can reassemble the packet on the server. for (var i = 0; i < dataSegs.length; i++) { this.scriptTagHolder.enqueueSegment(this.curSegmentNum, dataSegs.length, dataSegs[i]); this.curSegmentNum++; } }; /** * This is how we notify the server that we're leaving. * We aren't able to send requests with DHTML on a window close event, but we can * trigger XHR requests in some browsers (everything but Opera basically). * @param {!string} id * @param {!string} pw */ BrowserPollConnection.prototype.addDisconnectPingFrame = function (id, pw) { if (util.isNodeSdk()) return; this.myDisconnFrame = document.createElement('iframe'); var urlParams = {}; urlParams[FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM] = 't'; urlParams[FIREBASE_LONGPOLL_ID_PARAM] = id; urlParams[FIREBASE_LONGPOLL_PW_PARAM] = pw; this.myDisconnFrame.src = this.urlFn(urlParams); this.myDisconnFrame.style.display = 'none'; document.body.appendChild(this.myDisconnFrame); }; /** * Used to track the bytes received by this client * @param {*} args * @private */ BrowserPollConnection.prototype.incrementIncomingBytes_ = function (args) { // TODO: This is an annoying perf hit just to track the number of incoming bytes. Maybe it should be opt-in. var bytesReceived = util.stringify(args).length; this.bytesReceived += bytesReceived; this.stats_.incrementCounter('bytes_received', bytesReceived); }; return BrowserPollConnection; }()); /********************************************************************************************* * A wrapper around an iframe that is used as a long-polling script holder. * @constructor *********************************************************************************************/ var FirebaseIFrameScriptHolder = /** @class */ (function () { /** * @param commandCB - The callback to be called when control commands are recevied from the server. * @param onMessageCB - The callback to be triggered when responses arrive from the server. * @param onDisconnect - The callback to be triggered when this tag holder is closed * @param urlFn - A function that provides the URL of the endpoint to send data to. */ function FirebaseIFrameScriptHolder(commandCB, onMessageCB, onDisconnect, urlFn) { this.onDisconnect = onDisconnect; this.urlFn = urlFn; //We maintain a count of all of the outstanding requests, because if we have too many active at once it can cause //problems in some browsers. /** * @type {CountedSet.} */ this.outstandingRequests = new CountedSet(); //A queue of the pending segments waiting for transmission to the server. this.pendingSegs = []; //A serial number. We use this for two things: // 1) A way to ensure the browser doesn't cache responses to polls // 2) A way to make the server aware when long-polls arrive in a different order than we started them. The // server needs to release both polls in this case or it will cause problems in Opera since Opera can only execute // JSONP code in the order it was added to the iframe. this.currentSerial = Math.floor(Math.random() * 100000000); // This gets set to false when we're "closing down" the connection (e.g. we're switching transports but there's still // incoming data from the server that we're waiting for). this.sendNewPolls = true; if (!util.isNodeSdk()) { //Each script holder registers a couple of uniquely named callbacks with the window. These are called from the //iframes where we put the long-polling script tags. We have two callbacks: // 1) Command Callback - Triggered for control issues, like starting a connection. // 2) Message Callback - Triggered when new data arrives. this.uniqueCallbackIdentifier = LUIDGenerator(); window[FIREBASE_LONGPOLL_COMMAND_CB_NAME + this.uniqueCallbackIdentifier] = commandCB; window[FIREBASE_LONGPOLL_DATA_CB_NAME + this.uniqueCallbackIdentifier] = onMessageCB; //Create an iframe for us to add script tags to. this.myIFrame = FirebaseIFrameScriptHolder.createIFrame_(); // Set the iframe's contents. var script = ''; // if we set a javascript url, it's IE and we need to set the document domain. The javascript url is sufficient // for ie9, but ie8 needs to do it again in the document itself. if (this.myIFrame.src && this.myIFrame.src.substr(0, 'javascript:'.length) === 'javascript:') { var currentDomain = document.domain; script = ''; } var iframeContents = '' + script + ''; try { this.myIFrame.doc.open(); this.myIFrame.doc.write(iframeContents); this.myIFrame.doc.close(); } catch (e) { log('frame writing exception'); if (e.stack) { log(e.stack); } log(e); } } else { this.commandCB = commandCB; this.onMessageCB = onMessageCB; } } /** * Each browser has its own funny way to handle iframes. Here we mush them all together into one object that I can * actually use. * @private * @return {Element} */ FirebaseIFrameScriptHolder.createIFrame_ = function () { var iframe = document.createElement('iframe'); iframe.style.display = 'none'; // This is necessary in order to initialize the document inside the iframe if (document.body) { document.body.appendChild(iframe); try { // If document.domain has been modified in IE, this will throw an error, and we need to set the // domain of the iframe's document manually. We can do this via a javascript: url as the src attribute // Also note that we must do this *after* the iframe has been appended to the page. Otherwise it doesn't work. var a = iframe.contentWindow.document; if (!a) { // Apologies for the log-spam, I need to do something to keep closure from optimizing out the assignment above. log('No IE domain setting required'); } } catch (e) { var domain = document.domain; iframe.src = "javascript:void((function(){document.open();document.domain='" + domain + "';document.close();})())"; } } else { // LongPollConnection attempts to delay initialization until the document is ready, so hopefully this // never gets hit. throw 'Document body has not initialized. Wait to initialize Firebase until after the document is ready.'; } // Get the document of the iframe in a browser-specific way. if (iframe.contentDocument) { iframe.doc = iframe.contentDocument; // Firefox, Opera, Safari } else if (iframe.contentWindow) { iframe.doc = iframe.contentWindow.document; // Internet Explorer } else if (iframe.document) { iframe.doc = iframe.document; //others? } return iframe; }; /** * Cancel all outstanding queries and remove the frame. */ FirebaseIFrameScriptHolder.prototype.close = function () { var _this = this; //Mark this iframe as dead, so no new requests are sent. this.alive = false; if (this.myIFrame) { //We have to actually remove all of the html inside this iframe before removing it from the //window, or IE will continue loading and executing the script tags we've already added, which //can lead to some errors being thrown. Setting innerHTML seems to be the easiest way to do this. this.myIFrame.doc.body.innerHTML = ''; setTimeout(function () { if (_this.myIFrame !== null) { document.body.removeChild(_this.myIFrame); _this.myIFrame = null; } }, Math.floor(0)); } if (util.isNodeSdk() && this.myID) { var urlParams = {}; urlParams[FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM] = 't'; urlParams[FIREBASE_LONGPOLL_ID_PARAM] = this.myID; urlParams[FIREBASE_LONGPOLL_PW_PARAM] = this.myPW; var theURL = this.urlFn(urlParams); FirebaseIFrameScriptHolder.nodeRestRequest(theURL); } // Protect from being called recursively. var onDisconnect = this.onDisconnect; if (onDisconnect) { this.onDisconnect = null; onDisconnect(); } }; /** * Actually start the long-polling session by adding the first script tag(s) to the iframe. * @param {!string} id - The ID of this connection * @param {!string} pw - The password for this connection */ FirebaseIFrameScriptHolder.prototype.startLongPoll = function (id, pw) { this.myID = id; this.myPW = pw; this.alive = true; //send the initial request. If there are requests queued, make sure that we transmit as many as we are currently able to. while (this.newRequest_()) { } }; /** * This is called any time someone might want a script tag to be added. It adds a script tag when there aren't * too many outstanding requests and we are still alive. * * If there are outstanding packet segments to send, it sends one. If there aren't, it sends a long-poll anyways if * needed. */ FirebaseIFrameScriptHolder.prototype.newRequest_ = function () { // We keep one outstanding request open all the time to receive data, but if we need to send data // (pendingSegs.length > 0) then we create a new request to send the data. The server will automatically // close the old request. if (this.alive && this.sendNewPolls && this.outstandingRequests.count() < (this.pendingSegs.length > 0 ? 2 : 1)) { //construct our url this.currentSerial++; var urlParams = {}; urlParams[FIREBASE_LONGPOLL_ID_PARAM] = this.myID; urlParams[FIREBASE_LONGPOLL_PW_PARAM] = this.myPW; urlParams[FIREBASE_LONGPOLL_SERIAL_PARAM] = this.currentSerial; var theURL = this.urlFn(urlParams); //Now add as much data as we can. var curDataString = ''; var i = 0; while (this.pendingSegs.length > 0) { //first, lets see if the next segment will fit. var nextSeg = this.pendingSegs[0]; if (nextSeg.d.length + SEG_HEADER_SIZE + curDataString.length <= MAX_URL_DATA_SIZE) { //great, the segment will fit. Lets append it. var theSeg = this.pendingSegs.shift(); curDataString = curDataString + '&' + FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM + i + '=' + theSeg.seg + '&' + FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET + i + '=' + theSeg.ts + '&' + FIREBASE_LONGPOLL_DATA_PARAM + i + '=' + theSeg.d; i++; } else { break; } } theURL = theURL + curDataString; this.addLongPollTag_(theURL, this.currentSerial); return true; } else { return false; } }; /** * Queue a packet for transmission to the server. * @param segnum - A sequential id for this packet segment used for reassembly * @param totalsegs - The total number of segments in this packet * @param data - The data for this segment. */ FirebaseIFrameScriptHolder.prototype.enqueueSegment = function (segnum, totalsegs, data) { //add this to the queue of segments to send. this.pendingSegs.push({ seg: segnum, ts: totalsegs, d: data }); //send the data immediately if there isn't already data being transmitted, unless //startLongPoll hasn't been called yet. if (this.alive) { this.newRequest_(); } }; /** * Add a script tag for a regular long-poll request. * @param {!string} url - The URL of the script tag. * @param {!number} serial - The serial number of the request. * @private */ FirebaseIFrameScriptHolder.prototype.addLongPollTag_ = function (url, serial) { var _this = this; //remember that we sent this request. this.outstandingRequests.add(serial, 1); var doNewRequest = function () { _this.outstandingRequests.remove(serial); _this.newRequest_(); }; // If this request doesn't return on its own accord (by the server sending us some data), we'll // create a new one after the KEEPALIVE interval to make sure we always keep a fresh request open. var keepaliveTimeout = setTimeout(doNewRequest, Math.floor(KEEPALIVE_REQUEST_INTERVAL)); var readyStateCB = function () { // Request completed. Cancel the keepalive. clearTimeout(keepaliveTimeout); // Trigger a new request so we can continue receiving data. doNewRequest(); }; this.addTag(url, readyStateCB); }; /** * Add an arbitrary script tag to the iframe. * @param {!string} url - The URL for the script tag source. * @param {!function()} loadCB - A callback to be triggered once the script has loaded. */ FirebaseIFrameScriptHolder.prototype.addTag = function (url, loadCB) { var _this = this; if (util.isNodeSdk()) { this.doNodeLongPoll(url, loadCB); } else { setTimeout(function () { try { // if we're already closed, don't add this poll if (!_this.sendNewPolls) return; var newScript_1 = _this.myIFrame.doc.createElement('script'); newScript_1.type = 'text/javascript'; newScript_1.async = true; newScript_1.src = url; newScript_1.onload = newScript_1.onreadystatechange = function () { var rstate = newScript_1.readyState; if (!rstate || rstate === 'loaded' || rstate === 'complete') { newScript_1.onload = newScript_1.onreadystatechange = null; if (newScript_1.parentNode) { newScript_1.parentNode.removeChild(newScript_1); } loadCB(); } }; newScript_1.onerror = function () { log('Long-poll script failed to load: ' + url); _this.sendNewPolls = false; _this.close(); }; _this.myIFrame.doc.body.appendChild(newScript_1); } catch (e) { // TODO: we should make this error visible somehow } }, Math.floor(1)); } }; return FirebaseIFrameScriptHolder; }()); /** * Copyright 2017 Google Inc. * * 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. */ var WEBSOCKET_MAX_FRAME_SIZE = 16384; var WEBSOCKET_KEEPALIVE_INTERVAL = 45000; var WebSocketImpl = null; if (typeof MozWebSocket !== 'undefined') { WebSocketImpl = MozWebSocket; } else if (typeof WebSocket !== 'undefined') { WebSocketImpl = WebSocket; } /** * Create a new websocket connection with the given callbacks. * @constructor * @implements {Transport} */ var WebSocketConnection = /** @class */ (function () { /** * @param {string} connId identifier for this transport * @param {RepoInfo} repoInfo The info for the websocket endpoint. * @param {string=} transportSessionId Optional transportSessionId if this is connecting to an existing transport * session * @param {string=} lastSessionId Optional lastSessionId if there was a previous connection */ function WebSocketConnection(connId, repoInfo, transportSessionId, lastSessionId) { this.connId = connId; this.keepaliveTimer = null; this.frames = null; this.totalFrames = 0; this.bytesSent = 0; this.bytesReceived = 0; this.log_ = logWrapper(this.connId); this.stats_ = StatsManager.getCollection(repoInfo); this.connURL = WebSocketConnection.connectionURL_(repoInfo, transportSessionId, lastSessionId); } /** * @param {RepoInfo} repoInfo The info for the websocket endpoint. * @param {string=} transportSessionId Optional transportSessionId if this is connecting to an existing transport * session * @param {string=} lastSessionId Optional lastSessionId if there was a previous connection * @return {string} connection url * @private */ WebSocketConnection.connectionURL_ = function (repoInfo, transportSessionId, lastSessionId) { var urlParams = {}; urlParams[VERSION_PARAM] = PROTOCOL_VERSION; if (!util.isNodeSdk() && typeof location !== 'undefined' && location.href && location.href.indexOf(FORGE_DOMAIN) !== -1) { urlParams[REFERER_PARAM] = FORGE_REF; } if (transportSessionId) { urlParams[TRANSPORT_SESSION_PARAM] = transportSessionId; } if (lastSessionId) { urlParams[LAST_SESSION_PARAM] = lastSessionId; } return repoInfo.connectionURL(WEBSOCKET, urlParams); }; /** * * @param onMessage Callback when messages arrive * @param onDisconnect Callback with connection lost. */ WebSocketConnection.prototype.open = function (onMessage, onDisconnect) { var _this = this; this.onDisconnect = onDisconnect; this.onMessage = onMessage; this.log_('Websocket connecting to ' + this.connURL); this.everConnected_ = false; // Assume failure until proven otherwise. PersistentStorage.set('previous_websocket_failure', true); try { if (util.isNodeSdk()) { var device = util.CONSTANTS.NODE_ADMIN ? 'AdminNode' : 'Node'; // UA Format: Firebase//// var options = { headers: { 'User-Agent': "Firebase/" + PROTOCOL_VERSION + "/" + firebase.SDK_VERSION + "/" + process.platform + "/" + device } }; // Plumb appropriate http_proxy environment variable into faye-websocket if it exists. var env = Object({"DEVELOPMENT":undefined}); var proxy = this.connURL.indexOf('wss://') == 0 ? env['HTTPS_PROXY'] || env['https_proxy'] : env['HTTP_PROXY'] || env['http_proxy']; if (proxy) { options['proxy'] = { origin: proxy }; } this.mySock = new WebSocketImpl(this.connURL, [], options); } else { this.mySock = new WebSocketImpl(this.connURL); } } catch (e) { this.log_('Error instantiating WebSocket.'); var error$$1 = e.message || e.data; if (error$$1) { this.log_(error$$1); } this.onClosed_(); return; } this.mySock.onopen = function () { _this.log_('Websocket connected.'); _this.everConnected_ = true; }; this.mySock.onclose = function () { _this.log_('Websocket connection was disconnected.'); _this.mySock = null; _this.onClosed_(); }; this.mySock.onmessage = function (m) { _this.handleIncomingFrame(m); }; this.mySock.onerror = function (e) { _this.log_('WebSocket error. Closing connection.'); var error$$1 = e.message || e.data; if (error$$1) { _this.log_(error$$1); } _this.onClosed_(); }; }; /** * No-op for websockets, we don't need to do anything once the connection is confirmed as open */ WebSocketConnection.prototype.start = function () { }; WebSocketConnection.forceDisallow = function () { WebSocketConnection.forceDisallow_ = true; }; WebSocketConnection.isAvailable = function () { var isOldAndroid = false; if (typeof navigator !== 'undefined' && navigator.userAgent) { var oldAndroidRegex = /Android ([0-9]{0,}\.[0-9]{0,})/; var oldAndroidMatch = navigator.userAgent.match(oldAndroidRegex); if (oldAndroidMatch && oldAndroidMatch.length > 1) { if (parseFloat(oldAndroidMatch[1]) < 4.4) { isOldAndroid = true; } } } return (!isOldAndroid && WebSocketImpl !== null && !WebSocketConnection.forceDisallow_); }; /** * Returns true if we previously failed to connect with this transport. * @return {boolean} */ WebSocketConnection.previouslyFailed = function () { // If our persistent storage is actually only in-memory storage, // we default to assuming that it previously failed to be safe. return (PersistentStorage.isInMemoryStorage || PersistentStorage.get('previous_websocket_failure') === true); }; WebSocketConnection.prototype.markConnectionHealthy = function () { PersistentStorage.remove('previous_websocket_failure'); }; WebSocketConnection.prototype.appendFrame_ = function (data) { this.frames.push(data); if (this.frames.length == this.totalFrames) { var fullMess = this.frames.join(''); this.frames = null; var jsonMess = util.jsonEval(fullMess); //handle the message this.onMessage(jsonMess); } }; /** * @param {number} frameCount The number of frames we are expecting from the server * @private */ WebSocketConnection.prototype.handleNewFrameCount_ = function (frameCount) { this.totalFrames = frameCount; this.frames = []; }; /** * Attempts to parse a frame count out of some text. If it can't, assumes a value of 1 * @param {!String} data * @return {?String} Any remaining data to be process, or null if there is none * @private */ WebSocketConnection.prototype.extractFrameCount_ = function (data) { util.assert(this.frames === null, 'We already have a frame buffer'); // TODO: The server is only supposed to send up to 9999 frames (i.e. length <= 4), but that isn't being enforced // currently. So allowing larger frame counts (length <= 6). See https://app.asana.com/0/search/8688598998380/8237608042508 if (data.length <= 6) { var frameCount = Number(data); if (!isNaN(frameCount)) { this.handleNewFrameCount_(frameCount); return null; } } this.handleNewFrameCount_(1); return data; }; /** * Process a websocket frame that has arrived from the server. * @param mess The frame data */ WebSocketConnection.prototype.handleIncomingFrame = function (mess) { if (this.mySock === null) return; // Chrome apparently delivers incoming packets even after we .close() the connection sometimes. var data = mess['data']; this.bytesReceived += data.length; this.stats_.incrementCounter('bytes_received', data.length); this.resetKeepAlive(); if (this.frames !== null) { // we're buffering this.appendFrame_(data); } else { // try to parse out a frame count, otherwise, assume 1 and process it var remainingData = this.extractFrameCount_(data); if (remainingData !== null) { this.appendFrame_(remainingData); } } }; /** * Send a message to the server * @param {Object} data The JSON object to transmit */ WebSocketConnection.prototype.send = function (data) { this.resetKeepAlive(); var dataStr = util.stringify(data); this.bytesSent += dataStr.length; this.stats_.incrementCounter('bytes_sent', dataStr.length); //We can only fit a certain amount in each websocket frame, so we need to split this request //up into multiple pieces if it doesn't fit in one request. var dataSegs = splitStringBySize(dataStr, WEBSOCKET_MAX_FRAME_SIZE); //Send the length header if (dataSegs.length > 1) { this.sendString_(String(dataSegs.length)); } //Send the actual data in segments. for (var i = 0; i < dataSegs.length; i++) { this.sendString_(dataSegs[i]); } }; WebSocketConnection.prototype.shutdown_ = function () { this.isClosed_ = true; if (this.keepaliveTimer) { clearInterval(this.keepaliveTimer); this.keepaliveTimer = null; } if (this.mySock) { this.mySock.close(); this.mySock = null; } }; WebSocketConnection.prototype.onClosed_ = function () { if (!this.isClosed_) { this.log_('WebSocket is closing itself'); this.shutdown_(); // since this is an internal close, trigger the close listener if (this.onDisconnect) { this.onDisconnect(this.everConnected_); this.onDisconnect = null; } } }; /** * External-facing close handler. * Close the websocket and kill the connection. */ WebSocketConnection.prototype.close = function () { if (!this.isClosed_) { this.log_('WebSocket is being closed'); this.shutdown_(); } }; /** * Kill the current keepalive timer and start a new one, to ensure that it always fires N seconds after * the last activity. */ WebSocketConnection.prototype.resetKeepAlive = function () { var _this = this; clearInterval(this.keepaliveTimer); this.keepaliveTimer = setInterval(function () { //If there has been no websocket activity for a while, send a no-op if (_this.mySock) { _this.sendString_('0'); } _this.resetKeepAlive(); }, Math.floor(WEBSOCKET_KEEPALIVE_INTERVAL)); }; /** * Send a string over the websocket. * * @param {string} str String to send. * @private */ WebSocketConnection.prototype.sendString_ = function (str) { // Firefox seems to sometimes throw exceptions (NS_ERROR_UNEXPECTED) from websocket .send() // calls for some unknown reason. We treat these as an error and disconnect. // See https://app.asana.com/0/58926111402292/68021340250410 try { this.mySock.send(str); } catch (e) { this.log_('Exception thrown from WebSocket.send():', e.message || e.data, 'Closing connection.'); setTimeout(this.onClosed_.bind(this), 0); } }; /** * Number of response before we consider the connection "healthy." * @type {number} */ WebSocketConnection.responsesRequiredToBeHealthy = 2; /** * Time to wait for the connection te become healthy before giving up. * @type {number} */ WebSocketConnection.healthyTimeout = 30000; return WebSocketConnection; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Currently simplistic, this class manages what transport a Connection should use at various stages of its * lifecycle. * * It starts with longpolling in a browser, and httppolling on node. It then upgrades to websockets if * they are available. * @constructor */ var TransportManager = /** @class */ (function () { /** * @param {!RepoInfo} repoInfo Metadata around the namespace we're connecting to */ function TransportManager(repoInfo) { this.initTransports_(repoInfo); } Object.defineProperty(TransportManager, "ALL_TRANSPORTS", { /** * @const * @type {!Array.} */ get: function () { return [BrowserPollConnection, WebSocketConnection]; }, enumerable: true, configurable: true }); /** * @param {!RepoInfo} repoInfo * @private */ TransportManager.prototype.initTransports_ = function (repoInfo) { var isWebSocketsAvailable = WebSocketConnection && WebSocketConnection['isAvailable'](); var isSkipPollConnection = isWebSocketsAvailable && !WebSocketConnection.previouslyFailed(); if (repoInfo.webSocketOnly) { if (!isWebSocketsAvailable) warn("wss:// URL used, but browser isn't known to support websockets. Trying anyway."); isSkipPollConnection = true; } if (isSkipPollConnection) { this.transports_ = [WebSocketConnection]; } else { var transports_1 = (this.transports_ = []); each(TransportManager.ALL_TRANSPORTS, function (i, transport) { if (transport && transport['isAvailable']()) { transports_1.push(transport); } }); } }; /** * @return {function(new:Transport, !string, !RepoInfo, string=, string=)} The constructor for the * initial transport to use */ TransportManager.prototype.initialTransport = function () { if (this.transports_.length > 0) { return this.transports_[0]; } else { throw new Error('No transports available'); } }; /** * @return {?function(new:Transport, function(),function(), string=)} The constructor for the next * transport, or null */ TransportManager.prototype.upgradeTransport = function () { if (this.transports_.length > 1) { return this.transports_[1]; } else { return null; } }; return TransportManager; }()); /** * Copyright 2017 Google Inc. * * 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. */ // Abort upgrade attempt if it takes longer than 60s. var UPGRADE_TIMEOUT = 60000; // For some transports (WebSockets), we need to "validate" the transport by exchanging a few requests and responses. // If we haven't sent enough requests within 5s, we'll start sending noop ping requests. var DELAY_BEFORE_SENDING_EXTRA_REQUESTS = 5000; // If the initial data sent triggers a lot of bandwidth (i.e. it's a large put or a listen for a large amount of data) // then we may not be able to exchange our ping/pong requests within the healthy timeout. So if we reach the timeout // but we've sent/received enough bytes, we don't cancel the connection. var BYTES_SENT_HEALTHY_OVERRIDE = 10 * 1024; var BYTES_RECEIVED_HEALTHY_OVERRIDE = 100 * 1024; var MESSAGE_TYPE = 't'; var MESSAGE_DATA = 'd'; var CONTROL_SHUTDOWN = 's'; var CONTROL_RESET = 'r'; var CONTROL_ERROR = 'e'; var CONTROL_PONG = 'o'; var SWITCH_ACK = 'a'; var END_TRANSMISSION = 'n'; var PING = 'p'; var SERVER_HELLO = 'h'; /** * Creates a new real-time connection to the server using whichever method works * best in the current browser. * * @constructor */ var Connection = /** @class */ (function () { /** * @param {!string} id - an id for this connection * @param {!RepoInfo} repoInfo_ - the info for the endpoint to connect to * @param {function(Object)} onMessage_ - the callback to be triggered when a server-push message arrives * @param {function(number, string)} onReady_ - the callback to be triggered when this connection is ready to send messages. * @param {function()} onDisconnect_ - the callback to be triggered when a connection was lost * @param {function(string)} onKill_ - the callback to be triggered when this connection has permanently shut down. * @param {string=} lastSessionId - last session id in persistent connection. is used to clean up old session in real-time server */ function Connection(id, repoInfo_, onMessage_, onReady_, onDisconnect_, onKill_, lastSessionId) { this.id = id; this.repoInfo_ = repoInfo_; this.onMessage_ = onMessage_; this.onReady_ = onReady_; this.onDisconnect_ = onDisconnect_; this.onKill_ = onKill_; this.lastSessionId = lastSessionId; this.connectionCount = 0; this.pendingDataMessages = []; this.state_ = 0 /* CONNECTING */; this.log_ = logWrapper('c:' + this.id + ':'); this.transportManager_ = new TransportManager(repoInfo_); this.log_('Connection created'); this.start_(); } /** * Starts a connection attempt * @private */ Connection.prototype.start_ = function () { var _this = this; var conn = this.transportManager_.initialTransport(); this.conn_ = new conn(this.nextTransportId_(), this.repoInfo_, undefined, this.lastSessionId); // For certain transports (WebSockets), we need to send and receive several messages back and forth before we // can consider the transport healthy. this.primaryResponsesRequired_ = conn['responsesRequiredToBeHealthy'] || 0; var onMessageReceived = this.connReceiver_(this.conn_); var onConnectionLost = this.disconnReceiver_(this.conn_); this.tx_ = this.conn_; this.rx_ = this.conn_; this.secondaryConn_ = null; this.isHealthy_ = false; /* * Firefox doesn't like when code from one iframe tries to create another iframe by way of the parent frame. * This can occur in the case of a redirect, i.e. we guessed wrong on what server to connect to and received a reset. * Somehow, setTimeout seems to make this ok. That doesn't make sense from a security perspective, since you should * still have the context of your originating frame. */ setTimeout(function () { // this.conn_ gets set to null in some of the tests. Check to make sure it still exists before using it _this.conn_ && _this.conn_.open(onMessageReceived, onConnectionLost); }, Math.floor(0)); var healthyTimeout_ms = conn['healthyTimeout'] || 0; if (healthyTimeout_ms > 0) { this.healthyTimeout_ = setTimeoutNonBlocking(function () { _this.healthyTimeout_ = null; if (!_this.isHealthy_) { if (_this.conn_ && _this.conn_.bytesReceived > BYTES_RECEIVED_HEALTHY_OVERRIDE) { _this.log_('Connection exceeded healthy timeout but has received ' + _this.conn_.bytesReceived + ' bytes. Marking connection healthy.'); _this.isHealthy_ = true; _this.conn_.markConnectionHealthy(); } else if (_this.conn_ && _this.conn_.bytesSent > BYTES_SENT_HEALTHY_OVERRIDE) { _this.log_('Connection exceeded healthy timeout but has sent ' + _this.conn_.bytesSent + ' bytes. Leaving connection alive.'); // NOTE: We don't want to mark it healthy, since we have no guarantee that the bytes have made it to // the server. } else { _this.log_('Closing unhealthy connection after timeout.'); _this.close(); } } }, Math.floor(healthyTimeout_ms)); } }; /** * @return {!string} * @private */ Connection.prototype.nextTransportId_ = function () { return 'c:' + this.id + ':' + this.connectionCount++; }; Connection.prototype.disconnReceiver_ = function (conn) { var _this = this; return function (everConnected) { if (conn === _this.conn_) { _this.onConnectionLost_(everConnected); } else if (conn === _this.secondaryConn_) { _this.log_('Secondary connection lost.'); _this.onSecondaryConnectionLost_(); } else { _this.log_('closing an old connection'); } }; }; Connection.prototype.connReceiver_ = function (conn) { var _this = this; return function (message) { if (_this.state_ != 2 /* DISCONNECTED */) { if (conn === _this.rx_) { _this.onPrimaryMessageReceived_(message); } else if (conn === _this.secondaryConn_) { _this.onSecondaryMessageReceived_(message); } else { _this.log_('message on old connection'); } } }; }; /** * * @param {Object} dataMsg An arbitrary data message to be sent to the server */ Connection.prototype.sendRequest = function (dataMsg) { // wrap in a data message envelope and send it on var msg = { t: 'd', d: dataMsg }; this.sendData_(msg); }; Connection.prototype.tryCleanupConnection = function () { if (this.tx_ === this.secondaryConn_ && this.rx_ === this.secondaryConn_) { this.log_('cleaning up and promoting a connection: ' + this.secondaryConn_.connId); this.conn_ = this.secondaryConn_; this.secondaryConn_ = null; // the server will shutdown the old connection } }; Connection.prototype.onSecondaryControl_ = function (controlData) { if (MESSAGE_TYPE in controlData) { var cmd = controlData[MESSAGE_TYPE]; if (cmd === SWITCH_ACK) { this.upgradeIfSecondaryHealthy_(); } else if (cmd === CONTROL_RESET) { // Most likely the session wasn't valid. Abandon the switch attempt this.log_('Got a reset on secondary, closing it'); this.secondaryConn_.close(); // If we were already using this connection for something, than we need to fully close if (this.tx_ === this.secondaryConn_ || this.rx_ === this.secondaryConn_) { this.close(); } } else if (cmd === CONTROL_PONG) { this.log_('got pong on secondary.'); this.secondaryResponsesRequired_--; this.upgradeIfSecondaryHealthy_(); } } }; Connection.prototype.onSecondaryMessageReceived_ = function (parsedData) { var layer = requireKey('t', parsedData); var data = requireKey('d', parsedData); if (layer == 'c') { this.onSecondaryControl_(data); } else if (layer == 'd') { // got a data message, but we're still second connection. Need to buffer it up this.pendingDataMessages.push(data); } else { throw new Error('Unknown protocol layer: ' + layer); } }; Connection.prototype.upgradeIfSecondaryHealthy_ = function () { if (this.secondaryResponsesRequired_ <= 0) { this.log_('Secondary connection is healthy.'); this.isHealthy_ = true; this.secondaryConn_.markConnectionHealthy(); this.proceedWithUpgrade_(); } else { // Send a ping to make sure the connection is healthy. this.log_('sending ping on secondary.'); this.secondaryConn_.send({ t: 'c', d: { t: PING, d: {} } }); } }; Connection.prototype.proceedWithUpgrade_ = function () { // tell this connection to consider itself open this.secondaryConn_.start(); // send ack this.log_('sending client ack on secondary'); this.secondaryConn_.send({ t: 'c', d: { t: SWITCH_ACK, d: {} } }); // send end packet on primary transport, switch to sending on this one // can receive on this one, buffer responses until end received on primary transport this.log_('Ending transmission on primary'); this.conn_.send({ t: 'c', d: { t: END_TRANSMISSION, d: {} } }); this.tx_ = this.secondaryConn_; this.tryCleanupConnection(); }; Connection.prototype.onPrimaryMessageReceived_ = function (parsedData) { // Must refer to parsedData properties in quotes, so closure doesn't touch them. var layer = requireKey('t', parsedData); var data = requireKey('d', parsedData); if (layer == 'c') { this.onControl_(data); } else if (layer == 'd') { this.onDataMessage_(data); } }; Connection.prototype.onDataMessage_ = function (message) { this.onPrimaryResponse_(); // We don't do anything with data messages, just kick them up a level this.onMessage_(message); }; Connection.prototype.onPrimaryResponse_ = function () { if (!this.isHealthy_) { this.primaryResponsesRequired_--; if (this.primaryResponsesRequired_ <= 0) { this.log_('Primary connection is healthy.'); this.isHealthy_ = true; this.conn_.markConnectionHealthy(); } } }; Connection.prototype.onControl_ = function (controlData) { var cmd = requireKey(MESSAGE_TYPE, controlData); if (MESSAGE_DATA in controlData) { var payload = controlData[MESSAGE_DATA]; if (cmd === SERVER_HELLO) { this.onHandshake_(payload); } else if (cmd === END_TRANSMISSION) { this.log_('recvd end transmission on primary'); this.rx_ = this.secondaryConn_; for (var i = 0; i < this.pendingDataMessages.length; ++i) { this.onDataMessage_(this.pendingDataMessages[i]); } this.pendingDataMessages = []; this.tryCleanupConnection(); } else if (cmd === CONTROL_SHUTDOWN) { // This was previously the 'onKill' callback passed to the lower-level connection // payload in this case is the reason for the shutdown. Generally a human-readable error this.onConnectionShutdown_(payload); } else if (cmd === CONTROL_RESET) { // payload in this case is the host we should contact this.onReset_(payload); } else if (cmd === CONTROL_ERROR) { error('Server Error: ' + payload); } else if (cmd === CONTROL_PONG) { this.log_('got pong on primary.'); this.onPrimaryResponse_(); this.sendPingOnPrimaryIfNecessary_(); } else { error('Unknown control packet command: ' + cmd); } } }; /** * * @param {Object} handshake The handshake data returned from the server * @private */ Connection.prototype.onHandshake_ = function (handshake) { var timestamp = handshake.ts; var version = handshake.v; var host = handshake.h; this.sessionId = handshake.s; this.repoInfo_.updateHost(host); // if we've already closed the connection, then don't bother trying to progress further if (this.state_ == 0 /* CONNECTING */) { this.conn_.start(); this.onConnectionEstablished_(this.conn_, timestamp); if (PROTOCOL_VERSION !== version) { warn('Protocol version mismatch detected'); } // TODO: do we want to upgrade? when? maybe a delay? this.tryStartUpgrade_(); } }; Connection.prototype.tryStartUpgrade_ = function () { var conn = this.transportManager_.upgradeTransport(); if (conn) { this.startUpgrade_(conn); } }; Connection.prototype.startUpgrade_ = function (conn) { var _this = this; this.secondaryConn_ = new conn(this.nextTransportId_(), this.repoInfo_, this.sessionId); // For certain transports (WebSockets), we need to send and receive several messages back and forth before we // can consider the transport healthy. this.secondaryResponsesRequired_ = conn['responsesRequiredToBeHealthy'] || 0; var onMessage = this.connReceiver_(this.secondaryConn_); var onDisconnect = this.disconnReceiver_(this.secondaryConn_); this.secondaryConn_.open(onMessage, onDisconnect); // If we haven't successfully upgraded after UPGRADE_TIMEOUT, give up and kill the secondary. setTimeoutNonBlocking(function () { if (_this.secondaryConn_) { _this.log_('Timed out trying to upgrade.'); _this.secondaryConn_.close(); } }, Math.floor(UPGRADE_TIMEOUT)); }; Connection.prototype.onReset_ = function (host) { this.log_('Reset packet received. New host: ' + host); this.repoInfo_.updateHost(host); // TODO: if we're already "connected", we need to trigger a disconnect at the next layer up. // We don't currently support resets after the connection has already been established if (this.state_ === 1 /* CONNECTED */) { this.close(); } else { // Close whatever connections we have open and start again. this.closeConnections_(); this.start_(); } }; Connection.prototype.onConnectionEstablished_ = function (conn, timestamp) { var _this = this; this.log_('Realtime connection established.'); this.conn_ = conn; this.state_ = 1 /* CONNECTED */; if (this.onReady_) { this.onReady_(timestamp, this.sessionId); this.onReady_ = null; } // If after 5 seconds we haven't sent enough requests to the server to get the connection healthy, // send some pings. if (this.primaryResponsesRequired_ === 0) { this.log_('Primary connection is healthy.'); this.isHealthy_ = true; } else { setTimeoutNonBlocking(function () { _this.sendPingOnPrimaryIfNecessary_(); }, Math.floor(DELAY_BEFORE_SENDING_EXTRA_REQUESTS)); } }; Connection.prototype.sendPingOnPrimaryIfNecessary_ = function () { // If the connection isn't considered healthy yet, we'll send a noop ping packet request. if (!this.isHealthy_ && this.state_ === 1 /* CONNECTED */) { this.log_('sending ping on primary.'); this.sendData_({ t: 'c', d: { t: PING, d: {} } }); } }; Connection.prototype.onSecondaryConnectionLost_ = function () { var conn = this.secondaryConn_; this.secondaryConn_ = null; if (this.tx_ === conn || this.rx_ === conn) { // we are relying on this connection already in some capacity. Therefore, a failure is real this.close(); } }; /** * * @param {boolean} everConnected Whether or not the connection ever reached a server. Used to determine if * we should flush the host cache * @private */ Connection.prototype.onConnectionLost_ = function (everConnected) { this.conn_ = null; // NOTE: IF you're seeing a Firefox error for this line, I think it might be because it's getting // called on window close and RealtimeState.CONNECTING is no longer defined. Just a guess. if (!everConnected && this.state_ === 0 /* CONNECTING */) { this.log_('Realtime connection failed.'); // Since we failed to connect at all, clear any cached entry for this namespace in case the machine went away if (this.repoInfo_.isCacheableHost()) { PersistentStorage.remove('host:' + this.repoInfo_.host); // reset the internal host to what we would show the user, i.e. .firebaseio.com this.repoInfo_.internalHost = this.repoInfo_.host; } } else if (this.state_ === 1 /* CONNECTED */) { this.log_('Realtime connection lost.'); } this.close(); }; /** * * @param {string} reason * @private */ Connection.prototype.onConnectionShutdown_ = function (reason) { this.log_('Connection shutdown command received. Shutting down...'); if (this.onKill_) { this.onKill_(reason); this.onKill_ = null; } // We intentionally don't want to fire onDisconnect (kill is a different case), // so clear the callback. this.onDisconnect_ = null; this.close(); }; Connection.prototype.sendData_ = function (data) { if (this.state_ !== 1 /* CONNECTED */) { throw 'Connection is not connected'; } else { this.tx_.send(data); } }; /** * Cleans up this connection, calling the appropriate callbacks */ Connection.prototype.close = function () { if (this.state_ !== 2 /* DISCONNECTED */) { this.log_('Closing realtime connection.'); this.state_ = 2 /* DISCONNECTED */; this.closeConnections_(); if (this.onDisconnect_) { this.onDisconnect_(); this.onDisconnect_ = null; } } }; /** * * @private */ Connection.prototype.closeConnections_ = function () { this.log_('Shutting down all connections'); if (this.conn_) { this.conn_.close(); this.conn_ = null; } if (this.secondaryConn_) { this.secondaryConn_.close(); this.secondaryConn_ = null; } if (this.healthyTimeout_) { clearTimeout(this.healthyTimeout_); this.healthyTimeout_ = null; } }; return Connection; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Interface defining the set of actions that can be performed against the Firebase server * (basically corresponds to our wire protocol). * * @interface */ var ServerActions = /** @class */ (function () { function ServerActions() { } /** * @param {string} pathString * @param {*} data * @param {function(string, string)=} onComplete * @param {string=} hash */ ServerActions.prototype.put = function (pathString, data, onComplete, hash) { }; /** * @param {string} pathString * @param {*} data * @param {function(string, ?string)} onComplete * @param {string=} hash */ ServerActions.prototype.merge = function (pathString, data, onComplete, hash) { }; /** * Refreshes the auth token for the current connection. * @param {string} token The authentication token */ ServerActions.prototype.refreshAuthToken = function (token) { }; /** * @param {string} pathString * @param {*} data * @param {function(string, string)=} onComplete */ ServerActions.prototype.onDisconnectPut = function (pathString, data, onComplete) { }; /** * @param {string} pathString * @param {*} data * @param {function(string, string)=} onComplete */ ServerActions.prototype.onDisconnectMerge = function (pathString, data, onComplete) { }; /** * @param {string} pathString * @param {function(string, string)=} onComplete */ ServerActions.prototype.onDisconnectCancel = function (pathString, onComplete) { }; /** * @param {Object.} stats */ ServerActions.prototype.reportStats = function (stats) { }; return ServerActions; }()); /** * Copyright 2017 Google Inc. * * 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. */ var RECONNECT_MIN_DELAY = 1000; var RECONNECT_MAX_DELAY_DEFAULT = 60 * 5 * 1000; // 5 minutes in milliseconds (Case: 1858) var RECONNECT_MAX_DELAY_FOR_ADMINS = 30 * 1000; // 30 seconds for admin clients (likely to be a backend server) var RECONNECT_DELAY_MULTIPLIER = 1.3; var RECONNECT_DELAY_RESET_TIMEOUT = 30000; // Reset delay back to MIN_DELAY after being connected for 30sec. var SERVER_KILL_INTERRUPT_REASON = 'server_kill'; // If auth fails repeatedly, we'll assume something is wrong and log a warning / back off. var INVALID_AUTH_TOKEN_THRESHOLD = 3; /** * Firebase connection. Abstracts wire protocol and handles reconnecting. * * NOTE: All JSON objects sent to the realtime connection must have property names enclosed * in quotes to make sure the closure compiler does not minify them. */ var PersistentConnection = /** @class */ (function (_super) { tslib_1.__extends(PersistentConnection, _super); /** * @implements {ServerActions} * @param {!RepoInfo} repoInfo_ Data about the namespace we are connecting to * @param {function(string, *, boolean, ?number)} onDataUpdate_ A callback for new data from the server * @param onConnectStatus_ * @param onServerInfoUpdate_ * @param authTokenProvider_ * @param authOverride_ */ function PersistentConnection(repoInfo_, onDataUpdate_, onConnectStatus_, onServerInfoUpdate_, authTokenProvider_, authOverride_) { var _this = _super.call(this) || this; _this.repoInfo_ = repoInfo_; _this.onDataUpdate_ = onDataUpdate_; _this.onConnectStatus_ = onConnectStatus_; _this.onServerInfoUpdate_ = onServerInfoUpdate_; _this.authTokenProvider_ = authTokenProvider_; _this.authOverride_ = authOverride_; // Used for diagnostic logging. _this.id = PersistentConnection.nextPersistentConnectionId_++; _this.log_ = logWrapper('p:' + _this.id + ':'); /** @private {Object} */ _this.interruptReasons_ = {}; _this.listens_ = {}; _this.outstandingPuts_ = []; _this.outstandingPutCount_ = 0; _this.onDisconnectRequestQueue_ = []; _this.connected_ = false; _this.reconnectDelay_ = RECONNECT_MIN_DELAY; _this.maxReconnectDelay_ = RECONNECT_MAX_DELAY_DEFAULT; _this.securityDebugCallback_ = null; _this.lastSessionId = null; /** @private {number|null} */ _this.establishConnectionTimer_ = null; /** @private {boolean} */ _this.visible_ = false; // Before we get connected, we keep a queue of pending messages to send. _this.requestCBHash_ = {}; _this.requestNumber_ = 0; /** @private {?{ * sendRequest(Object), * close() * }} */ _this.realtime_ = null; /** @private {string|null} */ _this.authToken_ = null; _this.forceTokenRefresh_ = false; _this.invalidAuthTokenCount_ = 0; _this.firstConnection_ = true; _this.lastConnectionAttemptTime_ = null; _this.lastConnectionEstablishedTime_ = null; if (authOverride_ && !util.isNodeSdk()) { throw new Error('Auth override specified in options, but not supported on non Node.js platforms'); } _this.scheduleConnect_(0); VisibilityMonitor.getInstance().on('visible', _this.onVisible_, _this); if (repoInfo_.host.indexOf('fblocal') === -1) { OnlineMonitor.getInstance().on('online', _this.onOnline_, _this); } return _this; } /** * @param {!string} action * @param {*} body * @param {function(*)=} onResponse * @protected */ PersistentConnection.prototype.sendRequest = function (action, body, onResponse) { var curReqNum = ++this.requestNumber_; var msg = { r: curReqNum, a: action, b: body }; this.log_(util.stringify(msg)); util.assert(this.connected_, "sendRequest call when we're not connected not allowed."); this.realtime_.sendRequest(msg); if (onResponse) { this.requestCBHash_[curReqNum] = onResponse; } }; /** * @inheritDoc */ PersistentConnection.prototype.listen = function (query, currentHashFn, tag, onComplete) { var queryId = query.queryIdentifier(); var pathString = query.path.toString(); this.log_('Listen called for ' + pathString + ' ' + queryId); this.listens_[pathString] = this.listens_[pathString] || {}; util.assert(query.getQueryParams().isDefault() || !query.getQueryParams().loadsAllData(), 'listen() called for non-default but complete query'); util.assert(!this.listens_[pathString][queryId], 'listen() called twice for same path/queryId.'); var listenSpec = { onComplete: onComplete, hashFn: currentHashFn, query: query, tag: tag }; this.listens_[pathString][queryId] = listenSpec; if (this.connected_) { this.sendListen_(listenSpec); } }; /** * @param {!{onComplete(), * hashFn():!string, * query: !Query, * tag: ?number}} listenSpec * @private */ PersistentConnection.prototype.sendListen_ = function (listenSpec) { var _this = this; var query = listenSpec.query; var pathString = query.path.toString(); var queryId = query.queryIdentifier(); this.log_('Listen on ' + pathString + ' for ' + queryId); var req = { /*path*/ p: pathString }; var action = 'q'; // Only bother to send query if it's non-default. if (listenSpec.tag) { req['q'] = query.queryObject(); req['t'] = listenSpec.tag; } req[ /*hash*/'h'] = listenSpec.hashFn(); this.sendRequest(action, req, function (message) { var payload = message[ /*data*/'d']; var status = message[ /*status*/'s']; // print warnings in any case... PersistentConnection.warnOnListenWarnings_(payload, query); var currentListenSpec = _this.listens_[pathString] && _this.listens_[pathString][queryId]; // only trigger actions if the listen hasn't been removed and readded if (currentListenSpec === listenSpec) { _this.log_('listen response', message); if (status !== 'ok') { _this.removeListen_(pathString, queryId); } if (listenSpec.onComplete) { listenSpec.onComplete(status, payload); } } }); }; /** * @param {*} payload * @param {!Query} query * @private */ PersistentConnection.warnOnListenWarnings_ = function (payload, query) { if (payload && typeof payload === 'object' && util.contains(payload, 'w')) { var warnings = util.safeGet(payload, 'w'); if (Array.isArray(warnings) && ~warnings.indexOf('no_index')) { var indexSpec = '".indexOn": "' + query .getQueryParams() .getIndex() .toString() + '"'; var indexPath = query.path.toString(); warn("Using an unspecified index. Your data will be downloaded and " + ("filtered on the client. Consider adding " + indexSpec + " at ") + (indexPath + " to your security rules for better performance.")); } } }; /** * @inheritDoc */ PersistentConnection.prototype.refreshAuthToken = function (token) { this.authToken_ = token; this.log_('Auth token refreshed'); if (this.authToken_) { this.tryAuth(); } else { //If we're connected we want to let the server know to unauthenticate us. If we're not connected, simply delete //the credential so we dont become authenticated next time we connect. if (this.connected_) { this.sendRequest('unauth', {}, function () { }); } } this.reduceReconnectDelayIfAdminCredential_(token); }; /** * @param {!string} credential * @private */ PersistentConnection.prototype.reduceReconnectDelayIfAdminCredential_ = function (credential) { // NOTE: This isn't intended to be bulletproof (a malicious developer can always just modify the client). // Additionally, we don't bother resetting the max delay back to the default if auth fails / expires. var isFirebaseSecret = credential && credential.length === 40; if (isFirebaseSecret || util.isAdmin(credential)) { this.log_('Admin auth credential detected. Reducing max reconnect time.'); this.maxReconnectDelay_ = RECONNECT_MAX_DELAY_FOR_ADMINS; } }; /** * Attempts to authenticate with the given credentials. If the authentication attempt fails, it's triggered like * a auth revoked (the connection is closed). */ PersistentConnection.prototype.tryAuth = function () { var _this = this; if (this.connected_ && this.authToken_) { var token_1 = this.authToken_; var authMethod = util.isValidFormat(token_1) ? 'auth' : 'gauth'; var requestData = { cred: token_1 }; if (this.authOverride_ === null) { requestData['noauth'] = true; } else if (typeof this.authOverride_ === 'object') { requestData['authvar'] = this.authOverride_; } this.sendRequest(authMethod, requestData, function (res) { var status = res[ /*status*/'s']; var data = res[ /*data*/'d'] || 'error'; if (_this.authToken_ === token_1) { if (status === 'ok') { _this.invalidAuthTokenCount_ = 0; } else { // Triggers reconnect and force refresh for auth token _this.onAuthRevoked_(status, data); } } }); } }; /** * @inheritDoc */ PersistentConnection.prototype.unlisten = function (query, tag) { var pathString = query.path.toString(); var queryId = query.queryIdentifier(); this.log_('Unlisten called for ' + pathString + ' ' + queryId); util.assert(query.getQueryParams().isDefault() || !query.getQueryParams().loadsAllData(), 'unlisten() called for non-default but complete query'); var listen = this.removeListen_(pathString, queryId); if (listen && this.connected_) { this.sendUnlisten_(pathString, queryId, query.queryObject(), tag); } }; PersistentConnection.prototype.sendUnlisten_ = function (pathString, queryId, queryObj, tag) { this.log_('Unlisten on ' + pathString + ' for ' + queryId); var req = { /*path*/ p: pathString }; var action = 'n'; // Only bother sending queryId if it's non-default. if (tag) { req['q'] = queryObj; req['t'] = tag; } this.sendRequest(action, req); }; /** * @inheritDoc */ PersistentConnection.prototype.onDisconnectPut = function (pathString, data, onComplete) { if (this.connected_) { this.sendOnDisconnect_('o', pathString, data, onComplete); } else { this.onDisconnectRequestQueue_.push({ pathString: pathString, action: 'o', data: data, onComplete: onComplete }); } }; /** * @inheritDoc */ PersistentConnection.prototype.onDisconnectMerge = function (pathString, data, onComplete) { if (this.connected_) { this.sendOnDisconnect_('om', pathString, data, onComplete); } else { this.onDisconnectRequestQueue_.push({ pathString: pathString, action: 'om', data: data, onComplete: onComplete }); } }; /** * @inheritDoc */ PersistentConnection.prototype.onDisconnectCancel = function (pathString, onComplete) { if (this.connected_) { this.sendOnDisconnect_('oc', pathString, null, onComplete); } else { this.onDisconnectRequestQueue_.push({ pathString: pathString, action: 'oc', data: null, onComplete: onComplete }); } }; PersistentConnection.prototype.sendOnDisconnect_ = function (action, pathString, data, onComplete) { var request = { /*path*/ p: pathString, /*data*/ d: data }; this.log_('onDisconnect ' + action, request); this.sendRequest(action, request, function (response) { if (onComplete) { setTimeout(function () { onComplete(response[ /*status*/'s'], response[ /* data */'d']); }, Math.floor(0)); } }); }; /** * @inheritDoc */ PersistentConnection.prototype.put = function (pathString, data, onComplete, hash) { this.putInternal('p', pathString, data, onComplete, hash); }; /** * @inheritDoc */ PersistentConnection.prototype.merge = function (pathString, data, onComplete, hash) { this.putInternal('m', pathString, data, onComplete, hash); }; PersistentConnection.prototype.putInternal = function (action, pathString, data, onComplete, hash) { var request = { /*path*/ p: pathString, /*data*/ d: data }; if (hash !== undefined) request[ /*hash*/'h'] = hash; // TODO: Only keep track of the most recent put for a given path? this.outstandingPuts_.push({ action: action, request: request, onComplete: onComplete }); this.outstandingPutCount_++; var index = this.outstandingPuts_.length - 1; if (this.connected_) { this.sendPut_(index); } else { this.log_('Buffering put: ' + pathString); } }; PersistentConnection.prototype.sendPut_ = function (index) { var _this = this; var action = this.outstandingPuts_[index].action; var request = this.outstandingPuts_[index].request; var onComplete = this.outstandingPuts_[index].onComplete; this.outstandingPuts_[index].queued = this.connected_; this.sendRequest(action, request, function (message) { _this.log_(action + ' response', message); delete _this.outstandingPuts_[index]; _this.outstandingPutCount_--; // Clean up array occasionally. if (_this.outstandingPutCount_ === 0) { _this.outstandingPuts_ = []; } if (onComplete) onComplete(message[ /*status*/'s'], message[ /* data */'d']); }); }; /** * @inheritDoc */ PersistentConnection.prototype.reportStats = function (stats) { var _this = this; // If we're not connected, we just drop the stats. if (this.connected_) { var request = { /*counters*/ c: stats }; this.log_('reportStats', request); this.sendRequest(/*stats*/ 's', request, function (result) { var status = result[ /*status*/'s']; if (status !== 'ok') { var errorReason = result[ /* data */'d']; _this.log_('reportStats', 'Error sending stats: ' + errorReason); } }); } }; /** * @param {*} message * @private */ PersistentConnection.prototype.onDataMessage_ = function (message) { if ('r' in message) { // this is a response this.log_('from server: ' + util.stringify(message)); var reqNum = message['r']; var onResponse = this.requestCBHash_[reqNum]; if (onResponse) { delete this.requestCBHash_[reqNum]; onResponse(message[ /*body*/'b']); } } else if ('error' in message) { throw 'A server-side error has occurred: ' + message['error']; } else if ('a' in message) { // a and b are action and body, respectively this.onDataPush_(message['a'], message['b']); } }; PersistentConnection.prototype.onDataPush_ = function (action, body) { this.log_('handleServerMessage', action, body); if (action === 'd') this.onDataUpdate_(body[ /*path*/'p'], body[ /*data*/'d'], /*isMerge*/ false, body['t']); else if (action === 'm') this.onDataUpdate_(body[ /*path*/'p'], body[ /*data*/'d'], /*isMerge=*/ true, body['t']); else if (action === 'c') this.onListenRevoked_(body[ /*path*/'p'], body[ /*query*/'q']); else if (action === 'ac') this.onAuthRevoked_(body[ /*status code*/'s'], body[ /* explanation */'d']); else if (action === 'sd') this.onSecurityDebugPacket_(body); else error('Unrecognized action received from server: ' + util.stringify(action) + '\nAre you using the latest client?'); }; PersistentConnection.prototype.onReady_ = function (timestamp, sessionId) { this.log_('connection ready'); this.connected_ = true; this.lastConnectionEstablishedTime_ = new Date().getTime(); this.handleTimestamp_(timestamp); this.lastSessionId = sessionId; if (this.firstConnection_) { this.sendConnectStats_(); } this.restoreState_(); this.firstConnection_ = false; this.onConnectStatus_(true); }; PersistentConnection.prototype.scheduleConnect_ = function (timeout) { var _this = this; util.assert(!this.realtime_, "Scheduling a connect when we're already connected/ing?"); if (this.establishConnectionTimer_) { clearTimeout(this.establishConnectionTimer_); } // NOTE: Even when timeout is 0, it's important to do a setTimeout to work around an infuriating "Security Error" in // Firefox when trying to write to our long-polling iframe in some scenarios (e.g. Forge or our unit tests). this.establishConnectionTimer_ = setTimeout(function () { _this.establishConnectionTimer_ = null; _this.establishConnection_(); }, Math.floor(timeout)); }; /** * @param {boolean} visible * @private */ PersistentConnection.prototype.onVisible_ = function (visible) { // NOTE: Tabbing away and back to a window will defeat our reconnect backoff, but I think that's fine. if (visible && !this.visible_ && this.reconnectDelay_ === this.maxReconnectDelay_) { this.log_('Window became visible. Reducing delay.'); this.reconnectDelay_ = RECONNECT_MIN_DELAY; if (!this.realtime_) { this.scheduleConnect_(0); } } this.visible_ = visible; }; PersistentConnection.prototype.onOnline_ = function (online) { if (online) { this.log_('Browser went online.'); this.reconnectDelay_ = RECONNECT_MIN_DELAY; if (!this.realtime_) { this.scheduleConnect_(0); } } else { this.log_('Browser went offline. Killing connection.'); if (this.realtime_) { this.realtime_.close(); } } }; PersistentConnection.prototype.onRealtimeDisconnect_ = function () { this.log_('data client disconnected'); this.connected_ = false; this.realtime_ = null; // Since we don't know if our sent transactions succeeded or not, we need to cancel them. this.cancelSentTransactions_(); // Clear out the pending requests. this.requestCBHash_ = {}; if (this.shouldReconnect_()) { if (!this.visible_) { this.log_("Window isn't visible. Delaying reconnect."); this.reconnectDelay_ = this.maxReconnectDelay_; this.lastConnectionAttemptTime_ = new Date().getTime(); } else if (this.lastConnectionEstablishedTime_) { // If we've been connected long enough, reset reconnect delay to minimum. var timeSinceLastConnectSucceeded = new Date().getTime() - this.lastConnectionEstablishedTime_; if (timeSinceLastConnectSucceeded > RECONNECT_DELAY_RESET_TIMEOUT) this.reconnectDelay_ = RECONNECT_MIN_DELAY; this.lastConnectionEstablishedTime_ = null; } var timeSinceLastConnectAttempt = new Date().getTime() - this.lastConnectionAttemptTime_; var reconnectDelay = Math.max(0, this.reconnectDelay_ - timeSinceLastConnectAttempt); reconnectDelay = Math.random() * reconnectDelay; this.log_('Trying to reconnect in ' + reconnectDelay + 'ms'); this.scheduleConnect_(reconnectDelay); // Adjust reconnect delay for next time. this.reconnectDelay_ = Math.min(this.maxReconnectDelay_, this.reconnectDelay_ * RECONNECT_DELAY_MULTIPLIER); } this.onConnectStatus_(false); }; PersistentConnection.prototype.establishConnection_ = function () { if (this.shouldReconnect_()) { this.log_('Making a connection attempt'); this.lastConnectionAttemptTime_ = new Date().getTime(); this.lastConnectionEstablishedTime_ = null; var onDataMessage_1 = this.onDataMessage_.bind(this); var onReady_1 = this.onReady_.bind(this); var onDisconnect_1 = this.onRealtimeDisconnect_.bind(this); var connId_1 = this.id + ':' + PersistentConnection.nextConnectionId_++; var self_1 = this; var lastSessionId_1 = this.lastSessionId; var canceled_1 = false; var connection_1 = null; var closeFn_1 = function () { if (connection_1) { connection_1.close(); } else { canceled_1 = true; onDisconnect_1(); } }; var sendRequestFn = function (msg) { util.assert(connection_1, "sendRequest call when we're not connected not allowed."); connection_1.sendRequest(msg); }; this.realtime_ = { close: closeFn_1, sendRequest: sendRequestFn }; var forceRefresh = this.forceTokenRefresh_; this.forceTokenRefresh_ = false; // First fetch auth token, and establish connection after fetching the token was successful this.authTokenProvider_ .getToken(forceRefresh) .then(function (result) { if (!canceled_1) { log('getToken() completed. Creating connection.'); self_1.authToken_ = result && result.accessToken; connection_1 = new Connection(connId_1, self_1.repoInfo_, onDataMessage_1, onReady_1, onDisconnect_1, /* onKill= */ function (reason) { warn(reason + ' (' + self_1.repoInfo_.toString() + ')'); self_1.interrupt(SERVER_KILL_INTERRUPT_REASON); }, lastSessionId_1); } else { log('getToken() completed but was canceled'); } }) .then(null, function (error$$1) { self_1.log_('Failed to get token: ' + error$$1); if (!canceled_1) { if (util.CONSTANTS.NODE_ADMIN) { // This may be a critical error for the Admin Node.js SDK, so log a warning. // But getToken() may also just have temporarily failed, so we still want to // continue retrying. warn(error$$1); } closeFn_1(); } }); } }; /** * @param {string} reason */ PersistentConnection.prototype.interrupt = function (reason) { log('Interrupting connection for reason: ' + reason); this.interruptReasons_[reason] = true; if (this.realtime_) { this.realtime_.close(); } else { if (this.establishConnectionTimer_) { clearTimeout(this.establishConnectionTimer_); this.establishConnectionTimer_ = null; } if (this.connected_) { this.onRealtimeDisconnect_(); } } }; /** * @param {string} reason */ PersistentConnection.prototype.resume = function (reason) { log('Resuming connection for reason: ' + reason); delete this.interruptReasons_[reason]; if (util.isEmpty(this.interruptReasons_)) { this.reconnectDelay_ = RECONNECT_MIN_DELAY; if (!this.realtime_) { this.scheduleConnect_(0); } } }; PersistentConnection.prototype.handleTimestamp_ = function (timestamp) { var delta = timestamp - new Date().getTime(); this.onServerInfoUpdate_({ serverTimeOffset: delta }); }; PersistentConnection.prototype.cancelSentTransactions_ = function () { for (var i = 0; i < this.outstandingPuts_.length; i++) { var put = this.outstandingPuts_[i]; if (put && /*hash*/ 'h' in put.request && put.queued) { if (put.onComplete) put.onComplete('disconnect'); delete this.outstandingPuts_[i]; this.outstandingPutCount_--; } } // Clean up array occasionally. if (this.outstandingPutCount_ === 0) this.outstandingPuts_ = []; }; /** * @param {!string} pathString * @param {Array.<*>=} query * @private */ PersistentConnection.prototype.onListenRevoked_ = function (pathString, query) { // Remove the listen and manufacture a "permission_denied" error for the failed listen. var queryId; if (!query) { queryId = 'default'; } else { queryId = query.map(function (q) { return ObjectToUniqueKey(q); }).join('$'); } var listen = this.removeListen_(pathString, queryId); if (listen && listen.onComplete) listen.onComplete('permission_denied'); }; /** * @param {!string} pathString * @param {!string} queryId * @return {{queries:Array., onComplete:function(string)}} * @private */ PersistentConnection.prototype.removeListen_ = function (pathString, queryId) { var normalizedPathString = new Path(pathString).toString(); // normalize path. var listen; if (this.listens_[normalizedPathString] !== undefined) { listen = this.listens_[normalizedPathString][queryId]; delete this.listens_[normalizedPathString][queryId]; if (util.getCount(this.listens_[normalizedPathString]) === 0) { delete this.listens_[normalizedPathString]; } } else { // all listens for this path has already been removed listen = undefined; } return listen; }; PersistentConnection.prototype.onAuthRevoked_ = function (statusCode, explanation) { log('Auth token revoked: ' + statusCode + '/' + explanation); this.authToken_ = null; this.forceTokenRefresh_ = true; this.realtime_.close(); if (statusCode === 'invalid_token' || statusCode === 'permission_denied') { // We'll wait a couple times before logging the warning / increasing the // retry period since oauth tokens will report as "invalid" if they're // just expired. Plus there may be transient issues that resolve themselves. this.invalidAuthTokenCount_++; if (this.invalidAuthTokenCount_ >= INVALID_AUTH_TOKEN_THRESHOLD) { // Set a long reconnect delay because recovery is unlikely this.reconnectDelay_ = RECONNECT_MAX_DELAY_FOR_ADMINS; // Notify the auth token provider that the token is invalid, which will log // a warning this.authTokenProvider_.notifyForInvalidToken(); } } }; PersistentConnection.prototype.onSecurityDebugPacket_ = function (body) { if (this.securityDebugCallback_) { this.securityDebugCallback_(body); } else { if ('msg' in body) { console.log('FIREBASE: ' + body['msg'].replace('\n', '\nFIREBASE: ')); } } }; PersistentConnection.prototype.restoreState_ = function () { var _this = this; //Re-authenticate ourselves if we have a credential stored. this.tryAuth(); // Puts depend on having received the corresponding data update from the server before they complete, so we must // make sure to send listens before puts. util.forEach(this.listens_, function (pathString, queries) { util.forEach(queries, function (key, listenSpec) { _this.sendListen_(listenSpec); }); }); for (var i = 0; i < this.outstandingPuts_.length; i++) { if (this.outstandingPuts_[i]) this.sendPut_(i); } while (this.onDisconnectRequestQueue_.length) { var request = this.onDisconnectRequestQueue_.shift(); this.sendOnDisconnect_(request.action, request.pathString, request.data, request.onComplete); } }; /** * Sends client stats for first connection * @private */ PersistentConnection.prototype.sendConnectStats_ = function () { var stats = {}; var clientName = 'js'; if (util.CONSTANTS.NODE_ADMIN) { clientName = 'admin_node'; } else if (util.CONSTANTS.NODE_CLIENT) { clientName = 'node'; } stats['sdk.' + clientName + '.' + firebase.SDK_VERSION.replace(/\./g, '-')] = 1; if (util.isMobileCordova()) { stats['framework.cordova'] = 1; } else if (util.isReactNative()) { stats['framework.reactnative'] = 1; } this.reportStats(stats); }; /** * @return {boolean} * @private */ PersistentConnection.prototype.shouldReconnect_ = function () { var online = OnlineMonitor.getInstance().currentlyOnline(); return util.isEmpty(this.interruptReasons_) && online; }; /** * @private */ PersistentConnection.nextPersistentConnectionId_ = 0; /** * Counter for number of connections created. Mainly used for tagging in the logs * @type {number} * @private */ PersistentConnection.nextConnectionId_ = 0; return PersistentConnection; }(ServerActions)); /** * Copyright 2017 Google Inc. * * 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. */ /** * An implementation of ServerActions that communicates with the server via REST requests. * This is mostly useful for compatibility with crawlers, where we don't want to spin up a full * persistent connection (using WebSockets or long-polling) */ var ReadonlyRestClient = /** @class */ (function (_super) { tslib_1.__extends(ReadonlyRestClient, _super); /** * @param {!RepoInfo} repoInfo_ Data about the namespace we are connecting to * @param {function(string, *, boolean, ?number)} onDataUpdate_ A callback for new data from the server * @param {AuthTokenProvider} authTokenProvider_ * @implements {ServerActions} */ function ReadonlyRestClient(repoInfo_, onDataUpdate_, authTokenProvider_) { var _this = _super.call(this) || this; _this.repoInfo_ = repoInfo_; _this.onDataUpdate_ = onDataUpdate_; _this.authTokenProvider_ = authTokenProvider_; /** @private {function(...[*])} */ _this.log_ = logWrapper('p:rest:'); /** * We don't actually need to track listens, except to prevent us calling an onComplete for a listen * that's been removed. :-/ * * @private {!Object.} */ _this.listens_ = {}; return _this; } ReadonlyRestClient.prototype.reportStats = function (stats) { throw new Error('Method not implemented.'); }; /** * @param {!Query} query * @param {?number=} tag * @return {string} * @private */ ReadonlyRestClient.getListenId_ = function (query, tag) { if (tag !== undefined) { return 'tag$' + tag; } else { util.assert(query.getQueryParams().isDefault(), "should have a tag if it's not a default query."); return query.path.toString(); } }; /** @inheritDoc */ ReadonlyRestClient.prototype.listen = function (query, currentHashFn, tag, onComplete) { var _this = this; var pathString = query.path.toString(); this.log_('Listen called for ' + pathString + ' ' + query.queryIdentifier()); // Mark this listener so we can tell if it's removed. var listenId = ReadonlyRestClient.getListenId_(query, tag); var thisListen = {}; this.listens_[listenId] = thisListen; var queryStringParamaters = query .getQueryParams() .toRestQueryStringParameters(); this.restRequest_(pathString + '.json', queryStringParamaters, function (error$$1, result) { var data = result; if (error$$1 === 404) { data = null; error$$1 = null; } if (error$$1 === null) { _this.onDataUpdate_(pathString, data, /*isMerge=*/ false, tag); } if (util.safeGet(_this.listens_, listenId) === thisListen) { var status_1; if (!error$$1) { status_1 = 'ok'; } else if (error$$1 == 401) { status_1 = 'permission_denied'; } else { status_1 = 'rest_error:' + error$$1; } onComplete(status_1, null); } }); }; /** @inheritDoc */ ReadonlyRestClient.prototype.unlisten = function (query, tag) { var listenId = ReadonlyRestClient.getListenId_(query, tag); delete this.listens_[listenId]; }; /** @inheritDoc */ ReadonlyRestClient.prototype.refreshAuthToken = function (token) { // no-op since we just always call getToken. }; /** * Performs a REST request to the given path, with the provided query string parameters, * and any auth credentials we have. * * @param {!string} pathString * @param {!Object.} queryStringParameters * @param {?function(?number, *=)} callback * @private */ ReadonlyRestClient.prototype.restRequest_ = function (pathString, queryStringParameters, callback) { var _this = this; if (queryStringParameters === void 0) { queryStringParameters = {}; } queryStringParameters['format'] = 'export'; this.authTokenProvider_ .getToken(/*forceRefresh=*/ false) .then(function (authTokenData) { var authToken = authTokenData && authTokenData.accessToken; if (authToken) { queryStringParameters['auth'] = authToken; } var url = (_this.repoInfo_.secure ? 'https://' : 'http://') + _this.repoInfo_.host + pathString + '?' + util.querystring(queryStringParameters); _this.log_('Sending REST request for ' + url); var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (callback && xhr.readyState === 4) { _this.log_('REST Response for ' + url + ' received. status:', xhr.status, 'response:', xhr.responseText); var res = null; if (xhr.status >= 200 && xhr.status < 300) { try { res = util.jsonEval(xhr.responseText); } catch (e) { warn('Failed to parse JSON response for ' + url + ': ' + xhr.responseText); } callback(null, res); } else { // 401 and 404 are expected. if (xhr.status !== 401 && xhr.status !== 404) { warn('Got unsuccessful REST response for ' + url + ' Status: ' + xhr.status); } callback(xhr.status); } callback = null; } }; xhr.open('GET', url, /*asynchronous=*/ true); xhr.send(); }); }; return ReadonlyRestClient; }(ServerActions)); /** * Copyright 2017 Google Inc. * * 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. */ var INTERRUPT_REASON = 'repo_interrupt'; /** * A connection to a single data repository. */ var Repo = /** @class */ (function () { /** * @param {!RepoInfo} repoInfo_ * @param {boolean} forceRestClient * @param {!FirebaseApp} app */ function Repo(repoInfo_, forceRestClient, app) { var _this = this; this.repoInfo_ = repoInfo_; this.app = app; this.dataUpdateCount = 0; this.statsListener_ = null; this.eventQueue_ = new EventQueue(); this.nextWriteId_ = 1; this.interceptServerDataCallback_ = null; // A list of data pieces and paths to be set when this client disconnects. this.onDisconnect_ = new SparseSnapshotTree(); /** * TODO: This should be @private but it's used by test_access.js and internal.js * @type {?PersistentConnection} */ this.persistentConnection_ = null; /** @type {!AuthTokenProvider} */ var authTokenProvider = new AuthTokenProvider(app); this.stats_ = StatsManager.getCollection(repoInfo_); if (forceRestClient || beingCrawled()) { this.server_ = new ReadonlyRestClient(this.repoInfo_, this.onDataUpdate_.bind(this), authTokenProvider); // Minor hack: Fire onConnect immediately, since there's no actual connection. setTimeout(this.onConnectStatus_.bind(this, true), 0); } else { var authOverride = app.options['databaseAuthVariableOverride']; // Validate authOverride if (typeof authOverride !== 'undefined' && authOverride !== null) { if (typeof authOverride !== 'object') { throw new Error('Only objects are supported for option databaseAuthVariableOverride'); } try { util.stringify(authOverride); } catch (e) { throw new Error('Invalid authOverride provided: ' + e); } } this.persistentConnection_ = new PersistentConnection(this.repoInfo_, this.onDataUpdate_.bind(this), this.onConnectStatus_.bind(this), this.onServerInfoUpdate_.bind(this), authTokenProvider, authOverride); this.server_ = this.persistentConnection_; } authTokenProvider.addTokenChangeListener(function (token) { _this.server_.refreshAuthToken(token); }); // In the case of multiple Repos for the same repoInfo (i.e. there are multiple Firebase.Contexts being used), // we only want to create one StatsReporter. As such, we'll report stats over the first Repo created. this.statsReporter_ = StatsManager.getOrCreateReporter(repoInfo_, function () { return new StatsReporter(_this.stats_, _this.server_); }); this.transactions_init_(); // Used for .info. this.infoData_ = new SnapshotHolder(); this.infoSyncTree_ = new SyncTree({ startListening: function (query, tag, currentHashFn, onComplete) { var infoEvents = []; var node = _this.infoData_.getNode(query.path); // This is possibly a hack, but we have different semantics for .info endpoints. We don't raise null events // on initial data... if (!node.isEmpty()) { infoEvents = _this.infoSyncTree_.applyServerOverwrite(query.path, node); setTimeout(function () { onComplete('ok'); }, 0); } return infoEvents; }, stopListening: function () { } }); this.updateInfo_('connected', false); this.serverSyncTree_ = new SyncTree({ startListening: function (query, tag, currentHashFn, onComplete) { _this.server_.listen(query, currentHashFn, tag, function (status, data) { var events = onComplete(status, data); _this.eventQueue_.raiseEventsForChangedPath(query.path, events); }); // No synchronous events for network-backed sync trees return []; }, stopListening: function (query, tag) { _this.server_.unlisten(query, tag); } }); } /** * @return {string} The URL corresponding to the root of this Firebase. */ Repo.prototype.toString = function () { return ((this.repoInfo_.secure ? 'https://' : 'http://') + this.repoInfo_.host); }; /** * @return {!string} The namespace represented by the repo. */ Repo.prototype.name = function () { return this.repoInfo_.namespace; }; /** * @return {!number} The time in milliseconds, taking the server offset into account if we have one. */ Repo.prototype.serverTime = function () { var offsetNode = this.infoData_.getNode(new Path('.info/serverTimeOffset')); var offset = offsetNode.val() || 0; return new Date().getTime() + offset; }; /** * Generate ServerValues using some variables from the repo object. * @return {!Object} */ Repo.prototype.generateServerValues = function () { return generateWithValues({ timestamp: this.serverTime() }); }; /** * Called by realtime when we get new messages from the server. * * @private * @param {string} pathString * @param {*} data * @param {boolean} isMerge * @param {?number} tag */ Repo.prototype.onDataUpdate_ = function (pathString, data, isMerge, tag) { // For testing. this.dataUpdateCount++; var path = new Path(pathString); data = this.interceptServerDataCallback_ ? this.interceptServerDataCallback_(pathString, data) : data; var events = []; if (tag) { if (isMerge) { var taggedChildren = util.map(data, function (raw) { return nodeFromJSON$1(raw); }); events = this.serverSyncTree_.applyTaggedQueryMerge(path, taggedChildren, tag); } else { var taggedSnap = nodeFromJSON$1(data); events = this.serverSyncTree_.applyTaggedQueryOverwrite(path, taggedSnap, tag); } } else if (isMerge) { var changedChildren = util.map(data, function (raw) { return nodeFromJSON$1(raw); }); events = this.serverSyncTree_.applyServerMerge(path, changedChildren); } else { var snap = nodeFromJSON$1(data); events = this.serverSyncTree_.applyServerOverwrite(path, snap); } var affectedPath = path; if (events.length > 0) { // Since we have a listener outstanding for each transaction, receiving any events // is a proxy for some change having occurred. affectedPath = this.rerunTransactions_(path); } this.eventQueue_.raiseEventsForChangedPath(affectedPath, events); }; /** * TODO: This should be @private but it's used by test_access.js and internal.js * @param {?function(!string, *):*} callback * @private */ Repo.prototype.interceptServerData_ = function (callback) { this.interceptServerDataCallback_ = callback; }; /** * @param {!boolean} connectStatus * @private */ Repo.prototype.onConnectStatus_ = function (connectStatus) { this.updateInfo_('connected', connectStatus); if (connectStatus === false) { this.runOnDisconnectEvents_(); } }; /** * @param {!Object} updates * @private */ Repo.prototype.onServerInfoUpdate_ = function (updates) { var _this = this; each(updates, function (value, key) { _this.updateInfo_(key, value); }); }; /** * * @param {!string} pathString * @param {*} value * @private */ Repo.prototype.updateInfo_ = function (pathString, value) { var path = new Path('/.info/' + pathString); var newNode = nodeFromJSON$1(value); this.infoData_.updateSnapshot(path, newNode); var events = this.infoSyncTree_.applyServerOverwrite(path, newNode); this.eventQueue_.raiseEventsForChangedPath(path, events); }; /** * @return {!number} * @private */ Repo.prototype.getNextWriteId_ = function () { return this.nextWriteId_++; }; /** * @param {!Path} path * @param {*} newVal * @param {number|string|null} newPriority * @param {?function(?Error, *=)} onComplete */ Repo.prototype.setWithPriority = function (path, newVal, newPriority, onComplete) { var _this = this; this.log_('set', { path: path.toString(), value: newVal, priority: newPriority }); // TODO: Optimize this behavior to either (a) store flag to skip resolving where possible and / or // (b) store unresolved paths on JSON parse var serverValues = this.generateServerValues(); var newNodeUnresolved = nodeFromJSON$1(newVal, newPriority); var newNode = resolveDeferredValueSnapshot(newNodeUnresolved, serverValues); var writeId = this.getNextWriteId_(); var events = this.serverSyncTree_.applyUserOverwrite(path, newNode, writeId, true); this.eventQueue_.queueEvents(events); this.server_.put(path.toString(), newNodeUnresolved.val(/*export=*/ true), function (status, errorReason) { var success = status === 'ok'; if (!success) { warn('set at ' + path + ' failed: ' + status); } var clearEvents = _this.serverSyncTree_.ackUserWrite(writeId, !success); _this.eventQueue_.raiseEventsForChangedPath(path, clearEvents); _this.callOnCompleteCallback(onComplete, status, errorReason); }); var affectedPath = this.abortTransactions_(path); this.rerunTransactions_(affectedPath); // We queued the events above, so just flush the queue here this.eventQueue_.raiseEventsForChangedPath(affectedPath, []); }; /** * @param {!Path} path * @param {!Object} childrenToMerge * @param {?function(?Error, *=)} onComplete */ Repo.prototype.update = function (path, childrenToMerge, onComplete) { var _this = this; this.log_('update', { path: path.toString(), value: childrenToMerge }); // Start with our existing data and merge each child into it. var empty = true; var serverValues = this.generateServerValues(); var changedChildren = {}; util.forEach(childrenToMerge, function (changedKey, changedValue) { empty = false; var newNodeUnresolved = nodeFromJSON$1(changedValue); changedChildren[changedKey] = resolveDeferredValueSnapshot(newNodeUnresolved, serverValues); }); if (!empty) { var writeId_1 = this.getNextWriteId_(); var events = this.serverSyncTree_.applyUserMerge(path, changedChildren, writeId_1); this.eventQueue_.queueEvents(events); this.server_.merge(path.toString(), childrenToMerge, function (status, errorReason) { var success = status === 'ok'; if (!success) { warn('update at ' + path + ' failed: ' + status); } var clearEvents = _this.serverSyncTree_.ackUserWrite(writeId_1, !success); var affectedPath = clearEvents.length > 0 ? _this.rerunTransactions_(path) : path; _this.eventQueue_.raiseEventsForChangedPath(affectedPath, clearEvents); _this.callOnCompleteCallback(onComplete, status, errorReason); }); util.forEach(childrenToMerge, function (changedPath) { var affectedPath = _this.abortTransactions_(path.child(changedPath)); _this.rerunTransactions_(affectedPath); }); // We queued the events above, so just flush the queue here this.eventQueue_.raiseEventsForChangedPath(path, []); } else { log("update() called with empty data. Don't do anything."); this.callOnCompleteCallback(onComplete, 'ok'); } }; /** * Applies all of the changes stored up in the onDisconnect_ tree. * @private */ Repo.prototype.runOnDisconnectEvents_ = function () { var _this = this; this.log_('onDisconnectEvents'); var serverValues = this.generateServerValues(); var resolvedOnDisconnectTree = resolveDeferredValueTree(this.onDisconnect_, serverValues); var events = []; resolvedOnDisconnectTree.forEachTree(Path.Empty, function (path, snap) { events = events.concat(_this.serverSyncTree_.applyServerOverwrite(path, snap)); var affectedPath = _this.abortTransactions_(path); _this.rerunTransactions_(affectedPath); }); this.onDisconnect_ = new SparseSnapshotTree(); this.eventQueue_.raiseEventsForChangedPath(Path.Empty, events); }; /** * @param {!Path} path * @param {?function(?Error, *=)} onComplete */ Repo.prototype.onDisconnectCancel = function (path, onComplete) { var _this = this; this.server_.onDisconnectCancel(path.toString(), function (status, errorReason) { if (status === 'ok') { _this.onDisconnect_.forget(path); } _this.callOnCompleteCallback(onComplete, status, errorReason); }); }; /** * @param {!Path} path * @param {*} value * @param {?function(?Error, *=)} onComplete */ Repo.prototype.onDisconnectSet = function (path, value, onComplete) { var _this = this; var newNode = nodeFromJSON$1(value); this.server_.onDisconnectPut(path.toString(), newNode.val(/*export=*/ true), function (status, errorReason) { if (status === 'ok') { _this.onDisconnect_.remember(path, newNode); } _this.callOnCompleteCallback(onComplete, status, errorReason); }); }; /** * @param {!Path} path * @param {*} value * @param {*} priority * @param {?function(?Error, *=)} onComplete */ Repo.prototype.onDisconnectSetWithPriority = function (path, value, priority, onComplete) { var _this = this; var newNode = nodeFromJSON$1(value, priority); this.server_.onDisconnectPut(path.toString(), newNode.val(/*export=*/ true), function (status, errorReason) { if (status === 'ok') { _this.onDisconnect_.remember(path, newNode); } _this.callOnCompleteCallback(onComplete, status, errorReason); }); }; /** * @param {!Path} path * @param {*} childrenToMerge * @param {?function(?Error, *=)} onComplete */ Repo.prototype.onDisconnectUpdate = function (path, childrenToMerge, onComplete) { var _this = this; if (util.isEmpty(childrenToMerge)) { log("onDisconnect().update() called with empty data. Don't do anything."); this.callOnCompleteCallback(onComplete, 'ok'); return; } this.server_.onDisconnectMerge(path.toString(), childrenToMerge, function (status, errorReason) { if (status === 'ok') { util.forEach(childrenToMerge, function (childName, childNode) { var newChildNode = nodeFromJSON$1(childNode); _this.onDisconnect_.remember(path.child(childName), newChildNode); }); } _this.callOnCompleteCallback(onComplete, status, errorReason); }); }; /** * @param {!Query} query * @param {!EventRegistration} eventRegistration */ Repo.prototype.addEventCallbackForQuery = function (query, eventRegistration) { var events; if (query.path.getFront() === '.info') { events = this.infoSyncTree_.addEventRegistration(query, eventRegistration); } else { events = this.serverSyncTree_.addEventRegistration(query, eventRegistration); } this.eventQueue_.raiseEventsAtPath(query.path, events); }; /** * @param {!Query} query * @param {?EventRegistration} eventRegistration */ Repo.prototype.removeEventCallbackForQuery = function (query, eventRegistration) { // These are guaranteed not to raise events, since we're not passing in a cancelError. However, we can future-proof // a little bit by handling the return values anyways. var events; if (query.path.getFront() === '.info') { events = this.infoSyncTree_.removeEventRegistration(query, eventRegistration); } else { events = this.serverSyncTree_.removeEventRegistration(query, eventRegistration); } this.eventQueue_.raiseEventsAtPath(query.path, events); }; Repo.prototype.interrupt = function () { if (this.persistentConnection_) { this.persistentConnection_.interrupt(INTERRUPT_REASON); } }; Repo.prototype.resume = function () { if (this.persistentConnection_) { this.persistentConnection_.resume(INTERRUPT_REASON); } }; Repo.prototype.stats = function (showDelta) { if (showDelta === void 0) { showDelta = false; } if (typeof console === 'undefined') return; var stats; if (showDelta) { if (!this.statsListener_) this.statsListener_ = new StatsListener(this.stats_); stats = this.statsListener_.get(); } else { stats = this.stats_.get(); } var longestName = Object.keys(stats).reduce(function (previousValue, currentValue) { return Math.max(currentValue.length, previousValue); }, 0); util.forEach(stats, function (stat, value) { // pad stat names to be the same length (plus 2 extra spaces). for (var i = stat.length; i < longestName + 2; i++) stat += ' '; console.log(stat + value); }); }; Repo.prototype.statsIncrementCounter = function (metric) { this.stats_.incrementCounter(metric); this.statsReporter_.includeStat(metric); }; /** * @param {...*} var_args * @private */ Repo.prototype.log_ = function () { var var_args = []; for (var _i = 0; _i < arguments.length; _i++) { var_args[_i] = arguments[_i]; } var prefix = ''; if (this.persistentConnection_) { prefix = this.persistentConnection_.id + ':'; } log.apply(void 0, [prefix].concat(var_args)); }; /** * @param {?function(?Error, *=)} callback * @param {!string} status * @param {?string=} errorReason */ Repo.prototype.callOnCompleteCallback = function (callback, status, errorReason) { if (callback) { exceptionGuard(function () { if (status == 'ok') { callback(null); } else { var code = (status || 'error').toUpperCase(); var message = code; if (errorReason) message += ': ' + errorReason; var error$$1 = new Error(message); error$$1.code = code; callback(error$$1); } }); } }; Object.defineProperty(Repo.prototype, "database", { get: function () { return this.__database || (this.__database = new Database(this)); }, enumerable: true, configurable: true }); return Repo; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Filters nodes by range and uses an IndexFilter to track any changes after filtering the node * * @constructor * @implements {NodeFilter} */ var RangedFilter = /** @class */ (function () { /** * @param {!QueryParams} params */ function RangedFilter(params) { this.indexedFilter_ = new IndexedFilter(params.getIndex()); this.index_ = params.getIndex(); this.startPost_ = RangedFilter.getStartPost_(params); this.endPost_ = RangedFilter.getEndPost_(params); } /** * @return {!NamedNode} */ RangedFilter.prototype.getStartPost = function () { return this.startPost_; }; /** * @return {!NamedNode} */ RangedFilter.prototype.getEndPost = function () { return this.endPost_; }; /** * @param {!NamedNode} node * @return {boolean} */ RangedFilter.prototype.matches = function (node) { return (this.index_.compare(this.getStartPost(), node) <= 0 && this.index_.compare(node, this.getEndPost()) <= 0); }; /** * @inheritDoc */ RangedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) { if (!this.matches(new NamedNode(key, newChild))) { newChild = ChildrenNode.EMPTY_NODE; } return this.indexedFilter_.updateChild(snap, key, newChild, affectedPath, source, optChangeAccumulator); }; /** * @inheritDoc */ RangedFilter.prototype.updateFullNode = function (oldSnap, newSnap, optChangeAccumulator) { if (newSnap.isLeafNode()) { // Make sure we have a children node with the correct index, not a leaf node; newSnap = ChildrenNode.EMPTY_NODE; } var filtered = newSnap.withIndex(this.index_); // Don't support priorities on queries filtered = filtered.updatePriority(ChildrenNode.EMPTY_NODE); var self = this; newSnap.forEachChild(PRIORITY_INDEX, function (key, childNode) { if (!self.matches(new NamedNode(key, childNode))) { filtered = filtered.updateImmediateChild(key, ChildrenNode.EMPTY_NODE); } }); return this.indexedFilter_.updateFullNode(oldSnap, filtered, optChangeAccumulator); }; /** * @inheritDoc */ RangedFilter.prototype.updatePriority = function (oldSnap, newPriority) { // Don't support priorities on queries return oldSnap; }; /** * @inheritDoc */ RangedFilter.prototype.filtersNodes = function () { return true; }; /** * @inheritDoc */ RangedFilter.prototype.getIndexedFilter = function () { return this.indexedFilter_; }; /** * @inheritDoc */ RangedFilter.prototype.getIndex = function () { return this.index_; }; /** * @param {!QueryParams} params * @return {!NamedNode} * @private */ RangedFilter.getStartPost_ = function (params) { if (params.hasStart()) { var startName = params.getIndexStartName(); return params.getIndex().makePost(params.getIndexStartValue(), startName); } else { return params.getIndex().minPost(); } }; /** * @param {!QueryParams} params * @return {!NamedNode} * @private */ RangedFilter.getEndPost_ = function (params) { if (params.hasEnd()) { var endName = params.getIndexEndName(); return params.getIndex().makePost(params.getIndexEndValue(), endName); } else { return params.getIndex().maxPost(); } }; return RangedFilter; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Applies a limit and a range to a node and uses RangedFilter to do the heavy lifting where possible * * @constructor * @implements {NodeFilter} */ var LimitedFilter = /** @class */ (function () { /** * @param {!QueryParams} params */ function LimitedFilter(params) { this.rangedFilter_ = new RangedFilter(params); this.index_ = params.getIndex(); this.limit_ = params.getLimit(); this.reverse_ = !params.isViewFromLeft(); } /** * @inheritDoc */ LimitedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) { if (!this.rangedFilter_.matches(new NamedNode(key, newChild))) { newChild = ChildrenNode.EMPTY_NODE; } if (snap.getImmediateChild(key).equals(newChild)) { // No change return snap; } else if (snap.numChildren() < this.limit_) { return this.rangedFilter_ .getIndexedFilter() .updateChild(snap, key, newChild, affectedPath, source, optChangeAccumulator); } else { return this.fullLimitUpdateChild_(snap, key, newChild, source, optChangeAccumulator); } }; /** * @inheritDoc */ LimitedFilter.prototype.updateFullNode = function (oldSnap, newSnap, optChangeAccumulator) { var filtered; if (newSnap.isLeafNode() || newSnap.isEmpty()) { // Make sure we have a children node with the correct index, not a leaf node; filtered = ChildrenNode.EMPTY_NODE.withIndex(this.index_); } else { if (this.limit_ * 2 < newSnap.numChildren() && newSnap.isIndexed(this.index_)) { // Easier to build up a snapshot, since what we're given has more than twice the elements we want filtered = ChildrenNode.EMPTY_NODE.withIndex(this.index_); // anchor to the startPost, endPost, or last element as appropriate var iterator = void 0; if (this.reverse_) { iterator = newSnap.getReverseIteratorFrom(this.rangedFilter_.getEndPost(), this.index_); } else { iterator = newSnap.getIteratorFrom(this.rangedFilter_.getStartPost(), this.index_); } var count = 0; while (iterator.hasNext() && count < this.limit_) { var next = iterator.getNext(); var inRange = void 0; if (this.reverse_) { inRange = this.index_.compare(this.rangedFilter_.getStartPost(), next) <= 0; } else { inRange = this.index_.compare(next, this.rangedFilter_.getEndPost()) <= 0; } if (inRange) { filtered = filtered.updateImmediateChild(next.name, next.node); count++; } else { // if we have reached the end post, we cannot keep adding elemments break; } } } else { // The snap contains less than twice the limit. Faster to delete from the snap than build up a new one filtered = newSnap.withIndex(this.index_); // Don't support priorities on queries filtered = filtered.updatePriority(ChildrenNode.EMPTY_NODE); var startPost = void 0; var endPost = void 0; var cmp = void 0; var iterator = void 0; if (this.reverse_) { iterator = filtered.getReverseIterator(this.index_); startPost = this.rangedFilter_.getEndPost(); endPost = this.rangedFilter_.getStartPost(); var indexCompare_1 = this.index_.getCompare(); cmp = function (a, b) { return indexCompare_1(b, a); }; } else { iterator = filtered.getIterator(this.index_); startPost = this.rangedFilter_.getStartPost(); endPost = this.rangedFilter_.getEndPost(); cmp = this.index_.getCompare(); } var count = 0; var foundStartPost = false; while (iterator.hasNext()) { var next = iterator.getNext(); if (!foundStartPost && cmp(startPost, next) <= 0) { // start adding foundStartPost = true; } var inRange = foundStartPost && count < this.limit_ && cmp(next, endPost) <= 0; if (inRange) { count++; } else { filtered = filtered.updateImmediateChild(next.name, ChildrenNode.EMPTY_NODE); } } } } return this.rangedFilter_ .getIndexedFilter() .updateFullNode(oldSnap, filtered, optChangeAccumulator); }; /** * @inheritDoc */ LimitedFilter.prototype.updatePriority = function (oldSnap, newPriority) { // Don't support priorities on queries return oldSnap; }; /** * @inheritDoc */ LimitedFilter.prototype.filtersNodes = function () { return true; }; /** * @inheritDoc */ LimitedFilter.prototype.getIndexedFilter = function () { return this.rangedFilter_.getIndexedFilter(); }; /** * @inheritDoc */ LimitedFilter.prototype.getIndex = function () { return this.index_; }; /** * @param {!Node} snap * @param {string} childKey * @param {!Node} childSnap * @param {!CompleteChildSource} source * @param {?ChildChangeAccumulator} changeAccumulator * @return {!Node} * @private */ LimitedFilter.prototype.fullLimitUpdateChild_ = function (snap, childKey, childSnap, source, changeAccumulator) { // TODO: rename all cache stuff etc to general snap terminology var cmp; if (this.reverse_) { var indexCmp_1 = this.index_.getCompare(); cmp = function (a, b) { return indexCmp_1(b, a); }; } else { cmp = this.index_.getCompare(); } var oldEventCache = snap; util.assert(oldEventCache.numChildren() == this.limit_, ''); var newChildNamedNode = new NamedNode(childKey, childSnap); var windowBoundary = this.reverse_ ? oldEventCache.getFirstChild(this.index_) : oldEventCache.getLastChild(this.index_); var inRange = this.rangedFilter_.matches(newChildNamedNode); if (oldEventCache.hasChild(childKey)) { var oldChildSnap = oldEventCache.getImmediateChild(childKey); var nextChild = source.getChildAfterChild(this.index_, windowBoundary, this.reverse_); while (nextChild != null && (nextChild.name == childKey || oldEventCache.hasChild(nextChild.name))) { // There is a weird edge case where a node is updated as part of a merge in the write tree, but hasn't // been applied to the limited filter yet. Ignore this next child which will be updated later in // the limited filter... nextChild = source.getChildAfterChild(this.index_, nextChild, this.reverse_); } var compareNext = nextChild == null ? 1 : cmp(nextChild, newChildNamedNode); var remainsInWindow = inRange && !childSnap.isEmpty() && compareNext >= 0; if (remainsInWindow) { if (changeAccumulator != null) { changeAccumulator.trackChildChange(Change.childChangedChange(childKey, childSnap, oldChildSnap)); } return oldEventCache.updateImmediateChild(childKey, childSnap); } else { if (changeAccumulator != null) { changeAccumulator.trackChildChange(Change.childRemovedChange(childKey, oldChildSnap)); } var newEventCache = oldEventCache.updateImmediateChild(childKey, ChildrenNode.EMPTY_NODE); var nextChildInRange = nextChild != null && this.rangedFilter_.matches(nextChild); if (nextChildInRange) { if (changeAccumulator != null) { changeAccumulator.trackChildChange(Change.childAddedChange(nextChild.name, nextChild.node)); } return newEventCache.updateImmediateChild(nextChild.name, nextChild.node); } else { return newEventCache; } } } else if (childSnap.isEmpty()) { // we're deleting a node, but it was not in the window, so ignore it return snap; } else if (inRange) { if (cmp(windowBoundary, newChildNamedNode) >= 0) { if (changeAccumulator != null) { changeAccumulator.trackChildChange(Change.childRemovedChange(windowBoundary.name, windowBoundary.node)); changeAccumulator.trackChildChange(Change.childAddedChange(childKey, childSnap)); } return oldEventCache .updateImmediateChild(childKey, childSnap) .updateImmediateChild(windowBoundary.name, ChildrenNode.EMPTY_NODE); } else { return snap; } } else { return snap; } }; return LimitedFilter; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * This class is an immutable-from-the-public-api struct containing a set of query parameters defining a * range to be returned for a particular location. It is assumed that validation of parameters is done at the * user-facing API level, so it is not done here. * @constructor */ var QueryParams = /** @class */ (function () { function QueryParams() { this.limitSet_ = false; this.startSet_ = false; this.startNameSet_ = false; this.endSet_ = false; this.endNameSet_ = false; this.limit_ = 0; this.viewFrom_ = ''; this.indexStartValue_ = null; this.indexStartName_ = ''; this.indexEndValue_ = null; this.indexEndName_ = ''; this.index_ = PRIORITY_INDEX; } /** * @return {boolean} */ QueryParams.prototype.hasStart = function () { return this.startSet_; }; /** * @return {boolean} True if it would return from left. */ QueryParams.prototype.isViewFromLeft = function () { if (this.viewFrom_ === '') { // limit(), rather than limitToFirst or limitToLast was called. // This means that only one of startSet_ and endSet_ is true. Use them // to calculate which side of the view to anchor to. If neither is set, // anchor to the end. return this.startSet_; } else { return (this.viewFrom_ === QueryParams.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT); } }; /** * Only valid to call if hasStart() returns true * @return {*} */ QueryParams.prototype.getIndexStartValue = function () { util.assert(this.startSet_, 'Only valid if start has been set'); return this.indexStartValue_; }; /** * Only valid to call if hasStart() returns true. * Returns the starting key name for the range defined by these query parameters * @return {!string} */ QueryParams.prototype.getIndexStartName = function () { util.assert(this.startSet_, 'Only valid if start has been set'); if (this.startNameSet_) { return this.indexStartName_; } else { return MIN_NAME; } }; /** * @return {boolean} */ QueryParams.prototype.hasEnd = function () { return this.endSet_; }; /** * Only valid to call if hasEnd() returns true. * @return {*} */ QueryParams.prototype.getIndexEndValue = function () { util.assert(this.endSet_, 'Only valid if end has been set'); return this.indexEndValue_; }; /** * Only valid to call if hasEnd() returns true. * Returns the end key name for the range defined by these query parameters * @return {!string} */ QueryParams.prototype.getIndexEndName = function () { util.assert(this.endSet_, 'Only valid if end has been set'); if (this.endNameSet_) { return this.indexEndName_; } else { return MAX_NAME; } }; /** * @return {boolean} */ QueryParams.prototype.hasLimit = function () { return this.limitSet_; }; /** * @return {boolean} True if a limit has been set and it has been explicitly anchored */ QueryParams.prototype.hasAnchoredLimit = function () { return this.limitSet_ && this.viewFrom_ !== ''; }; /** * Only valid to call if hasLimit() returns true * @return {!number} */ QueryParams.prototype.getLimit = function () { util.assert(this.limitSet_, 'Only valid if limit has been set'); return this.limit_; }; /** * @return {!Index} */ QueryParams.prototype.getIndex = function () { return this.index_; }; /** * @return {!QueryParams} * @private */ QueryParams.prototype.copy_ = function () { var copy = new QueryParams(); copy.limitSet_ = this.limitSet_; copy.limit_ = this.limit_; copy.startSet_ = this.startSet_; copy.indexStartValue_ = this.indexStartValue_; copy.startNameSet_ = this.startNameSet_; copy.indexStartName_ = this.indexStartName_; copy.endSet_ = this.endSet_; copy.indexEndValue_ = this.indexEndValue_; copy.endNameSet_ = this.endNameSet_; copy.indexEndName_ = this.indexEndName_; copy.index_ = this.index_; copy.viewFrom_ = this.viewFrom_; return copy; }; /** * @param {!number} newLimit * @return {!QueryParams} */ QueryParams.prototype.limit = function (newLimit) { var newParams = this.copy_(); newParams.limitSet_ = true; newParams.limit_ = newLimit; newParams.viewFrom_ = ''; return newParams; }; /** * @param {!number} newLimit * @return {!QueryParams} */ QueryParams.prototype.limitToFirst = function (newLimit) { var newParams = this.copy_(); newParams.limitSet_ = true; newParams.limit_ = newLimit; newParams.viewFrom_ = QueryParams.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT; return newParams; }; /** * @param {!number} newLimit * @return {!QueryParams} */ QueryParams.prototype.limitToLast = function (newLimit) { var newParams = this.copy_(); newParams.limitSet_ = true; newParams.limit_ = newLimit; newParams.viewFrom_ = QueryParams.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT; return newParams; }; /** * @param {*} indexValue * @param {?string=} key * @return {!QueryParams} */ QueryParams.prototype.startAt = function (indexValue, key) { var newParams = this.copy_(); newParams.startSet_ = true; if (!(indexValue !== undefined)) { indexValue = null; } newParams.indexStartValue_ = indexValue; if (key != null) { newParams.startNameSet_ = true; newParams.indexStartName_ = key; } else { newParams.startNameSet_ = false; newParams.indexStartName_ = ''; } return newParams; }; /** * @param {*} indexValue * @param {?string=} key * @return {!QueryParams} */ QueryParams.prototype.endAt = function (indexValue, key) { var newParams = this.copy_(); newParams.endSet_ = true; if (!(indexValue !== undefined)) { indexValue = null; } newParams.indexEndValue_ = indexValue; if (key !== undefined) { newParams.endNameSet_ = true; newParams.indexEndName_ = key; } else { newParams.endNameSet_ = false; newParams.indexEndName_ = ''; } return newParams; }; /** * @param {!Index} index * @return {!QueryParams} */ QueryParams.prototype.orderBy = function (index) { var newParams = this.copy_(); newParams.index_ = index; return newParams; }; /** * @return {!Object} */ QueryParams.prototype.getQueryObject = function () { var WIRE_PROTOCOL_CONSTANTS = QueryParams.WIRE_PROTOCOL_CONSTANTS_; var obj = {}; if (this.startSet_) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX_START_VALUE] = this.indexStartValue_; if (this.startNameSet_) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX_START_NAME] = this.indexStartName_; } } if (this.endSet_) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX_END_VALUE] = this.indexEndValue_; if (this.endNameSet_) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX_END_NAME] = this.indexEndName_; } } if (this.limitSet_) { obj[WIRE_PROTOCOL_CONSTANTS.LIMIT] = this.limit_; var viewFrom = this.viewFrom_; if (viewFrom === '') { if (this.isViewFromLeft()) { viewFrom = WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT; } else { viewFrom = WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT; } } obj[WIRE_PROTOCOL_CONSTANTS.VIEW_FROM] = viewFrom; } // For now, priority index is the default, so we only specify if it's some other index if (this.index_ !== PRIORITY_INDEX) { obj[WIRE_PROTOCOL_CONSTANTS.INDEX] = this.index_.toString(); } return obj; }; /** * @return {boolean} */ QueryParams.prototype.loadsAllData = function () { return !(this.startSet_ || this.endSet_ || this.limitSet_); }; /** * @return {boolean} */ QueryParams.prototype.isDefault = function () { return this.loadsAllData() && this.index_ == PRIORITY_INDEX; }; /** * @return {!NodeFilter} */ QueryParams.prototype.getNodeFilter = function () { if (this.loadsAllData()) { return new IndexedFilter(this.getIndex()); } else if (this.hasLimit()) { return new LimitedFilter(this); } else { return new RangedFilter(this); } }; /** * Returns a set of REST query string parameters representing this query. * * @return {!Object.} query string parameters */ QueryParams.prototype.toRestQueryStringParameters = function () { var REST_CONSTANTS = QueryParams.REST_QUERY_CONSTANTS_; var qs = {}; if (this.isDefault()) { return qs; } var orderBy; if (this.index_ === PRIORITY_INDEX) { orderBy = REST_CONSTANTS.PRIORITY_INDEX; } else if (this.index_ === VALUE_INDEX) { orderBy = REST_CONSTANTS.VALUE_INDEX; } else if (this.index_ === KEY_INDEX) { orderBy = REST_CONSTANTS.KEY_INDEX; } else { util.assert(this.index_ instanceof PathIndex, 'Unrecognized index type!'); orderBy = this.index_.toString(); } qs[REST_CONSTANTS.ORDER_BY] = util.stringify(orderBy); if (this.startSet_) { qs[REST_CONSTANTS.START_AT] = util.stringify(this.indexStartValue_); if (this.startNameSet_) { qs[REST_CONSTANTS.START_AT] += ',' + util.stringify(this.indexStartName_); } } if (this.endSet_) { qs[REST_CONSTANTS.END_AT] = util.stringify(this.indexEndValue_); if (this.endNameSet_) { qs[REST_CONSTANTS.END_AT] += ',' + util.stringify(this.indexEndName_); } } if (this.limitSet_) { if (this.isViewFromLeft()) { qs[REST_CONSTANTS.LIMIT_TO_FIRST] = this.limit_; } else { qs[REST_CONSTANTS.LIMIT_TO_LAST] = this.limit_; } } return qs; }; /** * Wire Protocol Constants * @const * @enum {string} * @private */ QueryParams.WIRE_PROTOCOL_CONSTANTS_ = { INDEX_START_VALUE: 'sp', INDEX_START_NAME: 'sn', INDEX_END_VALUE: 'ep', INDEX_END_NAME: 'en', LIMIT: 'l', VIEW_FROM: 'vf', VIEW_FROM_LEFT: 'l', VIEW_FROM_RIGHT: 'r', INDEX: 'i' }; /** * REST Query Constants * @const * @enum {string} * @private */ QueryParams.REST_QUERY_CONSTANTS_ = { ORDER_BY: 'orderBy', PRIORITY_INDEX: '$priority', VALUE_INDEX: '$value', KEY_INDEX: '$key', START_AT: 'startAt', END_AT: 'endAt', LIMIT_TO_FIRST: 'limitToFirst', LIMIT_TO_LAST: 'limitToLast' }; /** * Default, empty query parameters * @type {!QueryParams} * @const */ QueryParams.DEFAULT = new QueryParams(); return QueryParams; }()); /** * Copyright 2017 Google Inc. * * 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. */ var Reference = /** @class */ (function (_super) { tslib_1.__extends(Reference, _super); /** * Call options: * new Reference(Repo, Path) or * new Reference(url: string, string|RepoManager) * * Externally - this is the firebase.database.Reference type. * * @param {!Repo} repo * @param {(!Path)} path * @extends {Query} */ function Reference(repo, path) { var _this = this; if (!(repo instanceof Repo)) { throw new Error('new Reference() no longer supported - use app.database().'); } // call Query's constructor, passing in the repo and path. _this = _super.call(this, repo, path, QueryParams.DEFAULT, false) || this; return _this; } /** @return {?string} */ Reference.prototype.getKey = function () { util.validateArgCount('Reference.key', 0, 0, arguments.length); if (this.path.isEmpty()) return null; else return this.path.getBack(); }; /** * @param {!(string|Path)} pathString * @return {!Reference} */ Reference.prototype.child = function (pathString) { util.validateArgCount('Reference.child', 1, 1, arguments.length); if (typeof pathString === 'number') { pathString = String(pathString); } else if (!(pathString instanceof Path)) { if (this.path.getFront() === null) validateRootPathString('Reference.child', 1, pathString, false); else validatePathString('Reference.child', 1, pathString, false); } return new Reference(this.repo, this.path.child(pathString)); }; /** @return {?Reference} */ Reference.prototype.getParent = function () { util.validateArgCount('Reference.parent', 0, 0, arguments.length); var parentPath = this.path.parent(); return parentPath === null ? null : new Reference(this.repo, parentPath); }; /** @return {!Reference} */ Reference.prototype.getRoot = function () { util.validateArgCount('Reference.root', 0, 0, arguments.length); var ref = this; while (ref.getParent() !== null) { ref = ref.getParent(); } return ref; }; /** @return {!Database} */ Reference.prototype.databaseProp = function () { return this.repo.database; }; /** * @param {*} newVal * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.set = function (newVal, onComplete) { util.validateArgCount('Reference.set', 1, 2, arguments.length); validateWritablePath('Reference.set', this.path); validateFirebaseDataArg('Reference.set', 1, newVal, this.path, false); util.validateCallback('Reference.set', 2, onComplete, true); var deferred = new util.Deferred(); this.repo.setWithPriority(this.path, newVal, /*priority=*/ null, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {!Object} objectToMerge * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.update = function (objectToMerge, onComplete) { util.validateArgCount('Reference.update', 1, 2, arguments.length); validateWritablePath('Reference.update', this.path); if (Array.isArray(objectToMerge)) { var newObjectToMerge = {}; for (var i = 0; i < objectToMerge.length; ++i) { newObjectToMerge['' + i] = objectToMerge[i]; } objectToMerge = newObjectToMerge; warn('Passing an Array to Firebase.update() is deprecated. ' + 'Use set() if you want to overwrite the existing data, or ' + 'an Object with integer keys if you really do want to ' + 'only update some of the children.'); } validateFirebaseMergeDataArg('Reference.update', 1, objectToMerge, this.path, false); util.validateCallback('Reference.update', 2, onComplete, true); var deferred = new util.Deferred(); this.repo.update(this.path, objectToMerge, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {*} newVal * @param {string|number|null} newPriority * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.setWithPriority = function (newVal, newPriority, onComplete) { util.validateArgCount('Reference.setWithPriority', 2, 3, arguments.length); validateWritablePath('Reference.setWithPriority', this.path); validateFirebaseDataArg('Reference.setWithPriority', 1, newVal, this.path, false); validatePriority('Reference.setWithPriority', 2, newPriority, false); util.validateCallback('Reference.setWithPriority', 3, onComplete, true); if (this.getKey() === '.length' || this.getKey() === '.keys') throw 'Reference.setWithPriority failed: ' + this.getKey() + ' is a read-only object.'; var deferred = new util.Deferred(); this.repo.setWithPriority(this.path, newVal, newPriority, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.remove = function (onComplete) { util.validateArgCount('Reference.remove', 0, 1, arguments.length); validateWritablePath('Reference.remove', this.path); util.validateCallback('Reference.remove', 1, onComplete, true); return this.set(null, onComplete); }; /** * @param {function(*):*} transactionUpdate * @param {(function(?Error, boolean, ?DataSnapshot))=} onComplete * @param {boolean=} applyLocally * @return {!Promise} */ Reference.prototype.transaction = function (transactionUpdate, onComplete, applyLocally) { util.validateArgCount('Reference.transaction', 1, 3, arguments.length); validateWritablePath('Reference.transaction', this.path); util.validateCallback('Reference.transaction', 1, transactionUpdate, false); util.validateCallback('Reference.transaction', 2, onComplete, true); // NOTE: applyLocally is an internal-only option for now. We need to decide if we want to keep it and how // to expose it. validateBoolean('Reference.transaction', 3, applyLocally, true); if (this.getKey() === '.length' || this.getKey() === '.keys') throw 'Reference.transaction failed: ' + this.getKey() + ' is a read-only object.'; if (applyLocally === undefined) applyLocally = true; var deferred = new util.Deferred(); if (typeof onComplete === 'function') { deferred.promise.catch(function () { }); } var promiseComplete = function (error$$1, committed, snapshot) { if (error$$1) { deferred.reject(error$$1); } else { deferred.resolve(new TransactionResult(committed, snapshot)); } if (typeof onComplete === 'function') { onComplete(error$$1, committed, snapshot); } }; this.repo.startTransaction(this.path, transactionUpdate, promiseComplete, applyLocally); return deferred.promise; }; /** * @param {string|number|null} priority * @param {function(?Error)=} onComplete * @return {!Promise} */ Reference.prototype.setPriority = function (priority, onComplete) { util.validateArgCount('Reference.setPriority', 1, 2, arguments.length); validateWritablePath('Reference.setPriority', this.path); validatePriority('Reference.setPriority', 1, priority, false); util.validateCallback('Reference.setPriority', 2, onComplete, true); var deferred = new util.Deferred(); this.repo.setWithPriority(this.path.child('.priority'), priority, null, deferred.wrapCallback(onComplete)); return deferred.promise; }; /** * @param {*=} value * @param {function(?Error)=} onComplete * @return {!Reference} */ Reference.prototype.push = function (value, onComplete) { util.validateArgCount('Reference.push', 0, 2, arguments.length); validateWritablePath('Reference.push', this.path); validateFirebaseDataArg('Reference.push', 1, value, this.path, true); util.validateCallback('Reference.push', 2, onComplete, true); var now = this.repo.serverTime(); var name = nextPushId(now); // push() returns a ThennableReference whose promise is fulfilled with a regular Reference. // We use child() to create handles to two different references. The first is turned into a // ThennableReference below by adding then() and catch() methods and is used as the // return value of push(). The second remains a regular Reference and is used as the fulfilled // value of the first ThennableReference. var thennablePushRef = this.child(name); var pushRef = this.child(name); var promise; if (value != null) { promise = thennablePushRef.set(value, onComplete).then(function () { return pushRef; }); } else { promise = Promise.resolve(pushRef); } thennablePushRef.then = promise.then.bind(promise); thennablePushRef.catch = promise.then.bind(promise, undefined); if (typeof onComplete === 'function') { promise.catch(function () { }); } return thennablePushRef; }; /** * @return {!OnDisconnect} */ Reference.prototype.onDisconnect = function () { validateWritablePath('Reference.onDisconnect', this.path); return new OnDisconnect(this.repo, this.path); }; Object.defineProperty(Reference.prototype, "database", { get: function () { return this.databaseProp(); }, enumerable: true, configurable: true }); Object.defineProperty(Reference.prototype, "key", { get: function () { return this.getKey(); }, enumerable: true, configurable: true }); Object.defineProperty(Reference.prototype, "parent", { get: function () { return this.getParent(); }, enumerable: true, configurable: true }); Object.defineProperty(Reference.prototype, "root", { get: function () { return this.getRoot(); }, enumerable: true, configurable: true }); return Reference; }(Query)); /** * Define reference constructor in various modules * * We are doing this here to avoid several circular * dependency issues */ Query.__referenceConstructor = Reference; SyncPoint.__referenceConstructor = Reference; /** * Copyright 2017 Google Inc. * * 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. */ /** * Node in a Tree. */ var TreeNode = /** @class */ (function () { function TreeNode() { // TODO: Consider making accessors that create children and value lazily or // separate Internal / Leaf 'types'. this.children = {}; this.childCount = 0; this.value = null; } return TreeNode; }()); /** * A light-weight tree, traversable by path. Nodes can have both values and children. * Nodes are not enumerated (by forEachChild) unless they have a value or non-empty * children. */ var Tree = /** @class */ (function () { /** * @template T * @param {string=} name_ Optional name of the node. * @param {Tree=} parent_ Optional parent node. * @param {TreeNode=} node_ Optional node to wrap. */ function Tree(name_, parent_, node_) { if (name_ === void 0) { name_ = ''; } if (parent_ === void 0) { parent_ = null; } if (node_ === void 0) { node_ = new TreeNode(); } this.name_ = name_; this.parent_ = parent_; this.node_ = node_; } /** * Returns a sub-Tree for the given path. * * @param {!(string|Path)} pathObj Path to look up. * @return {!Tree.} Tree for path. */ Tree.prototype.subTree = function (pathObj) { // TODO: Require pathObj to be Path? var path = pathObj instanceof Path ? pathObj : new Path(pathObj); var child = this, next; while ((next = path.getFront()) !== null) { var childNode = util.safeGet(child.node_.children, next) || new TreeNode(); child = new Tree(next, child, childNode); path = path.popFront(); } return child; }; /** * Returns the data associated with this tree node. * * @return {?T} The data or null if no data exists. */ Tree.prototype.getValue = function () { return this.node_.value; }; /** * Sets data to this tree node. * * @param {!T} value Value to set. */ Tree.prototype.setValue = function (value) { util.assert(typeof value !== 'undefined', 'Cannot set value to undefined'); this.node_.value = value; this.updateParents_(); }; /** * Clears the contents of the tree node (its value and all children). */ Tree.prototype.clear = function () { this.node_.value = null; this.node_.children = {}; this.node_.childCount = 0; this.updateParents_(); }; /** * @return {boolean} Whether the tree has any children. */ Tree.prototype.hasChildren = function () { return this.node_.childCount > 0; }; /** * @return {boolean} Whether the tree is empty (no value or children). */ Tree.prototype.isEmpty = function () { return this.getValue() === null && !this.hasChildren(); }; /** * Calls action for each child of this tree node. * * @param {function(!Tree.)} action Action to be called for each child. */ Tree.prototype.forEachChild = function (action) { var _this = this; util.forEach(this.node_.children, function (child, childTree) { action(new Tree(child, _this, childTree)); }); }; /** * Does a depth-first traversal of this node's descendants, calling action for each one. * * @param {function(!Tree.)} action Action to be called for each child. * @param {boolean=} includeSelf Whether to call action on this node as well. Defaults to * false. * @param {boolean=} childrenFirst Whether to call action on children before calling it on * parent. */ Tree.prototype.forEachDescendant = function (action, includeSelf, childrenFirst) { if (includeSelf && !childrenFirst) action(this); this.forEachChild(function (child) { child.forEachDescendant(action, /*includeSelf=*/ true, childrenFirst); }); if (includeSelf && childrenFirst) action(this); }; /** * Calls action on each ancestor node. * * @param {function(!Tree.)} action Action to be called on each parent; return * true to abort. * @param {boolean=} includeSelf Whether to call action on this node as well. * @return {boolean} true if the action callback returned true. */ Tree.prototype.forEachAncestor = function (action, includeSelf) { var node = includeSelf ? this : this.parent(); while (node !== null) { if (action(node)) { return true; } node = node.parent(); } return false; }; /** * Does a depth-first traversal of this node's descendants. When a descendant with a value * is found, action is called on it and traversal does not continue inside the node. * Action is *not* called on this node. * * @param {function(!Tree.)} action Action to be called for each child. */ Tree.prototype.forEachImmediateDescendantWithValue = function (action) { this.forEachChild(function (child) { if (child.getValue() !== null) action(child); else child.forEachImmediateDescendantWithValue(action); }); }; /** * @return {!Path} The path of this tree node, as a Path. */ Tree.prototype.path = function () { return new Path(this.parent_ === null ? this.name_ : this.parent_.path() + '/' + this.name_); }; /** * @return {string} The name of the tree node. */ Tree.prototype.name = function () { return this.name_; }; /** * @return {?Tree} The parent tree node, or null if this is the root of the tree. */ Tree.prototype.parent = function () { return this.parent_; }; /** * Adds or removes this child from its parent based on whether it's empty or not. * * @private */ Tree.prototype.updateParents_ = function () { if (this.parent_ !== null) this.parent_.updateChild_(this.name_, this); }; /** * Adds or removes the passed child to this tree node, depending on whether it's empty. * * @param {string} childName The name of the child to update. * @param {!Tree.} child The child to update. * @private */ Tree.prototype.updateChild_ = function (childName, child) { var childEmpty = child.isEmpty(); var childExists = util.contains(this.node_.children, childName); if (childEmpty && childExists) { delete this.node_.children[childName]; this.node_.childCount--; this.updateParents_(); } else if (!childEmpty && !childExists) { this.node_.children[childName] = child.node_; this.node_.childCount++; this.updateParents_(); } }; return Tree; }()); /** * Copyright 2017 Google Inc. * * 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. */ // TODO: This is pretty messy. Ideally, a lot of this would move into FirebaseData, or a transaction-specific // component used by FirebaseData, but it has ties to user callbacks (transaction update and onComplete) as well // as the realtime connection (to send transactions to the server). So that all needs to be decoupled first. // For now it's part of Repo, but in its own file. /** * @enum {number} */ var TransactionStatus; (function (TransactionStatus) { // We've run the transaction and updated transactionResultData_ with the result, but it isn't currently sent to the // server. A transaction will go from RUN -> SENT -> RUN if it comes back from the server as rejected due to // mismatched hash. TransactionStatus[TransactionStatus["RUN"] = 0] = "RUN"; // We've run the transaction and sent it to the server and it's currently outstanding (hasn't come back as accepted // or rejected yet). TransactionStatus[TransactionStatus["SENT"] = 1] = "SENT"; // Temporary state used to mark completed transactions (whether successful or aborted). The transaction will be // removed when we get a chance to prune completed ones. TransactionStatus[TransactionStatus["COMPLETED"] = 2] = "COMPLETED"; // Used when an already-sent transaction needs to be aborted (e.g. due to a conflicting set() call that was made). // If it comes back as unsuccessful, we'll abort it. TransactionStatus[TransactionStatus["SENT_NEEDS_ABORT"] = 3] = "SENT_NEEDS_ABORT"; // Temporary state used to mark transactions that need to be aborted. TransactionStatus[TransactionStatus["NEEDS_ABORT"] = 4] = "NEEDS_ABORT"; })(TransactionStatus || (TransactionStatus = {})); /** * If a transaction does not succeed after 25 retries, we abort it. Among other things this ensure that if there's * ever a bug causing a mismatch between client / server hashes for some data, we won't retry indefinitely. * @type {number} * @const * @private */ Repo.MAX_TRANSACTION_RETRIES_ = 25; /** * Setup the transaction data structures * @private */ Repo.prototype.transactions_init_ = function () { /** * Stores queues of outstanding transactions for Firebase locations. * * @type {!Tree.>} * @private */ this.transactionQueueTree_ = new Tree(); }; /** * Creates a new transaction, adds it to the transactions we're tracking, and sends it to the server if possible. * * @param {!Path} path Path at which to do transaction. * @param {function(*):*} transactionUpdate Update callback. * @param {?function(?Error, boolean, ?DataSnapshot)} onComplete Completion callback. * @param {boolean} applyLocally Whether or not to make intermediate results visible */ Repo.prototype.startTransaction = function (path, transactionUpdate, onComplete, applyLocally) { this.log_('transaction on ' + path); // Add a watch to make sure we get server updates. var valueCallback = function () { }; var watchRef = new Reference(this, path); watchRef.on('value', valueCallback); var unwatcher = function () { watchRef.off('value', valueCallback); }; // Initialize transaction. var transaction = { path: path, update: transactionUpdate, onComplete: onComplete, // One of TransactionStatus enums. status: null, // Used when combining transactions at different locations to figure out which one goes first. order: LUIDGenerator(), // Whether to raise local events for this transaction. applyLocally: applyLocally, // Count of how many times we've retried the transaction. retryCount: 0, // Function to call to clean up our .on() listener. unwatcher: unwatcher, // Stores why a transaction was aborted. abortReason: null, currentWriteId: null, currentInputSnapshot: null, currentOutputSnapshotRaw: null, currentOutputSnapshotResolved: null }; // Run transaction initially. var currentState = this.getLatestState_(path); transaction.currentInputSnapshot = currentState; var newVal = transaction.update(currentState.val()); if (newVal === undefined) { // Abort transaction. transaction.unwatcher(); transaction.currentOutputSnapshotRaw = null; transaction.currentOutputSnapshotResolved = null; if (transaction.onComplete) { // We just set the input snapshot, so this cast should be safe var snapshot = new DataSnapshot(transaction.currentInputSnapshot, new Reference(this, transaction.path), PRIORITY_INDEX); transaction.onComplete(null, false, snapshot); } } else { validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path); // Mark as run and add to our queue. transaction.status = TransactionStatus.RUN; var queueNode = this.transactionQueueTree_.subTree(path); var nodeQueue = queueNode.getValue() || []; nodeQueue.push(transaction); queueNode.setValue(nodeQueue); // Update visibleData and raise events // Note: We intentionally raise events after updating all of our transaction state, since the user could // start new transactions from the event callbacks. var priorityForNode = void 0; if (typeof newVal === 'object' && newVal !== null && util.contains(newVal, '.priority')) { priorityForNode = util.safeGet(newVal, '.priority'); util.assert(isValidPriority(priorityForNode), 'Invalid priority returned by transaction. ' + 'Priority must be a valid string, finite number, server value, or null.'); } else { var currentNode = this.serverSyncTree_.calcCompleteEventCache(path) || ChildrenNode.EMPTY_NODE; priorityForNode = currentNode.getPriority().val(); } priorityForNode /** @type {null|number|string} */ = priorityForNode; var serverValues = this.generateServerValues(); var newNodeUnresolved = nodeFromJSON$1(newVal, priorityForNode); var newNode = resolveDeferredValueSnapshot(newNodeUnresolved, serverValues); transaction.currentOutputSnapshotRaw = newNodeUnresolved; transaction.currentOutputSnapshotResolved = newNode; transaction.currentWriteId = this.getNextWriteId_(); var events = this.serverSyncTree_.applyUserOverwrite(path, newNode, transaction.currentWriteId, transaction.applyLocally); this.eventQueue_.raiseEventsForChangedPath(path, events); this.sendReadyTransactions_(); } }; /** * @param {!Path} path * @param {Array.=} excludeSets A specific set to exclude * @return {Node} * @private */ Repo.prototype.getLatestState_ = function (path, excludeSets) { return (this.serverSyncTree_.calcCompleteEventCache(path, excludeSets) || ChildrenNode.EMPTY_NODE); }; /** * Sends any already-run transactions that aren't waiting for outstanding transactions to * complete. * * Externally it's called with no arguments, but it calls itself recursively with a particular * transactionQueueTree node to recurse through the tree. * * @param {Tree.>=} node transactionQueueTree node to start at. * @private */ Repo.prototype.sendReadyTransactions_ = function (node) { var _this = this; if (node === void 0) { node = this.transactionQueueTree_; } // Before recursing, make sure any completed transactions are removed. if (!node) { this.pruneCompletedTransactionsBelowNode_(node); } if (node.getValue() !== null) { var queue = this.buildTransactionQueue_(node); util.assert(queue.length > 0, 'Sending zero length transaction queue'); var allRun = queue.every(function (transaction) { return transaction.status === TransactionStatus.RUN; }); // If they're all run (and not sent), we can send them. Else, we must wait. if (allRun) { this.sendTransactionQueue_(node.path(), queue); } } else if (node.hasChildren()) { node.forEachChild(function (childNode) { _this.sendReadyTransactions_(childNode); }); } }; /** * Given a list of run transactions, send them to the server and then handle the result (success or failure). * * @param {!Path} path The location of the queue. * @param {!Array.} queue Queue of transactions under the specified location. * @private */ Repo.prototype.sendTransactionQueue_ = function (path, queue) { var _this = this; // Mark transactions as sent and increment retry count! var setsToIgnore = queue.map(function (txn) { return txn.currentWriteId; }); var latestState = this.getLatestState_(path, setsToIgnore); var snapToSend = latestState; var latestHash = latestState.hash(); for (var i = 0; i < queue.length; i++) { var txn = queue[i]; util.assert(txn.status === TransactionStatus.RUN, 'tryToSendTransactionQueue_: items in queue should all be run.'); txn.status = TransactionStatus.SENT; txn.retryCount++; var relativePath = Path.relativePath(path, txn.path); // If we've gotten to this point, the output snapshot must be defined. snapToSend = snapToSend.updateChild(relativePath /**@type {!Node} */, txn.currentOutputSnapshotRaw); } var dataToSend = snapToSend.val(true); var pathToSend = path; // Send the put. this.server_.put(pathToSend.toString(), dataToSend, function (status) { _this.log_('transaction put response', { path: pathToSend.toString(), status: status }); var events = []; if (status === 'ok') { // Queue up the callbacks and fire them after cleaning up all of our transaction state, since // the callback could trigger more transactions or sets. var callbacks = []; for (var i = 0; i < queue.length; i++) { queue[i].status = TransactionStatus.COMPLETED; events = events.concat(_this.serverSyncTree_.ackUserWrite(queue[i].currentWriteId)); if (queue[i].onComplete) { // We never unset the output snapshot, and given that this transaction is complete, it should be set var node = queue[i].currentOutputSnapshotResolved; var ref = new Reference(_this, queue[i].path); var snapshot = new DataSnapshot(node, ref, PRIORITY_INDEX); callbacks.push(queue[i].onComplete.bind(null, null, true, snapshot)); } queue[i].unwatcher(); } // Now remove the completed transactions. _this.pruneCompletedTransactionsBelowNode_(_this.transactionQueueTree_.subTree(path)); // There may be pending transactions that we can now send. _this.sendReadyTransactions_(); _this.eventQueue_.raiseEventsForChangedPath(path, events); // Finally, trigger onComplete callbacks. for (var i = 0; i < callbacks.length; i++) { exceptionGuard(callbacks[i]); } } else { // transactions are no longer sent. Update their status appropriately. if (status === 'datastale') { for (var i = 0; i < queue.length; i++) { if (queue[i].status === TransactionStatus.SENT_NEEDS_ABORT) queue[i].status = TransactionStatus.NEEDS_ABORT; else queue[i].status = TransactionStatus.RUN; } } else { warn('transaction at ' + pathToSend.toString() + ' failed: ' + status); for (var i = 0; i < queue.length; i++) { queue[i].status = TransactionStatus.NEEDS_ABORT; queue[i].abortReason = status; } } _this.rerunTransactions_(path); } }, latestHash); }; /** * Finds all transactions dependent on the data at changedPath and reruns them. * * Should be called any time cached data changes. * * Return the highest path that was affected by rerunning transactions. This is the path at which events need to * be raised for. * * @param {!Path} changedPath The path in mergedData that changed. * @return {!Path} The rootmost path that was affected by rerunning transactions. * @private */ Repo.prototype.rerunTransactions_ = function (changedPath) { var rootMostTransactionNode = this.getAncestorTransactionNode_(changedPath); var path = rootMostTransactionNode.path(); var queue = this.buildTransactionQueue_(rootMostTransactionNode); this.rerunTransactionQueue_(queue, path); return path; }; /** * Does all the work of rerunning transactions (as well as cleans up aborted transactions and whatnot). * * @param {Array.} queue The queue of transactions to run. * @param {!Path} path The path the queue is for. * @private */ Repo.prototype.rerunTransactionQueue_ = function (queue, path) { if (queue.length === 0) { return; // Nothing to do! } // Queue up the callbacks and fire them after cleaning up all of our transaction state, since // the callback could trigger more transactions or sets. var callbacks = []; var events = []; // Ignore all of the sets we're going to re-run. var txnsToRerun = queue.filter(function (q) { return q.status === TransactionStatus.RUN; }); var setsToIgnore = txnsToRerun.map(function (q) { return q.currentWriteId; }); for (var i = 0; i < queue.length; i++) { var transaction = queue[i]; var relativePath = Path.relativePath(path, transaction.path); var abortTransaction = false, abortReason = void 0; util.assert(relativePath !== null, 'rerunTransactionsUnderNode_: relativePath should not be null.'); if (transaction.status === TransactionStatus.NEEDS_ABORT) { abortTransaction = true; abortReason = transaction.abortReason; events = events.concat(this.serverSyncTree_.ackUserWrite(transaction.currentWriteId, true)); } else if (transaction.status === TransactionStatus.RUN) { if (transaction.retryCount >= Repo.MAX_TRANSACTION_RETRIES_) { abortTransaction = true; abortReason = 'maxretry'; events = events.concat(this.serverSyncTree_.ackUserWrite(transaction.currentWriteId, true)); } else { // This code reruns a transaction var currentNode = this.getLatestState_(transaction.path, setsToIgnore); transaction.currentInputSnapshot = currentNode; var newData = queue[i].update(currentNode.val()); if (newData !== undefined) { validateFirebaseData('transaction failed: Data returned ', newData, transaction.path); var newDataNode = nodeFromJSON$1(newData); var hasExplicitPriority = typeof newData === 'object' && newData != null && util.contains(newData, '.priority'); if (!hasExplicitPriority) { // Keep the old priority if there wasn't a priority explicitly specified. newDataNode = newDataNode.updatePriority(currentNode.getPriority()); } var oldWriteId = transaction.currentWriteId; var serverValues = this.generateServerValues(); var newNodeResolved = resolveDeferredValueSnapshot(newDataNode, serverValues); transaction.currentOutputSnapshotRaw = newDataNode; transaction.currentOutputSnapshotResolved = newNodeResolved; transaction.currentWriteId = this.getNextWriteId_(); // Mutates setsToIgnore in place setsToIgnore.splice(setsToIgnore.indexOf(oldWriteId), 1); events = events.concat(this.serverSyncTree_.applyUserOverwrite(transaction.path, newNodeResolved, transaction.currentWriteId, transaction.applyLocally)); events = events.concat(this.serverSyncTree_.ackUserWrite(oldWriteId, true)); } else { abortTransaction = true; abortReason = 'nodata'; events = events.concat(this.serverSyncTree_.ackUserWrite(transaction.currentWriteId, true)); } } } this.eventQueue_.raiseEventsForChangedPath(path, events); events = []; if (abortTransaction) { // Abort. queue[i].status = TransactionStatus.COMPLETED; // Removing a listener can trigger pruning which can muck with mergedData/visibleData (as it prunes data). // So defer the unwatcher until we're done. (function (unwatcher) { setTimeout(unwatcher, Math.floor(0)); })(queue[i].unwatcher); if (queue[i].onComplete) { if (abortReason === 'nodata') { var ref = new Reference(this, queue[i].path); // We set this field immediately, so it's safe to cast to an actual snapshot var lastInput /** @type {!Node} */ = queue[i].currentInputSnapshot; var snapshot = new DataSnapshot(lastInput, ref, PRIORITY_INDEX); callbacks.push(queue[i].onComplete.bind(null, null, false, snapshot)); } else { callbacks.push(queue[i].onComplete.bind(null, new Error(abortReason), false, null)); } } } } // Clean up completed transactions. this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_); // Now fire callbacks, now that we're in a good, known state. for (var i = 0; i < callbacks.length; i++) { exceptionGuard(callbacks[i]); } // Try to send the transaction result to the server. this.sendReadyTransactions_(); }; /** * Returns the rootmost ancestor node of the specified path that has a pending transaction on it, or just returns * the node for the given path if there are no pending transactions on any ancestor. * * @param {!Path} path The location to start at. * @return {!Tree.>} The rootmost node with a transaction. * @private */ Repo.prototype.getAncestorTransactionNode_ = function (path) { var front; // Start at the root and walk deeper into the tree towards path until we find a node with pending transactions. var transactionNode = this.transactionQueueTree_; while ((front = path.getFront()) !== null && transactionNode.getValue() === null) { transactionNode = transactionNode.subTree(front); path = path.popFront(); } return transactionNode; }; /** * Builds the queue of all transactions at or below the specified transactionNode. * * @param {!Tree.>} transactionNode * @return {Array.} The generated queue. * @private */ Repo.prototype.buildTransactionQueue_ = function (transactionNode) { // Walk any child transaction queues and aggregate them into a single queue. var transactionQueue = []; this.aggregateTransactionQueuesForNode_(transactionNode, transactionQueue); // Sort them by the order the transactions were created. transactionQueue.sort(function (a, b) { return a.order - b.order; }); return transactionQueue; }; /** * @param {!Tree.>} node * @param {Array.} queue * @private */ Repo.prototype.aggregateTransactionQueuesForNode_ = function (node, queue) { var _this = this; var nodeQueue = node.getValue(); if (nodeQueue !== null) { for (var i = 0; i < nodeQueue.length; i++) { queue.push(nodeQueue[i]); } } node.forEachChild(function (child) { _this.aggregateTransactionQueuesForNode_(child, queue); }); }; /** * Remove COMPLETED transactions at or below this node in the transactionQueueTree_. * * @param {!Tree.>} node * @private */ Repo.prototype.pruneCompletedTransactionsBelowNode_ = function (node) { var _this = this; var queue = node.getValue(); if (queue) { var to = 0; for (var from = 0; from < queue.length; from++) { if (queue[from].status !== TransactionStatus.COMPLETED) { queue[to] = queue[from]; to++; } } queue.length = to; node.setValue(queue.length > 0 ? queue : null); } node.forEachChild(function (childNode) { _this.pruneCompletedTransactionsBelowNode_(childNode); }); }; /** * Aborts all transactions on ancestors or descendants of the specified path. Called when doing a set() or update() * since we consider them incompatible with transactions. * * @param {!Path} path Path for which we want to abort related transactions. * @return {!Path} * @private */ Repo.prototype.abortTransactions_ = function (path) { var _this = this; var affectedPath = this.getAncestorTransactionNode_(path).path(); var transactionNode = this.transactionQueueTree_.subTree(path); transactionNode.forEachAncestor(function (node) { _this.abortTransactionsOnNode_(node); }); this.abortTransactionsOnNode_(transactionNode); transactionNode.forEachDescendant(function (node) { _this.abortTransactionsOnNode_(node); }); return affectedPath; }; /** * Abort transactions stored in this transaction queue node. * * @param {!Tree.>} node Node to abort transactions for. * @private */ Repo.prototype.abortTransactionsOnNode_ = function (node) { var queue = node.getValue(); if (queue !== null) { // Queue up the callbacks and fire them after cleaning up all of our transaction state, since // the callback could trigger more transactions or sets. var callbacks = []; // Go through queue. Any already-sent transactions must be marked for abort, while the unsent ones // can be immediately aborted and removed. var events = []; var lastSent = -1; for (var i = 0; i < queue.length; i++) { if (queue[i].status === TransactionStatus.SENT_NEEDS_ABORT) { // Already marked. No action needed. } else if (queue[i].status === TransactionStatus.SENT) { util.assert(lastSent === i - 1, 'All SENT items should be at beginning of queue.'); lastSent = i; // Mark transaction for abort when it comes back. queue[i].status = TransactionStatus.SENT_NEEDS_ABORT; queue[i].abortReason = 'set'; } else { util.assert(queue[i].status === TransactionStatus.RUN, 'Unexpected transaction status in abort'); // We can abort it immediately. queue[i].unwatcher(); events = events.concat(this.serverSyncTree_.ackUserWrite(queue[i].currentWriteId, true)); if (queue[i].onComplete) { var snapshot = null; callbacks.push(queue[i].onComplete.bind(null, new Error('set'), false, snapshot)); } } } if (lastSent === -1) { // We're not waiting for any sent transactions. We can clear the queue. node.setValue(null); } else { // Remove the transactions we aborted. queue.length = lastSent + 1; } // Now fire the callbacks. this.eventQueue_.raiseEventsForChangedPath(node.path(), events); for (var i = 0; i < callbacks.length; i++) { exceptionGuard(callbacks[i]); } } }; /** * Copyright 2017 Google Inc. * * 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. */ /** @const {string} */ var DATABASE_URL_OPTION = 'databaseURL'; var _staticInstance; /** * Creates and caches Repo instances. */ var RepoManager = /** @class */ (function () { function RepoManager() { /** * @private {!Object.>} */ this.repos_ = {}; /** * If true, new Repos will be created to use ReadonlyRestClient (for testing purposes). * @private {boolean} */ this.useRestClient_ = false; } RepoManager.getInstance = function () { if (!_staticInstance) { _staticInstance = new RepoManager(); } return _staticInstance; }; // TODO(koss): Remove these functions unless used in tests? RepoManager.prototype.interrupt = function () { for (var appName in this.repos_) { for (var dbUrl in this.repos_[appName]) { this.repos_[appName][dbUrl].interrupt(); } } }; RepoManager.prototype.resume = function () { for (var appName in this.repos_) { for (var dbUrl in this.repos_[appName]) { this.repos_[appName][dbUrl].resume(); } } }; /** * This function should only ever be called to CREATE a new database instance. * * @param {!FirebaseApp} app * @return {!Database} */ RepoManager.prototype.databaseFromApp = function (app, url) { var dbUrl = url || app.options[DATABASE_URL_OPTION]; if (dbUrl === undefined) { fatal("Can't determine Firebase Database URL. Be sure to include " + DATABASE_URL_OPTION + ' option when calling firebase.initializeApp().'); } var parsedUrl = parseRepoInfo(dbUrl); var repoInfo = parsedUrl.repoInfo; validateUrl('Invalid Firebase Database URL', 1, parsedUrl); if (!parsedUrl.path.isEmpty()) { fatal('Database URL must point to the root of a Firebase Database ' + '(not including a child path).'); } var repo = this.createRepo(repoInfo, app); return repo.database; }; /** * Remove the repo and make sure it is disconnected. * * @param {!Repo} repo */ RepoManager.prototype.deleteRepo = function (repo) { var appRepos = util.safeGet(this.repos_, repo.app.name); // This should never happen... if (!appRepos || util.safeGet(appRepos, repo.repoInfo_.toURLString()) !== repo) { fatal("Database " + repo.app.name + "(" + repo.repoInfo_ + ") has already been deleted."); } repo.interrupt(); delete appRepos[repo.repoInfo_.toURLString()]; }; /** * Ensures a repo doesn't already exist and then creates one using the * provided app. * * @param {!RepoInfo} repoInfo The metadata about the Repo * @param {!FirebaseApp} app * @return {!Repo} The Repo object for the specified server / repoName. */ RepoManager.prototype.createRepo = function (repoInfo, app) { var appRepos = util.safeGet(this.repos_, app.name); if (!appRepos) { appRepos = {}; this.repos_[app.name] = appRepos; } var repo = util.safeGet(appRepos, repoInfo.toURLString()); if (repo) { fatal('Database initialized multiple times. Please make sure the format of the database URL matches with each database() call.'); } repo = new Repo(repoInfo, this.useRestClient_, app); appRepos[repoInfo.toURLString()] = repo; return repo; }; /** * Forces us to use ReadonlyRestClient instead of PersistentConnection for new Repos. * @param {boolean} forceRestClient */ RepoManager.prototype.forceRestClient = function (forceRestClient) { this.useRestClient_ = forceRestClient; }; return RepoManager; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Class representing a firebase database. * @implements {FirebaseService} */ var Database = /** @class */ (function () { /** * The constructor should not be called by users of our public API. * @param {!Repo} repo_ */ function Database(repo_) { this.repo_ = repo_; if (!(repo_ instanceof Repo)) { fatal("Don't call new Database() directly - please use firebase.database()."); } /** @type {Reference} */ this.root_ = new Reference(repo_, Path.Empty); this.INTERNAL = new DatabaseInternals(this); } Object.defineProperty(Database.prototype, "app", { get: function () { return this.repo_.app; }, enumerable: true, configurable: true }); Database.prototype.ref = function (path) { this.checkDeleted_('ref'); util.validateArgCount('database.ref', 0, 1, arguments.length); if (path instanceof Reference) { return this.refFromURL(path.toString()); } return path !== undefined ? this.root_.child(path) : this.root_; }; /** * Returns a reference to the root or the path specified in url. * We throw a exception if the url is not in the same domain as the * current repo. * @param {string} url * @return {!Reference} Firebase reference. */ Database.prototype.refFromURL = function (url) { /** @const {string} */ var apiName = 'database.refFromURL'; this.checkDeleted_(apiName); util.validateArgCount(apiName, 1, 1, arguments.length); var parsedURL = parseRepoInfo(url); validateUrl(apiName, 1, parsedURL); var repoInfo = parsedURL.repoInfo; if (repoInfo.host !== this.repo_.repoInfo_.host) { fatal(apiName + ': Host name does not match the current database: ' + '(found ' + repoInfo.host + ' but expected ' + this.repo_.repoInfo_.host + ')'); } return this.ref(parsedURL.path.toString()); }; /** * @param {string} apiName */ Database.prototype.checkDeleted_ = function (apiName) { if (this.repo_ === null) { fatal('Cannot call ' + apiName + ' on a deleted database.'); } }; // Make individual repo go offline. Database.prototype.goOffline = function () { util.validateArgCount('database.goOffline', 0, 0, arguments.length); this.checkDeleted_('goOffline'); this.repo_.interrupt(); }; Database.prototype.goOnline = function () { util.validateArgCount('database.goOnline', 0, 0, arguments.length); this.checkDeleted_('goOnline'); this.repo_.resume(); }; Database.ServerValue = { TIMESTAMP: { '.sv': 'timestamp' } }; return Database; }()); var DatabaseInternals = /** @class */ (function () { /** @param {!Database} database */ function DatabaseInternals(database) { this.database = database; } /** @return {Promise} */ DatabaseInternals.prototype.delete = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { this.database.checkDeleted_('delete'); RepoManager.getInstance().deleteRepo(this.database.repo_); this.database.repo_ = null; this.database.root_ = null; this.database.INTERNAL = null; this.database = null; return [2 /*return*/]; }); }); }; return DatabaseInternals; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * INTERNAL methods for internal-use only (tests, etc.). * * Customers shouldn't use these or else should be aware that they could break at any time. * * @const */ var forceLongPolling = function () { WebSocketConnection.forceDisallow(); BrowserPollConnection.forceAllow(); }; var forceWebSockets = function () { BrowserPollConnection.forceDisallow(); }; /* Used by App Manager */ var isWebSocketsAvailable = function () { return WebSocketConnection['isAvailable'](); }; var setSecurityDebugCallback = function (ref, callback) { ref.repo.persistentConnection_.securityDebugCallback_ = callback; }; var stats = function (ref, showDelta) { ref.repo.stats(showDelta); }; var statsIncrementCounter = function (ref, metric) { ref.repo.statsIncrementCounter(metric); }; var dataUpdateCount = function (ref) { return ref.repo.dataUpdateCount; }; var interceptServerData = function (ref, callback) { return ref.repo.interceptServerData_(callback); }; var INTERNAL = /*#__PURE__*/Object.freeze({ forceLongPolling: forceLongPolling, forceWebSockets: forceWebSockets, isWebSocketsAvailable: isWebSocketsAvailable, setSecurityDebugCallback: setSecurityDebugCallback, stats: stats, statsIncrementCounter: statsIncrementCounter, dataUpdateCount: dataUpdateCount, interceptServerData: interceptServerData }); /** * Copyright 2017 Google Inc. * * 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. */ var DataConnection = PersistentConnection; /** * @param {!string} pathString * @param {function(*)} onComplete */ PersistentConnection.prototype.simpleListen = function (pathString, onComplete) { this.sendRequest('q', { p: pathString }, onComplete); }; /** * @param {*} data * @param {function(*)} onEcho */ PersistentConnection.prototype.echo = function (data, onEcho) { this.sendRequest('echo', { d: data }, onEcho); }; // RealTimeConnection properties that we use in tests. var RealTimeConnection = Connection; /** * @param {function(): string} newHash * @return {function()} */ var hijackHash = function (newHash) { var oldPut = PersistentConnection.prototype.put; PersistentConnection.prototype.put = function (pathString, data, opt_onComplete, opt_hash) { if (opt_hash !== undefined) { opt_hash = newHash(); } oldPut.call(this, pathString, data, opt_onComplete, opt_hash); }; return function () { PersistentConnection.prototype.put = oldPut; }; }; /** * @type {function(new:RepoInfo, !string, boolean, !string, boolean): undefined} */ var ConnectionTarget = RepoInfo; /** * @param {!Query} query * @return {!string} */ var queryIdentifier = function (query) { return query.queryIdentifier(); }; /** * @param {!Query} firebaseRef * @return {!Object} */ var listens = function (firebaseRef) { return firebaseRef.repo.persistentConnection_.listens_; }; /** * Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection. * * @param {boolean} forceRestClient */ var forceRestClient = function (forceRestClient) { RepoManager.getInstance().forceRestClient(forceRestClient); }; var TEST_ACCESS = /*#__PURE__*/Object.freeze({ DataConnection: DataConnection, RealTimeConnection: RealTimeConnection, hijackHash: hijackHash, ConnectionTarget: ConnectionTarget, queryIdentifier: queryIdentifier, listens: listens, forceRestClient: forceRestClient }); /** * Copyright 2017 Google Inc. * * 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. */ var ServerValue = Database.ServerValue; function registerDatabase(instance) { // Register the Database Service with the 'firebase' namespace. var namespace = instance.INTERNAL.registerService('database', function (app, unused, url) { return RepoManager.getInstance().databaseFromApp(app, url); }, // firebase.database namespace properties { Reference: Reference, Query: Query, Database: Database, enableLogging: enableLogging, INTERNAL: INTERNAL, ServerValue: ServerValue, TEST_ACCESS: TEST_ACCESS }, null, true); if (util.isNodeSdk()) { module.exports = namespace; } } registerDatabase(firebase); exports.registerDatabase = registerDatabase; exports.Database = Database; exports.Query = Query; exports.Reference = Reference; exports.enableLogging = enableLogging; exports.ServerValue = ServerValue; exports.DataSnapshot = DataSnapshot; exports.OnDisconnect = OnDisconnect; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node-libs-browser/node_modules/process/browser.js */ "../../node_modules/node-libs-browser/node_modules/process/browser.js"), __webpack_require__(/*! ./../../../console-browserify/index.js */ "../../node_modules/console-browserify/index.js"))) /***/ }), /***/ "../../node_modules/@firebase/firestore/dist/index.cjs.js": /*!*******************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/firestore/dist/index.cjs.js ***! \*******************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(console) { Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var firebase = _interopDefault(__webpack_require__(/*! @firebase/app */ "../../node_modules/@firebase/app/dist/index.cjs.js")); var logger = __webpack_require__(/*! @firebase/logger */ "../../node_modules/@firebase/logger/dist/index.esm.js"); var tslib_1 = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); var webchannelWrapper = __webpack_require__(/*! @firebase/webchannel-wrapper */ "../../node_modules/@firebase/webchannel-wrapper/dist/index.esm.js"); /** * Copyright 2017 Google Inc. * * 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. */ /** The semver (www.semver.org) version of the SDK. */ var SDK_VERSION = firebase.SDK_VERSION; /** * Copyright 2017 Google Inc. * * 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. */ var logClient = new logger.Logger('@firebase/firestore'); var LogLevel; (function (LogLevel) { LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG"; LogLevel[LogLevel["ERROR"] = 1] = "ERROR"; LogLevel[LogLevel["SILENT"] = 2] = "SILENT"; })(LogLevel || (LogLevel = {})); // Helper methods are needed because variables can't be exported as read/write function getLogLevel() { if (logClient.logLevel === logger.LogLevel.DEBUG) { return LogLevel.DEBUG; } else if (logClient.logLevel === logger.LogLevel.SILENT) { return LogLevel.SILENT; } else { return LogLevel.ERROR; } } function setLogLevel(newLevel) { /** * Map the new log level to the associated Firebase Log Level */ switch (newLevel) { case LogLevel.DEBUG: logClient.logLevel = logger.LogLevel.DEBUG; break; case LogLevel.ERROR: logClient.logLevel = logger.LogLevel.ERROR; break; case LogLevel.SILENT: logClient.logLevel = logger.LogLevel.SILENT; break; default: logClient.error("Firestore (" + SDK_VERSION + "): Invalid value passed to `setLogLevel`"); } } function debug(tag, msg) { var obj = []; for (var _i = 2; _i < arguments.length; _i++) { obj[_i - 2] = arguments[_i]; } if (logClient.logLevel <= logger.LogLevel.DEBUG) { var args = obj.map(argToString); logClient.debug.apply(logClient, ["Firestore (" + SDK_VERSION + ") [" + tag + "]: " + msg].concat(args)); } } function error(msg) { var obj = []; for (var _i = 1; _i < arguments.length; _i++) { obj[_i - 1] = arguments[_i]; } if (logClient.logLevel <= logger.LogLevel.ERROR) { var args = obj.map(argToString); logClient.error.apply(logClient, ["Firestore (" + SDK_VERSION + "): " + msg].concat(args)); } } /** * Converts an additional log parameter to a string representation. */ function argToString(obj) { if (typeof obj === 'string') { return obj; } else { var platform = PlatformSupport.getPlatform(); try { return platform.formatJSON(obj); } catch (e) { // Converting to JSON failed, just log the object directly return obj; } } } /** * Copyright 2017 Google Inc. * * 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. */ /** * Unconditionally fails, throwing an Error with the given message. * * Returns any so it can be used in expressions: * @example * let futureVar = fail('not implemented yet'); */ function fail(failure) { // Log the failure in addition to throw an exception, just in case the // exception is swallowed. var message = "FIRESTORE (" + SDK_VERSION + ") INTERNAL ASSERTION FAILED: " + failure; error(message); // NOTE: We don't use FirestoreError here because these are internal failures // that cannot be handled by the user. (Also it would create a circular // dependency between the error and assert modules which doesn't work.) throw new Error(message); } /** * Fails if the given assertion condition is false, throwing an Error with the * given message if it did. */ function assert(assertion, message) { if (!assertion) { fail(message); } } /** * Copyright 2017 Google Inc. * * 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. */ /** * Provides singleton helpers where setup code can inject a platform at runtime. * setPlatform needs to be set before Firestore is used and must be set exactly * once. */ var PlatformSupport = /** @class */ (function () { function PlatformSupport() { } PlatformSupport.setPlatform = function (platform) { if (PlatformSupport.platform) { fail('Platform already defined'); } PlatformSupport.platform = platform; }; PlatformSupport.getPlatform = function () { if (!PlatformSupport.platform) { fail('Platform not set'); } return PlatformSupport.platform; }; return PlatformSupport; }()); /** * Returns the representation of an empty "proto" byte string for the * platform. */ function emptyByteString() { return PlatformSupport.getPlatform().emptyByteString; } /** * Copyright 2017 Google Inc. * * 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. */ // TODO(mcg): Change to a string enum once we've upgraded to typescript 2.4. // tslint:disable-next-line:variable-name Intended to look like a TS 2.4 enum var Code = { // Causes are copied from: // https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h /** Not an error; returned on success. */ OK: 'ok', /** The operation was cancelled (typically by the caller). */ CANCELLED: 'cancelled', /** Unknown error or an error from a different error domain. */ UNKNOWN: 'unknown', /** * Client specified an invalid argument. Note that this differs from * FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are * problematic regardless of the state of the system (e.g., a malformed file * name). */ INVALID_ARGUMENT: 'invalid-argument', /** * Deadline expired before operation could complete. For operations that * change the state of the system, this error may be returned even if the * operation has completed successfully. For example, a successful response * from a server could have been delayed long enough for the deadline to * expire. */ DEADLINE_EXCEEDED: 'deadline-exceeded', /** Some requested entity (e.g., file or directory) was not found. */ NOT_FOUND: 'not-found', /** * Some entity that we attempted to create (e.g., file or directory) already * exists. */ ALREADY_EXISTS: 'already-exists', /** * The caller does not have permission to execute the specified operation. * PERMISSION_DENIED must not be used for rejections caused by exhausting * some resource (use RESOURCE_EXHAUSTED instead for those errors). * PERMISSION_DENIED must not be used if the caller can not be identified * (use UNAUTHENTICATED instead for those errors). */ PERMISSION_DENIED: 'permission-denied', /** * The request does not have valid authentication credentials for the * operation. */ UNAUTHENTICATED: 'unauthenticated', /** * Some resource has been exhausted, perhaps a per-user quota, or perhaps the * entire file system is out of space. */ RESOURCE_EXHAUSTED: 'resource-exhausted', /** * Operation was rejected because the system is not in a state required for * the operation's execution. For example, directory to be deleted may be * non-empty, an rmdir operation is applied to a non-directory, etc. * * A litmus test that may help a service implementor in deciding * between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: * (a) Use UNAVAILABLE if the client can retry just the failing call. * (b) Use ABORTED if the client should retry at a higher-level * (e.g., restarting a read-modify-write sequence). * (c) Use FAILED_PRECONDITION if the client should not retry until * the system state has been explicitly fixed. E.g., if an "rmdir" * fails because the directory is non-empty, FAILED_PRECONDITION * should be returned since the client should not retry unless * they have first fixed up the directory by deleting files from it. * (d) Use FAILED_PRECONDITION if the client performs conditional * REST Get/Update/Delete on a resource and the resource on the * server does not match the condition. E.g., conflicting * read-modify-write on the same resource. */ FAILED_PRECONDITION: 'failed-precondition', /** * The operation was aborted, typically due to a concurrency issue like * sequencer check failures, transaction aborts, etc. * * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, * and UNAVAILABLE. */ ABORTED: 'aborted', /** * Operation was attempted past the valid range. E.g., seeking or reading * past end of file. * * Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed * if the system state changes. For example, a 32-bit file system will * generate INVALID_ARGUMENT if asked to read at an offset that is not in the * range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from * an offset past the current file size. * * There is a fair bit of overlap between FAILED_PRECONDITION and * OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) * when it applies so that callers who are iterating through a space can * easily look for an OUT_OF_RANGE error to detect when they are done. */ OUT_OF_RANGE: 'out-of-range', /** Operation is not implemented or not supported/enabled in this service. */ UNIMPLEMENTED: 'unimplemented', /** * Internal errors. Means some invariants expected by underlying System has * been broken. If you see one of these errors, Something is very broken. */ INTERNAL: 'internal', /** * The service is currently unavailable. This is a most likely a transient * condition and may be corrected by retrying with a backoff. * * See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, * and UNAVAILABLE. */ UNAVAILABLE: 'unavailable', /** Unrecoverable data loss or corruption. */ DATA_LOSS: 'data-loss' }; /** * An error class used for Firestore-generated errors. Ideally we should be * using FirebaseError, but integrating with it is overly arduous at the moment, * so we define our own compatible error class (with a `name` of 'FirebaseError' * and compatible `code` and `message` fields.) */ var FirestoreError = /** @class */ (function (_super) { tslib_1.__extends(FirestoreError, _super); function FirestoreError(code, message) { var _this = _super.call(this, message) || this; _this.code = code; _this.message = message; _this.name = 'FirebaseError'; // HACK: We write a toString property directly because Error is not a real // class and so inheritance does not work correctly. We could alternatively // do the same "back-door inheritance" trick that FirebaseError does. _this.toString = function () { return _this.name + ": [code=" + _this.code + "]: " + _this.message; }; return _this; } return FirestoreError; }(Error)); /** * Copyright 2017 Google Inc. * * 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. */ /** * Helper function to prevent instantiation through the constructor. * * This method creates a new constructor that throws when it's invoked. * The prototype of that constructor is then set to the prototype of the hidden * "class" to expose all the prototype methods and allow for instanceof * checks. * * To also make all the static methods available, all properties of the * original constructor are copied to the new constructor. */ function makeConstructorPrivate(cls, optionalMessage) { function PublicConstructor() { var error = 'This constructor is private.'; if (optionalMessage) { error += ' '; error += optionalMessage; } throw new FirestoreError(Code.INVALID_ARGUMENT, error); } // Make sure instanceof checks work and all methods are exposed on the public // constructor PublicConstructor.prototype = cls.prototype; // Copy any static methods/members for (var staticProperty in cls) { if (cls.hasOwnProperty(staticProperty)) { PublicConstructor[staticProperty] = cls[staticProperty]; } } return PublicConstructor; } /** * Copyright 2017 Google Inc. * * 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. */ function contains(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } /** Returns the given value if it's defined or the defaultValue otherwise. */ function defaulted(value, defaultValue) { return value !== undefined ? value : defaultValue; } function forEachNumber(obj, fn) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var num = Number(key); if (!isNaN(num)) { fn(num, obj[key]); } } } } function values(obj) { var vs = []; forEach(obj, function (_, v) { return vs.push(v); }); return vs; } function forEach(obj, fn) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { fn(key, obj[key]); } } } function isEmpty(obj) { assert(obj != null && typeof obj === 'object', 'isEmpty() expects object parameter.'); for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { return false; } } return true; } function shallowCopy(obj) { assert(obj && typeof obj === 'object', 'shallowCopy() expects object parameter.'); var result = {}; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { result[key] = obj[key]; } } return result; } /** * Copyright 2017 Google Inc. * * 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. */ /** * Validates the invocation of functionName has the exact number of arguments. * * Forward the magic "arguments" variable as second parameter on which the * parameter validation is performed: * validateExactNumberOfArgs('myFunction', arguments, 2); */ function validateExactNumberOfArgs(functionName, args, numberOfArgs) { if (args.length !== numberOfArgs) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + functionName + "() requires " + formatPlural(numberOfArgs, 'argument') + ', but was called with ' + formatPlural(args.length, 'argument') + '.'); } } /** * Validates the invocation of functionName has at least the provided number of * arguments (but can have many more). * * Forward the magic "arguments" variable as second parameter on which the * parameter validation is performed: * validateAtLeastNumberOfArgs('myFunction', arguments, 2); */ function validateAtLeastNumberOfArgs(functionName, args, minNumberOfArgs) { if (args.length < minNumberOfArgs) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + functionName + "() requires at least " + formatPlural(minNumberOfArgs, 'argument') + ', but was called with ' + formatPlural(args.length, 'argument') + '.'); } } /** * Validates the invocation of functionName has number of arguments between * the values provided. * * Forward the magic "arguments" variable as second parameter on which the * parameter validation is performed: * validateBetweenNumberOfArgs('myFunction', arguments, 2, 3); */ function validateBetweenNumberOfArgs(functionName, args, minNumberOfArgs, maxNumberOfArgs) { if (args.length < minNumberOfArgs || args.length > maxNumberOfArgs) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + functionName + "() requires between " + minNumberOfArgs + " and " + (maxNumberOfArgs + " arguments, but was called with ") + formatPlural(args.length, 'argument') + '.'); } } /** * Validates the provided argument is an array and has as least the expected * number of elements. */ function validateNamedArrayAtLeastNumberOfElements(functionName, value, name, minNumberOfElements) { if (!(value instanceof Array) || value.length < minNumberOfElements) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + functionName + "() requires its " + name + " argument to be an " + 'array with at least ' + (formatPlural(minNumberOfElements, 'element') + ".")); } } /** * Validates the provided positional argument has the native JavaScript type * using typeof checks. */ function validateArgType(functionName, type, position, argument) { validateType(functionName, type, ordinal(position) + " argument", argument); } /** * Validates the provided argument has the native JavaScript type using * typeof checks or is undefined. */ function validateOptionalArgType(functionName, type, position, argument) { if (argument !== undefined) { validateArgType(functionName, type, position, argument); } } /** * Validates the provided named option has the native JavaScript type using * typeof checks. */ function validateNamedType(functionName, type, optionName, argument) { validateType(functionName, type, optionName + " option", argument); } /** * Validates the provided named option has the native JavaScript type using * typeof checks or is undefined. */ function validateNamedOptionalType(functionName, type, optionName, argument) { if (argument !== undefined) { validateNamedType(functionName, type, optionName, argument); } } function validateArrayElements(functionName, optionName, typeDescription, argument, validator) { if (!(argument instanceof Array)) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + functionName + "() requires its " + optionName + " " + ("option to be an array, but it was: " + valueDescription(argument))); } for (var i = 0; i < argument.length; ++i) { if (!validator(argument[i])) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + functionName + "() requires all " + optionName + " " + ("elements to be " + typeDescription + ", but the value at index " + i + " ") + ("was: " + valueDescription(argument[i]))); } } } function validateOptionalArrayElements(functionName, optionName, typeDescription, argument, validator) { if (argument !== undefined) { validateArrayElements(functionName, optionName, typeDescription, argument, validator); } } /** * Validates that the provided named option equals one of the expected values. */ function validateNamedPropertyEquals(functionName, inputName, optionName, input, expected) { var expectedDescription = []; for (var _i = 0, expected_1 = expected; _i < expected_1.length; _i++) { var val = expected_1[_i]; if (val === input) { return; } expectedDescription.push(valueDescription(val)); } var actualDescription = valueDescription(input); throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid value " + actualDescription + " provided to function " + functionName + "() for option " + ("\"" + optionName + "\". Acceptable values: " + expectedDescription.join(', '))); } /** * Validates that the provided named option equals one of the expected values or * is undefined. */ function validateNamedOptionalPropertyEquals(functionName, inputName, optionName, input, expected) { if (input !== undefined) { validateNamedPropertyEquals(functionName, inputName, optionName, input, expected); } } /** Helper to validate the type of a provided input. */ function validateType(functionName, type, inputName, input) { var valid = false; if (type === 'object') { valid = isPlainObject(input); } else if (type === 'non-empty string') { valid = typeof input === 'string' && input !== ''; } else { valid = typeof input === type; } if (!valid) { var description = valueDescription(input); throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + functionName + "() requires its " + inputName + " " + ("to be of type " + type + ", but it was: " + description)); } } /** * Returns true if it's a non-null object without a custom prototype * (i.e. excludes Array, Date, etc.). */ function isPlainObject(input) { return (typeof input === 'object' && input !== null && (Object.getPrototypeOf(input) === Object.prototype || Object.getPrototypeOf(input) === null)); } /** Returns a string describing the type / value of the provided input. */ function valueDescription(input) { if (input === undefined) { return 'undefined'; } else if (input === null) { return 'null'; } else if (typeof input === 'string') { if (input.length > 20) { input = input.substring(0, 20) + "..."; } return JSON.stringify(input); } else if (typeof input === 'number' || typeof input === 'boolean') { return '' + input; } else if (typeof input === 'object') { if (input instanceof Array) { return 'an array'; } else { var customObjectName = tryGetCustomObjectType(input); if (customObjectName) { return "a custom " + customObjectName + " object"; } else { return 'an object'; } } } else if (typeof input === 'function') { return 'a function'; } else { return fail('Unknown wrong type: ' + typeof input); } } /** Hacky method to try to get the constructor name for an object. */ function tryGetCustomObjectType(input) { if (input.constructor) { var funcNameRegex = /function\s+([^\s(]+)\s*\(/; var results = funcNameRegex.exec(input.constructor.toString()); if (results && results.length > 1) { return results[1]; } } return null; } /** Validates the provided argument is defined. */ function validateDefined(functionName, position, argument) { if (argument === undefined) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + functionName + "() requires a valid " + ordinal(position) + " " + "argument, but it was undefined."); } } /** * Validates the provided positional argument is an object, and its keys and * values match the expected keys and types provided in optionTypes. */ function validateOptionNames(functionName, options, optionNames) { forEach(options, function (key, _) { if (optionNames.indexOf(key) < 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Unknown option '" + key + "' passed to function " + functionName + "(). " + 'Available options: ' + optionNames.join(', ')); } }); } /** * Helper method to throw an error that the provided argument did not pass * an instanceof check. */ function invalidClassError(functionName, type, position, argument) { var description = valueDescription(argument); return new FirestoreError(Code.INVALID_ARGUMENT, "Function " + functionName + "() requires its " + ordinal(position) + " " + ("argument to be a " + type + ", but it was: " + description)); } /** Converts a number to its english word representation */ function ordinal(num) { switch (num) { case 1: return 'first'; case 2: return 'second'; case 3: return 'third'; default: return num + 'th'; } } /** * Formats the given word as plural conditionally given the preceding number. */ function formatPlural(num, str) { return num + " " + str + (num === 1 ? '' : 's'); } /** * Copyright 2017 Google Inc. * * 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. */ // tslint:disable-next-line:class-as-namespace var AutoId = /** @class */ (function () { function AutoId() { } AutoId.newId = function () { // Alphanumeric characters var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var autoId = ''; for (var i = 0; i < 20; i++) { autoId += chars.charAt(Math.floor(Math.random() * chars.length)); } assert(autoId.length === 20, 'Invalid auto ID: ' + autoId); return autoId; }; return AutoId; }()); function primitiveComparator(left, right) { if (left < right) return -1; if (left > right) return 1; return 0; } /** Helper to compare nullable (or undefined-able) objects using isEqual(). */ function equals(left, right) { if (left !== null && left !== undefined) { return !!(right && left.isEqual(right)); } else { // HACK: Explicitly cast since TypeScript's type narrowing apparently isn't // smart enough. return left === right; } } /** Helper to compare arrays using isEqual(). */ function arrayEquals(left, right) { if (left.length !== right.length) { return false; } for (var i = 0; i < left.length; i++) { if (!left[i].isEqual(right[i])) { return false; } } return true; } /** * Returns the immediate lexicographically-following string. This is useful to * construct an inclusive range for indexeddb iterators. */ function immediateSuccessor(s) { // Return the input string, with an additional NUL byte appended. return s + '\0'; } /** * Copyright 2017 Google Inc. * * 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. */ /** Helper function to assert Uint8Array is available at runtime. */ function assertUint8ArrayAvailable() { if (typeof Uint8Array === 'undefined') { throw new FirestoreError(Code.UNIMPLEMENTED, 'Uint8Arrays are not available in this environment.'); } } /** Helper function to assert Base64 functions are available at runtime. */ function assertBase64Available() { if (!PlatformSupport.getPlatform().base64Available) { throw new FirestoreError(Code.UNIMPLEMENTED, 'Blobs are unavailable in Firestore in this environment.'); } } /** * Immutable class holding a blob (binary data). * This class is directly exposed in the public API. * * Note that while you can't hide the constructor in JavaScript code, we are * using the hack above to make sure no-one outside this module can call it. */ var Blob = /** @class */ (function () { function Blob(binaryString) { assertBase64Available(); this._binaryString = binaryString; } Blob.fromBase64String = function (base64) { validateExactNumberOfArgs('Blob.fromBase64String', arguments, 1); validateArgType('Blob.fromBase64String', 'string', 1, base64); assertBase64Available(); try { var binaryString = PlatformSupport.getPlatform().atob(base64); return new Blob(binaryString); } catch (e) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to construct Blob from Base64 string: ' + e); } }; Blob.fromUint8Array = function (array) { validateExactNumberOfArgs('Blob.fromUint8Array', arguments, 1); assertUint8ArrayAvailable(); if (!(array instanceof Uint8Array)) { throw invalidClassError('Blob.fromUint8Array', 'Uint8Array', 1, array); } // We can't call array.map directly because it expects the return type to // be a Uint8Array, whereas we can convert it to a regular array by invoking // map on the Array prototype. var binaryString = Array.prototype.map .call(array, function (char) { return String.fromCharCode(char); }) .join(''); return new Blob(binaryString); }; Blob.prototype.toBase64 = function () { validateExactNumberOfArgs('Blob.toBase64', arguments, 0); assertBase64Available(); return PlatformSupport.getPlatform().btoa(this._binaryString); }; Blob.prototype.toUint8Array = function () { validateExactNumberOfArgs('Blob.toUint8Array', arguments, 0); assertUint8ArrayAvailable(); var buffer = new Uint8Array(this._binaryString.length); for (var i = 0; i < this._binaryString.length; i++) { buffer[i] = this._binaryString.charCodeAt(i); } return buffer; }; Blob.prototype.toString = function () { return 'Blob(base64: ' + this.toBase64() + ')'; }; Blob.prototype.isEqual = function (other) { return this._binaryString === other._binaryString; }; /** * Actually private to JS consumers of our API, so this function is prefixed * with an underscore. */ Blob.prototype._compareTo = function (other) { return primitiveComparator(this._binaryString, other._binaryString); }; return Blob; }()); // Public instance that disallows construction at runtime. This constructor is // used when exporting Blob on firebase.firestore.Blob and will be called Blob // publicly. Internally we still use Blob which has a type checked private // constructor. Note that Blob and PublicBlob can be used interchangeably in // instanceof checks. // For our internal TypeScript code PublicBlob doesn't exist as a type, and so // we need to use Blob as type and export it too. // tslint:disable-next-line:variable-name We're treating this as a class name. var PublicBlob = makeConstructorPrivate(Blob, 'Use Blob.fromUint8Array() or Blob.fromBase64String() instead.'); /** * Copyright 2017 Google Inc. * * 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. */ /** * Immutable class representing a geo point as latitude-longitude pair. * This class is directly exposed in the public API, including its constructor. */ var GeoPoint = /** @class */ (function () { function GeoPoint(latitude, longitude) { validateExactNumberOfArgs('GeoPoint', arguments, 2); validateArgType('GeoPoint', 'number', 1, latitude); validateArgType('GeoPoint', 'number', 2, longitude); if (!isFinite(latitude) || latitude < -90 || latitude > 90) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Latitude must be a number between -90 and 90, but was: ' + latitude); } if (!isFinite(longitude) || longitude < -180 || longitude > 180) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Longitude must be a number between -180 and 180, but was: ' + longitude); } this._lat = latitude; this._long = longitude; } Object.defineProperty(GeoPoint.prototype, "latitude", { /** * Returns the latitude of this geo point, a number between -90 and 90. */ get: function () { return this._lat; }, enumerable: true, configurable: true }); Object.defineProperty(GeoPoint.prototype, "longitude", { /** * Returns the longitude of this geo point, a number between -180 and 180. */ get: function () { return this._long; }, enumerable: true, configurable: true }); GeoPoint.prototype.isEqual = function (other) { return this._lat === other._lat && this._long === other._long; }; /** * Actually private to JS consumers of our API, so this function is prefixed * with an underscore. */ GeoPoint.prototype._compareTo = function (other) { return (primitiveComparator(this._lat, other._lat) || primitiveComparator(this._long, other._long)); }; return GeoPoint; }()); /** * Copyright 2017 Google Inc. * * 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. */ var Timestamp = /** @class */ (function () { function Timestamp(seconds, nanoseconds) { this.seconds = seconds; this.nanoseconds = nanoseconds; if (nanoseconds < 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Timestamp nanoseconds out of range: ' + nanoseconds); } if (nanoseconds >= 1e9) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Timestamp nanoseconds out of range: ' + nanoseconds); } // Midnight at the beginning of 1/1/1 is the earliest Firestore supports. if (seconds < -62135596800) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Timestamp seconds out of range: ' + seconds); } // This will break in the year 10,000. if (seconds >= 253402300800) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Timestamp seconds out of range: ' + seconds); } } Timestamp.now = function () { return Timestamp.fromMillis(Date.now()); }; Timestamp.fromDate = function (date) { return Timestamp.fromMillis(date.getTime()); }; Timestamp.fromMillis = function (milliseconds) { var seconds = Math.floor(milliseconds / 1000); var nanos = (milliseconds - seconds * 1000) * 1e6; return new Timestamp(seconds, nanos); }; Timestamp.prototype.toDate = function () { return new Date(this.toMillis()); }; Timestamp.prototype.toMillis = function () { return this.seconds * 1000 + this.nanoseconds / 1e6; }; Timestamp.prototype._compareTo = function (other) { if (this.seconds === other.seconds) { return primitiveComparator(this.nanoseconds, other.nanoseconds); } return primitiveComparator(this.seconds, other.seconds); }; Timestamp.prototype.isEqual = function (other) { return (other.seconds === this.seconds && other.nanoseconds === this.nanoseconds); }; Timestamp.prototype.toString = function () { return ('Timestamp(seconds=' + this.seconds + ', nanoseconds=' + this.nanoseconds + ')'); }; return Timestamp; }()); /** * Copyright 2017 Google Inc. * * 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. */ var DatabaseInfo = /** @class */ (function () { /** * Constructs a DatabaseInfo using the provided host, databaseId and * persistenceKey. * * @param databaseId The database to use. * @param persistenceKey A unique identifier for this Firestore's local * storage (used in conjunction with the databaseId). * @param host The Firestore backend host to connect to. * @param ssl Whether to use SSL when connecting. */ function DatabaseInfo(databaseId, persistenceKey, host, ssl) { this.databaseId = databaseId; this.persistenceKey = persistenceKey; this.host = host; this.ssl = ssl; } return DatabaseInfo; }()); /** The default database name for a project. */ var DEFAULT_DATABASE_NAME = '(default)'; /** Represents the database ID a Firestore client is associated with. */ var DatabaseId = /** @class */ (function () { function DatabaseId(projectId, database) { this.projectId = projectId; this.database = database ? database : DEFAULT_DATABASE_NAME; } Object.defineProperty(DatabaseId.prototype, "isDefaultDatabase", { get: function () { return this.database === DEFAULT_DATABASE_NAME; }, enumerable: true, configurable: true }); DatabaseId.prototype.isEqual = function (other) { return (other instanceof DatabaseId && other.projectId === this.projectId && other.database === this.database); }; DatabaseId.prototype.compareTo = function (other) { return (primitiveComparator(this.projectId, other.projectId) || primitiveComparator(this.database, other.database)); }; return DatabaseId; }()); /** * Copyright 2017 Google Inc. * * 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. */ var DOCUMENT_KEY_NAME = '__name__'; /** * Path represents an ordered sequence of string segments. */ var Path = /** @class */ (function () { function Path(segments, offset, length) { this.init(segments, offset, length); } /** * An initialization method that can be called from outside the constructor. * We need this so that we can have a non-static construct method that returns * the polymorphic `this` type. */ Path.prototype.init = function (segments, offset, length) { if (offset === undefined) { offset = 0; } else if (offset > segments.length) { fail('offset ' + offset + ' out of range ' + segments.length); } if (length === undefined) { length = segments.length - offset; } else if (length > segments.length - offset) { fail('length ' + length + ' out of range ' + (segments.length - offset)); } this.segments = segments; this.offset = offset; this.len = length; }; /** * Constructs a new instance of Path using the same concrete type as `this`. * We need this instead of using the normal constructor, because polymorphic * `this` doesn't work on static methods. */ Path.prototype.construct = function (segments, offset, length) { var path = Object.create(Object.getPrototypeOf(this)); path.init(segments, offset, length); return path; }; Object.defineProperty(Path.prototype, "length", { get: function () { return this.len; }, enumerable: true, configurable: true }); Path.prototype.isEqual = function (other) { return Path.comparator(this, other) === 0; }; Path.prototype.child = function (nameOrPath) { var segments = this.segments.slice(this.offset, this.limit()); if (nameOrPath instanceof Path) { nameOrPath.forEach(function (segment) { segments.push(segment); }); } else if (typeof nameOrPath === 'string') { segments.push(nameOrPath); } else { fail('Unknown parameter type for Path.child(): ' + nameOrPath); } return this.construct(segments); }; /** The index of one past the last segment of the path. */ Path.prototype.limit = function () { return this.offset + this.length; }; Path.prototype.popFirst = function (size) { size = size === undefined ? 1 : size; assert(this.length >= size, "Can't call popFirst() with less segments"); return this.construct(this.segments, this.offset + size, this.length - size); }; Path.prototype.popLast = function () { assert(!this.isEmpty(), "Can't call popLast() on empty path"); return this.construct(this.segments, this.offset, this.length - 1); }; Path.prototype.firstSegment = function () { assert(!this.isEmpty(), "Can't call firstSegment() on empty path"); return this.segments[this.offset]; }; Path.prototype.lastSegment = function () { assert(!this.isEmpty(), "Can't call lastSegment() on empty path"); return this.segments[this.limit() - 1]; }; Path.prototype.get = function (index) { assert(index < this.length, 'Index out of range'); return this.segments[this.offset + index]; }; Path.prototype.isEmpty = function () { return this.length === 0; }; Path.prototype.isPrefixOf = function (other) { if (other.length < this.length) { return false; } for (var i = 0; i < this.length; i++) { if (this.get(i) !== other.get(i)) { return false; } } return true; }; Path.prototype.isImmediateParentOf = function (potentialChild) { if (this.length + 1 !== potentialChild.length) { return false; } for (var i = 0; i < this.length; i++) { if (this.get(i) !== potentialChild.get(i)) { return false; } } return true; }; Path.prototype.forEach = function (fn) { for (var i = this.offset, end = this.limit(); i < end; i++) { fn(this.segments[i]); } }; Path.prototype.toArray = function () { return this.segments.slice(this.offset, this.limit()); }; Path.comparator = function (p1, p2) { var len = Math.min(p1.length, p2.length); for (var i = 0; i < len; i++) { var left = p1.get(i); var right = p2.get(i); if (left < right) return -1; if (left > right) return 1; } if (p1.length < p2.length) return -1; if (p1.length > p2.length) return 1; return 0; }; return Path; }()); /** * A slash-separated path for navigating resources (documents and collections) * within Firestore. */ var ResourcePath = /** @class */ (function (_super) { tslib_1.__extends(ResourcePath, _super); function ResourcePath() { return _super !== null && _super.apply(this, arguments) || this; } ResourcePath.prototype.canonicalString = function () { // NOTE: The client is ignorant of any path segments containing escape // sequences (e.g. __id123__) and just passes them through raw (they exist // for legacy reasons and should not be used frequently). return this.toArray().join('/'); }; ResourcePath.prototype.toString = function () { return this.canonicalString(); }; /** * Creates a resource path from the given slash-delimited string. */ ResourcePath.fromString = function (path) { // NOTE: The client is ignorant of any path segments containing escape // sequences (e.g. __id123__) and just passes them through raw (they exist // for legacy reasons and should not be used frequently). if (path.indexOf('//') >= 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid path (" + path + "). Paths must not contain // in them."); } // We may still have an empty segment at the beginning or end if they had a // leading or trailing slash (which we allow). var segments = path.split('/').filter(function (segment) { return segment.length > 0; }); return new ResourcePath(segments); }; ResourcePath.EMPTY_PATH = new ResourcePath([]); return ResourcePath; }(Path)); var identifierRegExp = /^[_a-zA-Z][_a-zA-Z0-9]*$/; /** A dot-separated path for navigating sub-objects within a document. */ var FieldPath = /** @class */ (function (_super) { tslib_1.__extends(FieldPath, _super); function FieldPath() { return _super !== null && _super.apply(this, arguments) || this; } /** * Returns true if the string could be used as a segment in a field path * without escaping. */ FieldPath.isValidIdentifier = function (segment) { return identifierRegExp.test(segment); }; FieldPath.prototype.canonicalString = function () { return this.toArray() .map(function (str) { str = str.replace('\\', '\\\\').replace('`', '\\`'); if (!FieldPath.isValidIdentifier(str)) { str = '`' + str + '`'; } return str; }) .join('.'); }; FieldPath.prototype.toString = function () { return this.canonicalString(); }; /** * Returns true if this field references the key of a document. */ FieldPath.prototype.isKeyField = function () { return this.length === 1 && this.get(0) === DOCUMENT_KEY_NAME; }; /** * The field designating the key of a document. */ FieldPath.keyField = function () { return new FieldPath([DOCUMENT_KEY_NAME]); }; /** * Parses a field string from the given server-formatted string. * * - Splitting the empty string is not allowed (for now at least). * - Empty segments within the string (e.g. if there are two consecutive * separators) are not allowed. * * TODO(b/37244157): we should make this more strict. Right now, it allows * non-identifier path components, even if they aren't escaped. */ FieldPath.fromServerFormat = function (path) { var segments = []; var current = ''; var i = 0; var addCurrentSegment = function () { if (current.length === 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid field path (" + path + "). Paths must not be empty, begin " + "with '.', end with '.', or contain '..'"); } segments.push(current); current = ''; }; var inBackticks = false; while (i < path.length) { var c = path[i]; if (c === '\\') { if (i + 1 === path.length) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Path has trailing escape character: ' + path); } var next = path[i + 1]; if (!(next === '\\' || next === '.' || next === '`')) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Path has invalid escape sequence: ' + path); } current += next; i += 2; } else if (c === '`') { inBackticks = !inBackticks; i++; } else if (c === '.' && !inBackticks) { addCurrentSegment(); i++; } else { current += c; i++; } } addCurrentSegment(); if (inBackticks) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Unterminated ` in path: ' + path); } return new FieldPath(segments); }; FieldPath.EMPTY_PATH = new FieldPath([]); return FieldPath; }(Path)); /** * Copyright 2017 Google Inc. * * 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. */ var DocumentKey = /** @class */ (function () { function DocumentKey(path) { this.path = path; assert(DocumentKey.isDocumentKey(path), 'Invalid DocumentKey with an odd number of segments: ' + path.toArray().join('/')); } DocumentKey.prototype.isEqual = function (other) { return (other !== null && ResourcePath.comparator(this.path, other.path) === 0); }; DocumentKey.prototype.toString = function () { return this.path.toString(); }; DocumentKey.comparator = function (k1, k2) { return ResourcePath.comparator(k1.path, k2.path); }; DocumentKey.isDocumentKey = function (path) { return path.length % 2 === 0; }; /** * Creates and returns a new document key with the given segments. * * @param path The segments of the path to the document * @return A new instance of DocumentKey */ DocumentKey.fromSegments = function (segments) { return new DocumentKey(new ResourcePath(segments.slice())); }; /** * Creates and returns a new document key using '/' to split the string into * segments. * * @param path The slash-separated path string to the document * @return A new instance of DocumentKey */ DocumentKey.fromPathString = function (path) { return new DocumentKey(ResourcePath.fromString(path)); }; DocumentKey.EMPTY = new DocumentKey(new ResourcePath([])); return DocumentKey; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * The result of a lookup for a given path may be an existing document or a * marker that this document does not exist at a given version. */ var MaybeDocument = /** @class */ (function () { function MaybeDocument(key, version) { this.key = key; this.version = version; } MaybeDocument.compareByKey = function (d1, d2) { return DocumentKey.comparator(d1.key, d2.key); }; return MaybeDocument; }()); /** * Represents a document in Firestore with a key, version, data and whether the * data has local mutations applied to it. */ var Document = /** @class */ (function (_super) { tslib_1.__extends(Document, _super); function Document(key, version, data, options) { var _this = _super.call(this, key, version) || this; _this.data = data; _this.hasLocalMutations = !!options.hasLocalMutations; _this.hasCommittedMutations = !!options.hasCommittedMutations; return _this; } Document.prototype.field = function (path) { return this.data.field(path); }; Document.prototype.fieldValue = function (path) { var field = this.field(path); return field ? field.value() : undefined; }; Document.prototype.value = function () { return this.data.value(); }; Document.prototype.isEqual = function (other) { return (other instanceof Document && this.key.isEqual(other.key) && this.version.isEqual(other.version) && this.data.isEqual(other.data) && this.hasLocalMutations === other.hasLocalMutations && this.hasCommittedMutations === other.hasCommittedMutations); }; Document.prototype.toString = function () { return ("Document(" + this.key + ", " + this.version + ", " + this.data.toString() + ", " + ("{hasLocalMutations: " + this.hasLocalMutations + "}), ") + ("{hasCommittedMutations: " + this.hasCommittedMutations + "})")); }; Object.defineProperty(Document.prototype, "hasPendingWrites", { get: function () { return this.hasLocalMutations || this.hasCommittedMutations; }, enumerable: true, configurable: true }); Document.compareByField = function (field, d1, d2) { var v1 = d1.field(field); var v2 = d2.field(field); if (v1 !== undefined && v2 !== undefined) { return v1.compareTo(v2); } else { return fail("Trying to compare documents on fields that don't exist"); } }; return Document; }(MaybeDocument)); /** * A class representing a deleted document. * Version is set to 0 if we don't point to any specific time, otherwise it * denotes time we know it didn't exist at. */ var NoDocument = /** @class */ (function (_super) { tslib_1.__extends(NoDocument, _super); function NoDocument(key, version, options) { var _this = _super.call(this, key, version) || this; _this.hasCommittedMutations = !!(options && options.hasCommittedMutations); return _this; } NoDocument.prototype.toString = function () { return "NoDocument(" + this.key + ", " + this.version + ")"; }; Object.defineProperty(NoDocument.prototype, "hasPendingWrites", { get: function () { return this.hasCommittedMutations; }, enumerable: true, configurable: true }); NoDocument.prototype.isEqual = function (other) { return (other instanceof NoDocument && other.hasCommittedMutations === this.hasCommittedMutations && other.version.isEqual(this.version) && other.key.isEqual(this.key)); }; return NoDocument; }(MaybeDocument)); /** * A class representing an existing document whose data is unknown (e.g. a * document that was updated without a known base document). */ var UnknownDocument = /** @class */ (function (_super) { tslib_1.__extends(UnknownDocument, _super); function UnknownDocument(key, version) { return _super.call(this, key, version) || this; } UnknownDocument.prototype.toString = function () { return "UnknownDocument(" + this.key + ", " + this.version + ")"; }; Object.defineProperty(UnknownDocument.prototype, "hasPendingWrites", { get: function () { return true; }, enumerable: true, configurable: true }); UnknownDocument.prototype.isEqual = function (other) { return (other instanceof UnknownDocument && other.version.isEqual(this.version) && other.key.isEqual(this.key)); }; return UnknownDocument; }(MaybeDocument)); /** * Copyright 2017 Google Inc. * * 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. */ // An immutable sorted map implementation, based on a Left-leaning Red-Black // tree. var SortedMap = /** @class */ (function () { function SortedMap(comparator, root) { this.comparator = comparator; this.root = root ? root : LLRBNode.EMPTY; } // Returns a copy of the map, with the specified key/value added or replaced. SortedMap.prototype.insert = function (key, value) { return new SortedMap(this.comparator, this.root .insert(key, value, this.comparator) .copy(null, null, LLRBNode.BLACK, null, null)); }; // Returns a copy of the map, with the specified key removed. SortedMap.prototype.remove = function (key) { return new SortedMap(this.comparator, this.root .remove(key, this.comparator) .copy(null, null, LLRBNode.BLACK, null, null)); }; // Returns the value of the node with the given key, or null. SortedMap.prototype.get = function (key) { var node = this.root; while (!node.isEmpty()) { var cmp = this.comparator(key, node.key); if (cmp === 0) { return node.value; } else if (cmp < 0) { node = node.left; } else if (cmp > 0) { node = node.right; } } return null; }; // Returns the index of the element in this sorted map, or -1 if it doesn't // exist. SortedMap.prototype.indexOf = function (key) { // Number of nodes that were pruned when descending right var prunedNodes = 0; var node = this.root; while (!node.isEmpty()) { var cmp = this.comparator(key, node.key); if (cmp === 0) { return prunedNodes + node.left.size; } else if (cmp < 0) { node = node.left; } else { // Count all nodes left of the node plus the node itself prunedNodes += node.left.size + 1; node = node.right; } } // Node not found return -1; }; SortedMap.prototype.isEmpty = function () { return this.root.isEmpty(); }; Object.defineProperty(SortedMap.prototype, "size", { // Returns the total number of nodes in the map. get: function () { return this.root.size; }, enumerable: true, configurable: true }); // Returns the minimum key in the map. SortedMap.prototype.minKey = function () { return this.root.minKey(); }; // Returns the maximum key in the map. SortedMap.prototype.maxKey = function () { return this.root.maxKey(); }; // Traverses the map in key order and calls the specified action function // for each key/value pair. If action returns true, traversal is aborted. // Returns the first truthy value returned by action, or the last falsey // value returned by action. SortedMap.prototype.inorderTraversal = function (action) { return this.root.inorderTraversal(action); }; SortedMap.prototype.forEach = function (fn) { this.inorderTraversal(function (k, v) { fn(k, v); return false; }); }; // Traverses the map in reverse key order and calls the specified action // function for each key/value pair. If action returns true, traversal is // aborted. // Returns the first truthy value returned by action, or the last falsey // value returned by action. SortedMap.prototype.reverseTraversal = function (action) { return this.root.reverseTraversal(action); }; // Returns an iterator over the SortedMap. SortedMap.prototype.getIterator = function () { return new SortedMapIterator(this.root, null, this.comparator, false); }; SortedMap.prototype.getIteratorFrom = function (key) { return new SortedMapIterator(this.root, key, this.comparator, false); }; SortedMap.prototype.getReverseIterator = function () { return new SortedMapIterator(this.root, null, this.comparator, true); }; SortedMap.prototype.getReverseIteratorFrom = function (key) { return new SortedMapIterator(this.root, key, this.comparator, true); }; return SortedMap; }()); // end SortedMap // An iterator over an LLRBNode. var SortedMapIterator = /** @class */ (function () { function SortedMapIterator(node, startKey, comparator, isReverse) { this.isReverse = isReverse; this.nodeStack = []; var cmp = 1; while (!node.isEmpty()) { cmp = startKey ? comparator(node.key, startKey) : 1; // flip the comparison if we're going in reverse if (isReverse) cmp *= -1; if (cmp < 0) { // This node is less than our start key. ignore it if (this.isReverse) { node = node.left; } else { node = node.right; } } else if (cmp === 0) { // This node is exactly equal to our start key. Push it on the stack, // but stop iterating; this.nodeStack.push(node); break; } else { // This node is greater than our start key, add it to the stack and move // to the next one this.nodeStack.push(node); if (this.isReverse) { node = node.right; } else { node = node.left; } } } } SortedMapIterator.prototype.getNext = function () { assert(this.nodeStack.length > 0, 'getNext() called on iterator when hasNext() is false.'); var node = this.nodeStack.pop(); var result = { key: node.key, value: node.value }; if (this.isReverse) { node = node.left; while (!node.isEmpty()) { this.nodeStack.push(node); node = node.right; } } else { node = node.right; while (!node.isEmpty()) { this.nodeStack.push(node); node = node.left; } } return result; }; SortedMapIterator.prototype.hasNext = function () { return this.nodeStack.length > 0; }; SortedMapIterator.prototype.peek = function () { if (this.nodeStack.length === 0) return null; var node = this.nodeStack[this.nodeStack.length - 1]; return { key: node.key, value: node.value }; }; return SortedMapIterator; }()); // end SortedMapIterator // Represents a node in a Left-leaning Red-Black tree. var LLRBNode = /** @class */ (function () { function LLRBNode(key, value, color, left, right) { this.key = key; this.value = value; this.color = color != null ? color : LLRBNode.RED; this.left = left != null ? left : LLRBNode.EMPTY; this.right = right != null ? right : LLRBNode.EMPTY; this.size = this.left.size + 1 + this.right.size; } // Returns a copy of the current node, optionally replacing pieces of it. LLRBNode.prototype.copy = function (key, value, color, left, right) { return new LLRBNode(key != null ? key : this.key, value != null ? value : this.value, color != null ? color : this.color, left != null ? left : this.left, right != null ? right : this.right); }; LLRBNode.prototype.isEmpty = function () { return false; }; // Traverses the tree in key order and calls the specified action function // for each node. If action returns true, traversal is aborted. // Returns the first truthy value returned by action, or the last falsey // value returned by action. LLRBNode.prototype.inorderTraversal = function (action) { return (this.left.inorderTraversal(action) || action(this.key, this.value) || this.right.inorderTraversal(action)); }; // Traverses the tree in reverse key order and calls the specified action // function for each node. If action returns true, traversal is aborted. // Returns the first truthy value returned by action, or the last falsey // value returned by action. LLRBNode.prototype.reverseTraversal = function (action) { return (this.right.reverseTraversal(action) || action(this.key, this.value) || this.left.reverseTraversal(action)); }; // Returns the minimum node in the tree. LLRBNode.prototype.min = function () { if (this.left.isEmpty()) { return this; } else { return this.left.min(); } }; // Returns the maximum key in the tree. LLRBNode.prototype.minKey = function () { return this.min().key; }; // Returns the maximum key in the tree. LLRBNode.prototype.maxKey = function () { if (this.right.isEmpty()) { return this.key; } else { return this.right.maxKey(); } }; // Returns new tree, with the key/value added. LLRBNode.prototype.insert = function (key, value, comparator) { var n = this; var cmp = comparator(key, n.key); if (cmp < 0) { n = n.copy(null, null, null, n.left.insert(key, value, comparator), null); } else if (cmp === 0) { n = n.copy(null, value, null, null, null); } else { n = n.copy(null, null, null, null, n.right.insert(key, value, comparator)); } return n.fixUp(); }; LLRBNode.prototype.removeMin = function () { if (this.left.isEmpty()) { return LLRBNode.EMPTY; } var n = this; if (!n.left.isRed() && !n.left.left.isRed()) n = n.moveRedLeft(); n = n.copy(null, null, null, n.left.removeMin(), null); return n.fixUp(); }; // Returns new tree, with the specified item removed. LLRBNode.prototype.remove = function (key, comparator) { var smallest; var n = this; if (comparator(key, n.key) < 0) { if (!n.left.isEmpty() && !n.left.isRed() && !n.left.left.isRed()) { n = n.moveRedLeft(); } n = n.copy(null, null, null, n.left.remove(key, comparator), null); } else { if (n.left.isRed()) n = n.rotateRight(); if (!n.right.isEmpty() && !n.right.isRed() && !n.right.left.isRed()) { n = n.moveRedRight(); } if (comparator(key, n.key) === 0) { if (n.right.isEmpty()) { return LLRBNode.EMPTY; } else { smallest = n.right.min(); n = n.copy(smallest.key, smallest.value, null, null, n.right.removeMin()); } } n = n.copy(null, null, null, null, n.right.remove(key, comparator)); } return n.fixUp(); }; LLRBNode.prototype.isRed = function () { return this.color; }; // Returns new tree after performing any needed rotations. LLRBNode.prototype.fixUp = function () { var n = this; if (n.right.isRed() && !n.left.isRed()) n = n.rotateLeft(); if (n.left.isRed() && n.left.left.isRed()) n = n.rotateRight(); if (n.left.isRed() && n.right.isRed()) n = n.colorFlip(); return n; }; LLRBNode.prototype.moveRedLeft = function () { var n = this.colorFlip(); if (n.right.left.isRed()) { n = n.copy(null, null, null, null, n.right.rotateRight()); n = n.rotateLeft(); n = n.colorFlip(); } return n; }; LLRBNode.prototype.moveRedRight = function () { var n = this.colorFlip(); if (n.left.left.isRed()) { n = n.rotateRight(); n = n.colorFlip(); } return n; }; LLRBNode.prototype.rotateLeft = function () { var nl = this.copy(null, null, LLRBNode.RED, null, this.right.left); return this.right.copy(null, null, this.color, nl, null); }; LLRBNode.prototype.rotateRight = function () { var nr = this.copy(null, null, LLRBNode.RED, this.left.right, null); return this.left.copy(null, null, this.color, null, nr); }; LLRBNode.prototype.colorFlip = function () { var left = this.left.copy(null, null, !this.left.color, null, null); var right = this.right.copy(null, null, !this.right.color, null, null); return this.copy(null, null, !this.color, left, right); }; // For testing. LLRBNode.prototype.checkMaxDepth = function () { var blackDepth = this.check(); if (Math.pow(2.0, blackDepth) <= this.size + 1) { return true; } else { return false; } }; // In a balanced RB tree, the black-depth (number of black nodes) from root to // leaves is equal on both sides. This function verifies that or asserts. LLRBNode.prototype.check = function () { if (this.isRed() && this.left.isRed()) { throw fail('Red node has red child(' + this.key + ',' + this.value + ')'); } if (this.right.isRed()) { throw fail('Right child of (' + this.key + ',' + this.value + ') is red'); } var blackDepth = this.left.check(); if (blackDepth !== this.right.check()) { throw fail('Black depths differ'); } else { return blackDepth + (this.isRed() ? 0 : 1); } }; // tslint:disable-next-line:no-any Empty node is shared between all LLRB trees. LLRBNode.EMPTY = null; LLRBNode.RED = true; LLRBNode.BLACK = false; return LLRBNode; }()); // end LLRBNode // Represents an empty node (a leaf node in the Red-Black Tree). var LLRBEmptyNode = /** @class */ (function () { function LLRBEmptyNode() { this.size = 0; } // Returns a copy of the current node. LLRBEmptyNode.prototype.copy = function (key, value, color, left, right) { return this; }; // Returns a copy of the tree, with the specified key/value added. LLRBEmptyNode.prototype.insert = function (key, value, comparator) { return new LLRBNode(key, value); }; // Returns a copy of the tree, with the specified key removed. LLRBEmptyNode.prototype.remove = function (key, comparator) { return this; }; LLRBEmptyNode.prototype.isEmpty = function () { return true; }; LLRBEmptyNode.prototype.inorderTraversal = function (action) { return false; }; LLRBEmptyNode.prototype.reverseTraversal = function (action) { return false; }; LLRBEmptyNode.prototype.minKey = function () { return null; }; LLRBEmptyNode.prototype.maxKey = function () { return null; }; LLRBEmptyNode.prototype.isRed = function () { return false; }; // For testing. LLRBEmptyNode.prototype.checkMaxDepth = function () { return true; }; LLRBEmptyNode.prototype.check = function () { return 0; }; return LLRBEmptyNode; }()); // end LLRBEmptyNode LLRBNode.EMPTY = new LLRBEmptyNode(); /** * Copyright 2017 Google Inc. * * 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. */ var TypeOrder; (function (TypeOrder) { // This order is defined by the backend. TypeOrder[TypeOrder["NullValue"] = 0] = "NullValue"; TypeOrder[TypeOrder["BooleanValue"] = 1] = "BooleanValue"; TypeOrder[TypeOrder["NumberValue"] = 2] = "NumberValue"; TypeOrder[TypeOrder["TimestampValue"] = 3] = "TimestampValue"; TypeOrder[TypeOrder["StringValue"] = 4] = "StringValue"; TypeOrder[TypeOrder["BlobValue"] = 5] = "BlobValue"; TypeOrder[TypeOrder["RefValue"] = 6] = "RefValue"; TypeOrder[TypeOrder["GeoPointValue"] = 7] = "GeoPointValue"; TypeOrder[TypeOrder["ArrayValue"] = 8] = "ArrayValue"; TypeOrder[TypeOrder["ObjectValue"] = 9] = "ObjectValue"; })(TypeOrder || (TypeOrder = {})); /** Defines the return value for pending server timestamps. */ var ServerTimestampBehavior; (function (ServerTimestampBehavior) { ServerTimestampBehavior[ServerTimestampBehavior["Default"] = 0] = "Default"; ServerTimestampBehavior[ServerTimestampBehavior["Estimate"] = 1] = "Estimate"; ServerTimestampBehavior[ServerTimestampBehavior["Previous"] = 2] = "Previous"; })(ServerTimestampBehavior || (ServerTimestampBehavior = {})); /** Holds properties that define field value deserialization options. */ var FieldValueOptions = /** @class */ (function () { function FieldValueOptions(serverTimestampBehavior, timestampsInSnapshots) { this.serverTimestampBehavior = serverTimestampBehavior; this.timestampsInSnapshots = timestampsInSnapshots; } FieldValueOptions.fromSnapshotOptions = function (options, timestampsInSnapshots) { switch (options.serverTimestamps) { case 'estimate': return new FieldValueOptions(ServerTimestampBehavior.Estimate, timestampsInSnapshots); case 'previous': return new FieldValueOptions(ServerTimestampBehavior.Previous, timestampsInSnapshots); case 'none': // Fall-through intended. case undefined: return new FieldValueOptions(ServerTimestampBehavior.Default, timestampsInSnapshots); default: return fail('fromSnapshotOptions() called with invalid options.'); } }; return FieldValueOptions; }()); /** * A field value represents a datatype as stored by Firestore. */ var FieldValue = /** @class */ (function () { function FieldValue() { } FieldValue.prototype.toString = function () { var val = this.value(); return val === null ? 'null' : val.toString(); }; FieldValue.prototype.defaultCompareTo = function (other) { assert(this.typeOrder !== other.typeOrder, 'Default compareTo should not be used for values of same type.'); var cmp = primitiveComparator(this.typeOrder, other.typeOrder); return cmp; }; return FieldValue; }()); var NullValue = /** @class */ (function (_super) { tslib_1.__extends(NullValue, _super); function NullValue() { var _this = _super.call(this) || this; _this.typeOrder = TypeOrder.NullValue; // internalValue is unused but we add it to work around // https://github.com/Microsoft/TypeScript/issues/15585 _this.internalValue = null; return _this; } NullValue.prototype.value = function (options) { return null; }; NullValue.prototype.isEqual = function (other) { return other instanceof NullValue; }; NullValue.prototype.compareTo = function (other) { if (other instanceof NullValue) { return 0; } return this.defaultCompareTo(other); }; NullValue.INSTANCE = new NullValue(); return NullValue; }(FieldValue)); var BooleanValue = /** @class */ (function (_super) { tslib_1.__extends(BooleanValue, _super); function BooleanValue(internalValue) { var _this = _super.call(this) || this; _this.internalValue = internalValue; _this.typeOrder = TypeOrder.BooleanValue; return _this; } BooleanValue.prototype.value = function (options) { return this.internalValue; }; BooleanValue.prototype.isEqual = function (other) { return (other instanceof BooleanValue && this.internalValue === other.internalValue); }; BooleanValue.prototype.compareTo = function (other) { if (other instanceof BooleanValue) { return primitiveComparator(this, other); } return this.defaultCompareTo(other); }; BooleanValue.of = function (value) { return value ? BooleanValue.TRUE : BooleanValue.FALSE; }; BooleanValue.TRUE = new BooleanValue(true); BooleanValue.FALSE = new BooleanValue(false); return BooleanValue; }(FieldValue)); /** Base class for IntegerValue and DoubleValue. */ var NumberValue = /** @class */ (function (_super) { tslib_1.__extends(NumberValue, _super); function NumberValue(internalValue) { var _this = _super.call(this) || this; _this.internalValue = internalValue; _this.typeOrder = TypeOrder.NumberValue; return _this; } NumberValue.prototype.value = function (options) { return this.internalValue; }; NumberValue.prototype.compareTo = function (other) { if (other instanceof NumberValue) { return numericComparator(this.internalValue, other.internalValue); } return this.defaultCompareTo(other); }; return NumberValue; }(FieldValue)); /** Utility function to compare doubles (using Firestore semantics for NaN). */ function numericComparator(left, right) { if (left < right) { return -1; } else if (left > right) { return 1; } else if (left === right) { return 0; } else { // one or both are NaN. if (isNaN(left)) { return isNaN(right) ? 0 : -1; } else { return 1; } } } /** * Utility function to check numbers for equality using Firestore semantics * (NaN === NaN, -0.0 !== 0.0). */ function numericEquals(left, right) { // Implemented based on Object.is() polyfill from // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is if (left === right) { // +0 != -0 return left !== 0 || 1 / left === 1 / right; } else { // NaN == NaN return left !== left && right !== right; } } var IntegerValue = /** @class */ (function (_super) { tslib_1.__extends(IntegerValue, _super); function IntegerValue(internalValue) { return _super.call(this, internalValue) || this; } IntegerValue.prototype.isEqual = function (other) { // NOTE: DoubleValue and IntegerValue instances may compareTo() the same, // but that doesn't make them equal via isEqual(). if (other instanceof IntegerValue) { return numericEquals(this.internalValue, other.internalValue); } else { return false; } }; return IntegerValue; }(NumberValue)); var DoubleValue = /** @class */ (function (_super) { tslib_1.__extends(DoubleValue, _super); function DoubleValue(internalValue) { var _this = _super.call(this, internalValue) || this; _this.internalValue = internalValue; return _this; } DoubleValue.prototype.isEqual = function (other) { // NOTE: DoubleValue and IntegerValue instances may compareTo() the same, // but that doesn't make them equal via isEqual(). if (other instanceof DoubleValue) { return numericEquals(this.internalValue, other.internalValue); } else { return false; } }; DoubleValue.NAN = new DoubleValue(NaN); DoubleValue.POSITIVE_INFINITY = new DoubleValue(Infinity); DoubleValue.NEGATIVE_INFINITY = new DoubleValue(-Infinity); return DoubleValue; }(NumberValue)); // TODO(b/37267885): Add truncation support var StringValue = /** @class */ (function (_super) { tslib_1.__extends(StringValue, _super); function StringValue(internalValue) { var _this = _super.call(this) || this; _this.internalValue = internalValue; _this.typeOrder = TypeOrder.StringValue; return _this; } StringValue.prototype.value = function (options) { return this.internalValue; }; StringValue.prototype.isEqual = function (other) { return (other instanceof StringValue && this.internalValue === other.internalValue); }; StringValue.prototype.compareTo = function (other) { if (other instanceof StringValue) { return primitiveComparator(this.internalValue, other.internalValue); } return this.defaultCompareTo(other); }; return StringValue; }(FieldValue)); var TimestampValue = /** @class */ (function (_super) { tslib_1.__extends(TimestampValue, _super); function TimestampValue(internalValue) { var _this = _super.call(this) || this; _this.internalValue = internalValue; _this.typeOrder = TypeOrder.TimestampValue; return _this; } TimestampValue.prototype.value = function (options) { if (options && options.timestampsInSnapshots) { return this.internalValue; } else { return this.internalValue.toDate(); } }; TimestampValue.prototype.isEqual = function (other) { return (other instanceof TimestampValue && this.internalValue.isEqual(other.internalValue)); }; TimestampValue.prototype.compareTo = function (other) { if (other instanceof TimestampValue) { return this.internalValue._compareTo(other.internalValue); } else if (other instanceof ServerTimestampValue) { // Concrete timestamps come before server timestamps. return -1; } else { return this.defaultCompareTo(other); } }; return TimestampValue; }(FieldValue)); /** * Represents a locally-applied ServerTimestamp. * * Notes: * - ServerTimestampValue instances are created as the result of applying a * TransformMutation (see TransformMutation.applyTo()). They can only exist in * the local view of a document. Therefore they do not need to be parsed or * serialized. * - When evaluated locally (e.g. for snapshot.data()), they by default * evaluate to `null`. This behavior can be configured by passing custom * FieldValueOptions to value(). * - With respect to other ServerTimestampValues, they sort by their * localWriteTime. */ var ServerTimestampValue = /** @class */ (function (_super) { tslib_1.__extends(ServerTimestampValue, _super); function ServerTimestampValue(localWriteTime, previousValue) { var _this = _super.call(this) || this; _this.localWriteTime = localWriteTime; _this.previousValue = previousValue; _this.typeOrder = TypeOrder.TimestampValue; return _this; } ServerTimestampValue.prototype.value = function (options) { if (options && options.serverTimestampBehavior === ServerTimestampBehavior.Estimate) { return new TimestampValue(this.localWriteTime).value(options); } else if (options && options.serverTimestampBehavior === ServerTimestampBehavior.Previous) { return this.previousValue ? this.previousValue.value(options) : null; } else { return null; } }; ServerTimestampValue.prototype.isEqual = function (other) { return (other instanceof ServerTimestampValue && this.localWriteTime.isEqual(other.localWriteTime)); }; ServerTimestampValue.prototype.compareTo = function (other) { if (other instanceof ServerTimestampValue) { return this.localWriteTime._compareTo(other.localWriteTime); } else if (other instanceof TimestampValue) { // Server timestamps come after all concrete timestamps. return 1; } else { return this.defaultCompareTo(other); } }; ServerTimestampValue.prototype.toString = function () { return ''; }; return ServerTimestampValue; }(FieldValue)); var BlobValue = /** @class */ (function (_super) { tslib_1.__extends(BlobValue, _super); function BlobValue(internalValue) { var _this = _super.call(this) || this; _this.internalValue = internalValue; _this.typeOrder = TypeOrder.BlobValue; return _this; } BlobValue.prototype.value = function (options) { return this.internalValue; }; BlobValue.prototype.isEqual = function (other) { return (other instanceof BlobValue && this.internalValue.isEqual(other.internalValue)); }; BlobValue.prototype.compareTo = function (other) { if (other instanceof BlobValue) { return this.internalValue._compareTo(other.internalValue); } return this.defaultCompareTo(other); }; return BlobValue; }(FieldValue)); var RefValue = /** @class */ (function (_super) { tslib_1.__extends(RefValue, _super); function RefValue(databaseId, key) { var _this = _super.call(this) || this; _this.databaseId = databaseId; _this.key = key; _this.typeOrder = TypeOrder.RefValue; return _this; } RefValue.prototype.value = function (options) { return this.key; }; RefValue.prototype.isEqual = function (other) { if (other instanceof RefValue) { return (this.key.isEqual(other.key) && this.databaseId.isEqual(other.databaseId)); } else { return false; } }; RefValue.prototype.compareTo = function (other) { if (other instanceof RefValue) { var cmp = this.databaseId.compareTo(other.databaseId); return cmp !== 0 ? cmp : DocumentKey.comparator(this.key, other.key); } return this.defaultCompareTo(other); }; return RefValue; }(FieldValue)); var GeoPointValue = /** @class */ (function (_super) { tslib_1.__extends(GeoPointValue, _super); function GeoPointValue(internalValue) { var _this = _super.call(this) || this; _this.internalValue = internalValue; _this.typeOrder = TypeOrder.GeoPointValue; return _this; } GeoPointValue.prototype.value = function (options) { return this.internalValue; }; GeoPointValue.prototype.isEqual = function (other) { return (other instanceof GeoPointValue && this.internalValue.isEqual(other.internalValue)); }; GeoPointValue.prototype.compareTo = function (other) { if (other instanceof GeoPointValue) { return this.internalValue._compareTo(other.internalValue); } return this.defaultCompareTo(other); }; return GeoPointValue; }(FieldValue)); var ObjectValue = /** @class */ (function (_super) { tslib_1.__extends(ObjectValue, _super); function ObjectValue(internalValue) { var _this = _super.call(this) || this; _this.internalValue = internalValue; _this.typeOrder = TypeOrder.ObjectValue; return _this; } ObjectValue.prototype.value = function (options) { var result = {}; this.internalValue.inorderTraversal(function (key, val) { result[key] = val.value(options); }); return result; }; ObjectValue.prototype.forEach = function (action) { this.internalValue.inorderTraversal(action); }; ObjectValue.prototype.isEqual = function (other) { if (other instanceof ObjectValue) { var it1 = this.internalValue.getIterator(); var it2 = other.internalValue.getIterator(); while (it1.hasNext() && it2.hasNext()) { var next1 = it1.getNext(); var next2 = it2.getNext(); if (next1.key !== next2.key || !next1.value.isEqual(next2.value)) { return false; } } return !it1.hasNext() && !it2.hasNext(); } return false; }; ObjectValue.prototype.compareTo = function (other) { if (other instanceof ObjectValue) { var it1 = this.internalValue.getIterator(); var it2 = other.internalValue.getIterator(); while (it1.hasNext() && it2.hasNext()) { var next1 = it1.getNext(); var next2 = it2.getNext(); var cmp = primitiveComparator(next1.key, next2.key) || next1.value.compareTo(next2.value); if (cmp) { return cmp; } } // Only equal if both iterators are exhausted return primitiveComparator(it1.hasNext(), it2.hasNext()); } else { return this.defaultCompareTo(other); } }; ObjectValue.prototype.set = function (path, to) { assert(!path.isEmpty(), 'Cannot set field for empty path on ObjectValue'); if (path.length === 1) { return this.setChild(path.firstSegment(), to); } else { var child = this.child(path.firstSegment()); if (!(child instanceof ObjectValue)) { child = ObjectValue.EMPTY; } var newChild = child.set(path.popFirst(), to); return this.setChild(path.firstSegment(), newChild); } }; ObjectValue.prototype.delete = function (path) { assert(!path.isEmpty(), 'Cannot delete field for empty path on ObjectValue'); if (path.length === 1) { return new ObjectValue(this.internalValue.remove(path.firstSegment())); } else { // nested field var child = this.child(path.firstSegment()); if (child instanceof ObjectValue) { var newChild = child.delete(path.popFirst()); return new ObjectValue(this.internalValue.insert(path.firstSegment(), newChild)); } else { // Don't actually change a primitive value to an object for a delete return this; } } }; ObjectValue.prototype.contains = function (path) { return this.field(path) !== undefined; }; ObjectValue.prototype.field = function (path) { assert(!path.isEmpty(), "Can't get field of empty path"); var field = this; path.forEach(function (pathSegment) { if (field instanceof ObjectValue) { field = field.internalValue.get(pathSegment) || undefined; } else { field = undefined; } }); return field; }; ObjectValue.prototype.toString = function () { return JSON.stringify(this.value()); }; ObjectValue.prototype.child = function (childName) { return this.internalValue.get(childName) || undefined; }; ObjectValue.prototype.setChild = function (childName, value) { return new ObjectValue(this.internalValue.insert(childName, value)); }; ObjectValue.EMPTY = new ObjectValue(new SortedMap(primitiveComparator)); return ObjectValue; }(FieldValue)); var ArrayValue = /** @class */ (function (_super) { tslib_1.__extends(ArrayValue, _super); function ArrayValue(internalValue) { var _this = _super.call(this) || this; _this.internalValue = internalValue; _this.typeOrder = TypeOrder.ArrayValue; return _this; } ArrayValue.prototype.value = function (options) { return this.internalValue.map(function (v) { return v.value(options); }); }; ArrayValue.prototype.forEach = function (action) { this.internalValue.forEach(action); }; ArrayValue.prototype.isEqual = function (other) { if (other instanceof ArrayValue) { if (this.internalValue.length !== other.internalValue.length) { return false; } for (var i = 0; i < this.internalValue.length; i++) { if (!this.internalValue[i].isEqual(other.internalValue[i])) { return false; } } return true; } return false; }; ArrayValue.prototype.compareTo = function (other) { if (other instanceof ArrayValue) { var minLength = Math.min(this.internalValue.length, other.internalValue.length); for (var i = 0; i < minLength; i++) { var cmp = this.internalValue[i].compareTo(other.internalValue[i]); if (cmp) { return cmp; } } return primitiveComparator(this.internalValue.length, other.internalValue.length); } else { return this.defaultCompareTo(other); } }; ArrayValue.prototype.toString = function () { return JSON.stringify(this.value()); }; return ArrayValue; }(FieldValue)); /** * Copyright 2017 Google Inc. * * 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. */ // Untyped Number alias we can use to check for ES6 methods / properties. // tslint:disable-next-line:no-any variable-name var NumberAsAny = Number; /** * Minimum safe integer in Javascript because of floating point precision. * Added to not rely on ES6 features. */ var MIN_SAFE_INTEGER = NumberAsAny.MIN_SAFE_INTEGER || -(Math.pow(2, 53) - 1); /** * Maximum safe integer in Javascript because of floating point precision. * Added to not rely on ES6 features. */ var MAX_SAFE_INTEGER = NumberAsAny.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; /** * Returns whether an number is an integer, uses native implementation if * available. * Added to not rely on ES6 features. * @param value The value to test for being an integer */ var isInteger = NumberAsAny.isInteger || (function (value) { return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; }); /** * Returns whether a variable is either undefined or null. */ function isNullOrUndefined(value) { return value === null || value === undefined; } /** * Returns whether a value is an integer and in the safe integer range * @param value The value to test for being an integer and in the safe range */ function isSafeInteger(value) { return (isInteger(value) && value <= MAX_SAFE_INTEGER && value >= MIN_SAFE_INTEGER); } /** * Copyright 2017 Google Inc. * * 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. */ var Query = /** @class */ (function () { function Query(path, explicitOrderBy, filters, limit, startAt, endAt) { if (explicitOrderBy === void 0) { explicitOrderBy = []; } if (filters === void 0) { filters = []; } if (limit === void 0) { limit = null; } if (startAt === void 0) { startAt = null; } if (endAt === void 0) { endAt = null; } this.path = path; this.explicitOrderBy = explicitOrderBy; this.filters = filters; this.limit = limit; this.startAt = startAt; this.endAt = endAt; this.memoizedCanonicalId = null; this.memoizedOrderBy = null; if (this.startAt) { this.assertValidBound(this.startAt); } if (this.endAt) { this.assertValidBound(this.endAt); } } Query.atPath = function (path) { return new Query(path); }; Object.defineProperty(Query.prototype, "orderBy", { get: function () { if (this.memoizedOrderBy === null) { var inequalityField = this.getInequalityFilterField(); var firstOrderByField = this.getFirstOrderByField(); if (inequalityField !== null && firstOrderByField === null) { // In order to implicitly add key ordering, we must also add the // inequality filter field for it to be a valid query. // Note that the default inequality field and key ordering is ascending. if (inequalityField.isKeyField()) { this.memoizedOrderBy = [KEY_ORDERING_ASC]; } else { this.memoizedOrderBy = [ new OrderBy(inequalityField), KEY_ORDERING_ASC ]; } } else { assert(inequalityField === null || (firstOrderByField !== null && inequalityField.isEqual(firstOrderByField)), 'First orderBy should match inequality field.'); this.memoizedOrderBy = []; var foundKeyOrdering = false; for (var _i = 0, _a = this.explicitOrderBy; _i < _a.length; _i++) { var orderBy = _a[_i]; this.memoizedOrderBy.push(orderBy); if (orderBy.field.isKeyField()) { foundKeyOrdering = true; } } if (!foundKeyOrdering) { // The order of the implicit key ordering always matches the last // explicit order by var lastDirection = this.explicitOrderBy.length > 0 ? this.explicitOrderBy[this.explicitOrderBy.length - 1].dir : Direction.ASCENDING; this.memoizedOrderBy.push(lastDirection === Direction.ASCENDING ? KEY_ORDERING_ASC : KEY_ORDERING_DESC); } } } return this.memoizedOrderBy; }, enumerable: true, configurable: true }); Query.prototype.addFilter = function (filter) { assert(this.getInequalityFilterField() == null || !(filter instanceof RelationFilter) || !filter.isInequality() || filter.field.isEqual(this.getInequalityFilterField()), 'Query must only have one inequality field.'); assert(!DocumentKey.isDocumentKey(this.path), 'No filtering allowed for document query'); var newFilters = this.filters.concat([filter]); return new Query(this.path, this.explicitOrderBy.slice(), newFilters, this.limit, this.startAt, this.endAt); }; Query.prototype.addOrderBy = function (orderBy) { assert(!DocumentKey.isDocumentKey(this.path), 'No ordering allowed for document query'); assert(!this.startAt && !this.endAt, 'Bounds must be set after orderBy'); // TODO(dimond): validate that orderBy does not list the same key twice. var newOrderBy = this.explicitOrderBy.concat([orderBy]); return new Query(this.path, newOrderBy, this.filters.slice(), this.limit, this.startAt, this.endAt); }; Query.prototype.withLimit = function (limit) { return new Query(this.path, this.explicitOrderBy.slice(), this.filters.slice(), limit, this.startAt, this.endAt); }; Query.prototype.withStartAt = function (bound) { return new Query(this.path, this.explicitOrderBy.slice(), this.filters.slice(), this.limit, bound, this.endAt); }; Query.prototype.withEndAt = function (bound) { return new Query(this.path, this.explicitOrderBy.slice(), this.filters.slice(), this.limit, this.startAt, bound); }; // TODO(b/29183165): This is used to get a unique string from a query to, for // example, use as a dictionary key, but the implementation is subject to // collisions. Make it collision-free. Query.prototype.canonicalId = function () { if (this.memoizedCanonicalId === null) { var canonicalId = this.path.canonicalString(); canonicalId += '|f:'; for (var _i = 0, _a = this.filters; _i < _a.length; _i++) { var filter = _a[_i]; canonicalId += filter.canonicalId(); canonicalId += ','; } canonicalId += '|ob:'; // TODO(dimond): make this collision resistant for (var _b = 0, _c = this.orderBy; _b < _c.length; _b++) { var orderBy = _c[_b]; canonicalId += orderBy.canonicalId(); canonicalId += ','; } if (!isNullOrUndefined(this.limit)) { canonicalId += '|l:'; canonicalId += this.limit; } if (this.startAt) { canonicalId += '|lb:'; canonicalId += this.startAt.canonicalId(); } if (this.endAt) { canonicalId += '|ub:'; canonicalId += this.endAt.canonicalId(); } this.memoizedCanonicalId = canonicalId; } return this.memoizedCanonicalId; }; Query.prototype.toString = function () { var str = 'Query(' + this.path.canonicalString(); if (this.filters.length > 0) { str += ", filters: [" + this.filters.join(', ') + "]"; } if (!isNullOrUndefined(this.limit)) { str += ', limit: ' + this.limit; } if (this.explicitOrderBy.length > 0) { str += ", orderBy: [" + this.explicitOrderBy.join(', ') + "]"; } if (this.startAt) { str += ', startAt: ' + this.startAt.canonicalId(); } if (this.endAt) { str += ', endAt: ' + this.endAt.canonicalId(); } return str + ')'; }; Query.prototype.isEqual = function (other) { if (this.limit !== other.limit) { return false; } if (this.orderBy.length !== other.orderBy.length) { return false; } for (var i = 0; i < this.orderBy.length; i++) { if (!this.orderBy[i].isEqual(other.orderBy[i])) { return false; } } if (this.filters.length !== other.filters.length) { return false; } for (var i = 0; i < this.filters.length; i++) { if (!this.filters[i].isEqual(other.filters[i])) { return false; } } if (!this.path.isEqual(other.path)) { return false; } if (this.startAt !== null ? !this.startAt.isEqual(other.startAt) : other.startAt !== null) { return false; } return this.endAt !== null ? this.endAt.isEqual(other.endAt) : other.endAt === null; }; Query.prototype.docComparator = function (d1, d2) { var comparedOnKeyField = false; for (var _i = 0, _a = this.orderBy; _i < _a.length; _i++) { var orderBy = _a[_i]; var comp = orderBy.compare(d1, d2); if (comp !== 0) return comp; comparedOnKeyField = comparedOnKeyField || orderBy.field.isKeyField(); } // Assert that we actually compared by key assert(comparedOnKeyField, "orderBy used that doesn't compare on key field"); return 0; }; Query.prototype.matches = function (doc) { return (this.matchesAncestor(doc) && this.matchesOrderBy(doc) && this.matchesFilters(doc) && this.matchesBounds(doc)); }; Query.prototype.hasLimit = function () { return !isNullOrUndefined(this.limit); }; Query.prototype.getFirstOrderByField = function () { return this.explicitOrderBy.length > 0 ? this.explicitOrderBy[0].field : null; }; Query.prototype.getInequalityFilterField = function () { for (var _i = 0, _a = this.filters; _i < _a.length; _i++) { var filter = _a[_i]; if (filter instanceof RelationFilter && filter.isInequality()) { return filter.field; } } return null; }; Query.prototype.hasArrayContainsFilter = function () { return (this.filters.find(function (filter) { return filter instanceof RelationFilter && filter.op === RelationOp.ARRAY_CONTAINS; }) !== undefined); }; Query.prototype.isDocumentQuery = function () { return DocumentKey.isDocumentKey(this.path) && this.filters.length === 0; }; Query.prototype.matchesAncestor = function (doc) { var docPath = doc.key.path; if (DocumentKey.isDocumentKey(this.path)) { // exact match for document queries return this.path.isEqual(docPath); } else { // shallow ancestor queries by default return (this.path.isPrefixOf(docPath) && this.path.length === docPath.length - 1); } }; /** * A document must have a value for every ordering clause in order to show up * in the results. */ Query.prototype.matchesOrderBy = function (doc) { for (var _i = 0, _a = this.explicitOrderBy; _i < _a.length; _i++) { var orderBy = _a[_i]; // order by key always matches if (!orderBy.field.isKeyField() && doc.field(orderBy.field) === undefined) { return false; } } return true; }; Query.prototype.matchesFilters = function (doc) { for (var _i = 0, _a = this.filters; _i < _a.length; _i++) { var filter = _a[_i]; if (!filter.matches(doc)) { return false; } } return true; }; /** * Makes sure a document is within the bounds, if provided. */ Query.prototype.matchesBounds = function (doc) { if (this.startAt && !this.startAt.sortsBeforeDocument(this.orderBy, doc)) { return false; } if (this.endAt && this.endAt.sortsBeforeDocument(this.orderBy, doc)) { return false; } return true; }; Query.prototype.assertValidBound = function (bound) { assert(bound.position.length <= this.orderBy.length, 'Bound is longer than orderBy'); }; return Query; }()); var Filter = /** @class */ (function () { function Filter() { } /** * Creates a filter based on the provided arguments. */ Filter.create = function (field, op, value) { if (value.isEqual(NullValue.INSTANCE)) { if (op !== RelationOp.EQUAL) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid query. You can only perform equals comparisons on null.'); } return new NullFilter(field); } else if (value.isEqual(DoubleValue.NAN)) { if (op !== RelationOp.EQUAL) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid query. You can only perform equals comparisons on NaN.'); } return new NanFilter(field); } else { return new RelationFilter(field, op, value); } }; return Filter; }()); var RelationOp = /** @class */ (function () { function RelationOp(name) { this.name = name; } RelationOp.fromString = function (op) { switch (op) { case '<': return RelationOp.LESS_THAN; case '<=': return RelationOp.LESS_THAN_OR_EQUAL; case '==': return RelationOp.EQUAL; case '>=': return RelationOp.GREATER_THAN_OR_EQUAL; case '>': return RelationOp.GREATER_THAN; case 'array-contains': return RelationOp.ARRAY_CONTAINS; default: return fail('Unknown relation: ' + op); } }; RelationOp.prototype.toString = function () { return this.name; }; RelationOp.prototype.isEqual = function (other) { return this.name === other.name; }; RelationOp.LESS_THAN = new RelationOp('<'); RelationOp.LESS_THAN_OR_EQUAL = new RelationOp('<='); RelationOp.EQUAL = new RelationOp('=='); RelationOp.GREATER_THAN = new RelationOp('>'); RelationOp.GREATER_THAN_OR_EQUAL = new RelationOp('>='); RelationOp.ARRAY_CONTAINS = new RelationOp('array-contains'); return RelationOp; }()); var RelationFilter = /** @class */ (function (_super) { tslib_1.__extends(RelationFilter, _super); function RelationFilter(field, op, value) { var _this = _super.call(this) || this; _this.field = field; _this.op = op; _this.value = value; return _this; } RelationFilter.prototype.matches = function (doc) { if (this.field.isKeyField()) { assert(this.value instanceof RefValue, 'Comparing on key, but filter value not a RefValue'); assert(this.op !== RelationOp.ARRAY_CONTAINS, "array-contains queries don't make sense on document keys."); var refValue = this.value; var comparison = DocumentKey.comparator(doc.key, refValue.key); return this.matchesComparison(comparison); } else { var val = doc.field(this.field); return val !== undefined && this.matchesValue(val); } }; RelationFilter.prototype.matchesValue = function (value) { var _this = this; if (this.op === RelationOp.ARRAY_CONTAINS) { return (value instanceof ArrayValue && value.internalValue.find(function (element) { return element.isEqual(_this.value); }) !== undefined); } else { // Only compare types with matching backend order (such as double and int). return (this.value.typeOrder === value.typeOrder && this.matchesComparison(value.compareTo(this.value))); } }; RelationFilter.prototype.matchesComparison = function (comparison) { switch (this.op) { case RelationOp.LESS_THAN: return comparison < 0; case RelationOp.LESS_THAN_OR_EQUAL: return comparison <= 0; case RelationOp.EQUAL: return comparison === 0; case RelationOp.GREATER_THAN: return comparison > 0; case RelationOp.GREATER_THAN_OR_EQUAL: return comparison >= 0; default: return fail('Unknown relation op' + this.op); } }; RelationFilter.prototype.isInequality = function () { return (this.op !== RelationOp.EQUAL && this.op !== RelationOp.ARRAY_CONTAINS); }; RelationFilter.prototype.canonicalId = function () { // TODO(b/29183165): Technically, this won't be unique if two values have // the same description, such as the int 3 and the string "3". So we should // add the types in here somehow, too. return (this.field.canonicalString() + this.op.toString() + this.value.toString()); }; RelationFilter.prototype.isEqual = function (other) { if (other instanceof RelationFilter) { return (this.op.isEqual(other.op) && this.field.isEqual(other.field) && this.value.isEqual(other.value)); } else { return false; } }; RelationFilter.prototype.toString = function () { return this.field.canonicalString() + " " + this.op + " " + this.value.value(); }; return RelationFilter; }(Filter)); /** * Filter that matches 'null' values. */ var NullFilter = /** @class */ (function (_super) { tslib_1.__extends(NullFilter, _super); function NullFilter(field) { var _this = _super.call(this) || this; _this.field = field; return _this; } NullFilter.prototype.matches = function (doc) { var val = doc.field(this.field); return val !== undefined && val.value() === null; }; NullFilter.prototype.canonicalId = function () { return this.field.canonicalString() + ' IS null'; }; NullFilter.prototype.toString = function () { return this.field.canonicalString() + " IS null"; }; NullFilter.prototype.isEqual = function (other) { if (other instanceof NullFilter) { return this.field.isEqual(other.field); } else { return false; } }; return NullFilter; }(Filter)); /** * Filter that matches 'NaN' values. */ var NanFilter = /** @class */ (function (_super) { tslib_1.__extends(NanFilter, _super); function NanFilter(field) { var _this = _super.call(this) || this; _this.field = field; return _this; } NanFilter.prototype.matches = function (doc) { var field = doc.field(this.field); var val = field && field.value(); return typeof val === 'number' && isNaN(val); }; NanFilter.prototype.canonicalId = function () { return this.field.canonicalString() + ' IS NaN'; }; NanFilter.prototype.toString = function () { return this.field.canonicalString() + " IS NaN"; }; NanFilter.prototype.isEqual = function (other) { if (other instanceof NanFilter) { return this.field.isEqual(other.field); } else { return false; } }; return NanFilter; }(Filter)); /** * The direction of sorting in an order by. */ var Direction = /** @class */ (function () { function Direction(name) { this.name = name; } Direction.prototype.toString = function () { return this.name; }; Direction.ASCENDING = new Direction('asc'); Direction.DESCENDING = new Direction('desc'); return Direction; }()); /** * Represents a bound of a query. * * The bound is specified with the given components representing a position and * whether it's just before or just after the position (relative to whatever the * query order is). * * The position represents a logical index position for a query. It's a prefix * of values for the (potentially implicit) order by clauses of a query. * * Bound provides a function to determine whether a document comes before or * after a bound. This is influenced by whether the position is just before or * just after the provided values. */ var Bound = /** @class */ (function () { function Bound(position, before) { this.position = position; this.before = before; } Bound.prototype.canonicalId = function () { // TODO(b/29183165): Make this collision robust. var canonicalId = this.before ? 'b:' : 'a:'; for (var _i = 0, _a = this.position; _i < _a.length; _i++) { var component = _a[_i]; canonicalId += component.toString(); } return canonicalId; }; /** * Returns true if a document sorts before a bound using the provided sort * order. */ Bound.prototype.sortsBeforeDocument = function (orderBy, doc) { assert(this.position.length <= orderBy.length, "Bound has more components than query's orderBy"); var comparison = 0; for (var i = 0; i < this.position.length; i++) { var orderByComponent = orderBy[i]; var component = this.position[i]; if (orderByComponent.field.isKeyField()) { assert(component instanceof RefValue, 'Bound has a non-key value where the key path is being used.'); comparison = DocumentKey.comparator(component.key, doc.key); } else { var docValue = doc.field(orderByComponent.field); assert(docValue !== undefined, 'Field should exist since document matched the orderBy already.'); comparison = component.compareTo(docValue); } if (orderByComponent.dir === Direction.DESCENDING) { comparison = comparison * -1; } if (comparison !== 0) { break; } } return this.before ? comparison <= 0 : comparison < 0; }; Bound.prototype.isEqual = function (other) { if (other === null) { return false; } if (this.before !== other.before || this.position.length !== other.position.length) { return false; } for (var i = 0; i < this.position.length; i++) { var thisPosition = this.position[i]; var otherPosition = other.position[i]; return thisPosition.isEqual(otherPosition); } return true; }; return Bound; }()); /** * An ordering on a field, in some Direction. Direction defaults to ASCENDING. */ var OrderBy = /** @class */ (function () { function OrderBy(field, dir) { this.field = field; if (dir === undefined) { dir = Direction.ASCENDING; } this.dir = dir; this.isKeyOrderBy = field.isKeyField(); } OrderBy.prototype.compare = function (d1, d2) { var comparison = this.isKeyOrderBy ? Document.compareByKey(d1, d2) : Document.compareByField(this.field, d1, d2); switch (this.dir) { case Direction.ASCENDING: return comparison; case Direction.DESCENDING: return -1 * comparison; default: return fail('Unknown direction: ' + this.dir); } }; OrderBy.prototype.canonicalId = function () { // TODO(b/29183165): Make this collision robust. return this.field.canonicalString() + this.dir.toString(); }; OrderBy.prototype.toString = function () { return this.field.canonicalString() + " (" + this.dir + ")"; }; OrderBy.prototype.isEqual = function (other) { return this.dir === other.dir && this.field.isEqual(other.field); }; return OrderBy; }()); var KEY_ORDERING_ASC = new OrderBy(FieldPath.keyField(), Direction.ASCENDING); var KEY_ORDERING_DESC = new OrderBy(FieldPath.keyField(), Direction.DESCENDING); /** * Copyright 2017 Google Inc. * * 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. */ /** * A version of a document in Firestore. This corresponds to the version * timestamp, such as update_time or read_time. */ var SnapshotVersion = /** @class */ (function () { function SnapshotVersion(timestamp) { this.timestamp = timestamp; } // TODO(b/34176344): Once we no longer need to use the old alpha protos, // delete this constructor and use a timestamp-backed version everywhere. SnapshotVersion.fromMicroseconds = function (value) { var seconds = Math.floor(value / 1e6); var nanos = (value % 1e6) * 1e3; return new SnapshotVersion(new Timestamp(seconds, nanos)); }; SnapshotVersion.fromTimestamp = function (value) { return new SnapshotVersion(value); }; SnapshotVersion.forDeletedDoc = function () { return SnapshotVersion.MIN; }; SnapshotVersion.prototype.compareTo = function (other) { return this.timestamp._compareTo(other.timestamp); }; SnapshotVersion.prototype.isEqual = function (other) { return this.timestamp.isEqual(other.timestamp); }; /** Returns a number representation of the version for use in spec tests. */ SnapshotVersion.prototype.toMicroseconds = function () { // Convert to microseconds. return this.timestamp.seconds * 1e6 + this.timestamp.nanoseconds / 1000; }; SnapshotVersion.prototype.toString = function () { return 'SnapshotVersion(' + this.timestamp.toString() + ')'; }; SnapshotVersion.prototype.toTimestamp = function () { return this.timestamp; }; SnapshotVersion.MIN = new SnapshotVersion(new Timestamp(0, 0)); return SnapshotVersion; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** An enumeration of the different purposes we have for queries. */ var QueryPurpose; (function (QueryPurpose) { /** A regular, normal query. */ QueryPurpose[QueryPurpose["Listen"] = 0] = "Listen"; /** * The query was used to refill a query after an existence filter mismatch. */ QueryPurpose[QueryPurpose["ExistenceFilterMismatch"] = 1] = "ExistenceFilterMismatch"; /** The query was used to resolve a limbo document. */ QueryPurpose[QueryPurpose["LimboResolution"] = 2] = "LimboResolution"; })(QueryPurpose || (QueryPurpose = {})); /** * An immutable set of metadata that the local store tracks for each query. */ var QueryData = /** @class */ (function () { function QueryData( /** The query being listened to. */ query, /** * The target ID to which the query corresponds; Assigned by the * LocalStore for user listens and by the SyncEngine for limbo watches. */ targetId, /** The purpose of the query. */ purpose, /** The sequence number of the last transaction during which this query data was modified */ sequenceNumber, /** The latest snapshot version seen for this target. */ snapshotVersion, /** * An opaque, server-assigned token that allows watching a query to be * resumed after disconnecting without retransmitting all the data that * matches the query. The resume token essentially identifies a point in * time from which the server should resume sending results. */ resumeToken) { if (snapshotVersion === void 0) { snapshotVersion = SnapshotVersion.MIN; } if (resumeToken === void 0) { resumeToken = emptyByteString(); } this.query = query; this.targetId = targetId; this.purpose = purpose; this.sequenceNumber = sequenceNumber; this.snapshotVersion = snapshotVersion; this.resumeToken = resumeToken; } /** * Creates a new query data instance with an updated snapshot version and * resume token. */ QueryData.prototype.copy = function (overwrite) { return new QueryData(this.query, this.targetId, this.purpose, overwrite.sequenceNumber === undefined ? this.sequenceNumber : overwrite.sequenceNumber, overwrite.snapshotVersion === undefined ? this.snapshotVersion : overwrite.snapshotVersion, overwrite.resumeToken === undefined ? this.resumeToken : overwrite.resumeToken); }; QueryData.prototype.isEqual = function (other) { return (this.targetId === other.targetId && this.purpose === other.purpose && this.sequenceNumber === other.sequenceNumber && this.snapshotVersion.isEqual(other.snapshotVersion) && this.resumeToken === other.resumeToken && this.query.isEqual(other.query)); }; return QueryData; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Provides a set of fields that can be used to partially patch a document. * FieldMask is used in conjunction with ObjectValue. * Examples: * foo - Overwrites foo entirely with the provided value. If foo is not * present in the companion ObjectValue, the field is deleted. * foo.bar - Overwrites only the field bar of the object foo. * If foo is not an object, foo is replaced with an object * containing foo */ var FieldMask = /** @class */ (function () { function FieldMask(fields) { this.fields = fields; // TODO(dimond): validation of FieldMask } /** * Verifies that `fieldPath` is included by at least one field in this field * mask. * * This is an O(n) operation, where `n` is the size of the field mask. */ FieldMask.prototype.covers = function (fieldPath) { for (var _i = 0, _a = this.fields; _i < _a.length; _i++) { var fieldMaskPath = _a[_i]; if (fieldMaskPath.isPrefixOf(fieldPath)) { return true; } } return false; }; FieldMask.prototype.isEqual = function (other) { return arrayEquals(this.fields, other.fields); }; return FieldMask; }()); /** A field path and the TransformOperation to perform upon it. */ var FieldTransform = /** @class */ (function () { function FieldTransform(field, transform) { this.field = field; this.transform = transform; } FieldTransform.prototype.isEqual = function (other) { return (this.field.isEqual(other.field) && this.transform.isEqual(other.transform)); }; return FieldTransform; }()); /** The result of successfully applying a mutation to the backend. */ var MutationResult = /** @class */ (function () { function MutationResult( /** * The version at which the mutation was committed: * * - For most operations, this is the updateTime in the WriteResult. * - For deletes, the commitTime of the WriteResponse (because deletes are * not stored and have no updateTime). * * Note that these versions can be different: No-op writes will not change * the updateTime even though the commitTime advances. */ version, /** * The resulting fields returned from the backend after a * TransformMutation has been committed. Contains one FieldValue for each * FieldTransform that was in the mutation. * * Will be null if the mutation was not a TransformMutation. */ transformResults) { this.version = version; this.transformResults = transformResults; } return MutationResult; }()); var MutationType; (function (MutationType) { MutationType[MutationType["Set"] = 0] = "Set"; MutationType[MutationType["Patch"] = 1] = "Patch"; MutationType[MutationType["Transform"] = 2] = "Transform"; MutationType[MutationType["Delete"] = 3] = "Delete"; })(MutationType || (MutationType = {})); /** * Encodes a precondition for a mutation. This follows the model that the * backend accepts with the special case of an explicit "empty" precondition * (meaning no precondition). */ var Precondition = /** @class */ (function () { function Precondition(updateTime, exists) { this.updateTime = updateTime; this.exists = exists; assert(updateTime === undefined || exists === undefined, 'Precondition can specify "exists" or "updateTime" but not both'); } /** Creates a new Precondition with an exists flag. */ Precondition.exists = function (exists) { return new Precondition(undefined, exists); }; /** Creates a new Precondition based on a version a document exists at. */ Precondition.updateTime = function (version) { return new Precondition(version); }; Object.defineProperty(Precondition.prototype, "isNone", { /** Returns whether this Precondition is empty. */ get: function () { return this.updateTime === undefined && this.exists === undefined; }, enumerable: true, configurable: true }); /** * Returns true if the preconditions is valid for the given document * (or null if no document is available). */ Precondition.prototype.isValidFor = function (maybeDoc) { if (this.updateTime !== undefined) { return (maybeDoc instanceof Document && maybeDoc.version.isEqual(this.updateTime)); } else if (this.exists !== undefined) { return this.exists === maybeDoc instanceof Document; } else { assert(this.isNone, 'Precondition should be empty'); return true; } }; Precondition.prototype.isEqual = function (other) { return (equals(this.updateTime, other.updateTime) && this.exists === other.exists); }; Precondition.NONE = new Precondition(); return Precondition; }()); /** * A mutation describes a self-contained change to a document. Mutations can * create, replace, delete, and update subsets of documents. * * Mutations not only act on the value of the document but also it version. * * For local mutations (mutations that haven't been committed yet), we preserve * the existing version for Set, Patch, and Transform mutations. For Delete * mutations, we reset the version to 0. * * Here's the expected transition table. * * MUTATION APPLIED TO RESULTS IN * * SetMutation Document(v3) Document(v3) * SetMutation NoDocument(v3) Document(v0) * SetMutation null Document(v0) * PatchMutation Document(v3) Document(v3) * PatchMutation NoDocument(v3) NoDocument(v3) * PatchMutation null null * TransformMutation Document(v3) Document(v3) * TransformMutation NoDocument(v3) NoDocument(v3) * TransformMutation null null * DeleteMutation Document(v3) NoDocument(v0) * DeleteMutation NoDocument(v3) NoDocument(v0) * DeleteMutation null NoDocument(v0) * * For acknowledged mutations, we use the updateTime of the WriteResponse as * the resulting version for Set, Patch, and Transform mutations. As deletes * have no explicit update time, we use the commitTime of the WriteResponse for * Delete mutations. * * If a mutation is acknowledged by the backend but fails the precondition check * locally, we return an `UnknownDocument` and rely on Watch to send us the * updated version. * * Note that TransformMutations don't create Documents (in the case of being * applied to a NoDocument), even though they would on the backend. This is * because the client always combines the TransformMutation with a SetMutation * or PatchMutation and we only want to apply the transform if the prior * mutation resulted in a Document (always true for a SetMutation, but not * necessarily for a PatchMutation). * * ## Subclassing Notes * * Subclasses of Mutation need to implement applyToRemoteDocument() and * applyToLocalView() to implement the actual behavior of applying the mutation * to some source document. */ var Mutation = /** @class */ (function () { function Mutation() { } Mutation.prototype.verifyKeyMatches = function (maybeDoc) { if (maybeDoc != null) { assert(maybeDoc.key.isEqual(this.key), 'Can only apply a mutation to a document with the same key'); } }; /** * Returns the version from the given document for use as the result of a * mutation. Mutations are defined to return the version of the base document * only if it is an existing document. Deleted and unknown documents have a * post-mutation version of SnapshotVersion.MIN. */ Mutation.getPostMutationVersion = function (maybeDoc) { if (maybeDoc instanceof Document) { return maybeDoc.version; } else { return SnapshotVersion.MIN; } }; return Mutation; }()); /** * A mutation that creates or replaces the document at the given key with the * object value contents. */ var SetMutation = /** @class */ (function (_super) { tslib_1.__extends(SetMutation, _super); function SetMutation(key, value, precondition) { var _this = _super.call(this) || this; _this.key = key; _this.value = value; _this.precondition = precondition; _this.type = MutationType.Set; return _this; } SetMutation.prototype.applyToRemoteDocument = function (maybeDoc, mutationResult) { this.verifyKeyMatches(maybeDoc); assert(mutationResult.transformResults == null, 'Transform results received by SetMutation.'); // Unlike applyToLocalView, if we're applying a mutation to a remote // document the server has accepted the mutation so the precondition must // have held. var version = mutationResult.version; return new Document(this.key, version, this.value, { hasCommittedMutations: true }); }; SetMutation.prototype.applyToLocalView = function (maybeDoc, baseDoc, localWriteTime) { this.verifyKeyMatches(maybeDoc); if (!this.precondition.isValidFor(maybeDoc)) { return maybeDoc; } var version = Mutation.getPostMutationVersion(maybeDoc); return new Document(this.key, version, this.value, { hasLocalMutations: true }); }; SetMutation.prototype.isEqual = function (other) { return (other instanceof SetMutation && this.key.isEqual(other.key) && this.value.isEqual(other.value) && this.precondition.isEqual(other.precondition)); }; return SetMutation; }(Mutation)); /** * A mutation that modifies fields of the document at the given key with the * given values. The values are applied through a field mask: * * * When a field is in both the mask and the values, the corresponding field * is updated. * * When a field is in neither the mask nor the values, the corresponding * field is unmodified. * * When a field is in the mask but not in the values, the corresponding field * is deleted. * * When a field is not in the mask but is in the values, the values map is * ignored. */ var PatchMutation = /** @class */ (function (_super) { tslib_1.__extends(PatchMutation, _super); function PatchMutation(key, data, fieldMask, precondition) { var _this = _super.call(this) || this; _this.key = key; _this.data = data; _this.fieldMask = fieldMask; _this.precondition = precondition; _this.type = MutationType.Patch; return _this; } PatchMutation.prototype.applyToRemoteDocument = function (maybeDoc, mutationResult) { this.verifyKeyMatches(maybeDoc); assert(mutationResult.transformResults == null, 'Transform results received by PatchMutation.'); if (!this.precondition.isValidFor(maybeDoc)) { // Since the mutation was not rejected, we know that the precondition // matched on the backend. We therefore must not have the expected version // of the document in our cache and return an UnknownDocument with the // known updateTime. return new UnknownDocument(this.key, mutationResult.version); } var newData = this.patchDocument(maybeDoc); return new Document(this.key, mutationResult.version, newData, { hasCommittedMutations: true }); }; PatchMutation.prototype.applyToLocalView = function (maybeDoc, baseDoc, localWriteTime) { this.verifyKeyMatches(maybeDoc); if (!this.precondition.isValidFor(maybeDoc)) { return maybeDoc; } var version = Mutation.getPostMutationVersion(maybeDoc); var newData = this.patchDocument(maybeDoc); return new Document(this.key, version, newData, { hasLocalMutations: true }); }; PatchMutation.prototype.isEqual = function (other) { return (other instanceof PatchMutation && this.key.isEqual(other.key) && this.fieldMask.isEqual(other.fieldMask) && this.precondition.isEqual(other.precondition)); }; /** * Patches the data of document if available or creates a new document. Note * that this does not check whether or not the precondition of this patch * holds. */ PatchMutation.prototype.patchDocument = function (maybeDoc) { var data; if (maybeDoc instanceof Document) { data = maybeDoc.data; } else { data = ObjectValue.EMPTY; } return this.patchObject(data); }; PatchMutation.prototype.patchObject = function (data) { for (var _i = 0, _a = this.fieldMask.fields; _i < _a.length; _i++) { var fieldPath = _a[_i]; if (!fieldPath.isEmpty()) { var newValue = this.data.field(fieldPath); if (newValue !== undefined) { data = data.set(fieldPath, newValue); } else { data = data.delete(fieldPath); } } } return data; }; return PatchMutation; }(Mutation)); /** * A mutation that modifies specific fields of the document with transform * operations. Currently the only supported transform is a server timestamp, but * IP Address, increment(n), etc. could be supported in the future. * * It is somewhat similar to a PatchMutation in that it patches specific fields * and has no effect when applied to a null or NoDocument (see comment on * Mutation for rationale). */ var TransformMutation = /** @class */ (function (_super) { tslib_1.__extends(TransformMutation, _super); function TransformMutation(key, fieldTransforms) { var _this = _super.call(this) || this; _this.key = key; _this.fieldTransforms = fieldTransforms; _this.type = MutationType.Transform; // NOTE: We set a precondition of exists: true as a safety-check, since we // always combine TransformMutations with a SetMutation or PatchMutation which // (if successful) should end up with an existing document. _this.precondition = Precondition.exists(true); return _this; } TransformMutation.prototype.applyToRemoteDocument = function (maybeDoc, mutationResult) { this.verifyKeyMatches(maybeDoc); assert(mutationResult.transformResults != null, 'Transform results missing for TransformMutation.'); if (!this.precondition.isValidFor(maybeDoc)) { // Since the mutation was not rejected, we know that the precondition // matched on the backend. We therefore must not have the expected version // of the document in our cache and return an UnknownDocument with the // known updateTime. return new UnknownDocument(this.key, mutationResult.version); } var doc = this.requireDocument(maybeDoc); var transformResults = this.serverTransformResults(maybeDoc, mutationResult.transformResults); var version = mutationResult.version; var newData = this.transformObject(doc.data, transformResults); return new Document(this.key, version, newData, { hasCommittedMutations: true }); }; TransformMutation.prototype.applyToLocalView = function (maybeDoc, baseDoc, localWriteTime) { this.verifyKeyMatches(maybeDoc); if (!this.precondition.isValidFor(maybeDoc)) { return maybeDoc; } var doc = this.requireDocument(maybeDoc); var transformResults = this.localTransformResults(localWriteTime, baseDoc); var newData = this.transformObject(doc.data, transformResults); return new Document(this.key, doc.version, newData, { hasLocalMutations: true }); }; TransformMutation.prototype.isEqual = function (other) { return (other instanceof TransformMutation && this.key.isEqual(other.key) && arrayEquals(this.fieldTransforms, other.fieldTransforms) && this.precondition.isEqual(other.precondition)); }; /** * Asserts that the given MaybeDocument is actually a Document and verifies * that it matches the key for this mutation. Since we only support * transformations with precondition exists this method is guaranteed to be * safe. */ TransformMutation.prototype.requireDocument = function (maybeDoc) { assert(maybeDoc instanceof Document, 'Unknown MaybeDocument type ' + maybeDoc); var doc = maybeDoc; assert(doc.key.isEqual(this.key), 'Can only transform a document with the same key'); return doc; }; /** * Creates a list of "transform results" (a transform result is a field value * representing the result of applying a transform) for use after a * TransformMutation has been acknowledged by the server. * * @param baseDoc The document prior to applying this mutation batch. * @param serverTransformResults The transform results received by the server. * @return The transform results list. */ TransformMutation.prototype.serverTransformResults = function (baseDoc, serverTransformResults) { var transformResults = []; assert(this.fieldTransforms.length === serverTransformResults.length, "server transform result count (" + serverTransformResults.length + ") " + ("should match field transform count (" + this.fieldTransforms.length + ")")); for (var i = 0; i < serverTransformResults.length; i++) { var fieldTransform = this.fieldTransforms[i]; var transform = fieldTransform.transform; var previousValue = null; if (baseDoc instanceof Document) { previousValue = baseDoc.field(fieldTransform.field) || null; } transformResults.push(transform.applyToRemoteDocument(previousValue, serverTransformResults[i])); } return transformResults; }; /** * Creates a list of "transform results" (a transform result is a field value * representing the result of applying a transform) for use when applying a * TransformMutation locally. * * @param localWriteTime The local time of the transform mutation (used to * generate ServerTimestampValues). * @param baseDoc The document prior to applying this mutation batch. * @return The transform results list. */ TransformMutation.prototype.localTransformResults = function (localWriteTime, baseDoc) { var transformResults = []; for (var _i = 0, _a = this.fieldTransforms; _i < _a.length; _i++) { var fieldTransform = _a[_i]; var transform = fieldTransform.transform; var previousValue = null; if (baseDoc instanceof Document) { previousValue = baseDoc.field(fieldTransform.field) || null; } transformResults.push(transform.applyToLocalView(previousValue, localWriteTime)); } return transformResults; }; TransformMutation.prototype.transformObject = function (data, transformResults) { assert(transformResults.length === this.fieldTransforms.length, 'TransformResults length mismatch.'); for (var i = 0; i < this.fieldTransforms.length; i++) { var fieldTransform = this.fieldTransforms[i]; var fieldPath = fieldTransform.field; data = data.set(fieldPath, transformResults[i]); } return data; }; return TransformMutation; }(Mutation)); /** A mutation that deletes the document at the given key. */ var DeleteMutation = /** @class */ (function (_super) { tslib_1.__extends(DeleteMutation, _super); function DeleteMutation(key, precondition) { var _this = _super.call(this) || this; _this.key = key; _this.precondition = precondition; _this.type = MutationType.Delete; return _this; } DeleteMutation.prototype.applyToRemoteDocument = function (maybeDoc, mutationResult) { this.verifyKeyMatches(maybeDoc); assert(mutationResult.transformResults == null, 'Transform results received by DeleteMutation.'); // Unlike applyToLocalView, if we're applying a mutation to a remote // document the server has accepted the mutation so the precondition must // have held. return new NoDocument(this.key, mutationResult.version, { hasCommittedMutations: true }); }; DeleteMutation.prototype.applyToLocalView = function (maybeDoc, baseDoc, localWriteTime) { this.verifyKeyMatches(maybeDoc); if (!this.precondition.isValidFor(maybeDoc)) { return maybeDoc; } if (maybeDoc) { assert(maybeDoc.key.isEqual(this.key), 'Can only apply mutation to document with same key'); } return new NoDocument(this.key, SnapshotVersion.forDeletedDoc()); }; DeleteMutation.prototype.isEqual = function (other) { return (other instanceof DeleteMutation && this.key.isEqual(other.key) && this.precondition.isEqual(other.precondition)); }; return DeleteMutation; }(Mutation)); /** * Copyright 2018 Google Inc. * * 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. */ /** Transforms a value into a server-generated timestamp. */ var ServerTimestampTransform = /** @class */ (function () { function ServerTimestampTransform() { } ServerTimestampTransform.prototype.applyToLocalView = function (previousValue, localWriteTime) { return new ServerTimestampValue(localWriteTime, previousValue); }; ServerTimestampTransform.prototype.applyToRemoteDocument = function (previousValue, transformResult) { return transformResult; }; ServerTimestampTransform.prototype.isEqual = function (other) { return other instanceof ServerTimestampTransform; }; ServerTimestampTransform.instance = new ServerTimestampTransform(); return ServerTimestampTransform; }()); /** Transforms an array value via a union operation. */ var ArrayUnionTransformOperation = /** @class */ (function () { function ArrayUnionTransformOperation(elements) { this.elements = elements; } ArrayUnionTransformOperation.prototype.applyToLocalView = function (previousValue, localWriteTime) { return this.apply(previousValue); }; ArrayUnionTransformOperation.prototype.applyToRemoteDocument = function (previousValue, transformResult) { // The server just sends null as the transform result for array operations, // so we have to calculate a result the same as we do for local // applications. return this.apply(previousValue); }; ArrayUnionTransformOperation.prototype.apply = function (previousValue) { var result = coercedFieldValuesArray(previousValue); var _loop_1 = function (toUnion) { if (!result.find(function (element) { return element.isEqual(toUnion); })) { result.push(toUnion); } }; for (var _i = 0, _a = this.elements; _i < _a.length; _i++) { var toUnion = _a[_i]; _loop_1(toUnion); } return new ArrayValue(result); }; ArrayUnionTransformOperation.prototype.isEqual = function (other) { return (other instanceof ArrayUnionTransformOperation && arrayEquals(other.elements, this.elements)); }; return ArrayUnionTransformOperation; }()); /** Transforms an array value via a remove operation. */ var ArrayRemoveTransformOperation = /** @class */ (function () { function ArrayRemoveTransformOperation(elements) { this.elements = elements; } ArrayRemoveTransformOperation.prototype.applyToLocalView = function (previousValue, localWriteTime) { return this.apply(previousValue); }; ArrayRemoveTransformOperation.prototype.applyToRemoteDocument = function (previousValue, transformResult) { // The server just sends null as the transform result for array operations, // so we have to calculate a result the same as we do for local // applications. return this.apply(previousValue); }; ArrayRemoveTransformOperation.prototype.apply = function (previousValue) { var result = coercedFieldValuesArray(previousValue); var _loop_2 = function (toRemove) { result = result.filter(function (element) { return !element.isEqual(toRemove); }); }; for (var _i = 0, _a = this.elements; _i < _a.length; _i++) { var toRemove = _a[_i]; _loop_2(toRemove); } return new ArrayValue(result); }; ArrayRemoveTransformOperation.prototype.isEqual = function (other) { return (other instanceof ArrayRemoveTransformOperation && arrayEquals(other.elements, this.elements)); }; return ArrayRemoveTransformOperation; }()); function coercedFieldValuesArray(value) { if (value instanceof ArrayValue) { return value.internalValue.slice(); } else { // coerce to empty array. return []; } } /** * Copyright 2017 Google Inc. * * 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. */ var ExistenceFilter = /** @class */ (function () { // TODO(b/33078163): just use simplest form of existence filter for now function ExistenceFilter(count) { this.count = count; } ExistenceFilter.prototype.isEqual = function (other) { return other && other.count === this.count; }; return ExistenceFilter; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Error Codes describing the different ways GRPC can fail. These are copied * directly from GRPC's sources here: * * https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h * * Important! The names of these identifiers matter because the string forms * are used for reverse lookups from the webchannel stream. Do NOT change the * names of these identifiers. */ var RpcCode; (function (RpcCode) { RpcCode[RpcCode["OK"] = 0] = "OK"; RpcCode[RpcCode["CANCELLED"] = 1] = "CANCELLED"; RpcCode[RpcCode["UNKNOWN"] = 2] = "UNKNOWN"; RpcCode[RpcCode["INVALID_ARGUMENT"] = 3] = "INVALID_ARGUMENT"; RpcCode[RpcCode["DEADLINE_EXCEEDED"] = 4] = "DEADLINE_EXCEEDED"; RpcCode[RpcCode["NOT_FOUND"] = 5] = "NOT_FOUND"; RpcCode[RpcCode["ALREADY_EXISTS"] = 6] = "ALREADY_EXISTS"; RpcCode[RpcCode["PERMISSION_DENIED"] = 7] = "PERMISSION_DENIED"; RpcCode[RpcCode["UNAUTHENTICATED"] = 16] = "UNAUTHENTICATED"; RpcCode[RpcCode["RESOURCE_EXHAUSTED"] = 8] = "RESOURCE_EXHAUSTED"; RpcCode[RpcCode["FAILED_PRECONDITION"] = 9] = "FAILED_PRECONDITION"; RpcCode[RpcCode["ABORTED"] = 10] = "ABORTED"; RpcCode[RpcCode["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE"; RpcCode[RpcCode["UNIMPLEMENTED"] = 12] = "UNIMPLEMENTED"; RpcCode[RpcCode["INTERNAL"] = 13] = "INTERNAL"; RpcCode[RpcCode["UNAVAILABLE"] = 14] = "UNAVAILABLE"; RpcCode[RpcCode["DATA_LOSS"] = 15] = "DATA_LOSS"; })(RpcCode || (RpcCode = {})); function isPermanentError(code) { switch (code) { case Code.OK: return fail('Treated status OK as error'); case Code.CANCELLED: case Code.UNKNOWN: case Code.DEADLINE_EXCEEDED: case Code.RESOURCE_EXHAUSTED: case Code.INTERNAL: case Code.UNAVAILABLE: // Unauthenticated means something went wrong with our token and we need // to retry with new credentials which will happen automatically. case Code.UNAUTHENTICATED: return false; case Code.INVALID_ARGUMENT: case Code.NOT_FOUND: case Code.ALREADY_EXISTS: case Code.PERMISSION_DENIED: case Code.FAILED_PRECONDITION: // Aborted might be retried in some scenarios, but that is dependant on // the context and should handled individually by the calling code. // See https://cloud.google.com/apis/design/errors. case Code.ABORTED: case Code.OUT_OF_RANGE: case Code.UNIMPLEMENTED: case Code.DATA_LOSS: return true; default: return fail('Unknown status code: ' + code); } } /** * Maps an error Code from a GRPC status identifier like 'NOT_FOUND'. * * @returns The Code equivalent to the given status string or undefined if * there is no match. */ function mapCodeFromRpcStatus(status) { // tslint:disable-next-line:no-any lookup by string var code = RpcCode[status]; if (code === undefined) { return undefined; } return mapCodeFromRpcCode(code); } /** * Maps an error Code from GRPC status code number, like 0, 1, or 14. These * are not the same as HTTP status codes. * * @returns The Code equivalent to the given GRPC status code. Fails if there * is no match. */ function mapCodeFromRpcCode(code) { if (code === undefined) { // This shouldn't normally happen, but in certain error cases (like trying // to send invalid proto messages) we may get an error with no GRPC code. error('GRPC error has no .code'); return Code.UNKNOWN; } switch (code) { case RpcCode.OK: return Code.OK; case RpcCode.CANCELLED: return Code.CANCELLED; case RpcCode.UNKNOWN: return Code.UNKNOWN; case RpcCode.DEADLINE_EXCEEDED: return Code.DEADLINE_EXCEEDED; case RpcCode.RESOURCE_EXHAUSTED: return Code.RESOURCE_EXHAUSTED; case RpcCode.INTERNAL: return Code.INTERNAL; case RpcCode.UNAVAILABLE: return Code.UNAVAILABLE; case RpcCode.UNAUTHENTICATED: return Code.UNAUTHENTICATED; case RpcCode.INVALID_ARGUMENT: return Code.INVALID_ARGUMENT; case RpcCode.NOT_FOUND: return Code.NOT_FOUND; case RpcCode.ALREADY_EXISTS: return Code.ALREADY_EXISTS; case RpcCode.PERMISSION_DENIED: return Code.PERMISSION_DENIED; case RpcCode.FAILED_PRECONDITION: return Code.FAILED_PRECONDITION; case RpcCode.ABORTED: return Code.ABORTED; case RpcCode.OUT_OF_RANGE: return Code.OUT_OF_RANGE; case RpcCode.UNIMPLEMENTED: return Code.UNIMPLEMENTED; case RpcCode.DATA_LOSS: return Code.DATA_LOSS; default: return fail('Unknown status code: ' + code); } } /** * Maps an RPC code from a Code. This is the reverse operation from * mapCodeFromRpcCode and should really only be used in tests. */ function mapRpcCodeFromCode(code) { if (code === undefined) { return RpcCode.OK; } switch (code) { case Code.OK: return RpcCode.OK; case Code.CANCELLED: return RpcCode.CANCELLED; case Code.UNKNOWN: return RpcCode.UNKNOWN; case Code.DEADLINE_EXCEEDED: return RpcCode.DEADLINE_EXCEEDED; case Code.RESOURCE_EXHAUSTED: return RpcCode.RESOURCE_EXHAUSTED; case Code.INTERNAL: return RpcCode.INTERNAL; case Code.UNAVAILABLE: return RpcCode.UNAVAILABLE; case Code.UNAUTHENTICATED: return RpcCode.UNAUTHENTICATED; case Code.INVALID_ARGUMENT: return RpcCode.INVALID_ARGUMENT; case Code.NOT_FOUND: return RpcCode.NOT_FOUND; case Code.ALREADY_EXISTS: return RpcCode.ALREADY_EXISTS; case Code.PERMISSION_DENIED: return RpcCode.PERMISSION_DENIED; case Code.FAILED_PRECONDITION: return RpcCode.FAILED_PRECONDITION; case Code.ABORTED: return RpcCode.ABORTED; case Code.OUT_OF_RANGE: return RpcCode.OUT_OF_RANGE; case Code.UNIMPLEMENTED: return RpcCode.UNIMPLEMENTED; case Code.DATA_LOSS: return RpcCode.DATA_LOSS; default: return fail('Unknown status code: ' + code); } } /** * Converts an HTTP Status Code to the equivalent error code. * * @param status An HTTP Status Code, like 200, 404, 503, etc. * @returns The equivalent Code. Unknown status codes are mapped to * Code.UNKNOWN. */ function mapCodeFromHttpStatus(status) { // The canonical error codes for Google APIs [1] specify mapping onto HTTP // status codes but the mapping is not bijective. In each case of ambiguity // this function chooses a primary error. // // [1] // https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto switch (status) { case 200: // OK return Code.OK; case 400: // Bad Request return Code.INVALID_ARGUMENT; // Other possibilities based on the forward mapping // return Code.FAILED_PRECONDITION; // return Code.OUT_OF_RANGE; case 401: // Unauthorized return Code.UNAUTHENTICATED; case 403: // Forbidden return Code.PERMISSION_DENIED; case 404: // Not Found return Code.NOT_FOUND; case 409: // Conflict return Code.ABORTED; // Other possibilities: // return Code.ALREADY_EXISTS; case 416: // Range Not Satisfiable return Code.OUT_OF_RANGE; case 429: // Too Many Requests return Code.RESOURCE_EXHAUSTED; case 499: // Client Closed Request return Code.CANCELLED; case 500: // Internal Server Error return Code.UNKNOWN; // Other possibilities: // return Code.INTERNAL; // return Code.DATA_LOSS; case 501: // Unimplemented return Code.UNIMPLEMENTED; case 503: // Service Unavailable return Code.UNAVAILABLE; case 504: // Gateway Timeout return Code.DEADLINE_EXCEEDED; default: if (status >= 200 && status < 300) return Code.OK; if (status >= 400 && status < 500) return Code.FAILED_PRECONDITION; if (status >= 500 && status < 600) return Code.INTERNAL; return Code.UNKNOWN; } } /** * Copyright 2017 Google Inc. * * 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. */ /** * SortedSet is an immutable (copy-on-write) collection that holds elements * in order specified by the provided comparator. * * NOTE: if provided comparator returns 0 for two elements, we consider them to * be equal! */ var SortedSet = /** @class */ (function () { function SortedSet(comparator) { this.comparator = comparator; this.data = new SortedMap(this.comparator); } /** * Creates a SortedSet from the keys of the map. * This is currently implemented as an O(n) copy. */ SortedSet.fromMapKeys = function (map) { var keys = new SortedSet(map.comparator); map.forEach(function (key) { keys = keys.add(key); }); return keys; }; SortedSet.prototype.has = function (elem) { return this.data.get(elem) !== null; }; SortedSet.prototype.first = function () { return this.data.minKey(); }; SortedSet.prototype.last = function () { return this.data.maxKey(); }; Object.defineProperty(SortedSet.prototype, "size", { get: function () { return this.data.size; }, enumerable: true, configurable: true }); SortedSet.prototype.indexOf = function (elem) { return this.data.indexOf(elem); }; /** Iterates elements in order defined by "comparator" */ SortedSet.prototype.forEach = function (cb) { this.data.inorderTraversal(function (k, v) { cb(k); return false; }); }; /** Iterates over `elem`s such that: range[0] <= elem < range[1]. */ SortedSet.prototype.forEachInRange = function (range, cb) { var iter = this.data.getIteratorFrom(range[0]); while (iter.hasNext()) { var elem = iter.getNext(); if (this.comparator(elem.key, range[1]) >= 0) return; cb(elem.key); } }; /** * Iterates over `elem`s such that: start <= elem until false is returned. */ SortedSet.prototype.forEachWhile = function (cb, start) { var iter; if (start !== undefined) { iter = this.data.getIteratorFrom(start); } else { iter = this.data.getIterator(); } while (iter.hasNext()) { var elem = iter.getNext(); var result = cb(elem.key); if (!result) return; } }; /** Finds the least element greater than or equal to `elem`. */ SortedSet.prototype.firstAfterOrEqual = function (elem) { var iter = this.data.getIteratorFrom(elem); return iter.hasNext() ? iter.getNext().key : null; }; /** Inserts or updates an element */ SortedSet.prototype.add = function (elem) { return this.copy(this.data.remove(elem).insert(elem, true)); }; /** Deletes an element */ SortedSet.prototype.delete = function (elem) { if (!this.has(elem)) return this; return this.copy(this.data.remove(elem)); }; SortedSet.prototype.isEmpty = function () { return this.data.isEmpty(); }; SortedSet.prototype.unionWith = function (other) { var result = this; other.forEach(function (elem) { result = result.add(elem); }); return result; }; SortedSet.prototype.isEqual = function (other) { if (!(other instanceof SortedSet)) return false; if (this.size !== other.size) return false; var thisIt = this.data.getIterator(); var otherIt = other.data.getIterator(); while (thisIt.hasNext()) { var thisElem = thisIt.getNext().key; var otherElem = otherIt.getNext().key; if (this.comparator(thisElem, otherElem) !== 0) return false; } return true; }; SortedSet.prototype.toArray = function () { var res = []; this.forEach(function (targetId) { res.push(targetId); }); return res; }; SortedSet.prototype.toString = function () { var result = []; this.forEach(function (elem) { return result.push(elem); }); return 'SortedSet(' + result.toString() + ')'; }; SortedSet.prototype.copy = function (data) { var result = new SortedSet(this.comparator); result.data = data; return result; }; return SortedSet; }()); /** * Copyright 2017 Google Inc. * * 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. */ var EMPTY_MAYBE_DOCUMENT_MAP = new SortedMap(DocumentKey.comparator); function maybeDocumentMap() { return EMPTY_MAYBE_DOCUMENT_MAP; } var EMPTY_DOCUMENT_MAP = new SortedMap(DocumentKey.comparator); function documentMap() { return EMPTY_DOCUMENT_MAP; } var EMPTY_DOCUMENT_VERSION_MAP = new SortedMap(DocumentKey.comparator); function documentVersionMap() { return EMPTY_DOCUMENT_VERSION_MAP; } var EMPTY_DOCUMENT_KEY_SET = new SortedSet(DocumentKey.comparator); function documentKeySet() { return EMPTY_DOCUMENT_KEY_SET; } var EMPTY_TARGET_ID_SET = new SortedSet(primitiveComparator); function targetIdSet() { return EMPTY_TARGET_ID_SET; } /** * Copyright 2017 Google Inc. * * 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. */ /** * DocumentSet is an immutable (copy-on-write) collection that holds documents * in order specified by the provided comparator. We always add a document key * comparator on top of what is provided to guarantee document equality based on * the key. */ var DocumentSet = /** @class */ (function () { /** The default ordering is by key if the comparator is omitted */ function DocumentSet(comp) { // We are adding document key comparator to the end as it's the only // guaranteed unique property of a document. if (comp) { this.comparator = function (d1, d2) { return comp(d1, d2) || DocumentKey.comparator(d1.key, d2.key); }; } else { this.comparator = function (d1, d2) { return DocumentKey.comparator(d1.key, d2.key); }; } this.keyedMap = documentMap(); this.sortedSet = new SortedMap(this.comparator); } /** * Returns an empty copy of the existing DocumentSet, using the same * comparator. */ DocumentSet.emptySet = function (oldSet) { return new DocumentSet(oldSet.comparator); }; DocumentSet.prototype.has = function (key) { return this.keyedMap.get(key) != null; }; DocumentSet.prototype.get = function (key) { return this.keyedMap.get(key); }; DocumentSet.prototype.first = function () { return this.sortedSet.minKey(); }; DocumentSet.prototype.last = function () { return this.sortedSet.maxKey(); }; DocumentSet.prototype.isEmpty = function () { return this.sortedSet.isEmpty(); }; /** * Returns the index of the provided key in the document set, or -1 if the * document key is not present in the set; */ DocumentSet.prototype.indexOf = function (key) { var doc = this.keyedMap.get(key); return doc ? this.sortedSet.indexOf(doc) : -1; }; Object.defineProperty(DocumentSet.prototype, "size", { get: function () { return this.sortedSet.size; }, enumerable: true, configurable: true }); /** Iterates documents in order defined by "comparator" */ DocumentSet.prototype.forEach = function (cb) { this.sortedSet.inorderTraversal(function (k, v) { cb(k); return false; }); }; /** Inserts or updates a document with the same key */ DocumentSet.prototype.add = function (doc) { // First remove the element if we have it. var set = this.delete(doc.key); return set.copy(set.keyedMap.insert(doc.key, doc), set.sortedSet.insert(doc, null)); }; /** Deletes a document with a given key */ DocumentSet.prototype.delete = function (key) { var doc = this.get(key); if (!doc) { return this; } return this.copy(this.keyedMap.remove(key), this.sortedSet.remove(doc)); }; DocumentSet.prototype.isEqual = function (other) { if (!(other instanceof DocumentSet)) return false; if (this.size !== other.size) return false; var thisIt = this.sortedSet.getIterator(); var otherIt = other.sortedSet.getIterator(); while (thisIt.hasNext()) { var thisDoc = thisIt.getNext().key; var otherDoc = otherIt.getNext().key; if (!thisDoc.isEqual(otherDoc)) return false; } return true; }; DocumentSet.prototype.toString = function () { var docStrings = []; this.forEach(function (doc) { docStrings.push(doc.toString()); }); if (docStrings.length === 0) { return 'DocumentSet ()'; } else { return 'DocumentSet (\n ' + docStrings.join(' \n') + '\n)'; } }; DocumentSet.prototype.copy = function (keyedMap, sortedSet) { var newSet = new DocumentSet(); newSet.comparator = this.comparator; newSet.keyedMap = keyedMap; newSet.sortedSet = sortedSet; return newSet; }; return DocumentSet; }()); /** * Copyright 2017 Google Inc. * * 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. */ var ChangeType; (function (ChangeType) { ChangeType[ChangeType["Added"] = 0] = "Added"; ChangeType[ChangeType["Removed"] = 1] = "Removed"; ChangeType[ChangeType["Modified"] = 2] = "Modified"; ChangeType[ChangeType["Metadata"] = 3] = "Metadata"; })(ChangeType || (ChangeType = {})); var SyncState; (function (SyncState) { SyncState[SyncState["Local"] = 0] = "Local"; SyncState[SyncState["Synced"] = 1] = "Synced"; })(SyncState || (SyncState = {})); /** * DocumentChangeSet keeps track of a set of changes to docs in a query, merging * duplicate events for the same doc. */ var DocumentChangeSet = /** @class */ (function () { function DocumentChangeSet() { this.changeMap = new SortedMap(DocumentKey.comparator); } DocumentChangeSet.prototype.track = function (change) { var key = change.doc.key; var oldChange = this.changeMap.get(key); if (!oldChange) { this.changeMap = this.changeMap.insert(key, change); return; } // Merge the new change with the existing change. if (change.type !== ChangeType.Added && oldChange.type === ChangeType.Metadata) { this.changeMap = this.changeMap.insert(key, change); } else if (change.type === ChangeType.Metadata && oldChange.type !== ChangeType.Removed) { this.changeMap = this.changeMap.insert(key, { type: oldChange.type, doc: change.doc }); } else if (change.type === ChangeType.Modified && oldChange.type === ChangeType.Modified) { this.changeMap = this.changeMap.insert(key, { type: ChangeType.Modified, doc: change.doc }); } else if (change.type === ChangeType.Modified && oldChange.type === ChangeType.Added) { this.changeMap = this.changeMap.insert(key, { type: ChangeType.Added, doc: change.doc }); } else if (change.type === ChangeType.Removed && oldChange.type === ChangeType.Added) { this.changeMap = this.changeMap.remove(key); } else if (change.type === ChangeType.Removed && oldChange.type === ChangeType.Modified) { this.changeMap = this.changeMap.insert(key, { type: ChangeType.Removed, doc: oldChange.doc }); } else if (change.type === ChangeType.Added && oldChange.type === ChangeType.Removed) { this.changeMap = this.changeMap.insert(key, { type: ChangeType.Modified, doc: change.doc }); } else { // This includes these cases, which don't make sense: // Added->Added // Removed->Removed // Modified->Added // Removed->Modified // Metadata->Added // Removed->Metadata fail('unsupported combination of changes: ' + JSON.stringify(change) + ' after ' + JSON.stringify(oldChange)); } }; DocumentChangeSet.prototype.getChanges = function () { var changes = []; this.changeMap.inorderTraversal(function (key, change) { changes.push(change); }); return changes; }; return DocumentChangeSet; }()); var ViewSnapshot = /** @class */ (function () { function ViewSnapshot(query, docs, oldDocs, docChanges, mutatedKeys, fromCache, syncStateChanged, excludesMetadataChanges) { this.query = query; this.docs = docs; this.oldDocs = oldDocs; this.docChanges = docChanges; this.mutatedKeys = mutatedKeys; this.fromCache = fromCache; this.syncStateChanged = syncStateChanged; this.excludesMetadataChanges = excludesMetadataChanges; } /** Returns a view snapshot as if all documents in the snapshot were added. */ ViewSnapshot.fromInitialDocuments = function (query, documents, mutatedKeys, fromCache) { var changes = []; documents.forEach(function (doc) { changes.push({ type: ChangeType.Added, doc: doc }); }); return new ViewSnapshot(query, documents, DocumentSet.emptySet(documents), changes, mutatedKeys, fromCache, true, false); }; Object.defineProperty(ViewSnapshot.prototype, "hasPendingWrites", { get: function () { return !this.mutatedKeys.isEmpty(); }, enumerable: true, configurable: true }); ViewSnapshot.prototype.isEqual = function (other) { if (this.fromCache !== other.fromCache || this.syncStateChanged !== other.syncStateChanged || !this.mutatedKeys.isEqual(other.mutatedKeys) || !this.query.isEqual(other.query) || !this.docs.isEqual(other.docs) || !this.oldDocs.isEqual(other.oldDocs)) { return false; } var changes = this.docChanges; var otherChanges = other.docChanges; if (changes.length !== otherChanges.length) { return false; } for (var i = 0; i < changes.length; i++) { if (changes[i].type !== otherChanges[i].type || !changes[i].doc.isEqual(otherChanges[i].doc)) { return false; } } return true; }; return ViewSnapshot; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * An event from the RemoteStore. It is split into targetChanges (changes to the * state or the set of documents in our watched targets) and documentUpdates * (changes to the actual documents). */ var RemoteEvent = /** @class */ (function () { function RemoteEvent( /** * The snapshot version this event brings us up to, or MIN if not set. */ snapshotVersion, /** * A map from target to changes to the target. See TargetChange. */ targetChanges, /** * A set of targets that is known to be inconsistent. Listens for these * targets should be re-established without resume tokens. */ targetMismatches, /** * A set of which documents have changed or been deleted, along with the * doc's new values (if not deleted). */ documentUpdates, /** * A set of which document updates are due only to limbo resolution targets. */ resolvedLimboDocuments) { this.snapshotVersion = snapshotVersion; this.targetChanges = targetChanges; this.targetMismatches = targetMismatches; this.documentUpdates = documentUpdates; this.resolvedLimboDocuments = resolvedLimboDocuments; } /** * HACK: Views require RemoteEvents in order to determine whether the view is * CURRENT, but secondary tabs don't receive remote events. So this method is * used to create a synthesized RemoteEvent that can be used to apply a * CURRENT status change to a View, for queries executed in a different tab. */ // PORTING NOTE: Multi-tab only RemoteEvent.createSynthesizedRemoteEventForCurrentChange = function (targetId, current) { var targetChanges = (_a = {}, _a[targetId] = TargetChange.createSynthesizedTargetChangeForCurrentChange(targetId, current), _a); return new RemoteEvent(SnapshotVersion.MIN, targetChanges, targetIdSet(), maybeDocumentMap(), documentKeySet()); var _a; }; return RemoteEvent; }()); /** * A TargetChange specifies the set of changes for a specific target as part of * a RemoteEvent. These changes track which documents are added, modified or * removed, as well as the target's resume token and whether the target is * marked CURRENT. * The actual changes *to* documents are not part of the TargetChange since * documents may be part of multiple targets. */ var TargetChange = /** @class */ (function () { function TargetChange( /** * An opaque, server-assigned token that allows watching a query to be resumed * after disconnecting without retransmitting all the data that matches the * query. The resume token essentially identifies a point in time from which * the server should resume sending results. */ resumeToken, /** * The "current" (synced) status of this target. Note that "current" * has special meaning in the RPC protocol that implies that a target is * both up-to-date and consistent with the rest of the watch stream. */ current, /** * The set of documents that were newly assigned to this target as part of * this remote event. */ addedDocuments, /** * The set of documents that were already assigned to this target but received * an update during this remote event. */ modifiedDocuments, /** * The set of documents that were removed from this target as part of this * remote event. */ removedDocuments) { this.resumeToken = resumeToken; this.current = current; this.addedDocuments = addedDocuments; this.modifiedDocuments = modifiedDocuments; this.removedDocuments = removedDocuments; } /** * HACK: Views require TargetChanges in order to determine whether the view is * CURRENT, but secondary tabs don't receive remote events. So this method is * used to create a synthesized TargetChanges that can be used to apply a * CURRENT status change to a View, for queries executed in a different tab. */ // PORTING NOTE: Multi-tab only TargetChange.createSynthesizedTargetChangeForCurrentChange = function (targetId, current) { return new TargetChange(emptyByteString(), current, documentKeySet(), documentKeySet(), documentKeySet()); }; return TargetChange; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Represents a changed document and a list of target ids to which this change * applies. * * If document has been deleted NoDocument will be provided. */ var DocumentWatchChange = /** @class */ (function () { function DocumentWatchChange( /** The new document applies to all of these targets. */ updatedTargetIds, /** The new document is removed from all of these targets. */ removedTargetIds, /** The key of the document for this change. */ key, /** * The new document or NoDocument if it was deleted. Is null if the * document went out of view without the server sending a new document. */ newDoc) { this.updatedTargetIds = updatedTargetIds; this.removedTargetIds = removedTargetIds; this.key = key; this.newDoc = newDoc; } return DocumentWatchChange; }()); var ExistenceFilterChange = /** @class */ (function () { function ExistenceFilterChange(targetId, existenceFilter) { this.targetId = targetId; this.existenceFilter = existenceFilter; } return ExistenceFilterChange; }()); var WatchTargetChangeState; (function (WatchTargetChangeState) { WatchTargetChangeState[WatchTargetChangeState["NoChange"] = 0] = "NoChange"; WatchTargetChangeState[WatchTargetChangeState["Added"] = 1] = "Added"; WatchTargetChangeState[WatchTargetChangeState["Removed"] = 2] = "Removed"; WatchTargetChangeState[WatchTargetChangeState["Current"] = 3] = "Current"; WatchTargetChangeState[WatchTargetChangeState["Reset"] = 4] = "Reset"; })(WatchTargetChangeState || (WatchTargetChangeState = {})); var WatchTargetChange = /** @class */ (function () { function WatchTargetChange( /** What kind of change occurred to the watch target. */ state, /** The target IDs that were added/removed/set. */ targetIds, /** * An opaque, server-assigned token that allows watching a query to be * resumed after disconnecting without retransmitting all the data that * matches the query. The resume token essentially identifies a point in * time from which the server should resume sending results. */ resumeToken, /** An RPC error indicating why the watch failed. */ cause) { if (resumeToken === void 0) { resumeToken = emptyByteString(); } if (cause === void 0) { cause = null; } this.state = state; this.targetIds = targetIds; this.resumeToken = resumeToken; this.cause = cause; } return WatchTargetChange; }()); /** Tracks the internal state of a Watch target. */ var TargetState = /** @class */ (function () { function TargetState() { /** * The number of pending responses (adds or removes) that we are waiting on. * We only consider targets active that have no pending responses. */ this.pendingResponses = 0; /** * Keeps track of the document changes since the last raised snapshot. * * These changes are continuously updated as we receive document updates and * always reflect the current set of changes against the last issued snapshot. */ this.documentChanges = snapshotChangesMap(); /** See public getters for explanations of these fields. */ this._resumeToken = emptyByteString(); this._current = false; /** * Whether this target state should be included in the next snapshot. We * initialize to true so that newly-added targets are included in the next * RemoteEvent. */ this._hasPendingChanges = true; } Object.defineProperty(TargetState.prototype, "current", { /** * Whether this target has been marked 'current'. * * 'Current' has special meaning in the RPC protocol: It implies that the * Watch backend has sent us all changes up to the point at which the target * was added and that the target is consistent with the rest of the watch * stream. */ get: function () { return this._current; }, enumerable: true, configurable: true }); Object.defineProperty(TargetState.prototype, "resumeToken", { /** The last resume token sent to us for this target. */ get: function () { return this._resumeToken; }, enumerable: true, configurable: true }); Object.defineProperty(TargetState.prototype, "isPending", { /** Whether this target has pending target adds or target removes. */ get: function () { return this.pendingResponses !== 0; }, enumerable: true, configurable: true }); Object.defineProperty(TargetState.prototype, "hasPendingChanges", { /** Whether we have modified any state that should trigger a snapshot. */ get: function () { return this._hasPendingChanges; }, enumerable: true, configurable: true }); /** * Applies the resume token to the TargetChange, but only when it has a new * value. Empty resumeTokens are discarded. */ TargetState.prototype.updateResumeToken = function (resumeToken) { if (resumeToken.length > 0) { this._hasPendingChanges = true; this._resumeToken = resumeToken; } }; /** * Creates a target change from the current set of changes. * * To reset the document changes after raising this snapshot, call * `clearPendingChanges()`. */ TargetState.prototype.toTargetChange = function () { var addedDocuments = documentKeySet(); var modifiedDocuments = documentKeySet(); var removedDocuments = documentKeySet(); this.documentChanges.forEach(function (key, changeType) { switch (changeType) { case ChangeType.Added: addedDocuments = addedDocuments.add(key); break; case ChangeType.Modified: modifiedDocuments = modifiedDocuments.add(key); break; case ChangeType.Removed: removedDocuments = removedDocuments.add(key); break; default: fail('Encountered invalid change type: ' + changeType); } }); return new TargetChange(this._resumeToken, this._current, addedDocuments, modifiedDocuments, removedDocuments); }; /** * Resets the document changes and sets `hasPendingChanges` to false. */ TargetState.prototype.clearPendingChanges = function () { this._hasPendingChanges = false; this.documentChanges = snapshotChangesMap(); }; TargetState.prototype.addDocumentChange = function (key, changeType) { this._hasPendingChanges = true; this.documentChanges = this.documentChanges.insert(key, changeType); }; TargetState.prototype.removeDocumentChange = function (key) { this._hasPendingChanges = true; this.documentChanges = this.documentChanges.remove(key); }; TargetState.prototype.recordPendingTargetRequest = function () { this.pendingResponses += 1; }; TargetState.prototype.recordTargetResponse = function () { this.pendingResponses -= 1; }; TargetState.prototype.markCurrent = function () { this._hasPendingChanges = true; this._current = true; }; return TargetState; }()); /** * A helper class to accumulate watch changes into a RemoteEvent. */ var WatchChangeAggregator = /** @class */ (function () { function WatchChangeAggregator(metadataProvider) { this.metadataProvider = metadataProvider; /** The internal state of all tracked targets. */ this.targetStates = {}; /** Keeps track of the documents to update since the last raised snapshot. */ this.pendingDocumentUpdates = maybeDocumentMap(); /** A mapping of document keys to their set of target IDs. */ this.pendingDocumentTargetMapping = documentTargetMap(); /** * A list of targets with existence filter mismatches. These targets are * known to be inconsistent and their listens needs to be re-established by * RemoteStore. */ this.pendingTargetResets = new SortedSet(primitiveComparator); } /** * Processes and adds the DocumentWatchChange to the current set of changes. */ WatchChangeAggregator.prototype.handleDocumentChange = function (docChange) { for (var _i = 0, _a = docChange.updatedTargetIds; _i < _a.length; _i++) { var targetId = _a[_i]; if (docChange.newDoc instanceof Document) { this.addDocumentToTarget(targetId, docChange.newDoc); } else if (docChange.newDoc instanceof NoDocument) { this.removeDocumentFromTarget(targetId, docChange.key, docChange.newDoc); } } for (var _b = 0, _c = docChange.removedTargetIds; _b < _c.length; _b++) { var targetId = _c[_b]; this.removeDocumentFromTarget(targetId, docChange.key, docChange.newDoc); } }; /** Processes and adds the WatchTargetChange to the current set of changes. */ WatchChangeAggregator.prototype.handleTargetChange = function (targetChange) { var _this = this; this.forEachTarget(targetChange, function (targetId) { var targetState = _this.ensureTargetState(targetId); switch (targetChange.state) { case WatchTargetChangeState.NoChange: if (_this.isActiveTarget(targetId)) { targetState.updateResumeToken(targetChange.resumeToken); } break; case WatchTargetChangeState.Added: // We need to decrement the number of pending acks needed from watch // for this targetId. targetState.recordTargetResponse(); if (!targetState.isPending) { // We have a freshly added target, so we need to reset any state // that we had previously. This can happen e.g. when remove and add // back a target for existence filter mismatches. targetState.clearPendingChanges(); } targetState.updateResumeToken(targetChange.resumeToken); break; case WatchTargetChangeState.Removed: // We need to keep track of removed targets to we can post-filter and // remove any target changes. // We need to decrement the number of pending acks needed from watch // for this targetId. targetState.recordTargetResponse(); if (!targetState.isPending) { _this.removeTarget(targetId); } assert(!targetChange.cause, 'WatchChangeAggregator does not handle errored targets'); break; case WatchTargetChangeState.Current: if (_this.isActiveTarget(targetId)) { targetState.markCurrent(); targetState.updateResumeToken(targetChange.resumeToken); } break; case WatchTargetChangeState.Reset: if (_this.isActiveTarget(targetId)) { // Reset the target and synthesizes removes for all existing // documents. The backend will re-add any documents that still // match the target before it sends the next global snapshot. _this.resetTarget(targetId); targetState.updateResumeToken(targetChange.resumeToken); } break; default: fail('Unknown target watch change state: ' + targetChange.state); } }); }; /** * Iterates over all targetIds that the watch change applies to: either the * targetIds explicitly listed in the change or the targetIds of all currently * active targets. */ WatchChangeAggregator.prototype.forEachTarget = function (targetChange, fn) { if (targetChange.targetIds.length > 0) { targetChange.targetIds.forEach(fn); } else { forEachNumber(this.targetStates, fn); } }; /** * Handles existence filters and synthesizes deletes for filter mismatches. * Targets that are invalidated by filter mismatches are added to * `pendingTargetResets`. */ WatchChangeAggregator.prototype.handleExistenceFilter = function (watchChange) { var targetId = watchChange.targetId; var expectedCount = watchChange.existenceFilter.count; var queryData = this.queryDataForActiveTarget(targetId); if (queryData) { var query = queryData.query; if (query.isDocumentQuery()) { if (expectedCount === 0) { // The existence filter told us the document does not exist. We deduce // that this document does not exist and apply a deleted document to // our updates. Without applying this deleted document there might be // another query that will raise this document as part of a snapshot // until it is resolved, essentially exposing inconsistency between // queries. var key = new DocumentKey(query.path); this.removeDocumentFromTarget(targetId, key, new NoDocument(key, SnapshotVersion.forDeletedDoc())); } else { assert(expectedCount === 1, 'Single document existence filter with count: ' + expectedCount); } } else { var currentSize = this.getCurrentDocumentCountForTarget(targetId); if (currentSize !== expectedCount) { // Existence filter mismatch: We reset the mapping and raise a new // snapshot with `isFromCache:true`. this.resetTarget(targetId); this.pendingTargetResets = this.pendingTargetResets.add(targetId); } } } }; /** * Converts the currently accumulated state into a remote event at the * provided snapshot version. Resets the accumulated changes before returning. */ WatchChangeAggregator.prototype.createRemoteEvent = function (snapshotVersion) { var _this = this; var targetChanges = {}; forEachNumber(this.targetStates, function (targetId, targetState) { var queryData = _this.queryDataForActiveTarget(targetId); if (queryData) { if (targetState.current && queryData.query.isDocumentQuery()) { // Document queries for document that don't exist can produce an empty // result set. To update our local cache, we synthesize a document // delete if we have not previously received the document. This // resolves the limbo state of the document, removing it from // limboDocumentRefs. // // TODO(dimond): Ideally we would have an explicit lookup query // instead resulting in an explicit delete message and we could // remove this special logic. var key = new DocumentKey(queryData.query.path); if (_this.pendingDocumentUpdates.get(key) === null && !_this.targetContainsDocument(targetId, key)) { _this.removeDocumentFromTarget(targetId, key, new NoDocument(key, snapshotVersion)); } } if (targetState.hasPendingChanges) { targetChanges[targetId] = targetState.toTargetChange(); targetState.clearPendingChanges(); } } }); var resolvedLimboDocuments = documentKeySet(); // We extract the set of limbo-only document updates as the GC logic // special-cases documents that do not appear in the query cache. // // TODO(gsoltis): Expand on this comment once GC is available in the JS // client. this.pendingDocumentTargetMapping.forEach(function (key, targets) { var isOnlyLimboTarget = true; targets.forEachWhile(function (targetId) { var queryData = _this.queryDataForActiveTarget(targetId); if (queryData && queryData.purpose !== QueryPurpose.LimboResolution) { isOnlyLimboTarget = false; return false; } return true; }); if (isOnlyLimboTarget) { resolvedLimboDocuments = resolvedLimboDocuments.add(key); } }); var remoteEvent = new RemoteEvent(snapshotVersion, targetChanges, this.pendingTargetResets, this.pendingDocumentUpdates, resolvedLimboDocuments); this.pendingDocumentUpdates = maybeDocumentMap(); this.pendingDocumentTargetMapping = documentTargetMap(); this.pendingTargetResets = new SortedSet(primitiveComparator); return remoteEvent; }; /** * Adds the provided document to the internal list of document updates and * its document key to the given target's mapping. */ // Visible for testing. WatchChangeAggregator.prototype.addDocumentToTarget = function (targetId, document) { if (!this.isActiveTarget(targetId)) { return; } var changeType = this.targetContainsDocument(targetId, document.key) ? ChangeType.Modified : ChangeType.Added; var targetState = this.ensureTargetState(targetId); targetState.addDocumentChange(document.key, changeType); this.pendingDocumentUpdates = this.pendingDocumentUpdates.insert(document.key, document); this.pendingDocumentTargetMapping = this.pendingDocumentTargetMapping.insert(document.key, this.ensureDocumentTargetMapping(document.key).add(targetId)); }; /** * Removes the provided document from the target mapping. If the * document no longer matches the target, but the document's state is still * known (e.g. we know that the document was deleted or we received the change * that caused the filter mismatch), the new document can be provided * to update the remote document cache. */ // Visible for testing. WatchChangeAggregator.prototype.removeDocumentFromTarget = function (targetId, key, updatedDocument) { if (!this.isActiveTarget(targetId)) { return; } var targetState = this.ensureTargetState(targetId); if (this.targetContainsDocument(targetId, key)) { targetState.addDocumentChange(key, ChangeType.Removed); } else { // The document may have entered and left the target before we raised a // snapshot, so we can just ignore the change. targetState.removeDocumentChange(key); } this.pendingDocumentTargetMapping = this.pendingDocumentTargetMapping.insert(key, this.ensureDocumentTargetMapping(key).delete(targetId)); if (updatedDocument) { this.pendingDocumentUpdates = this.pendingDocumentUpdates.insert(key, updatedDocument); } }; WatchChangeAggregator.prototype.removeTarget = function (targetId) { delete this.targetStates[targetId]; }; /** * Returns the current count of documents in the target. This includes both * the number of documents that the LocalStore considers to be part of the * target as well as any accumulated changes. */ WatchChangeAggregator.prototype.getCurrentDocumentCountForTarget = function (targetId) { var targetState = this.ensureTargetState(targetId); var targetChange = targetState.toTargetChange(); return (this.metadataProvider.getRemoteKeysForTarget(targetId).size + targetChange.addedDocuments.size - targetChange.removedDocuments.size); }; /** * Increment the number of acks needed from watch before we can consider the * server to be 'in-sync' with the client's active targets. */ WatchChangeAggregator.prototype.recordPendingTargetRequest = function (targetId) { // For each request we get we need to record we need a response for it. var targetState = this.ensureTargetState(targetId); targetState.recordPendingTargetRequest(); }; WatchChangeAggregator.prototype.ensureTargetState = function (targetId) { if (!this.targetStates[targetId]) { this.targetStates[targetId] = new TargetState(); } return this.targetStates[targetId]; }; WatchChangeAggregator.prototype.ensureDocumentTargetMapping = function (key) { var targetMapping = this.pendingDocumentTargetMapping.get(key); if (!targetMapping) { targetMapping = new SortedSet(primitiveComparator); this.pendingDocumentTargetMapping = this.pendingDocumentTargetMapping.insert(key, targetMapping); } return targetMapping; }; /** * Verifies that the user is still interested in this target (by calling * `getQueryDataForTarget()`) and that we are not waiting for pending ADDs * from watch. */ WatchChangeAggregator.prototype.isActiveTarget = function (targetId) { return this.queryDataForActiveTarget(targetId) !== null; }; /** * Returns the QueryData for an active target (i.e. a target that the user * is still interested in that has no outstanding target change requests). */ WatchChangeAggregator.prototype.queryDataForActiveTarget = function (targetId) { var targetState = this.targetStates[targetId]; return targetState && targetState.isPending ? null : this.metadataProvider.getQueryDataForTarget(targetId); }; /** * Resets the state of a Watch target to its initial state (e.g. sets * 'current' to false, clears the resume token and removes its target mapping * from all documents). */ WatchChangeAggregator.prototype.resetTarget = function (targetId) { var _this = this; assert(!this.targetStates[targetId].isPending, 'Should only reset active targets'); this.targetStates[targetId] = new TargetState(); // Trigger removal for any documents currently mapped to this target. // These removals will be part of the initial snapshot if Watch does not // resend these documents. var existingKeys = this.metadataProvider.getRemoteKeysForTarget(targetId); existingKeys.forEach(function (key) { _this.removeDocumentFromTarget(targetId, key, /*updatedDocument=*/ null); }); }; /** * Returns whether the LocalStore considers the document to be part of the * specified target. */ WatchChangeAggregator.prototype.targetContainsDocument = function (targetId, key) { var existingKeys = this.metadataProvider.getRemoteKeysForTarget(targetId); return existingKeys.has(key); }; return WatchChangeAggregator; }()); function documentTargetMap() { return new SortedMap(DocumentKey.comparator); } function snapshotChangesMap() { return new SortedMap(DocumentKey.comparator); } /** * Copyright 2017 Google Inc. * * 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. */ var DIRECTIONS = (function () { var dirs = {}; dirs[Direction.ASCENDING.name] = 'ASCENDING'; dirs[Direction.DESCENDING.name] = 'DESCENDING'; return dirs; })(); var OPERATORS = (function () { var ops = {}; ops[RelationOp.LESS_THAN.name] = 'LESS_THAN'; ops[RelationOp.LESS_THAN_OR_EQUAL.name] = 'LESS_THAN_OR_EQUAL'; ops[RelationOp.GREATER_THAN.name] = 'GREATER_THAN'; ops[RelationOp.GREATER_THAN_OR_EQUAL.name] = 'GREATER_THAN_OR_EQUAL'; ops[RelationOp.EQUAL.name] = 'EQUAL'; ops[RelationOp.ARRAY_CONTAINS.name] = 'ARRAY_CONTAINS'; return ops; })(); // A RegExp matching ISO 8601 UTC timestamps with optional fraction. var ISO_REG_EXP = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/); function assertPresent(value, description) { assert(!isNullOrUndefined(value), description + ' is missing'); } function parseInt64(value) { // TODO(bjornick): Handle int64 greater than 53 bits. if (typeof value === 'number') { return value; } else if (typeof value === 'string') { return Number(value); } else { return fail("can't parse " + value); } } /** * Generates JsonObject values for the Datastore API suitable for sending to * either GRPC stub methods or via the JSON/HTTP REST API. * TODO(klimt): We can remove the databaseId argument if we keep the full * resource name in documents. */ var JsonProtoSerializer = /** @class */ (function () { function JsonProtoSerializer(databaseId, options) { this.databaseId = databaseId; this.options = options; } JsonProtoSerializer.prototype.emptyByteString = function () { if (this.options.useProto3Json) { return ''; } else { return new Uint8Array(0); } }; JsonProtoSerializer.prototype.unsafeCastProtoByteString = function (byteString) { // byteStrings can be either string or UInt8Array, but the typings say // it's always a string. Cast as string to avoid type check failing return byteString; }; JsonProtoSerializer.prototype.fromRpcStatus = function (status) { var code = status.code === undefined ? Code.UNKNOWN : mapCodeFromRpcCode(status.code); return new FirestoreError(code, status.message || ''); }; /** * Returns a value for a number (or undefined) that's appropriate to put into * a google.protobuf.Int32Value proto. * DO NOT USE THIS FOR ANYTHING ELSE. * This method cheats. It's typed as returning "number" because that's what * our generated proto interfaces say Int32Value must be. But GRPC actually * expects a { value: } struct. */ JsonProtoSerializer.prototype.toInt32Value = function (val) { if (!isNullOrUndefined(val)) { // tslint:disable-next-line:no-any We need to match generated Proto types. return { value: val }; } else { return undefined; } }; /** * Returns a number (or null) from a google.protobuf.Int32Value proto. * DO NOT USE THIS FOR ANYTHING ELSE. * This method cheats. It's typed as accepting "number" because that's what * our generated proto interfaces say Int32Value must be, but it actually * accepts { value: number } to match our serialization in toInt32Value(). */ JsonProtoSerializer.prototype.fromInt32Value = function (val) { var result; if (typeof val === 'object') { // tslint:disable-next-line:no-any We need to match generated Proto types. result = val.value; } else { // We accept raw numbers (without the {value: ... } wrapper) for // compatibility with legacy persisted data. result = val; } return isNullOrUndefined(result) ? null : result; }; /** * Returns a value for a Date that's appropriate to put into a proto. * DO NOT USE THIS FOR ANYTHING ELSE. * This method cheats. It's typed as returning "string" because that's what * our generated proto interfaces say dates must be. But it's easier and safer * to actually return a Timestamp proto. */ JsonProtoSerializer.prototype.toTimestamp = function (timestamp) { return { seconds: timestamp.seconds, nanos: timestamp.nanoseconds // tslint:disable-next-line:no-any }; }; JsonProtoSerializer.prototype.fromTimestamp = function (date) { // The json interface (for the browser) will return an iso timestamp string, // while the proto js library (for node) will return a // google.protobuf.Timestamp instance. if (typeof date === 'string') { // TODO(b/37282237): Use strings for Proto3 timestamps // assert(this.options.useProto3Json, // 'The timestamp string format requires Proto3.'); return this.fromIso8601String(date); } else { assert(!!date, 'Cannot deserialize null or undefined timestamp.'); // TODO(b/37282237): Use strings for Proto3 timestamps // assert(!this.options.useProto3Json, // 'The timestamp instance format requires Proto JS.'); var seconds = parseInt64(date.seconds || '0'); var nanos = date.nanos || 0; return new Timestamp(seconds, nanos); } }; JsonProtoSerializer.prototype.fromIso8601String = function (utc) { // The date string can have higher precision (nanos) than the Date class // (millis), so we do some custom parsing here. // Parse the nanos right out of the string. var nanos = 0; var fraction = ISO_REG_EXP.exec(utc); assert(!!fraction, 'invalid timestamp: ' + utc); if (fraction[1]) { // Pad the fraction out to 9 digits (nanos). var nanoStr = fraction[1]; nanoStr = (nanoStr + '000000000').substr(0, 9); nanos = Number(nanoStr); } // Parse the date to get the seconds. var date = new Date(utc); var seconds = Math.floor(date.getTime() / 1000); return new Timestamp(seconds, nanos); }; /** * Returns a value for bytes that's appropriate to put in a proto. * DO NOT USE THIS FOR ANYTHING ELSE. * This method cheats. It's typed as returning "string" because that's what * our generated proto interfaces say bytes must be. But it should return * an Uint8Array in Node. */ JsonProtoSerializer.prototype.toBytes = function (bytes) { if (this.options.useProto3Json) { return bytes.toBase64(); } else { // The typings say it's a string, but it needs to be a Uint8Array in Node. return this.unsafeCastProtoByteString(bytes.toUint8Array()); } }; /** * Parse the blob from the protos into the internal Blob class. Note that the * typings assume all blobs are strings, but they are actually Uint8Arrays * on Node. */ JsonProtoSerializer.prototype.fromBlob = function (blob) { if (typeof blob === 'string') { assert(this.options.useProto3Json, 'Expected bytes to be passed in as Uint8Array, but got a string instead.'); return Blob.fromBase64String(blob); } else { assert(!this.options.useProto3Json, 'Expected bytes to be passed in as string, but got something else instead.'); return Blob.fromUint8Array(blob); } }; JsonProtoSerializer.prototype.toVersion = function (version) { return this.toTimestamp(version.toTimestamp()); }; JsonProtoSerializer.prototype.fromVersion = function (version) { assert(!!version, "Trying to deserialize version that isn't set"); return SnapshotVersion.fromTimestamp(this.fromTimestamp(version)); }; JsonProtoSerializer.prototype.toResourceName = function (databaseId, path) { return this.fullyQualifiedPrefixPath(databaseId) .child('documents') .child(path) .canonicalString(); }; JsonProtoSerializer.prototype.fromResourceName = function (name) { var resource = ResourcePath.fromString(name); assert(this.isValidResourceName(resource), 'Tried to deserialize invalid key ' + resource.toString()); return resource; }; JsonProtoSerializer.prototype.toName = function (key) { return this.toResourceName(this.databaseId, key.path); }; JsonProtoSerializer.prototype.fromName = function (name) { var resource = this.fromResourceName(name); assert(resource.get(1) === this.databaseId.projectId, 'Tried to deserialize key from different project: ' + resource.get(1) + ' vs ' + this.databaseId.projectId); assert((!resource.get(3) && !this.databaseId.database) || resource.get(3) === this.databaseId.database, 'Tried to deserialize key from different database: ' + resource.get(3) + ' vs ' + this.databaseId.database); return new DocumentKey(this.extractLocalPathFromResourceName(resource)); }; JsonProtoSerializer.prototype.toQueryPath = function (path) { if (path.length === 0) { // If the path is empty, the backend requires we leave off the /documents // at the end. return this.encodedDatabaseId; } return this.toResourceName(this.databaseId, path); }; JsonProtoSerializer.prototype.fromQueryPath = function (name) { var resourceName = this.fromResourceName(name); if (resourceName.length === 4) { return ResourcePath.EMPTY_PATH; } return this.extractLocalPathFromResourceName(resourceName); }; Object.defineProperty(JsonProtoSerializer.prototype, "encodedDatabaseId", { get: function () { var path = new ResourcePath([ 'projects', this.databaseId.projectId, 'databases', this.databaseId.database ]); return path.canonicalString(); }, enumerable: true, configurable: true }); JsonProtoSerializer.prototype.fullyQualifiedPrefixPath = function (databaseId) { return new ResourcePath([ 'projects', databaseId.projectId, 'databases', databaseId.database ]); }; JsonProtoSerializer.prototype.extractLocalPathFromResourceName = function (resourceName) { assert(resourceName.length > 4 && resourceName.get(4) === 'documents', 'tried to deserialize invalid key ' + resourceName.toString()); return resourceName.popFirst(5); }; JsonProtoSerializer.prototype.isValidResourceName = function (path) { // Resource names have at least 4 components (project ID, database ID) return (path.length >= 4 && path.get(0) === 'projects' && path.get(2) === 'databases'); }; JsonProtoSerializer.prototype.toValue = function (val) { if (val instanceof NullValue) { return { nullValue: 'NULL_VALUE' }; } else if (val instanceof BooleanValue) { return { booleanValue: val.value() }; } else if (val instanceof IntegerValue) { return { integerValue: '' + val.value() }; } else if (val instanceof DoubleValue) { var doubleValue = val.value(); if (this.options.useProto3Json) { // Proto 3 let's us encode NaN and Infinity as string values as // expected by the backend. This is currently not checked by our unit // tests because they rely on protobuf.js. if (isNaN(doubleValue)) { return { doubleValue: 'NaN' }; } else if (doubleValue === Infinity) { return { doubleValue: 'Infinity' }; } else if (doubleValue === -Infinity) { return { doubleValue: '-Infinity' }; } } return { doubleValue: val.value() }; } else if (val instanceof StringValue) { return { stringValue: val.value() }; } else if (val instanceof ObjectValue) { return { mapValue: this.toMapValue(val) }; } else if (val instanceof ArrayValue) { return { arrayValue: this.toArrayValue(val) }; } else if (val instanceof TimestampValue) { return { timestampValue: this.toTimestamp(val.internalValue) }; } else if (val instanceof GeoPointValue) { return { geoPointValue: { latitude: val.value().latitude, longitude: val.value().longitude } }; } else if (val instanceof BlobValue) { return { bytesValue: this.toBytes(val.value()) }; } else if (val instanceof RefValue) { return { referenceValue: this.toResourceName(val.databaseId, val.key.path) }; } else { return fail('Unknown FieldValue ' + JSON.stringify(val)); } }; JsonProtoSerializer.prototype.fromValue = function (obj) { var _this = this; // tslint:disable-next-line:no-any var type = obj['value_type']; if (hasTag(obj, type, 'nullValue')) { return NullValue.INSTANCE; } else if (hasTag(obj, type, 'booleanValue')) { return BooleanValue.of(obj.booleanValue); } else if (hasTag(obj, type, 'integerValue')) { return new IntegerValue(parseInt64(obj.integerValue)); } else if (hasTag(obj, type, 'doubleValue')) { if (this.options.useProto3Json) { // Proto 3 uses the string values 'NaN' and 'Infinity'. if (obj.doubleValue === 'NaN') { return DoubleValue.NAN; } else if (obj.doubleValue === 'Infinity') { return DoubleValue.POSITIVE_INFINITY; } else if (obj.doubleValue === '-Infinity') { return DoubleValue.NEGATIVE_INFINITY; } } return new DoubleValue(obj.doubleValue); } else if (hasTag(obj, type, 'stringValue')) { return new StringValue(obj.stringValue); } else if (hasTag(obj, type, 'mapValue')) { return this.fromFields(obj.mapValue.fields || {}); } else if (hasTag(obj, type, 'arrayValue')) { // "values" is not present if the array is empty assertPresent(obj.arrayValue, 'arrayValue'); var values$$1 = obj.arrayValue.values || []; return new ArrayValue(values$$1.map(function (v) { return _this.fromValue(v); })); } else if (hasTag(obj, type, 'timestampValue')) { assertPresent(obj.timestampValue, 'timestampValue'); return new TimestampValue(this.fromTimestamp(obj.timestampValue)); } else if (hasTag(obj, type, 'geoPointValue')) { assertPresent(obj.geoPointValue, 'geoPointValue'); var latitude = obj.geoPointValue.latitude || 0; var longitude = obj.geoPointValue.longitude || 0; return new GeoPointValue(new GeoPoint(latitude, longitude)); } else if (hasTag(obj, type, 'bytesValue')) { assertPresent(obj.bytesValue, 'bytesValue'); var blob = this.fromBlob(obj.bytesValue); return new BlobValue(blob); } else if (hasTag(obj, type, 'referenceValue')) { assertPresent(obj.referenceValue, 'referenceValue'); var resourceName = this.fromResourceName(obj.referenceValue); var dbId = new DatabaseId(resourceName.get(1), resourceName.get(3)); var key = new DocumentKey(this.extractLocalPathFromResourceName(resourceName)); return new RefValue(dbId, key); } else { return fail('Unknown Value proto ' + JSON.stringify(obj)); } }; /** Creates an api.Document from key and fields (but no create/update time) */ JsonProtoSerializer.prototype.toMutationDocument = function (key, fields) { return { name: this.toName(key), fields: this.toFields(fields) }; }; JsonProtoSerializer.prototype.toDocument = function (document) { assert(!document.hasLocalMutations, "Can't serialize documents with mutations."); return { name: this.toName(document.key), fields: this.toFields(document.data), updateTime: this.toTimestamp(document.version.toTimestamp()) }; }; JsonProtoSerializer.prototype.fromDocument = function (document, hasCommittedMutations) { return new Document(this.fromName(document.name), this.fromVersion(document.updateTime), this.fromFields(document.fields || {}), { hasCommittedMutations: !!hasCommittedMutations }); }; JsonProtoSerializer.prototype.toFields = function (fields) { var _this = this; var result = {}; fields.forEach(function (key, value) { result[key] = _this.toValue(value); }); return result; }; JsonProtoSerializer.prototype.fromFields = function (object) { var _this = this; // Proto map gets mapped to Object, so cast it. var map = object; var result = ObjectValue.EMPTY; forEach(map, function (key, value) { result = result.set(new FieldPath([key]), _this.fromValue(value)); }); return result; }; JsonProtoSerializer.prototype.toMapValue = function (map) { return { fields: this.toFields(map) }; }; JsonProtoSerializer.prototype.toArrayValue = function (array) { var _this = this; var result = []; array.forEach(function (value) { result.push(_this.toValue(value)); }); return { values: result }; }; JsonProtoSerializer.prototype.fromFound = function (doc) { assert(!!doc.found, 'Tried to deserialize a found document from a missing document.'); assertPresent(doc.found.name, 'doc.found.name'); assertPresent(doc.found.updateTime, 'doc.found.updateTime'); var key = this.fromName(doc.found.name); var version = this.fromVersion(doc.found.updateTime); var fields = this.fromFields(doc.found.fields || {}); return new Document(key, version, fields, {}); }; JsonProtoSerializer.prototype.fromMissing = function (result) { assert(!!result.missing, 'Tried to deserialize a missing document from a found document.'); assert(!!result.readTime, 'Tried to deserialize a missing document without a read time.'); var key = this.fromName(result.missing); var version = this.fromVersion(result.readTime); return new NoDocument(key, version); }; JsonProtoSerializer.prototype.fromMaybeDocument = function (result) { // tslint:disable-next-line:no-any var type = result['result']; if (hasTag(result, type, 'found')) { return this.fromFound(result); } else if (hasTag(result, type, 'missing')) { return this.fromMissing(result); } return fail('invalid batch get response: ' + JSON.stringify(result)); }; JsonProtoSerializer.prototype.toWatchTargetChangeState = function (state) { switch (state) { case WatchTargetChangeState.Added: return 'ADD'; case WatchTargetChangeState.Current: return 'CURRENT'; case WatchTargetChangeState.NoChange: return 'NO_CHANGE'; case WatchTargetChangeState.Removed: return 'REMOVE'; case WatchTargetChangeState.Reset: return 'RESET'; default: return fail('Unknown WatchTargetChangeState: ' + state); } }; JsonProtoSerializer.prototype.toTestWatchChange = function (watchChange) { if (watchChange instanceof ExistenceFilterChange) { return { filter: { count: watchChange.existenceFilter.count, targetId: watchChange.targetId } }; } if (watchChange instanceof DocumentWatchChange) { if (watchChange.newDoc instanceof Document) { var doc = watchChange.newDoc; return { documentChange: { document: { name: this.toName(doc.key), fields: this.toFields(doc.data), updateTime: this.toVersion(doc.version) }, targetIds: watchChange.updatedTargetIds, removedTargetIds: watchChange.removedTargetIds } }; } else if (watchChange.newDoc instanceof NoDocument) { var doc = watchChange.newDoc; return { documentDelete: { document: this.toName(doc.key), readTime: this.toVersion(doc.version), removedTargetIds: watchChange.removedTargetIds } }; } else if (watchChange.newDoc === null) { return { documentRemove: { document: this.toName(watchChange.key), removedTargetIds: watchChange.removedTargetIds } }; } } if (watchChange instanceof WatchTargetChange) { var cause = undefined; if (watchChange.cause) { cause = { code: mapRpcCodeFromCode(watchChange.cause.code), message: watchChange.cause.message }; } return { targetChange: { targetChangeType: this.toWatchTargetChangeState(watchChange.state), targetIds: watchChange.targetIds, resumeToken: this.unsafeCastProtoByteString(watchChange.resumeToken), cause: cause } }; } return fail('Unrecognized watch change: ' + JSON.stringify(watchChange)); }; JsonProtoSerializer.prototype.fromWatchChange = function (change) { // tslint:disable-next-line:no-any var type = change['response_type']; var watchChange; if (hasTag(change, type, 'targetChange')) { assertPresent(change.targetChange, 'targetChange'); // proto3 default value is unset in JSON (undefined), so use 'NO_CHANGE' // if unset var state = this.fromWatchTargetChangeState(change.targetChange.targetChangeType || 'NO_CHANGE'); var targetIds = change.targetChange.targetIds || []; var resumeToken = change.targetChange.resumeToken || this.emptyByteString(); var causeProto = change.targetChange.cause; var cause = causeProto && this.fromRpcStatus(causeProto); watchChange = new WatchTargetChange(state, targetIds, resumeToken, cause || null); } else if (hasTag(change, type, 'documentChange')) { assertPresent(change.documentChange, 'documentChange'); assertPresent(change.documentChange.document, 'documentChange.name'); assertPresent(change.documentChange.document.name, 'documentChange.document.name'); assertPresent(change.documentChange.document.updateTime, 'documentChange.document.updateTime'); var entityChange = change.documentChange; var key = this.fromName(entityChange.document.name); var version = this.fromVersion(entityChange.document.updateTime); var fields = this.fromFields(entityChange.document.fields || {}); var doc = new Document(key, version, fields, {}); var updatedTargetIds = entityChange.targetIds || []; var removedTargetIds = entityChange.removedTargetIds || []; watchChange = new DocumentWatchChange(updatedTargetIds, removedTargetIds, doc.key, doc); } else if (hasTag(change, type, 'documentDelete')) { assertPresent(change.documentDelete, 'documentDelete'); assertPresent(change.documentDelete.document, 'documentDelete.document'); var docDelete = change.documentDelete; var key = this.fromName(docDelete.document); var version = docDelete.readTime ? this.fromVersion(docDelete.readTime) : SnapshotVersion.forDeletedDoc(); var doc = new NoDocument(key, version); var removedTargetIds = docDelete.removedTargetIds || []; watchChange = new DocumentWatchChange([], removedTargetIds, doc.key, doc); } else if (hasTag(change, type, 'documentRemove')) { assertPresent(change.documentRemove, 'documentRemove'); assertPresent(change.documentRemove.document, 'documentRemove'); var docRemove = change.documentRemove; var key = this.fromName(docRemove.document); var removedTargetIds = docRemove.removedTargetIds || []; watchChange = new DocumentWatchChange([], removedTargetIds, key, null); } else if (hasTag(change, type, 'filter')) { // TODO(dimond): implement existence filter parsing with strategy. assertPresent(change.filter, 'filter'); assertPresent(change.filter.targetId, 'filter.targetId'); var filter = change.filter; var count = filter.count || 0; var existenceFilter = new ExistenceFilter(count); var targetId = filter.targetId; watchChange = new ExistenceFilterChange(targetId, existenceFilter); } else { return fail('Unknown change type ' + JSON.stringify(change)); } return watchChange; }; JsonProtoSerializer.prototype.fromWatchTargetChangeState = function (state) { if (state === 'NO_CHANGE') { return WatchTargetChangeState.NoChange; } else if (state === 'ADD') { return WatchTargetChangeState.Added; } else if (state === 'REMOVE') { return WatchTargetChangeState.Removed; } else if (state === 'CURRENT') { return WatchTargetChangeState.Current; } else if (state === 'RESET') { return WatchTargetChangeState.Reset; } else { return fail('Got unexpected TargetChange.state: ' + state); } }; JsonProtoSerializer.prototype.versionFromListenResponse = function (change) { // We have only reached a consistent snapshot for the entire stream if there // is a read_time set and it applies to all targets (i.e. the list of // targets is empty). The backend is guaranteed to send such responses. // tslint:disable-next-line:no-any var type = change['response_type']; if (!hasTag(change, type, 'targetChange')) { return SnapshotVersion.MIN; } var targetChange = change.targetChange; if (targetChange.targetIds && targetChange.targetIds.length) { return SnapshotVersion.MIN; } if (!targetChange.readTime) { return SnapshotVersion.MIN; } return this.fromVersion(targetChange.readTime); }; JsonProtoSerializer.prototype.toMutation = function (mutation) { var _this = this; var result; if (mutation instanceof SetMutation) { result = { update: this.toMutationDocument(mutation.key, mutation.value) }; } else if (mutation instanceof DeleteMutation) { result = { delete: this.toName(mutation.key) }; } else if (mutation instanceof PatchMutation) { result = { update: this.toMutationDocument(mutation.key, mutation.data), updateMask: this.toDocumentMask(mutation.fieldMask) }; } else if (mutation instanceof TransformMutation) { result = { transform: { document: this.toName(mutation.key), fieldTransforms: mutation.fieldTransforms.map(function (transform) { return _this.toFieldTransform(transform); }) } }; } else { return fail('Unknown mutation type ' + mutation.type); } if (!mutation.precondition.isNone) { result.currentDocument = this.toPrecondition(mutation.precondition); } return result; }; JsonProtoSerializer.prototype.fromMutation = function (proto) { var _this = this; var precondition = proto.currentDocument ? this.fromPrecondition(proto.currentDocument) : Precondition.NONE; if (proto.update) { assertPresent(proto.update.name, 'name'); var key = this.fromName(proto.update.name); var value = this.fromFields(proto.update.fields || {}); if (proto.updateMask) { var fieldMask = this.fromDocumentMask(proto.updateMask); return new PatchMutation(key, value, fieldMask, precondition); } else { return new SetMutation(key, value, precondition); } } else if (proto.delete) { var key = this.fromName(proto.delete); return new DeleteMutation(key, precondition); } else if (proto.transform) { var key = this.fromName(proto.transform.document); var fieldTransforms = proto.transform.fieldTransforms.map(function (transform) { return _this.fromFieldTransform(transform); }); assert(precondition.exists === true, 'Transforms only support precondition "exists == true"'); return new TransformMutation(key, fieldTransforms); } else { return fail('unknown mutation proto: ' + JSON.stringify(proto)); } }; JsonProtoSerializer.prototype.toPrecondition = function (precondition) { assert(!precondition.isNone, "Can't serialize an empty precondition"); if (precondition.updateTime !== undefined) { return { updateTime: this.toVersion(precondition.updateTime) }; } else if (precondition.exists !== undefined) { return { exists: precondition.exists }; } else { return fail('Unknown precondition'); } }; JsonProtoSerializer.prototype.fromPrecondition = function (precondition) { if (precondition.updateTime !== undefined) { return Precondition.updateTime(this.fromVersion(precondition.updateTime)); } else if (precondition.exists !== undefined) { return Precondition.exists(precondition.exists); } else { return Precondition.NONE; } }; JsonProtoSerializer.prototype.fromWriteResult = function (proto, commitTime) { var _this = this; // NOTE: Deletes don't have an updateTime. var version = proto.updateTime ? this.fromVersion(proto.updateTime) : this.fromVersion(commitTime); var transformResults = null; if (proto.transformResults && proto.transformResults.length > 0) { transformResults = proto.transformResults.map(function (result) { return _this.fromValue(result); }); } return new MutationResult(version, transformResults); }; JsonProtoSerializer.prototype.fromWriteResults = function (protos, commitTime) { var _this = this; if (protos && protos.length > 0) { assert(commitTime !== undefined, 'Received a write result without a commit time'); return protos.map(function (proto) { return _this.fromWriteResult(proto, commitTime); }); } else { return []; } }; JsonProtoSerializer.prototype.toFieldTransform = function (fieldTransform) { var _this = this; var transform = fieldTransform.transform; if (transform instanceof ServerTimestampTransform) { return { fieldPath: fieldTransform.field.canonicalString(), setToServerValue: 'REQUEST_TIME' }; } else if (transform instanceof ArrayUnionTransformOperation) { return { fieldPath: fieldTransform.field.canonicalString(), appendMissingElements: { values: transform.elements.map(function (v) { return _this.toValue(v); }) } }; } else if (transform instanceof ArrayRemoveTransformOperation) { return { fieldPath: fieldTransform.field.canonicalString(), removeAllFromArray: { values: transform.elements.map(function (v) { return _this.toValue(v); }) } }; } else { throw fail('Unknown transform: ' + fieldTransform.transform); } }; JsonProtoSerializer.prototype.fromFieldTransform = function (proto) { var _this = this; // tslint:disable-next-line:no-any We need to match generated Proto types. var type = proto['transform_type']; var transform = null; if (hasTag(proto, type, 'setToServerValue')) { assert(proto.setToServerValue === 'REQUEST_TIME', 'Unknown server value transform proto: ' + JSON.stringify(proto)); transform = ServerTimestampTransform.instance; } else if (hasTag(proto, type, 'appendMissingElements')) { var values$$1 = proto.appendMissingElements.values || []; transform = new ArrayUnionTransformOperation(values$$1.map(function (v) { return _this.fromValue(v); })); } else if (hasTag(proto, type, 'removeAllFromArray')) { var values$$1 = proto.removeAllFromArray.values || []; transform = new ArrayRemoveTransformOperation(values$$1.map(function (v) { return _this.fromValue(v); })); } else { fail('Unknown transform proto: ' + JSON.stringify(proto)); } var fieldPath = FieldPath.fromServerFormat(proto.fieldPath); return new FieldTransform(fieldPath, transform); }; JsonProtoSerializer.prototype.toDocumentsTarget = function (query) { return { documents: [this.toQueryPath(query.path)] }; }; JsonProtoSerializer.prototype.fromDocumentsTarget = function (documentsTarget) { var count = documentsTarget.documents.length; assert(count === 1, 'DocumentsTarget contained other than 1 document: ' + count); var name = documentsTarget.documents[0]; return Query.atPath(this.fromQueryPath(name)); }; JsonProtoSerializer.prototype.toQueryTarget = function (query) { // Dissect the path into parent, collectionId, and optional key filter. var result = { structuredQuery: {} }; if (query.path.isEmpty()) { result.parent = this.toQueryPath(ResourcePath.EMPTY_PATH); } else { var path = query.path; assert(path.length % 2 !== 0, 'Document queries with filters are not supported.'); result.parent = this.toQueryPath(path.popLast()); result.structuredQuery.from = [{ collectionId: path.lastSegment() }]; } var where = this.toFilter(query.filters); if (where) { result.structuredQuery.where = where; } var orderBy = this.toOrder(query.orderBy); if (orderBy) { result.structuredQuery.orderBy = orderBy; } var limit = this.toInt32Value(query.limit); if (limit !== undefined) { result.structuredQuery.limit = limit; } if (query.startAt) { result.structuredQuery.startAt = this.toCursor(query.startAt); } if (query.endAt) { result.structuredQuery.endAt = this.toCursor(query.endAt); } return result; }; JsonProtoSerializer.prototype.fromQueryTarget = function (target) { var path = this.fromQueryPath(target.parent); var query = target.structuredQuery; var fromCount = query.from ? query.from.length : 0; if (fromCount > 0) { assert(fromCount === 1, 'StructuredQuery.from with more than one collection is not supported.'); var from = query.from[0]; path = path.child(from.collectionId); } var filterBy = []; if (query.where) { filterBy = this.fromFilter(query.where); } var orderBy = []; if (query.orderBy) { orderBy = this.fromOrder(query.orderBy); } var limit = null; if (query.limit) { limit = this.fromInt32Value(query.limit); } var startAt = null; if (query.startAt) { startAt = this.fromCursor(query.startAt); } var endAt = null; if (query.endAt) { endAt = this.fromCursor(query.endAt); } return new Query(path, orderBy, filterBy, limit, startAt, endAt); }; JsonProtoSerializer.prototype.toListenRequestLabels = function (queryData) { var value = this.toLabel(queryData.purpose); if (value == null) { return null; } else { return { 'goog-listen-tags': value }; } }; JsonProtoSerializer.prototype.toLabel = function (purpose) { switch (purpose) { case QueryPurpose.Listen: return null; case QueryPurpose.ExistenceFilterMismatch: return 'existence-filter-mismatch'; case QueryPurpose.LimboResolution: return 'limbo-document'; default: return fail('Unrecognized query purpose: ' + purpose); } }; JsonProtoSerializer.prototype.toTarget = function (queryData) { var result; var query = queryData.query; if (query.isDocumentQuery()) { result = { documents: this.toDocumentsTarget(query) }; } else { result = { query: this.toQueryTarget(query) }; } result.targetId = queryData.targetId; if (queryData.resumeToken.length > 0) { result.resumeToken = this.unsafeCastProtoByteString(queryData.resumeToken); } return result; }; JsonProtoSerializer.prototype.toFilter = function (filters) { var _this = this; if (filters.length === 0) return; var protos = filters.map(function (filter) { return filter instanceof RelationFilter ? _this.toRelationFilter(filter) : _this.toUnaryFilter(filter); }); if (protos.length === 1) { return protos[0]; } return { compositeFilter: { op: 'AND', filters: protos } }; }; JsonProtoSerializer.prototype.fromFilter = function (filter) { var _this = this; if (!filter) { return []; } else if (filter.unaryFilter !== undefined) { return [this.fromUnaryFilter(filter)]; } else if (filter.fieldFilter !== undefined) { return [this.fromRelationFilter(filter)]; } else if (filter.compositeFilter !== undefined) { return filter.compositeFilter .filters.map(function (f) { return _this.fromFilter(f); }) .reduce(function (accum, current) { return accum.concat(current); }); } else { return fail('Unknown filter: ' + JSON.stringify(filter)); } }; JsonProtoSerializer.prototype.toOrder = function (orderBys) { var _this = this; if (orderBys.length === 0) return; return orderBys.map(function (order) { return _this.toPropertyOrder(order); }); }; JsonProtoSerializer.prototype.fromOrder = function (orderBys) { var _this = this; return orderBys.map(function (order) { return _this.fromPropertyOrder(order); }); }; JsonProtoSerializer.prototype.toCursor = function (cursor) { var _this = this; return { before: cursor.before, values: cursor.position.map(function (component) { return _this.toValue(component); }) }; }; JsonProtoSerializer.prototype.fromCursor = function (cursor) { var _this = this; var before = !!cursor.before; var position = cursor.values.map(function (component) { return _this.fromValue(component); }); return new Bound(position, before); }; // visible for testing JsonProtoSerializer.prototype.toDirection = function (dir) { return DIRECTIONS[dir.name]; }; // visible for testing JsonProtoSerializer.prototype.fromDirection = function (dir) { switch (dir) { case 'ASCENDING': return Direction.ASCENDING; case 'DESCENDING': return Direction.DESCENDING; default: return undefined; } }; // visible for testing JsonProtoSerializer.prototype.toOperatorName = function (op) { return OPERATORS[op.name]; }; JsonProtoSerializer.prototype.fromOperatorName = function (op) { switch (op) { case 'EQUAL': return RelationOp.EQUAL; case 'GREATER_THAN': return RelationOp.GREATER_THAN; case 'GREATER_THAN_OR_EQUAL': return RelationOp.GREATER_THAN_OR_EQUAL; case 'LESS_THAN': return RelationOp.LESS_THAN; case 'LESS_THAN_OR_EQUAL': return RelationOp.LESS_THAN_OR_EQUAL; case 'ARRAY_CONTAINS': return RelationOp.ARRAY_CONTAINS; case 'OPERATOR_UNSPECIFIED': return fail('Unspecified relation'); default: return fail('Unknown relation'); } }; JsonProtoSerializer.prototype.toFieldPathReference = function (path) { return { fieldPath: path.canonicalString() }; }; JsonProtoSerializer.prototype.fromFieldPathReference = function (fieldReference) { return FieldPath.fromServerFormat(fieldReference.fieldPath); }; // visible for testing JsonProtoSerializer.prototype.toPropertyOrder = function (orderBy) { return { field: this.toFieldPathReference(orderBy.field), direction: this.toDirection(orderBy.dir) }; }; JsonProtoSerializer.prototype.fromPropertyOrder = function (orderBy) { return new OrderBy(this.fromFieldPathReference(orderBy.field), this.fromDirection(orderBy.direction)); }; // visible for testing JsonProtoSerializer.prototype.toRelationFilter = function (filter) { if (filter instanceof RelationFilter) { return { fieldFilter: { field: this.toFieldPathReference(filter.field), op: this.toOperatorName(filter.op), value: this.toValue(filter.value) } }; } else { return fail('Unrecognized filter: ' + JSON.stringify(filter)); } }; JsonProtoSerializer.prototype.fromRelationFilter = function (filter) { return new RelationFilter(this.fromFieldPathReference(filter.fieldFilter.field), this.fromOperatorName(filter.fieldFilter.op), this.fromValue(filter.fieldFilter.value)); }; // visible for testing JsonProtoSerializer.prototype.toUnaryFilter = function (filter) { if (filter instanceof NanFilter) { return { unaryFilter: { field: this.toFieldPathReference(filter.field), op: 'IS_NAN' } }; } else if (filter instanceof NullFilter) { return { unaryFilter: { field: this.toFieldPathReference(filter.field), op: 'IS_NULL' } }; } else { return fail('Unrecognized filter: ' + JSON.stringify(filter)); } }; JsonProtoSerializer.prototype.fromUnaryFilter = function (filter) { switch (filter.unaryFilter.op) { case 'IS_NAN': var nanField = this.fromFieldPathReference(filter.unaryFilter.field); return new NanFilter(nanField); case 'IS_NULL': var nullField = this.fromFieldPathReference(filter.unaryFilter.field); return new NullFilter(nullField); case 'OPERATOR_UNSPECIFIED': return fail('Unspecified filter'); default: return fail('Unknown filter'); } }; JsonProtoSerializer.prototype.toDocumentMask = function (fieldMask) { return { fieldPaths: fieldMask.fields.map(function (field) { return field.canonicalString(); }) }; }; JsonProtoSerializer.prototype.fromDocumentMask = function (proto) { var paths = proto.fieldPaths || []; var fields = paths.map(function (path) { return FieldPath.fromServerFormat(path); }); return new FieldMask(fields); }; return JsonProtoSerializer; }()); /** * Checks for a specific oneof tag in a protocol buffer message. * * This intentionally accommodates two distinct cases: * * 1) Messages containing a type tag: these are the format produced by GRPC in * return values. These may contain default-value mappings for all tags in the * oneof but the type tag specifies which one was actually set. * * 2) Messages that don't contain a type tag: these are the format required by * GRPC as inputs. If we emitted objects with type tags, ProtoBuf.js would * choke claiming that the tags aren't fields in the Message. * * Allowing both formats here makes the serializer able to consume the outputs * it produces: for all messages it supports, fromX(toX(value)) == value. * * Note that case 2 suffers from ambiguity: if multiple tags are present * without a type tag then the callers are structured in such a way that the * first invocation will win. Since we only parse in this mode when parsing * the output of a serialize method this works, but it's not a general * solution. * * Unfortunately there is no general solution here because proto3 makes it * impossible to distinguish unset from explicitly set fields: both have the * default value for the type. Without the type tag but multiple value tags * it's possible to have default values for each tag in the oneof and not be * able to know which was actually in effect. */ function hasTag(obj, type, tag) { return type === tag || (!type && tag in obj); } /** * Detect React Native. * * @return {boolean} True if ReactNative environment is detected. */ var isReactNative = function () { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); }; var ERROR_NAME = 'FirebaseError'; var captureStackTrace = Error .captureStackTrace; var FirebaseError = /** @class */ (function () { function FirebaseError(code, message) { this.code = code; this.message = message; // We want the stack value, if implemented by Error if (captureStackTrace) { // Patches this.stack, omitted calls above ErrorFactory#create captureStackTrace(this, ErrorFactory.prototype.create); } else { try { // In case of IE11, stack will be set only after error is raised. // https://docs.microsoft.com/en-us/scripting/javascript/reference/stack-property-error-javascript throw Error.apply(this, arguments); } catch (err) { this.name = ERROR_NAME; // Make non-enumerable getter for the property. Object.defineProperty(this, 'stack', { get: function () { return err.stack; } }); } } } return FirebaseError; }()); // Back-door inheritance FirebaseError.prototype = Object.create(Error.prototype); FirebaseError.prototype.constructor = FirebaseError; FirebaseError.prototype.name = ERROR_NAME; var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; // Matches {$name}, by default. this.pattern = /\{\$([^}]+)}/g; // empty } ErrorFactory.prototype.create = function (code, data) { if (data === undefined) { data = {}; } var template = this.errors[code]; var fullCode = this.service + '/' + code; var message; if (template === undefined) { message = 'Error'; } else { message = template.replace(this.pattern, function (match, key) { var value = data[key]; return value !== undefined ? value.toString() : '<' + key + '?>'; }); } // Service: Error message (service/code). message = this.serviceName + ': ' + message + ' (' + fullCode + ').'; var err = new FirebaseError(fullCode, message); // Populate the Error object with message parts for programmatic // accesses (e.g., e.file). for (var prop in data) { if (!data.hasOwnProperty(prop) || prop.slice(-1) === '_') { continue; } err[prop] = data[prop]; } return err; }; return ErrorFactory; }()); /** * Copyright 2017 Google Inc. * * 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. */ // Copyright 2011 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. /** * @fileoverview Abstract cryptographic hash interface. * * See Sha1 and Md5 for sample implementations. * */ /** * Create a cryptographic hash instance. * * @constructor * @struct */ var Hash = /** @class */ (function () { function Hash() { /** * The block size for the hasher. * @type {number} */ this.blockSize = -1; } return Hash; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @extends {Hash} * @final * @struct */ var Sha1 = /** @class */ (function (_super) { tslib_1.__extends(Sha1, _super); function Sha1() { var _this = _super.call(this) || this; /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @type {!Array} * @private */ _this.chain_ = []; /** * A buffer holding the partially computed hash result. * @type {!Array} * @private */ _this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @type {!Array} * @private */ _this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @type {!Array} * @private */ _this.pad_ = []; /** * @private {number} */ _this.inbuf_ = 0; /** * @private {number} */ _this.total_ = 0; _this.blockSize = 512 / 8; _this.pad_[0] = 128; for (var i = 1; i < _this.blockSize; ++i) { _this.pad_[i] = 0; } _this.reset(); return _this; } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param {!Array|!Uint8Array|string} buf Block to compress. * @param {number=} opt_offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, opt_offset) { if (!opt_offset) { opt_offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(opt_offset) << 24) | (buf.charCodeAt(opt_offset + 1) << 16) | (buf.charCodeAt(opt_offset + 2) << 8) | buf.charCodeAt(opt_offset + 3); opt_offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[opt_offset] << 24) | (buf[opt_offset + 1] << 16) | (buf[opt_offset + 2] << 8) | buf[opt_offset + 3]; opt_offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, opt_length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (opt_length === undefined) { opt_length = bytes.length; } var lengthMinusBlock = opt_length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < opt_length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf == 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < opt_length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf == this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < opt_length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf == this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += opt_length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }(Hash)); /** * Copyright 2017 Google Inc. * * 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. */ /** * Provides a simple helper class that implements the Stream interface to * bridge to other implementations that are streams but do not implement the * interface. The stream callbacks are invoked with the callOn... methods. */ var StreamBridge = /** @class */ (function () { function StreamBridge(args) { this.sendFn = args.sendFn; this.closeFn = args.closeFn; } StreamBridge.prototype.onOpen = function (callback) { assert(!this.wrappedOnOpen, 'Called onOpen on stream twice!'); this.wrappedOnOpen = callback; }; StreamBridge.prototype.onClose = function (callback) { assert(!this.wrappedOnClose, 'Called onClose on stream twice!'); this.wrappedOnClose = callback; }; StreamBridge.prototype.onMessage = function (callback) { assert(!this.wrappedOnMessage, 'Called onMessage on stream twice!'); this.wrappedOnMessage = callback; }; StreamBridge.prototype.close = function () { this.closeFn(); }; StreamBridge.prototype.send = function (msg) { this.sendFn(msg); }; StreamBridge.prototype.callOnOpen = function () { assert(this.wrappedOnOpen !== undefined, 'Cannot call onOpen because no callback was set'); this.wrappedOnOpen(); }; StreamBridge.prototype.callOnClose = function (err) { assert(this.wrappedOnClose !== undefined, 'Cannot call onClose because no callback was set'); this.wrappedOnClose(err); }; StreamBridge.prototype.callOnMessage = function (msg) { assert(this.wrappedOnMessage !== undefined, 'Cannot call onMessage because no callback was set'); this.wrappedOnMessage(msg); }; return StreamBridge; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG = 'Connection'; var RPC_STREAM_SERVICE = 'google.firestore.v1beta1.Firestore'; var RPC_URL_VERSION = 'v1beta1'; /** Maps RPC names to the corresponding REST endpoint name. */ var RPC_NAME_REST_MAPPING = { BatchGetDocuments: 'batchGet', Commit: 'commit' }; // TODO(b/38203344): The SDK_VERSION is set independently from Firebase because // we are doing out-of-band releases. Once we release as part of Firebase, we // should use the Firebase version instead. var X_GOOG_API_CLIENT_VALUE = 'gl-js/ fire/' + SDK_VERSION; var XHR_TIMEOUT_SECS = 15; var WebChannelConnection = /** @class */ (function () { function WebChannelConnection(info) { this.databaseId = info.databaseId; this.pool = new webchannelWrapper.XhrIoPool(); var proto = info.ssl ? 'https' : 'http'; this.baseUrl = proto + '://' + info.host; } /** * Modifies the headers for a request, adding any authorization token if * present and any additional headers for the request. */ WebChannelConnection.prototype.modifyHeadersForRequest = function (headers, token) { if (token) { for (var header in token.authHeaders) { if (token.authHeaders.hasOwnProperty(header)) { headers[header] = token.authHeaders[header]; } } } headers['X-Goog-Api-Client'] = X_GOOG_API_CLIENT_VALUE; }; WebChannelConnection.prototype.invokeRPC = function (rpcName, request, token) { var _this = this; var url = this.makeUrl(rpcName); return new Promise(function (resolve, reject) { // tslint:disable-next-line:no-any XhrIoPool doesn't have TS typings. _this.pool.getObject(function (xhr) { xhr.listenOnce(webchannelWrapper.EventType.COMPLETE, function () { try { switch (xhr.getLastErrorCode()) { case webchannelWrapper.ErrorCode.NO_ERROR: var json = xhr.getResponseJson(); debug(LOG_TAG, 'XHR received:', JSON.stringify(json)); resolve(json); break; case webchannelWrapper.ErrorCode.TIMEOUT: debug(LOG_TAG, 'RPC "' + rpcName + '" timed out'); reject(new FirestoreError(Code.DEADLINE_EXCEEDED, 'Request time out')); break; case webchannelWrapper.ErrorCode.HTTP_ERROR: var status_1 = xhr.getStatus(); debug(LOG_TAG, 'RPC "' + rpcName + '" failed with status:', status_1, 'response text:', xhr.getResponseText()); if (status_1 > 0) { reject(new FirestoreError(mapCodeFromHttpStatus(status_1), 'Server responded with status ' + xhr.getStatusText())); } else { // If we received an HTTP_ERROR but there's no status code, // it's most probably a connection issue debug(LOG_TAG, 'RPC "' + rpcName + '" failed'); reject(new FirestoreError(Code.UNAVAILABLE, 'Connection failed.')); } break; default: fail('RPC "' + rpcName + '" failed with unanticipated ' + 'webchannel error ' + xhr.getLastErrorCode() + ': ' + xhr.getLastError() + ', giving up.'); } } finally { debug(LOG_TAG, 'RPC "' + rpcName + '" completed.'); _this.pool.releaseObject(xhr); } }); var requestString = JSON.stringify(request); debug(LOG_TAG, 'XHR sending: ', url + ' ' + requestString); // Content-Type: text/plain will avoid preflight requests which might // mess with CORS and redirects by proxies. If we add custom headers // we will need to change this code to potentially use the // $httpOverwrite parameter supported by ESF to avoid // triggering preflight requests. var headers = { 'Content-Type': 'text/plain' }; _this.modifyHeadersForRequest(headers, token); xhr.send(url, 'POST', requestString, headers, XHR_TIMEOUT_SECS); }); }); }; WebChannelConnection.prototype.invokeStreamingRPC = function (rpcName, request, token) { // The REST API automatically aggregates all of the streamed results, so we // can just use the normal invoke() method. return this.invokeRPC(rpcName, request, token); }; WebChannelConnection.prototype.openStream = function (rpcName, token) { var urlParts = [ this.baseUrl, '/', RPC_STREAM_SERVICE, '/', rpcName, '/channel' ]; var webchannelTransport = webchannelWrapper.createWebChannelTransport(); var request = { // Background channel test avoids the initial two test calls and decreases // initial cold start time. // TODO(dimond): wenboz@ mentioned this might affect use with proxies and // we should monitor closely for any reports. backgroundChannelTest: true, // Required for backend stickiness, routing behavior is based on this // parameter. httpSessionIdParam: 'gsessionid', initMessageHeaders: {}, messageUrlParams: { // This param is used to improve routing and project isolation by the // backend and must be included in every request. database: "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database }, sendRawJson: true, supportsCrossDomainXhr: true }; this.modifyHeadersForRequest(request.initMessageHeaders, token); // Sending the custom headers we just added to request.initMessageHeaders // (Authorization, etc.) will trigger the browser to make a CORS preflight // request because the XHR will no longer meet the criteria for a "simple" // CORS request: // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests // // Therefore to avoid the CORS preflight request (an extra network // roundtrip), we use the httpHeadersOverwriteParam option to specify that // the headers should instead be encoded into a special "$httpHeaders" query // parameter, which is recognized by the webchannel backend. This is // formally defined here: // https://github.com/google/closure-library/blob/b0e1815b13fb92a46d7c9b3c30de5d6a396a3245/closure/goog/net/rpc/httpcors.js#L32 // // But for some unclear reason (see // https://github.com/firebase/firebase-js-sdk/issues/703), this breaks // ReactNative and so we exclude it, which just means ReactNative may be // subject to the extra network roundtrip for CORS preflight. if (!isReactNative()) { request['httpHeadersOverwriteParam'] = '$httpHeaders'; } var url = urlParts.join(''); debug(LOG_TAG, 'Creating WebChannel: ' + url + ' ' + request); // tslint:disable-next-line:no-any Because listen isn't defined on it. var channel = webchannelTransport.createWebChannel(url, request); // WebChannel supports sending the first message with the handshake - saving // a network round trip. However, it will have to call send in the same // JS event loop as open. In order to enforce this, we delay actually // opening the WebChannel until send is called. Whether we have called // open is tracked with this variable. var opened = false; // A flag to determine whether the stream was closed (by us or through an // error/close event) to avoid delivering multiple close events or sending // on a closed stream var closed = false; var streamBridge = new StreamBridge({ sendFn: function (msg) { if (!closed) { if (!opened) { debug(LOG_TAG, 'Opening WebChannel transport.'); channel.open(); opened = true; } debug(LOG_TAG, 'WebChannel sending:', msg); channel.send(msg); } else { debug(LOG_TAG, 'Not sending because WebChannel is closed:', msg); } }, closeFn: function () { return channel.close(); } }); // Closure events are guarded and exceptions are swallowed, so catch any // exception and rethrow using a setTimeout so they become visible again. // Note that eventually this function could go away if we are confident // enough the code is exception free. var unguardedEventListen = function (type, fn) { // TODO(dimond): closure typing seems broken because WebChannel does // not implement goog.events.Listenable channel.listen(type, function (param) { try { fn(param); } catch (e) { setTimeout(function () { throw e; }, 0); } }); }; unguardedEventListen(webchannelWrapper.WebChannel.EventType.OPEN, function () { if (!closed) { debug(LOG_TAG, 'WebChannel transport opened.'); } }); unguardedEventListen(webchannelWrapper.WebChannel.EventType.CLOSE, function () { if (!closed) { closed = true; debug(LOG_TAG, 'WebChannel transport closed'); streamBridge.callOnClose(); } }); unguardedEventListen(webchannelWrapper.WebChannel.EventType.ERROR, function (err) { if (!closed) { closed = true; debug(LOG_TAG, 'WebChannel transport errored:', err); streamBridge.callOnClose(new FirestoreError(Code.UNAVAILABLE, 'The operation could not be completed')); } }); unguardedEventListen(webchannelWrapper.WebChannel.EventType.MESSAGE, function (msg) { if (!closed) { var msgData = msg.data[0]; assert(!!msgData, 'Got a webchannel message without data.'); // TODO(b/35143891): There is a bug in One Platform that caused errors // (and only errors) to be wrapped in an extra array. To be forward // compatible with the bug we need to check either condition. The latter // can be removed once the fix has been rolled out. var error$$1 = // tslint:disable-next-line:no-any msgData.error is not typed. msgData.error || (msgData[0] && msgData[0].error); if (error$$1) { debug(LOG_TAG, 'WebChannel received error:', error$$1); // error.status will be a string like 'OK' or 'NOT_FOUND'. var status_2 = error$$1.status; var code = mapCodeFromRpcStatus(status_2); var message = error$$1.message; if (code === undefined) { code = Code.INTERNAL; message = 'Unknown error status: ' + status_2 + ' with message ' + error$$1.message; } // Mark closed so no further events are propagated closed = true; streamBridge.callOnClose(new FirestoreError(code, message)); channel.close(); } else { debug(LOG_TAG, 'WebChannel received:', msgData); streamBridge.callOnMessage(msgData); } } }); setTimeout(function () { // Technically we could/should wait for the WebChannel opened event, // but because we want to send the first message with the WebChannel // handshake we pretend the channel opened here (asynchronously), and // then delay the actual open until the first message is sent. streamBridge.callOnOpen(); }, 0); return streamBridge; }; // visible for testing WebChannelConnection.prototype.makeUrl = function (rpcName) { var urlRpcName = RPC_NAME_REST_MAPPING[rpcName]; assert(urlRpcName !== undefined, 'Unknown REST mapping for: ' + rpcName); var url = [this.baseUrl, '/', RPC_URL_VERSION]; url.push('/projects/'); url.push(this.databaseId.projectId); url.push('/databases/'); url.push(this.databaseId.database); url.push('/documents'); url.push(':'); url.push(urlRpcName); return url.join(''); }; return WebChannelConnection; }()); /** * Copyright 2017 Google Inc. * * 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. */ var BrowserPlatform = /** @class */ (function () { function BrowserPlatform() { this.emptyByteString = ''; this.base64Available = typeof atob !== 'undefined'; } Object.defineProperty(BrowserPlatform.prototype, "document", { get: function () { return typeof document !== 'undefined' ? document : null; }, enumerable: true, configurable: true }); Object.defineProperty(BrowserPlatform.prototype, "window", { get: function () { return typeof window !== 'undefined' ? window : null; }, enumerable: true, configurable: true }); BrowserPlatform.prototype.loadConnection = function (databaseInfo) { return Promise.resolve(new WebChannelConnection(databaseInfo)); }; BrowserPlatform.prototype.newSerializer = function (databaseId) { return new JsonProtoSerializer(databaseId, { useProto3Json: true }); }; BrowserPlatform.prototype.formatJSON = function (value) { return JSON.stringify(value); }; BrowserPlatform.prototype.atob = function (encoded) { return atob(encoded); }; BrowserPlatform.prototype.btoa = function (raw) { return btoa(raw); }; return BrowserPlatform; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * This code needs to run before Firestore is used. This can be achieved in * several ways: * 1) Through the JSCompiler compiling this code and then (automatically) * executing it before exporting the Firestore symbols. * 2) Through importing this module first in a Firestore main module */ PlatformSupport.setPlatform(new BrowserPlatform()); /** * Copyright 2018 Google Inc. * * 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. */ /** * `ListenSequence` is a monotonic sequence. It is initialized with a minimum value to * exceed. All subsequent calls to next will return increasing values. If provided with a * `SequenceNumberSyncer`, it will additionally bump its next value when told of a new value, as * well as write out sequence numbers that it produces via `next()`. */ var ListenSequence = /** @class */ (function () { function ListenSequence(previousValue, sequenceNumberSyncer) { var _this = this; this.previousValue = previousValue; if (sequenceNumberSyncer) { sequenceNumberSyncer.sequenceNumberHandler = function (sequenceNumber) { return _this.setPreviousValue(sequenceNumber); }; this.writeNewSequenceNumber = function (sequenceNumber) { return sequenceNumberSyncer.writeSequenceNumber(sequenceNumber); }; } } ListenSequence.prototype.setPreviousValue = function (externalPreviousValue) { this.previousValue = Math.max(externalPreviousValue, this.previousValue); return this.previousValue; }; ListenSequence.prototype.next = function () { var nextValue = ++this.previousValue; if (this.writeNewSequenceNumber) { this.writeNewSequenceNumber(nextValue); } return nextValue; }; ListenSequence.INVALID = -1; return ListenSequence; }()); /** * Copyright 2017 Google Inc. * * 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. */ var Deferred$1 = /** @class */ (function () { function Deferred() { var _this = this; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } return Deferred; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Wellknown "timer" IDs used when scheduling delayed operations on the * AsyncQueue. These IDs can then be used from tests to check for the presence * of operations or to run them early. * * The string values are used when encoding these timer IDs in JSON spec tests. */ var TimerId; (function (TimerId) { /** All can be used with runDelayedOperationsEarly() to run all timers. */ TimerId["All"] = "all"; /** * The following 4 timers are used in persistent_stream.ts for the listen and * write streams. The "Idle" timer is used to close the stream due to * inactivity. The "ConnectionBackoff" timer is used to restart a stream once * the appropriate backoff delay has elapsed. */ TimerId["ListenStreamIdle"] = "listen_stream_idle"; TimerId["ListenStreamConnectionBackoff"] = "listen_stream_connection_backoff"; TimerId["WriteStreamIdle"] = "write_stream_idle"; TimerId["WriteStreamConnectionBackoff"] = "write_stream_connection_backoff"; /** * A timer used in online_state_tracker.ts to transition from * OnlineState.Unknown to Offline after a set timeout, rather than waiting * indefinitely for success or failure. */ TimerId["OnlineStateTimeout"] = "online_state_timeout"; /** * A timer used to update the client metadata in IndexedDb, which is used * to determine the primary leaseholder. */ TimerId["ClientMetadataRefresh"] = "client_metadata_refresh"; })(TimerId || (TimerId = {})); /** * Represents an operation scheduled to be run in the future on an AsyncQueue. * * It is created via DelayedOperation.createAndSchedule(). * * Supports cancellation (via cancel()) and early execution (via skipDelay()). */ var DelayedOperation = /** @class */ (function () { function DelayedOperation(asyncQueue, timerId, targetTimeMs, op, removalCallback) { this.asyncQueue = asyncQueue; this.timerId = timerId; this.targetTimeMs = targetTimeMs; this.op = op; this.removalCallback = removalCallback; this.deferred = new Deferred$1(); this.then = this.deferred.promise.then.bind(this.deferred.promise); this.catch = this.deferred.promise.catch.bind(this.deferred.promise); // It's normal for the deferred promise to be canceled (due to cancellation) // and so we attach a dummy catch callback to avoid // 'UnhandledPromiseRejectionWarning' log spam. this.deferred.promise.catch(function (err) { }); } /** * Creates and returns a DelayedOperation that has been scheduled to be * executed on the provided asyncQueue after the provided delayMs. * * @param asyncQueue The queue to schedule the operation on. * @param id A Timer ID identifying the type of operation this is. * @param delayMs The delay (ms) before the operation should be scheduled. * @param op The operation to run. * @param removalCallback A callback to be called synchronously once the * operation is executed or canceled, notifying the AsyncQueue to remove it * from its delayedOperations list. * PORTING NOTE: This exists to prevent making removeDelayedOperation() and * the DelayedOperation class public. */ DelayedOperation.createAndSchedule = function (asyncQueue, timerId, delayMs, op, removalCallback) { var targetTime = Date.now() + delayMs; var delayedOp = new DelayedOperation(asyncQueue, timerId, targetTime, op, removalCallback); delayedOp.start(delayMs); return delayedOp; }; /** * Starts the timer. This is called immediately after construction by * createAndSchedule(). */ DelayedOperation.prototype.start = function (delayMs) { var _this = this; this.timerHandle = setTimeout(function () { return _this.handleDelayElapsed(); }, delayMs); }; /** * Queues the operation to run immediately (if it hasn't already been run or * canceled). */ DelayedOperation.prototype.skipDelay = function () { return this.handleDelayElapsed(); }; /** * Cancels the operation if it hasn't already been executed or canceled. The * promise will be rejected. * * As long as the operation has not yet been run, calling cancel() provides a * guarantee that the operation will not be run. */ DelayedOperation.prototype.cancel = function (reason) { if (this.timerHandle !== null) { this.clearTimeout(); this.deferred.reject(new FirestoreError(Code.CANCELLED, 'Operation cancelled' + (reason ? ': ' + reason : ''))); } }; DelayedOperation.prototype.handleDelayElapsed = function () { var _this = this; this.asyncQueue.enqueueAndForget(function () { if (_this.timerHandle !== null) { _this.clearTimeout(); return _this.op().then(function (result) { return _this.deferred.resolve(result); }); } else { return Promise.resolve(); } }); }; DelayedOperation.prototype.clearTimeout = function () { if (this.timerHandle !== null) { this.removalCallback(this); clearTimeout(this.timerHandle); this.timerHandle = null; } }; return DelayedOperation; }()); var AsyncQueue = /** @class */ (function () { function AsyncQueue() { // The last promise in the queue. this.tail = Promise.resolve(); // Operations scheduled to be queued in the future. Operations are // automatically removed after they are run or canceled. this.delayedOperations = []; // Flag set while there's an outstanding AsyncQueue operation, used for // assertion sanity-checks. this.operationInProgress = false; } /** * Adds a new operation to the queue without waiting for it to complete (i.e. * we ignore the Promise result). */ AsyncQueue.prototype.enqueueAndForget = function (op) { // tslint:disable-next-line:no-floating-promises this.enqueue(op); }; /** * Adds a new operation to the queue. Returns a promise that will be resolved * when the promise returned by the new operation is (with its value). */ AsyncQueue.prototype.enqueue = function (op) { var _this = this; this.verifyNotFailed(); var newTail = this.tail.then(function () { _this.operationInProgress = true; return op() .catch(function (error$$1) { _this.failure = error$$1; _this.operationInProgress = false; var message = error$$1.stack || error$$1.message || ''; error('INTERNAL UNHANDLED ERROR: ', message); // Escape the promise chain and throw the error globally so that // e.g. any global crash reporting library detects and reports it. // (but not for simulated errors in our tests since this breaks mocha) if (message.indexOf('Firestore Test Simulated Error') < 0) { setTimeout(function () { throw error$$1; }, 0); } // Re-throw the error so that this.tail becomes a rejected Promise and // all further attempts to chain (via .then) will just short-circuit // and return the rejected Promise. throw error$$1; }) .then(function (result) { _this.operationInProgress = false; return result; }); }); this.tail = newTail; return newTail; }; /** * Schedules an operation to be queued on the AsyncQueue once the specified * `delayMs` has elapsed. The returned CancelablePromise can be used to cancel * the operation prior to its running. */ AsyncQueue.prototype.enqueueAfterDelay = function (timerId, delayMs, op) { var _this = this; this.verifyNotFailed(); assert(delayMs >= 0, "Attempted to schedule an operation with a negative delay of " + delayMs); // While not necessarily harmful, we currently don't expect to have multiple // ops with the same timer id in the queue, so defensively reject them. assert(!this.containsDelayedOperation(timerId), "Attempted to schedule multiple operations with timer id " + timerId + "."); var delayedOp = DelayedOperation.createAndSchedule(this, timerId, delayMs, op, function (op) { return _this.removeDelayedOperation(op); }); this.delayedOperations.push(delayedOp); return delayedOp; }; AsyncQueue.prototype.verifyNotFailed = function () { if (this.failure) { fail('AsyncQueue is already failed: ' + (this.failure.stack || this.failure.message)); } }; /** * Verifies there's an operation currently in-progress on the AsyncQueue. * Unfortunately we can't verify that the running code is in the promise chain * of that operation, so this isn't a foolproof check, but it should be enough * to catch some bugs. */ AsyncQueue.prototype.verifyOperationInProgress = function () { assert(this.operationInProgress, 'verifyOpInProgress() called when no op in progress on this queue.'); }; /** * Waits until all currently queued tasks are finished executing. Delayed * operations are not run. */ AsyncQueue.prototype.drain = function () { return this.enqueue(function () { return Promise.resolve(); }); }; /** * For Tests: Determine if a delayed operation with a particular TimerId * exists. */ AsyncQueue.prototype.containsDelayedOperation = function (timerId) { for (var _i = 0, _a = this.delayedOperations; _i < _a.length; _i++) { var op = _a[_i]; if (op.timerId === timerId) { return true; } } return false; }; /** * For Tests: Runs some or all delayed operations early. * * @param lastTimerId Delayed operations up to and including this TimerId will * be drained. Throws if no such operation exists. Pass TimerId.All to run * all delayed operations. * @returns a Promise that resolves once all operations have been run. */ AsyncQueue.prototype.runDelayedOperationsEarly = function (lastTimerId) { var _this = this; // Note that draining may generate more delayed ops, so we do that first. return this.drain().then(function () { assert(lastTimerId === TimerId.All || _this.containsDelayedOperation(lastTimerId), "Attempted to drain to missing operation " + lastTimerId); // Run ops in the same order they'd run if they ran naturally. _this.delayedOperations.sort(function (a, b) { return a.targetTimeMs - b.targetTimeMs; }); for (var _i = 0, _a = _this.delayedOperations; _i < _a.length; _i++) { var op = _a[_i]; op.skipDelay(); if (lastTimerId !== TimerId.All && op.timerId === lastTimerId) { break; } } return _this.drain(); }); }; /** Called once a DelayedOperation is run or canceled. */ AsyncQueue.prototype.removeDelayedOperation = function (op) { // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small. var index = this.delayedOperations.indexOf(op); assert(index >= 0, 'Delayed operation not found.'); this.delayedOperations.splice(index, 1); }; return AsyncQueue; }()); /** * Copyright 2017 Google Inc. * * 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. */ var escapeChar = '\u0001'; var encodedSeparatorChar = '\u0001'; var encodedNul = '\u0010'; var encodedEscape = '\u0011'; /** * Encodes a resource path into a IndexedDb-compatible string form. */ function encode(path) { var result = ''; for (var i = 0; i < path.length; i++) { if (result.length > 0) { result = encodeSeparator(result); } result = encodeSegment(path.get(i), result); } return encodeSeparator(result); } /** Encodes a single segment of a resource path into the given result */ function encodeSegment(segment, resultBuf) { var result = resultBuf; var length = segment.length; for (var i = 0; i < length; i++) { var c = segment.charAt(i); switch (c) { case '\0': result += escapeChar + encodedNul; break; case escapeChar: result += escapeChar + encodedEscape; break; default: result += c; } } return result; } /** Encodes a path separator into the given result */ function encodeSeparator(result) { return result + escapeChar + encodedSeparatorChar; } /** * Decodes the given IndexedDb-compatible string form of a resource path into * a ResourcePath instance. Note that this method is not suitable for use with * decoding resource names from the server; those are One Platform format * strings. */ function decode$1(path) { // Event the empty path must encode as a path of at least length 2. A path // with exactly 2 must be the empty path. var length = path.length; assert(length >= 2, 'Invalid path ' + path); if (length === 2) { assert(path.charAt(0) === escapeChar && path.charAt(1) === encodedSeparatorChar, 'Non-empty path ' + path + ' had length 2'); return ResourcePath.EMPTY_PATH; } // Escape characters cannot exist past the second-to-last position in the // source value. var lastReasonableEscapeIndex = length - 2; var segments = []; var segmentBuilder = ''; for (var start = 0; start < length;) { // The last two characters of a valid encoded path must be a separator, so // there must be an end to this segment. var end = path.indexOf(escapeChar, start); if (end < 0 || end > lastReasonableEscapeIndex) { fail('Invalid encoded resource path: "' + path + '"'); } var next = path.charAt(end + 1); switch (next) { case encodedSeparatorChar: var currentPiece = path.substring(start, end); var segment = void 0; if (segmentBuilder.length === 0) { // Avoid copying for the common case of a segment that excludes \0 // and \001 segment = currentPiece; } else { segmentBuilder += currentPiece; segment = segmentBuilder; segmentBuilder = ''; } segments.push(segment); break; case encodedNul: segmentBuilder += path.substring(start, end); segmentBuilder += '\0'; break; case encodedEscape: // The escape character can be used in the output to encode itself. segmentBuilder += path.substring(start, end + 1); break; default: fail('Invalid encoded resource path: "' + path + '"'); } start = end + 2; } return new ResourcePath(segments); } /** * Copyright 2017 Google Inc. * * 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. */ var BATCHID_UNKNOWN = -1; /** * A batch of mutations that will be sent as one unit to the backend. */ var MutationBatch = /** @class */ (function () { function MutationBatch(batchId, localWriteTime, mutations) { this.batchId = batchId; this.localWriteTime = localWriteTime; this.mutations = mutations; assert(mutations.length > 0, 'Cannot create an empty mutation batch'); } /** * Applies all the mutations in this MutationBatch to the specified document * to create a new remote document * * @param docKey The key of the document to apply mutations to. * @param maybeDoc The document to apply mutations to. * @param batchResult The result of applying the MutationBatch to the * backend. */ MutationBatch.prototype.applyToRemoteDocument = function (docKey, maybeDoc, batchResult) { if (maybeDoc) { assert(maybeDoc.key.isEqual(docKey), "applyToRemoteDocument: key " + docKey + " should match maybeDoc key\n " + maybeDoc.key); } var mutationResults = batchResult.mutationResults; assert(mutationResults.length === this.mutations.length, "Mismatch between mutations length\n (" + this.mutations.length + ") and mutation results length\n (" + mutationResults.length + ")."); for (var i = 0; i < this.mutations.length; i++) { var mutation = this.mutations[i]; if (mutation.key.isEqual(docKey)) { var mutationResult = mutationResults[i]; maybeDoc = mutation.applyToRemoteDocument(maybeDoc, mutationResult); } } return maybeDoc; }; /** * Computes the local view of a document given all the mutations in this * batch. * * @param docKey The key of the document to apply mutations to. * @param maybeDoc The document to apply mutations to. */ MutationBatch.prototype.applyToLocalView = function (docKey, maybeDoc) { if (maybeDoc) { assert(maybeDoc.key.isEqual(docKey), "applyToLocalDocument: key " + docKey + " should match maybeDoc key\n " + maybeDoc.key); } var baseDoc = maybeDoc; for (var i = 0; i < this.mutations.length; i++) { var mutation = this.mutations[i]; if (mutation.key.isEqual(docKey)) { maybeDoc = mutation.applyToLocalView(maybeDoc, baseDoc, this.localWriteTime); } } return maybeDoc; }; MutationBatch.prototype.keys = function () { var keySet = documentKeySet(); for (var _i = 0, _a = this.mutations; _i < _a.length; _i++) { var mutation = _a[_i]; keySet = keySet.add(mutation.key); } return keySet; }; MutationBatch.prototype.isEqual = function (other) { return (this.batchId === other.batchId && arrayEquals(this.mutations, other.mutations)); }; return MutationBatch; }()); /** The result of applying a mutation batch to the backend. */ var MutationBatchResult = /** @class */ (function () { function MutationBatchResult(batch, commitVersion, mutationResults, streamToken, /** * A pre-computed mapping from each mutated document to the resulting * version. */ docVersions) { this.batch = batch; this.commitVersion = commitVersion; this.mutationResults = mutationResults; this.streamToken = streamToken; this.docVersions = docVersions; } /** * Creates a new MutationBatchResult for the given batch and results. There * must be one result for each mutation in the batch. This static factory * caches a document=>version mapping (docVersions). */ MutationBatchResult.from = function (batch, commitVersion, results, streamToken) { assert(batch.mutations.length === results.length, 'Mutations sent ' + batch.mutations.length + ' must equal results received ' + results.length); var versionMap = documentVersionMap(); var mutations = batch.mutations; for (var i = 0; i < mutations.length; i++) { versionMap = versionMap.insert(mutations[i].key, results[i].version); } return new MutationBatchResult(batch, commitVersion, results, streamToken, versionMap); }; return MutationBatchResult; }()); /** * Copyright 2017 Google Inc. * * 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. */ var RESERVED_BITS = 1; var GeneratorIds; (function (GeneratorIds) { GeneratorIds[GeneratorIds["QueryCache"] = 0] = "QueryCache"; GeneratorIds[GeneratorIds["SyncEngine"] = 1] = "SyncEngine"; // The target IDs for limbo detection are odd (end in 1). })(GeneratorIds || (GeneratorIds = {})); /** * Generates monotonically increasing target IDs for sending targets to the * watch stream. * * The client constructs two generators, one for the query cache (via * forQueryCache()), and one for limbo documents (via forSyncEngine()). These * two generators produce non-overlapping IDs (by using even and odd IDs * respectively). * * By separating the target ID space, the query cache can generate target IDs * that persist across client restarts, while sync engine can independently * generate in-memory target IDs that are transient and can be reused after a * restart. */ // TODO(mrschmidt): Explore removing this class in favor of generating these IDs // directly in SyncEngine and LocalStore. var TargetIdGenerator = /** @class */ (function () { /** * Instantiates a new TargetIdGenerator. If a seed is provided, the generator * will use the seed value as the next target ID. */ function TargetIdGenerator(generatorId, seed) { this.generatorId = generatorId; assert((generatorId & RESERVED_BITS) === generatorId, "Generator ID " + generatorId + " contains more than " + RESERVED_BITS + " reserved bits"); this.seek(seed !== undefined ? seed : this.generatorId); } TargetIdGenerator.prototype.next = function () { var nextId = this.nextId; this.nextId += 1 << RESERVED_BITS; return nextId; }; /** * Returns the ID that follows the given ID. Subsequent calls to `next()` * use the newly returned target ID as their base. */ // PORTING NOTE: Multi-tab only. TargetIdGenerator.prototype.after = function (targetId) { this.seek(targetId + (1 << RESERVED_BITS)); return this.next(); }; TargetIdGenerator.prototype.seek = function (targetId) { assert((targetId & RESERVED_BITS) === this.generatorId, 'Cannot supply target ID from different generator ID'); this.nextId = targetId; }; TargetIdGenerator.forQueryCache = function () { // We seed the query cache generator to return '2' as its first ID, as there // is no differentiation in the protocol layer between an unset number and // the number '0'. If we were to sent a target with target ID '0', the // backend would consider it unset and replace it with its own ID. var targetIdGenerator = new TargetIdGenerator(GeneratorIds.QueryCache, 2); return targetIdGenerator; }; TargetIdGenerator.forSyncEngine = function () { // Sync engine assigns target IDs for limbo document detection. return new TargetIdGenerator(GeneratorIds.SyncEngine); }; return TargetIdGenerator; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * PersistencePromise<> is essentially a re-implementation of Promise<> except * it has a .next() method instead of .then() and .next() and .catch() callbacks * are executed synchronously when a PersistencePromise resolves rather than * asynchronously (Promise<> implementations use setImmediate() or similar). * * This is necessary to interoperate with IndexedDB which will automatically * commit transactions if control is returned to the event loop without * synchronously initiating another operation on the transaction. * * NOTE: .then() and .catch() only allow a single consumer, unlike normal * Promises. */ var PersistencePromise = /** @class */ (function () { function PersistencePromise(callback) { var _this = this; // NOTE: next/catchCallback will always point to our own wrapper functions, // not the user's raw next() or catch() callbacks. // tslint:disable-next-line:no-any Accept any result type for the next call in the Promise chain. this.nextCallback = null; // tslint:disable-next-line:no-any Accept any result type for the error handler. this.catchCallback = null; // When the operation resolves, we'll set result or error and mark isDone. this.result = undefined; this.error = undefined; this.isDone = false; // Set to true when .then() or .catch() are called and prevents additional // chaining. this.callbackAttached = false; callback(function (value) { _this.isDone = true; _this.result = value; if (_this.nextCallback) { // value should be defined unless T is Void, but we can't express // that in the type system. _this.nextCallback(value); } }, function (error) { _this.isDone = true; _this.error = error; if (_this.catchCallback) { _this.catchCallback(error); } }); } PersistencePromise.prototype.catch = function (fn) { return this.next(undefined, fn); }; PersistencePromise.prototype.next = function (nextFn, catchFn) { var _this = this; if (this.callbackAttached) { fail('Called next() or catch() twice for PersistencePromise'); } this.callbackAttached = true; if (this.isDone) { if (!this.error) { return this.wrapSuccess(nextFn, this.result); } else { return this.wrapFailure(catchFn, this.error); } } else { return new PersistencePromise(function (resolve, reject) { _this.nextCallback = function (value) { _this.wrapSuccess(nextFn, value).next(resolve, reject); }; _this.catchCallback = function (error) { _this.wrapFailure(catchFn, error).next(resolve, reject); }; }); } }; PersistencePromise.prototype.toPromise = function () { var _this = this; return new Promise(function (resolve, reject) { _this.next(resolve, reject); }); }; PersistencePromise.prototype.wrapUserFunction = function (fn) { try { var result = fn(); if (result instanceof PersistencePromise) { return result; } else { return PersistencePromise.resolve(result); } } catch (e) { return PersistencePromise.reject(e); } }; PersistencePromise.prototype.wrapSuccess = function (nextFn, value) { if (nextFn) { return this.wrapUserFunction(function () { return nextFn(value); }); } else { // If there's no nextFn, then R must be the same as T but we // can't express that in the type system. // tslint:disable-next-line:no-any return PersistencePromise.resolve(value); } }; PersistencePromise.prototype.wrapFailure = function (catchFn, error) { if (catchFn) { return this.wrapUserFunction(function () { return catchFn(error); }); } else { return PersistencePromise.reject(error); } }; PersistencePromise.resolve = function (result) { return new PersistencePromise(function (resolve, reject) { resolve(result); }); }; PersistencePromise.reject = function (error) { return new PersistencePromise(function (resolve, reject) { reject(error); }); }; PersistencePromise.waitFor = function ( // tslint:disable-next-line:no-any Accept all Promise types in waitFor(). all) { return new PersistencePromise(function (resolve, reject) { var expectedCount = 0; var resolvedCount = 0; var done = false; all.forEach(function (element) { ++expectedCount; element.next(function () { ++resolvedCount; if (done && resolvedCount === expectedCount) { resolve(); } }, function (err) { return reject(err); }); }); done = true; if (resolvedCount === expectedCount) { resolve(); } }); }; /** * Given an array of predicate functions that asynchronously evaluate to a * boolean, implements a short-circuiting `or` between the results. Predicates * will be evaluated until one of them returns `true`, then stop. The final * result will be whether any of them returned `true`. */ PersistencePromise.or = function (predicates) { var p = PersistencePromise.resolve(false); var _loop_1 = function (predicate) { p = p.next(function (isTrue) { if (isTrue) { return PersistencePromise.resolve(isTrue); } else { return predicate(); } }); }; for (var _i = 0, predicates_1 = predicates; _i < predicates_1.length; _i++) { var predicate = predicates_1[_i]; _loop_1(predicate); } return p; }; /** * Given an iterable, call the given function on each element in the * collection and wait for all of the resulting concurrent PersistencePromises * to resolve. */ PersistencePromise.forEach = function (collection, f) { var _this = this; var promises = []; collection.forEach(function (r, s) { promises.push(f.call(_this, r, s)); }); return this.waitFor(promises); }; return PersistencePromise; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG$1 = 'SimpleDb'; /** * Provides a wrapper around IndexedDb with a simplified interface that uses * Promise-like return values to chain operations. Real promises cannot be used * since .then() continuations are executed asynchronously (e.g. via * .setImmediate), which would cause IndexedDB to end the transaction. * See PersistencePromise for more details. */ var SimpleDb = /** @class */ (function () { function SimpleDb(db) { this.db = db; } /** Opens the specified database, creating or upgrading it if necessary. */ SimpleDb.openOrCreate = function (name, version, schemaConverter) { assert(SimpleDb.isAvailable(), 'IndexedDB not supported in current environment.'); debug(LOG_TAG$1, 'Opening database:', name); return new PersistencePromise(function (resolve, reject) { // TODO(mikelehen): Investigate browser compatibility. // https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB // suggests IE9 and older WebKit browsers handle upgrade // differently. They expect setVersion, as described here: // https://developer.mozilla.org/en-US/docs/Web/API/IDBVersionChangeRequest/setVersion var request = window.indexedDB.open(name, version); request.onsuccess = function (event) { var db = event.target.result; resolve(new SimpleDb(db)); }; request.onblocked = function () { reject(new FirestoreError(Code.FAILED_PRECONDITION, 'Cannot upgrade IndexedDB schema while another tab is open. ' + 'Close all tabs that access Firestore and reload this page to proceed.')); }; request.onerror = function (event) { reject(event.target.error); }; request.onupgradeneeded = function (event) { debug(LOG_TAG$1, 'Database "' + name + '" requires upgrade from version:', event.oldVersion); var db = event.target.result; // We are provided a version upgrade transaction from the request, so // we wrap that in a SimpleDbTransaction to allow use of our friendlier // API for schema migration operations. var txn = new SimpleDbTransaction(request.transaction); schemaConverter .createOrUpgrade(db, txn, event.oldVersion, SCHEMA_VERSION) .next(function () { debug(LOG_TAG$1, 'Database upgrade to version ' + SCHEMA_VERSION + ' complete'); }); }; }).toPromise(); }; /** Deletes the specified database. */ SimpleDb.delete = function (name) { debug(LOG_TAG$1, 'Removing database:', name); return wrapRequest(window.indexedDB.deleteDatabase(name)).toPromise(); }; /** Returns true if IndexedDB is available in the current environment. */ SimpleDb.isAvailable = function () { if (typeof window === 'undefined' || window.indexedDB == null) { return false; } // We extensively use indexed array values and compound keys, // which IE and Edge do not support. However, they still have indexedDB // defined on the window, so we need to check for them here and make sure // to return that persistence is not enabled for those browsers. // For tracking support of this feature, see here: // https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/ // If we are running in Node using the IndexedDBShim, `window` is defined, // but `window.navigator` is not. In this case, we support IndexedDB and // return `true`. if (window.navigator === undefined) { return Object({"DEVELOPMENT":undefined}).USE_MOCK_PERSISTENCE === 'YES'; } // Check the UA string to find out the browser. // TODO(mikelehen): Move this logic into packages/util/environment.ts var ua = window.navigator.userAgent; // IE 10 // ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)'; // IE 11 // ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'; // Edge // ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, // like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0'; if (ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0 || ua.indexOf('Edge/') > 0) { return false; } else { return true; } }; /** Helper to get a typed SimpleDbStore from a transaction. */ SimpleDb.getStore = function (txn, store) { return txn.store(store); }; SimpleDb.prototype.runTransaction = function (mode, objectStores, transactionFn) { var transaction = SimpleDbTransaction.open(this.db, mode, objectStores); var transactionFnResult = transactionFn(transaction) .catch(function (error$$1) { // Abort the transaction if there was an error. transaction.abort(error$$1); }) .toPromise(); // Wait for the transaction to complete (i.e. IndexedDb's onsuccess event to // fire), but still return the original transactionFnResult back to the // caller. return transaction.completionPromise.then(function () { return transactionFnResult; }); }; SimpleDb.prototype.close = function () { this.db.close(); }; return SimpleDb; }()); /** * A controller for iterating over a key range or index. It allows an iterate * callback to delete the currently-referenced object, or jump to a new key * within the key range or index. */ var IterationController = /** @class */ (function () { function IterationController(dbCursor) { this.dbCursor = dbCursor; this.shouldStop = false; this.nextKey = null; } Object.defineProperty(IterationController.prototype, "isDone", { get: function () { return this.shouldStop; }, enumerable: true, configurable: true }); Object.defineProperty(IterationController.prototype, "skipToKey", { get: function () { return this.nextKey; }, enumerable: true, configurable: true }); Object.defineProperty(IterationController.prototype, "cursor", { set: function (value) { this.dbCursor = value; }, enumerable: true, configurable: true }); /** * This function can be called to stop iteration at any point. */ IterationController.prototype.done = function () { this.shouldStop = true; }; /** * This function can be called to skip to that next key, which could be * an index or a primary key. */ IterationController.prototype.skip = function (key) { this.nextKey = key; }; /** * Delete the current cursor value from the object store. * * NOTE: You CANNOT do this with a keysOnly query. */ IterationController.prototype.delete = function () { return wrapRequest(this.dbCursor.delete()); }; return IterationController; }()); /** * Wraps an IDBTransaction and exposes a store() method to get a handle to a * specific object store. */ var SimpleDbTransaction = /** @class */ (function () { function SimpleDbTransaction(transaction) { var _this = this; this.transaction = transaction; this.aborted = false; /** * A promise that resolves with the result of the IndexedDb transaction. */ this.completionDeferred = new Deferred$1(); this.transaction.oncomplete = function () { _this.completionDeferred.resolve(); }; this.transaction.onabort = function () { if (transaction.error) { _this.completionDeferred.reject(transaction.error); } else { _this.completionDeferred.resolve(); } }; this.transaction.onerror = function (event) { _this.completionDeferred.reject(event.target.error); }; } SimpleDbTransaction.open = function (db, mode, objectStoreNames) { return new SimpleDbTransaction(db.transaction(objectStoreNames, mode)); }; Object.defineProperty(SimpleDbTransaction.prototype, "completionPromise", { get: function () { return this.completionDeferred.promise; }, enumerable: true, configurable: true }); SimpleDbTransaction.prototype.abort = function (error$$1) { if (error$$1) { this.completionDeferred.reject(error$$1); } if (!this.aborted) { debug(LOG_TAG$1, 'Aborting transaction:', error$$1 ? error$$1.message : 'Client-initiated abort'); this.aborted = true; this.transaction.abort(); } }; /** * Returns a SimpleDbStore for the specified store. All * operations performed on the SimpleDbStore happen within the context of this * transaction and it cannot be used anymore once the transaction is * completed. * * Note that we can't actually enforce that the KeyType and ValueType are * correct, but they allow type safety through the rest of the consuming code. */ SimpleDbTransaction.prototype.store = function (storeName) { var store = this.transaction.objectStore(storeName); assert(!!store, 'Object store not part of transaction: ' + storeName); return new SimpleDbStore(store); }; return SimpleDbTransaction; }()); /** * A wrapper around an IDBObjectStore providing an API that: * * 1) Has generic KeyType / ValueType parameters to provide strongly-typed * methods for acting against the object store. * 2) Deals with IndexedDB's onsuccess / onerror event callbacks, making every * method return a PersistencePromise instead. * 3) Provides a higher-level API to avoid needing to do excessive wrapping of * intermediate IndexedDB types (IDBCursorWithValue, etc.) */ var SimpleDbStore = /** @class */ (function () { function SimpleDbStore(store) { this.store = store; } SimpleDbStore.prototype.put = function (keyOrValue, value) { var request; if (value !== undefined) { debug(LOG_TAG$1, 'PUT', this.store.name, keyOrValue, value); request = this.store.put(value, keyOrValue); } else { debug(LOG_TAG$1, 'PUT', this.store.name, '', keyOrValue); request = this.store.put(keyOrValue); } return wrapRequest(request); }; /** * Adds a new value into an Object Store and returns the new key. Similar to * IndexedDb's `add()`, this method will fail on primary key collisions. * * @param value The object to write. * @return The key of the value to add. */ SimpleDbStore.prototype.add = function (value) { debug(LOG_TAG$1, 'ADD', this.store.name, value, value); var request = this.store.add(value); return wrapRequest(request); }; /** * Gets the object with the specified key from the specified store, or null * if no object exists with the specified key. * * @key The key of the object to get. * @return The object with the specified key or null if no object exists. */ SimpleDbStore.prototype.get = function (key) { var _this = this; var request = this.store.get(key); // tslint:disable-next-line:no-any We're doing an unsafe cast to ValueType. return wrapRequest(request).next(function (result) { // Normalize nonexistence to null. if (result === undefined) { result = null; } debug(LOG_TAG$1, 'GET', _this.store.name, key, result); return result; }); }; SimpleDbStore.prototype.delete = function (key) { debug(LOG_TAG$1, 'DELETE', this.store.name, key); var request = this.store.delete(key); return wrapRequest(request); }; /** * If we ever need more of the count variants, we can add overloads. For now, * all we need is to count everything in a store. * * Returns the number of rows in the store. */ SimpleDbStore.prototype.count = function () { debug(LOG_TAG$1, 'COUNT', this.store.name); var request = this.store.count(); return wrapRequest(request); }; SimpleDbStore.prototype.loadAll = function (indexOrRange, range) { var cursor = this.cursor(this.options(indexOrRange, range)); var results = []; return this.iterateCursor(cursor, function (key, value) { results.push(value); }).next(function () { return results; }); }; SimpleDbStore.prototype.deleteAll = function (indexOrRange, range) { debug(LOG_TAG$1, 'DELETE ALL', this.store.name); var options = this.options(indexOrRange, range); options.keysOnly = false; var cursor = this.cursor(options); return this.iterateCursor(cursor, function (key, value, control) { // NOTE: Calling delete() on a cursor is documented as more efficient than // calling delete() on an object store with a single key // (https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/delete), // however, this requires us *not* to use a keysOnly cursor // (https://developer.mozilla.org/en-US/docs/Web/API/IDBCursor/delete). We // may want to compare the performance of each method. return control.delete(); }); }; SimpleDbStore.prototype.iterate = function (optionsOrCallback, callback) { var options; if (!callback) { options = {}; callback = optionsOrCallback; } else { options = optionsOrCallback; } var cursor = this.cursor(options); return this.iterateCursor(cursor, callback); }; /** * Iterates over a store, but waits for the given callback to complete for * each entry before iterating the next entry. This allows the callback to do * asynchronous work to determine if this iteration should continue. * * The provided callback should return `true` to continue iteration, and * `false` otherwise. */ SimpleDbStore.prototype.iterateSerial = function (callback) { var cursorRequest = this.cursor({}); return new PersistencePromise(function (resolve, reject) { cursorRequest.onerror = function (event) { reject(event.target.error); }; cursorRequest.onsuccess = function (event) { var cursor = event.target.result; if (!cursor) { resolve(); return; } callback(cursor.primaryKey, cursor.value).next(function (shouldContinue) { if (shouldContinue) { cursor.continue(); } else { resolve(); } }); }; }); }; SimpleDbStore.prototype.iterateCursor = function (cursorRequest, fn) { var results = []; return new PersistencePromise(function (resolve, reject) { cursorRequest.onerror = function (event) { reject(event.target.error); }; cursorRequest.onsuccess = function (event) { var cursor = event.target.result; if (!cursor) { resolve(); return; } var controller = new IterationController(cursor); var userResult = fn(cursor.primaryKey, cursor.value, controller); if (userResult instanceof PersistencePromise) { var userPromise = userResult.catch(function (err) { controller.done(); return PersistencePromise.reject(err); }); results.push(userPromise); } if (controller.isDone) { resolve(); } else if (controller.skipToKey === null) { cursor.continue(); } else { cursor.continue(controller.skipToKey); } }; }).next(function () { return PersistencePromise.waitFor(results); }); }; SimpleDbStore.prototype.options = function (indexOrRange, range) { var indexName = undefined; if (indexOrRange !== undefined) { if (typeof indexOrRange === 'string') { indexName = indexOrRange; } else { assert(range === undefined, '3rd argument must not be defined if 2nd is a range.'); range = indexOrRange; } } return { index: indexName, range: range }; }; SimpleDbStore.prototype.cursor = function (options) { var direction = 'next'; if (options.reverse) { direction = 'prev'; } if (options.index) { var index = this.store.index(options.index); if (options.keysOnly) { return index.openKeyCursor(options.range, direction); } else { return index.openCursor(options.range, direction); } } else { return this.store.openCursor(options.range, direction); } }; return SimpleDbStore; }()); /** * Wraps an IDBRequest in a PersistencePromise, using the onsuccess / onerror * handlers to resolve / reject the PersistencePromise as appropriate. */ function wrapRequest(request) { return new PersistencePromise(function (resolve, reject) { request.onsuccess = function (event) { var result = event.target.result; resolve(result); }; request.onerror = function (event) { reject(event.target.error); }; }); } /** * Copyright 2017 Google Inc. * * 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. */ var IndexedDbQueryCache = /** @class */ (function () { function IndexedDbQueryCache(referenceDelegate, serializer) { this.referenceDelegate = referenceDelegate; this.serializer = serializer; // PORTING NOTE: We don't cache global metadata for the query cache, since // some of it (in particular `highestTargetId`) can be modified by secondary // tabs. We could perhaps be more granular (and e.g. still cache // `lastRemoteSnapshotVersion` in memory) but for simplicity we currently go // to IndexedDb whenever we need to read metadata. We can revisit if it turns // out to have a meaningful performance impact. this.targetIdGenerator = TargetIdGenerator.forQueryCache(); } IndexedDbQueryCache.prototype.allocateTargetId = function (transaction) { var _this = this; return this.retrieveMetadata(transaction).next(function (metadata) { metadata.highestTargetId = _this.targetIdGenerator.after(metadata.highestTargetId); return _this.saveMetadata(transaction, metadata).next(function () { return metadata.highestTargetId; }); }); }; IndexedDbQueryCache.prototype.getLastRemoteSnapshotVersion = function (transaction) { return this.retrieveMetadata(transaction).next(function (metadata) { return SnapshotVersion.fromTimestamp(new Timestamp(metadata.lastRemoteSnapshotVersion.seconds, metadata.lastRemoteSnapshotVersion.nanoseconds)); }); }; IndexedDbQueryCache.prototype.getHighestSequenceNumber = function (transaction) { return getHighestListenSequenceNumber(transaction.simpleDbTransaction); }; IndexedDbQueryCache.prototype.setTargetsMetadata = function (transaction, highestListenSequenceNumber, lastRemoteSnapshotVersion) { var _this = this; return this.retrieveMetadata(transaction).next(function (metadata) { metadata.highestListenSequenceNumber = highestListenSequenceNumber; if (lastRemoteSnapshotVersion) { metadata.lastRemoteSnapshotVersion = lastRemoteSnapshotVersion.toTimestamp(); } if (highestListenSequenceNumber > metadata.highestListenSequenceNumber) { metadata.highestListenSequenceNumber = highestListenSequenceNumber; } return _this.saveMetadata(transaction, metadata); }); }; IndexedDbQueryCache.prototype.addQueryData = function (transaction, queryData) { var _this = this; return this.saveQueryData(transaction, queryData).next(function () { return _this.retrieveMetadata(transaction).next(function (metadata) { metadata.targetCount += 1; _this.updateMetadataFromQueryData(queryData, metadata); return _this.saveMetadata(transaction, metadata); }); }); }; IndexedDbQueryCache.prototype.updateQueryData = function (transaction, queryData) { return this.saveQueryData(transaction, queryData); }; IndexedDbQueryCache.prototype.removeQueryData = function (transaction, queryData) { var _this = this; return this.removeMatchingKeysForTargetId(transaction, queryData.targetId) .next(function () { return targetsStore(transaction).delete(queryData.targetId); }) .next(function () { return _this.retrieveMetadata(transaction); }) .next(function (metadata) { assert(metadata.targetCount > 0, 'Removing from an empty query cache'); metadata.targetCount -= 1; return _this.saveMetadata(transaction, metadata); }); }; /** * Drops any targets with sequence number less than or equal to the upper bound, excepting those * present in `activeTargetIds`. Document associations for the removed targets are also removed. * Returns the number of targets removed. */ IndexedDbQueryCache.prototype.removeTargets = function (txn, upperBound, activeTargetIds) { var _this = this; var count = 0; var promises = []; return targetsStore(txn) .iterate(function (key, value) { var queryData = _this.serializer.fromDbTarget(value); if (queryData.sequenceNumber <= upperBound && activeTargetIds[queryData.targetId] === undefined) { count++; promises.push(_this.removeQueryData(txn, queryData)); } }) .next(function () { return PersistencePromise.waitFor(promises); }) .next(function () { return count; }); }; /** * Call provided function with each `QueryData` that we have cached. */ IndexedDbQueryCache.prototype.forEachTarget = function (txn, f) { var _this = this; return targetsStore(txn).iterate(function (key, value) { var queryData = _this.serializer.fromDbTarget(value); f(queryData); }); }; IndexedDbQueryCache.prototype.retrieveMetadata = function (transaction) { return retrieveMetadata(transaction.simpleDbTransaction); }; IndexedDbQueryCache.prototype.saveMetadata = function (transaction, metadata) { return globalTargetStore(transaction).put(DbTargetGlobal.key, metadata); }; IndexedDbQueryCache.prototype.saveQueryData = function (transaction, queryData) { return targetsStore(transaction).put(this.serializer.toDbTarget(queryData)); }; /** * In-place updates the provided metadata to account for values in the given * QueryData. Saving is done separately. Returns true if there were any * changes to the metadata. */ IndexedDbQueryCache.prototype.updateMetadataFromQueryData = function (queryData, metadata) { var updated = false; if (queryData.targetId > metadata.highestTargetId) { metadata.highestTargetId = queryData.targetId; updated = true; } if (queryData.sequenceNumber > metadata.highestListenSequenceNumber) { metadata.highestListenSequenceNumber = queryData.sequenceNumber; updated = true; } return updated; }; IndexedDbQueryCache.prototype.getQueryCount = function (transaction) { return this.retrieveMetadata(transaction).next(function (metadata) { return metadata.targetCount; }); }; IndexedDbQueryCache.prototype.getQueryData = function (transaction, query) { var _this = this; // Iterating by the canonicalId may yield more than one result because // canonicalId values are not required to be unique per target. This query // depends on the queryTargets index to be efficient. var canonicalId = query.canonicalId(); var range = IDBKeyRange.bound([canonicalId, Number.NEGATIVE_INFINITY], [canonicalId, Number.POSITIVE_INFINITY]); var result = null; return targetsStore(transaction) .iterate({ range: range, index: DbTarget.queryTargetsIndexName }, function (key, value, control) { var found = _this.serializer.fromDbTarget(value); // After finding a potential match, check that the query is // actually equal to the requested query. if (query.isEqual(found.query)) { result = found; control.done(); } }) .next(function () { return result; }); }; IndexedDbQueryCache.prototype.addMatchingKeys = function (txn, keys, targetId) { var _this = this; // PORTING NOTE: The reverse index (documentsTargets) is maintained by // IndexedDb. var promises = []; var store = documentTargetStore(txn); keys.forEach(function (key) { var path = encode(key.path); promises.push(store.put(new DbTargetDocument(targetId, path))); promises.push(_this.referenceDelegate.addReference(txn, key)); }); return PersistencePromise.waitFor(promises); }; IndexedDbQueryCache.prototype.removeMatchingKeys = function (txn, keys, targetId) { var _this = this; // PORTING NOTE: The reverse index (documentsTargets) is maintained by // IndexedDb. var store = documentTargetStore(txn); return PersistencePromise.forEach(keys, function (key) { var path = encode(key.path); return PersistencePromise.waitFor([ store.delete([targetId, path]), _this.referenceDelegate.removeReference(txn, key) ]); }); }; IndexedDbQueryCache.prototype.removeMatchingKeysForTargetId = function (txn, targetId) { var store = documentTargetStore(txn); var range = IDBKeyRange.bound([targetId], [targetId + 1], /*lowerOpen=*/ false, /*upperOpen=*/ true); return store.delete(range); }; IndexedDbQueryCache.prototype.getMatchingKeysForTargetId = function (txn, targetId) { var range = IDBKeyRange.bound([targetId], [targetId + 1], /*lowerOpen=*/ false, /*upperOpen=*/ true); var store = documentTargetStore(txn); var result = documentKeySet(); return store .iterate({ range: range, keysOnly: true }, function (key, _, control) { var path = decode$1(key[1]); var docKey = new DocumentKey(path); result = result.add(docKey); }) .next(function () { return result; }); }; IndexedDbQueryCache.prototype.containsKey = function (txn, key) { var path = encode(key.path); var range = IDBKeyRange.bound([path], [immediateSuccessor(path)], /*lowerOpen=*/ false, /*upperOpen=*/ true); var count = 0; return documentTargetStore(txn) .iterate({ index: DbTargetDocument.documentTargetsIndex, keysOnly: true, range: range }, function (_a, _, control) { var targetId = _a[0], path = _a[1]; // Having a sentinel row for a document does not count as containing that document; // For the query cache, containing the document means the document is part of some // target. if (targetId !== 0) { count++; control.done(); } }) .next(function () { return count > 0; }); }; IndexedDbQueryCache.prototype.getQueryDataForTarget = function (transaction, targetId) { var _this = this; return targetsStore(transaction) .get(targetId) .next(function (found) { if (found) { return _this.serializer.fromDbTarget(found); } else { return null; } }); }; return IndexedDbQueryCache; }()); /** * Helper to get a typed SimpleDbStore for the queries object store. */ function targetsStore(txn) { return IndexedDbPersistence.getStore(txn, DbTarget.store); } /** * Helper to get a typed SimpleDbStore for the target globals object store. */ function globalTargetStore(txn) { return IndexedDbPersistence.getStore(txn, DbTargetGlobal.store); } function retrieveMetadata(txn) { var globalStore = SimpleDb.getStore(txn, DbTargetGlobal.store); return globalStore.get(DbTargetGlobal.key).next(function (metadata) { assert(metadata !== null, 'Missing metadata row.'); return metadata; }); } function getHighestListenSequenceNumber(txn) { return retrieveMetadata(txn).next(function (targetGlobal) { return targetGlobal.highestListenSequenceNumber; }); } /** * Helper to get a typed SimpleDbStore for the document target object store. */ function documentTargetStore(txn) { return IndexedDbPersistence.getStore(txn, DbTargetDocument.store); } /** * Copyright 2017 Google Inc. * * 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. */ /** * A map implementation that uses objects as keys. Objects must implement the * Equatable interface and must be immutable. Entries in the map are stored * together with the key being produced from the mapKeyFn. This map * automatically handles collisions of keys. */ var ObjectMap = /** @class */ (function () { function ObjectMap(mapKeyFn) { this.mapKeyFn = mapKeyFn; /** * The inner map for a key -> value pair. Due to the possibility of * collisions we keep a list of entries that we do a linear search through * to find an actual match. Note that collisions should be rare, so we still * expect near constant time lookups in practice. */ this.inner = {}; } /** Get a value for this key, or undefined if it does not exist. */ ObjectMap.prototype.get = function (key) { var id = this.mapKeyFn(key); var matches = this.inner[id]; if (matches === undefined) { return undefined; } for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { var _a = matches_1[_i], otherKey = _a[0], value = _a[1]; if (otherKey.isEqual(key)) { return value; } } return undefined; }; ObjectMap.prototype.has = function (key) { return this.get(key) !== undefined; }; /** Put this key and value in the map. */ ObjectMap.prototype.set = function (key, value) { var id = this.mapKeyFn(key); var matches = this.inner[id]; if (matches === undefined) { this.inner[id] = [[key, value]]; return; } for (var i = 0; i < matches.length; i++) { if (matches[i][0].isEqual(key)) { matches[i] = [key, value]; return; } } matches.push([key, value]); }; /** * Remove this key from the map. Returns a boolean if anything was deleted. */ ObjectMap.prototype.delete = function (key) { var id = this.mapKeyFn(key); var matches = this.inner[id]; if (matches === undefined) { return false; } for (var i = 0; i < matches.length; i++) { if (matches[i][0].isEqual(key)) { if (matches.length === 1) { delete this.inner[id]; } else { matches.splice(i, 1); } return true; } } return false; }; ObjectMap.prototype.forEach = function (fn) { forEach(this.inner, function (_, entries) { for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { var _a = entries_1[_i], k = _a[0], v = _a[1]; fn(k, v); } }); }; ObjectMap.prototype.isEmpty = function () { return isEmpty(this.inner); }; return ObjectMap; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * An in-memory buffer of entries to be written to a RemoteDocumentCache. * It can be used to batch up a set of changes to be written to the cache, but * additionally supports reading entries back with the `getEntry()` method, * falling back to the underlying RemoteDocumentCache if no entry is * buffered. * * Entries added to the cache *must* be read first. This is to facilitate * calculating the size delta of the pending changes. * * PORTING NOTE: This class was implemented then removed from other platforms. * If byte-counting ends up being needed on the other platforms, consider * porting this class as part of that implementation work. */ var RemoteDocumentChangeBuffer = /** @class */ (function () { function RemoteDocumentChangeBuffer() { this.changes = maybeDocumentMap(); this.documentSizes = new ObjectMap(function (key) { return key.toString(); }); } /** Buffers a `RemoteDocumentCache.addEntry()` call. */ RemoteDocumentChangeBuffer.prototype.addEntry = function (maybeDocument) { var changes = this.assertChanges(); this.changes = changes.insert(maybeDocument.key, maybeDocument); }; // NOTE: removeEntry() is intentionally omitted. If it needs to be added in // the future it must take byte counting into account. /** * Looks up an entry in the cache. The buffered changes will first be checked, * and if no buffered change applies, this will forward to * `RemoteDocumentCache.getEntry()`. * * @param transaction The transaction in which to perform any persistence * operations. * @param documentKey The key of the entry to look up. * @return The cached Document or NoDocument entry, or null if we have nothing * cached. */ RemoteDocumentChangeBuffer.prototype.getEntry = function (transaction, documentKey) { var _this = this; var changes = this.assertChanges(); var bufferedEntry = changes.get(documentKey); if (bufferedEntry) { return PersistencePromise.resolve(bufferedEntry); } else { // Record the size of everything we load from the cache so we can compute a delta later. return this.getFromCache(transaction, documentKey).next(function (getResult) { if (getResult === null) { _this.documentSizes.set(documentKey, 0); return null; } else { _this.documentSizes.set(documentKey, getResult.size); return getResult.maybeDocument; } }); } }; /** * Applies buffered changes to the underlying RemoteDocumentCache, using * the provided transaction. */ RemoteDocumentChangeBuffer.prototype.apply = function (transaction) { var result = this.applyChanges(transaction); // We should not buffer any more changes. this.changes = null; return result; }; /** Helper to assert this.changes is not null and return it. */ RemoteDocumentChangeBuffer.prototype.assertChanges = function () { assert(this.changes !== null, 'Changes have already been applied.'); return this.changes; }; return RemoteDocumentChangeBuffer; }()); /** * Copyright 2017 Google Inc. * * 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. */ var REMOTE_DOCUMENT_CHANGE_MISSING_ERR_MSG = 'The remote document changelog no longer contains all changes for all ' + 'local query views. It may be necessary to rebuild these views.'; var IndexedDbRemoteDocumentCache = /** @class */ (function () { /** * @param {LocalSerializer} serializer The document serializer. * @param keepDocumentChangeLog Whether to keep a document change log in * IndexedDb. This change log is required for Multi-Tab synchronization, but * not needed in clients that don't share access to their remote document * cache. */ function IndexedDbRemoteDocumentCache(serializer, keepDocumentChangeLog) { this.serializer = serializer; this.keepDocumentChangeLog = keepDocumentChangeLog; /** The last id read by `getNewDocumentChanges()`. */ this._lastProcessedDocumentChangeId = 0; } Object.defineProperty(IndexedDbRemoteDocumentCache.prototype, "lastProcessedDocumentChangeId", { get: function () { return this._lastProcessedDocumentChangeId; }, enumerable: true, configurable: true }); /** * Starts up the remote document cache. * * Reads the ID of the last document change from the documentChanges store. * Existing changes will not be returned as part of * `getNewDocumentChanges()`. */ // PORTING NOTE: This is only used for multi-tab synchronization. IndexedDbRemoteDocumentCache.prototype.start = function (transaction) { var store = SimpleDb.getStore(transaction, DbRemoteDocumentChanges.store); return this.synchronizeLastDocumentChangeId(store); }; /** * Adds the supplied entries to the cache. Adds the given size delta to the cached size. */ IndexedDbRemoteDocumentCache.prototype.addEntries = function (transaction, entries, sizeDelta) { var promises = []; if (entries.length > 0) { var documentStore = remoteDocumentsStore(transaction); var changedKeys = documentKeySet(); for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { var _a = entries_1[_i], key = _a.key, doc = _a.doc; promises.push(documentStore.put(dbKey(key), doc)); changedKeys = changedKeys.add(key); } if (this.keepDocumentChangeLog) { promises.push(documentChangesStore(transaction).put({ changes: this.serializer.toDbResourcePaths(changedKeys) })); } promises.push(this.updateSize(transaction, sizeDelta)); } return PersistencePromise.waitFor(promises); }; /** * Removes a document from the cache. Note that this method does *not* do any * size accounting. It is the responsibility of the caller to count the bytes removed * and issue a final updateSize() call after removing documents. * * @param documentKey The key of the document to remove * @return The size of the document that was removed. */ IndexedDbRemoteDocumentCache.prototype.removeEntry = function (transaction, documentKey) { // We don't need to keep changelog for these removals since `removeEntry` is // only used for garbage collection. var store = remoteDocumentsStore(transaction); var key = dbKey(documentKey); return store.get(key).next(function (document) { if (document) { return store.delete(key).next(function () { return dbDocumentSize(document); }); } else { return PersistencePromise.resolve(0); } }); }; IndexedDbRemoteDocumentCache.prototype.getEntry = function (transaction, documentKey) { var _this = this; return remoteDocumentsStore(transaction) .get(dbKey(documentKey)) .next(function (dbRemoteDoc) { return dbRemoteDoc ? _this.serializer.fromDbRemoteDocument(dbRemoteDoc) : null; }); }; /** * Looks up an entry in the cache. * * @param documentKey The key of the entry to look up. * @return The cached MaybeDocument entry and its size, or null if we have nothing cached. */ IndexedDbRemoteDocumentCache.prototype.getSizedEntry = function (transaction, documentKey) { var _this = this; return remoteDocumentsStore(transaction) .get(dbKey(documentKey)) .next(function (dbRemoteDoc) { return dbRemoteDoc ? { maybeDocument: _this.serializer.fromDbRemoteDocument(dbRemoteDoc), size: dbDocumentSize(dbRemoteDoc) } : null; }); }; IndexedDbRemoteDocumentCache.prototype.getDocumentsMatchingQuery = function (transaction, query) { var _this = this; var results = documentMap(); // Documents are ordered by key, so we can use a prefix scan to narrow down // the documents we need to match the query against. var startKey = query.path.toArray(); var range = IDBKeyRange.lowerBound(startKey); return remoteDocumentsStore(transaction) .iterate({ range: range }, function (key, dbRemoteDoc, control) { var maybeDoc = _this.serializer.fromDbRemoteDocument(dbRemoteDoc); if (!query.path.isPrefixOf(maybeDoc.key.path)) { control.done(); } else if (maybeDoc instanceof Document && query.matches(maybeDoc)) { results = results.insert(maybeDoc.key, maybeDoc); } }) .next(function () { return results; }); }; IndexedDbRemoteDocumentCache.prototype.getNewDocumentChanges = function (transaction) { var _this = this; assert(this.keepDocumentChangeLog, 'Can only call getNewDocumentChanges() when document change log is enabled'); var changedKeys = documentKeySet(); var changedDocs = maybeDocumentMap(); var range = IDBKeyRange.lowerBound(this._lastProcessedDocumentChangeId + 1); var firstIteration = true; var changesStore = documentChangesStore(transaction); return changesStore .iterate({ range: range }, function (_, documentChange) { if (firstIteration) { firstIteration = false; // If our client was throttled for more than 30 minutes, another // client may have garbage collected the remote document changelog. if (_this._lastProcessedDocumentChangeId + 1 !== documentChange.id) { // Reset the `lastProcessedDocumentChangeId` to allow further // invocations to successfully return the changes after this // rejection. return _this.synchronizeLastDocumentChangeId(changesStore).next(function () { return PersistencePromise.reject(new FirestoreError(Code.DATA_LOSS, REMOTE_DOCUMENT_CHANGE_MISSING_ERR_MSG)); }); } } changedKeys = changedKeys.unionWith(_this.serializer.fromDbResourcePaths(documentChange.changes)); _this._lastProcessedDocumentChangeId = documentChange.id; }) .next(function () { var documentPromises = []; changedKeys.forEach(function (key) { documentPromises.push(_this.getEntry(transaction, key).next(function (maybeDocument) { var doc = maybeDocument || new NoDocument(key, SnapshotVersion.forDeletedDoc()); changedDocs = changedDocs.insert(key, doc); })); }); return PersistencePromise.waitFor(documentPromises); }) .next(function () { return changedDocs; }); }; /** * Removes all changes in the remote document changelog through `changeId` * (inclusive). */ IndexedDbRemoteDocumentCache.prototype.removeDocumentChangesThroughChangeId = function (transaction, changeId) { var range = IDBKeyRange.upperBound(changeId); return documentChangesStore(transaction).delete(range); }; IndexedDbRemoteDocumentCache.prototype.synchronizeLastDocumentChangeId = function (documentChangesStore) { var _this = this; // If there are no existing changes, we set `lastProcessedDocumentChangeId` // to 0 since IndexedDb's auto-generated keys start at 1. this._lastProcessedDocumentChangeId = 0; return documentChangesStore.iterate({ keysOnly: true, reverse: true }, function (key, value, control) { _this._lastProcessedDocumentChangeId = key; control.done(); }); }; IndexedDbRemoteDocumentCache.prototype.newChangeBuffer = function () { return new IndexedDbRemoteDocumentChangeBuffer(this); }; IndexedDbRemoteDocumentCache.prototype.getSize = function (txn) { return this.getMetadata(txn).next(function (metadata) { return metadata.byteSize; }); }; IndexedDbRemoteDocumentCache.prototype.getMetadata = function (txn) { return documentGlobalStore(txn) .get(DbRemoteDocumentGlobal.key) .next(function (metadata) { assert(!!metadata, 'Missing document cache metadata'); return metadata; }); }; IndexedDbRemoteDocumentCache.prototype.setMetadata = function (txn, metadata) { return documentGlobalStore(txn).put(DbRemoteDocumentGlobal.key, metadata); }; /** * Adds the given delta to the cached current size. Callers to removeEntry *must* call this * afterwards to update the size of the cache. * * @param sizeDelta */ IndexedDbRemoteDocumentCache.prototype.updateSize = function (txn, sizeDelta) { var _this = this; return this.getMetadata(txn).next(function (metadata) { metadata.byteSize += sizeDelta; return _this.setMetadata(txn, metadata); }); }; return IndexedDbRemoteDocumentCache; }()); function documentGlobalStore(txn) { return IndexedDbPersistence.getStore(txn, DbRemoteDocumentGlobal.store); } /** * Handles the details of adding and updating documents in the IndexedDbRemoteDocumentCache */ var IndexedDbRemoteDocumentChangeBuffer = /** @class */ (function (_super) { tslib_1.__extends(IndexedDbRemoteDocumentChangeBuffer, _super); function IndexedDbRemoteDocumentChangeBuffer(documentCache) { var _this = _super.call(this) || this; _this.documentCache = documentCache; return _this; } IndexedDbRemoteDocumentChangeBuffer.prototype.applyChanges = function (transaction) { var _this = this; var changes = this.assertChanges(); var delta = 0; var toApply = []; changes.forEach(function (key, maybeDocument) { var doc = _this.documentCache.serializer.toDbRemoteDocument(maybeDocument); var previousSize = _this.documentSizes.get(key); // NOTE: if we ever decide we need to support doing writes without // reading first, this assert will need to change to do the read automatically. assert(previousSize !== undefined, "Attempting to change document " + key.toString() + " without having read it first"); var size = dbDocumentSize(doc); delta += size - previousSize; toApply.push({ key: key, doc: doc }); }); return this.documentCache.addEntries(transaction, toApply, delta); }; IndexedDbRemoteDocumentChangeBuffer.prototype.getFromCache = function (transaction, documentKey) { return this.documentCache.getSizedEntry(transaction, documentKey); }; return IndexedDbRemoteDocumentChangeBuffer; }(RemoteDocumentChangeBuffer)); function isDocumentChangeMissingError(err) { return (err.code === Code.DATA_LOSS && err.message === REMOTE_DOCUMENT_CHANGE_MISSING_ERR_MSG); } /** * Helper to get a typed SimpleDbStore for the remoteDocuments object store. */ function remoteDocumentsStore(txn) { return IndexedDbPersistence.getStore(txn, DbRemoteDocument.store); } /** * Helper to get a typed SimpleDbStore for the remoteDocumentChanges object * store. */ function documentChangesStore(txn) { return IndexedDbPersistence.getStore(txn, DbRemoteDocumentChanges.store); } function dbKey(docKey) { return docKey.path.toArray(); } /** * Retrusn an approximate size for the given document. */ function dbDocumentSize(doc) { var value; if (doc.document) { value = doc.document; } else if (doc.unknownDocument) { value = doc.unknownDocument; } else if (doc.noDocument) { value = doc.noDocument; } else { throw fail('Unknown remote document type'); } return JSON.stringify(value).length; } /** * Copyright 2017 Google Inc. * * 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. */ /** * Schema Version for the Web client: * 1. Initial version including Mutation Queue, Query Cache, and Remote Document * Cache * 2. Used to ensure a targetGlobal object exists and add targetCount to it. No * longer required because migration 3 unconditionally clears it. * 3. Dropped and re-created Query Cache to deal with cache corruption related * to limbo resolution. Addresses * https://github.com/firebase/firebase-ios-sdk/issues/1548 * 4. Multi-Tab Support. * 5. Removal of held write acks. * 6. Create document global for tracking document cache size. * 7. Ensure every cached document has a sentinel row with a sequence number. */ var SCHEMA_VERSION = 7; /** Performs database creation and schema upgrades. */ var SchemaConverter = /** @class */ (function () { function SchemaConverter(serializer) { this.serializer = serializer; } /** * Performs database creation and schema upgrades. * * Note that in production, this method is only ever used to upgrade the schema * to SCHEMA_VERSION. Different values of toVersion are only used for testing * and local feature development. */ SchemaConverter.prototype.createOrUpgrade = function (db, txn, fromVersion, toVersion) { var _this = this; assert(fromVersion < toVersion && fromVersion >= 0 && toVersion <= SCHEMA_VERSION, "Unexpected schema upgrade from v" + fromVersion + " to v{toVersion}."); if (fromVersion < 1 && toVersion >= 1) { createPrimaryClientStore(db); createMutationQueue(db); createQueryCache(db); createRemoteDocumentCache(db); } // Migration 2 to populate the targetGlobal object no longer needed since // migration 3 unconditionally clears it. var p = PersistencePromise.resolve(); if (fromVersion < 3 && toVersion >= 3) { // Brand new clients don't need to drop and recreate--only clients that // potentially have corrupt data. if (fromVersion !== 0) { dropQueryCache(db); createQueryCache(db); } p = p.next(function () { return writeEmptyTargetGlobalEntry(txn); }); } if (fromVersion < 4 && toVersion >= 4) { if (fromVersion !== 0) { // Schema version 3 uses auto-generated keys to generate globally unique // mutation batch IDs (this was previously ensured internally by the // client). To migrate to the new schema, we have to read all mutations // and write them back out. We preserve the existing batch IDs to guarantee // consistency with other object stores. Any further mutation batch IDs will // be auto-generated. p = p.next(function () { return upgradeMutationBatchSchemaAndMigrateData(db, txn); }); } p = p.next(function () { createClientMetadataStore(db); createRemoteDocumentChangesStore(db); }); } if (fromVersion < 5 && toVersion >= 5) { p = p.next(function () { return _this.removeAcknowledgedMutations(txn); }); } if (fromVersion < 6 && toVersion >= 6) { p = p.next(function () { createDocumentGlobalStore(db); return _this.addDocumentGlobal(txn); }); } if (fromVersion < 7 && toVersion >= 7) { p = p.next(function () { return _this.ensureSequenceNumbers(txn); }); } return p; }; SchemaConverter.prototype.addDocumentGlobal = function (txn) { var byteCount = 0; return txn .store(DbRemoteDocument.store) .iterate(function (_, doc) { byteCount += dbDocumentSize(doc); }) .next(function () { var metadata = new DbRemoteDocumentGlobal(byteCount); return txn .store(DbRemoteDocumentGlobal.store) .put(DbRemoteDocumentGlobal.key, metadata); }); }; SchemaConverter.prototype.removeAcknowledgedMutations = function (txn) { var _this = this; var queuesStore = txn.store(DbMutationQueue.store); var mutationsStore = txn.store(DbMutationBatch.store); return queuesStore.loadAll().next(function (queues) { return PersistencePromise.forEach(queues, function (queue) { var range = IDBKeyRange.bound([queue.userId, BATCHID_UNKNOWN], [queue.userId, queue.lastAcknowledgedBatchId]); return mutationsStore .loadAll(DbMutationBatch.userMutationsIndex, range) .next(function (dbBatches) { return PersistencePromise.forEach(dbBatches, function (dbBatch) { assert(dbBatch.userId === queue.userId, "Cannot process batch " + dbBatch.batchId + " from unexpected user"); var batch = _this.serializer.fromDbMutationBatch(dbBatch); return removeMutationBatch(txn, queue.userId, batch).next(function () { }); }); }); }); }); }; /** * Ensures that every document in the remote document cache has a corresponding sentinel row * with a sequence number. Missing rows are given the most recently used sequence number. */ SchemaConverter.prototype.ensureSequenceNumbers = function (txn) { var documentTargetStore$$1 = txn.store(DbTargetDocument.store); var documentsStore = txn.store(DbRemoteDocument.store); return getHighestListenSequenceNumber(txn).next(function (currentSequenceNumber) { var writeSentinelKey = function (path) { return documentTargetStore$$1.put(new DbTargetDocument(0, encode(path), currentSequenceNumber)); }; var promises = []; return documentsStore .iterate(function (key, doc) { var path = new ResourcePath(key); var docSentinelKey = sentinelKey(path); promises.push(documentTargetStore$$1.get(docSentinelKey).next(function (maybeSentinel) { if (!maybeSentinel) { return writeSentinelKey(path); } else { return PersistencePromise.resolve(); } })); }) .next(function () { return PersistencePromise.waitFor(promises); }); }); }; return SchemaConverter; }()); function sentinelKey(path) { return [0, encode(path)]; } /** * Wrapper class to store timestamps (seconds and nanos) in IndexedDb objects. */ var DbTimestamp = /** @class */ (function () { function DbTimestamp(seconds, nanoseconds) { this.seconds = seconds; this.nanoseconds = nanoseconds; } return DbTimestamp; }()); /** * A singleton object to be stored in the 'owner' store in IndexedDb. * * A given database can have a single primary tab assigned at a given time. That * tab must validate that it is still holding the primary lease before every * operation that requires locked access. The primary tab should regularly * write an updated timestamp to this lease to prevent other tabs from * "stealing" the primary lease */ var DbPrimaryClient = /** @class */ (function () { function DbPrimaryClient(ownerId, /** Whether to allow shared access from multiple tabs. */ allowTabSynchronization, leaseTimestampMs) { this.ownerId = ownerId; this.allowTabSynchronization = allowTabSynchronization; this.leaseTimestampMs = leaseTimestampMs; } /** * Name of the IndexedDb object store. * * Note that the name 'owner' is chosen to ensure backwards compatibility with * older clients that only supported single locked access to the persistence * layer. */ DbPrimaryClient.store = 'owner'; /** * The key string used for the single object that exists in the * DbPrimaryClient store. */ DbPrimaryClient.key = 'owner'; return DbPrimaryClient; }()); function createPrimaryClientStore(db) { db.createObjectStore(DbPrimaryClient.store); } /** * An object to be stored in the 'mutationQueues' store in IndexedDb. * * Each user gets a single queue of MutationBatches to apply to the server. * DbMutationQueue tracks the metadata about the queue. */ var DbMutationQueue = /** @class */ (function () { function DbMutationQueue( /** * The normalized user ID to which this queue belongs. */ userId, /** * An identifier for the highest numbered batch that has been acknowledged * by the server. All MutationBatches in this queue with batchIds less * than or equal to this value are considered to have been acknowledged by * the server. */ lastAcknowledgedBatchId, /** * A stream token that was previously sent by the server. * * See StreamingWriteRequest in datastore.proto for more details about * usage. * * After sending this token, earlier tokens may not be used anymore so * only a single stream token is retained. */ lastStreamToken) { this.userId = userId; this.lastAcknowledgedBatchId = lastAcknowledgedBatchId; this.lastStreamToken = lastStreamToken; } /** Name of the IndexedDb object store. */ DbMutationQueue.store = 'mutationQueues'; /** Keys are automatically assigned via the userId property. */ DbMutationQueue.keyPath = 'userId'; return DbMutationQueue; }()); /** * An object to be stored in the 'mutations' store in IndexedDb. * * Represents a batch of user-level mutations intended to be sent to the server * in a single write. Each user-level batch gets a separate DbMutationBatch * with a new batchId. */ var DbMutationBatch = /** @class */ (function () { function DbMutationBatch( /** * The normalized user ID to which this batch belongs. */ userId, /** * An identifier for this batch, allocated using an auto-generated key. */ batchId, /** * The local write time of the batch, stored as milliseconds since the * epoch. */ localWriteTimeMs, /** * A list of mutations to apply. All mutations will be applied atomically. * * Mutations are serialized via JsonProtoSerializer.toMutation(). */ mutations) { this.userId = userId; this.batchId = batchId; this.localWriteTimeMs = localWriteTimeMs; this.mutations = mutations; } /** Name of the IndexedDb object store. */ DbMutationBatch.store = 'mutations'; /** Keys are automatically assigned via the userId, batchId properties. */ DbMutationBatch.keyPath = 'batchId'; /** The index name for lookup of mutations by user. */ DbMutationBatch.userMutationsIndex = 'userMutationsIndex'; /** The user mutations index is keyed by [userId, batchId] pairs. */ DbMutationBatch.userMutationsKeyPath = ['userId', 'batchId']; return DbMutationBatch; }()); function createMutationQueue(db) { db.createObjectStore(DbMutationQueue.store, { keyPath: DbMutationQueue.keyPath }); var mutationBatchesStore = db.createObjectStore(DbMutationBatch.store, { keyPath: DbMutationBatch.keyPath, autoIncrement: true }); mutationBatchesStore.createIndex(DbMutationBatch.userMutationsIndex, DbMutationBatch.userMutationsKeyPath, { unique: true }); db.createObjectStore(DbDocumentMutation.store); } /** * Upgrade function to migrate the 'mutations' store from V1 to V3. Loads * and rewrites all data. */ function upgradeMutationBatchSchemaAndMigrateData(db, txn) { var v1MutationsStore = txn.store(DbMutationBatch.store); return v1MutationsStore.loadAll().next(function (existingMutations) { db.deleteObjectStore(DbMutationBatch.store); var mutationsStore = db.createObjectStore(DbMutationBatch.store, { keyPath: DbMutationBatch.keyPath, autoIncrement: true }); mutationsStore.createIndex(DbMutationBatch.userMutationsIndex, DbMutationBatch.userMutationsKeyPath, { unique: true }); var v3MutationsStore = txn.store(DbMutationBatch.store); var writeAll = existingMutations.map(function (mutation) { return v3MutationsStore.put(mutation); }); return PersistencePromise.waitFor(writeAll); }); } /** * An object to be stored in the 'documentMutations' store in IndexedDb. * * A manually maintained index of all the mutation batches that affect a given * document key. The rows in this table are references based on the contents of * DbMutationBatch.mutations. */ var DbDocumentMutation = /** @class */ (function () { function DbDocumentMutation() { } /** * Creates a [userId] key for use in the DbDocumentMutations index to iterate * over all of a user's document mutations. */ DbDocumentMutation.prefixForUser = function (userId) { return [userId]; }; /** * Creates a [userId, encodedPath] key for use in the DbDocumentMutations * index to iterate over all at document mutations for a given path or lower. */ DbDocumentMutation.prefixForPath = function (userId, path) { return [userId, encode(path)]; }; /** * Creates a full index key of [userId, encodedPath, batchId] for inserting * and deleting into the DbDocumentMutations index. */ DbDocumentMutation.key = function (userId, path, batchId) { return [userId, encode(path), batchId]; }; DbDocumentMutation.store = 'documentMutations'; /** * Because we store all the useful information for this store in the key, * there is no useful information to store as the value. The raw (unencoded) * path cannot be stored because IndexedDb doesn't store prototype * information. */ DbDocumentMutation.PLACEHOLDER = new DbDocumentMutation(); return DbDocumentMutation; }()); function createRemoteDocumentCache(db) { db.createObjectStore(DbRemoteDocument.store); } /** * Represents the known absence of a document at a particular version. * Stored in IndexedDb as part of a DbRemoteDocument object. */ var DbNoDocument = /** @class */ (function () { function DbNoDocument(path, readTime) { this.path = path; this.readTime = readTime; } return DbNoDocument; }()); /** * Represents a document that is known to exist but whose data is unknown. * Stored in IndexedDb as part of a DbRemoteDocument object. */ var DbUnknownDocument = /** @class */ (function () { function DbUnknownDocument(path, version) { this.path = path; this.version = version; } return DbUnknownDocument; }()); /** * An object to be stored in the 'remoteDocuments' store in IndexedDb. * It represents either: * * - A complete document. * - A "no document" representing a document that is known not to exist (at * some version). * - An "unknown document" representing a document that is known to exist (at * some version) but whose contents are unknown. * * Note: This is the persisted equivalent of a MaybeDocument and could perhaps * be made more general if necessary. */ var DbRemoteDocument = /** @class */ (function () { function DbRemoteDocument( /** * Set to an instance of DbUnknownDocument if the data for a document is * not known, but it is known that a document exists at the specified * version (e.g. it had a successful update applied to it) */ unknownDocument, /** * Set to an instance of a DbNoDocument if it is known that no document * exists. */ noDocument, /** * Set to an instance of a Document if there's a cached version of the * document. */ document, /** * Documents that were written to the remote document store based on * a write acknowledgment are marked with `hasCommittedMutations`. These * documents are potentially inconsistent with the backend's copy and use * the write's commit version as their document version. */ hasCommittedMutations) { this.unknownDocument = unknownDocument; this.noDocument = noDocument; this.document = document; this.hasCommittedMutations = hasCommittedMutations; } DbRemoteDocument.store = 'remoteDocuments'; return DbRemoteDocument; }()); /** * Contains a single entry that has metadata about the remote document cache. */ var DbRemoteDocumentGlobal = /** @class */ (function () { /** * @param byteSize Approximately the total size in bytes of all the documents in the document * cache. */ function DbRemoteDocumentGlobal(byteSize) { this.byteSize = byteSize; } DbRemoteDocumentGlobal.store = 'remoteDocumentGlobal'; DbRemoteDocumentGlobal.key = 'remoteDocumentGlobalKey'; return DbRemoteDocumentGlobal; }()); function createDocumentGlobalStore(db) { db.createObjectStore(DbRemoteDocumentGlobal.store); } /** * An object to be stored in the 'targets' store in IndexedDb. * * This is based on and should be kept in sync with the proto used in the iOS * client. * * Each query the client listens to against the server is tracked on disk so * that the query can be efficiently resumed on restart. */ var DbTarget = /** @class */ (function () { function DbTarget( /** * An auto-generated sequential numeric identifier for the query. * * Queries are stored using their canonicalId as the key, but these * canonicalIds can be quite long so we additionally assign a unique * queryId which can be used by referenced data structures (e.g. * indexes) to minimize the on-disk cost. */ targetId, /** * The canonical string representing this query. This is not unique. */ canonicalId, /** * The last readTime received from the Watch Service for this query. * * This is the same value as TargetChange.read_time in the protos. */ readTime, /** * An opaque, server-assigned token that allows watching a query to be * resumed after disconnecting without retransmitting all the data * that matches the query. The resume token essentially identifies a * point in time from which the server should resume sending results. * * This is related to the snapshotVersion in that the resumeToken * effectively also encodes that value, but the resumeToken is opaque * and sometimes encodes additional information. * * A consequence of this is that the resumeToken should be used when * asking the server to reason about where this client is in the watch * stream, but the client should use the snapshotVersion for its own * purposes. * * This is the same value as TargetChange.resume_token in the protos. */ resumeToken, /** * A sequence number representing the last time this query was * listened to, used for garbage collection purposes. * * Conventionally this would be a timestamp value, but device-local * clocks are unreliable and they must be able to create new listens * even while disconnected. Instead this should be a monotonically * increasing number that's incremented on each listen call. * * This is different from the queryId since the queryId is an * immutable identifier assigned to the Query on first use while * lastListenSequenceNumber is updated every time the query is * listened to. */ lastListenSequenceNumber, /** * The query for this target. * * Because canonical ids are not unique we must store the actual query. We * use the proto to have an object we can persist without having to * duplicate translation logic to and from a `Query` object. */ query) { this.targetId = targetId; this.canonicalId = canonicalId; this.readTime = readTime; this.resumeToken = resumeToken; this.lastListenSequenceNumber = lastListenSequenceNumber; this.query = query; } DbTarget.store = 'targets'; /** Keys are automatically assigned via the targetId property. */ DbTarget.keyPath = 'targetId'; /** The name of the queryTargets index. */ DbTarget.queryTargetsIndexName = 'queryTargetsIndex'; /** * The index of all canonicalIds to the targets that they match. This is not * a unique mapping because canonicalId does not promise a unique name for all * possible queries, so we append the targetId to make the mapping unique. */ DbTarget.queryTargetsKeyPath = ['canonicalId', 'targetId']; return DbTarget; }()); /** * An object representing an association between a target and a document, or a * sentinel row marking the last sequence number at which a document was used. * Each document cached must have a corresponding sentinel row before lru * garbage collection is enabled. * * The target associations and sentinel rows are co-located so that orphaned * documents and their sequence numbers can be identified efficiently via a scan * of this store. */ var DbTargetDocument = /** @class */ (function () { function DbTargetDocument( /** * The targetId identifying a target or 0 for a sentinel row. */ targetId, /** * The path to the document, as encoded in the key. */ path, /** * If this is a sentinel row, this should be the sequence number of the last * time the document specified by `path` was used. Otherwise, it should be * `undefined`. */ sequenceNumber) { this.targetId = targetId; this.path = path; this.sequenceNumber = sequenceNumber; assert((targetId === 0) === (sequenceNumber !== undefined), // tslint:disable-next-line:max-line-length 'A target-document row must either have targetId == 0 and a defined sequence number, or a non-zero targetId and no sequence number'); } /** Name of the IndexedDb object store. */ DbTargetDocument.store = 'targetDocuments'; /** Keys are automatically assigned via the targetId, path properties. */ DbTargetDocument.keyPath = ['targetId', 'path']; /** The index name for the reverse index. */ DbTargetDocument.documentTargetsIndex = 'documentTargetsIndex'; /** We also need to create the reverse index for these properties. */ DbTargetDocument.documentTargetsKeyPath = ['path', 'targetId']; return DbTargetDocument; }()); /** * A record of global state tracked across all Targets, tracked separately * to avoid the need for extra indexes. * * This should be kept in-sync with the proto used in the iOS client. */ var DbTargetGlobal = /** @class */ (function () { function DbTargetGlobal( /** * The highest numbered target id across all targets. * * See DbTarget.targetId. */ highestTargetId, /** * The highest numbered lastListenSequenceNumber across all targets. * * See DbTarget.lastListenSequenceNumber. */ highestListenSequenceNumber, /** * A global snapshot version representing the last consistent snapshot we * received from the backend. This is monotonically increasing and any * snapshots received from the backend prior to this version (e.g. for * targets resumed with a resumeToken) should be suppressed (buffered) * until the backend has caught up to this snapshot version again. This * prevents our cache from ever going backwards in time. */ lastRemoteSnapshotVersion, /** * The number of targets persisted. */ targetCount) { this.highestTargetId = highestTargetId; this.highestListenSequenceNumber = highestListenSequenceNumber; this.lastRemoteSnapshotVersion = lastRemoteSnapshotVersion; this.targetCount = targetCount; } /** * The key string used for the single object that exists in the * DbTargetGlobal store. */ DbTargetGlobal.key = 'targetGlobalKey'; DbTargetGlobal.store = 'targetGlobal'; return DbTargetGlobal; }()); function createQueryCache(db) { var targetDocumentsStore = db.createObjectStore(DbTargetDocument.store, { keyPath: DbTargetDocument.keyPath }); targetDocumentsStore.createIndex(DbTargetDocument.documentTargetsIndex, DbTargetDocument.documentTargetsKeyPath, { unique: true }); var targetStore = db.createObjectStore(DbTarget.store, { keyPath: DbTarget.keyPath }); // NOTE: This is unique only because the TargetId is the suffix. targetStore.createIndex(DbTarget.queryTargetsIndexName, DbTarget.queryTargetsKeyPath, { unique: true }); db.createObjectStore(DbTargetGlobal.store); } function dropQueryCache(db) { db.deleteObjectStore(DbTargetDocument.store); db.deleteObjectStore(DbTarget.store); db.deleteObjectStore(DbTargetGlobal.store); } /** * Creates the target global singleton row. * * @param {IDBTransaction} txn The version upgrade transaction for indexeddb */ function writeEmptyTargetGlobalEntry(txn) { var globalStore = txn.store(DbTargetGlobal.store); var metadata = new DbTargetGlobal( /*highestTargetId=*/ 0, /*lastListenSequenceNumber=*/ 0, SnapshotVersion.MIN.toTimestamp(), /*targetCount=*/ 0); return globalStore.put(DbTargetGlobal.key, metadata); } /** * An object store to store the keys of changed documents. This is used to * facilitate storing document changelogs in the Remote Document Cache. * * PORTING NOTE: This is used for change propagation during multi-tab syncing * and not needed on iOS and Android. */ var DbRemoteDocumentChanges = /** @class */ (function () { function DbRemoteDocumentChanges( /** The keys of the changed documents. */ changes) { this.changes = changes; } /** Name of the IndexedDb object store. */ DbRemoteDocumentChanges.store = 'remoteDocumentChanges'; /** Keys are auto-generated via the `id` property. */ DbRemoteDocumentChanges.keyPath = 'id'; return DbRemoteDocumentChanges; }()); function createRemoteDocumentChangesStore(db) { db.createObjectStore(DbRemoteDocumentChanges.store, { keyPath: 'id', autoIncrement: true }); } /** * A record of the metadata state of each client. * * PORTING NOTE: This is used to synchronize multi-tab state and does not need * to be ported to iOS or Android. */ var DbClientMetadata = /** @class */ (function () { function DbClientMetadata( /** The auto-generated client id assigned at client startup. */ clientId, /** The last time this state was updated. */ updateTimeMs, /** Whether the client's network connection is enabled. */ networkEnabled, /** Whether this client is running in a foreground tab. */ inForeground, /** * The last change read from the DbRemoteDocumentChanges store. * Can be undefined for backwards compatibility. */ lastProcessedDocumentChangeId) { this.clientId = clientId; this.updateTimeMs = updateTimeMs; this.networkEnabled = networkEnabled; this.inForeground = inForeground; this.lastProcessedDocumentChangeId = lastProcessedDocumentChangeId; } /** Name of the IndexedDb object store. */ DbClientMetadata.store = 'clientMetadata'; /** Keys are automatically assigned via the clientId properties. */ DbClientMetadata.keyPath = 'clientId'; return DbClientMetadata; }()); function createClientMetadataStore(db) { db.createObjectStore(DbClientMetadata.store, { keyPath: DbClientMetadata.keyPath }); } // Visible for testing var V1_STORES = [ DbMutationQueue.store, DbMutationBatch.store, DbDocumentMutation.store, DbRemoteDocument.store, DbTarget.store, DbPrimaryClient.store, DbTargetGlobal.store, DbTargetDocument.store ]; // V2 is no longer usable (see comment at top of file) // Visible for testing var V3_STORES = V1_STORES; // Visible for testing var V4_STORES = V3_STORES.concat([ DbClientMetadata.store, DbRemoteDocumentChanges.store ]); // V5 does not change the set of stores. var V6_STORES = V4_STORES.concat([DbRemoteDocumentGlobal.store]); /** * The list of all default IndexedDB stores used throughout the SDK. This is * used when creating transactions so that access across all stores is done * atomically. */ var ALL_STORES = V6_STORES; /** * Copyright 2017 Google Inc. * * 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. */ /** A mutation queue for a specific user, backed by IndexedDB. */ var IndexedDbMutationQueue = /** @class */ (function () { function IndexedDbMutationQueue( /** * The normalized userId (e.g. null UID => "" userId) used to store / * retrieve mutations. */ userId, serializer, referenceDelegate) { this.userId = userId; this.serializer = serializer; this.referenceDelegate = referenceDelegate; /** * Caches the document keys for pending mutation batches. If the mutation * has been removed from IndexedDb, the cached value may continue to * be used to retrieve the batch's document keys. To remove a cached value * locally, `removeCachedMutationKeys()` should be invoked either directly * or through `removeMutationBatches()`. * * With multi-tab, when the primary client acknowledges or rejects a mutation, * this cache is used by secondary clients to invalidate the local * view of the documents that were previously affected by the mutation. */ // PORTING NOTE: Multi-tab only. this.documentKeysByBatchId = {}; } /** * Creates a new mutation queue for the given user. * @param user The user for which to create a mutation queue. * @param serializer The serializer to use when persisting to IndexedDb. */ IndexedDbMutationQueue.forUser = function (user, serializer, referenceDelegate) { // TODO(mcg): Figure out what constraints there are on userIDs // In particular, are there any reserved characters? are empty ids allowed? // For the moment store these together in the same mutations table assuming // that empty userIDs aren't allowed. assert(user.uid !== '', 'UserID must not be an empty string.'); var userId = user.isAuthenticated() ? user.uid : ''; return new IndexedDbMutationQueue(userId, serializer, referenceDelegate); }; IndexedDbMutationQueue.prototype.checkEmpty = function (transaction) { var empty = true; var range = IDBKeyRange.bound([this.userId, Number.NEGATIVE_INFINITY], [this.userId, Number.POSITIVE_INFINITY]); return mutationsStore(transaction) .iterate({ index: DbMutationBatch.userMutationsIndex, range: range }, function (key, value, control) { empty = false; control.done(); }) .next(function () { return empty; }); }; IndexedDbMutationQueue.prototype.acknowledgeBatch = function (transaction, batch, streamToken) { return this.getMutationQueueMetadata(transaction).next(function (metadata) { var batchId = batch.batchId; assert(batchId > metadata.lastAcknowledgedBatchId, 'Mutation batchIDs must be acknowledged in order'); metadata.lastAcknowledgedBatchId = batchId; metadata.lastStreamToken = convertStreamToken(streamToken); return mutationQueuesStore(transaction).put(metadata); }); }; IndexedDbMutationQueue.prototype.getLastStreamToken = function (transaction) { return this.getMutationQueueMetadata(transaction).next(function (metadata) { return metadata.lastStreamToken; }); }; IndexedDbMutationQueue.prototype.setLastStreamToken = function (transaction, streamToken) { return this.getMutationQueueMetadata(transaction).next(function (metadata) { metadata.lastStreamToken = convertStreamToken(streamToken); return mutationQueuesStore(transaction).put(metadata); }); }; IndexedDbMutationQueue.prototype.addMutationBatch = function (transaction, localWriteTime, mutations) { var _this = this; var documentStore = documentMutationsStore(transaction); var mutationStore = mutationsStore(transaction); // The IndexedDb implementation in Chrome (and Firefox) does not handle // compound indices that include auto-generated keys correctly. To ensure // that the index entry is added correctly in all browsers, we perform two // writes: The first write is used to retrieve the next auto-generated Batch // ID, and the second write populates the index and stores the actual // mutation batch. // See: https://bugs.chromium.org/p/chromium/issues/detail?id=701972 // tslint:disable-next-line:no-any We write an empty object to obtain key return mutationStore.add({}).next(function (batchId) { assert(typeof batchId === 'number', 'Auto-generated key is not a number'); var batch = new MutationBatch(batchId, localWriteTime, mutations); var dbBatch = _this.serializer.toDbMutationBatch(_this.userId, batch); _this.documentKeysByBatchId[batchId] = batch.keys(); var promises = []; for (var _i = 0, mutations_1 = mutations; _i < mutations_1.length; _i++) { var mutation = mutations_1[_i]; var indexKey = DbDocumentMutation.key(_this.userId, mutation.key.path, batchId); promises.push(mutationStore.put(dbBatch)); promises.push(documentStore.put(indexKey, DbDocumentMutation.PLACEHOLDER)); } return PersistencePromise.waitFor(promises).next(function () { return batch; }); }); }; IndexedDbMutationQueue.prototype.lookupMutationBatch = function (transaction, batchId) { var _this = this; return mutationsStore(transaction) .get(batchId) .next(function (dbBatch) { if (dbBatch) { assert(dbBatch.userId === _this.userId, "Unexpected user '" + dbBatch.userId + "' for mutation batch " + batchId); return _this.serializer.fromDbMutationBatch(dbBatch); } return null; }); }; IndexedDbMutationQueue.prototype.lookupMutationKeys = function (transaction, batchId) { var _this = this; if (this.documentKeysByBatchId[batchId]) { return PersistencePromise.resolve(this.documentKeysByBatchId[batchId]); } else { return this.lookupMutationBatch(transaction, batchId).next(function (batch) { if (batch) { var keys = batch.keys(); _this.documentKeysByBatchId[batchId] = keys; return keys; } else { return null; } }); } }; IndexedDbMutationQueue.prototype.getNextMutationBatchAfterBatchId = function (transaction, batchId) { var _this = this; return this.getMutationQueueMetadata(transaction).next(function (metadata) { // All batches with batchId <= this.metadata.lastAcknowledgedBatchId have // been acknowledged so the first unacknowledged batch after batchID will // have a batchID larger than both of these values. var nextBatchId = Math.max(batchId, metadata.lastAcknowledgedBatchId) + 1; var range = IDBKeyRange.lowerBound([_this.userId, nextBatchId]); var foundBatch = null; return mutationsStore(transaction) .iterate({ index: DbMutationBatch.userMutationsIndex, range: range }, function (key, dbBatch, control) { if (dbBatch.userId === _this.userId) { assert(dbBatch.batchId >= nextBatchId, 'Should have found mutation after ' + nextBatchId); foundBatch = _this.serializer.fromDbMutationBatch(dbBatch); } control.done(); }) .next(function () { return foundBatch; }); }); }; IndexedDbMutationQueue.prototype.getAllMutationBatches = function (transaction) { var _this = this; var range = IDBKeyRange.bound([this.userId, BATCHID_UNKNOWN], [this.userId, Number.POSITIVE_INFINITY]); return mutationsStore(transaction) .loadAll(DbMutationBatch.userMutationsIndex, range) .next(function (dbBatches) { return dbBatches.map(function (dbBatch) { return _this.serializer.fromDbMutationBatch(dbBatch); }); }); }; IndexedDbMutationQueue.prototype.getAllMutationBatchesAffectingDocumentKey = function (transaction, documentKey) { var _this = this; // Scan the document-mutation index starting with a prefix starting with // the given documentKey. var indexPrefix = DbDocumentMutation.prefixForPath(this.userId, documentKey.path); var indexStart = IDBKeyRange.lowerBound(indexPrefix); var results = []; return documentMutationsStore(transaction) .iterate({ range: indexStart }, function (indexKey, _, control) { var userID = indexKey[0], encodedPath = indexKey[1], batchId = indexKey[2]; // Only consider rows matching exactly the specific key of // interest. Note that because we order by path first, and we // order terminators before path separators, we'll encounter all // the index rows for documentKey contiguously. In particular, all // the rows for documentKey will occur before any rows for // documents nested in a subcollection beneath documentKey so we // can stop as soon as we hit any such row. var path = decode$1(encodedPath); if (userID !== _this.userId || !documentKey.path.isEqual(path)) { control.done(); return; } // Look up the mutation batch in the store. return mutationsStore(transaction) .get(batchId) .next(function (mutation) { if (!mutation) { throw fail('Dangling document-mutation reference found: ' + indexKey + ' which points to ' + batchId); } assert(mutation.userId === _this.userId, "Unexpected user '" + mutation.userId + "' for mutation batch " + batchId); results.push(_this.serializer.fromDbMutationBatch(mutation)); }); }) .next(function () { return results; }); }; IndexedDbMutationQueue.prototype.getAllMutationBatchesAffectingDocumentKeys = function (transaction, documentKeys) { var _this = this; var uniqueBatchIDs = new SortedSet(primitiveComparator); var promises = []; documentKeys.forEach(function (documentKey) { var indexStart = DbDocumentMutation.prefixForPath(_this.userId, documentKey.path); var range = IDBKeyRange.lowerBound(indexStart); var promise = documentMutationsStore(transaction).iterate({ range: range }, function (indexKey, _, control) { var userID = indexKey[0], encodedPath = indexKey[1], batchID = indexKey[2]; // Only consider rows matching exactly the specific key of // interest. Note that because we order by path first, and we // order terminators before path separators, we'll encounter all // the index rows for documentKey contiguously. In particular, all // the rows for documentKey will occur before any rows for // documents nested in a subcollection beneath documentKey so we // can stop as soon as we hit any such row. var path = decode$1(encodedPath); if (userID !== _this.userId || !documentKey.path.isEqual(path)) { control.done(); return; } uniqueBatchIDs = uniqueBatchIDs.add(batchID); }); promises.push(promise); }); return PersistencePromise.waitFor(promises).next(function () { return _this.lookupMutationBatches(transaction, uniqueBatchIDs); }); }; IndexedDbMutationQueue.prototype.getAllMutationBatchesAffectingQuery = function (transaction, query) { var _this = this; assert(!query.isDocumentQuery(), "Document queries shouldn't go down this path"); var queryPath = query.path; var immediateChildrenLength = queryPath.length + 1; // TODO(mcg): Actually implement a single-collection query // // This is actually executing an ancestor query, traversing the whole // subtree below the collection which can be horrifically inefficient for // some structures. The right way to solve this is to implement the full // value index, but that's not in the cards in the near future so this is // the best we can do for the moment. // // Since we don't yet index the actual properties in the mutations, our // current approach is to just return all mutation batches that affect // documents in the collection being queried. var indexPrefix = DbDocumentMutation.prefixForPath(this.userId, queryPath); var indexStart = IDBKeyRange.lowerBound(indexPrefix); // Collect up unique batchIDs encountered during a scan of the index. Use a // SortedSet to accumulate batch IDs so they can be traversed in order in a // scan of the main table. var uniqueBatchIDs = new SortedSet(primitiveComparator); return documentMutationsStore(transaction) .iterate({ range: indexStart }, function (indexKey, _, control) { var userID = indexKey[0], encodedPath = indexKey[1], batchID = indexKey[2]; var path = decode$1(encodedPath); if (userID !== _this.userId || !queryPath.isPrefixOf(path)) { control.done(); return; } // Rows with document keys more than one segment longer than the // query path can't be matches. For example, a query on 'rooms' // can't match the document /rooms/abc/messages/xyx. // TODO(mcg): we'll need a different scanner when we implement // ancestor queries. if (path.length !== immediateChildrenLength) { return; } uniqueBatchIDs = uniqueBatchIDs.add(batchID); }) .next(function () { return _this.lookupMutationBatches(transaction, uniqueBatchIDs); }); }; IndexedDbMutationQueue.prototype.lookupMutationBatches = function (transaction, batchIDs) { var _this = this; var results = []; var promises = []; // TODO(rockwood): Implement this using iterate. batchIDs.forEach(function (batchId) { promises.push(mutationsStore(transaction) .get(batchId) .next(function (mutation) { if (mutation === null) { throw fail('Dangling document-mutation reference found, ' + 'which points to ' + batchId); } assert(mutation.userId === _this.userId, "Unexpected user '" + mutation.userId + "' for mutation batch " + batchId); results.push(_this.serializer.fromDbMutationBatch(mutation)); })); }); return PersistencePromise.waitFor(promises).next(function () { return results; }); }; IndexedDbMutationQueue.prototype.removeMutationBatch = function (transaction, batch) { var _this = this; return removeMutationBatch(transaction.simpleDbTransaction, this.userId, batch).next(function (removedDocuments) { _this.removeCachedMutationKeys(batch.batchId); return PersistencePromise.forEach(removedDocuments, function (key) { return _this.referenceDelegate.removeMutationReference(transaction, key); }); }); }; IndexedDbMutationQueue.prototype.removeCachedMutationKeys = function (batchId) { delete this.documentKeysByBatchId[batchId]; }; IndexedDbMutationQueue.prototype.performConsistencyCheck = function (txn) { var _this = this; return this.checkEmpty(txn).next(function (empty) { if (!empty) { return PersistencePromise.resolve(); } // Verify that there are no entries in the documentMutations index if // the queue is empty. var startRange = IDBKeyRange.lowerBound(DbDocumentMutation.prefixForUser(_this.userId)); var danglingMutationReferences = []; return documentMutationsStore(txn) .iterate({ range: startRange }, function (key, _, control) { var userID = key[0]; if (userID !== _this.userId) { control.done(); return; } else { var path = decode$1(key[1]); danglingMutationReferences.push(path); } }) .next(function () { assert(danglingMutationReferences.length === 0, 'Document leak -- detected dangling mutation references when queue is empty. ' + 'Dangling keys: ' + danglingMutationReferences.map(function (p) { return p.canonicalString(); })); }); }); }; IndexedDbMutationQueue.prototype.containsKey = function (txn, key) { return mutationQueueContainsKey(txn, this.userId, key); }; // PORTING NOTE: Multi-tab only (state is held in memory in other clients). /** Returns the mutation queue's metadata from IndexedDb. */ IndexedDbMutationQueue.prototype.getMutationQueueMetadata = function (transaction) { var _this = this; return mutationQueuesStore(transaction) .get(this.userId) .next(function (metadata) { return (metadata || new DbMutationQueue(_this.userId, BATCHID_UNKNOWN, /*lastStreamToken=*/ '')); }); }; return IndexedDbMutationQueue; }()); /** * @return true if the mutation queue for the given user contains a pending * mutation for the given key. */ function mutationQueueContainsKey(txn, userId, key) { var indexKey = DbDocumentMutation.prefixForPath(userId, key.path); var encodedPath = indexKey[1]; var startRange = IDBKeyRange.lowerBound(indexKey); var containsKey = false; return documentMutationsStore(txn) .iterate({ range: startRange, keysOnly: true }, function (key, value, control) { var userID = key[0], keyPath = key[1], /*batchID*/ _ = key[2]; if (userID === userId && keyPath === encodedPath) { containsKey = true; } control.done(); }) .next(function () { return containsKey; }); } /** Returns true if any mutation queue contains the given document. */ function mutationQueuesContainKey(txn, docKey) { var found = false; return mutationQueuesStore(txn) .iterateSerial(function (userId) { return mutationQueueContainsKey(txn, userId, docKey).next(function (containsKey) { if (containsKey) { found = true; } return PersistencePromise.resolve(!containsKey); }); }) .next(function () { return found; }); } /** * Delete a mutation batch and the associated document mutations. * @return A PersistencePromise of the document mutations that were removed. */ function removeMutationBatch(txn, userId, batch) { var mutationStore = txn.store(DbMutationBatch.store); var indexTxn = txn.store(DbDocumentMutation.store); var promises = []; var range = IDBKeyRange.only(batch.batchId); var numDeleted = 0; var removePromise = mutationStore.iterate({ range: range }, function (key, value, control) { numDeleted++; return control.delete(); }); promises.push(removePromise.next(function () { assert(numDeleted === 1, 'Dangling document-mutation reference found: Missing batch ' + batch.batchId); })); var removedDocuments = []; for (var _i = 0, _a = batch.mutations; _i < _a.length; _i++) { var mutation = _a[_i]; var indexKey = DbDocumentMutation.key(userId, mutation.key.path, batch.batchId); promises.push(indexTxn.delete(indexKey)); removedDocuments.push(mutation.key); } return PersistencePromise.waitFor(promises).next(function () { return removedDocuments; }); } function convertStreamToken(token) { if (token instanceof Uint8Array) { // TODO(b/78771403): Convert tokens to strings during deserialization assert(Object({"DEVELOPMENT":undefined}).USE_MOCK_PERSISTENCE === 'YES', 'Persisting non-string stream tokens is only supported with mock persistence.'); return token.toString(); } else { return token; } } /** * Helper to get a typed SimpleDbStore for the mutations object store. */ function mutationsStore(txn) { return IndexedDbPersistence.getStore(txn, DbMutationBatch.store); } /** * Helper to get a typed SimpleDbStore for the mutationQueues object store. */ function documentMutationsStore(txn) { return IndexedDbPersistence.getStore(txn, DbDocumentMutation.store); } /** * Helper to get a typed SimpleDbStore for the mutationQueues object store. */ function mutationQueuesStore(txn) { return IndexedDbPersistence.getStore(txn, DbMutationQueue.store); } /** * Copyright 2017 Google Inc. * * 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. */ /** Serializer for values stored in the LocalStore. */ var LocalSerializer = /** @class */ (function () { function LocalSerializer(remoteSerializer) { this.remoteSerializer = remoteSerializer; } /** Decodes a remote document from storage locally to a Document. */ LocalSerializer.prototype.fromDbRemoteDocument = function (remoteDoc) { if (remoteDoc.document) { return this.remoteSerializer.fromDocument(remoteDoc.document, !!remoteDoc.hasCommittedMutations); } else if (remoteDoc.noDocument) { var key = DocumentKey.fromSegments(remoteDoc.noDocument.path); var version = this.fromDbTimestamp(remoteDoc.noDocument.readTime); return new NoDocument(key, version, { hasCommittedMutations: !!remoteDoc.hasCommittedMutations }); } else if (remoteDoc.unknownDocument) { var key = DocumentKey.fromSegments(remoteDoc.unknownDocument.path); var version = this.fromDbTimestamp(remoteDoc.unknownDocument.version); return new UnknownDocument(key, version); } else { return fail('Unexpected DbRemoteDocument'); } }; /** Encodes a document for storage locally. */ LocalSerializer.prototype.toDbRemoteDocument = function (maybeDoc) { if (maybeDoc instanceof Document) { var doc = this.remoteSerializer.toDocument(maybeDoc); var hasCommittedMutations = maybeDoc.hasCommittedMutations; return new DbRemoteDocument( /* unknownDocument= */ null, /* noDocument= */ null, doc, hasCommittedMutations); } else if (maybeDoc instanceof NoDocument) { var path = maybeDoc.key.path.toArray(); var readTime = this.toDbTimestamp(maybeDoc.version); var hasCommittedMutations = maybeDoc.hasCommittedMutations; return new DbRemoteDocument( /* unknownDocument= */ null, new DbNoDocument(path, readTime), /* document= */ null, hasCommittedMutations); } else if (maybeDoc instanceof UnknownDocument) { var path = maybeDoc.key.path.toArray(); var readTime = this.toDbTimestamp(maybeDoc.version); return new DbRemoteDocument(new DbUnknownDocument(path, readTime), /* noDocument= */ null, /* document= */ null, /* hasCommittedMutations= */ true); } else { return fail('Unexpected MaybeDocumment'); } }; LocalSerializer.prototype.toDbTimestamp = function (snapshotVersion) { var timestamp = snapshotVersion.toTimestamp(); return new DbTimestamp(timestamp.seconds, timestamp.nanoseconds); }; LocalSerializer.prototype.fromDbTimestamp = function (dbTimestamp) { var timestamp = new Timestamp(dbTimestamp.seconds, dbTimestamp.nanoseconds); return SnapshotVersion.fromTimestamp(timestamp); }; /** Encodes a batch of mutations into a DbMutationBatch for local storage. */ LocalSerializer.prototype.toDbMutationBatch = function (userId, batch) { var _this = this; var serializedMutations = batch.mutations.map(function (m) { return _this.remoteSerializer.toMutation(m); }); return new DbMutationBatch(userId, batch.batchId, batch.localWriteTime.toMillis(), serializedMutations); }; /** Decodes a DbMutationBatch into a MutationBatch */ LocalSerializer.prototype.fromDbMutationBatch = function (dbBatch) { var _this = this; var mutations = dbBatch.mutations.map(function (m) { return _this.remoteSerializer.fromMutation(m); }); var timestamp = Timestamp.fromMillis(dbBatch.localWriteTimeMs); return new MutationBatch(dbBatch.batchId, timestamp, mutations); }; /* * Encodes a set of document keys into an array of EncodedResourcePaths. */ LocalSerializer.prototype.toDbResourcePaths = function (keys) { var encodedKeys = []; keys.forEach(function (key) { encodedKeys.push(encode(key.path)); }); return encodedKeys; }; /** Decodes an array of EncodedResourcePaths into a set of document keys. */ LocalSerializer.prototype.fromDbResourcePaths = function (encodedPaths) { var keys = documentKeySet(); for (var _i = 0, encodedPaths_1 = encodedPaths; _i < encodedPaths_1.length; _i++) { var documentKey = encodedPaths_1[_i]; keys = keys.add(new DocumentKey(decode$1(documentKey))); } return keys; }; /** Decodes a DbTarget into QueryData */ LocalSerializer.prototype.fromDbTarget = function (dbTarget) { var version = this.fromDbTimestamp(dbTarget.readTime); var query; if (isDocumentQuery(dbTarget.query)) { query = this.remoteSerializer.fromDocumentsTarget(dbTarget.query); } else { query = this.remoteSerializer.fromQueryTarget(dbTarget.query); } return new QueryData(query, dbTarget.targetId, QueryPurpose.Listen, dbTarget.lastListenSequenceNumber, version, dbTarget.resumeToken); }; /** Encodes QueryData into a DbTarget for storage locally. */ LocalSerializer.prototype.toDbTarget = function (queryData) { assert(QueryPurpose.Listen === queryData.purpose, 'Only queries with purpose ' + QueryPurpose.Listen + ' may be stored, got ' + queryData.purpose); var dbTimestamp = this.toDbTimestamp(queryData.snapshotVersion); var queryProto; if (queryData.query.isDocumentQuery()) { queryProto = this.remoteSerializer.toDocumentsTarget(queryData.query); } else { queryProto = this.remoteSerializer.toQueryTarget(queryData.query); } var resumeToken; if (queryData.resumeToken instanceof Uint8Array) { // TODO(b/78771403): Convert tokens to strings during deserialization assert(Object({"DEVELOPMENT":undefined}).USE_MOCK_PERSISTENCE === 'YES', 'Persisting non-string stream tokens is only supported with mock persistence .'); resumeToken = queryData.resumeToken.toString(); } else { resumeToken = queryData.resumeToken; } // lastListenSequenceNumber is always 0 until we do real GC. return new DbTarget(queryData.targetId, queryData.query.canonicalId(), dbTimestamp, resumeToken, queryData.sequenceNumber, queryProto); }; return LocalSerializer; }()); /** * A helper function for figuring out what kind of query has been stored. */ function isDocumentQuery(dbQuery) { return dbQuery.documents !== undefined; } /** * Copyright 2018 Google Inc. * * 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. */ function bufferEntryComparator(_a, _b) { var aSequence = _a[0], aIndex = _a[1]; var bSequence = _b[0], bIndex = _b[1]; var seqCmp = primitiveComparator(aSequence, bSequence); if (seqCmp === 0) { // This order doesn't matter, but we can bias against churn by sorting // entries created earlier as less than newer entries. return primitiveComparator(aIndex, bIndex); } else { return seqCmp; } } /** * Used to calculate the nth sequence number. Keeps a rolling buffer of the * lowest n values passed to `addElement`, and finally reports the largest of * them in `maxValue`. */ var RollingSequenceNumberBuffer = /** @class */ (function () { function RollingSequenceNumberBuffer(maxElements) { this.maxElements = maxElements; this.buffer = new SortedSet(bufferEntryComparator); this.previousIndex = 0; } RollingSequenceNumberBuffer.prototype.nextIndex = function () { return ++this.previousIndex; }; RollingSequenceNumberBuffer.prototype.addElement = function (sequenceNumber) { var entry = [sequenceNumber, this.nextIndex()]; if (this.buffer.size < this.maxElements) { this.buffer = this.buffer.add(entry); } else { var highestValue = this.buffer.last(); if (bufferEntryComparator(entry, highestValue) < 0) { this.buffer = this.buffer.delete(highestValue).add(entry); } } }; Object.defineProperty(RollingSequenceNumberBuffer.prototype, "maxValue", { get: function () { // Guaranteed to be non-empty. If we decide we are not collecting any // sequence numbers, nthSequenceNumber below short-circuits. If we have // decided that we are collecting n sequence numbers, it's because n is some // percentage of the existing sequence numbers. That means we should never // be in a situation where we are collecting sequence numbers but don't // actually have any. return this.buffer.last()[0]; }, enumerable: true, configurable: true }); return RollingSequenceNumberBuffer; }()); /** Implements the steps for LRU garbage collection. */ var LruGarbageCollector = /** @class */ (function () { function LruGarbageCollector(delegate) { this.delegate = delegate; } /** Given a percentile of target to collect, returns the number of targets to collect. */ LruGarbageCollector.prototype.calculateTargetCount = function (txn, percentile) { return this.delegate.getSequenceNumberCount(txn).next(function (targetCount) { return Math.floor(percentile / 100.0 * targetCount); }); }; /** Returns the nth sequence number, counting in order from the smallest. */ LruGarbageCollector.prototype.nthSequenceNumber = function (txn, n) { var _this = this; if (n === 0) { return PersistencePromise.resolve(ListenSequence.INVALID); } var buffer = new RollingSequenceNumberBuffer(n); return this.delegate .forEachTarget(txn, function (target) { return buffer.addElement(target.sequenceNumber); }) .next(function () { return _this.delegate.forEachOrphanedDocumentSequenceNumber(txn, function (sequenceNumber) { return buffer.addElement(sequenceNumber); }); }) .next(function () { return buffer.maxValue; }); }; /** * Removes targets with a sequence number equal to or less than the given upper bound, and removes * document associations with those targets. */ LruGarbageCollector.prototype.removeTargets = function (txn, upperBound, activeTargetIds) { return this.delegate.removeTargets(txn, upperBound, activeTargetIds); }; /** * Removes documents that have a sequence number equal to or less than the upper bound and are not * otherwise pinned. */ LruGarbageCollector.prototype.removeOrphanedDocuments = function (txn, upperBound) { return this.delegate.removeOrphanedDocuments(txn, upperBound); }; return LruGarbageCollector; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Opaque interface representing a persistence transaction. * * When you call Persistence.runTransaction(), it will create a transaction and * pass it to your callback. You then pass it to any method that operates * on persistence. */ var PersistenceTransaction = /** @class */ (function () { function PersistenceTransaction() { } return PersistenceTransaction; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG$2 = 'IndexedDbPersistence'; /** * Oldest acceptable age in milliseconds for client metadata before the client * is considered inactive and its associated data (such as the remote document * cache changelog) is garbage collected. */ var MAX_CLIENT_AGE_MS = 30 * 60 * 1000; // 30 minutes /** * Oldest acceptable metadata age for clients that may participate in the * primary lease election. Clients that have not updated their client metadata * within 5 seconds are not eligible to receive a primary lease. */ var MAX_PRIMARY_ELIGIBLE_AGE_MS = 5000; /** * The interval at which clients will update their metadata, including * refreshing their primary lease if held or potentially trying to acquire it if * not held. * * Primary clients may opportunistically refresh their metadata earlier * if they're already performing an IndexedDB operation. */ var CLIENT_METADATA_REFRESH_INTERVAL_MS = 4000; /** User-facing error when the primary lease is required but not available. */ var PRIMARY_LEASE_LOST_ERROR_MSG = 'The current tab is not in the required state to perform this operation. ' + 'It might be necessary to refresh the browser tab.'; var PRIMARY_LEASE_EXCLUSIVE_ERROR_MSG = 'Another tab has exclusive access to the persistence layer. ' + 'To allow shared access, make sure to invoke ' + '`enablePersistence()` with `experimentalTabSynchronization:true` in all tabs.'; var UNSUPPORTED_PLATFORM_ERROR_MSG = 'This platform is either missing' + ' IndexedDB or is known to have an incomplete implementation. Offline' + ' persistence has been disabled.'; // The format of the LocalStorage key that stores zombied client is: // firestore_zombie__ var ZOMBIED_CLIENTS_KEY_PREFIX = 'firestore_zombie'; var IndexedDbTransaction = /** @class */ (function (_super) { tslib_1.__extends(IndexedDbTransaction, _super); function IndexedDbTransaction(simpleDbTransaction, currentSequenceNumber) { var _this = _super.call(this) || this; _this.simpleDbTransaction = simpleDbTransaction; _this.currentSequenceNumber = currentSequenceNumber; return _this; } return IndexedDbTransaction; }(PersistenceTransaction)); var IndexedDbPersistence = /** @class */ (function () { // Note that `multiClientParams` must be present to enable multi-client support while multi-tab // is still experimental. When multi-client is switched to always on, `multiClientParams` will // no longer be optional. function IndexedDbPersistence(persistenceKey, clientId, platform, queue, serializer, multiClientParams) { this.persistenceKey = persistenceKey; this.clientId = clientId; this.queue = queue; this.multiClientParams = multiClientParams; this._started = false; this.isPrimary = false; this.networkEnabled = true; this.inForeground = false; /** The last time we garbage collected the Remote Document Changelog. */ this.lastGarbageCollectionTime = Number.NEGATIVE_INFINITY; /** A listener to notify on primary state changes. */ this.primaryStateListener = function (_) { return Promise.resolve(); }; if (!IndexedDbPersistence.isAvailable()) { throw new FirestoreError(Code.UNIMPLEMENTED, UNSUPPORTED_PLATFORM_ERROR_MSG); } this.referenceDelegate = new IndexedDbLruDelegate(this); this.dbName = persistenceKey + IndexedDbPersistence.MAIN_DATABASE; this.serializer = new LocalSerializer(serializer); this.document = platform.document; this.allowTabSynchronization = multiClientParams !== undefined; this.queryCache = new IndexedDbQueryCache(this.referenceDelegate, this.serializer); this.remoteDocumentCache = new IndexedDbRemoteDocumentCache(this.serializer, /*keepDocumentChangeLog=*/ this.allowTabSynchronization); if (platform.window && platform.window.localStorage) { this.window = platform.window; this.webStorage = this.window.localStorage; } else { throw new FirestoreError(Code.UNIMPLEMENTED, 'IndexedDB persistence is only available on platforms that support LocalStorage.'); } } IndexedDbPersistence.getStore = function (txn, store) { if (txn instanceof IndexedDbTransaction) { return SimpleDb.getStore(txn.simpleDbTransaction, store); } else { throw fail('IndexedDbPersistence must use instances of IndexedDbTransaction'); } }; IndexedDbPersistence.createIndexedDbPersistence = function (persistenceKey, clientId, platform, queue, serializer) { return tslib_1.__awaiter(this, void 0, void 0, function () { var persistence; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: persistence = new IndexedDbPersistence(persistenceKey, clientId, platform, queue, serializer); return [4 /*yield*/, persistence.start()]; case 1: _a.sent(); return [2 /*return*/, persistence]; } }); }); }; IndexedDbPersistence.createMultiClientIndexedDbPersistence = function (persistenceKey, clientId, platform, queue, serializer, multiClientParams) { return tslib_1.__awaiter(this, void 0, void 0, function () { var persistence; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: persistence = new IndexedDbPersistence(persistenceKey, clientId, platform, queue, serializer, multiClientParams); return [4 /*yield*/, persistence.start()]; case 1: _a.sent(); return [2 /*return*/, persistence]; } }); }); }; /** * Attempt to start IndexedDb persistence. * * @return {Promise} Whether persistence was enabled. */ IndexedDbPersistence.prototype.start = function () { var _this = this; assert(!this.started, 'IndexedDbPersistence double-started!'); assert(this.window !== null, "Expected 'window' to be defined"); return SimpleDb.openOrCreate(this.dbName, SCHEMA_VERSION, new SchemaConverter(this.serializer)) .then(function (db) { _this.simpleDb = db; }) .then(function () { return _this.startRemoteDocumentCache(); }) .then(function () { _this.attachVisibilityHandler(); _this.attachWindowUnloadHook(); return _this.updateClientMetadataAndTryBecomePrimary().then(function () { return _this.scheduleClientMetadataAndPrimaryLeaseRefreshes(); }); }) .then(function () { return _this.simpleDb.runTransaction('readonly', [DbTargetGlobal.store], function (txn) { return getHighestListenSequenceNumber(txn).next(function (highestListenSequenceNumber) { var sequenceNumberSyncer = _this.multiClientParams ? _this.multiClientParams.sequenceNumberSyncer : undefined; _this.listenSequence = new ListenSequence(highestListenSequenceNumber, sequenceNumberSyncer); }); }); }) .then(function () { _this._started = true; }) .catch(function (reason) { _this.simpleDb && _this.simpleDb.close(); return Promise.reject(reason); }); }; IndexedDbPersistence.prototype.startRemoteDocumentCache = function () { var _this = this; return this.simpleDb.runTransaction('readonly', ALL_STORES, function (txn) { return _this.remoteDocumentCache.start(txn); }); }; IndexedDbPersistence.prototype.setPrimaryStateListener = function (primaryStateListener) { var _this = this; this.primaryStateListener = function (primaryState) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { if (this.started) { return [2 /*return*/, primaryStateListener(primaryState)]; } return [2 /*return*/]; }); }); }; return primaryStateListener(this.isPrimary); }; IndexedDbPersistence.prototype.setNetworkEnabled = function (networkEnabled) { var _this = this; if (this.networkEnabled !== networkEnabled) { this.networkEnabled = networkEnabled; // Schedule a primary lease refresh for immediate execution. The eventual // lease update will be propagated via `primaryStateListener`. this.queue.enqueueAndForget(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: if (!this.started) return [3 /*break*/, 2]; return [4 /*yield*/, this.updateClientMetadataAndTryBecomePrimary()]; case 1: _a.sent(); _a.label = 2; case 2: return [2 /*return*/]; } }); }); }); } }; /** * Updates the client metadata in IndexedDb and attempts to either obtain or * extend the primary lease for the local client. Asynchronously notifies the * primary state listener if the client either newly obtained or released its * primary lease. */ IndexedDbPersistence.prototype.updateClientMetadataAndTryBecomePrimary = function () { var _this = this; return this.simpleDb.runTransaction('readwrite', ALL_STORES, function (txn) { var metadataStore = clientMetadataStore(txn); return metadataStore .put(new DbClientMetadata(_this.clientId, Date.now(), _this.networkEnabled, _this.inForeground, _this.remoteDocumentCache.lastProcessedDocumentChangeId)) .next(function () { if (_this.isPrimary) { return _this.verifyPrimaryLease(txn).next(function (success) { if (!success) { _this.isPrimary = false; _this.queue.enqueueAndForget(function () { return _this.primaryStateListener(false); }); } }); } }) .next(function () { return _this.canActAsPrimary(txn); }) .next(function (canActAsPrimary) { var wasPrimary = _this.isPrimary; _this.isPrimary = canActAsPrimary; if (wasPrimary !== _this.isPrimary) { _this.queue.enqueueAndForget(function () { return _this.primaryStateListener(_this.isPrimary); }); } if (wasPrimary && !_this.isPrimary) { return _this.releasePrimaryLeaseIfHeld(txn); } else if (_this.isPrimary) { return _this.acquireOrExtendPrimaryLease(txn); } }); }); }; IndexedDbPersistence.prototype.verifyPrimaryLease = function (txn) { var _this = this; var store = primaryClientStore(txn); return store.get(DbPrimaryClient.key).next(function (primaryClient) { return PersistencePromise.resolve(_this.isLocalClient(primaryClient)); }); }; IndexedDbPersistence.prototype.removeClientMetadata = function (txn) { var metadataStore = clientMetadataStore(txn); return metadataStore.delete(this.clientId); }; /** * If the garbage collection threshold has passed, prunes the * RemoteDocumentChanges and the ClientMetadata store based on the last update * time of all clients. */ IndexedDbPersistence.prototype.maybeGarbageCollectMultiClientState = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var activeClients_1, inactiveClients_1; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: if (!(this.isPrimary && !this.isWithinAge(this.lastGarbageCollectionTime, MAX_CLIENT_AGE_MS))) return [3 /*break*/, 2]; this.lastGarbageCollectionTime = Date.now(); inactiveClients_1 = []; return [4 /*yield*/, this.runTransaction('maybeGarbageCollectMultiClientState', 'readwrite-primary', function (txn) { var metadataStore = IndexedDbPersistence.getStore(txn, DbClientMetadata.store); return metadataStore .loadAll() .next(function (existingClients) { activeClients_1 = _this.filterActiveClients(existingClients, MAX_CLIENT_AGE_MS); inactiveClients_1 = existingClients.filter(function (client) { return activeClients_1.indexOf(client) === -1; }); }) .next(function () { // Delete metadata for clients that are no longer considered active. return PersistencePromise.forEach(inactiveClients_1, function (inactiveClient) { return metadataStore.delete(inactiveClient.clientId); }); }) .next(function () { // Retrieve the minimum change ID from the set of active clients. // The primary client doesn't read from the document change log, // and hence we exclude it when we determine the minimum // `lastProcessedDocumentChangeId`. activeClients_1 = activeClients_1.filter(function (client) { return client.clientId !== _this.clientId; }); if (activeClients_1.length > 0) { var processedChangeIds = activeClients_1.map(function (client) { return client.lastProcessedDocumentChangeId || 0; }); var oldestChangeId = Math.min.apply(Math, processedChangeIds); return _this.remoteDocumentCache.removeDocumentChangesThroughChangeId(txn, oldestChangeId); } }); })]; case 1: _a.sent(); // Delete potential leftover entries that may continue to mark the // inactive clients as zombied in LocalStorage. // Ideally we'd delete the IndexedDb and LocalStorage zombie entries for // the client atomically, but we can't. So we opt to delete the IndexedDb // entries first to avoid potentially reviving a zombied client. inactiveClients_1.forEach(function (inactiveClient) { _this.window.localStorage.removeItem(_this.zombiedClientLocalStorageKey(inactiveClient.clientId)); }); _a.label = 2; case 2: return [2 /*return*/]; } }); }); }; /** * Schedules a recurring timer to update the client metadata and to either * extend or acquire the primary lease if the client is eligible. */ IndexedDbPersistence.prototype.scheduleClientMetadataAndPrimaryLeaseRefreshes = function () { var _this = this; this.clientMetadataRefresher = this.queue.enqueueAfterDelay(TimerId.ClientMetadataRefresh, CLIENT_METADATA_REFRESH_INTERVAL_MS, function () { return _this.updateClientMetadataAndTryBecomePrimary() .then(function () { return _this.maybeGarbageCollectMultiClientState(); }) .then(function () { return _this.scheduleClientMetadataAndPrimaryLeaseRefreshes(); }); }); }; /** Checks whether `client` is the local client. */ IndexedDbPersistence.prototype.isLocalClient = function (client) { return client ? client.ownerId === this.clientId : false; }; /** * Evaluate the state of all active clients and determine whether the local * client is or can act as the holder of the primary lease. Returns whether * the client is eligible for the lease, but does not actually acquire it. * May return 'false' even if there is no active leaseholder and another * (foreground) client should become leaseholder instead. */ IndexedDbPersistence.prototype.canActAsPrimary = function (txn) { var _this = this; var store = primaryClientStore(txn); return store .get(DbPrimaryClient.key) .next(function (currentPrimary) { var currentLeaseIsValid = currentPrimary !== null && _this.isWithinAge(currentPrimary.leaseTimestampMs, MAX_PRIMARY_ELIGIBLE_AGE_MS) && !_this.isClientZombied(currentPrimary.ownerId); // A client is eligible for the primary lease if: // - its network is enabled and the client's tab is in the foreground. // - its network is enabled and no other client's tab is in the // foreground. // - every clients network is disabled and the client's tab is in the // foreground. // - every clients network is disabled and no other client's tab is in // the foreground. if (currentLeaseIsValid) { if (_this.isLocalClient(currentPrimary) && _this.networkEnabled) { return true; } if (!_this.isLocalClient(currentPrimary)) { if (!currentPrimary.allowTabSynchronization) { // Fail the `canActAsPrimary` check if the current leaseholder has // not opted into multi-tab synchronization. If this happens at // client startup, we reject the Promise returned by // `enablePersistence()` and the user can continue to use Firestore // with in-memory persistence. // If this fails during a lease refresh, we will instead block the // AsyncQueue from executing further operations. Note that this is // acceptable since mixing & matching different `synchronizeTabs` // settings is not supported. // // TODO(b/114226234): Remove this check when `synchronizeTabs` can // no longer be turned off. throw new FirestoreError(Code.FAILED_PRECONDITION, PRIMARY_LEASE_EXCLUSIVE_ERROR_MSG); } return false; } } if (_this.networkEnabled && _this.inForeground) { return true; } return clientMetadataStore(txn) .loadAll() .next(function (existingClients) { // Process all existing clients and determine whether at least one of // them is better suited to obtain the primary lease. var preferredCandidate = _this.filterActiveClients(existingClients, MAX_PRIMARY_ELIGIBLE_AGE_MS).find(function (otherClient) { if (_this.clientId !== otherClient.clientId) { var otherClientHasBetterNetworkState = !_this.networkEnabled && otherClient.networkEnabled; var otherClientHasBetterVisibility = !_this.inForeground && otherClient.inForeground; var otherClientHasSameNetworkState = _this.networkEnabled === otherClient.networkEnabled; if (otherClientHasBetterNetworkState || (otherClientHasBetterVisibility && otherClientHasSameNetworkState)) { return true; } } return false; }); return preferredCandidate === undefined; }); }) .next(function (canActAsPrimary) { if (_this.isPrimary !== canActAsPrimary) { debug(LOG_TAG$2, "Client " + (canActAsPrimary ? 'is' : 'is not') + " eligible for a primary lease."); } return canActAsPrimary; }); }; IndexedDbPersistence.prototype.shutdown = function (deleteData) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: // The shutdown() operations are idempotent and can be called even when // start() aborted (e.g. because it couldn't acquire the persistence lease). this._started = false; this.markClientZombied(); if (this.clientMetadataRefresher) { this.clientMetadataRefresher.cancel(); } this.detachVisibilityHandler(); this.detachWindowUnloadHook(); return [4 /*yield*/, this.simpleDb.runTransaction('readwrite', [DbPrimaryClient.store, DbClientMetadata.store], function (txn) { return _this.releasePrimaryLeaseIfHeld(txn).next(function () { return _this.removeClientMetadata(txn); }); })]; case 1: _a.sent(); this.simpleDb.close(); // Remove the entry marking the client as zombied from LocalStorage since // we successfully deleted its metadata from IndexedDb. this.removeClientZombiedEntry(); if (!deleteData) return [3 /*break*/, 3]; return [4 /*yield*/, SimpleDb.delete(this.dbName)]; case 2: _a.sent(); _a.label = 3; case 3: return [2 /*return*/]; } }); }); }; /** * Returns clients that are not zombied and have an updateTime within the * provided threshold. */ IndexedDbPersistence.prototype.filterActiveClients = function (clients, activityThresholdMs) { var _this = this; return clients.filter(function (client) { return _this.isWithinAge(client.updateTimeMs, activityThresholdMs) && !_this.isClientZombied(client.clientId); }); }; IndexedDbPersistence.prototype.getActiveClients = function () { var _this = this; return this.simpleDb.runTransaction('readonly', [DbClientMetadata.store], function (txn) { return clientMetadataStore(txn) .loadAll() .next(function (clients) { return _this.filterActiveClients(clients, MAX_CLIENT_AGE_MS).map(function (clientMetadata) { return clientMetadata.clientId; }); }); }); }; Object.defineProperty(IndexedDbPersistence.prototype, "started", { get: function () { return this._started; }, enumerable: true, configurable: true }); IndexedDbPersistence.prototype.getMutationQueue = function (user) { assert(this.started, 'Cannot initialize MutationQueue before persistence is started.'); return IndexedDbMutationQueue.forUser(user, this.serializer, this.referenceDelegate); }; IndexedDbPersistence.prototype.getQueryCache = function () { assert(this.started, 'Cannot initialize QueryCache before persistence is started.'); return this.queryCache; }; IndexedDbPersistence.prototype.getRemoteDocumentCache = function () { assert(this.started, 'Cannot initialize RemoteDocumentCache before persistence is started.'); return this.remoteDocumentCache; }; IndexedDbPersistence.prototype.runTransaction = function (action, mode, transactionOperation) { var _this = this; debug(LOG_TAG$2, 'Starting transaction:', action); // Do all transactions as readwrite against all object stores, since we // are the only reader/writer. return this.simpleDb.runTransaction(mode === 'readonly' ? 'readonly' : 'readwrite', ALL_STORES, function (simpleDbTxn) { if (mode === 'readwrite-primary') { // While we merely verify that we have (or can acquire) the lease // immediately, we wait to extend the primary lease until after // executing transactionOperation(). This ensures that even if the // transactionOperation takes a long time, we'll use a recent // leaseTimestampMs in the extended (or newly acquired) lease. return _this.verifyPrimaryLease(simpleDbTxn) .next(function (success) { if (!success) { error("Failed to obtain primary lease for action '" + action + "'."); _this.isPrimary = false; _this.queue.enqueueAndForget(function () { return _this.primaryStateListener(false); }); throw new FirestoreError(Code.FAILED_PRECONDITION, PRIMARY_LEASE_LOST_ERROR_MSG); } return transactionOperation(new IndexedDbTransaction(simpleDbTxn, _this.listenSequence.next())); }) .next(function (result) { return _this.acquireOrExtendPrimaryLease(simpleDbTxn).next(function () { return result; }); }); } else { return _this.verifyAllowTabSynchronization(simpleDbTxn).next(function () { return transactionOperation(new IndexedDbTransaction(simpleDbTxn, _this.listenSequence.next())); }); } }); }; /** * Verifies that the current tab is the primary leaseholder or alternatively * that the leaseholder has opted into multi-tab synchronization. */ // TODO(b/114226234): Remove this check when `synchronizeTabs` can no longer // be turned off. IndexedDbPersistence.prototype.verifyAllowTabSynchronization = function (txn) { var _this = this; var store = primaryClientStore(txn); return store.get(DbPrimaryClient.key).next(function (currentPrimary) { var currentLeaseIsValid = currentPrimary !== null && _this.isWithinAge(currentPrimary.leaseTimestampMs, MAX_PRIMARY_ELIGIBLE_AGE_MS) && !_this.isClientZombied(currentPrimary.ownerId); if (currentLeaseIsValid && !_this.isLocalClient(currentPrimary)) { if (!currentPrimary.allowTabSynchronization) { throw new FirestoreError(Code.FAILED_PRECONDITION, PRIMARY_LEASE_EXCLUSIVE_ERROR_MSG); } } }); }; /** * Obtains or extends the new primary lease for the local client. This * method does not verify that the client is eligible for this lease. */ IndexedDbPersistence.prototype.acquireOrExtendPrimaryLease = function (txn) { var newPrimary = new DbPrimaryClient(this.clientId, this.allowTabSynchronization, Date.now()); return primaryClientStore(txn).put(DbPrimaryClient.key, newPrimary); }; IndexedDbPersistence.isAvailable = function () { return SimpleDb.isAvailable(); }; /** * Generates a string used as a prefix when storing data in IndexedDB and * LocalStorage. */ IndexedDbPersistence.buildStoragePrefix = function (databaseInfo) { // Use two different prefix formats: // // * firestore / persistenceKey / projectID . databaseID / ... // * firestore / persistenceKey / projectID / ... // // projectIDs are DNS-compatible names and cannot contain dots // so there's no danger of collisions. var database = databaseInfo.databaseId.projectId; if (!databaseInfo.databaseId.isDefaultDatabase) { database += '.' + databaseInfo.databaseId.database; } return 'firestore/' + databaseInfo.persistenceKey + '/' + database + '/'; }; /** Checks the primary lease and removes it if we are the current primary. */ IndexedDbPersistence.prototype.releasePrimaryLeaseIfHeld = function (txn) { var _this = this; var store = primaryClientStore(txn); return store.get(DbPrimaryClient.key).next(function (primaryClient) { if (_this.isLocalClient(primaryClient)) { debug(LOG_TAG$2, 'Releasing primary lease.'); return store.delete(DbPrimaryClient.key); } else { return PersistencePromise.resolve(); } }); }; /** Verifies that `updateTimeMs` is within `maxAgeMs`. */ IndexedDbPersistence.prototype.isWithinAge = function (updateTimeMs, maxAgeMs) { var now = Date.now(); var minAcceptable = now - maxAgeMs; var maxAcceptable = now; if (updateTimeMs < minAcceptable) { return false; } else if (updateTimeMs > maxAcceptable) { error("Detected an update time that is in the future: " + updateTimeMs + " > " + maxAcceptable); return false; } return true; }; IndexedDbPersistence.prototype.attachVisibilityHandler = function () { var _this = this; if (this.document !== null && typeof this.document.addEventListener === 'function') { this.documentVisibilityHandler = function () { _this.queue.enqueueAndForget(function () { _this.inForeground = _this.document.visibilityState === 'visible'; return _this.updateClientMetadataAndTryBecomePrimary(); }); }; this.document.addEventListener('visibilitychange', this.documentVisibilityHandler); this.inForeground = this.document.visibilityState === 'visible'; } }; IndexedDbPersistence.prototype.detachVisibilityHandler = function () { if (this.documentVisibilityHandler) { assert(this.document !== null && typeof this.document.addEventListener === 'function', "Expected 'document.addEventListener' to be a function"); this.document.removeEventListener('visibilitychange', this.documentVisibilityHandler); this.documentVisibilityHandler = null; } }; /** * Attaches a window.unload handler that will synchronously write our * clientId to a "zombie client id" location in LocalStorage. This can be used * by tabs trying to acquire the primary lease to determine that the lease * is no longer valid even if the timestamp is recent. This is particularly * important for the refresh case (so the tab correctly re-acquires the * primary lease). LocalStorage is used for this rather than IndexedDb because * it is a synchronous API and so can be used reliably from an unload * handler. */ IndexedDbPersistence.prototype.attachWindowUnloadHook = function () { var _this = this; if (typeof this.window.addEventListener === 'function') { this.windowUnloadHandler = function () { // Note: In theory, this should be scheduled on the AsyncQueue since it // accesses internal state. We execute this code directly during shutdown // to make sure it gets a chance to run. _this.markClientZombied(); _this.queue.enqueueAndForget(function () { // Attempt graceful shutdown (including releasing our primary lease), // but there's no guarantee it will complete. return _this.shutdown(); }); }; this.window.addEventListener('unload', this.windowUnloadHandler); } }; IndexedDbPersistence.prototype.detachWindowUnloadHook = function () { if (this.windowUnloadHandler) { assert(typeof this.window.removeEventListener === 'function', "Expected 'window.removeEventListener' to be a function"); this.window.removeEventListener('unload', this.windowUnloadHandler); this.windowUnloadHandler = null; } }; /** * Returns whether a client is "zombied" based on its LocalStorage entry. * Clients become zombied when their tab closes without running all of the * cleanup logic in `shutdown()`. */ IndexedDbPersistence.prototype.isClientZombied = function (clientId) { try { var isZombied = this.webStorage.getItem(this.zombiedClientLocalStorageKey(clientId)) !== null; debug(LOG_TAG$2, "Client '" + clientId + "' " + (isZombied ? 'is' : 'is not') + " zombied in LocalStorage"); return isZombied; } catch (e) { // Gracefully handle if LocalStorage isn't working. error(LOG_TAG$2, 'Failed to get zombied client id.', e); return false; } }; /** * Record client as zombied (a client that had its tab closed). Zombied * clients are ignored during primary tab selection. */ IndexedDbPersistence.prototype.markClientZombied = function () { try { this.webStorage.setItem(this.zombiedClientLocalStorageKey(this.clientId), String(Date.now())); } catch (e) { // Gracefully handle if LocalStorage isn't available / working. error('Failed to set zombie client id.', e); } }; /** Removes the zombied client entry if it exists. */ IndexedDbPersistence.prototype.removeClientZombiedEntry = function () { try { this.webStorage.removeItem(this.zombiedClientLocalStorageKey(this.clientId)); } catch (e) { // Ignore } }; IndexedDbPersistence.prototype.zombiedClientLocalStorageKey = function (clientId) { return ZOMBIED_CLIENTS_KEY_PREFIX + "_" + this.persistenceKey + "_" + clientId; }; /** * The name of the main (and currently only) IndexedDB database. this name is * appended to the prefix provided to the IndexedDbPersistence constructor. */ IndexedDbPersistence.MAIN_DATABASE = 'main'; return IndexedDbPersistence; }()); function isPrimaryLeaseLostError(err) { return (err.code === Code.FAILED_PRECONDITION && err.message === PRIMARY_LEASE_LOST_ERROR_MSG); } /** * Helper to get a typed SimpleDbStore for the primary client object store. */ function primaryClientStore(txn) { return txn.store(DbPrimaryClient.store); } /** * Helper to get a typed SimpleDbStore for the client metadata object store. */ function clientMetadataStore(txn) { return txn.store(DbClientMetadata.store); } /** Provides LRU functionality for IndexedDB persistence. */ var IndexedDbLruDelegate = /** @class */ (function () { function IndexedDbLruDelegate(db) { this.db = db; this.garbageCollector = new LruGarbageCollector(this); } IndexedDbLruDelegate.prototype.getSequenceNumberCount = function (txn) { var docCountPromise = this.orphanedDocmentCount(txn); var targetCountPromise = this.db.getQueryCache().getQueryCount(txn); return targetCountPromise.next(function (targetCount) { return docCountPromise.next(function (docCount) { return targetCount + docCount; }); }); }; IndexedDbLruDelegate.prototype.orphanedDocmentCount = function (txn) { var orphanedCount = 0; return this.forEachOrphanedDocumentSequenceNumber(txn, function (_) { orphanedCount++; }).next(function () { return orphanedCount; }); }; IndexedDbLruDelegate.prototype.forEachTarget = function (txn, f) { return this.db.getQueryCache().forEachTarget(txn, f); }; IndexedDbLruDelegate.prototype.forEachOrphanedDocumentSequenceNumber = function (txn, f) { return this.forEachOrphanedDocument(txn, function (docKey, sequenceNumber) { return f(sequenceNumber); }); }; IndexedDbLruDelegate.prototype.setInMemoryPins = function (inMemoryPins) { this.inMemoryPins = inMemoryPins; }; IndexedDbLruDelegate.prototype.addReference = function (txn, key) { return writeSentinelKey(txn, key); }; IndexedDbLruDelegate.prototype.removeReference = function (txn, key) { return writeSentinelKey(txn, key); }; IndexedDbLruDelegate.prototype.removeTargets = function (txn, upperBound, activeTargetIds) { return this.db .getQueryCache() .removeTargets(txn, upperBound, activeTargetIds); }; IndexedDbLruDelegate.prototype.removeMutationReference = function (txn, key) { return writeSentinelKey(txn, key); }; /** * Returns true if anything would prevent this document from being garbage * collected, given that the document in question is not present in any * targets and has a sequence number less than or equal to the upper bound for * the collection run. */ IndexedDbLruDelegate.prototype.isPinned = function (txn, docKey) { if (this.inMemoryPins.containsKey(docKey)) { return PersistencePromise.resolve(true); } else { return mutationQueuesContainKey(txn, docKey); } }; IndexedDbLruDelegate.prototype.removeOrphanedDocuments = function (txn, upperBound) { var _this = this; var count = 0; var bytesRemoved = 0; var promises = []; var iteration = this.forEachOrphanedDocument(txn, function (docKey, sequenceNumber) { if (sequenceNumber <= upperBound) { var p = _this.isPinned(txn, docKey).next(function (isPinned) { if (!isPinned) { count++; return _this.removeOrphanedDocument(txn, docKey).next(function (documentBytes) { bytesRemoved += documentBytes; }); } }); promises.push(p); } }); // Wait for iteration first to make sure we have a chance to add all of the // removal promises to the array. return iteration .next(function () { return PersistencePromise.waitFor(promises); }) .next(function () { return _this.db.getRemoteDocumentCache().updateSize(txn, -bytesRemoved); }) .next(function () { return count; }); }; /** * Clears a document from the cache. The document is assumed to be orphaned, so target-document * associations are not queried. We remove it from the remote document cache, as well as remove * its sentinel row. */ IndexedDbLruDelegate.prototype.removeOrphanedDocument = function (txn, docKey) { var totalBytesRemoved = 0; var documentCache = this.db.getRemoteDocumentCache(); return PersistencePromise.waitFor([ documentTargetStore(txn).delete(sentinelKey$1(docKey)), documentCache.removeEntry(txn, docKey).next(function (bytesRemoved) { totalBytesRemoved += bytesRemoved; }) ]).next(function () { return totalBytesRemoved; }); }; IndexedDbLruDelegate.prototype.removeTarget = function (txn, queryData) { var updated = queryData.copy({ sequenceNumber: txn.currentSequenceNumber }); return this.db.getQueryCache().updateQueryData(txn, updated); }; IndexedDbLruDelegate.prototype.updateLimboDocument = function (txn, key) { return writeSentinelKey(txn, key); }; /** * Call provided function for each document in the cache that is 'orphaned'. Orphaned * means not a part of any target, so the only entry in the target-document index for * that document will be the sentinel row (targetId 0), which will also have the sequence * number for the last time the document was accessed. */ IndexedDbLruDelegate.prototype.forEachOrphanedDocument = function (txn, f) { var store = documentTargetStore(txn); var nextToReport = ListenSequence.INVALID; var nextPath; return store .iterate({ index: DbTargetDocument.documentTargetsIndex }, function (_a, _b) { var targetId = _a[0], docKey = _a[1]; var path = _b.path, sequenceNumber = _b.sequenceNumber; if (targetId === 0) { // if nextToReport is valid, report it, this is a new key so the // last one must not be a member of any targets. if (nextToReport !== ListenSequence.INVALID) { f(new DocumentKey(decode$1(nextPath)), nextToReport); } // set nextToReport to be this sequence number. It's the next one we // might report, if we don't find any targets for this document. // Note that the sequence number must be defined when the targetId // is 0. nextToReport = sequenceNumber; nextPath = path; } else { // set nextToReport to be invalid, we know we don't need to report // this one since we found a target for it. nextToReport = ListenSequence.INVALID; } }) .next(function () { // Since we report sequence numbers after getting to the next key, we // need to check if the last key we iterated over was an orphaned // document and report it. if (nextToReport !== ListenSequence.INVALID) { f(new DocumentKey(decode$1(nextPath)), nextToReport); } }); }; return IndexedDbLruDelegate; }()); function sentinelKey$1(key) { return [0, encode(key.path)]; } /** * @return A value suitable for writing a sentinel row in the target-document * store. */ function sentinelRow(key, sequenceNumber) { return new DbTargetDocument(0, encode(key.path), sequenceNumber); } function writeSentinelKey(txn, key) { return documentTargetStore(txn).put(sentinelRow(key, txn.currentSequenceNumber)); } /** * Copyright 2017 Google Inc. * * 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. */ /** * A readonly view of the local state of all documents we're tracking (i.e. we * have a cached version in remoteDocumentCache or local mutations for the * document). The view is computed by applying the mutations in the * MutationQueue to the RemoteDocumentCache. */ var LocalDocumentsView = /** @class */ (function () { function LocalDocumentsView(remoteDocumentCache, mutationQueue) { this.remoteDocumentCache = remoteDocumentCache; this.mutationQueue = mutationQueue; } /** * Get the local view of the document identified by `key`. * * @return Local view of the document or null if we don't have any cached * state for it. */ LocalDocumentsView.prototype.getDocument = function (transaction, key) { var _this = this; return this.mutationQueue .getAllMutationBatchesAffectingDocumentKey(transaction, key) .next(function (batches) { return _this.getDocumentInternal(transaction, key, batches); }); }; /** Internal version of `getDocument` that allows reusing batches. */ LocalDocumentsView.prototype.getDocumentInternal = function (transaction, key, inBatches) { return this.remoteDocumentCache.getEntry(transaction, key).next(function (doc) { for (var _i = 0, inBatches_1 = inBatches; _i < inBatches_1.length; _i++) { var batch = inBatches_1[_i]; doc = batch.applyToLocalView(key, doc); } return doc; }); }; /** * Gets the local view of the documents identified by `keys`. * * If we don't have cached state for a document in `keys`, a NoDocument will * be stored for that key in the resulting set. */ LocalDocumentsView.prototype.getDocuments = function (transaction, keys) { var _this = this; return this.mutationQueue .getAllMutationBatchesAffectingDocumentKeys(transaction, keys) .next(function (batches) { var promises = []; var results = maybeDocumentMap(); keys.forEach(function (key) { promises.push(_this.getDocumentInternal(transaction, key, batches).next(function (maybeDoc) { // TODO(http://b/32275378): Don't conflate missing / deleted. if (!maybeDoc) { maybeDoc = new NoDocument(key, SnapshotVersion.forDeletedDoc()); } results = results.insert(key, maybeDoc); })); }); return PersistencePromise.waitFor(promises).next(function () { return results; }); }); }; /** Performs a query against the local view of all documents. */ LocalDocumentsView.prototype.getDocumentsMatchingQuery = function (transaction, query) { if (DocumentKey.isDocumentKey(query.path)) { return this.getDocumentsMatchingDocumentQuery(transaction, query.path); } else { return this.getDocumentsMatchingCollectionQuery(transaction, query); } }; LocalDocumentsView.prototype.getDocumentsMatchingDocumentQuery = function (transaction, docPath) { // Just do a simple document lookup. return this.getDocument(transaction, new DocumentKey(docPath)).next(function (maybeDoc) { var result = documentMap(); if (maybeDoc instanceof Document) { result = result.insert(maybeDoc.key, maybeDoc); } return result; }); }; LocalDocumentsView.prototype.getDocumentsMatchingCollectionQuery = function (transaction, query) { var _this = this; // Query the remote documents and overlay mutations. var results; return this.remoteDocumentCache .getDocumentsMatchingQuery(transaction, query) .next(function (queryResults) { results = queryResults; return _this.mutationQueue.getAllMutationBatchesAffectingQuery(transaction, query); }) .next(function (matchingMutationBatches) { for (var _i = 0, matchingMutationBatches_1 = matchingMutationBatches; _i < matchingMutationBatches_1.length; _i++) { var batch = matchingMutationBatches_1[_i]; for (var _a = 0, _b = batch.mutations; _a < _b.length; _a++) { var mutation = _b[_a]; var key = mutation.key; // Only process documents belonging to the collection. if (!query.path.isImmediateParentOf(key.path)) { continue; } var baseDoc = results.get(key); var mutatedDoc = mutation.applyToLocalView(baseDoc, baseDoc, batch.localWriteTime); if (mutatedDoc instanceof Document) { results = results.insert(key, mutatedDoc); } else { results = results.remove(key); } } } }) .next(function () { // Finally, filter out any documents that don't actually match // the query. results.forEach(function (key, doc) { if (!query.matches(doc)) { results = results.remove(key); } }); return results; }); }; return LocalDocumentsView; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * A collection of references to a document from some kind of numbered entity * (either a target ID or batch ID). As references are added to or removed from * the set corresponding events are emitted to a registered garbage collector. * * Each reference is represented by a DocumentReference object. Each of them * contains enough information to uniquely identify the reference. They are all * stored primarily in a set sorted by key. A document is considered garbage if * there's no references in that set (this can be efficiently checked thanks to * sorting by key). * * ReferenceSet also keeps a secondary set that contains references sorted by * IDs. This one is used to efficiently implement removal of all references by * some target ID. */ var ReferenceSet = /** @class */ (function () { function ReferenceSet() { // A set of outstanding references to a document sorted by key. this.refsByKey = new SortedSet(DocReference.compareByKey); // A set of outstanding references to a document sorted by target id. this.refsByTarget = new SortedSet(DocReference.compareByTargetId); } /** Returns true if the reference set contains no references. */ ReferenceSet.prototype.isEmpty = function () { return this.refsByKey.isEmpty(); }; /** Adds a reference to the given document key for the given ID. */ ReferenceSet.prototype.addReference = function (key, id) { var ref = new DocReference(key, id); this.refsByKey = this.refsByKey.add(ref); this.refsByTarget = this.refsByTarget.add(ref); }; /** Add references to the given document keys for the given ID. */ ReferenceSet.prototype.addReferences = function (keys, id) { var _this = this; keys.forEach(function (key) { return _this.addReference(key, id); }); }; /** * Removes a reference to the given document key for the given * ID. */ ReferenceSet.prototype.removeReference = function (key, id) { this.removeRef(new DocReference(key, id)); }; ReferenceSet.prototype.removeReferences = function (keys, id) { var _this = this; keys.forEach(function (key) { return _this.removeReference(key, id); }); }; /** * Clears all references with a given ID. Calls removeRef() for each key * removed. */ ReferenceSet.prototype.removeReferencesForId = function (id) { var _this = this; var emptyKey = DocumentKey.EMPTY; var startRef = new DocReference(emptyKey, id); var endRef = new DocReference(emptyKey, id + 1); var keys = []; this.refsByTarget.forEachInRange([startRef, endRef], function (ref) { _this.removeRef(ref); keys.push(ref.key); }); return keys; }; ReferenceSet.prototype.removeAllReferences = function () { var _this = this; this.refsByKey.forEach(function (ref) { return _this.removeRef(ref); }); }; ReferenceSet.prototype.removeRef = function (ref) { this.refsByKey = this.refsByKey.delete(ref); this.refsByTarget = this.refsByTarget.delete(ref); }; ReferenceSet.prototype.referencesForId = function (id) { var emptyKey = DocumentKey.EMPTY; var startRef = new DocReference(emptyKey, id); var endRef = new DocReference(emptyKey, id + 1); var keys = documentKeySet(); this.refsByTarget.forEachInRange([startRef, endRef], function (ref) { keys = keys.add(ref.key); }); return keys; }; ReferenceSet.prototype.containsKey = function (key) { var ref = new DocReference(key, 0); var firstRef = this.refsByKey.firstAfterOrEqual(ref); return firstRef !== null && key.isEqual(firstRef.key); }; return ReferenceSet; }()); var DocReference = /** @class */ (function () { function DocReference(key, targetOrBatchId) { this.key = key; this.targetOrBatchId = targetOrBatchId; } /** Compare by key then by ID */ DocReference.compareByKey = function (left, right) { return (DocumentKey.comparator(left.key, right.key) || primitiveComparator(left.targetOrBatchId, right.targetOrBatchId)); }; /** Compare by ID then by key */ DocReference.compareByTargetId = function (left, right) { return (primitiveComparator(left.targetOrBatchId, right.targetOrBatchId) || DocumentKey.comparator(left.key, right.key)); }; return DocReference; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG$3 = 'LocalStore'; /** * Local storage in the Firestore client. Coordinates persistence components * like the mutation queue and remote document cache to present a * latency-compensated view of stored data. * * The LocalStore is responsible for accepting mutations from the Sync Engine. * Writes from the client are put into a queue as provisional Mutations until * they are processed by the RemoteStore and confirmed as having been written * to the server. * * The local store provides the local version of documents that have been * modified locally. It maintains the constraint: * * LocalDocument = RemoteDocument + Active(LocalMutations) * * (Active mutations are those that are enqueued and have not been previously * acknowledged or rejected). * * The RemoteDocument ("ground truth") state is provided via the * applyChangeBatch method. It will be some version of a server-provided * document OR will be a server-provided document PLUS acknowledged mutations: * * RemoteDocument' = RemoteDocument + Acknowledged(LocalMutations) * * Note that this "dirty" version of a RemoteDocument will not be identical to a * server base version, since it has LocalMutations added to it pending getting * an authoritative copy from the server. * * Since LocalMutations can be rejected by the server, we have to be able to * revert a LocalMutation that has already been applied to the LocalDocument * (typically done by replaying all remaining LocalMutations to the * RemoteDocument to re-apply). * * The LocalStore is responsible for the garbage collection of the documents it * contains. For now, it every doc referenced by a view, the mutation queue, or * the RemoteStore. * * It also maintains the persistence of mapping queries to resume tokens and * target ids. It needs to know this data about queries to properly know what * docs it would be allowed to garbage collect. * * The LocalStore must be able to efficiently execute queries against its local * cache of the documents, to provide the initial set of results before any * remote changes have been received. * * Note: In TypeScript, most methods return Promises since the implementation * may rely on fetching data from IndexedDB which is async. * These Promises will only be rejected on an I/O error or other internal * (unexpected) failure (e.g. failed assert) and always represent an * unrecoverable error (should be caught / reported by the async_queue). */ var LocalStore = /** @class */ (function () { function LocalStore( /** Manages our in-memory or durable persistence. */ persistence, initialUser) { this.persistence = persistence; /** * The set of document references maintained by any local views. */ this.localViewReferences = new ReferenceSet(); /** Maps a targetID to data about its query. */ this.queryDataByTarget = {}; assert(persistence.started, 'LocalStore was passed an unstarted persistence implementation'); this.persistence.referenceDelegate.setInMemoryPins(this.localViewReferences); this.mutationQueue = persistence.getMutationQueue(initialUser); this.remoteDocuments = persistence.getRemoteDocumentCache(); this.queryCache = persistence.getQueryCache(); this.localDocuments = new LocalDocumentsView(this.remoteDocuments, this.mutationQueue); } /** * Tells the LocalStore that the currently authenticated user has changed. * * In response the local store switches the mutation queue to the new user and * returns any resulting document changes. */ // PORTING NOTE: Android and iOS only return the documents affected by the // change. LocalStore.prototype.handleUserChange = function (user) { var _this = this; return this.persistence.runTransaction('Handle user change', 'readonly', function (txn) { // Swap out the mutation queue, grabbing the pending mutation batches // before and after. var oldBatches; return _this.mutationQueue .getAllMutationBatches(txn) .next(function (promisedOldBatches) { oldBatches = promisedOldBatches; _this.mutationQueue = _this.persistence.getMutationQueue(user); // Recreate our LocalDocumentsView using the new // MutationQueue. _this.localDocuments = new LocalDocumentsView(_this.remoteDocuments, _this.mutationQueue); return _this.mutationQueue.getAllMutationBatches(txn); }) .next(function (newBatches) { var removedBatchIds = []; var addedBatchIds = []; // Union the old/new changed keys. var changedKeys = documentKeySet(); for (var _i = 0, oldBatches_1 = oldBatches; _i < oldBatches_1.length; _i++) { var batch = oldBatches_1[_i]; removedBatchIds.push(batch.batchId); for (var _a = 0, _b = batch.mutations; _a < _b.length; _a++) { var mutation = _b[_a]; changedKeys = changedKeys.add(mutation.key); } } for (var _c = 0, newBatches_1 = newBatches; _c < newBatches_1.length; _c++) { var batch = newBatches_1[_c]; addedBatchIds.push(batch.batchId); for (var _d = 0, _e = batch.mutations; _d < _e.length; _d++) { var mutation = _e[_d]; changedKeys = changedKeys.add(mutation.key); } } // Return the set of all (potentially) changed documents and the list // of mutation batch IDs that were affected by change. return _this.localDocuments .getDocuments(txn, changedKeys) .next(function (affectedDocuments) { return { affectedDocuments: affectedDocuments, removedBatchIds: removedBatchIds, addedBatchIds: addedBatchIds }; }); }); }); }; /* Accept locally generated Mutations and commit them to storage. */ LocalStore.prototype.localWrite = function (mutations) { var _this = this; return this.persistence.runTransaction('Locally write mutations', 'readwrite', function (txn) { var batch; var localWriteTime = Timestamp.now(); return _this.mutationQueue .addMutationBatch(txn, localWriteTime, mutations) .next(function (promisedBatch) { batch = promisedBatch; // TODO(koss): This is doing an N^2 update by replaying ALL the // mutations on each document (instead of just the ones added) in // this batch. var keys = batch.keys(); return _this.localDocuments.getDocuments(txn, keys); }) .next(function (changedDocuments) { return { batchId: batch.batchId, changes: changedDocuments }; }); }); }; /** Returns the local view of the documents affected by a mutation batch. */ // PORTING NOTE: Multi-tab only. LocalStore.prototype.lookupMutationDocuments = function (batchId) { var _this = this; return this.persistence.runTransaction('Lookup mutation documents', 'readonly', function (txn) { return _this.mutationQueue .lookupMutationKeys(txn, batchId) .next(function (keys) { if (keys) { return _this.localDocuments.getDocuments(txn, keys); } else { return PersistencePromise.resolve(null); } }); }); }; /** * Acknowledge the given batch. * * On the happy path when a batch is acknowledged, the local store will * * + remove the batch from the mutation queue; * + apply the changes to the remote document cache; * + recalculate the latency compensated view implied by those changes (there * may be mutations in the queue that affect the documents but haven't been * acknowledged yet); and * + give the changed documents back the sync engine * * @returns The resulting (modified) documents. */ LocalStore.prototype.acknowledgeBatch = function (batchResult) { var _this = this; return this.persistence.runTransaction('Acknowledge batch', 'readwrite-primary', function (txn) { var affected = batchResult.batch.keys(); var documentBuffer = _this.remoteDocuments.newChangeBuffer(); return _this.mutationQueue .acknowledgeBatch(txn, batchResult.batch, batchResult.streamToken) .next(function () { return _this.applyWriteToRemoteDocuments(txn, batchResult, documentBuffer); }) .next(function () { return documentBuffer.apply(txn); }) .next(function () { return _this.mutationQueue.performConsistencyCheck(txn); }) .next(function () { return _this.localDocuments.getDocuments(txn, affected); }); }); }; /** * Remove mutations from the MutationQueue for the specified batch; * LocalDocuments will be recalculated. * * @returns The resulting modified documents. */ LocalStore.prototype.rejectBatch = function (batchId) { var _this = this; return this.persistence.runTransaction('Reject batch', 'readwrite-primary', function (txn) { var affectedKeys; return _this.mutationQueue .lookupMutationBatch(txn, batchId) .next(function (batch) { assert(batch !== null, 'Attempt to reject nonexistent batch!'); affectedKeys = batch.keys(); return _this.mutationQueue.removeMutationBatch(txn, batch); }) .next(function () { return _this.mutationQueue.performConsistencyCheck(txn); }) .next(function () { return _this.localDocuments.getDocuments(txn, affectedKeys); }); }); }; /** Returns the last recorded stream token for the current user. */ LocalStore.prototype.getLastStreamToken = function () { var _this = this; return this.persistence.runTransaction('Get last stream token', 'readonly', function (txn) { return _this.mutationQueue.getLastStreamToken(txn); }); }; /** * Sets the stream token for the current user without acknowledging any * mutation batch. This is usually only useful after a stream handshake or in * response to an error that requires clearing the stream token. */ LocalStore.prototype.setLastStreamToken = function (streamToken) { var _this = this; return this.persistence.runTransaction('Set last stream token', 'readwrite-primary', function (txn) { return _this.mutationQueue.setLastStreamToken(txn, streamToken); }); }; /** * Returns the last consistent snapshot processed (used by the RemoteStore to * determine whether to buffer incoming snapshots from the backend). */ LocalStore.prototype.getLastRemoteSnapshotVersion = function () { var _this = this; return this.persistence.runTransaction('Get last remote snapshot version', 'readonly', function (txn) { return _this.queryCache.getLastRemoteSnapshotVersion(txn); }); }; /** * Update the "ground-state" (remote) documents. We assume that the remote * event reflects any write batches that have been acknowledged or rejected * (i.e. we do not re-apply local mutations to updates from this event). * * LocalDocuments are re-calculated if there are remaining mutations in the * queue. */ LocalStore.prototype.applyRemoteEvent = function (remoteEvent) { var _this = this; var documentBuffer = this.remoteDocuments.newChangeBuffer(); return this.persistence.runTransaction('Apply remote event', 'readwrite-primary', function (txn) { var promises = []; var authoritativeUpdates = documentKeySet(); forEachNumber(remoteEvent.targetChanges, function (targetId, change) { // Do not ref/unref unassigned targetIds - it may lead to leaks. var queryData = _this.queryDataByTarget[targetId]; if (!queryData) return; // When a global snapshot contains updates (either add or modify) we // can completely trust these updates as authoritative and blindly // apply them to our cache (as a defensive measure to promote // self-healing in the unfortunate case that our cache is ever somehow // corrupted / out-of-sync). // // If the document is only updated while removing it from a target // then watch isn't obligated to send the absolute latest version: it // can send the first version that caused the document not to match. change.addedDocuments.forEach(function (key) { authoritativeUpdates = authoritativeUpdates.add(key); }); change.modifiedDocuments.forEach(function (key) { authoritativeUpdates = authoritativeUpdates.add(key); }); promises.push(_this.queryCache .removeMatchingKeys(txn, change.removedDocuments, targetId) .next(function () { return _this.queryCache.addMatchingKeys(txn, change.addedDocuments, targetId); })); // Update the resume token if the change includes one. Don't clear // any preexisting value. var resumeToken = change.resumeToken; if (resumeToken.length > 0) { var oldQueryData = queryData; queryData = queryData.copy({ resumeToken: resumeToken, snapshotVersion: remoteEvent.snapshotVersion }); _this.queryDataByTarget[targetId] = queryData; if (LocalStore.shouldPersistQueryData(oldQueryData, queryData, change)) { promises.push(_this.queryCache.updateQueryData(txn, queryData)); } } }); var changedDocKeys = documentKeySet(); remoteEvent.documentUpdates.forEach(function (key, doc) { changedDocKeys = changedDocKeys.add(key); promises.push(documentBuffer.getEntry(txn, key).next(function (existingDoc) { // If a document update isn't authoritative, make sure we don't // apply an old document version to the remote cache. We make an // exception for SnapshotVersion.MIN which can happen for // manufactured events (e.g. in the case of a limbo document // resolution failing). if (existingDoc == null || doc.version.isEqual(SnapshotVersion.MIN) || (authoritativeUpdates.has(doc.key) && !existingDoc.hasPendingWrites) || doc.version.compareTo(existingDoc.version) >= 0) { documentBuffer.addEntry(doc); } else { debug(LOG_TAG$3, 'Ignoring outdated watch update for ', key, '. Current version:', existingDoc.version, ' Watch version:', doc.version); } })); if (remoteEvent.resolvedLimboDocuments.has(key)) { promises.push(_this.persistence.referenceDelegate.updateLimboDocument(txn, key)); } }); // HACK: The only reason we allow a null snapshot version is so that we // can synthesize remote events when we get permission denied errors while // trying to resolve the state of a locally cached document that is in // limbo. var remoteVersion = remoteEvent.snapshotVersion; if (!remoteVersion.isEqual(SnapshotVersion.MIN)) { var updateRemoteVersion = _this.queryCache .getLastRemoteSnapshotVersion(txn) .next(function (lastRemoteVersion) { assert(remoteVersion.compareTo(lastRemoteVersion) >= 0, 'Watch stream reverted to previous snapshot?? ' + remoteVersion + ' < ' + lastRemoteVersion); return _this.queryCache.setTargetsMetadata(txn, txn.currentSequenceNumber, remoteVersion); }); promises.push(updateRemoteVersion); } return PersistencePromise.waitFor(promises) .next(function () { return documentBuffer.apply(txn); }) .next(function () { return _this.localDocuments.getDocuments(txn, changedDocKeys); }); }); }; /** * Returns true if the newQueryData should be persisted during an update of * an active target. QueryData should always be persisted when a target is * being released and should not call this function. * * While the target is active, QueryData updates can be omitted when nothing * about the target has changed except metadata like the resume token or * snapshot version. Occasionally it's worth the extra write to prevent these * values from getting too stale after a crash, but this doesn't have to be * too frequent. */ LocalStore.shouldPersistQueryData = function (oldQueryData, newQueryData, change) { // Avoid clearing any existing value if (newQueryData.resumeToken.length === 0) return false; // Any resume token is interesting if there isn't one already. if (oldQueryData.resumeToken.length === 0) return true; // Don't allow resume token changes to be buffered indefinitely. This // allows us to be reasonably up-to-date after a crash and avoids needing // to loop over all active queries on shutdown. Especially in the browser // we may not get time to do anything interesting while the current tab is // closing. var timeDelta = newQueryData.snapshotVersion.toMicroseconds() - oldQueryData.snapshotVersion.toMicroseconds(); if (timeDelta >= this.RESUME_TOKEN_MAX_AGE_MICROS) return true; // Otherwise if the only thing that has changed about a target is its resume // token it's not worth persisting. Note that the RemoteStore keeps an // in-memory view of the currently active targets which includes the current // resume token, so stream failure or user changes will still use an // up-to-date resume token regardless of what we do here. var changes = change.addedDocuments.size + change.modifiedDocuments.size + change.removedDocuments.size; return changes > 0; }; /** * Notify local store of the changed views to locally pin documents. */ LocalStore.prototype.notifyLocalViewChanges = function (viewChanges) { var _this = this; return this.persistence.runTransaction('notifyLocalViewChanges', 'readwrite', function (txn) { return PersistencePromise.forEach(viewChanges, function (viewChange) { _this.localViewReferences.addReferences(viewChange.addedKeys, viewChange.targetId); _this.localViewReferences.removeReferences(viewChange.removedKeys, viewChange.targetId); return PersistencePromise.forEach(viewChange.removedKeys, function (key) { return _this.persistence.referenceDelegate.removeReference(txn, key); }); }); }); }; /** * Gets the mutation batch after the passed in batchId in the mutation queue * or null if empty. * @param afterBatchId If provided, the batch to search after. * @returns The next mutation or null if there wasn't one. */ LocalStore.prototype.nextMutationBatch = function (afterBatchId) { var _this = this; return this.persistence.runTransaction('Get next mutation batch', 'readonly', function (txn) { if (afterBatchId === undefined) { afterBatchId = BATCHID_UNKNOWN; } return _this.mutationQueue.getNextMutationBatchAfterBatchId(txn, afterBatchId); }); }; /** * Read the current value of a Document with a given key or null if not * found - used for testing. */ LocalStore.prototype.readDocument = function (key) { var _this = this; return this.persistence.runTransaction('read document', 'readonly', function (txn) { return _this.localDocuments.getDocument(txn, key); }); }; /** * Assigns the given query an internal ID so that its results can be pinned so * they don't get GC'd. A query must be allocated in the local store before * the store can be used to manage its view. */ LocalStore.prototype.allocateQuery = function (query) { var _this = this; return this.persistence.runTransaction('Allocate query', 'readwrite', function (txn) { var queryData; return _this.queryCache .getQueryData(txn, query) .next(function (cached) { if (cached) { // This query has been listened to previously, so reuse the // previous targetID. // TODO(mcg): freshen last accessed date? queryData = cached; return PersistencePromise.resolve(); } else { return _this.queryCache.allocateTargetId(txn).next(function (targetId) { queryData = new QueryData(query, targetId, QueryPurpose.Listen, txn.currentSequenceNumber); return _this.queryCache.addQueryData(txn, queryData); }); } }) .next(function () { assert(!_this.queryDataByTarget[queryData.targetId], 'Tried to allocate an already allocated query: ' + query); _this.queryDataByTarget[queryData.targetId] = queryData; return queryData; }); }); }; /** * Unpin all the documents associated with the given query. If * `keepPersistedQueryData` is set to false and Eager GC enabled, the method * directly removes the associated query data from the query cache. */ // PORTING NOTE: `keepPersistedQueryData` is multi-tab only. LocalStore.prototype.releaseQuery = function (query, keepPersistedQueryData) { var _this = this; var mode = keepPersistedQueryData ? 'readwrite' : 'readwrite-primary'; return this.persistence.runTransaction('Release query', mode, function (txn) { return _this.queryCache .getQueryData(txn, query) .next(function (queryData) { assert(queryData != null, 'Tried to release nonexistent query: ' + query); var targetId = queryData.targetId; var cachedQueryData = _this.queryDataByTarget[targetId]; // References for documents sent via Watch are automatically removed when we delete a // query's target data from the reference delegate. Since this does not remove references // for locally mutated documents, we have to remove the target associations for these // documents manually. var removed = _this.localViewReferences.removeReferencesForId(targetId); delete _this.queryDataByTarget[targetId]; if (!keepPersistedQueryData) { return PersistencePromise.forEach(removed, function (key) { return _this.persistence.referenceDelegate.removeReference(txn, key); }).next(function () { return _this.persistence.referenceDelegate.removeTarget(txn, cachedQueryData); }); } else { return PersistencePromise.resolve(); } }); }); }; /** * Runs the specified query against all the documents in the local store and * returns the results. */ LocalStore.prototype.executeQuery = function (query) { var _this = this; return this.persistence.runTransaction('Execute query', 'readonly', function (txn) { return _this.localDocuments.getDocumentsMatchingQuery(txn, query); }); }; /** * Returns the keys of the documents that are associated with the given * target id in the remote table. */ LocalStore.prototype.remoteDocumentKeys = function (targetId) { var _this = this; return this.persistence.runTransaction('Remote document keys', 'readonly', function (txn) { return _this.queryCache.getMatchingKeysForTargetId(txn, targetId); }); }; // PORTING NOTE: Multi-tab only. LocalStore.prototype.getActiveClients = function () { return this.persistence.getActiveClients(); }; // PORTING NOTE: Multi-tab only. LocalStore.prototype.removeCachedMutationBatchMetadata = function (batchId) { this.mutationQueue.removeCachedMutationKeys(batchId); }; // PORTING NOTE: Multi-tab only. LocalStore.prototype.setNetworkEnabled = function (networkEnabled) { this.persistence.setNetworkEnabled(networkEnabled); }; LocalStore.prototype.applyWriteToRemoteDocuments = function (txn, batchResult, documentBuffer) { var _this = this; var batch = batchResult.batch; var docKeys = batch.keys(); var promiseChain = PersistencePromise.resolve(); docKeys.forEach(function (docKey) { promiseChain = promiseChain .next(function () { return documentBuffer.getEntry(txn, docKey); }) .next(function (remoteDoc) { var doc = remoteDoc; var ackVersion = batchResult.docVersions.get(docKey); assert(ackVersion !== null, 'ackVersions should contain every doc in the write.'); if (!doc || doc.version.compareTo(ackVersion) < 0) { doc = batch.applyToRemoteDocument(docKey, doc, batchResult); if (!doc) { assert(!remoteDoc, 'Mutation batch ' + batch + ' applied to document ' + remoteDoc + ' resulted in null'); } else { documentBuffer.addEntry(doc); } } }); }); return promiseChain.next(function () { return _this.mutationQueue.removeMutationBatch(txn, batch); }); }; // PORTING NOTE: Multi-tab only. LocalStore.prototype.getQueryForTarget = function (targetId) { var _this = this; if (this.queryDataByTarget[targetId]) { return Promise.resolve(this.queryDataByTarget[targetId].query); } else { return this.persistence.runTransaction('Get query data', 'readonly', function (txn) { return _this.queryCache .getQueryDataForTarget(txn, targetId) .next(function (queryData) { return (queryData ? queryData.query : null); }); }); } }; // PORTING NOTE: Multi-tab only. LocalStore.prototype.getNewDocumentChanges = function () { var _this = this; return this.persistence.runTransaction('Get new document changes', 'readonly', function (txn) { return _this.remoteDocuments.getNewDocumentChanges(txn); }); }; /** * The maximum time to leave a resume token buffered without writing it out. * This value is arbitrary: it's long enough to avoid several writes * (possibly indefinitely if updates come more frequently than this) but * short enough that restarting after crashing will still have a pretty * recent resume token. */ LocalStore.RESUME_TOKEN_MAX_AGE_MICROS = 5 * 60 * 1e6; return LocalStore; }()); /** * Copyright 2017 Google Inc. * * 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. */ var MemoryMutationQueue = /** @class */ (function () { function MemoryMutationQueue(referenceDelegate) { this.referenceDelegate = referenceDelegate; /** * The set of all mutations that have been sent but not yet been applied to * the backend. */ this.mutationQueue = []; /** Next value to use when assigning sequential IDs to each mutation batch. */ this.nextBatchId = 1; /** The highest acknowledged mutation in the queue. */ this.highestAcknowledgedBatchId = BATCHID_UNKNOWN; /** The last received stream token from the server, used to acknowledge which * responses the client has processed. Stream tokens are opaque checkpoint * markers whose only real value is their inclusion in the next request. */ this.lastStreamToken = emptyByteString(); /** An ordered mapping between documents and the mutations batch IDs. */ this.batchesByDocumentKey = new SortedSet(DocReference.compareByKey); } MemoryMutationQueue.prototype.checkEmpty = function (transaction) { return PersistencePromise.resolve(this.mutationQueue.length === 0); }; MemoryMutationQueue.prototype.acknowledgeBatch = function (transaction, batch, streamToken) { var batchId = batch.batchId; assert(batchId > this.highestAcknowledgedBatchId, 'Mutation batchIDs must be acknowledged in order'); var batchIndex = this.indexOfExistingBatchId(batchId, 'acknowledged'); assert(batchIndex === 0, 'Can only acknowledge the first batch in the mutation queue'); // Verify that the batch in the queue is the one to be acknowledged. var check = this.mutationQueue[batchIndex]; assert(batchId === check.batchId, 'Queue ordering failure: expected batch ' + batchId + ', got batch ' + check.batchId); this.highestAcknowledgedBatchId = batchId; this.lastStreamToken = streamToken; return PersistencePromise.resolve(); }; MemoryMutationQueue.prototype.getLastStreamToken = function (transaction) { return PersistencePromise.resolve(this.lastStreamToken); }; MemoryMutationQueue.prototype.setLastStreamToken = function (transaction, streamToken) { this.lastStreamToken = streamToken; return PersistencePromise.resolve(); }; MemoryMutationQueue.prototype.addMutationBatch = function (transaction, localWriteTime, mutations) { assert(mutations.length !== 0, 'Mutation batches should not be empty'); var batchId = this.nextBatchId; this.nextBatchId++; if (this.mutationQueue.length > 0) { var prior = this.mutationQueue[this.mutationQueue.length - 1]; assert(prior.batchId < batchId, 'Mutation batchIDs must be monotonically increasing order'); } var batch = new MutationBatch(batchId, localWriteTime, mutations); this.mutationQueue.push(batch); // Track references by document key. for (var _i = 0, mutations_1 = mutations; _i < mutations_1.length; _i++) { var mutation = mutations_1[_i]; this.batchesByDocumentKey = this.batchesByDocumentKey.add(new DocReference(mutation.key, batchId)); } return PersistencePromise.resolve(batch); }; MemoryMutationQueue.prototype.lookupMutationBatch = function (transaction, batchId) { return PersistencePromise.resolve(this.findMutationBatch(batchId)); }; MemoryMutationQueue.prototype.lookupMutationKeys = function (transaction, batchId) { var mutationBatch = this.findMutationBatch(batchId); assert(mutationBatch != null, 'Failed to find local mutation batch.'); return PersistencePromise.resolve(mutationBatch.keys()); }; MemoryMutationQueue.prototype.getNextMutationBatchAfterBatchId = function (transaction, batchId) { // All batches with batchId <= this.highestAcknowledgedBatchId have been // acknowledged so the first unacknowledged batch after batchID will have a // batchID larger than both of these values. var nextBatchId = Math.max(batchId, this.highestAcknowledgedBatchId) + 1; // The requested batchId may still be out of range so normalize it to the // start of the queue. var rawIndex = this.indexOfBatchId(nextBatchId); var index = rawIndex < 0 ? 0 : rawIndex; return PersistencePromise.resolve(this.mutationQueue.length > index ? this.mutationQueue[index] : null); }; MemoryMutationQueue.prototype.getAllMutationBatches = function (transaction) { return PersistencePromise.resolve(this.mutationQueue.slice()); }; MemoryMutationQueue.prototype.getAllMutationBatchesAffectingDocumentKey = function (transaction, documentKey) { var _this = this; var start = new DocReference(documentKey, 0); var end = new DocReference(documentKey, Number.POSITIVE_INFINITY); var result = []; this.batchesByDocumentKey.forEachInRange([start, end], function (ref) { assert(documentKey.isEqual(ref.key), "Should only iterate over a single key's batches"); var batch = _this.findMutationBatch(ref.targetOrBatchId); assert(batch !== null, 'Batches in the index must exist in the main table'); result.push(batch); }); return PersistencePromise.resolve(result); }; MemoryMutationQueue.prototype.getAllMutationBatchesAffectingDocumentKeys = function (transaction, documentKeys) { var _this = this; var uniqueBatchIDs = new SortedSet(primitiveComparator); documentKeys.forEach(function (documentKey) { var start = new DocReference(documentKey, 0); var end = new DocReference(documentKey, Number.POSITIVE_INFINITY); _this.batchesByDocumentKey.forEachInRange([start, end], function (ref) { assert(documentKey.isEqual(ref.key), "For each key, should only iterate over a single key's batches"); uniqueBatchIDs = uniqueBatchIDs.add(ref.targetOrBatchId); }); }); return PersistencePromise.resolve(this.findMutationBatches(uniqueBatchIDs)); }; MemoryMutationQueue.prototype.getAllMutationBatchesAffectingQuery = function (transaction, query) { // Use the query path as a prefix for testing if a document matches the // query. var prefix = query.path; var immediateChildrenPathLength = prefix.length + 1; // Construct a document reference for actually scanning the index. Unlike // the prefix the document key in this reference must have an even number of // segments. The empty segment can be used a suffix of the query path // because it precedes all other segments in an ordered traversal. var startPath = prefix; if (!DocumentKey.isDocumentKey(startPath)) { startPath = startPath.child(''); } var start = new DocReference(new DocumentKey(startPath), 0); // Find unique batchIDs referenced by all documents potentially matching the // query. var uniqueBatchIDs = new SortedSet(primitiveComparator); this.batchesByDocumentKey.forEachWhile(function (ref) { var rowKeyPath = ref.key.path; if (!prefix.isPrefixOf(rowKeyPath)) { return false; } else { // Rows with document keys more than one segment longer than the query // path can't be matches. For example, a query on 'rooms' can't match // the document /rooms/abc/messages/xyx. // TODO(mcg): we'll need a different scanner when we implement // ancestor queries. if (rowKeyPath.length === immediateChildrenPathLength) { uniqueBatchIDs = uniqueBatchIDs.add(ref.targetOrBatchId); } return true; } }, start); return PersistencePromise.resolve(this.findMutationBatches(uniqueBatchIDs)); }; MemoryMutationQueue.prototype.findMutationBatches = function (batchIDs) { var _this = this; // Construct an array of matching batches, sorted by batchID to ensure that // multiple mutations affecting the same document key are applied in order. var result = []; batchIDs.forEach(function (batchId) { var batch = _this.findMutationBatch(batchId); if (batch !== null) { result.push(batch); } }); return result; }; MemoryMutationQueue.prototype.removeMutationBatch = function (transaction, batch) { var _this = this; // Find the position of the first batch for removal. This need not be the // first entry in the queue. var batchIndex = this.indexOfExistingBatchId(batch.batchId, 'removed'); assert(batchIndex === 0, 'Can only remove the first entry of the mutation queue'); this.mutationQueue.shift(); var references = this.batchesByDocumentKey; return PersistencePromise.forEach(batch.mutations, function (mutation) { var ref = new DocReference(mutation.key, batch.batchId); references = references.delete(ref); return _this.referenceDelegate.removeMutationReference(transaction, mutation.key); }).next(function () { _this.batchesByDocumentKey = references; }); }; MemoryMutationQueue.prototype.removeCachedMutationKeys = function (batchId) { // No-op since the memory mutation queue does not maintain a separate cache. }; MemoryMutationQueue.prototype.containsKey = function (txn, key) { var ref = new DocReference(key, 0); var firstRef = this.batchesByDocumentKey.firstAfterOrEqual(ref); return PersistencePromise.resolve(key.isEqual(firstRef && firstRef.key)); }; MemoryMutationQueue.prototype.performConsistencyCheck = function (txn) { if (this.mutationQueue.length === 0) { assert(this.batchesByDocumentKey.isEmpty(), 'Document leak -- detected dangling mutation references when queue is empty.'); } return PersistencePromise.resolve(); }; /** * Finds the index of the given batchId in the mutation queue and asserts that * the resulting index is within the bounds of the queue. * * @param batchId The batchId to search for * @param action A description of what the caller is doing, phrased in passive * form (e.g. "acknowledged" in a routine that acknowledges batches). */ MemoryMutationQueue.prototype.indexOfExistingBatchId = function (batchId, action) { var index = this.indexOfBatchId(batchId); assert(index >= 0 && index < this.mutationQueue.length, 'Batches must exist to be ' + action); return index; }; /** * Finds the index of the given batchId in the mutation queue. This operation * is O(1). * * @return The computed index of the batch with the given batchId, based on * the state of the queue. Note this index can be negative if the requested * batchId has already been remvoed from the queue or past the end of the * queue if the batchId is larger than the last added batch. */ MemoryMutationQueue.prototype.indexOfBatchId = function (batchId) { if (this.mutationQueue.length === 0) { // As an index this is past the end of the queue return 0; } // Examine the front of the queue to figure out the difference between the // batchId and indexes in the array. Note that since the queue is ordered // by batchId, if the first batch has a larger batchId then the requested // batchId doesn't exist in the queue. var firstBatchId = this.mutationQueue[0].batchId; return batchId - firstBatchId; }; /** * A version of lookupMutationBatch that doesn't return a promise, this makes * other functions that uses this code easier to read and more efficent. */ MemoryMutationQueue.prototype.findMutationBatch = function (batchId) { var index = this.indexOfBatchId(batchId); if (index < 0 || index >= this.mutationQueue.length) { return null; } var batch = this.mutationQueue[index]; assert(batch.batchId === batchId, 'If found batch must match'); return batch; }; return MemoryMutationQueue; }()); /** * Copyright 2017 Google Inc. * * 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. */ var MemoryQueryCache = /** @class */ (function () { function MemoryQueryCache(persistence) { this.persistence = persistence; /** * Maps a query to the data about that query */ this.queries = new ObjectMap(function (q) { return q.canonicalId(); }); /** The last received snapshot version. */ this.lastRemoteSnapshotVersion = SnapshotVersion.MIN; /** The highest numbered target ID encountered. */ this.highestTargetId = 0; /** The highest sequence number encountered. */ this.highestSequenceNumber = 0; /** * A ordered bidirectional mapping between documents and the remote target * IDs. */ this.references = new ReferenceSet(); this.targetCount = 0; this.targetIdGenerator = TargetIdGenerator.forQueryCache(); } MemoryQueryCache.prototype.getTargetCount = function (txn) { return PersistencePromise.resolve(this.targetCount); }; MemoryQueryCache.prototype.forEachTarget = function (txn, f) { this.queries.forEach(function (_, queryData) { return f(queryData); }); return PersistencePromise.resolve(); }; MemoryQueryCache.prototype.getLastRemoteSnapshotVersion = function (transaction) { return PersistencePromise.resolve(this.lastRemoteSnapshotVersion); }; MemoryQueryCache.prototype.getHighestSequenceNumber = function (transaction) { return PersistencePromise.resolve(this.highestSequenceNumber); }; MemoryQueryCache.prototype.allocateTargetId = function (transaction) { var nextTargetId = this.targetIdGenerator.after(this.highestTargetId); this.highestTargetId = nextTargetId; return PersistencePromise.resolve(nextTargetId); }; MemoryQueryCache.prototype.setTargetsMetadata = function (transaction, highestListenSequenceNumber, lastRemoteSnapshotVersion) { if (lastRemoteSnapshotVersion) { this.lastRemoteSnapshotVersion = lastRemoteSnapshotVersion; } if (highestListenSequenceNumber > this.highestSequenceNumber) { this.highestSequenceNumber = highestListenSequenceNumber; } return PersistencePromise.resolve(); }; MemoryQueryCache.prototype.saveQueryData = function (queryData) { this.queries.set(queryData.query, queryData); var targetId = queryData.targetId; if (targetId > this.highestTargetId) { this.highestTargetId = targetId; } if (queryData.sequenceNumber > this.highestSequenceNumber) { this.highestSequenceNumber = queryData.sequenceNumber; } }; MemoryQueryCache.prototype.addQueryData = function (transaction, queryData) { assert(!this.queries.has(queryData.query), 'Adding a query that already exists'); this.saveQueryData(queryData); this.targetCount += 1; return PersistencePromise.resolve(); }; MemoryQueryCache.prototype.updateQueryData = function (transaction, queryData) { assert(this.queries.has(queryData.query), 'Updating a non-existent query'); this.saveQueryData(queryData); return PersistencePromise.resolve(); }; MemoryQueryCache.prototype.removeQueryData = function (transaction, queryData) { assert(this.targetCount > 0, 'Removing a target from an empty cache'); assert(this.queries.has(queryData.query), 'Removing a non-existent target from the cache'); this.queries.delete(queryData.query); this.references.removeReferencesForId(queryData.targetId); this.targetCount -= 1; return PersistencePromise.resolve(); }; MemoryQueryCache.prototype.removeTargets = function (transaction, upperBound, activeTargetIds) { var _this = this; var count = 0; var removals = []; this.queries.forEach(function (key, queryData) { if (queryData.sequenceNumber <= upperBound && !activeTargetIds[queryData.targetId]) { _this.queries.delete(key); removals.push(_this.removeMatchingKeysForTargetId(transaction, queryData.targetId)); count++; } }); return PersistencePromise.waitFor(removals).next(function () { return count; }); }; MemoryQueryCache.prototype.getQueryCount = function (transaction) { return PersistencePromise.resolve(this.targetCount); }; MemoryQueryCache.prototype.getQueryData = function (transaction, query) { var queryData = this.queries.get(query) || null; return PersistencePromise.resolve(queryData); }; MemoryQueryCache.prototype.getQueryDataForTarget = function (transaction, targetId) { // This method is only needed for multi-tab and we can't implement it // efficiently without additional data structures. return fail('Not yet implemented.'); }; MemoryQueryCache.prototype.addMatchingKeys = function (txn, keys, targetId) { this.references.addReferences(keys, targetId); var referenceDelegate = this.persistence.referenceDelegate; var promises = []; if (referenceDelegate) { keys.forEach(function (key) { promises.push(referenceDelegate.addReference(txn, key)); }); } return PersistencePromise.waitFor(promises); }; MemoryQueryCache.prototype.removeMatchingKeys = function (txn, keys, targetId) { this.references.removeReferences(keys, targetId); var referenceDelegate = this.persistence.referenceDelegate; var promises = []; if (referenceDelegate) { keys.forEach(function (key) { promises.push(referenceDelegate.removeReference(txn, key)); }); } return PersistencePromise.waitFor(promises); }; MemoryQueryCache.prototype.removeMatchingKeysForTargetId = function (txn, targetId) { this.references.removeReferencesForId(targetId); return PersistencePromise.resolve(); }; MemoryQueryCache.prototype.getMatchingKeysForTargetId = function (txn, targetId) { var matchingKeys = this.references.referencesForId(targetId); return PersistencePromise.resolve(matchingKeys); }; MemoryQueryCache.prototype.containsKey = function (txn, key) { return PersistencePromise.resolve(this.references.containsKey(key)); }; return MemoryQueryCache; }()); /** * Copyright 2017 Google Inc. * * 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. */ function documentSizeMap() { return new SortedMap(DocumentKey.comparator); } var MemoryRemoteDocumentCache = /** @class */ (function () { /** * @param sizer Used to assess the size of a document. For eager GC, this is expected to just * return 0 to avoid unnecessarily doing the work of calculating the size. */ function MemoryRemoteDocumentCache(sizer) { this.sizer = sizer; this.docs = documentSizeMap(); this.newDocumentChanges = documentKeySet(); this.size = 0; } /** * Adds the supplied entries to the cache. Adds the given size delta to the cached size. */ MemoryRemoteDocumentCache.prototype.addEntries = function (transaction, entries, sizeDelta) { for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { var entry = entries_1[_i]; var key = entry.maybeDocument.key; this.docs = this.docs.insert(key, entry); this.newDocumentChanges = this.newDocumentChanges.add(key); } this.size += sizeDelta; return PersistencePromise.resolve(); }; /** * Removes the specified entry from the cache and updates the size as appropriate. */ MemoryRemoteDocumentCache.prototype.removeEntry = function (transaction, documentKey) { var entry = this.docs.get(documentKey); if (entry) { this.docs = this.docs.remove(documentKey); this.size -= entry.size; return PersistencePromise.resolve(entry.size); } else { return PersistencePromise.resolve(0); } }; MemoryRemoteDocumentCache.prototype.getEntry = function (transaction, documentKey) { var entry = this.docs.get(documentKey); return PersistencePromise.resolve(entry ? entry.maybeDocument : null); }; /** * Looks up an entry in the cache. * * @param documentKey The key of the entry to look up. * @return The cached MaybeDocument entry and its size, or null if we have nothing cached. */ MemoryRemoteDocumentCache.prototype.getSizedEntry = function (transaction, documentKey) { return PersistencePromise.resolve(this.docs.get(documentKey)); }; MemoryRemoteDocumentCache.prototype.getDocumentsMatchingQuery = function (transaction, query) { var results = documentMap(); // Documents are ordered by key, so we can use a prefix scan to narrow down // the documents we need to match the query against. var prefix = new DocumentKey(query.path.child('')); var iterator = this.docs.getIteratorFrom(prefix); while (iterator.hasNext()) { var _a = iterator.getNext(), key = _a.key, maybeDocument = _a.value.maybeDocument; if (!query.path.isPrefixOf(key.path)) { break; } if (maybeDocument instanceof Document && query.matches(maybeDocument)) { results = results.insert(maybeDocument.key, maybeDocument); } } return PersistencePromise.resolve(results); }; MemoryRemoteDocumentCache.prototype.forEachDocumentKey = function (transaction, f) { return PersistencePromise.forEach(this.docs, function (key) { return f(key); }); }; MemoryRemoteDocumentCache.prototype.getNewDocumentChanges = function (transaction) { var _this = this; var changedDocs = maybeDocumentMap(); this.newDocumentChanges.forEach(function (key) { var entry = _this.docs.get(key); var changedDoc = entry ? entry.maybeDocument : new NoDocument(key, SnapshotVersion.forDeletedDoc()); changedDocs = changedDocs.insert(key, changedDoc); }); this.newDocumentChanges = documentKeySet(); return PersistencePromise.resolve(changedDocs); }; MemoryRemoteDocumentCache.prototype.newChangeBuffer = function () { return new MemoryRemoteDocumentChangeBuffer(this.sizer, this); }; MemoryRemoteDocumentCache.prototype.getSize = function (txn) { return PersistencePromise.resolve(this.size); }; return MemoryRemoteDocumentCache; }()); /** * Handles the details of adding and updating documents in the MemoryRemoteDocumentCache. */ var MemoryRemoteDocumentChangeBuffer = /** @class */ (function (_super) { tslib_1.__extends(MemoryRemoteDocumentChangeBuffer, _super); function MemoryRemoteDocumentChangeBuffer(sizer, documentCache) { var _this = _super.call(this) || this; _this.sizer = sizer; _this.documentCache = documentCache; return _this; } MemoryRemoteDocumentChangeBuffer.prototype.applyChanges = function (transaction) { var _this = this; var changes = this.assertChanges(); var delta = 0; var docs = []; changes.forEach(function (key, maybeDocument) { var previousSize = _this.documentSizes.get(key); assert(previousSize !== undefined, "Attempting to change document " + key.toString() + " without having read it first"); var size = _this.sizer(maybeDocument); delta += size - previousSize; docs.push({ maybeDocument: maybeDocument, size: size }); }); return this.documentCache.addEntries(transaction, docs, delta); }; MemoryRemoteDocumentChangeBuffer.prototype.getFromCache = function (transaction, documentKey) { return this.documentCache.getSizedEntry(transaction, documentKey); }; return MemoryRemoteDocumentChangeBuffer; }(RemoteDocumentChangeBuffer)); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG$4 = 'MemoryPersistence'; /** * A memory-backed instance of Persistence. Data is stored only in RAM and * not persisted across sessions. */ var MemoryPersistence = /** @class */ (function () { function MemoryPersistence(clientId, isEager, serializer) { var _this = this; this.clientId = clientId; /** * Note that these are retained here to make it easier to write tests * affecting both the in-memory and IndexedDB-backed persistence layers. Tests * can create a new LocalStore wrapping this Persistence instance and this * will make the in-memory persistence layer behave as if it were actually * persisting values. */ this.mutationQueues = {}; this.listenSequence = new ListenSequence(0); this._started = false; this._started = true; if (isEager) { this.referenceDelegate = new MemoryEagerDelegate(this); } else { this.referenceDelegate = new MemoryLruDelegate(this, new LocalSerializer(serializer)); } this.queryCache = new MemoryQueryCache(this); var sizer = function (doc) { return _this.referenceDelegate.documentSize(doc); }; this.remoteDocumentCache = new MemoryRemoteDocumentCache(sizer); } MemoryPersistence.createLruPersistence = function (clientId, serializer) { return new MemoryPersistence(clientId, /* isEager= */ false, serializer); }; MemoryPersistence.createEagerPersistence = function (clientId, serializer) { return new MemoryPersistence(clientId, /* isEager= */ true, serializer); }; MemoryPersistence.prototype.shutdown = function (deleteData) { // No durable state to ensure is closed on shutdown. this._started = false; return Promise.resolve(); }; Object.defineProperty(MemoryPersistence.prototype, "started", { get: function () { return this._started; }, enumerable: true, configurable: true }); MemoryPersistence.prototype.getActiveClients = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { return [2 /*return*/, [this.clientId]]; }); }); }; MemoryPersistence.prototype.setPrimaryStateListener = function (primaryStateListener) { // All clients using memory persistence act as primary. return primaryStateListener(true); }; MemoryPersistence.prototype.setNetworkEnabled = function (networkEnabled) { // No op. }; MemoryPersistence.prototype.getMutationQueue = function (user) { var queue = this.mutationQueues[user.toKey()]; if (!queue) { queue = new MemoryMutationQueue(this.referenceDelegate); this.mutationQueues[user.toKey()] = queue; } return queue; }; MemoryPersistence.prototype.getQueryCache = function () { return this.queryCache; }; MemoryPersistence.prototype.getRemoteDocumentCache = function () { return this.remoteDocumentCache; }; MemoryPersistence.prototype.runTransaction = function (action, mode, transactionOperation) { var _this = this; debug(LOG_TAG$4, 'Starting transaction:', action); var txn = new MemoryTransaction(this.listenSequence.next()); this.referenceDelegate.onTransactionStarted(); return transactionOperation(txn) .next(function (result) { return _this.referenceDelegate .onTransactionCommitted(txn) .next(function () { return result; }); }) .toPromise(); }; MemoryPersistence.prototype.mutationQueuesContainKey = function (transaction, key) { return PersistencePromise.or(values(this.mutationQueues) .map(function (queue) { return function () { return queue.containsKey(transaction, key); }; })); }; return MemoryPersistence; }()); /** * Memory persistence is not actually transactional, but future implementations * may have transaction-scoped state. */ var MemoryTransaction = /** @class */ (function () { function MemoryTransaction(currentSequenceNumber) { this.currentSequenceNumber = currentSequenceNumber; } return MemoryTransaction; }()); var MemoryEagerDelegate = /** @class */ (function () { function MemoryEagerDelegate(persistence) { this.persistence = persistence; } MemoryEagerDelegate.prototype.setInMemoryPins = function (inMemoryPins) { this.inMemoryPins = inMemoryPins; }; MemoryEagerDelegate.prototype.addReference = function (txn, key) { this.orphanedDocuments.delete(key); return PersistencePromise.resolve(); }; MemoryEagerDelegate.prototype.removeReference = function (txn, key) { this.orphanedDocuments.add(key); return PersistencePromise.resolve(); }; MemoryEagerDelegate.prototype.removeMutationReference = function (txn, key) { this.orphanedDocuments.add(key); return PersistencePromise.resolve(); }; MemoryEagerDelegate.prototype.removeTarget = function (txn, queryData) { var _this = this; var cache = this.persistence.getQueryCache(); return cache .getMatchingKeysForTargetId(txn, queryData.targetId) .next(function (keys) { keys.forEach(function (key) { return _this.orphanedDocuments.add(key); }); }) .next(function () { return cache.removeQueryData(txn, queryData); }); }; MemoryEagerDelegate.prototype.onTransactionStarted = function () { this.orphanedDocuments = new Set(); }; MemoryEagerDelegate.prototype.onTransactionCommitted = function (txn) { var _this = this; var cache = this.persistence.getRemoteDocumentCache(); return PersistencePromise.forEach(this.orphanedDocuments, function (key) { return _this.isReferenced(txn, key).next(function (isReferenced) { if (!isReferenced) { // Since this is the eager delegate and memory persistence, // we don't care about the size of documents. We don't track // the size of the cache for eager GC. return cache.removeEntry(txn, key).next(function () { }); } return PersistencePromise.resolve(); }); }); }; MemoryEagerDelegate.prototype.updateLimboDocument = function (txn, key) { var _this = this; return this.isReferenced(txn, key).next(function (isReferenced) { if (isReferenced) { _this.orphanedDocuments.delete(key); } else { _this.orphanedDocuments.add(key); } }); }; MemoryEagerDelegate.prototype.documentSize = function (doc) { // For eager GC, we don't care about the document size, there are no size thresholds. return 0; }; MemoryEagerDelegate.prototype.isReferenced = function (txn, key) { var _this = this; return PersistencePromise.or([ function () { return _this.persistence.getQueryCache().containsKey(txn, key); }, function () { return _this.persistence.mutationQueuesContainKey(txn, key); }, function () { return PersistencePromise.resolve(_this.inMemoryPins.containsKey(key)); } ]); }; return MemoryEagerDelegate; }()); var MemoryLruDelegate = /** @class */ (function () { function MemoryLruDelegate(persistence, serializer) { this.persistence = persistence; this.serializer = serializer; this.orphanedSequenceNumbers = new ObjectMap(function (k) { return encode(k.path); }); this.garbageCollector = new LruGarbageCollector(this); } // No-ops, present so memory persistence doesn't have to care which delegate // it has. MemoryLruDelegate.prototype.onTransactionStarted = function () { }; MemoryLruDelegate.prototype.onTransactionCommitted = function (txn) { return PersistencePromise.resolve(); }; MemoryLruDelegate.prototype.forEachTarget = function (txn, f) { return this.persistence.getQueryCache().forEachTarget(txn, f); }; MemoryLruDelegate.prototype.getSequenceNumberCount = function (txn) { var docCountPromise = this.orphanedDocumentCount(txn); var targetCountPromise = this.persistence .getQueryCache() .getTargetCount(txn); return targetCountPromise.next(function (targetCount) { return docCountPromise.next(function (docCount) { return targetCount + docCount; }); }); }; MemoryLruDelegate.prototype.orphanedDocumentCount = function (txn) { var orphanedCount = 0; return this.forEachOrphanedDocumentSequenceNumber(txn, function (_) { orphanedCount++; }).next(function () { return orphanedCount; }); }; MemoryLruDelegate.prototype.forEachOrphanedDocumentSequenceNumber = function (txn, f) { var _this = this; return PersistencePromise.forEach(this.orphanedSequenceNumbers, function (key, sequenceNumber) { // Pass in the exact sequence number as the upper bound so we know it won't be pinned by // being too recent. return _this.isPinned(txn, key, sequenceNumber).next(function (isPinned) { if (!isPinned) { return f(sequenceNumber); } else { return PersistencePromise.resolve(); } }); }); }; MemoryLruDelegate.prototype.setInMemoryPins = function (inMemoryPins) { this.inMemoryPins = inMemoryPins; }; MemoryLruDelegate.prototype.removeTargets = function (txn, upperBound, activeTargetIds) { return this.persistence .getQueryCache() .removeTargets(txn, upperBound, activeTargetIds); }; MemoryLruDelegate.prototype.removeOrphanedDocuments = function (txn, upperBound) { var _this = this; var count = 0; var cache = this.persistence.getRemoteDocumentCache(); var p = cache.forEachDocumentKey(txn, function (key) { return _this.isPinned(txn, key, upperBound).next(function (isPinned) { if (isPinned) { return PersistencePromise.resolve(); } else { count++; // The memory remote document cache does its own byte // accounting on removal. This is ok because updating the size // for memory persistence does not incur IO. return cache.removeEntry(txn, key).next(); } }); }); return p.next(function () { return count; }); }; MemoryLruDelegate.prototype.removeMutationReference = function (txn, key) { this.orphanedSequenceNumbers.set(key, txn.currentSequenceNumber); return PersistencePromise.resolve(); }; MemoryLruDelegate.prototype.removeTarget = function (txn, queryData) { var updated = queryData.copy({ sequenceNumber: txn.currentSequenceNumber }); return this.persistence.getQueryCache().updateQueryData(txn, updated); }; MemoryLruDelegate.prototype.addReference = function (txn, key) { this.orphanedSequenceNumbers.set(key, txn.currentSequenceNumber); return PersistencePromise.resolve(); }; MemoryLruDelegate.prototype.removeReference = function (txn, key) { this.orphanedSequenceNumbers.set(key, txn.currentSequenceNumber); return PersistencePromise.resolve(); }; MemoryLruDelegate.prototype.updateLimboDocument = function (txn, key) { this.orphanedSequenceNumbers.set(key, txn.currentSequenceNumber); return PersistencePromise.resolve(); }; MemoryLruDelegate.prototype.documentSize = function (maybeDoc) { var remoteDocument = this.serializer.toDbRemoteDocument(maybeDoc); var value; if (remoteDocument.document) { value = remoteDocument.document; } else if (remoteDocument.unknownDocument) { value = remoteDocument.unknownDocument; } else if (remoteDocument.noDocument) { value = remoteDocument.noDocument; } else { throw fail('Unknown remote document type'); } return JSON.stringify(value).length; }; MemoryLruDelegate.prototype.isPinned = function (txn, key, upperBound) { var _this = this; return PersistencePromise.or([ function () { return _this.persistence.mutationQueuesContainKey(txn, key); }, function () { return PersistencePromise.resolve(_this.inMemoryPins.containsKey(key)); }, function () { return _this.persistence.getQueryCache().containsKey(txn, key); }, function () { var orphanedAt = _this.orphanedSequenceNumbers.get(key); return PersistencePromise.resolve(orphanedAt !== undefined && orphanedAt > upperBound); } ]); }; return MemoryLruDelegate; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG$5 = 'ExponentialBackoff'; /** * A helper for running delayed tasks following an exponential backoff curve * between attempts. * * Each delay is made up of a "base" delay which follows the exponential * backoff curve, and a +/- 50% "jitter" that is calculated and added to the * base delay. This prevents clients from accidentally synchronizing their * delays causing spikes of load to the backend. */ var ExponentialBackoff = /** @class */ (function () { function ExponentialBackoff( /** * The AsyncQueue to run backoff operations on. */ queue, /** * The ID to use when scheduling backoff operations on the AsyncQueue. */ timerId, /** * The initial delay (used as the base delay on the first retry attempt). * Note that jitter will still be applied, so the actual delay could be as * little as 0.5*initialDelayMs. */ initialDelayMs, /** * The multiplier to use to determine the extended base delay after each * attempt. */ backoffFactor, /** * The maximum base delay after which no further backoff is performed. * Note that jitter will still be applied, so the actual delay could be as * much as 1.5*maxDelayMs. */ maxDelayMs) { this.queue = queue; this.timerId = timerId; this.initialDelayMs = initialDelayMs; this.backoffFactor = backoffFactor; this.maxDelayMs = maxDelayMs; this.timerPromise = null; /** The last backoff attempt, as epoch milliseconds. */ this.lastAttemptTime = Date.now(); this.reset(); } /** * Resets the backoff delay. * * The very next backoffAndWait() will have no delay. If it is called again * (i.e. due to an error), initialDelayMs (plus jitter) will be used, and * subsequent ones will increase according to the backoffFactor. */ ExponentialBackoff.prototype.reset = function () { this.currentBaseMs = 0; }; /** * Resets the backoff delay to the maximum delay (e.g. for use after a * RESOURCE_EXHAUSTED error). */ ExponentialBackoff.prototype.resetToMax = function () { this.currentBaseMs = this.maxDelayMs; }; /** * Returns a promise that resolves after currentDelayMs, and increases the * delay for any subsequent attempts. If there was a pending backoff operation * already, it will be canceled. */ ExponentialBackoff.prototype.backoffAndRun = function (op) { var _this = this; // Cancel any pending backoff operation. this.cancel(); // First schedule using the current base (which may be 0 and should be // honored as such). var desiredDelayWithJitterMs = Math.floor(this.currentBaseMs + this.jitterDelayMs()); // Guard against lastAttemptTime being in the future due to a clock change. var delaySoFarMs = Math.max(0, Date.now() - this.lastAttemptTime); // Guard against the backoff delay already being past. var remainingDelayMs = Math.max(0, desiredDelayWithJitterMs - delaySoFarMs); if (this.currentBaseMs > 0) { debug(LOG_TAG$5, "Backing off for " + remainingDelayMs + " ms " + ("(base delay: " + this.currentBaseMs + " ms, ") + ("delay with jitter: " + desiredDelayWithJitterMs + " ms, ") + ("last attempt: " + delaySoFarMs + " ms ago)")); } this.timerPromise = this.queue.enqueueAfterDelay(this.timerId, remainingDelayMs, function () { _this.lastAttemptTime = Date.now(); return op(); }); // Apply backoff factor to determine next delay and ensure it is within // bounds. this.currentBaseMs *= this.backoffFactor; if (this.currentBaseMs < this.initialDelayMs) { this.currentBaseMs = this.initialDelayMs; } if (this.currentBaseMs > this.maxDelayMs) { this.currentBaseMs = this.maxDelayMs; } }; ExponentialBackoff.prototype.cancel = function () { if (this.timerPromise !== null) { this.timerPromise.cancel(); this.timerPromise = null; } }; /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ ExponentialBackoff.prototype.jitterDelayMs = function () { return (Math.random() - 0.5) * this.currentBaseMs; }; return ExponentialBackoff; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG$6 = 'PersistentStream'; /** * PersistentStream can be in one of 5 states (each described in detail below) * based on the following state transition diagram: * * start() called auth & connection succeeded * INITIAL ----------------> STARTING -----------------------------> OPEN * ^ | | * | | error occurred | * | \-----------------------------v-----/ * | | * backoff | | * elapsed | start() called | * \--- BACKOFF <---------------- ERROR * * [any state] --------------------------> INITIAL * stop() called or * idle timer expired */ var PersistentStreamState; (function (PersistentStreamState) { /** * The streaming RPC is not yet running and there's no error condition. * Calling start() will start the stream immediately without backoff. * While in this state isStarted() will return false. */ PersistentStreamState[PersistentStreamState["Initial"] = 0] = "Initial"; /** * The stream is starting, either waiting for an auth token or for the stream * to successfully open. While in this state, isStarted() will return true but * isOpen() will return false. */ PersistentStreamState[PersistentStreamState["Starting"] = 1] = "Starting"; /** * The streaming RPC is up and running. Requests and responses can flow * freely. Both isStarted() and isOpen() will return true. */ PersistentStreamState[PersistentStreamState["Open"] = 2] = "Open"; /** * The stream encountered an error. The next start attempt will back off. * While in this state isStarted() will return false. */ PersistentStreamState[PersistentStreamState["Error"] = 3] = "Error"; /** * An in-between state after an error where the stream is waiting before * re-starting. After waiting is complete, the stream will try to open. * While in this state isStarted() will return true but isOpen() will return * false. */ PersistentStreamState[PersistentStreamState["Backoff"] = 4] = "Backoff"; })(PersistentStreamState || (PersistentStreamState = {})); /** * Initial backoff time in milliseconds after an error. * Set to 1s according to https://cloud.google.com/apis/design/errors. */ var BACKOFF_INITIAL_DELAY_MS = 1000; /** Maximum backoff time in milliseconds */ var BACKOFF_MAX_DELAY_MS = 60 * 1000; var BACKOFF_FACTOR = 1.5; /** The time a stream stays open after it is marked idle. */ var IDLE_TIMEOUT_MS = 60 * 1000; /** * A PersistentStream is an abstract base class that represents a streaming RPC * to the Firestore backend. It's built on top of the connections own support * for streaming RPCs, and adds several critical features for our clients: * * - Exponential backoff on failure * - Authentication via CredentialsProvider * - Dispatching all callbacks into the shared worker queue * - Closing idle streams after 60 seconds of inactivity * * Subclasses of PersistentStream implement serialization of models to and * from the JSON representation of the protocol buffers for a specific * streaming RPC. * * ## Starting and Stopping * * Streaming RPCs are stateful and need to be start()ed before messages can * be sent and received. The PersistentStream will call the onOpen() function * of the listener once the stream is ready to accept requests. * * Should a start() fail, PersistentStream will call the registered onClose() * listener with a FirestoreError indicating what went wrong. * * A PersistentStream can be started and stopped repeatedly. * * Generic types: * SendType: The type of the outgoing message of the underlying * connection stream * ReceiveType: The type of the incoming message of the underlying * connection stream * ListenerType: The type of the listener that will be used for callbacks */ var PersistentStream = /** @class */ (function () { function PersistentStream(queue, connectionTimerId, idleTimerId, connection, credentialsProvider, listener) { this.queue = queue; this.idleTimerId = idleTimerId; this.connection = connection; this.credentialsProvider = credentialsProvider; this.listener = listener; this.state = PersistentStreamState.Initial; /** * A close count that's incremented every time the stream is closed; used by * getCloseGuardedDispatcher() to invalidate callbacks that happen after * close. */ this.closeCount = 0; this.idleTimer = null; this.stream = null; this.backoff = new ExponentialBackoff(queue, connectionTimerId, BACKOFF_INITIAL_DELAY_MS, BACKOFF_FACTOR, BACKOFF_MAX_DELAY_MS); } /** * Returns true if start() has been called and no error has occurred. True * indicates the stream is open or in the process of opening (which * encompasses respecting backoff, getting auth tokens, and starting the * actual RPC). Use isOpen() to determine if the stream is open and ready for * outbound requests. */ PersistentStream.prototype.isStarted = function () { return (this.state === PersistentStreamState.Starting || this.state === PersistentStreamState.Open || this.state === PersistentStreamState.Backoff); }; /** * Returns true if the underlying RPC is open (the onOpen() listener has been * called) and the stream is ready for outbound requests. */ PersistentStream.prototype.isOpen = function () { return this.state === PersistentStreamState.Open; }; /** * Starts the RPC. Only allowed if isStarted() returns false. The stream is * not immediately ready for use: onOpen() will be invoked when the RPC is * ready for outbound requests, at which point isOpen() will return true. * * When start returns, isStarted() will return true. */ PersistentStream.prototype.start = function () { if (this.state === PersistentStreamState.Error) { this.performBackoff(); return; } assert(this.state === PersistentStreamState.Initial, 'Already started'); this.auth(); }; /** * Stops the RPC. This call is idempotent and allowed regardless of the * current isStarted() state. * * When stop returns, isStarted() and isOpen() will both return false. */ PersistentStream.prototype.stop = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: if (!this.isStarted()) return [3 /*break*/, 2]; return [4 /*yield*/, this.close(PersistentStreamState.Initial)]; case 1: _a.sent(); _a.label = 2; case 2: return [2 /*return*/]; } }); }); }; /** * After an error the stream will usually back off on the next attempt to * start it. If the error warrants an immediate restart of the stream, the * sender can use this to indicate that the receiver should not back off. * * Each error will call the onClose() listener. That function can decide to * inhibit backoff if required. */ PersistentStream.prototype.inhibitBackoff = function () { assert(!this.isStarted(), 'Can only inhibit backoff in a stopped state'); this.state = PersistentStreamState.Initial; this.backoff.reset(); }; /** * Marks this stream as idle. If no further actions are performed on the * stream for one minute, the stream will automatically close itself and * notify the stream's onClose() handler with Status.OK. The stream will then * be in a !isStarted() state, requiring the caller to start the stream again * before further use. * * Only streams that are in state 'Open' can be marked idle, as all other * states imply pending network operations. */ PersistentStream.prototype.markIdle = function () { var _this = this; // Starts the idle time if we are in state 'Open' and are not yet already // running a timer (in which case the previous idle timeout still applies). if (this.isOpen() && this.idleTimer === null) { this.idleTimer = this.queue.enqueueAfterDelay(this.idleTimerId, IDLE_TIMEOUT_MS, function () { return _this.handleIdleCloseTimer(); }); } }; /** Sends a message to the underlying stream. */ PersistentStream.prototype.sendRequest = function (msg) { this.cancelIdleCheck(); this.stream.send(msg); }; /** Called by the idle timer when the stream should close due to inactivity. */ PersistentStream.prototype.handleIdleCloseTimer = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { if (this.isOpen()) { // When timing out an idle stream there's no reason to force the stream into backoff when // it restarts so set the stream state to Initial instead of Error. return [2 /*return*/, this.close(PersistentStreamState.Initial)]; } return [2 /*return*/]; }); }); }; /** Marks the stream as active again. */ PersistentStream.prototype.cancelIdleCheck = function () { if (this.idleTimer) { this.idleTimer.cancel(); this.idleTimer = null; } }; /** * Closes the stream and cleans up as necessary: * * * closes the underlying GRPC stream; * * calls the onClose handler with the given 'error'; * * sets internal stream state to 'finalState'; * * adjusts the backoff timer based on the error * * A new stream can be opened by calling start(). * * @param finalState the intended state of the stream after closing. * @param error the error the connection was closed with. */ PersistentStream.prototype.close = function (finalState, error$$1) { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: assert(this.isStarted(), 'Only started streams should be closed.'); assert(finalState === PersistentStreamState.Error || isNullOrUndefined(error$$1), "Can't provide an error when not in an error state."); // Cancel any outstanding timers (they're guaranteed not to execute). this.cancelIdleCheck(); this.backoff.cancel(); // Invalidates any stream-related callbacks (e.g. from auth or the // underlying stream), guaranteeing they won't execute. this.closeCount++; if (finalState !== PersistentStreamState.Error) { // If this is an intentional close ensure we don't delay our next connection attempt. this.backoff.reset(); } else if (error$$1 && error$$1.code === Code.RESOURCE_EXHAUSTED) { // Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.) error(error$$1.toString()); error('Using maximum backoff delay to prevent overloading the backend.'); this.backoff.resetToMax(); } else if (error$$1 && error$$1.code === Code.UNAUTHENTICATED) { // "unauthenticated" error means the token was rejected. Try force refreshing it in case it // just expired. this.credentialsProvider.invalidateToken(); } // Clean up the underlying stream because we are no longer interested in events. if (this.stream !== null) { this.tearDown(); this.stream.close(); this.stream = null; } // This state must be assigned before calling onClose() to allow the callback to // inhibit backoff or otherwise manipulate the state in its non-started state. this.state = finalState; // Notify the listener that the stream closed. return [4 /*yield*/, this.listener.onClose(error$$1)]; case 1: // Notify the listener that the stream closed. _a.sent(); return [2 /*return*/]; } }); }); }; /** * Can be overridden to perform additional cleanup before the stream is closed. * Calling super.tearDown() is not required. */ PersistentStream.prototype.tearDown = function () { }; PersistentStream.prototype.auth = function () { var _this = this; assert(this.state === PersistentStreamState.Initial, 'Must be in initial state to auth'); this.state = PersistentStreamState.Starting; var dispatchIfNotClosed = this.getCloseGuardedDispatcher(this.closeCount); // TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below. var closeCount = this.closeCount; this.credentialsProvider.getToken().then(function (token) { // Stream can be stopped while waiting for authentication. // TODO(mikelehen): We really should just use dispatchIfNotClosed // and let this dispatch onto the queue, but that opened a spec test can // of worms that I don't want to deal with in this PR. if (_this.closeCount === closeCount) { // Normally we'd have to schedule the callback on the AsyncQueue. // However, the following calls are safe to be called outside the // AsyncQueue since they don't chain asynchronous calls _this.startStream(token); } }, function (error$$1) { dispatchIfNotClosed(function () { var rpcError = new FirestoreError(Code.UNKNOWN, 'Fetching auth token failed: ' + error$$1.message); return _this.handleStreamClose(rpcError); }); }); }; PersistentStream.prototype.startStream = function (token) { var _this = this; assert(this.state === PersistentStreamState.Starting, 'Trying to start stream in a non-starting state'); var dispatchIfNotClosed = this.getCloseGuardedDispatcher(this.closeCount); this.stream = this.startRpc(token); this.stream.onOpen(function () { dispatchIfNotClosed(function () { assert(_this.state === PersistentStreamState.Starting, 'Expected stream to be in state Starting, but was ' + _this.state); _this.state = PersistentStreamState.Open; return _this.listener.onOpen(); }); }); this.stream.onClose(function (error$$1) { dispatchIfNotClosed(function () { return _this.handleStreamClose(error$$1); }); }); this.stream.onMessage(function (msg) { dispatchIfNotClosed(function () { return _this.onMessage(msg); }); }); }; PersistentStream.prototype.performBackoff = function () { var _this = this; assert(this.state === PersistentStreamState.Error, 'Should only perform backoff when in Error state'); this.state = PersistentStreamState.Backoff; this.backoff.backoffAndRun(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { assert(this.state === PersistentStreamState.Backoff, 'Backoff elapsed but state is now: ' + this.state); this.state = PersistentStreamState.Initial; this.start(); assert(this.isStarted(), 'PersistentStream should have started'); return [2 /*return*/]; }); }); }); }; // Visible for tests PersistentStream.prototype.handleStreamClose = function (error$$1) { assert(this.isStarted(), "Can't handle server close on non-started stream"); debug(LOG_TAG$6, "close with error: " + error$$1); this.stream = null; // In theory the stream could close cleanly, however, in our current model // we never expect this to happen because if we stop a stream ourselves, // this callback will never be called. To prevent cases where we retry // without a backoff accidentally, we set the stream to error in all cases. return this.close(PersistentStreamState.Error, error$$1); }; /** * Returns a "dispatcher" function that dispatches operations onto the * AsyncQueue but only runs them if closeCount remains unchanged. This allows * us to turn auth / stream callbacks into no-ops if the stream is closed / * re-opened, etc. */ PersistentStream.prototype.getCloseGuardedDispatcher = function (startCloseCount) { var _this = this; return function (fn) { _this.queue.enqueueAndForget(function () { if (_this.closeCount === startCloseCount) { return fn(); } else { debug(LOG_TAG$6, 'stream callback skipped by getCloseGuardedDispatcher.'); return Promise.resolve(); } }); }; }; return PersistentStream; }()); /** * A PersistentStream that implements the Listen RPC. * * Once the Listen stream has called the onOpen() listener, any number of * listen() and unlisten() calls can be made to control what changes will be * sent from the server for ListenResponses. */ var PersistentListenStream = /** @class */ (function (_super) { tslib_1.__extends(PersistentListenStream, _super); function PersistentListenStream(queue, connection, credentials, serializer, listener) { var _this = _super.call(this, queue, TimerId.ListenStreamConnectionBackoff, TimerId.ListenStreamIdle, connection, credentials, listener) || this; _this.serializer = serializer; return _this; } PersistentListenStream.prototype.startRpc = function (token) { return this.connection.openStream('Listen', token); }; PersistentListenStream.prototype.onMessage = function (watchChangeProto) { // A successful response means the stream is healthy this.backoff.reset(); var watchChange = this.serializer.fromWatchChange(watchChangeProto); var snapshot = this.serializer.versionFromListenResponse(watchChangeProto); return this.listener.onWatchChange(watchChange, snapshot); }; /** * Registers interest in the results of the given query. If the query * includes a resumeToken it will be included in the request. Results that * affect the query will be streamed back as WatchChange messages that * reference the targetId. */ PersistentListenStream.prototype.watch = function (queryData) { var request = {}; request.database = this.serializer.encodedDatabaseId; request.addTarget = this.serializer.toTarget(queryData); var labels = this.serializer.toListenRequestLabels(queryData); if (labels) { request.labels = labels; } this.sendRequest(request); }; /** * Unregisters interest in the results of the query associated with the * given targetId. */ PersistentListenStream.prototype.unwatch = function (targetId) { var request = {}; request.database = this.serializer.encodedDatabaseId; request.removeTarget = targetId; this.sendRequest(request); }; return PersistentListenStream; }(PersistentStream)); /** * A Stream that implements the Write RPC. * * The Write RPC requires the caller to maintain special streamToken * state in between calls, to help the server understand which responses the * client has processed by the time the next request is made. Every response * will contain a streamToken; this value must be passed to the next * request. * * After calling start() on this stream, the next request must be a handshake, * containing whatever streamToken is on hand. Once a response to this * request is received, all pending mutations may be submitted. When * submitting multiple batches of mutations at the same time, it's * okay to use the same streamToken for the calls to writeMutations. * * TODO(b/33271235): Use proto types */ var PersistentWriteStream = /** @class */ (function (_super) { tslib_1.__extends(PersistentWriteStream, _super); function PersistentWriteStream(queue, connection, credentials, serializer, listener) { var _this = _super.call(this, queue, TimerId.WriteStreamConnectionBackoff, TimerId.WriteStreamIdle, connection, credentials, listener) || this; _this.serializer = serializer; _this.handshakeComplete_ = false; return _this; } Object.defineProperty(PersistentWriteStream.prototype, "handshakeComplete", { /** * Tracks whether or not a handshake has been successfully exchanged and * the stream is ready to accept mutations. */ get: function () { return this.handshakeComplete_; }, enumerable: true, configurable: true }); // Override of PersistentStream.start PersistentWriteStream.prototype.start = function () { this.handshakeComplete_ = false; _super.prototype.start.call(this); }; PersistentWriteStream.prototype.tearDown = function () { if (this.handshakeComplete_) { this.writeMutations([]); } }; PersistentWriteStream.prototype.startRpc = function (token) { return this.connection.openStream('Write', token); }; PersistentWriteStream.prototype.onMessage = function (responseProto) { // Always capture the last stream token. assert(!!responseProto.streamToken, 'Got a write response without a stream token'); this.lastStreamToken = responseProto.streamToken; if (!this.handshakeComplete_) { // The first response is always the handshake response assert(!responseProto.writeResults || responseProto.writeResults.length === 0, 'Got mutation results for handshake'); this.handshakeComplete_ = true; return this.listener.onHandshakeComplete(); } else { // A successful first write response means the stream is healthy, // Note, that we could consider a successful handshake healthy, however, // the write itself might be causing an error we want to back off from. this.backoff.reset(); var results = this.serializer.fromWriteResults(responseProto.writeResults, responseProto.commitTime); var commitVersion = this.serializer.fromVersion(responseProto.commitTime); return this.listener.onMutationResult(commitVersion, results); } }; /** * Sends an initial streamToken to the server, performing the handshake * required to make the StreamingWrite RPC work. Subsequent * calls should wait until onHandshakeComplete was called. */ PersistentWriteStream.prototype.writeHandshake = function () { assert(this.isOpen(), 'Writing handshake requires an opened stream'); assert(!this.handshakeComplete_, 'Handshake already completed'); // TODO(dimond): Support stream resumption. We intentionally do not set the // stream token on the handshake, ignoring any stream token we might have. var request = {}; request.database = this.serializer.encodedDatabaseId; this.sendRequest(request); }; /** Sends a group of mutations to the Firestore backend to apply. */ PersistentWriteStream.prototype.writeMutations = function (mutations) { var _this = this; assert(this.isOpen(), 'Writing mutations requires an opened stream'); assert(this.handshakeComplete_, 'Handshake must be complete before writing mutations'); assert(this.lastStreamToken.length > 0, 'Trying to write mutation without a token'); var request = { // Protos are typed with string, but we support UInt8Array on Node // tslint:disable-next-line:no-any streamToken: this.lastStreamToken, writes: mutations.map(function (mutation) { return _this.serializer.toMutation(mutation); }) }; this.sendRequest(request); }; return PersistentWriteStream; }(PersistentStream)); /** * Copyright 2017 Google Inc. * * 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. */ /** * Datastore is a wrapper around the external Google Cloud Datastore grpc API, * which provides an interface that is more convenient for the rest of the * client SDK architecture to consume. */ var Datastore = /** @class */ (function () { function Datastore(queue, connection, credentials, serializer) { this.queue = queue; this.connection = connection; this.credentials = credentials; this.serializer = serializer; } Datastore.prototype.newPersistentWriteStream = function (listener) { return new PersistentWriteStream(this.queue, this.connection, this.credentials, this.serializer, listener); }; Datastore.prototype.newPersistentWatchStream = function (listener) { return new PersistentListenStream(this.queue, this.connection, this.credentials, this.serializer, listener); }; Datastore.prototype.commit = function (mutations) { var _this = this; var params = { database: this.serializer.encodedDatabaseId, writes: mutations.map(function (m) { return _this.serializer.toMutation(m); }) }; return this.invokeRPC('Commit', params).then(function (response) { return _this.serializer.fromWriteResults(response.writeResults, response.commitTime); }); }; Datastore.prototype.lookup = function (keys) { var _this = this; var params = { database: this.serializer.encodedDatabaseId, documents: keys.map(function (k) { return _this.serializer.toName(k); }) }; return this.invokeStreamingRPC('BatchGetDocuments', params).then(function (response) { var docs = maybeDocumentMap(); response.forEach(function (proto) { var doc = _this.serializer.fromMaybeDocument(proto); docs = docs.insert(doc.key, doc); }); var result = []; keys.forEach(function (key) { var doc = docs.get(key); assert(!!doc, 'Missing entity in write response for ' + key); result.push(doc); }); return result; }); }; /** Gets an auth token and invokes the provided RPC. */ Datastore.prototype.invokeRPC = function (rpcName, request) { var _this = this; return this.credentials .getToken() .then(function (token) { return _this.connection.invokeRPC(rpcName, request, token); }) .catch(function (error) { if (error.code === Code.UNAUTHENTICATED) { _this.credentials.invalidateToken(); } throw error; }); }; /** Gets an auth token and invokes the provided RPC with streamed results. */ Datastore.prototype.invokeStreamingRPC = function (rpcName, request) { var _this = this; return this.credentials .getToken() .then(function (token) { return _this.connection.invokeStreamingRPC(rpcName, request, token); }) .catch(function (error) { if (error.code === Code.UNAUTHENTICATED) { _this.credentials.invalidateToken(); } throw error; }); }; return Datastore; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Internal transaction object responsible for accumulating the mutations to * perform and the base versions for any documents read. */ var Transaction = /** @class */ (function () { function Transaction(datastore) { this.datastore = datastore; // The version of each document that was read during this transaction. this.readVersions = documentVersionMap(); this.mutations = []; this.committed = false; } Transaction.prototype.recordVersion = function (doc) { var docVersion; if (doc instanceof Document) { docVersion = doc.version; } else if (doc instanceof NoDocument) { // For deleted docs, we must use baseVersion 0 when we overwrite them. docVersion = SnapshotVersion.forDeletedDoc(); } else { throw fail('Document in a transaction was a ' + doc.constructor.name); } var existingVersion = this.readVersions.get(doc.key); if (existingVersion !== null) { if (!docVersion.isEqual(existingVersion)) { // This transaction will fail no matter what. throw new FirestoreError(Code.ABORTED, 'Document version changed between two reads.'); } } else { this.readVersions = this.readVersions.insert(doc.key, docVersion); } }; Transaction.prototype.lookup = function (keys) { var _this = this; if (this.committed) { return Promise.reject('Transaction has already completed.'); } if (this.mutations.length > 0) { return Promise.reject('Transactions lookups are invalid after writes.'); } return this.datastore.lookup(keys).then(function (docs) { docs.forEach(function (doc) { if (doc instanceof NoDocument || doc instanceof Document) { _this.recordVersion(doc); } else { fail('Document in a transaction was a ' + doc.constructor.name); } }); return docs; }); }; Transaction.prototype.write = function (mutations) { if (this.committed) { throw new FirestoreError(Code.FAILED_PRECONDITION, 'Transaction has already completed.'); } this.mutations = this.mutations.concat(mutations); }; /** * Returns the version of this document when it was read in this transaction, * as a precondition, or no precondition if it was not read. */ Transaction.prototype.precondition = function (key) { var version = this.readVersions.get(key); if (version) { return Precondition.updateTime(version); } else { return Precondition.NONE; } }; /** * Returns the precondition for a document if the operation is an update. */ Transaction.prototype.preconditionForUpdate = function (key) { var version = this.readVersions.get(key); if (version && version.isEqual(SnapshotVersion.forDeletedDoc())) { // The document doesn't exist, so fail the transaction. throw new FirestoreError(Code.FAILED_PRECONDITION, "Can't update a document that doesn't exist."); } else if (version) { // Document exists, base precondition on document update time. return Precondition.updateTime(version); } else { // Document was not read, so we just use the preconditions for a blind // update. return Precondition.exists(true); } }; Transaction.prototype.set = function (key, data) { this.write(data.toMutations(key, this.precondition(key))); }; Transaction.prototype.update = function (key, data) { this.write(data.toMutations(key, this.preconditionForUpdate(key))); }; Transaction.prototype.delete = function (key) { this.write([new DeleteMutation(key, this.precondition(key))]); // Since the delete will be applied before all following writes, we need to // ensure that the precondition for the next write will be exists: false. this.readVersions = this.readVersions.insert(key, SnapshotVersion.forDeletedDoc()); }; Transaction.prototype.commit = function () { var _this = this; var unwritten = this.readVersions; // For each mutation, note that the doc was written. this.mutations.forEach(function (mutation) { unwritten = unwritten.remove(mutation.key); }); if (!unwritten.isEmpty()) { return Promise.reject(Error('Every document read in a transaction must also be written.')); } return this.datastore.commit(this.mutations).then(function () { _this.committed = true; }); }; return Transaction; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Describes the online state of the Firestore client. Note that this does not * indicate whether or not the remote store is trying to connect or not. This is * primarily used by the View / EventManager code to change their behavior while * offline (e.g. get() calls shouldn't wait for data from the server and * snapshot events should set metadata.isFromCache=true). */ var OnlineState; (function (OnlineState) { /** * The Firestore client is in an unknown online state. This means the client * is either not actively trying to establish a connection or it is currently * trying to establish a connection, but it has not succeeded or failed yet. * Higher-level components should not operate in offline mode. */ OnlineState[OnlineState["Unknown"] = 0] = "Unknown"; /** * The client is connected and the connections are healthy. This state is * reached after a successful connection and there has been at least one * successful message received from the backends. */ OnlineState[OnlineState["Online"] = 1] = "Online"; /** * The client is either trying to establish a connection but failing, or it * has been explicitly marked offline via a call to disableNetwork(). * Higher-level components should operate in offline mode. */ OnlineState[OnlineState["Offline"] = 2] = "Offline"; })(OnlineState || (OnlineState = {})); /** The source of an online state event. */ var OnlineStateSource; (function (OnlineStateSource) { OnlineStateSource[OnlineStateSource["RemoteStore"] = 0] = "RemoteStore"; OnlineStateSource[OnlineStateSource["SharedClientState"] = 1] = "SharedClientState"; })(OnlineStateSource || (OnlineStateSource = {})); /** * Copyright 2018 Google Inc. * * 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. */ var LOG_TAG$7 = 'OnlineStateTracker'; // To deal with transient failures, we allow multiple stream attempts before // giving up and transitioning from OnlineState.Unknown to Offline. // TODO(mikelehen): This used to be set to 2 as a mitigation for b/66228394. // @jdimond thinks that bug is sufficiently fixed so that we can set this back // to 1. If that works okay, we could potentially remove this logic entirely. var MAX_WATCH_STREAM_FAILURES = 1; // To deal with stream attempts that don't succeed or fail in a timely manner, // we have a timeout for OnlineState to reach Online or Offline. // If the timeout is reached, we transition to Offline rather than waiting // indefinitely. var ONLINE_STATE_TIMEOUT_MS = 10 * 1000; /** * A component used by the RemoteStore to track the OnlineState (that is, * whether or not the client as a whole should be considered to be online or * offline), implementing the appropriate heuristics. * * In particular, when the client is trying to connect to the backend, we * allow up to MAX_WATCH_STREAM_FAILURES within ONLINE_STATE_TIMEOUT_MS for * a connection to succeed. If we have too many failures or the timeout elapses, * then we set the OnlineState to Offline, and the client will behave as if * it is offline (get()s will return cached data, etc.). */ var OnlineStateTracker = /** @class */ (function () { function OnlineStateTracker(asyncQueue, onlineStateHandler) { this.asyncQueue = asyncQueue; this.onlineStateHandler = onlineStateHandler; /** The current OnlineState. */ this.state = OnlineState.Unknown; /** * A count of consecutive failures to open the stream. If it reaches the * maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to * Offline. */ this.watchStreamFailures = 0; /** * A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we * transition from OnlineState.Unknown to OnlineState.Offline without waiting * for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times). */ this.onlineStateTimer = null; /** * Whether the client should log a warning message if it fails to connect to * the backend (initially true, cleared after a successful stream, or if we've * logged the message already). */ this.shouldWarnClientIsOffline = true; } /** * Called by RemoteStore when a watch stream is started (including on each * backoff attempt). * * If this is the first attempt, it sets the OnlineState to Unknown and starts * the onlineStateTimer. */ OnlineStateTracker.prototype.handleWatchStreamStart = function () { var _this = this; if (this.watchStreamFailures === 0) { this.setAndBroadcast(OnlineState.Unknown); assert(this.onlineStateTimer === null, "onlineStateTimer shouldn't be started yet"); this.onlineStateTimer = this.asyncQueue.enqueueAfterDelay(TimerId.OnlineStateTimeout, ONLINE_STATE_TIMEOUT_MS, function () { _this.onlineStateTimer = null; assert(_this.state === OnlineState.Unknown, 'Timer should be canceled if we transitioned to a different state.'); _this.logClientOfflineWarningIfNecessary("Backend didn't respond within " + ONLINE_STATE_TIMEOUT_MS / 1000 + " " + "seconds."); _this.setAndBroadcast(OnlineState.Offline); // NOTE: handleWatchStreamFailure() will continue to increment // watchStreamFailures even though we are already marked Offline, // but this is non-harmful. return Promise.resolve(); }); } }; /** * Updates our OnlineState as appropriate after the watch stream reports a * failure. The first failure moves us to the 'Unknown' state. We then may * allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we * actually transition to the 'Offline' state. */ OnlineStateTracker.prototype.handleWatchStreamFailure = function (error$$1) { if (this.state === OnlineState.Online) { this.setAndBroadcast(OnlineState.Unknown); // To get to OnlineState.Online, set() must have been called which would // have reset our heuristics. assert(this.watchStreamFailures === 0, 'watchStreamFailures must be 0'); assert(this.onlineStateTimer === null, 'onlineStateTimer must be null'); } else { this.watchStreamFailures++; if (this.watchStreamFailures >= MAX_WATCH_STREAM_FAILURES) { this.clearOnlineStateTimer(); this.logClientOfflineWarningIfNecessary("Connection failed " + MAX_WATCH_STREAM_FAILURES + " " + ("times. Most recent error: " + error$$1.toString())); this.setAndBroadcast(OnlineState.Offline); } } }; /** * Explicitly sets the OnlineState to the specified state. * * Note that this resets our timers / failure counters, etc. used by our * Offline heuristics, so must not be used in place of * handleWatchStreamStart() and handleWatchStreamFailure(). */ OnlineStateTracker.prototype.set = function (newState) { this.clearOnlineStateTimer(); this.watchStreamFailures = 0; if (newState === OnlineState.Online) { // We've connected to watch at least once. Don't warn the developer // about being offline going forward. this.shouldWarnClientIsOffline = false; } this.setAndBroadcast(newState); }; OnlineStateTracker.prototype.setAndBroadcast = function (newState) { if (newState !== this.state) { this.state = newState; this.onlineStateHandler(newState); } }; OnlineStateTracker.prototype.logClientOfflineWarningIfNecessary = function (details) { var message = "Could not reach Cloud Firestore backend. " + details + "\n" + "This typically indicates that your device does not have a healthy " + "Internet connection at the moment. The client will operate in offline " + "mode until it is able to successfully connect to the backend."; if (this.shouldWarnClientIsOffline) { error(message); this.shouldWarnClientIsOffline = false; } else { debug(LOG_TAG$7, message); } }; OnlineStateTracker.prototype.clearOnlineStateTimer = function () { if (this.onlineStateTimer !== null) { this.onlineStateTimer.cancel(); this.onlineStateTimer = null; } }; return OnlineStateTracker; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG$8 = 'RemoteStore'; // TODO(b/35853402): Negotiate this with the stream. var MAX_PENDING_WRITES = 10; /** * RemoteStore - An interface to remotely stored data, basically providing a * wrapper around the Datastore that is more reliable for the rest of the * system. * * RemoteStore is responsible for maintaining the connection to the server. * - maintaining a list of active listens. * - reconnecting when the connection is dropped. * - resuming all the active listens on reconnect. * * RemoteStore handles all incoming events from the Datastore. * - listening to the watch stream and repackaging the events as RemoteEvents * - notifying SyncEngine of any changes to the active listens. * * RemoteStore takes writes from other components and handles them reliably. * - pulling pending mutations from LocalStore and sending them to Datastore. * - retrying mutations that failed because of network problems. * - acking mutations to the SyncEngine once they are accepted or rejected. */ var RemoteStore = /** @class */ (function () { function RemoteStore( /** * The local store, used to fill the write pipeline with outbound mutations. */ localStore, /** The client-side proxy for interacting with the backend. */ datastore, asyncQueue, onlineStateHandler) { this.localStore = localStore; this.datastore = datastore; /** * A list of up to MAX_PENDING_WRITES writes that we have fetched from the * LocalStore via fillWritePipeline() and have or will send to the write * stream. * * Whenever writePipeline.length > 0 the RemoteStore will attempt to start or * restart the write stream. When the stream is established the writes in the * pipeline will be sent in order. * * Writes remain in writePipeline until they are acknowledged by the backend * and thus will automatically be re-sent if the stream is interrupted / * restarted before they're acknowledged. * * Write responses from the backend are linked to their originating request * purely based on order, and so we can just shift() writes from the front of * the writePipeline as we receive responses. */ this.writePipeline = []; /** * A mapping of watched targets that the client cares about tracking and the * user has explicitly called a 'listen' for this target. * * These targets may or may not have been sent to or acknowledged by the * server. On re-establishing the listen stream, these targets should be sent * to the server. The targets removed with unlistens are removed eagerly * without waiting for confirmation from the listen stream. */ this.listenTargets = {}; this.watchChangeAggregator = null; /** * Set to true by enableNetwork() and false by disableNetwork() and indicates * the user-preferred network state. */ this.networkEnabled = false; this.isPrimary = false; this.onlineStateTracker = new OnlineStateTracker(asyncQueue, onlineStateHandler); // Create streams (but note they're not started yet). this.watchStream = this.datastore.newPersistentWatchStream({ onOpen: this.onWatchStreamOpen.bind(this), onClose: this.onWatchStreamClose.bind(this), onWatchChange: this.onWatchStreamChange.bind(this) }); this.writeStream = this.datastore.newPersistentWriteStream({ onOpen: this.onWriteStreamOpen.bind(this), onClose: this.onWriteStreamClose.bind(this), onHandshakeComplete: this.onWriteHandshakeComplete.bind(this), onMutationResult: this.onMutationResult.bind(this) }); } /** * Starts up the remote store, creating streams, restoring state from * LocalStore, etc. */ RemoteStore.prototype.start = function () { return this.enableNetwork(); }; /** Re-enables the network. Idempotent. */ RemoteStore.prototype.enableNetwork = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var _a; return tslib_1.__generator(this, function (_b) { switch (_b.label) { case 0: this.networkEnabled = true; if (!this.canUseNetwork()) return [3 /*break*/, 3]; _a = this.writeStream; return [4 /*yield*/, this.localStore.getLastStreamToken()]; case 1: _a.lastStreamToken = _b.sent(); if (this.shouldStartWatchStream()) { this.startWatchStream(); } else { this.onlineStateTracker.set(OnlineState.Unknown); } // This will start the write stream if necessary. return [4 /*yield*/, this.fillWritePipeline()]; case 2: // This will start the write stream if necessary. _b.sent(); _b.label = 3; case 3: return [2 /*return*/]; } }); }); }; /** * Temporarily disables the network. The network can be re-enabled using * enableNetwork(). */ RemoteStore.prototype.disableNetwork = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: this.networkEnabled = false; return [4 /*yield*/, this.disableNetworkInternal()]; case 1: _a.sent(); // Set the OnlineState to Offline so get()s return from cache, etc. this.onlineStateTracker.set(OnlineState.Offline); return [2 /*return*/]; } }); }); }; RemoteStore.prototype.disableNetworkInternal = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.writeStream.stop()]; case 1: _a.sent(); return [4 /*yield*/, this.watchStream.stop()]; case 2: _a.sent(); if (this.writePipeline.length > 0) { debug(LOG_TAG$8, "Stopping write stream with " + this.writePipeline.length + " pending writes"); this.writePipeline = []; } this.cleanUpWatchStreamState(); return [2 /*return*/]; } }); }); }; RemoteStore.prototype.shutdown = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: debug(LOG_TAG$8, 'RemoteStore shutting down.'); this.networkEnabled = false; return [4 /*yield*/, this.disableNetworkInternal()]; case 1: _a.sent(); // Set the OnlineState to Unknown (rather than Offline) to avoid potentially // triggering spurious listener events with cached data, etc. this.onlineStateTracker.set(OnlineState.Unknown); return [2 /*return*/]; } }); }); }; /** Starts new listen for the given query. Uses resume token if provided */ RemoteStore.prototype.listen = function (queryData) { assert(!contains(this.listenTargets, queryData.targetId), 'listen called with duplicate targetId!'); // Mark this as something the client is currently listening for. this.listenTargets[queryData.targetId] = queryData; if (this.shouldStartWatchStream()) { // The listen will be sent in onWatchStreamOpen this.startWatchStream(); } else if (this.watchStream.isOpen()) { this.sendWatchRequest(queryData); } }; /** Removes the listen from server */ RemoteStore.prototype.unlisten = function (targetId) { assert(contains(this.listenTargets, targetId), 'unlisten called without assigned target ID!'); delete this.listenTargets[targetId]; if (this.watchStream.isOpen()) { this.sendUnwatchRequest(targetId); } if (isEmpty(this.listenTargets)) { if (this.watchStream.isOpen()) { this.watchStream.markIdle(); } else if (this.canUseNetwork()) { // Revert to OnlineState.Unknown if the watch stream is not open and we // have no listeners, since without any listens to send we cannot // confirm if the stream is healthy and upgrade to OnlineState.Online. this.onlineStateTracker.set(OnlineState.Unknown); } } }; /** {@link TargetMetadataProvider.getQueryDataForTarget} */ RemoteStore.prototype.getQueryDataForTarget = function (targetId) { return this.listenTargets[targetId] || null; }; /** {@link TargetMetadataProvider.getRemoteKeysForTarget} */ RemoteStore.prototype.getRemoteKeysForTarget = function (targetId) { return this.syncEngine.getRemoteKeysForTarget(targetId); }; /** * We need to increment the the expected number of pending responses we're due * from watch so we wait for the ack to process any messages from this target. */ RemoteStore.prototype.sendWatchRequest = function (queryData) { this.watchChangeAggregator.recordPendingTargetRequest(queryData.targetId); this.watchStream.watch(queryData); }; /** * We need to increment the expected number of pending responses we're due * from watch so we wait for the removal on the server before we process any * messages from this target. */ RemoteStore.prototype.sendUnwatchRequest = function (targetId) { this.watchChangeAggregator.recordPendingTargetRequest(targetId); this.watchStream.unwatch(targetId); }; RemoteStore.prototype.startWatchStream = function () { assert(this.shouldStartWatchStream(), 'startWatchStream() called when shouldStartWatchStream() is false.'); this.watchChangeAggregator = new WatchChangeAggregator(this); this.watchStream.start(); this.onlineStateTracker.handleWatchStreamStart(); }; /** * Returns whether the watch stream should be started because it's necessary * and has not yet been started. */ RemoteStore.prototype.shouldStartWatchStream = function () { return (this.canUseNetwork() && !this.watchStream.isStarted() && !isEmpty(this.listenTargets)); }; RemoteStore.prototype.canUseNetwork = function () { return this.isPrimary && this.networkEnabled; }; RemoteStore.prototype.cleanUpWatchStreamState = function () { this.watchChangeAggregator = null; }; RemoteStore.prototype.onWatchStreamOpen = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; return tslib_1.__generator(this, function (_a) { forEachNumber(this.listenTargets, function (targetId, queryData) { _this.sendWatchRequest(queryData); }); return [2 /*return*/]; }); }); }; RemoteStore.prototype.onWatchStreamClose = function (error$$1) { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { if (error$$1 === undefined) { // Graceful stop (due to stop() or idle timeout). Make sure that's // desirable. assert(!this.shouldStartWatchStream(), 'Watch stream was stopped gracefully while still needed.'); } this.cleanUpWatchStreamState(); // If we still need the watch stream, retry the connection. if (this.shouldStartWatchStream()) { this.onlineStateTracker.handleWatchStreamFailure(error$$1); this.startWatchStream(); } else { // No need to restart watch stream because there are no active targets. // The online state is set to unknown because there is no active attempt // at establishing a connection this.onlineStateTracker.set(OnlineState.Unknown); } return [2 /*return*/]; }); }); }; RemoteStore.prototype.onWatchStreamChange = function (watchChange, snapshotVersion) { return tslib_1.__awaiter(this, void 0, void 0, function () { var lastRemoteSnapshotVersion; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: // Mark the client as online since we got a message from the server this.onlineStateTracker.set(OnlineState.Online); if (watchChange instanceof WatchTargetChange && watchChange.state === WatchTargetChangeState.Removed && watchChange.cause) { // There was an error on a target, don't wait for a consistent snapshot // to raise events return [2 /*return*/, this.handleTargetError(watchChange)]; } if (watchChange instanceof DocumentWatchChange) { this.watchChangeAggregator.handleDocumentChange(watchChange); } else if (watchChange instanceof ExistenceFilterChange) { this.watchChangeAggregator.handleExistenceFilter(watchChange); } else { assert(watchChange instanceof WatchTargetChange, 'Expected watchChange to be an instance of WatchTargetChange'); this.watchChangeAggregator.handleTargetChange(watchChange); } if (!!snapshotVersion.isEqual(SnapshotVersion.MIN)) return [3 /*break*/, 3]; return [4 /*yield*/, this.localStore.getLastRemoteSnapshotVersion()]; case 1: lastRemoteSnapshotVersion = _a.sent(); if (!(snapshotVersion.compareTo(lastRemoteSnapshotVersion) >= 0)) return [3 /*break*/, 3]; // We have received a target change with a global snapshot if the snapshot // version is not equal to SnapshotVersion.MIN. return [4 /*yield*/, this.raiseWatchSnapshot(snapshotVersion)]; case 2: // We have received a target change with a global snapshot if the snapshot // version is not equal to SnapshotVersion.MIN. _a.sent(); _a.label = 3; case 3: return [2 /*return*/]; } }); }); }; /** * Takes a batch of changes from the Datastore, repackages them as a * RemoteEvent, and passes that on to the listener, which is typically the * SyncEngine. */ RemoteStore.prototype.raiseWatchSnapshot = function (snapshotVersion) { var _this = this; assert(!snapshotVersion.isEqual(SnapshotVersion.MIN), "Can't raise event for unknown SnapshotVersion"); var remoteEvent = this.watchChangeAggregator.createRemoteEvent(snapshotVersion); // Update in-memory resume tokens. LocalStore will update the // persistent view of these when applying the completed RemoteEvent. forEachNumber(remoteEvent.targetChanges, function (targetId, change) { if (change.resumeToken.length > 0) { var queryData = _this.listenTargets[targetId]; // A watched target might have been removed already. if (queryData) { _this.listenTargets[targetId] = queryData.copy({ resumeToken: change.resumeToken, snapshotVersion: snapshotVersion }); } } }); // Re-establish listens for the targets that have been invalidated by // existence filter mismatches. remoteEvent.targetMismatches.forEach(function (targetId) { var queryData = _this.listenTargets[targetId]; if (!queryData) { // A watched target might have been removed already. return; } // Clear the resume token for the query, since we're in a known mismatch // state. _this.listenTargets[targetId] = queryData.copy({ resumeToken: emptyByteString() }); // Cause a hard reset by unwatching and rewatching immediately, but // deliberately don't send a resume token so that we get a full update. _this.sendUnwatchRequest(targetId); // Mark the query we send as being on behalf of an existence filter // mismatch, but don't actually retain that in listenTargets. This ensures // that we flag the first re-listen this way without impacting future // listens of this target (that might happen e.g. on reconnect). var requestQueryData = new QueryData(queryData.query, targetId, QueryPurpose.ExistenceFilterMismatch, queryData.sequenceNumber); _this.sendWatchRequest(requestQueryData); }); // Finally raise remote event return this.syncEngine.applyRemoteEvent(remoteEvent); }; /** Handles an error on a target */ RemoteStore.prototype.handleTargetError = function (watchChange) { var _this = this; assert(!!watchChange.cause, 'Handling target error without a cause'); var error$$1 = watchChange.cause; var promiseChain = Promise.resolve(); watchChange.targetIds.forEach(function (targetId) { promiseChain = promiseChain.then(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { // A watched target might have been removed already. if (contains(this.listenTargets, targetId)) { delete this.listenTargets[targetId]; this.watchChangeAggregator.removeTarget(targetId); return [2 /*return*/, this.syncEngine.rejectListen(targetId, error$$1)]; } return [2 /*return*/]; }); }); }); }); return promiseChain; }; /** * Attempts to fill our write pipeline with writes from the LocalStore. * * Called internally to bootstrap or refill the write pipeline and by * SyncEngine whenever there are new mutations to process. * * Starts the write stream if necessary. */ RemoteStore.prototype.fillWritePipeline = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var lastBatchIdRetrieved, batch; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: if (!this.canAddToWritePipeline()) return [3 /*break*/, 4]; lastBatchIdRetrieved = this.writePipeline.length > 0 ? this.writePipeline[this.writePipeline.length - 1].batchId : BATCHID_UNKNOWN; return [4 /*yield*/, this.localStore.nextMutationBatch(lastBatchIdRetrieved)]; case 1: batch = _a.sent(); if (!(batch === null)) return [3 /*break*/, 2]; if (this.writePipeline.length === 0) { this.writeStream.markIdle(); } return [3 /*break*/, 4]; case 2: this.addToWritePipeline(batch); return [4 /*yield*/, this.fillWritePipeline()]; case 3: _a.sent(); _a.label = 4; case 4: if (this.shouldStartWriteStream()) { this.startWriteStream(); } return [2 /*return*/]; } }); }); }; /** * Returns true if we can add to the write pipeline (i.e. the network is * enabled and the write pipeline is not full). */ RemoteStore.prototype.canAddToWritePipeline = function () { return (this.canUseNetwork() && this.writePipeline.length < MAX_PENDING_WRITES); }; // For testing RemoteStore.prototype.outstandingWrites = function () { return this.writePipeline.length; }; /** * Queues additional writes to be sent to the write stream, sending them * immediately if the write stream is established. */ RemoteStore.prototype.addToWritePipeline = function (batch) { assert(this.canAddToWritePipeline(), 'addToWritePipeline called when pipeline is full'); this.writePipeline.push(batch); if (this.writeStream.isOpen() && this.writeStream.handshakeComplete) { this.writeStream.writeMutations(batch.mutations); } }; RemoteStore.prototype.shouldStartWriteStream = function () { return (this.canUseNetwork() && !this.writeStream.isStarted() && this.writePipeline.length > 0); }; RemoteStore.prototype.startWriteStream = function () { assert(this.shouldStartWriteStream(), 'startWriteStream() called when shouldStartWriteStream() is false.'); this.writeStream.start(); }; RemoteStore.prototype.onWriteStreamOpen = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { this.writeStream.writeHandshake(); return [2 /*return*/]; }); }); }; RemoteStore.prototype.onWriteHandshakeComplete = function () { var _this = this; // Record the stream token. return this.localStore .setLastStreamToken(this.writeStream.lastStreamToken) .then(function () { // Send the write pipeline now that the stream is established. for (var _i = 0, _a = _this.writePipeline; _i < _a.length; _i++) { var batch = _a[_i]; _this.writeStream.writeMutations(batch.mutations); } }) .catch(function (err) { return _this.ignoreIfPrimaryLeaseLoss(err); }); }; /** * Verifies the error thrown by an LocalStore operation. If a LocalStore * operation fails because the primary lease has been taken by another client, * we ignore the error. All other errors are re-thrown. * * @param err An error returned by a LocalStore operation. * @return A Promise that resolves after we recovered, or the original error. */ RemoteStore.prototype.ignoreIfPrimaryLeaseLoss = function (err) { if (isPrimaryLeaseLostError(err)) { debug(LOG_TAG$8, 'Unexpectedly lost primary lease'); } else { throw err; } }; RemoteStore.prototype.onMutationResult = function (commitVersion, results) { var _this = this; // This is a response to a write containing mutations and should be // correlated to the first write in our write pipeline. assert(this.writePipeline.length > 0, 'Got result for empty write pipeline'); var batch = this.writePipeline.shift(); var success = MutationBatchResult.from(batch, commitVersion, results, this.writeStream.lastStreamToken); return this.syncEngine.applySuccessfulWrite(success).then(function () { // It's possible that with the completion of this mutation another // slot has freed up. return _this.fillWritePipeline(); }); }; RemoteStore.prototype.onWriteStreamClose = function (error$$1) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var errorHandling; return tslib_1.__generator(this, function (_a) { if (error$$1 === undefined) { // Graceful stop (due to stop() or idle timeout). Make sure that's // desirable. assert(!this.shouldStartWriteStream(), 'Write stream was stopped gracefully while still needed.'); } // If the write stream closed due to an error, invoke the error callbacks if // there are pending writes. if (error$$1 && this.writePipeline.length > 0) { errorHandling = void 0; if (this.writeStream.handshakeComplete) { // This error affects the actual write. errorHandling = this.handleWriteError(error$$1); } else { // If there was an error before the handshake has finished, it's // possible that the server is unable to process the stream token // we're sending. (Perhaps it's too old?) errorHandling = this.handleHandshakeError(error$$1); } return [2 /*return*/, errorHandling.then(function () { // The write stream might have been started by refilling the write // pipeline for failed writes if (_this.shouldStartWriteStream()) { _this.startWriteStream(); } })]; } return [2 /*return*/]; }); }); }; RemoteStore.prototype.handleHandshakeError = function (error$$1) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; return tslib_1.__generator(this, function (_a) { // Reset the token if it's a permanent error or the error code is // ABORTED, signaling the write stream is no longer valid. if (isPermanentError(error$$1.code) || error$$1.code === Code.ABORTED) { debug(LOG_TAG$8, 'RemoteStore error before completed handshake; resetting stream token: ', this.writeStream.lastStreamToken); this.writeStream.lastStreamToken = emptyByteString(); return [2 /*return*/, this.localStore .setLastStreamToken(emptyByteString()) .catch(function (err) { return _this.ignoreIfPrimaryLeaseLoss(err); })]; } else { // Some other error, don't reset stream token. Our stream logic will // just retry with exponential backoff. } return [2 /*return*/]; }); }); }; RemoteStore.prototype.handleWriteError = function (error$$1) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var batch; return tslib_1.__generator(this, function (_a) { if (isPermanentError(error$$1.code)) { batch = this.writePipeline.shift(); // In this case it's also unlikely that the server itself is melting // down -- this was just a bad request so inhibit backoff on the next // restart. this.writeStream.inhibitBackoff(); return [2 /*return*/, this.syncEngine .rejectFailedWrite(batch.batchId, error$$1) .then(function () { // It's possible that with the completion of this mutation // another slot has freed up. return _this.fillWritePipeline(); })]; } else { // Transient error, just let the retry logic kick in. } return [2 /*return*/]; }); }); }; RemoteStore.prototype.createTransaction = function () { return new Transaction(this.datastore); }; RemoteStore.prototype.handleCredentialChange = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: if (!this.canUseNetwork()) return [3 /*break*/, 3]; // Tear down and re-create our network streams. This will ensure we get a fresh auth token // for the new user and re-fill the write pipeline with new mutations from the LocalStore // (since mutations are per-user). debug(LOG_TAG$8, 'RemoteStore restarting streams for new credential'); this.networkEnabled = false; return [4 /*yield*/, this.disableNetworkInternal()]; case 1: _a.sent(); this.onlineStateTracker.set(OnlineState.Unknown); return [4 /*yield*/, this.enableNetwork()]; case 2: _a.sent(); _a.label = 3; case 3: return [2 /*return*/]; } }); }); }; /** * Toggles the network state when the client gains or loses its primary lease. */ RemoteStore.prototype.applyPrimaryState = function (isPrimary) { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: this.isPrimary = isPrimary; if (!(isPrimary && this.networkEnabled)) return [3 /*break*/, 2]; return [4 /*yield*/, this.enableNetwork()]; case 1: _a.sent(); return [3 /*break*/, 4]; case 2: if (!!isPrimary) return [3 /*break*/, 4]; return [4 /*yield*/, this.disableNetworkInternal()]; case 3: _a.sent(); this.onlineStateTracker.set(OnlineState.Unknown); _a.label = 4; case 4: return [2 /*return*/]; } }); }); }; return RemoteStore; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Holds the listeners and the last received ViewSnapshot for a query being * tracked by EventManager. */ var QueryListenersInfo = /** @class */ (function () { function QueryListenersInfo() { this.listeners = []; } return QueryListenersInfo; }()); /** * EventManager is responsible for mapping queries to query event emitters. * It handles "fan-out". -- Identical queries will re-use the same watch on the * backend. */ var EventManager = /** @class */ (function () { function EventManager(syncEngine) { this.syncEngine = syncEngine; this.queries = new ObjectMap(function (q) { return q.canonicalId(); }); this.onlineState = OnlineState.Unknown; this.syncEngine.subscribe(this); } EventManager.prototype.listen = function (listener) { var query = listener.query; var firstListen = false; var queryInfo = this.queries.get(query); if (!queryInfo) { firstListen = true; queryInfo = new QueryListenersInfo(); this.queries.set(query, queryInfo); } queryInfo.listeners.push(listener); listener.applyOnlineStateChange(this.onlineState); if (queryInfo.viewSnap) listener.onViewSnapshot(queryInfo.viewSnap); if (firstListen) { return this.syncEngine.listen(query).then(function (targetId) { queryInfo.targetId = targetId; return targetId; }); } else { return Promise.resolve(queryInfo.targetId); } }; EventManager.prototype.unlisten = function (listener) { return tslib_1.__awaiter(this, void 0, void 0, function () { var query, lastListen, queryInfo, i; return tslib_1.__generator(this, function (_a) { query = listener.query; lastListen = false; queryInfo = this.queries.get(query); if (queryInfo) { i = queryInfo.listeners.indexOf(listener); if (i >= 0) { queryInfo.listeners.splice(i, 1); lastListen = queryInfo.listeners.length === 0; } } if (lastListen) { this.queries.delete(query); return [2 /*return*/, this.syncEngine.unlisten(query)]; } return [2 /*return*/]; }); }); }; EventManager.prototype.onWatchChange = function (viewSnaps) { for (var _i = 0, viewSnaps_1 = viewSnaps; _i < viewSnaps_1.length; _i++) { var viewSnap = viewSnaps_1[_i]; var query = viewSnap.query; var queryInfo = this.queries.get(query); if (queryInfo) { for (var _a = 0, _b = queryInfo.listeners; _a < _b.length; _a++) { var listener = _b[_a]; listener.onViewSnapshot(viewSnap); } queryInfo.viewSnap = viewSnap; } } }; EventManager.prototype.onWatchError = function (query, error) { var queryInfo = this.queries.get(query); if (queryInfo) { for (var _i = 0, _a = queryInfo.listeners; _i < _a.length; _i++) { var listener = _a[_i]; listener.onError(error); } } // Remove all listeners. NOTE: We don't need to call syncEngine.unlisten() // after an error. this.queries.delete(query); }; EventManager.prototype.onOnlineStateChange = function (onlineState) { this.onlineState = onlineState; this.queries.forEach(function (_, queryInfo) { for (var _i = 0, _a = queryInfo.listeners; _i < _a.length; _i++) { var listener = _a[_i]; listener.applyOnlineStateChange(onlineState); } }); }; return EventManager; }()); /** * QueryListener takes a series of internal view snapshots and determines * when to raise the event. * * It uses an Observer to dispatch events. */ var QueryListener = /** @class */ (function () { function QueryListener(query, queryObserver, options) { this.query = query; this.queryObserver = queryObserver; /** * Initial snapshots (e.g. from cache) may not be propagated to the wrapped * observer. This flag is set to true once we've actually raised an event. */ this.raisedInitialEvent = false; this.onlineState = OnlineState.Unknown; this.options = options || {}; } QueryListener.prototype.onViewSnapshot = function (snap) { assert(snap.docChanges.length > 0 || snap.syncStateChanged, 'We got a new snapshot with no changes?'); if (!this.options.includeMetadataChanges) { // Remove the metadata only changes. var docChanges = []; for (var _i = 0, _a = snap.docChanges; _i < _a.length; _i++) { var docChange = _a[_i]; if (docChange.type !== ChangeType.Metadata) { docChanges.push(docChange); } } snap = new ViewSnapshot(snap.query, snap.docs, snap.oldDocs, docChanges, snap.mutatedKeys, snap.fromCache, snap.syncStateChanged, /* excludesMetadataChanges= */ true); } if (!this.raisedInitialEvent) { if (this.shouldRaiseInitialEvent(snap, this.onlineState)) { this.raiseInitialEvent(snap); } } else if (this.shouldRaiseEvent(snap)) { this.queryObserver.next(snap); } this.snap = snap; }; QueryListener.prototype.onError = function (error) { this.queryObserver.error(error); }; QueryListener.prototype.applyOnlineStateChange = function (onlineState) { this.onlineState = onlineState; if (this.snap && !this.raisedInitialEvent && this.shouldRaiseInitialEvent(this.snap, onlineState)) { this.raiseInitialEvent(this.snap); } }; QueryListener.prototype.shouldRaiseInitialEvent = function (snap, onlineState) { assert(!this.raisedInitialEvent, 'Determining whether to raise first event but already had first event'); // Always raise the first event when we're synced if (!snap.fromCache) { return true; } // NOTE: We consider OnlineState.Unknown as online (it should become Offline // or Online if we wait long enough). var maybeOnline = onlineState !== OnlineState.Offline; // Don't raise the event if we're online, aren't synced yet (checked // above) and are waiting for a sync. if (this.options.waitForSyncWhenOnline && maybeOnline) { assert(snap.fromCache, 'Waiting for sync, but snapshot is not from cache'); return false; } // Raise data from cache if we have any documents or we are offline return !snap.docs.isEmpty() || onlineState === OnlineState.Offline; }; QueryListener.prototype.shouldRaiseEvent = function (snap) { // We don't need to handle includeDocumentMetadataChanges here because // the Metadata only changes have already been stripped out if needed. // At this point the only changes we will see are the ones we should // propagate. if (snap.docChanges.length > 0) { return true; } var hasPendingWritesChanged = this.snap && this.snap.hasPendingWrites !== snap.hasPendingWrites; if (snap.syncStateChanged || hasPendingWritesChanged) { return this.options.includeMetadataChanges === true; } // Generally we should have hit one of the cases above, but it's possible // to get here if there were only metadata docChanges and they got // stripped out. return false; }; QueryListener.prototype.raiseInitialEvent = function (snap) { assert(!this.raisedInitialEvent, 'Trying to raise initial events for second time'); snap = ViewSnapshot.fromInitialDocuments(snap.query, snap.docs, snap.mutatedKeys, snap.fromCache); this.raisedInitialEvent = true; this.queryObserver.next(snap); }; return QueryListener; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * A set of changes to what documents are currently in view and out of view for * a given query. These changes are sent to the LocalStore by the View (via * the SyncEngine) and are used to pin / unpin documents as appropriate. */ var LocalViewChanges = /** @class */ (function () { function LocalViewChanges(targetId, addedKeys, removedKeys) { this.targetId = targetId; this.addedKeys = addedKeys; this.removedKeys = removedKeys; } LocalViewChanges.fromSnapshot = function (targetId, viewSnapshot) { var addedKeys = documentKeySet(); var removedKeys = documentKeySet(); for (var _i = 0, _a = viewSnapshot.docChanges; _i < _a.length; _i++) { var docChange = _a[_i]; switch (docChange.type) { case ChangeType.Added: addedKeys = addedKeys.add(docChange.doc.key); break; case ChangeType.Removed: removedKeys = removedKeys.add(docChange.doc.key); break; default: // do nothing } } return new LocalViewChanges(targetId, addedKeys, removedKeys); }; return LocalViewChanges; }()); /** * Copyright 2017 Google Inc. * * 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. */ var AddedLimboDocument = /** @class */ (function () { function AddedLimboDocument(key) { this.key = key; } return AddedLimboDocument; }()); var RemovedLimboDocument = /** @class */ (function () { function RemovedLimboDocument(key) { this.key = key; } return RemovedLimboDocument; }()); /** * View is responsible for computing the final merged truth of what docs are in * a query. It gets notified of local and remote changes to docs, and applies * the query filters and limits to determine the most correct possible results. */ var View = /** @class */ (function () { function View(query, /** Documents included in the remote target */ _syncedDocuments) { this.query = query; this._syncedDocuments = _syncedDocuments; this.syncState = null; /** * A flag whether the view is current with the backend. A view is considered * current after it has seen the current flag from the backend and did not * lose consistency within the watch stream (e.g. because of an existence * filter mismatch). */ this.current = false; /** Documents in the view but not in the remote target */ this.limboDocuments = documentKeySet(); /** Document Keys that have local changes */ this.mutatedKeys = documentKeySet(); this.documentSet = new DocumentSet(query.docComparator.bind(query)); } Object.defineProperty(View.prototype, "syncedDocuments", { /** * The set of remote documents that the server has told us belongs to the target associated with * this view. */ get: function () { return this._syncedDocuments; }, enumerable: true, configurable: true }); /** * Iterates over a set of doc changes, applies the query limit, and computes * what the new results should be, what the changes were, and whether we may * need to go back to the local cache for more results. Does not make any * changes to the view. * @param docChanges The doc changes to apply to this view. * @param previousChanges If this is being called with a refill, then start * with this set of docs and changes instead of the current view. * @return a new set of docs, changes, and refill flag. */ View.prototype.computeDocChanges = function (docChanges, previousChanges) { var _this = this; var changeSet = previousChanges ? previousChanges.changeSet : new DocumentChangeSet(); var oldDocumentSet = previousChanges ? previousChanges.documentSet : this.documentSet; var newMutatedKeys = previousChanges ? previousChanges.mutatedKeys : this.mutatedKeys; var newDocumentSet = oldDocumentSet; var needsRefill = false; // Track the last doc in a (full) limit. This is necessary, because some // update (a delete, or an update moving a doc past the old limit) might // mean there is some other document in the local cache that either should // come (1) between the old last limit doc and the new last document, in the // case of updates, or (2) after the new last document, in the case of // deletes. So we keep this doc at the old limit to compare the updates to. // // Note that this should never get used in a refill (when previousChanges is // set), because there will only be adds -- no deletes or updates. var lastDocInLimit = this.query.hasLimit() && oldDocumentSet.size === this.query.limit ? oldDocumentSet.last() : null; docChanges.inorderTraversal(function (key, newMaybeDoc) { var oldDoc = oldDocumentSet.get(key); var newDoc = newMaybeDoc instanceof Document ? newMaybeDoc : null; if (newDoc) { assert(key.isEqual(newDoc.key), 'Mismatching keys found in document changes: ' + key + ' != ' + newDoc.key); newDoc = _this.query.matches(newDoc) ? newDoc : null; } var oldDocHadPendingMutations = oldDoc ? _this.mutatedKeys.has(oldDoc.key) : false; var newDocHasPendingMutations = newDoc ? newDoc.hasLocalMutations || // We only consider committed mutations for documents that were // mutated during the lifetime of the view. (_this.mutatedKeys.has(newDoc.key) && newDoc.hasCommittedMutations) : false; var changeApplied = false; // Calculate change if (oldDoc && newDoc) { var docsEqual = oldDoc.data.isEqual(newDoc.data); if (!docsEqual) { if (!_this.shouldWaitForSyncedDocument(oldDoc, newDoc)) { changeSet.track({ type: ChangeType.Modified, doc: newDoc }); changeApplied = true; if (lastDocInLimit && _this.query.docComparator(newDoc, lastDocInLimit) > 0) { // This doc moved from inside the limit to after the limit. // That means there may be some doc in the local cache that's // actually less than this one. needsRefill = true; } } } else if (oldDocHadPendingMutations !== newDocHasPendingMutations) { changeSet.track({ type: ChangeType.Metadata, doc: newDoc }); changeApplied = true; } } else if (!oldDoc && newDoc) { changeSet.track({ type: ChangeType.Added, doc: newDoc }); changeApplied = true; } else if (oldDoc && !newDoc) { changeSet.track({ type: ChangeType.Removed, doc: oldDoc }); changeApplied = true; if (lastDocInLimit) { // A doc was removed from a full limit query. We'll need to // requery from the local cache to see if we know about some other // doc that should be in the results. needsRefill = true; } } if (changeApplied) { if (newDoc) { newDocumentSet = newDocumentSet.add(newDoc); if (newDocHasPendingMutations) { newMutatedKeys = newMutatedKeys.add(key); } else { newMutatedKeys = newMutatedKeys.delete(key); } } else { newDocumentSet = newDocumentSet.delete(key); newMutatedKeys = newMutatedKeys.delete(key); } } }); if (this.query.hasLimit()) { while (newDocumentSet.size > this.query.limit) { var oldDoc = newDocumentSet.last(); newDocumentSet = newDocumentSet.delete(oldDoc.key); newMutatedKeys = newMutatedKeys.delete(oldDoc.key); changeSet.track({ type: ChangeType.Removed, doc: oldDoc }); } } assert(!needsRefill || !previousChanges, 'View was refilled using docs that themselves needed refilling.'); return { documentSet: newDocumentSet, changeSet: changeSet, needsRefill: needsRefill, mutatedKeys: newMutatedKeys }; }; View.prototype.shouldWaitForSyncedDocument = function (oldDoc, newDoc) { // We suppress the initial change event for documents that were modified as // part of a write acknowledgment (e.g. when the value of a server transform // is applied) as Watch will send us the same document again. // By suppressing the event, we only raise two user visible events (one with // `hasPendingWrites` and the final state of the document) instead of three // (one with `hasPendingWrites`, the modified document with // `hasPendingWrites` and the final state of the document). return (oldDoc.hasLocalMutations && newDoc.hasCommittedMutations && !newDoc.hasLocalMutations); }; /** * Updates the view with the given ViewDocumentChanges and optionally updates * limbo docs and sync state from the provided target change. * @param docChanges The set of changes to make to the view's docs. * @param updateLimboDocuments Whether to update limbo documents based on this * change. * @param targetChange A target change to apply for computing limbo docs and * sync state. * @return A new ViewChange with the given docs, changes, and sync state. */ // PORTING NOTE: The iOS/Android clients always compute limbo document changes. View.prototype.applyChanges = function (docChanges, updateLimboDocuments, targetChange) { var _this = this; assert(!docChanges.needsRefill, 'Cannot apply changes that need a refill'); var oldDocs = this.documentSet; this.documentSet = docChanges.documentSet; this.mutatedKeys = docChanges.mutatedKeys; // Sort changes based on type and query comparator var changes = docChanges.changeSet.getChanges(); changes.sort(function (c1, c2) { return (compareChangeType(c1.type, c2.type) || _this.query.docComparator(c1.doc, c2.doc)); }); this.applyTargetChange(targetChange); var limboChanges = updateLimboDocuments ? this.updateLimboDocuments() : []; var synced = this.limboDocuments.size === 0 && this.current; var newSyncState = synced ? SyncState.Synced : SyncState.Local; var syncStateChanged = newSyncState !== this.syncState; this.syncState = newSyncState; if (changes.length === 0 && !syncStateChanged) { // no changes return { limboChanges: limboChanges }; } else { var snap = new ViewSnapshot(this.query, docChanges.documentSet, oldDocs, changes, docChanges.mutatedKeys, newSyncState === SyncState.Local, syncStateChanged, /* excludesMetadataChanges= */ false); return { snapshot: snap, limboChanges: limboChanges }; } }; /** * Applies an OnlineState change to the view, potentially generating a * ViewChange if the view's syncState changes as a result. */ View.prototype.applyOnlineStateChange = function (onlineState) { if (this.current && onlineState === OnlineState.Offline) { // If we're offline, set `current` to false and then call applyChanges() // to refresh our syncState and generate a ViewChange as appropriate. We // are guaranteed to get a new TargetChange that sets `current` back to // true once the client is back online. this.current = false; return this.applyChanges({ documentSet: this.documentSet, changeSet: new DocumentChangeSet(), mutatedKeys: this.mutatedKeys, needsRefill: false }, /* updateLimboDocuments= */ false); } else { // No effect, just return a no-op ViewChange. return { limboChanges: [] }; } }; /** * Returns whether the doc for the given key should be in limbo. */ View.prototype.shouldBeInLimbo = function (key) { // If the remote end says it's part of this query, it's not in limbo. if (this._syncedDocuments.has(key)) { return false; } // The local store doesn't think it's a result, so it shouldn't be in limbo. if (!this.documentSet.has(key)) { return false; } // If there are local changes to the doc, they might explain why the server // doesn't know that it's part of the query. So don't put it in limbo. // TODO(klimt): Ideally, we would only consider changes that might actually // affect this specific query. if (this.documentSet.get(key).hasLocalMutations) { return false; } // Everything else is in limbo. return true; }; /** * Updates syncedDocuments, current, and limbo docs based on the given change. * Returns the list of changes to which docs are in limbo. */ View.prototype.applyTargetChange = function (targetChange) { var _this = this; if (targetChange) { targetChange.addedDocuments.forEach(function (key) { return (_this._syncedDocuments = _this._syncedDocuments.add(key)); }); targetChange.modifiedDocuments.forEach(function (key) { return assert(_this._syncedDocuments.has(key), "Modified document " + key + " not found in view."); }); targetChange.removedDocuments.forEach(function (key) { return (_this._syncedDocuments = _this._syncedDocuments.delete(key)); }); this.current = targetChange.current; } }; View.prototype.updateLimboDocuments = function () { var _this = this; // We can only determine limbo documents when we're in-sync with the server. if (!this.current) { return []; } // TODO(klimt): Do this incrementally so that it's not quadratic when // updating many documents. var oldLimboDocuments = this.limboDocuments; this.limboDocuments = documentKeySet(); this.documentSet.forEach(function (doc) { if (_this.shouldBeInLimbo(doc.key)) { _this.limboDocuments = _this.limboDocuments.add(doc.key); } }); // Diff the new limbo docs with the old limbo docs. var changes = []; oldLimboDocuments.forEach(function (key) { if (!_this.limboDocuments.has(key)) { changes.push(new RemovedLimboDocument(key)); } }); this.limboDocuments.forEach(function (key) { if (!oldLimboDocuments.has(key)) { changes.push(new AddedLimboDocument(key)); } }); return changes; }; /** * Update the in-memory state of the current view with the state read from * persistence. * * We update the query view whenever a client's primary status changes: * - When a client transitions from primary to secondary, it can miss * LocalStorage updates and its query views may temporarily not be * synchronized with the state on disk. * - For secondary to primary transitions, the client needs to update the list * of `syncedDocuments` since secondary clients update their query views * based purely on synthesized RemoteEvents. * * @param localDocs - The documents that match the query according to the * LocalStore. * @param remoteKeys - The keys of the documents that match the query * according to the backend. * * @return The ViewChange that resulted from this synchronization. */ // PORTING NOTE: Multi-tab only. View.prototype.synchronizeWithPersistedState = function (localDocs, remoteKeys) { this._syncedDocuments = remoteKeys; this.limboDocuments = documentKeySet(); var docChanges = this.computeDocChanges(localDocs); return this.applyChanges(docChanges, /*updateLimboDocuments=*/ true); }; /** * Returns a view snapshot as if this query was just listened to. Contains * a document add for every existing document and the `fromCache` and * `hasPendingWrites` status of the already established view. */ // PORTING NOTE: Multi-tab only. View.prototype.computeInitialSnapshot = function () { return ViewSnapshot.fromInitialDocuments(this.query, this.documentSet, this.mutatedKeys, this.syncState === SyncState.Local); }; return View; }()); function compareChangeType(c1, c2) { var order = function (change) { switch (change) { case ChangeType.Added: return 1; case ChangeType.Modified: return 2; case ChangeType.Metadata: // A metadata change is converted to a modified change at the public // api layer. Since we sort by document key and then change type, // metadata and modified changes must be sorted equivalently. return 2; case ChangeType.Removed: return 0; default: return fail('Unknown ChangeType: ' + change); } }; return order(c1) - order(c2); } /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG$9 = 'SyncEngine'; /** * QueryView contains all of the data that SyncEngine needs to keep track of for * a particular query. */ var QueryView = /** @class */ (function () { function QueryView( /** * The query itself. */ query, /** * The target number created by the client that is used in the watch * stream to identify this query. */ targetId, /** * The view is responsible for computing the final merged truth of what * docs are in the query. It gets notified of local and remote changes, * and applies the query filters and limits to determine the most correct * possible results. */ view) { this.query = query; this.targetId = targetId; this.view = view; } return QueryView; }()); /** Tracks a limbo resolution. */ var LimboResolution = /** @class */ (function () { function LimboResolution(key) { this.key = key; } return LimboResolution; }()); /** * SyncEngine is the central controller in the client SDK architecture. It is * the glue code between the EventManager, LocalStore, and RemoteStore. Some of * SyncEngine's responsibilities include: * 1. Coordinating client requests and remote events between the EventManager * and the local and remote data stores. * 2. Managing a View object for each query, providing the unified view between * the local and remote data stores. * 3. Notifying the RemoteStore when the LocalStore has new mutations in its * queue that need sending to the backend. * * The SyncEngine’s methods should only ever be called by methods running in the * global async queue. */ var SyncEngine = /** @class */ (function () { function SyncEngine(localStore, remoteStore, // PORTING NOTE: Manages state synchronization in multi-tab environments. sharedClientState, currentUser) { this.localStore = localStore; this.remoteStore = remoteStore; this.sharedClientState = sharedClientState; this.currentUser = currentUser; this.syncEngineListener = null; this.queryViewsByQuery = new ObjectMap(function (q) { return q.canonicalId(); }); this.queryViewsByTarget = {}; this.limboTargetsByKey = new SortedMap(DocumentKey.comparator); this.limboResolutionsByTarget = {}; this.limboDocumentRefs = new ReferenceSet(); /** Stores user completion handlers, indexed by User and BatchId. */ this.mutationUserCallbacks = {}; this.limboTargetIdGenerator = TargetIdGenerator.forSyncEngine(); // The primary state is set to `true` or `false` immediately after Firestore // startup. In the interim, a client should only be considered primary if // `isPrimary` is true. this.isPrimary = undefined; this.onlineState = OnlineState.Unknown; } Object.defineProperty(SyncEngine.prototype, "isPrimaryClient", { // Only used for testing. get: function () { return this.isPrimary === true; }, enumerable: true, configurable: true }); /** Subscribes to SyncEngine notifications. Has to be called exactly once. */ SyncEngine.prototype.subscribe = function (syncEngineListener) { assert(syncEngineListener !== null, 'SyncEngine listener cannot be null'); assert(this.syncEngineListener === null, 'SyncEngine already has a subscriber.'); this.syncEngineListener = syncEngineListener; }; /** * Initiates the new listen, resolves promise when listen enqueued to the * server. All the subsequent view snapshots or errors are sent to the * subscribed handlers. Returns the targetId of the query. */ SyncEngine.prototype.listen = function (query) { return tslib_1.__awaiter(this, void 0, void 0, function () { var targetId, viewSnapshot, queryView, queryData, status_1; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: this.assertSubscribed('listen()'); queryView = this.queryViewsByQuery.get(query); if (!queryView) return [3 /*break*/, 1]; // PORTING NOTE: With Mult-Tab Web, it is possible that a query view // already exists when EventManager calls us for the first time. This // happens when the primary tab is already listening to this query on // behalf of another tab and the user of the primary also starts listening // to the query. EventManager will not have an assigned target ID in this // case and calls `listen` to obtain this ID. targetId = queryView.targetId; this.sharedClientState.addLocalQueryTarget(targetId); viewSnapshot = queryView.view.computeInitialSnapshot(); return [3 /*break*/, 4]; case 1: return [4 /*yield*/, this.localStore.allocateQuery(query)]; case 2: queryData = _a.sent(); status_1 = this.sharedClientState.addLocalQueryTarget(queryData.targetId); targetId = queryData.targetId; return [4 /*yield*/, this.initializeViewAndComputeSnapshot(queryData, status_1 === 'current')]; case 3: viewSnapshot = _a.sent(); if (this.isPrimary) { this.remoteStore.listen(queryData); } _a.label = 4; case 4: this.syncEngineListener.onWatchChange([viewSnapshot]); return [2 /*return*/, targetId]; } }); }); }; /** * Registers a view for a previously unknown query and computes its initial * snapshot. */ SyncEngine.prototype.initializeViewAndComputeSnapshot = function (queryData, current) { var _this = this; var query = queryData.query; return this.localStore.executeQuery(query).then(function (docs) { return _this.localStore .remoteDocumentKeys(queryData.targetId) .then(function (remoteKeys) { var view = new View(query, remoteKeys); var viewDocChanges = view.computeDocChanges(docs); // tslint:disable-next-line:max-line-length Prettier formats this exceed 100 characters. var synthesizedTargetChange = TargetChange.createSynthesizedTargetChangeForCurrentChange(queryData.targetId, current && _this.onlineState !== OnlineState.Offline); var viewChange = view.applyChanges(viewDocChanges, /* updateLimboDocuments= */ _this.isPrimary === true, synthesizedTargetChange); assert(viewChange.limboChanges.length === 0, 'View returned limbo docs before target ack from the server.'); assert(!!viewChange.snapshot, 'applyChanges for new view should always return a snapshot'); var data = new QueryView(query, queryData.targetId, view); _this.queryViewsByQuery.set(query, data); _this.queryViewsByTarget[queryData.targetId] = data; return viewChange.snapshot; }); }); }; /** * Reconcile the list of synced documents in an existing view with those * from persistence. */ // PORTING NOTE: Multi-tab only. SyncEngine.prototype.synchronizeViewAndComputeSnapshot = function (queryView) { var _this = this; return this.localStore.executeQuery(queryView.query).then(function (docs) { return _this.localStore .remoteDocumentKeys(queryView.targetId) .then(function (remoteKeys) { return tslib_1.__awaiter(_this, void 0, void 0, function () { var viewSnapshot; return tslib_1.__generator(this, function (_a) { viewSnapshot = queryView.view.synchronizeWithPersistedState(docs, remoteKeys); if (this.isPrimary) { this.updateTrackedLimbos(queryView.targetId, viewSnapshot.limboChanges); } return [2 /*return*/, viewSnapshot]; }); }); }); }); }; /** Stops listening to the query. */ SyncEngine.prototype.unlisten = function (query) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var queryView, targetRemainsActive; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: this.assertSubscribed('unlisten()'); queryView = this.queryViewsByQuery.get(query); assert(!!queryView, 'Trying to unlisten on query not found:' + query); if (!this.isPrimary) return [3 /*break*/, 3]; // We need to remove the local query target first to allow us to verify // whether any other client is still interested in this target. this.sharedClientState.removeLocalQueryTarget(queryView.targetId); targetRemainsActive = this.sharedClientState.isActiveQueryTarget(queryView.targetId); if (!!targetRemainsActive) return [3 /*break*/, 2]; return [4 /*yield*/, this.localStore .releaseQuery(query, /*keepPersistedQueryData=*/ false) .then(function () { _this.sharedClientState.clearQueryState(queryView.targetId); _this.remoteStore.unlisten(queryView.targetId); _this.removeAndCleanupQuery(queryView); }) .catch(function (err) { return _this.ignoreIfPrimaryLeaseLoss(err); })]; case 1: _a.sent(); _a.label = 2; case 2: return [3 /*break*/, 5]; case 3: this.removeAndCleanupQuery(queryView); return [4 /*yield*/, this.localStore.releaseQuery(query, /*keepPersistedQueryData=*/ true)]; case 4: _a.sent(); _a.label = 5; case 5: return [2 /*return*/]; } }); }); }; /** * Initiates the write of local mutation batch which involves adding the * writes to the mutation queue, notifying the remote store about new * mutations and raising events for any changes this write caused. * * The promise returned by this call is resolved when the above steps * have completed, *not* when the write was acked by the backend. The * userCallback is resolved once the write was acked/rejected by the * backend (or failed locally for any other reason). */ SyncEngine.prototype.write = function (batch, userCallback) { var _this = this; this.assertSubscribed('write()'); return this.localStore .localWrite(batch) .then(function (result) { _this.sharedClientState.addPendingMutation(result.batchId); _this.addMutationCallback(result.batchId, userCallback); return _this.emitNewSnapsAndNotifyLocalStore(result.changes); }) .then(function () { return _this.remoteStore.fillWritePipeline(); }); }; // TODO(klimt): Wrap the given error in a standard Firestore error object. SyncEngine.prototype.wrapUpdateFunctionError = function (error$$1) { return error$$1; }; /** * Takes an updateFunction in which a set of reads and writes can be performed * atomically. In the updateFunction, the client can read and write values * using the supplied transaction object. After the updateFunction, all * changes will be committed. If some other client has changed any of the data * referenced, then the updateFunction will be called again. If the * updateFunction still fails after the given number of retries, then the * transaction will be rejection. * * The transaction object passed to the updateFunction contains methods for * accessing documents and collections. Unlike other datastore access, data * accessed with the transaction will not reflect local changes that have not * been committed. For this reason, it is required that all reads are * performed before any writes. Transactions must be performed while online. * * The promise returned is resolved when the transaction is fully committed. */ SyncEngine.prototype.runTransaction = function (updateFunction, retries) { var _this = this; if (retries === void 0) { retries = 5; } assert(retries >= 0, 'Got negative number of retries for transaction.'); var transaction = this.remoteStore.createTransaction(); var wrappedUpdateFunction = function () { try { var userPromise = updateFunction(transaction); if (isNullOrUndefined(userPromise) || !userPromise.catch || !userPromise.then) { return Promise.reject(Error('Transaction callback must return a Promise')); } return userPromise.catch(function (e) { return Promise.reject(_this.wrapUpdateFunctionError(e)); }); } catch (e) { return Promise.reject(_this.wrapUpdateFunctionError(e)); } }; return wrappedUpdateFunction().then(function (result) { return transaction .commit() .then(function () { return result; }) .catch(function (error$$1) { if (retries === 0) { return Promise.reject(error$$1); } // TODO(klimt): Put in a retry delay? return _this.runTransaction(updateFunction, retries - 1); }); }); }; SyncEngine.prototype.applyRemoteEvent = function (remoteEvent) { var _this = this; this.assertSubscribed('applyRemoteEvent()'); return this.localStore .applyRemoteEvent(remoteEvent) .then(function (changes) { // Update `receivedDocument` as appropriate for any limbo targets. forEach(remoteEvent.targetChanges, function (targetId, targetChange) { var limboResolution = _this.limboResolutionsByTarget[targetId]; if (limboResolution) { // Since this is a limbo resolution lookup, it's for a single document // and it could be added, modified, or removed, but not a combination. assert(targetChange.addedDocuments.size + targetChange.modifiedDocuments.size + targetChange.removedDocuments.size <= 1, 'Limbo resolution for single document contains multiple changes.'); if (targetChange.addedDocuments.size > 0) { limboResolution.receivedDocument = true; } else if (targetChange.modifiedDocuments.size > 0) { assert(limboResolution.receivedDocument, 'Received change for limbo target document without add.'); } else if (targetChange.removedDocuments.size > 0) { assert(limboResolution.receivedDocument, 'Received remove for limbo target document without add.'); limboResolution.receivedDocument = false; } else { // This was probably just a CURRENT targetChange or similar. } } }); return _this.emitNewSnapsAndNotifyLocalStore(changes, remoteEvent); }) .catch(function (err) { return _this.ignoreIfPrimaryLeaseLoss(err); }); }; /** * Applies an OnlineState change to the sync engine and notifies any views of * the change. */ SyncEngine.prototype.applyOnlineStateChange = function (onlineState, source) { // If we are the secondary client, we explicitly ignore the remote store's // online state (the local client may go offline, even though the primary // tab remains online) and only apply the primary tab's online state from // SharedClientState. if ((this.isPrimary && source === OnlineStateSource.RemoteStore) || (!this.isPrimary && source === OnlineStateSource.SharedClientState)) { var newViewSnapshots_1 = []; this.queryViewsByQuery.forEach(function (query, queryView) { var viewChange = queryView.view.applyOnlineStateChange(onlineState); assert(viewChange.limboChanges.length === 0, 'OnlineState should not affect limbo documents.'); if (viewChange.snapshot) { newViewSnapshots_1.push(viewChange.snapshot); } }); this.syncEngineListener.onOnlineStateChange(onlineState); this.syncEngineListener.onWatchChange(newViewSnapshots_1); this.onlineState = onlineState; if (this.isPrimary) { this.sharedClientState.setOnlineState(onlineState); } } }; SyncEngine.prototype.rejectListen = function (targetId, err) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var limboResolution, limboKey, documentUpdates, resolvedLimboDocuments, event_1, queryView_1; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: this.assertSubscribed('rejectListens()'); // PORTING NOTE: Multi-tab only. this.sharedClientState.updateQueryState(targetId, 'rejected', err); limboResolution = this.limboResolutionsByTarget[targetId]; limboKey = limboResolution && limboResolution.key; if (!limboKey) return [3 /*break*/, 1]; // Since this query failed, we won't want to manually unlisten to it. // So go ahead and remove it from bookkeeping. this.limboTargetsByKey = this.limboTargetsByKey.remove(limboKey); delete this.limboResolutionsByTarget[targetId]; documentUpdates = new SortedMap(DocumentKey.comparator); documentUpdates = documentUpdates.insert(limboKey, new NoDocument(limboKey, SnapshotVersion.forDeletedDoc())); resolvedLimboDocuments = documentKeySet().add(limboKey); event_1 = new RemoteEvent(SnapshotVersion.MIN, /* targetChanges= */ {}, /* targetMismatches= */ new SortedSet(primitiveComparator), documentUpdates, resolvedLimboDocuments); return [2 /*return*/, this.applyRemoteEvent(event_1)]; case 1: queryView_1 = this.queryViewsByTarget[targetId]; assert(!!queryView_1, 'Unknown targetId: ' + targetId); return [4 /*yield*/, this.localStore .releaseQuery(queryView_1.query, /* keepPersistedQueryData */ false) .then(function () { return _this.removeAndCleanupQuery(queryView_1); }) .catch(function (err) { return _this.ignoreIfPrimaryLeaseLoss(err); })]; case 2: _a.sent(); this.syncEngineListener.onWatchError(queryView_1.query, err); _a.label = 3; case 3: return [2 /*return*/]; } }); }); }; // PORTING NOTE: Multi-tab only SyncEngine.prototype.applyBatchState = function (batchId, batchState, error$$1) { return tslib_1.__awaiter(this, void 0, void 0, function () { var documents; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: this.assertSubscribed('applyBatchState()'); return [4 /*yield*/, this.localStore.lookupMutationDocuments(batchId)]; case 1: documents = _a.sent(); if (documents === null) { // A throttled tab may not have seen the mutation before it was completed // and removed from the mutation queue, in which case we won't have cached // the affected documents. In this case we can safely ignore the update // since that means we didn't apply the mutation locally at all (if we // had, we would have cached the affected documents), and so we will just // see any resulting document changes via normal remote document updates // as applicable. debug(LOG_TAG$9, 'Cannot apply mutation batch with id: ' + batchId); return [2 /*return*/]; } if (!(batchState === 'pending')) return [3 /*break*/, 3]; // If we are the primary client, we need to send this write to the // backend. Secondary clients will ignore these writes since their remote // connection is disabled. return [4 /*yield*/, this.remoteStore.fillWritePipeline()]; case 2: // If we are the primary client, we need to send this write to the // backend. Secondary clients will ignore these writes since their remote // connection is disabled. _a.sent(); return [3 /*break*/, 4]; case 3: if (batchState === 'acknowledged' || batchState === 'rejected') { // NOTE: Both these methods are no-ops for batches that originated from // other clients. this.processUserCallback(batchId, error$$1 ? error$$1 : null); this.localStore.removeCachedMutationBatchMetadata(batchId); } else { fail("Unknown batchState: " + batchState); } _a.label = 4; case 4: return [4 /*yield*/, this.emitNewSnapsAndNotifyLocalStore(documents)]; case 5: _a.sent(); return [2 /*return*/]; } }); }); }; SyncEngine.prototype.applySuccessfulWrite = function (mutationBatchResult) { var _this = this; this.assertSubscribed('applySuccessfulWrite()'); var batchId = mutationBatchResult.batch.batchId; // The local store may or may not be able to apply the write result and // raise events immediately (depending on whether the watcher is caught // up), so we raise user callbacks first so that they consistently happen // before listen events. this.processUserCallback(batchId, /*error=*/ null); return this.localStore .acknowledgeBatch(mutationBatchResult) .then(function (changes) { _this.sharedClientState.updateMutationState(batchId, 'acknowledged'); return _this.emitNewSnapsAndNotifyLocalStore(changes); }) .catch(function (err) { return _this.ignoreIfPrimaryLeaseLoss(err); }); }; SyncEngine.prototype.rejectFailedWrite = function (batchId, error$$1) { var _this = this; this.assertSubscribed('rejectFailedWrite()'); // The local store may or may not be able to apply the write result and // raise events immediately (depending on whether the watcher is caught up), // so we raise user callbacks first so that they consistently happen before // listen events. this.processUserCallback(batchId, error$$1); return this.localStore .rejectBatch(batchId) .then(function (changes) { _this.sharedClientState.updateMutationState(batchId, 'rejected', error$$1); return _this.emitNewSnapsAndNotifyLocalStore(changes); }) .catch(function (err) { return _this.ignoreIfPrimaryLeaseLoss(err); }); }; SyncEngine.prototype.addMutationCallback = function (batchId, callback) { var newCallbacks = this.mutationUserCallbacks[this.currentUser.toKey()]; if (!newCallbacks) { newCallbacks = new SortedMap(primitiveComparator); } newCallbacks = newCallbacks.insert(batchId, callback); this.mutationUserCallbacks[this.currentUser.toKey()] = newCallbacks; }; /** * Resolves or rejects the user callback for the given batch and then discards * it. */ SyncEngine.prototype.processUserCallback = function (batchId, error$$1) { var newCallbacks = this.mutationUserCallbacks[this.currentUser.toKey()]; // NOTE: Mutations restored from persistence won't have callbacks, so it's // okay for there to be no callback for this ID. if (newCallbacks) { var callback = newCallbacks.get(batchId); if (callback) { assert(batchId === newCallbacks.minKey(), 'Mutation callbacks processed out-of-order?'); if (error$$1) { callback.reject(error$$1); } else { callback.resolve(); } newCallbacks = newCallbacks.remove(batchId); } this.mutationUserCallbacks[this.currentUser.toKey()] = newCallbacks; } }; SyncEngine.prototype.removeAndCleanupQuery = function (queryView) { var _this = this; this.sharedClientState.removeLocalQueryTarget(queryView.targetId); this.queryViewsByQuery.delete(queryView.query); delete this.queryViewsByTarget[queryView.targetId]; if (this.isPrimary) { var limboKeys = this.limboDocumentRefs.referencesForId(queryView.targetId); this.limboDocumentRefs.removeReferencesForId(queryView.targetId); limboKeys.forEach(function (limboKey) { var isReferenced = _this.limboDocumentRefs.containsKey(limboKey); if (!isReferenced) { // We removed the last reference for this key _this.removeLimboTarget(limboKey); } }); } }; SyncEngine.prototype.removeLimboTarget = function (key) { // It's possible that the target already got removed because the query failed. In that case, // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target. var limboTargetId = this.limboTargetsByKey.get(key); if (limboTargetId === null) { // This target already got removed, because the query failed. return; } this.remoteStore.unlisten(limboTargetId); this.limboTargetsByKey = this.limboTargetsByKey.remove(key); delete this.limboResolutionsByTarget[limboTargetId]; }; SyncEngine.prototype.updateTrackedLimbos = function (targetId, limboChanges) { for (var _i = 0, limboChanges_1 = limboChanges; _i < limboChanges_1.length; _i++) { var limboChange = limboChanges_1[_i]; if (limboChange instanceof AddedLimboDocument) { this.limboDocumentRefs.addReference(limboChange.key, targetId); this.trackLimboChange(limboChange); } else if (limboChange instanceof RemovedLimboDocument) { debug(LOG_TAG$9, 'Document no longer in limbo: ' + limboChange.key); this.limboDocumentRefs.removeReference(limboChange.key, targetId); var isReferenced = this.limboDocumentRefs.containsKey(limboChange.key); if (!isReferenced) { // We removed the last reference for this key this.removeLimboTarget(limboChange.key); } } else { fail('Unknown limbo change: ' + JSON.stringify(limboChange)); } } }; SyncEngine.prototype.trackLimboChange = function (limboChange) { var key = limboChange.key; if (!this.limboTargetsByKey.get(key)) { debug(LOG_TAG$9, 'New document in limbo: ' + key); var limboTargetId = this.limboTargetIdGenerator.next(); var query = Query.atPath(key.path); this.limboResolutionsByTarget[limboTargetId] = new LimboResolution(key); this.remoteStore.listen(new QueryData(query, limboTargetId, QueryPurpose.LimboResolution, ListenSequence.INVALID)); this.limboTargetsByKey = this.limboTargetsByKey.insert(key, limboTargetId); } }; // Visible for testing SyncEngine.prototype.currentLimboDocs = function () { return this.limboTargetsByKey; }; SyncEngine.prototype.emitNewSnapsAndNotifyLocalStore = function (changes, remoteEvent) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var newSnaps, docChangesInAllViews, queriesProcessed; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: newSnaps = []; docChangesInAllViews = []; queriesProcessed = []; this.queryViewsByQuery.forEach(function (_, queryView) { queriesProcessed.push(Promise.resolve() .then(function () { var viewDocChanges = queryView.view.computeDocChanges(changes); if (!viewDocChanges.needsRefill) { return viewDocChanges; } // The query has a limit and some docs were removed, so we need // to re-run the query against the local store to make sure we // didn't lose any good docs that had been past the limit. return _this.localStore.executeQuery(queryView.query).then(function (docs) { return queryView.view.computeDocChanges(docs, viewDocChanges); }); }) .then(function (viewDocChanges) { var targetChange = remoteEvent && remoteEvent.targetChanges[queryView.targetId]; var viewChange = queryView.view.applyChanges(viewDocChanges, /* updateLimboDocuments= */ _this.isPrimary === true, targetChange); _this.updateTrackedLimbos(queryView.targetId, viewChange.limboChanges); if (viewChange.snapshot) { if (_this.isPrimary) { _this.sharedClientState.updateQueryState(queryView.targetId, viewChange.snapshot.fromCache ? 'not-current' : 'current'); } newSnaps.push(viewChange.snapshot); var docChanges = LocalViewChanges.fromSnapshot(queryView.targetId, viewChange.snapshot); docChangesInAllViews.push(docChanges); } })); }); return [4 /*yield*/, Promise.all(queriesProcessed)]; case 1: _a.sent(); this.syncEngineListener.onWatchChange(newSnaps); return [4 /*yield*/, this.localStore.notifyLocalViewChanges(docChangesInAllViews)]; case 2: _a.sent(); return [2 /*return*/]; } }); }); }; /** * Verifies the error thrown by an LocalStore operation. If a LocalStore * operation fails because the primary lease has been taken by another client, * we ignore the error (the persistence layer will immediately call * `applyPrimaryLease` to propagate the primary state change). All other * errors are re-thrown. * * @param err An error returned by a LocalStore operation. * @return A Promise that resolves after we recovered, or the original error. */ SyncEngine.prototype.ignoreIfPrimaryLeaseLoss = function (err) { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { if (isPrimaryLeaseLostError(err)) { debug(LOG_TAG$9, 'Unexpectedly lost primary lease'); } else { throw err; } return [2 /*return*/]; }); }); }; SyncEngine.prototype.assertSubscribed = function (fnName) { assert(this.syncEngineListener !== null, 'Trying to call ' + fnName + ' before calling subscribe().'); }; SyncEngine.prototype.handleCredentialChange = function (user) { return tslib_1.__awaiter(this, void 0, void 0, function () { var userChanged, result; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: userChanged = !this.currentUser.isEqual(user); this.currentUser = user; if (!userChanged) return [3 /*break*/, 3]; return [4 /*yield*/, this.localStore.handleUserChange(user)]; case 1: result = _a.sent(); // TODO(b/114226417): Consider calling this only in the primary tab. this.sharedClientState.handleUserChange(user, result.removedBatchIds, result.addedBatchIds); return [4 /*yield*/, this.emitNewSnapsAndNotifyLocalStore(result.affectedDocuments)]; case 2: _a.sent(); _a.label = 3; case 3: return [4 /*yield*/, this.remoteStore.handleCredentialChange()]; case 4: _a.sent(); return [2 /*return*/]; } }); }); }; // PORTING NOTE: Multi-tab only SyncEngine.prototype.applyPrimaryState = function (isPrimary) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var activeTargets, activeQueries, _i, activeQueries_1, queryData, activeTargets_1, p_1; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: if (!(isPrimary === true && this.isPrimary !== true)) return [3 /*break*/, 3]; this.isPrimary = true; return [4 /*yield*/, this.remoteStore.applyPrimaryState(true)]; case 1: _a.sent(); activeTargets = this.sharedClientState.getAllActiveQueryTargets(); return [4 /*yield*/, this.synchronizeQueryViewsAndRaiseSnapshots(activeTargets.toArray())]; case 2: activeQueries = _a.sent(); for (_i = 0, activeQueries_1 = activeQueries; _i < activeQueries_1.length; _i++) { queryData = activeQueries_1[_i]; this.remoteStore.listen(queryData); } return [3 /*break*/, 7]; case 3: if (!(isPrimary === false && this.isPrimary !== false)) return [3 /*break*/, 7]; this.isPrimary = false; activeTargets_1 = []; p_1 = Promise.resolve(); forEachNumber(this.queryViewsByTarget, function (targetId, queryView) { if (_this.sharedClientState.isLocalQueryTarget(targetId)) { activeTargets_1.push(targetId); } else { p_1 = p_1.then(function () { return _this.unlisten(queryView.query); }); } _this.remoteStore.unlisten(queryView.targetId); }); return [4 /*yield*/, p_1]; case 4: _a.sent(); return [4 /*yield*/, this.synchronizeQueryViewsAndRaiseSnapshots(activeTargets_1)]; case 5: _a.sent(); this.resetLimboDocuments(); return [4 /*yield*/, this.remoteStore.applyPrimaryState(false)]; case 6: _a.sent(); _a.label = 7; case 7: return [2 /*return*/]; } }); }); }; // PORTING NOTE: Multi-tab only. SyncEngine.prototype.resetLimboDocuments = function () { var _this = this; forEachNumber(this.limboResolutionsByTarget, function (targetId) { _this.remoteStore.unlisten(targetId); }); this.limboDocumentRefs.removeAllReferences(); this.limboResolutionsByTarget = []; this.limboTargetsByKey = new SortedMap(DocumentKey.comparator); }; /** * Reconcile the query views of the provided query targets with the state from * persistence. Raises snapshots for any changes that affect the local * client and returns the updated state of all target's query data. */ // PORTING NOTE: Multi-tab only. SyncEngine.prototype.synchronizeQueryViewsAndRaiseSnapshots = function (targets) { var _this = this; var p = Promise.resolve(); var activeQueries = []; var newViewSnapshots = []; var _loop_1 = function (targetId) { p = p.then(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { var queryData, queryView, viewChange, query; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: queryView = this.queryViewsByTarget[targetId]; if (!queryView) return [3 /*break*/, 4]; // For queries that have a local View, we need to update their state // in LocalStore (as the resume token and the snapshot version // might have changed) and reconcile their views with the persisted // state (the list of syncedDocuments may have gotten out of sync). return [4 /*yield*/, this.localStore.releaseQuery(queryView.query, /*keepPersistedQueryData=*/ true)]; case 1: // For queries that have a local View, we need to update their state // in LocalStore (as the resume token and the snapshot version // might have changed) and reconcile their views with the persisted // state (the list of syncedDocuments may have gotten out of sync). _a.sent(); return [4 /*yield*/, this.localStore.allocateQuery(queryView.query)]; case 2: queryData = _a.sent(); return [4 /*yield*/, this.synchronizeViewAndComputeSnapshot(queryView)]; case 3: viewChange = _a.sent(); if (viewChange.snapshot) { newViewSnapshots.push(viewChange.snapshot); } return [3 /*break*/, 8]; case 4: assert(this.isPrimary === true, 'A secondary tab should never have an active query without an active view.'); return [4 /*yield*/, this.localStore.getQueryForTarget(targetId)]; case 5: query = _a.sent(); assert(!!query, "Query data for target " + targetId + " not found"); return [4 /*yield*/, this.localStore.allocateQuery(query)]; case 6: queryData = _a.sent(); return [4 /*yield*/, this.initializeViewAndComputeSnapshot(queryData, /*current=*/ false)]; case 7: _a.sent(); _a.label = 8; case 8: activeQueries.push(queryData); return [2 /*return*/]; } }); }); }); }; for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) { var targetId = targets_1[_i]; _loop_1(targetId); } return p.then(function () { _this.syncEngineListener.onWatchChange(newViewSnapshots); return activeQueries; }); }; // PORTING NOTE: Multi-tab only SyncEngine.prototype.getActiveClients = function () { return this.localStore.getActiveClients(); }; // PORTING NOTE: Multi-tab only SyncEngine.prototype.applyTargetState = function (targetId, state, error$$1) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var _a, queryView; return tslib_1.__generator(this, function (_b) { switch (_b.label) { case 0: if (this.isPrimary) { // If we receive a target state notification via WebStorage, we are // either already secondary or another tab has taken the primary lease. debug(LOG_TAG$9, 'Ignoring unexpected query state notification.'); return [2 /*return*/]; } if (!this.queryViewsByTarget[targetId]) return [3 /*break*/, 5]; _a = state; switch (_a) { case 'current': return [3 /*break*/, 1]; case 'not-current': return [3 /*break*/, 1]; case 'rejected': return [3 /*break*/, 2]; } return [3 /*break*/, 4]; case 1: { return [2 /*return*/, this.localStore.getNewDocumentChanges().then(function (changes) { return tslib_1.__awaiter(_this, void 0, void 0, function () { var synthesizedRemoteEvent; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: synthesizedRemoteEvent = RemoteEvent.createSynthesizedRemoteEventForCurrentChange(targetId, state === 'current'); return [4 /*yield*/, this.emitNewSnapsAndNotifyLocalStore(changes, synthesizedRemoteEvent)]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }, function (err) { return tslib_1.__awaiter(_this, void 0, void 0, function () { var activeTargets_2; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: if (!isDocumentChangeMissingError(err)) return [3 /*break*/, 2]; activeTargets_2 = []; forEachNumber(this.queryViewsByTarget, function (target) { return activeTargets_2.push(target); }); return [4 /*yield*/, this.synchronizeQueryViewsAndRaiseSnapshots(activeTargets_2)]; case 1: _a.sent(); return [3 /*break*/, 3]; case 2: throw err; case 3: return [2 /*return*/]; } }); }); })]; } _b.label = 2; case 2: queryView = this.queryViewsByTarget[targetId]; this.removeAndCleanupQuery(queryView); return [4 /*yield*/, this.localStore.releaseQuery(queryView.query, /*keepPersistedQueryData=*/ true)]; case 3: _b.sent(); this.syncEngineListener.onWatchError(queryView.query, error$$1); return [3 /*break*/, 5]; case 4: fail('Unexpected target state: ' + state); _b.label = 5; case 5: return [2 /*return*/]; } }); }); }; // PORTING NOTE: Multi-tab only SyncEngine.prototype.applyActiveTargetsChange = function (added, removed) { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var _i, added_1, targetId, query, queryData, _loop_2, this_1, _a, removed_1, targetId; return tslib_1.__generator(this, function (_b) { switch (_b.label) { case 0: if (!this.isPrimary) { return [2 /*return*/]; } _i = 0, added_1 = added; _b.label = 1; case 1: if (!(_i < added_1.length)) return [3 /*break*/, 6]; targetId = added_1[_i]; assert(!this.queryViewsByTarget[targetId], 'Trying to add an already active target'); return [4 /*yield*/, this.localStore.getQueryForTarget(targetId)]; case 2: query = _b.sent(); assert(!!query, "Query data for active target " + targetId + " not found"); return [4 /*yield*/, this.localStore.allocateQuery(query)]; case 3: queryData = _b.sent(); return [4 /*yield*/, this.initializeViewAndComputeSnapshot(queryData, /*current=*/ false)]; case 4: _b.sent(); this.remoteStore.listen(queryData); _b.label = 5; case 5: _i++; return [3 /*break*/, 1]; case 6: _loop_2 = function (targetId) { var queryView; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: queryView = this_1.queryViewsByTarget[targetId]; if (!queryView) return [3 /*break*/, 2]; return [4 /*yield*/, this_1.localStore .releaseQuery(queryView.query, /*keepPersistedQueryData=*/ false) .then(function () { _this.remoteStore.unlisten(targetId); _this.removeAndCleanupQuery(queryView); }) .catch(function (err) { return _this.ignoreIfPrimaryLeaseLoss(err); })]; case 1: _a.sent(); _a.label = 2; case 2: return [2 /*return*/]; } }); }; this_1 = this; _a = 0, removed_1 = removed; _b.label = 7; case 7: if (!(_a < removed_1.length)) return [3 /*break*/, 10]; targetId = removed_1[_a]; return [5 /*yield**/, _loop_2(targetId)]; case 8: _b.sent(); _b.label = 9; case 9: _a++; return [3 /*break*/, 7]; case 10: return [2 /*return*/]; } }); }); }; // PORTING NOTE: Multi-tab only. In other clients, LocalStore is unaware of // the online state. SyncEngine.prototype.enableNetwork = function () { this.localStore.setNetworkEnabled(true); return this.remoteStore.enableNetwork(); }; // PORTING NOTE: Multi-tab only. In other clients, LocalStore is unaware of // the online state. SyncEngine.prototype.disableNetwork = function () { this.localStore.setNetworkEnabled(false); return this.remoteStore.disableNetwork(); }; SyncEngine.prototype.getRemoteKeysForTarget = function (targetId) { var limboResolution = this.limboResolutionsByTarget[targetId]; if (limboResolution && limboResolution.receivedDocument) { return documentKeySet().add(limboResolution.key); } else { return this.queryViewsByTarget[targetId] ? this.queryViewsByTarget[targetId].view.syncedDocuments : documentKeySet(); } }; return SyncEngine; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Simple wrapper around a nullable UID. Mostly exists to make code more * readable. */ var User = /** @class */ (function () { function User(uid) { this.uid = uid; } User.prototype.isAuthenticated = function () { return this.uid != null; }; /** * Returns a key representing this user, suitable for inclusion in a * dictionary. */ User.prototype.toKey = function () { if (this.isAuthenticated()) { return 'uid:' + this.uid; } else { return 'anonymous-user'; } }; User.prototype.isEqual = function (otherUser) { return otherUser.uid === this.uid; }; /** A user with a null UID. */ User.UNAUTHENTICATED = new User(null); // TODO(mikelehen): Look into getting a proper uid-equivalent for // non-FirebaseAuth providers. User.GOOGLE_CREDENTIALS = new User('google-credentials-uid'); User.FIRST_PARTY = new User('first-party-uid'); return User; }()); /** * Copyright 2018 Google Inc. * * 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. */ var LOG_TAG$10 = 'SharedClientState'; // The format of the LocalStorage key that stores the client state is: // firestore_clients__ var CLIENT_STATE_KEY_PREFIX = 'firestore_clients'; // The format of the WebStorage key that stores the mutation state is: // firestore_mutations__ // (for unauthenticated users) // or: firestore_mutations___ // // 'user_uid' is last to avoid needing to escape '_' characters that it might // contain. var MUTATION_BATCH_KEY_PREFIX = 'firestore_mutations'; // The format of the WebStorage key that stores a query target's metadata is: // firestore_targets__ var QUERY_TARGET_KEY_PREFIX = 'firestore_targets'; // The WebStorage prefix that stores the primary tab's online state. The // format of the key is: // firestore_online_state_ var ONLINE_STATE_KEY_PREFIX = 'firestore_online_state'; // The WebStorage key prefix for the key that stores the last sequence number allocated. The key // looks like 'firestore_sequence_number_'. var SEQUENCE_NUMBER_KEY_PREFIX = 'firestore_sequence_number'; /** * Holds the state of a mutation batch, including its user ID, batch ID and * whether the batch is 'pending', 'acknowledged' or 'rejected'. */ // Visible for testing var MutationMetadata = /** @class */ (function () { function MutationMetadata(user, batchId, state, error$$1) { this.user = user; this.batchId = batchId; this.state = state; this.error = error$$1; assert((error$$1 !== undefined) === (state === 'rejected'), "MutationMetadata must contain an error iff state is 'rejected'"); } /** * Parses a MutationMetadata from its JSON representation in WebStorage. * Logs a warning and returns null if the format of the data is not valid. */ MutationMetadata.fromWebStorageEntry = function (user, batchId, value) { var mutationBatch = JSON.parse(value); var validData = typeof mutationBatch === 'object' && ['pending', 'acknowledged', 'rejected'].indexOf(mutationBatch.state) !== -1 && (mutationBatch.error === undefined || typeof mutationBatch.error === 'object'); var firestoreError = undefined; if (validData && mutationBatch.error) { validData = typeof mutationBatch.error.message === 'string' && typeof mutationBatch.error.code === 'string'; if (validData) { firestoreError = new FirestoreError(mutationBatch.error.code, mutationBatch.error.message); } } if (validData) { return new MutationMetadata(user, batchId, mutationBatch.state, firestoreError); } else { error(LOG_TAG$10, "Failed to parse mutation state for ID '" + batchId + "': " + value); return null; } }; MutationMetadata.prototype.toWebStorageJSON = function () { var batchMetadata = { state: this.state, updateTimeMs: Date.now() // Modify the existing value to trigger update. }; if (this.error) { batchMetadata.error = { code: this.error.code, message: this.error.message }; } return JSON.stringify(batchMetadata); }; return MutationMetadata; }()); /** * Holds the state of a query target, including its target ID and whether the * target is 'not-current', 'current' or 'rejected'. */ // Visible for testing var QueryTargetMetadata = /** @class */ (function () { function QueryTargetMetadata(targetId, state, error$$1) { this.targetId = targetId; this.state = state; this.error = error$$1; assert((error$$1 !== undefined) === (state === 'rejected'), "QueryTargetMetadata must contain an error iff state is 'rejected'"); } /** * Parses a QueryTargetMetadata from its JSON representation in WebStorage. * Logs a warning and returns null if the format of the data is not valid. */ QueryTargetMetadata.fromWebStorageEntry = function (targetId, value) { var targetState = JSON.parse(value); var validData = typeof targetState === 'object' && ['not-current', 'current', 'rejected'].indexOf(targetState.state) !== -1 && (targetState.error === undefined || typeof targetState.error === 'object'); var firestoreError = undefined; if (validData && targetState.error) { validData = typeof targetState.error.message === 'string' && typeof targetState.error.code === 'string'; if (validData) { firestoreError = new FirestoreError(targetState.error.code, targetState.error.message); } } if (validData) { return new QueryTargetMetadata(targetId, targetState.state, firestoreError); } else { error(LOG_TAG$10, "Failed to parse target state for ID '" + targetId + "': " + value); return null; } }; QueryTargetMetadata.prototype.toWebStorageJSON = function () { var targetState = { state: this.state, updateTimeMs: Date.now() // Modify the existing value to trigger update. }; if (this.error) { targetState.error = { code: this.error.code, message: this.error.message }; } return JSON.stringify(targetState); }; return QueryTargetMetadata; }()); /** * This class represents the immutable ClientState for a client read from * WebStorage, containing the list of active query targets. */ var RemoteClientState = /** @class */ (function () { function RemoteClientState(clientId, activeTargetIds) { this.clientId = clientId; this.activeTargetIds = activeTargetIds; } /** * Parses a RemoteClientState from the JSON representation in WebStorage. * Logs a warning and returns null if the format of the data is not valid. */ RemoteClientState.fromWebStorageEntry = function (clientId, value) { var clientState = JSON.parse(value); var validData = typeof clientState === 'object' && clientState.activeTargetIds instanceof Array; var activeTargetIdsSet = targetIdSet(); for (var i = 0; validData && i < clientState.activeTargetIds.length; ++i) { validData = isSafeInteger(clientState.activeTargetIds[i]); activeTargetIdsSet = activeTargetIdsSet.add(clientState.activeTargetIds[i]); } if (validData) { return new RemoteClientState(clientId, activeTargetIdsSet); } else { error(LOG_TAG$10, "Failed to parse client data for instance '" + clientId + "': " + value); return null; } }; return RemoteClientState; }()); /** * This class represents the online state for all clients participating in * multi-tab. The online state is only written to by the primary client, and * used in secondary clients to update their query views. */ var SharedOnlineState = /** @class */ (function () { function SharedOnlineState(clientId, onlineState) { this.clientId = clientId; this.onlineState = onlineState; } /** * Parses a SharedOnlineState from its JSON representation in WebStorage. * Logs a warning and returns null if the format of the data is not valid. */ SharedOnlineState.fromWebStorageEntry = function (value) { var onlineState = JSON.parse(value); var validData = typeof onlineState === 'object' && OnlineState[onlineState.onlineState] !== undefined && typeof onlineState.clientId === 'string'; if (validData) { return new SharedOnlineState(onlineState.clientId, OnlineState[onlineState.onlineState]); } else { error(LOG_TAG$10, "Failed to parse online state: " + value); return null; } }; return SharedOnlineState; }()); /** * Metadata state of the local client. Unlike `RemoteClientState`, this class is * mutable and keeps track of all pending mutations, which allows us to * update the range of pending mutation batch IDs as new mutations are added or * removed. * * The data in `LocalClientState` is not read from WebStorage and instead * updated via its instance methods. The updated state can be serialized via * `toWebStorageJSON()`. */ // Visible for testing. var LocalClientState = /** @class */ (function () { function LocalClientState() { this.activeTargetIds = targetIdSet(); } LocalClientState.prototype.addQueryTarget = function (targetId) { assert(!this.activeTargetIds.has(targetId), "Target with ID '" + targetId + "' already active."); this.activeTargetIds = this.activeTargetIds.add(targetId); }; LocalClientState.prototype.removeQueryTarget = function (targetId) { this.activeTargetIds = this.activeTargetIds.delete(targetId); }; /** * Converts this entry into a JSON-encoded format we can use for WebStorage. * Does not encode `clientId` as it is part of the key in WebStorage. */ LocalClientState.prototype.toWebStorageJSON = function () { var data = { activeTargetIds: this.activeTargetIds.toArray(), updateTimeMs: Date.now() // Modify the existing value to trigger update. }; return JSON.stringify(data); }; return LocalClientState; }()); /** * `WebStorageSharedClientState` uses WebStorage (window.localStorage) as the * backing store for the SharedClientState. It keeps track of all active * clients and supports modifications of the local client's data. */ var WebStorageSharedClientState = /** @class */ (function () { function WebStorageSharedClientState(queue, platform, persistenceKey, localClientId, initialUser) { this.queue = queue; this.platform = platform; this.persistenceKey = persistenceKey; this.localClientId = localClientId; this.syncEngine = null; this.onlineStateHandler = null; this.sequenceNumberHandler = null; this.activeClients = {}; this.storageListener = this.handleWebStorageEvent.bind(this); this.started = false; /** * Captures WebStorage events that occur before `start()` is called. These * events are replayed once `WebStorageSharedClientState` is started. */ this.earlyEvents = []; if (!WebStorageSharedClientState.isAvailable(this.platform)) { throw new FirestoreError(Code.UNIMPLEMENTED, 'LocalStorage is not available on this platform.'); } // Escape the special characters mentioned here: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions var escapedPersistenceKey = persistenceKey.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); this.storage = this.platform.window.localStorage; this.currentUser = initialUser; this.localClientStorageKey = this.toWebStorageClientStateKey(this.localClientId); this.sequenceNumberKey = SEQUENCE_NUMBER_KEY_PREFIX + "_" + persistenceKey; this.activeClients[this.localClientId] = new LocalClientState(); this.clientStateKeyRe = new RegExp("^" + CLIENT_STATE_KEY_PREFIX + "_" + escapedPersistenceKey + "_([^_]*)$"); this.mutationBatchKeyRe = new RegExp("^" + MUTATION_BATCH_KEY_PREFIX + "_" + escapedPersistenceKey + "_(\\d+)(?:_(.*))?$"); this.queryTargetKeyRe = new RegExp("^" + QUERY_TARGET_KEY_PREFIX + "_" + escapedPersistenceKey + "_(\\d+)$"); this.onlineStateKey = ONLINE_STATE_KEY_PREFIX + "_" + persistenceKey; // Rather than adding the storage observer during start(), we add the // storage observer during initialization. This ensures that we collect // events before other components populate their initial state (during their // respective start() calls). Otherwise, we might for example miss a // mutation that is added after LocalStore's start() processed the existing // mutations but before we observe WebStorage events. this.platform.window.addEventListener('storage', this.storageListener); } /** Returns 'true' if WebStorage is available in the current environment. */ WebStorageSharedClientState.isAvailable = function (platform) { return !!(platform.window && platform.window.localStorage != null); }; WebStorageSharedClientState.prototype.start = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var _this = this; var existingClients, _i, existingClients_1, clientId, storageItem, clientState, onlineStateJSON, onlineState, _a, _b, event_1; return tslib_1.__generator(this, function (_c) { switch (_c.label) { case 0: assert(!this.started, 'WebStorageSharedClientState already started'); assert(this.syncEngine !== null, 'syncEngine property must be set before calling start()'); assert(this.onlineStateHandler !== null, 'onlineStateHandler property must be set before calling start()'); return [4 /*yield*/, this.syncEngine.getActiveClients()]; case 1: existingClients = _c.sent(); for (_i = 0, existingClients_1 = existingClients; _i < existingClients_1.length; _i++) { clientId = existingClients_1[_i]; if (clientId === this.localClientId) { continue; } storageItem = this.getItem(this.toWebStorageClientStateKey(clientId)); if (storageItem) { clientState = RemoteClientState.fromWebStorageEntry(clientId, storageItem); if (clientState) { this.activeClients[clientState.clientId] = clientState; } } } this.persistClientState(); onlineStateJSON = this.storage.getItem(this.onlineStateKey); if (onlineStateJSON) { onlineState = this.fromWebStorageOnlineState(onlineStateJSON); if (onlineState) { this.handleOnlineStateEvent(onlineState); } } for (_a = 0, _b = this.earlyEvents; _a < _b.length; _a++) { event_1 = _b[_a]; this.handleWebStorageEvent(event_1); } this.earlyEvents = []; // Register a window unload hook to remove the client metadata entry from // WebStorage even if `shutdown()` was not called. this.platform.window.addEventListener('unload', function () { return _this.shutdown(); }); this.started = true; return [2 /*return*/]; } }); }); }; WebStorageSharedClientState.prototype.writeSequenceNumber = function (sequenceNumber) { this.setItem(this.sequenceNumberKey, JSON.stringify(sequenceNumber)); }; WebStorageSharedClientState.prototype.getAllActiveQueryTargets = function () { var activeTargets = targetIdSet(); forEach(this.activeClients, function (key, value) { activeTargets = activeTargets.unionWith(value.activeTargetIds); }); return activeTargets; }; WebStorageSharedClientState.prototype.isActiveQueryTarget = function (targetId) { // This is not using `obj.forEach` since `forEach` doesn't support early // return. for (var clientId in this.activeClients) { if (this.activeClients.hasOwnProperty(clientId)) { if (this.activeClients[clientId].activeTargetIds.has(targetId)) { return true; } } } return false; }; WebStorageSharedClientState.prototype.addPendingMutation = function (batchId) { this.persistMutationState(batchId, 'pending'); }; WebStorageSharedClientState.prototype.updateMutationState = function (batchId, state, error$$1) { this.persistMutationState(batchId, state, error$$1); // Once a final mutation result is observed by other clients, they no longer // access the mutation's metadata entry. Since WebStorage replays events // in order, it is safe to delete the entry right after updating it. this.removeMutationState(batchId); }; WebStorageSharedClientState.prototype.addLocalQueryTarget = function (targetId) { var queryState = 'not-current'; // Lookup an existing query state if the target ID was already registered // by another tab if (this.isActiveQueryTarget(targetId)) { var storageItem = this.storage.getItem(this.toWebStorageQueryTargetMetadataKey(targetId)); if (storageItem) { var metadata = QueryTargetMetadata.fromWebStorageEntry(targetId, storageItem); if (metadata) { queryState = metadata.state; } } } this.localClientState.addQueryTarget(targetId); this.persistClientState(); return queryState; }; WebStorageSharedClientState.prototype.removeLocalQueryTarget = function (targetId) { this.localClientState.removeQueryTarget(targetId); this.persistClientState(); }; WebStorageSharedClientState.prototype.isLocalQueryTarget = function (targetId) { return this.localClientState.activeTargetIds.has(targetId); }; WebStorageSharedClientState.prototype.clearQueryState = function (targetId) { this.removeItem(this.toWebStorageQueryTargetMetadataKey(targetId)); }; WebStorageSharedClientState.prototype.updateQueryState = function (targetId, state, error$$1) { this.persistQueryTargetState(targetId, state, error$$1); }; WebStorageSharedClientState.prototype.handleUserChange = function (user, removedBatchIds, addedBatchIds) { var _this = this; removedBatchIds.forEach(function (batchId) { _this.removeMutationState(batchId); }); this.currentUser = user; addedBatchIds.forEach(function (batchId) { _this.addPendingMutation(batchId); }); }; WebStorageSharedClientState.prototype.setOnlineState = function (onlineState) { this.persistOnlineState(onlineState); }; WebStorageSharedClientState.prototype.shutdown = function () { if (this.started) { this.platform.window.removeEventListener('storage', this.storageListener); this.removeItem(this.localClientStorageKey); this.started = false; } }; WebStorageSharedClientState.prototype.getItem = function (key) { var value = this.storage.getItem(key); debug(LOG_TAG$10, 'READ', key, value); return value; }; WebStorageSharedClientState.prototype.setItem = function (key, value) { debug(LOG_TAG$10, 'SET', key, value); this.storage.setItem(key, value); }; WebStorageSharedClientState.prototype.removeItem = function (key) { debug(LOG_TAG$10, 'REMOVE', key); this.storage.removeItem(key); }; WebStorageSharedClientState.prototype.handleWebStorageEvent = function (event) { var _this = this; if (event.storageArea === this.storage) { debug(LOG_TAG$10, 'EVENT', event.key, event.newValue); if (event.key === this.localClientStorageKey) { error('Received WebStorage notification for local change. Another client might have ' + 'garbage-collected our state'); return; } this.queue.enqueueAndForget(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { var clientState, clientId, mutationMetadata, queryTargetMetadata, onlineState, sequenceNumber; return tslib_1.__generator(this, function (_a) { if (!this.started) { this.earlyEvents.push(event); return [2 /*return*/]; } if (event.key === null) { return [2 /*return*/]; } if (this.clientStateKeyRe.test(event.key)) { if (event.newValue != null) { clientState = this.fromWebStorageClientState(event.key, event.newValue); if (clientState) { return [2 /*return*/, this.handleClientStateEvent(clientState.clientId, clientState)]; } } else { clientId = this.fromWebStorageClientStateKey(event.key); return [2 /*return*/, this.handleClientStateEvent(clientId, null)]; } } else if (this.mutationBatchKeyRe.test(event.key)) { if (event.newValue !== null) { mutationMetadata = this.fromWebStorageMutationMetadata(event.key, event.newValue); if (mutationMetadata) { return [2 /*return*/, this.handleMutationBatchEvent(mutationMetadata)]; } } } else if (this.queryTargetKeyRe.test(event.key)) { if (event.newValue !== null) { queryTargetMetadata = this.fromWebStorageQueryTargetMetadata(event.key, event.newValue); if (queryTargetMetadata) { return [2 /*return*/, this.handleQueryTargetEvent(queryTargetMetadata)]; } } } else if (event.key === this.onlineStateKey) { if (event.newValue !== null) { onlineState = this.fromWebStorageOnlineState(event.newValue); if (onlineState) { return [2 /*return*/, this.handleOnlineStateEvent(onlineState)]; } } } else if (event.key === this.sequenceNumberKey) { assert(!!this.sequenceNumberHandler, 'Missing sequenceNumberHandler'); sequenceNumber = fromWebStorageSequenceNumber(event.newValue); if (sequenceNumber !== ListenSequence.INVALID) { this.sequenceNumberHandler(sequenceNumber); } } return [2 /*return*/]; }); }); }); } }; Object.defineProperty(WebStorageSharedClientState.prototype, "localClientState", { get: function () { return this.activeClients[this.localClientId]; }, enumerable: true, configurable: true }); WebStorageSharedClientState.prototype.persistClientState = function () { this.setItem(this.localClientStorageKey, this.localClientState.toWebStorageJSON()); }; WebStorageSharedClientState.prototype.persistMutationState = function (batchId, state, error$$1) { var mutationState = new MutationMetadata(this.currentUser, batchId, state, error$$1); var mutationKey = this.toWebStorageMutationBatchKey(batchId); this.setItem(mutationKey, mutationState.toWebStorageJSON()); }; WebStorageSharedClientState.prototype.removeMutationState = function (batchId) { var mutationKey = this.toWebStorageMutationBatchKey(batchId); this.removeItem(mutationKey); }; WebStorageSharedClientState.prototype.persistOnlineState = function (onlineState) { var entry = { clientId: this.localClientId, onlineState: OnlineState[onlineState] }; this.storage.setItem(this.onlineStateKey, JSON.stringify(entry)); }; WebStorageSharedClientState.prototype.persistQueryTargetState = function (targetId, state, error$$1) { var targetKey = this.toWebStorageQueryTargetMetadataKey(targetId); var targetMetadata = new QueryTargetMetadata(targetId, state, error$$1); this.setItem(targetKey, targetMetadata.toWebStorageJSON()); }; /** Assembles the key for a client state in WebStorage */ WebStorageSharedClientState.prototype.toWebStorageClientStateKey = function (clientId) { assert(clientId.indexOf('_') === -1, "Client key cannot contain '_', but was '" + clientId + "'"); return CLIENT_STATE_KEY_PREFIX + "_" + this.persistenceKey + "_" + clientId; }; /** Assembles the key for a query state in WebStorage */ WebStorageSharedClientState.prototype.toWebStorageQueryTargetMetadataKey = function (targetId) { return QUERY_TARGET_KEY_PREFIX + "_" + this.persistenceKey + "_" + targetId; }; /** Assembles the key for a mutation batch in WebStorage */ WebStorageSharedClientState.prototype.toWebStorageMutationBatchKey = function (batchId) { var mutationKey = MUTATION_BATCH_KEY_PREFIX + "_" + this.persistenceKey + "_" + batchId; if (this.currentUser.isAuthenticated()) { mutationKey += "_" + this.currentUser.uid; } return mutationKey; }; /** * Parses a client state key in WebStorage. Returns null if the key does not * match the expected key format. */ WebStorageSharedClientState.prototype.fromWebStorageClientStateKey = function (key) { var match = this.clientStateKeyRe.exec(key); return match ? match[1] : null; }; /** * Parses a client state in WebStorage. Returns 'null' if the value could not * be parsed. */ WebStorageSharedClientState.prototype.fromWebStorageClientState = function (key, value) { var clientId = this.fromWebStorageClientStateKey(key); assert(clientId !== null, "Cannot parse client state key '" + key + "'"); return RemoteClientState.fromWebStorageEntry(clientId, value); }; /** * Parses a mutation batch state in WebStorage. Returns 'null' if the value * could not be parsed. */ WebStorageSharedClientState.prototype.fromWebStorageMutationMetadata = function (key, value) { var match = this.mutationBatchKeyRe.exec(key); assert(match !== null, "Cannot parse mutation batch key '" + key + "'"); var batchId = Number(match[1]); var userId = match[2] !== undefined ? match[2] : null; return MutationMetadata.fromWebStorageEntry(new User(userId), batchId, value); }; /** * Parses a query target state from WebStorage. Returns 'null' if the value * could not be parsed. */ WebStorageSharedClientState.prototype.fromWebStorageQueryTargetMetadata = function (key, value) { var match = this.queryTargetKeyRe.exec(key); assert(match !== null, "Cannot parse query target key '" + key + "'"); var targetId = Number(match[1]); return QueryTargetMetadata.fromWebStorageEntry(targetId, value); }; /** * Parses an online state from WebStorage. Returns 'null' if the value * could not be parsed. */ WebStorageSharedClientState.prototype.fromWebStorageOnlineState = function (value) { return SharedOnlineState.fromWebStorageEntry(value); }; WebStorageSharedClientState.prototype.handleMutationBatchEvent = function (mutationBatch) { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { if (mutationBatch.user.uid !== this.currentUser.uid) { debug(LOG_TAG$10, "Ignoring mutation for non-active user " + mutationBatch.user.uid); return [2 /*return*/]; } return [2 /*return*/, this.syncEngine.applyBatchState(mutationBatch.batchId, mutationBatch.state, mutationBatch.error)]; }); }); }; WebStorageSharedClientState.prototype.handleQueryTargetEvent = function (targetMetadata) { return this.syncEngine.applyTargetState(targetMetadata.targetId, targetMetadata.state, targetMetadata.error); }; WebStorageSharedClientState.prototype.handleClientStateEvent = function (clientId, clientState) { var _this = this; var existingTargets = this.getAllActiveQueryTargets(); if (clientState) { this.activeClients[clientId] = clientState; } else { delete this.activeClients[clientId]; } var newTargets = this.getAllActiveQueryTargets(); var addedTargets = []; var removedTargets = []; newTargets.forEach(function (targetId) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { if (!existingTargets.has(targetId)) { addedTargets.push(targetId); } return [2 /*return*/]; }); }); }); existingTargets.forEach(function (targetId) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { if (!newTargets.has(targetId)) { removedTargets.push(targetId); } return [2 /*return*/]; }); }); }); return this.syncEngine.applyActiveTargetsChange(addedTargets, removedTargets); }; WebStorageSharedClientState.prototype.handleOnlineStateEvent = function (onlineState) { // We check whether the client that wrote this online state is still active // by comparing its client ID to the list of clients kept active in // IndexedDb. If a client does not update their IndexedDb client state // within 5 seconds, it is considered inactive and we don't emit an online // state event. if (this.activeClients[onlineState.clientId]) { this.onlineStateHandler(onlineState.onlineState); } }; return WebStorageSharedClientState; }()); function fromWebStorageSequenceNumber(seqString) { var sequenceNumber = ListenSequence.INVALID; if (seqString != null) { try { var parsed = JSON.parse(seqString); assert(typeof parsed === 'number', 'Found non-numeric sequence number'); sequenceNumber = parsed; } catch (e) { error(LOG_TAG$10, 'Failed to read sequence number from WebStorage', e); } } return sequenceNumber; } /** * `MemorySharedClientState` is a simple implementation of SharedClientState for * clients using memory persistence. The state in this class remains fully * isolated and no synchronization is performed. */ var MemorySharedClientState = /** @class */ (function () { function MemorySharedClientState() { this.localState = new LocalClientState(); this.queryState = {}; this.syncEngine = null; this.onlineStateHandler = null; this.sequenceNumberHandler = null; } MemorySharedClientState.prototype.addPendingMutation = function (batchId) { // No op. }; MemorySharedClientState.prototype.updateMutationState = function (batchId, state, error$$1) { // No op. }; MemorySharedClientState.prototype.addLocalQueryTarget = function (targetId) { this.localState.addQueryTarget(targetId); return this.queryState[targetId] || 'not-current'; }; MemorySharedClientState.prototype.updateQueryState = function (targetId, state, error$$1) { this.queryState[targetId] = state; }; MemorySharedClientState.prototype.removeLocalQueryTarget = function (targetId) { this.localState.removeQueryTarget(targetId); }; MemorySharedClientState.prototype.isLocalQueryTarget = function (targetId) { return this.localState.activeTargetIds.has(targetId); }; MemorySharedClientState.prototype.clearQueryState = function (targetId) { delete this.queryState[targetId]; }; MemorySharedClientState.prototype.getAllActiveQueryTargets = function () { return this.localState.activeTargetIds; }; MemorySharedClientState.prototype.isActiveQueryTarget = function (targetId) { return this.localState.activeTargetIds.has(targetId); }; MemorySharedClientState.prototype.start = function () { this.localState = new LocalClientState(); return Promise.resolve(); }; MemorySharedClientState.prototype.handleUserChange = function (user, removedBatchIds, addedBatchIds) { // No op. }; MemorySharedClientState.prototype.setOnlineState = function (onlineState) { // No op. }; MemorySharedClientState.prototype.shutdown = function () { }; MemorySharedClientState.prototype.writeSequenceNumber = function (sequenceNumber) { }; return MemorySharedClientState; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LOG_TAG$11 = 'FirestoreClient'; /** The DOMException code for an aborted operation. */ var DOM_EXCEPTION_ABORTED = 20; /** The DOMException code for quota exceeded. */ var DOM_EXCEPTION_QUOTA_EXCEEDED = 22; /** * FirestoreClient is a top-level class that constructs and owns all of the * pieces of the client SDK architecture. It is responsible for creating the * async queue that is shared by all of the other components in the system. */ var FirestoreClient = /** @class */ (function () { function FirestoreClient(platform, databaseInfo, credentials, /** * Asynchronous queue responsible for all of our internal processing. When * we get incoming work from the user (via public API) or the network * (incoming GRPC messages), we should always schedule onto this queue. * This ensures all of our work is properly serialized (e.g. we don't * start processing a new operation while the previous one is waiting for * an async I/O to complete). */ asyncQueue) { this.platform = platform; this.databaseInfo = databaseInfo; this.credentials = credentials; this.asyncQueue = asyncQueue; this.clientId = AutoId.newId(); } /** * Starts up the FirestoreClient, returning only whether or not enabling * persistence succeeded. * * The intent here is to "do the right thing" as far as users are concerned. * Namely, in cases where offline persistence is requested and possible, * enable it, but otherwise fall back to persistence disabled. For the most * part we expect this to succeed one way or the other so we don't expect our * users to actually wait on the firestore.enablePersistence Promise since * they generally won't care. * * Of course some users actually do care about whether or not persistence * was successfully enabled, so the Promise returned from this method * indicates this outcome. * * This presents a problem though: even before enablePersistence resolves or * rejects, users may have made calls to e.g. firestore.collection() which * means that the FirestoreClient in there will be available and will be * enqueuing actions on the async queue. * * Meanwhile any failure of an operation on the async queue causes it to * panic and reject any further work, on the premise that unhandled errors * are fatal. * * Consequently the fallback is handled internally here in start, and if the * fallback succeeds we signal success to the async queue even though the * start() itself signals failure. * * @param persistenceSettings Settings object to configure offline * persistence. * @returns A deferred result indicating the user-visible result of enabling * offline persistence. This method will reject this if IndexedDB fails to * start for any reason. If usePersistence is false this is * unconditionally resolved. */ FirestoreClient.prototype.start = function (persistenceSettings) { var _this = this; // We defer our initialization until we get the current user from // setChangeListener(). We block the async queue until we got the initial // user and the initialization is completed. This will prevent any scheduled // work from happening before initialization is completed. // // If initializationDone resolved then the FirestoreClient is in a usable // state. var initializationDone = new Deferred$1(); // If usePersistence is true, certain classes of errors while starting are // recoverable but only by falling back to persistence disabled. // // If there's an error in the first case but not in recovery we cannot // reject the promise blocking the async queue because this will cause the // async queue to panic. var persistenceResult = new Deferred$1(); var initialized = false; this.credentials.setChangeListener(function (user) { if (!initialized) { initialized = true; _this.initializePersistence(persistenceSettings, persistenceResult, user) .then(function () { return _this.initializeRest(user); }) .then(initializationDone.resolve, initializationDone.reject); } else { _this.asyncQueue.enqueueAndForget(function () { return _this.handleCredentialChange(user); }); } }); // Block the async queue until initialization is done this.asyncQueue.enqueueAndForget(function () { return initializationDone.promise; }); // Return only the result of enabling persistence. Note that this does not // need to await the completion of initializationDone because the result of // this method should not reflect any other kind of failure to start. return persistenceResult.promise; }; /** Enables the network connection and requeues all pending operations. */ FirestoreClient.prototype.enableNetwork = function () { var _this = this; return this.asyncQueue.enqueue(function () { return _this.syncEngine.enableNetwork(); }); }; /** * Initializes persistent storage, attempting to use IndexedDB if * usePersistence is true or memory-only if false. * * If IndexedDB fails because it's already open in another tab or because the * platform can't possibly support our implementation then this method rejects * the persistenceResult and falls back on memory-only persistence. * * @param persistenceSettings Settings object to configure offline persistence * @param persistenceResult A deferred result indicating the user-visible * result of enabling offline persistence. This method will reject this if * IndexedDB fails to start for any reason. If usePersistence is false * this is unconditionally resolved. * @returns a Promise indicating whether or not initialization should * continue, i.e. that one of the persistence implementations actually * succeeded. */ FirestoreClient.prototype.initializePersistence = function (persistenceSettings, persistenceResult, user) { var _this = this; if (persistenceSettings.enabled) { return this.startIndexedDbPersistence(user, persistenceSettings) .then(persistenceResult.resolve) .catch(function (error$$1) { // Regardless of whether or not the retry succeeds, from an user // perspective, offline persistence has failed. persistenceResult.reject(error$$1); // An unknown failure on the first stage shuts everything down. if (!_this.canFallback(error$$1)) { return Promise.reject(error$$1); } console.warn('Error enabling offline storage. Falling back to' + ' storage disabled: ' + error$$1); return _this.startMemoryPersistence(); }); } else { // When usePersistence == false, enabling offline persistence is defined // to unconditionally succeed. This allows start() to have the same // signature for both cases, despite the fact that the returned promise // is only used in the enablePersistence call. persistenceResult.resolve(); return this.startMemoryPersistence(); } }; /** * Decides whether the provided error allows us to gracefully disable * persistence (as opposed to crashing the client). */ FirestoreClient.prototype.canFallback = function (error$$1) { if (error$$1 instanceof FirestoreError) { return (error$$1.code === Code.FAILED_PRECONDITION || error$$1.code === Code.UNIMPLEMENTED); } else if (typeof DOMException !== 'undefined' && error$$1 instanceof DOMException) { // We fall back to memory persistence if we cannot write the primary // lease. This can happen can during a schema migration, or if we run out // of quota when we try to write the primary lease. // For both the `QuotaExceededError` and the `AbortError`, it is safe to // fall back to memory persistence since all modifications to IndexedDb // failed to commit. return (error$$1.code === DOM_EXCEPTION_QUOTA_EXCEEDED || error$$1.code === DOM_EXCEPTION_ABORTED); } return true; }; /** * Starts IndexedDB-based persistence. * * @returns A promise indicating success or failure. */ FirestoreClient.prototype.startIndexedDbPersistence = function (user, settings) { var _this = this; assert(settings.enabled, 'Should only start IndexedDb persitence with offline persistence enabled.'); // TODO(http://b/33384523): For now we just disable garbage collection // when persistence is enabled. var storagePrefix = IndexedDbPersistence.buildStoragePrefix(this.databaseInfo); // Opt to use proto3 JSON in case the platform doesn't support Uint8Array. var serializer = new JsonProtoSerializer(this.databaseInfo.databaseId, { useProto3Json: true }); return Promise.resolve().then(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { var _a, _b; return tslib_1.__generator(this, function (_c) { switch (_c.label) { case 0: if (settings.experimentalTabSynchronization && !WebStorageSharedClientState.isAvailable(this.platform)) { throw new FirestoreError(Code.UNIMPLEMENTED, 'IndexedDB persistence is only available on platforms that support LocalStorage.'); } if (!settings.experimentalTabSynchronization) return [3 /*break*/, 2]; this.sharedClientState = new WebStorageSharedClientState(this.asyncQueue, this.platform, storagePrefix, this.clientId, user); _a = this; return [4 /*yield*/, IndexedDbPersistence.createMultiClientIndexedDbPersistence(storagePrefix, this.clientId, this.platform, this.asyncQueue, serializer, { sequenceNumberSyncer: this.sharedClientState })]; case 1: _a.persistence = _c.sent(); return [3 /*break*/, 4]; case 2: this.sharedClientState = new MemorySharedClientState(); _b = this; return [4 /*yield*/, IndexedDbPersistence.createIndexedDbPersistence(storagePrefix, this.clientId, this.platform, this.asyncQueue, serializer)]; case 3: _b.persistence = _c.sent(); _c.label = 4; case 4: return [2 /*return*/]; } }); }); }); }; /** * Starts Memory-backed persistence. In practice this cannot fail. * * @returns A promise that will successfully resolve. */ FirestoreClient.prototype.startMemoryPersistence = function () { // Opt to use proto3 JSON in case the platform doesn't support Uint8Array. var serializer = new JsonProtoSerializer(this.databaseInfo.databaseId, { useProto3Json: true }); this.persistence = MemoryPersistence.createEagerPersistence(this.clientId, serializer); this.sharedClientState = new MemorySharedClientState(); return Promise.resolve(); }; /** * Initializes the rest of the FirestoreClient, assuming the initial user * has been obtained from the credential provider and some persistence * implementation is available in this.persistence. */ FirestoreClient.prototype.initializeRest = function (user) { var _this = this; debug(LOG_TAG$11, 'Initializing. user=', user.uid); return this.platform .loadConnection(this.databaseInfo) .then(function (connection) { return tslib_1.__awaiter(_this, void 0, void 0, function () { var _this = this; var serializer, datastore, remoteStoreOnlineStateChangedHandler, sharedClientStateOnlineStateChangedHandler; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: this.localStore = new LocalStore(this.persistence, user); serializer = this.platform.newSerializer(this.databaseInfo.databaseId); datastore = new Datastore(this.asyncQueue, connection, this.credentials, serializer); remoteStoreOnlineStateChangedHandler = function (onlineState) { return _this.syncEngine.applyOnlineStateChange(onlineState, OnlineStateSource.RemoteStore); }; sharedClientStateOnlineStateChangedHandler = function (onlineState) { return _this.syncEngine.applyOnlineStateChange(onlineState, OnlineStateSource.SharedClientState); }; this.remoteStore = new RemoteStore(this.localStore, datastore, this.asyncQueue, remoteStoreOnlineStateChangedHandler); this.syncEngine = new SyncEngine(this.localStore, this.remoteStore, this.sharedClientState, user); this.sharedClientState.onlineStateHandler = sharedClientStateOnlineStateChangedHandler; // Set up wiring between sync engine and other components this.remoteStore.syncEngine = this.syncEngine; this.sharedClientState.syncEngine = this.syncEngine; this.eventMgr = new EventManager(this.syncEngine); // PORTING NOTE: LocalStore doesn't need an explicit start() on the Web. return [4 /*yield*/, this.sharedClientState.start()]; case 1: // PORTING NOTE: LocalStore doesn't need an explicit start() on the Web. _a.sent(); return [4 /*yield*/, this.remoteStore.start()]; case 2: _a.sent(); // NOTE: This will immediately call the listener, so we make sure to // set it after localStore / remoteStore are started. return [4 /*yield*/, this.persistence.setPrimaryStateListener(function (isPrimary) { return _this.syncEngine.applyPrimaryState(isPrimary); })]; case 3: // NOTE: This will immediately call the listener, so we make sure to // set it after localStore / remoteStore are started. _a.sent(); return [2 /*return*/]; } }); }); }); }; FirestoreClient.prototype.handleCredentialChange = function (user) { this.asyncQueue.verifyOperationInProgress(); debug(LOG_TAG$11, 'Credential Changed. Current user: ' + user.uid); return this.syncEngine.handleCredentialChange(user); }; /** Disables the network connection. Pending operations will not complete. */ FirestoreClient.prototype.disableNetwork = function () { var _this = this; return this.asyncQueue.enqueue(function () { return _this.syncEngine.disableNetwork(); }); }; FirestoreClient.prototype.shutdown = function (options) { var _this = this; return this.asyncQueue.enqueue(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: // PORTING NOTE: LocalStore does not need an explicit shutdown on web. return [4 /*yield*/, this.remoteStore.shutdown()]; case 1: // PORTING NOTE: LocalStore does not need an explicit shutdown on web. _a.sent(); return [4 /*yield*/, this.sharedClientState.shutdown()]; case 2: _a.sent(); return [4 /*yield*/, this.persistence.shutdown(options && options.purgePersistenceWithDataLoss)]; case 3: _a.sent(); // `removeChangeListener` must be called after shutting down the // RemoteStore as it will prevent the RemoteStore from retrieving // auth tokens. this.credentials.removeChangeListener(); return [2 /*return*/]; } }); }); }); }; FirestoreClient.prototype.listen = function (query, observer, options) { var _this = this; var listener = new QueryListener(query, observer, options); this.asyncQueue.enqueueAndForget(function () { return _this.eventMgr.listen(listener); }); return listener; }; FirestoreClient.prototype.unlisten = function (listener) { var _this = this; this.asyncQueue.enqueueAndForget(function () { return _this.eventMgr.unlisten(listener); }); }; FirestoreClient.prototype.getDocumentFromLocalCache = function (docKey) { var _this = this; return this.asyncQueue .enqueue(function () { return _this.localStore.readDocument(docKey); }) .then(function (maybeDoc) { if (maybeDoc instanceof Document) { return maybeDoc; } else if (maybeDoc instanceof NoDocument) { return null; } else { throw new FirestoreError(Code.UNAVAILABLE, 'Failed to get document from cache. (However, this document may ' + "exist on the server. Run again without setting 'source' in " + 'the GetOptions to attempt to retrieve the document from the ' + 'server.)'); } }); }; FirestoreClient.prototype.getDocumentsFromLocalCache = function (query) { var _this = this; return this.asyncQueue .enqueue(function () { return _this.localStore.executeQuery(query); }) .then(function (docs) { var remoteKeys = documentKeySet(); var view = new View(query, remoteKeys); var viewDocChanges = view.computeDocChanges(docs); return view.applyChanges(viewDocChanges, /* updateLimboDocuments= */ false).snapshot; }); }; FirestoreClient.prototype.write = function (mutations) { var _this = this; var deferred = new Deferred$1(); this.asyncQueue.enqueueAndForget(function () { return _this.syncEngine.write(mutations, deferred); }); return deferred.promise; }; FirestoreClient.prototype.databaseId = function () { return this.databaseInfo.databaseId; }; FirestoreClient.prototype.transaction = function (updateFunction) { var _this = this; // We have to wait for the async queue to be sure syncEngine is initialized. return this.asyncQueue .enqueue(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { return [2 /*return*/]; }); }); }) .then(function () { return _this.syncEngine.runTransaction(updateFunction); }); }; return FirestoreClient; }()); /** * Copyright 2017 Google Inc. * * 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. */ /* * A wrapper implementation of Observer that will dispatch events * asynchronously. To allow immediate silencing, a mute call is added which * causes events scheduled to no longer be raised. */ var AsyncObserver = /** @class */ (function () { function AsyncObserver(observer) { this.observer = observer; /** * When set to true, will not raise future events. Necessary to deal with * async detachment of listener. */ this.muted = false; } AsyncObserver.prototype.next = function (value) { this.scheduleEvent(this.observer.next, value); }; AsyncObserver.prototype.error = function (error) { this.scheduleEvent(this.observer.error, error); }; AsyncObserver.prototype.mute = function () { this.muted = true; }; AsyncObserver.prototype.scheduleEvent = function (eventHandler, event) { var _this = this; if (!this.muted) { setTimeout(function () { if (!_this.muted) { eventHandler(event); } }, 0); } }; return AsyncObserver; }()); /** * Copyright 2017 Google Inc. * * 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. */ // The objects that are a part of this API are exposed to third-parties as // compiled javascript so we want to flag our private members with a leading // underscore to discourage their use. // tslint:disable:strip-private-property-underscore /** * A FieldPath refers to a field in a document. The path may consist of a single * field name (referring to a top-level field in the document), or a list of * field names (referring to a nested field in the document). */ var FieldPath$1 = /** @class */ (function () { /** * Creates a FieldPath from the provided field names. If more than one field * name is provided, the path will point to a nested field in a document. * * @param fieldNames A list of field names. */ function FieldPath$$1() { var fieldNames = []; for (var _i = 0; _i < arguments.length; _i++) { fieldNames[_i] = arguments[_i]; } validateNamedArrayAtLeastNumberOfElements('FieldPath', fieldNames, 'fieldNames', 1); for (var i = 0; i < fieldNames.length; ++i) { validateArgType('FieldPath', 'string', i, fieldNames[i]); if (fieldNames[i].length === 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid field name at argument $(i + 1). " + 'Field names must not be empty.'); } } this._internalPath = new FieldPath(fieldNames); } FieldPath$$1.documentId = function () { return FieldPath$$1._DOCUMENT_ID; }; FieldPath$$1.prototype.isEqual = function (other) { if (!(other instanceof FieldPath$$1)) { throw invalidClassError('isEqual', 'FieldPath', 1, other); } return this._internalPath.isEqual(other._internalPath); }; /** * Internal Note: The backend doesn't technically support querying by * document ID. Instead it queries by the entire document name (full path * included), but in the cases we currently support documentId(), the net * effect is the same. */ FieldPath$$1._DOCUMENT_ID = new FieldPath$$1(FieldPath.keyField().canonicalString()); return FieldPath$$1; }()); /** * Matches any characters in a field path string that are reserved. */ var RESERVED = new RegExp('[~\\*/\\[\\]]'); /** * Parses a field path string into a FieldPath, treating dots as separators. */ function fromDotSeparatedString(path) { var found = path.search(RESERVED); if (found >= 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid field path (" + path + "). Paths must not contain " + "'~', '*', '/', '[', or ']'"); } try { return new (FieldPath$1.bind.apply(FieldPath$1, [void 0].concat(path.split('.'))))(); } catch (e) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid field path (" + path + "). Paths must not be empty, " + "begin with '.', end with '.', or contain '..'"); } } /** * Copyright 2017 Google Inc. * * 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. */ var OAuthToken = /** @class */ (function () { function OAuthToken(value, user) { this.user = user; this.type = 'OAuth'; this.authHeaders = { Authorization: "Bearer " + value }; } return OAuthToken; }()); /** A CredentialsProvider that always yields an empty token. */ var EmptyCredentialsProvider = /** @class */ (function () { function EmptyCredentialsProvider() { /** * Stores the listener registered with setChangeListener() * This isn't actually necessary since the UID never changes, but we use this * to verify the listen contract is adhered to in tests. */ this.changeListener = null; } EmptyCredentialsProvider.prototype.getToken = function () { return Promise.resolve(null); }; EmptyCredentialsProvider.prototype.invalidateToken = function () { }; EmptyCredentialsProvider.prototype.setChangeListener = function (changeListener) { assert(!this.changeListener, 'Can only call setChangeListener() once.'); this.changeListener = changeListener; // Fire with initial user. changeListener(User.UNAUTHENTICATED); }; EmptyCredentialsProvider.prototype.removeChangeListener = function () { assert(this.changeListener !== null, 'removeChangeListener() when no listener registered'); this.changeListener = null; }; return EmptyCredentialsProvider; }()); var FirebaseCredentialsProvider = /** @class */ (function () { function FirebaseCredentialsProvider(app) { var _this = this; this.app = app; /** * The auth token listener registered with FirebaseApp, retained here so we * can unregister it. */ this.tokenListener = null; /** * Counter used to detect if the token changed while a getToken request was * outstanding. */ this.tokenCounter = 0; /** The listener registered with setChangeListener(). */ this.changeListener = null; this.forceRefresh = false; this.tokenListener = function () { _this.tokenCounter++; _this.currentUser = _this.getUser(); if (_this.changeListener) { _this.changeListener(_this.currentUser); } }; this.tokenCounter = 0; // Will fire at least once where we set this.currentUser this.app.INTERNAL.addAuthTokenListener(this.tokenListener); } FirebaseCredentialsProvider.prototype.getToken = function () { var _this = this; assert(this.tokenListener != null, 'getToken cannot be called after listener removed.'); // Take note of the current value of the tokenCounter so that this method // can fail (with an ABORTED error) if there is a token change while the // request is outstanding. var initialTokenCounter = this.tokenCounter; var forceRefresh = this.forceRefresh; this.forceRefresh = false; return this.app.INTERNAL.getToken(forceRefresh).then(function (tokenData) { // Cancel the request since the token changed while the request was // outstanding so the response is potentially for a previous user (which // user, we can't be sure). if (_this.tokenCounter !== initialTokenCounter) { throw new FirestoreError(Code.ABORTED, 'getToken aborted due to token change.'); } else { if (tokenData) { assert(typeof tokenData.accessToken === 'string', 'Invalid tokenData returned from getToken():' + tokenData); return new OAuthToken(tokenData.accessToken, _this.currentUser); } else { return null; } } }); }; FirebaseCredentialsProvider.prototype.invalidateToken = function () { this.forceRefresh = true; }; FirebaseCredentialsProvider.prototype.setChangeListener = function (changeListener) { assert(!this.changeListener, 'Can only call setChangeListener() once.'); this.changeListener = changeListener; // Fire the initial event, but only if we received the initial user if (this.currentUser) { changeListener(this.currentUser); } }; FirebaseCredentialsProvider.prototype.removeChangeListener = function () { assert(this.tokenListener != null, 'removeChangeListener() called twice'); assert(this.changeListener !== null, 'removeChangeListener() called when no listener registered'); this.app.INTERNAL.removeAuthTokenListener(this.tokenListener); this.tokenListener = null; this.changeListener = null; }; FirebaseCredentialsProvider.prototype.getUser = function () { var currentUid = this.app.INTERNAL.getUid(); assert(currentUid === null || typeof currentUid === 'string', 'Received invalid UID: ' + currentUid); return new User(currentUid); }; return FirebaseCredentialsProvider; }()); /* * FirstPartyToken provides a fresh token each time its value * is requested, because if the token is too old, requests will be rejected. * TODO(b/33147818) this implementation violates the current assumption that * tokens are immutable. We need to either revisit this assumption or come * up with some way for FPA to use the listen/unlisten interface. */ var FirstPartyToken = /** @class */ (function () { function FirstPartyToken(gapi, sessionIndex) { this.gapi = gapi; this.sessionIndex = sessionIndex; this.type = 'FirstParty'; this.user = User.FIRST_PARTY; assert(this.gapi && this.gapi['auth'] && this.gapi['auth']['getAuthHeaderValueForFirstParty'], 'unexpected gapi interface'); } Object.defineProperty(FirstPartyToken.prototype, "authHeaders", { get: function () { return { Authorization: this.gapi['auth']['getAuthHeaderValueForFirstParty']([]), 'X-Goog-AuthUser': this.sessionIndex }; }, enumerable: true, configurable: true }); return FirstPartyToken; }()); /* * Provides user credentials required for the Firestore JavaScript SDK * to authenticate the user, using technique that is only available * to applications hosted by Google. */ var FirstPartyCredentialsProvider = /** @class */ (function () { function FirstPartyCredentialsProvider(gapi, sessionIndex) { this.gapi = gapi; this.sessionIndex = sessionIndex; assert(this.gapi && this.gapi['auth'] && this.gapi['auth']['getAuthHeaderValueForFirstParty'], 'unexpected gapi interface'); } FirstPartyCredentialsProvider.prototype.getToken = function () { return Promise.resolve(new FirstPartyToken(this.gapi, this.sessionIndex)); }; // TODO(33108925): can someone switch users w/o a page refresh? // TODO(33110621): need to understand token/session lifecycle FirstPartyCredentialsProvider.prototype.setChangeListener = function (changeListener) { // Fire with initial uid. changeListener(User.FIRST_PARTY); }; FirstPartyCredentialsProvider.prototype.removeChangeListener = function () { }; FirstPartyCredentialsProvider.prototype.invalidateToken = function () { }; return FirstPartyCredentialsProvider; }()); /** * Builds a CredentialsProvider depending on the type of * the credentials passed in. */ function makeCredentialsProvider(credentials) { if (!credentials) { return new EmptyCredentialsProvider(); } switch (credentials.type) { case 'gapi': return new FirstPartyCredentialsProvider(credentials.client, credentials.sessionIndex || '0'); case 'provider': return credentials.client; default: throw new FirestoreError(Code.INVALID_ARGUMENT, 'makeCredentialsProvider failed due to invalid credential type'); } } /** * Copyright 2017 Google Inc. * * 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. */ function isPartialObserver(obj) { return implementsAnyMethods$1(obj, ['next', 'error', 'complete']); } /** * Returns true if obj is an object and contains at least one of the specified * methods. */ function implementsAnyMethods$1(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } var object = obj; for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in object && typeof object[method] === 'function') { return true; } } return false; } /** * Copyright 2017 Google Inc. * * 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. */ /** * An opaque base class for FieldValue sentinel objects in our public API, * with public static methods for creating said sentinel objects. */ // tslint:disable-next-line:class-as-namespace We use this as a base class. var FieldValueImpl = /** @class */ (function () { function FieldValueImpl(_methodName) { this._methodName = _methodName; } FieldValueImpl.delete = function () { return DeleteFieldValueImpl.instance; }; FieldValueImpl.serverTimestamp = function () { return ServerTimestampFieldValueImpl.instance; }; FieldValueImpl.arrayUnion = function () { var elements = []; for (var _i = 0; _i < arguments.length; _i++) { elements[_i] = arguments[_i]; } validateAtLeastNumberOfArgs('FieldValue.arrayUnion', arguments, 1); // NOTE: We don't actually parse the data until it's used in set() or // update() since we need access to the Firestore instance. return new ArrayUnionFieldValueImpl(elements); }; FieldValueImpl.arrayRemove = function () { var elements = []; for (var _i = 0; _i < arguments.length; _i++) { elements[_i] = arguments[_i]; } validateAtLeastNumberOfArgs('FieldValue.arrayRemove', arguments, 1); // NOTE: We don't actually parse the data until it's used in set() or // update() since we need access to the Firestore instance. return new ArrayRemoveFieldValueImpl(elements); }; FieldValueImpl.prototype.isEqual = function (other) { return this === other; }; return FieldValueImpl; }()); var DeleteFieldValueImpl = /** @class */ (function (_super) { tslib_1.__extends(DeleteFieldValueImpl, _super); function DeleteFieldValueImpl() { return _super.call(this, 'FieldValue.delete') || this; } /** Singleton instance. */ DeleteFieldValueImpl.instance = new DeleteFieldValueImpl(); return DeleteFieldValueImpl; }(FieldValueImpl)); var ServerTimestampFieldValueImpl = /** @class */ (function (_super) { tslib_1.__extends(ServerTimestampFieldValueImpl, _super); function ServerTimestampFieldValueImpl() { return _super.call(this, 'FieldValue.serverTimestamp') || this; } /** Singleton instance. */ ServerTimestampFieldValueImpl.instance = new ServerTimestampFieldValueImpl(); return ServerTimestampFieldValueImpl; }(FieldValueImpl)); var ArrayUnionFieldValueImpl = /** @class */ (function (_super) { tslib_1.__extends(ArrayUnionFieldValueImpl, _super); function ArrayUnionFieldValueImpl(_elements) { var _this = _super.call(this, 'FieldValue.arrayUnion') || this; _this._elements = _elements; return _this; } return ArrayUnionFieldValueImpl; }(FieldValueImpl)); var ArrayRemoveFieldValueImpl = /** @class */ (function (_super) { tslib_1.__extends(ArrayRemoveFieldValueImpl, _super); function ArrayRemoveFieldValueImpl(_elements) { var _this = _super.call(this, 'FieldValue.arrayRemove') || this; _this._elements = _elements; return _this; } return ArrayRemoveFieldValueImpl; }(FieldValueImpl)); // Public instance that disallows construction at runtime. This constructor is // used when exporting FieldValueImpl on firebase.firestore.FieldValue and will // be called FieldValue publicly. Internally we still use FieldValueImpl which // has a type-checked private constructor. Note that FieldValueImpl and // PublicFieldValue can be used interchangeably in instanceof checks. // For our internal TypeScript code PublicFieldValue doesn't exist as a type, // and so we need to use FieldValueImpl as type and export it too. // tslint:disable-next-line:variable-name We treat this as a class name. var PublicFieldValue = makeConstructorPrivate(FieldValueImpl, 'Use FieldValue.() instead.'); /** * Copyright 2017 Google Inc. * * 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. */ var RESERVED_FIELD_REGEX = /^__.*__$/; /** The result of parsing document data (e.g. for a setData call). */ var ParsedSetData = /** @class */ (function () { function ParsedSetData(data, fieldMask, fieldTransforms) { this.data = data; this.fieldMask = fieldMask; this.fieldTransforms = fieldTransforms; } ParsedSetData.prototype.toMutations = function (key, precondition) { var mutations = []; if (this.fieldMask !== null) { mutations.push(new PatchMutation(key, this.data, this.fieldMask, precondition)); } else { mutations.push(new SetMutation(key, this.data, precondition)); } if (this.fieldTransforms.length > 0) { mutations.push(new TransformMutation(key, this.fieldTransforms)); } return mutations; }; return ParsedSetData; }()); /** The result of parsing "update" data (i.e. for an updateData call). */ var ParsedUpdateData = /** @class */ (function () { function ParsedUpdateData(data, fieldMask, fieldTransforms) { this.data = data; this.fieldMask = fieldMask; this.fieldTransforms = fieldTransforms; } ParsedUpdateData.prototype.toMutations = function (key, precondition) { var mutations = [ new PatchMutation(key, this.data, this.fieldMask, precondition) ]; if (this.fieldTransforms.length > 0) { mutations.push(new TransformMutation(key, this.fieldTransforms)); } return mutations; }; return ParsedUpdateData; }()); /* * Represents what type of API method provided the data being parsed; useful * for determining which error conditions apply during parsing and providing * better error messages. */ var UserDataSource; (function (UserDataSource) { UserDataSource[UserDataSource["Set"] = 0] = "Set"; UserDataSource[UserDataSource["Update"] = 1] = "Update"; UserDataSource[UserDataSource["MergeSet"] = 2] = "MergeSet"; /** * Indicates the source is a where clause, cursor bound, arrayUnion() * element, etc. Of note, isWrite(source) will return false. */ UserDataSource[UserDataSource["Argument"] = 3] = "Argument"; })(UserDataSource || (UserDataSource = {})); function isWrite(dataSource) { switch (dataSource) { case UserDataSource.Set: // fall through case UserDataSource.MergeSet: // fall through case UserDataSource.Update: return true; case UserDataSource.Argument: return false; default: throw fail("Unexpected case for UserDataSource: " + dataSource); } } /** A "context" object passed around while parsing user data. */ var ParseContext = /** @class */ (function () { /** * Initializes a ParseContext with the given source and path. * * @param dataSource Indicates what kind of API method this data came from. * @param methodName The name of the method the user called to create this * ParseContext. * @param path A path within the object being parsed. This could be an empty * path (in which case the context represents the root of the data being * parsed), or a nonempty path (indicating the context represents a nested * location within the data). * @param arrayElement Whether or not this context corresponds to an element * of an array. * @param fieldTransforms A mutable list of field transforms encountered while * parsing the data. * @param fieldMask A mutable list of field paths encountered while parsing * the data. * * TODO(b/34871131): We don't support array paths right now, so path can be * null to indicate the context represents any location within an array (in * which case certain features will not work and errors will be somewhat * compromised). */ function ParseContext(dataSource, methodName, path, arrayElement, fieldTransforms, fieldMask) { this.dataSource = dataSource; this.methodName = methodName; this.path = path; this.arrayElement = arrayElement; // Minor hack: If fieldTransforms is undefined, we assume this is an // external call and we need to validate the entire path. if (fieldTransforms === undefined) { this.validatePath(); } this.arrayElement = arrayElement !== undefined ? arrayElement : false; this.fieldTransforms = fieldTransforms || []; this.fieldMask = fieldMask || []; } ParseContext.prototype.childContextForField = function (field) { var childPath = this.path == null ? null : this.path.child(field); var context = new ParseContext(this.dataSource, this.methodName, childPath, /*arrayElement=*/ false, this.fieldTransforms, this.fieldMask); context.validatePathSegment(field); return context; }; ParseContext.prototype.childContextForFieldPath = function (field) { var childPath = this.path == null ? null : this.path.child(field); var context = new ParseContext(this.dataSource, this.methodName, childPath, /*arrayElement=*/ false, this.fieldTransforms, this.fieldMask); context.validatePath(); return context; }; ParseContext.prototype.childContextForArray = function (index) { // TODO(b/34871131): We don't support array paths right now; so make path // null. return new ParseContext(this.dataSource, this.methodName, /*path=*/ null, /*arrayElement=*/ true, this.fieldTransforms, this.fieldMask); }; ParseContext.prototype.createError = function (reason) { var fieldDescription = this.path === null || this.path.isEmpty() ? '' : " (found in field " + this.path.toString() + ")"; return new FirestoreError(Code.INVALID_ARGUMENT, "Function " + this.methodName + "() called with invalid data. " + reason + fieldDescription); }; /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ ParseContext.prototype.contains = function (fieldPath) { return (this.fieldMask.find(function (field) { return fieldPath.isPrefixOf(field); }) !== undefined || this.fieldTransforms.find(function (transform) { return fieldPath.isPrefixOf(transform.field); }) !== undefined); }; ParseContext.prototype.validatePath = function () { // TODO(b/34871131): Remove null check once we have proper paths for fields // within arrays. if (this.path === null) { return; } for (var i = 0; i < this.path.length; i++) { this.validatePathSegment(this.path.get(i)); } }; ParseContext.prototype.validatePathSegment = function (segment) { if (isWrite(this.dataSource) && RESERVED_FIELD_REGEX.test(segment)) { throw this.createError('Document fields cannot begin and end with __'); } }; return ParseContext; }()); /** * A placeholder object for DocumentReferences in this file, in order to * avoid a circular dependency. See the comments for `DataPreConverter` for * the full context. */ var DocumentKeyReference = /** @class */ (function () { function DocumentKeyReference(databaseId, key) { this.databaseId = databaseId; this.key = key; } return DocumentKeyReference; }()); /** * Helper for parsing raw user input (provided via the API) into internal model * classes. */ var UserDataConverter = /** @class */ (function () { function UserDataConverter(preConverter) { this.preConverter = preConverter; } /** Parse document data from a non-merge set() call. */ UserDataConverter.prototype.parseSetData = function (methodName, input) { var context = new ParseContext(UserDataSource.Set, methodName, FieldPath.EMPTY_PATH); validatePlainObject('Data must be an object, but it was:', context, input); var updateData = this.parseData(input, context); return new ParsedSetData(updateData, /* fieldMask= */ null, context.fieldTransforms); }; /** Parse document data from a set() call with '{merge:true}'. */ UserDataConverter.prototype.parseMergeData = function (methodName, input, fieldPaths) { var context = new ParseContext(UserDataSource.MergeSet, methodName, FieldPath.EMPTY_PATH); validatePlainObject('Data must be an object, but it was:', context, input); var updateData = this.parseData(input, context); var fieldMask; var fieldTransforms; if (!fieldPaths) { fieldMask = new FieldMask(context.fieldMask); fieldTransforms = context.fieldTransforms; } else { var validatedFieldPaths = []; for (var _i = 0, fieldPaths_1 = fieldPaths; _i < fieldPaths_1.length; _i++) { var stringOrFieldPath = fieldPaths_1[_i]; var fieldPath = void 0; if (stringOrFieldPath instanceof FieldPath$1) { fieldPath = stringOrFieldPath._internalPath; } else if (typeof stringOrFieldPath === 'string') { fieldPath = fieldPathFromDotSeparatedString(methodName, stringOrFieldPath); } else { throw fail('Expected stringOrFieldPath to be a string or a FieldPath'); } if (!context.contains(fieldPath)) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Field '" + fieldPath + "' is specified in your field mask but missing from your input data."); } validatedFieldPaths.push(fieldPath); } fieldMask = new FieldMask(validatedFieldPaths); fieldTransforms = context.fieldTransforms.filter(function (transform) { return fieldMask.covers(transform.field); }); } return new ParsedSetData(updateData, fieldMask, fieldTransforms); }; /** Parse update data from an update() call. */ UserDataConverter.prototype.parseUpdateData = function (methodName, input) { var _this = this; var context = new ParseContext(UserDataSource.Update, methodName, FieldPath.EMPTY_PATH); validatePlainObject('Data must be an object, but it was:', context, input); var fieldMaskPaths = []; var updateData = ObjectValue.EMPTY; forEach(input, function (key, value) { var path = fieldPathFromDotSeparatedString(methodName, key); var childContext = context.childContextForFieldPath(path); value = _this.runPreConverter(value, childContext); if (value instanceof DeleteFieldValueImpl) { // Add it to the field mask, but don't add anything to updateData. fieldMaskPaths.push(path); } else { var parsedValue = _this.parseData(value, childContext); if (parsedValue != null) { fieldMaskPaths.push(path); updateData = updateData.set(path, parsedValue); } } }); var mask = new FieldMask(fieldMaskPaths); return new ParsedUpdateData(updateData, mask, context.fieldTransforms); }; /** Parse update data from a list of field/value arguments. */ UserDataConverter.prototype.parseUpdateVarargs = function (methodName, field, value, moreFieldsAndValues) { var context = new ParseContext(UserDataSource.Update, methodName, FieldPath.EMPTY_PATH); var keys = [fieldPathFromArgument(methodName, field)]; var values$$1 = [value]; if (moreFieldsAndValues.length % 2 !== 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + methodName + "() needs to be called with an even number " + 'of arguments that alternate between field names and values.'); } for (var i = 0; i < moreFieldsAndValues.length; i += 2) { keys.push(fieldPathFromArgument(methodName, moreFieldsAndValues[i])); values$$1.push(moreFieldsAndValues[i + 1]); } var fieldMaskPaths = []; var updateData = ObjectValue.EMPTY; for (var i = 0; i < keys.length; ++i) { var path = keys[i]; var childContext = context.childContextForFieldPath(path); var value_1 = this.runPreConverter(values$$1[i], childContext); if (value_1 instanceof DeleteFieldValueImpl) { // Add it to the field mask, but don't add anything to updateData. fieldMaskPaths.push(path); } else { var parsedValue = this.parseData(value_1, childContext); if (parsedValue != null) { fieldMaskPaths.push(path); updateData = updateData.set(path, parsedValue); } } } var mask = new FieldMask(fieldMaskPaths); return new ParsedUpdateData(updateData, mask, context.fieldTransforms); }; /** * Parse a "query value" (e.g. value in a where filter or a value in a cursor * bound). */ UserDataConverter.prototype.parseQueryValue = function (methodName, input) { var context = new ParseContext(UserDataSource.Argument, methodName, FieldPath.EMPTY_PATH); var parsed = this.parseData(input, context); assert(parsed != null, 'Parsed data should not be null.'); assert(context.fieldTransforms.length === 0, 'Field transforms should have been disallowed.'); return parsed; }; /** Sends data through this.preConverter, handling any thrown errors. */ UserDataConverter.prototype.runPreConverter = function (input, context) { try { return this.preConverter(input); } catch (e) { var message = errorMessage(e); throw context.createError(message); } }; /** * Internal helper for parsing user data. * * @param input Data to be parsed. * @param context A context object representing the current path being parsed, * the source of the data being parsed, etc. * @return The parsed value, or null if the value was a FieldValue sentinel * that should not be included in the resulting parsed data. */ UserDataConverter.prototype.parseData = function (input, context) { input = this.runPreConverter(input, context); if (looksLikeJsonObject(input)) { validatePlainObject('Unsupported field value:', context, input); return this.parseObject(input, context); } else if (input instanceof FieldValueImpl) { // FieldValues usually parse into transforms (except FieldValue.delete()) // in which case we do not want to include this field in our parsed data // (as doing so will overwrite the field directly prior to the transform // trying to transform it). So we don't add this location to // context.fieldMask and we return null as our parsing result. this.parseSentinelFieldValue(input, context); return null; } else { // If context.path is null we are inside an array and we don't support // field mask paths more granular than the top-level array. if (context.path) { context.fieldMask.push(context.path); } if (input instanceof Array) { // TODO(b/34871131): Include the path containing the array in the error // message. if (context.arrayElement) { throw context.createError('Nested arrays are not supported'); } return this.parseArray(input, context); } else { return this.parseScalarValue(input, context); } } }; UserDataConverter.prototype.parseObject = function (obj, context) { var _this = this; var result = new SortedMap(primitiveComparator); if (isEmpty(obj)) { // If we encounter an empty object, we explicitly add it to the update // mask to ensure that the server creates a map entry. if (context.path && context.path.length > 0) { context.fieldMask.push(context.path); } } else { forEach(obj, function (key, val) { var parsedValue = _this.parseData(val, context.childContextForField(key)); if (parsedValue != null) { result = result.insert(key, parsedValue); } }); } return new ObjectValue(result); }; UserDataConverter.prototype.parseArray = function (array, context) { var result = []; var entryIndex = 0; for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { var entry = array_1[_i]; var parsedEntry = this.parseData(entry, context.childContextForArray(entryIndex)); if (parsedEntry == null) { // Just include nulls in the array for fields being replaced with a // sentinel. parsedEntry = NullValue.INSTANCE; } result.push(parsedEntry); entryIndex++; } return new ArrayValue(result); }; /** * "Parses" the provided FieldValueImpl, adding any necessary transforms to * context.fieldTransforms. */ UserDataConverter.prototype.parseSentinelFieldValue = function (value, context) { // Sentinels are only supported with writes, and not within arrays. if (!isWrite(context.dataSource)) { throw context.createError(value._methodName + "() can only be used with update() and set()"); } if (context.path === null) { throw context.createError(value._methodName + "() is not currently supported inside arrays"); } if (value instanceof DeleteFieldValueImpl) { if (context.dataSource === UserDataSource.MergeSet) { // No transform to add for a delete, but we need to add it to our // fieldMask so it gets deleted. context.fieldMask.push(context.path); } else if (context.dataSource === UserDataSource.Update) { assert(context.path.length > 0, 'FieldValue.delete() at the top level should have already' + ' been handled.'); throw context.createError('FieldValue.delete() can only appear at the top level ' + 'of your update data'); } else { // We shouldn't encounter delete sentinels for queries or non-merge set() calls. throw context.createError('FieldValue.delete() cannot be used with set() unless you pass ' + '{merge:true}'); } } else if (value instanceof ServerTimestampFieldValueImpl) { context.fieldTransforms.push(new FieldTransform(context.path, ServerTimestampTransform.instance)); } else if (value instanceof ArrayUnionFieldValueImpl) { var parsedElements = this.parseArrayTransformElements(value._methodName, value._elements); var arrayUnion = new ArrayUnionTransformOperation(parsedElements); context.fieldTransforms.push(new FieldTransform(context.path, arrayUnion)); } else if (value instanceof ArrayRemoveFieldValueImpl) { var parsedElements = this.parseArrayTransformElements(value._methodName, value._elements); var arrayRemove = new ArrayRemoveTransformOperation(parsedElements); context.fieldTransforms.push(new FieldTransform(context.path, arrayRemove)); } else { fail('Unknown FieldValue type: ' + value); } }; /** * Helper to parse a scalar value (i.e. not an Object, Array, or FieldValue) * * @return The parsed value */ UserDataConverter.prototype.parseScalarValue = function (value, context) { if (value === null) { return NullValue.INSTANCE; } else if (typeof value === 'number') { if (isSafeInteger(value)) { return new IntegerValue(value); } else { return new DoubleValue(value); } } else if (typeof value === 'boolean') { return BooleanValue.of(value); } else if (typeof value === 'string') { return new StringValue(value); } else if (value instanceof Date) { return new TimestampValue(Timestamp.fromDate(value)); } else if (value instanceof Timestamp) { // Firestore backend truncates precision down to microseconds. To ensure // offline mode works the same with regards to truncation, perform the // truncation immediately without waiting for the backend to do that. return new TimestampValue(new Timestamp(value.seconds, Math.floor(value.nanoseconds / 1000) * 1000)); } else if (value instanceof GeoPoint) { return new GeoPointValue(value); } else if (value instanceof Blob) { return new BlobValue(value); } else if (value instanceof DocumentKeyReference) { return new RefValue(value.databaseId, value.key); } else { throw context.createError("Unsupported field value: " + valueDescription(value)); } }; UserDataConverter.prototype.parseArrayTransformElements = function (methodName, elements) { var _this = this; return elements.map(function (element, i) { // Although array transforms are used with writes, the actual elements // being unioned or removed are not considered writes since they cannot // contain any FieldValue sentinels, etc. var context = new ParseContext(UserDataSource.Argument, methodName, FieldPath.EMPTY_PATH); return _this.parseData(element, context.childContextForArray(i)); }); }; return UserDataConverter; }()); /** * Checks whether an object looks like a JSON object that should be converted * into a struct. Normal class/prototype instances are considered to look like * JSON objects since they should be converted to a struct value. Arrays, Dates, * GeoPoints, etc. are not considered to look like JSON objects since they map * to specific FieldValue types other than ObjectValue. */ function looksLikeJsonObject(input) { return (typeof input === 'object' && input !== null && !(input instanceof Array) && !(input instanceof Date) && !(input instanceof Timestamp) && !(input instanceof GeoPoint) && !(input instanceof Blob) && !(input instanceof DocumentKeyReference) && !(input instanceof FieldValueImpl)); } function validatePlainObject(message, context, input) { if (!looksLikeJsonObject(input) || !isPlainObject(input)) { var description = valueDescription(input); if (description === 'an object') { // Massage the error if it was an object. throw context.createError(message + ' a custom object'); } else { throw context.createError(message + ' ' + description); } } } /** * Helper that calls fromDotSeparatedString() but wraps any error thrown. */ function fieldPathFromArgument(methodName, path) { if (path instanceof FieldPath$1) { return path._internalPath; } else if (typeof path === 'string') { return fieldPathFromDotSeparatedString(methodName, path); } else { var message = 'Field path arguments must be of type string or FieldPath.'; throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + methodName + "() called with invalid data. " + message); } } /** * Wraps fromDotSeparatedString with an error message about the method that * was thrown. * @param methodName The publicly visible method name * @param path The dot-separated string form of a field path which will be split * on dots. */ function fieldPathFromDotSeparatedString(methodName, path) { try { return fromDotSeparatedString(path)._internalPath; } catch (e) { var message = errorMessage(e); throw new FirestoreError(Code.INVALID_ARGUMENT, "Function " + methodName + "() called with invalid data. " + message); } } /** * Extracts the message from a caught exception, which should be an Error object * though JS doesn't guarantee that. */ function errorMessage(error) { return error instanceof Error ? error.message : error.toString(); } /** * Copyright 2017 Google Inc. * * 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. */ // The objects that are a part of this API are exposed to third-parties as // compiled javascript so we want to flag our private members with a leading // underscore to discourage their use. // tslint:disable:strip-private-property-underscore // settings() defaults: var DEFAULT_HOST = 'firestore.googleapis.com'; var DEFAULT_SSL = true; var DEFAULT_TIMESTAMPS_IN_SNAPSHOTS = false; // enablePersistence() defaults: var DEFAULT_SYNCHRONIZE_TABS = false; /** * A concrete type describing all the values that can be applied via a * user-supplied firestore.Settings object. This is a separate type so that * defaults can be supplied and the value can be checked for equality. */ var FirestoreSettings = /** @class */ (function () { function FirestoreSettings(settings) { if (settings.host === undefined) { if (settings.ssl !== undefined) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set"); } this.host = DEFAULT_HOST; this.ssl = DEFAULT_SSL; } else { validateNamedType('settings', 'non-empty string', 'host', settings.host); this.host = settings.host; validateNamedOptionalType('settings', 'boolean', 'ssl', settings.ssl); this.ssl = defaulted(settings.ssl, DEFAULT_SSL); } validateOptionNames('settings', settings, [ 'host', 'ssl', 'credentials', 'timestampsInSnapshots' ]); validateNamedOptionalType('settings', 'object', 'credentials', settings.credentials); this.credentials = settings.credentials; validateNamedOptionalType('settings', 'boolean', 'timestampsInSnapshots', settings.timestampsInSnapshots); this.timestampsInSnapshots = defaulted(settings.timestampsInSnapshots, DEFAULT_TIMESTAMPS_IN_SNAPSHOTS); } FirestoreSettings.prototype.isEqual = function (other) { return (this.host === other.host && this.ssl === other.ssl && this.timestampsInSnapshots === other.timestampsInSnapshots && this.credentials === other.credentials); }; return FirestoreSettings; }()); var FirestoreConfig = /** @class */ (function () { function FirestoreConfig() { } return FirestoreConfig; }()); /** * Encapsulates the settings that can be used to configure Firestore * persistence. */ var PersistenceSettings = /** @class */ (function () { function PersistenceSettings(enabled, settings) { this.enabled = enabled; assert(enabled || !settings, 'Can only provide PersistenceSettings with persistence enabled'); settings = settings || {}; this.experimentalTabSynchronization = defaulted(settings.experimentalTabSynchronization, DEFAULT_SYNCHRONIZE_TABS); } PersistenceSettings.prototype.isEqual = function (other) { return (this.enabled === other.enabled && this.experimentalTabSynchronization === other.experimentalTabSynchronization); }; return PersistenceSettings; }()); /** * The root reference to the database. */ var Firestore = /** @class */ (function () { function Firestore(databaseIdOrApp) { var _this = this; // Public for use in tests. // TODO(mikelehen): Use modularized initialization instead. this._queue = new AsyncQueue(); this.INTERNAL = { delete: function (options) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { if (this._firestoreClient) { return [2 /*return*/, this._firestoreClient.shutdown(options)]; } return [2 /*return*/]; }); }); } }; var config = new FirestoreConfig(); if (typeof databaseIdOrApp.options === 'object') { // This is very likely a Firebase app object // TODO(b/34177605): Can we somehow use instanceof? var app = databaseIdOrApp; config.firebaseApp = app; config.databaseId = Firestore.databaseIdFromApp(app); config.persistenceKey = config.firebaseApp.name; config.credentials = new FirebaseCredentialsProvider(app); } else { var external_1 = databaseIdOrApp; if (!external_1.projectId) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Must provide projectId'); } config.databaseId = new DatabaseId(external_1.projectId, external_1.database); // Use a default persistenceKey that lines up with FirebaseApp. config.persistenceKey = '[DEFAULT]'; config.credentials = new EmptyCredentialsProvider(); } config.settings = new FirestoreSettings({}); this._config = config; this._databaseId = config.databaseId; } Firestore.prototype.settings = function (settingsLiteral) { validateExactNumberOfArgs('Firestore.settings', arguments, 1); validateArgType('Firestore.settings', 'object', 1, settingsLiteral); if (contains(settingsLiteral, 'persistence')) { throw new FirestoreError(Code.INVALID_ARGUMENT, '"persistence" is now specified with a separate call to ' + 'firestore.enablePersistence().'); } var newSettings = new FirestoreSettings(settingsLiteral); if (this._firestoreClient && !this._config.settings.isEqual(newSettings)) { throw new FirestoreError(Code.FAILED_PRECONDITION, 'Firestore has already been started and its settings can no longer ' + 'be changed. You can only call settings() before calling any other ' + 'methods on a Firestore object.'); } this._config.settings = newSettings; if (newSettings.credentials !== undefined) { this._config.credentials = makeCredentialsProvider(newSettings.credentials); } }; Firestore.prototype.enableNetwork = function () { this.ensureClientConfigured(); return this._firestoreClient.enableNetwork(); }; Firestore.prototype.disableNetwork = function () { this.ensureClientConfigured(); return this._firestoreClient.disableNetwork(); }; Firestore.prototype.enablePersistence = function (settings) { if (this._firestoreClient) { throw new FirestoreError(Code.FAILED_PRECONDITION, 'Firestore has already been started and persistence can no longer ' + 'be enabled. You can only call enablePersistence() before calling ' + 'any other methods on a Firestore object.'); } return this.configureClient(new PersistenceSettings(/* enabled= */ true, settings)); }; Firestore.prototype.ensureClientConfigured = function () { if (!this._firestoreClient) { // Kick off starting the client but don't actually wait for it. // tslint:disable-next-line:no-floating-promises this.configureClient(new PersistenceSettings(/* enabled= */ false)); } return this._firestoreClient; }; Firestore.prototype.configureClient = function (persistenceSettings) { var _this = this; assert(!!this._config.settings.host, 'FirestoreSettings.host cannot be falsey'); if (!this._config.settings.timestampsInSnapshots) { error("\nThe behavior for Date objects stored in Firestore is going to change\nAND YOUR APP MAY BREAK.\nTo hide this warning and ensure your app does not break, you need to add the\nfollowing code to your app before calling any other Cloud Firestore methods:\n\n const firestore = firebase.firestore();\n const settings = {/* your settings... */ timestampsInSnapshots: true};\n firestore.settings(settings);\n\nWith this change, timestamps stored in Cloud Firestore will be read back as\nFirebase Timestamp objects instead of as system Date objects. So you will also\nneed to update code expecting a Date to instead expect a Timestamp. For example:\n\n // Old:\n const date = snapshot.get('created_at');\n // New:\n const timestamp = snapshot.get('created_at');\n const date = timestamp.toDate();\n\nPlease audit all existing usages of Date when you enable the new behavior. In a\nfuture release, the behavior will change to the new behavior, so if you do not\nfollow these steps, YOUR APP MAY BREAK."); } assert(!this._firestoreClient, 'configureClient() called multiple times'); var databaseInfo = new DatabaseInfo(this._config.databaseId, this._config.persistenceKey, this._config.settings.host, this._config.settings.ssl); var preConverter = function (value) { if (value instanceof DocumentReference) { var thisDb = _this._config.databaseId; var otherDb = value.firestore._config.databaseId; if (!otherDb.isEqual(thisDb)) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Document reference is for database ' + (otherDb.projectId + "/" + otherDb.database + " but should be ") + ("for database " + thisDb.projectId + "/" + thisDb.database)); } return new DocumentKeyReference(_this._config.databaseId, value._key); } else { return value; } }; this._dataConverter = new UserDataConverter(preConverter); this._firestoreClient = new FirestoreClient(PlatformSupport.getPlatform(), databaseInfo, this._config.credentials, this._queue); return this._firestoreClient.start(persistenceSettings); }; Firestore.databaseIdFromApp = function (app) { var options = app.options; if (!contains(options, 'projectId')) { throw new FirestoreError(Code.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.'); } var projectId = options['projectId']; if (!projectId || typeof projectId !== 'string') { throw new FirestoreError(Code.INVALID_ARGUMENT, 'projectId must be a string in FirebaseApp.options'); } return new DatabaseId(projectId); }; Object.defineProperty(Firestore.prototype, "app", { get: function () { if (!this._config.firebaseApp) { throw new FirestoreError(Code.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is " + 'not available'); } return this._config.firebaseApp; }, enumerable: true, configurable: true }); Firestore.prototype.collection = function (pathString) { validateExactNumberOfArgs('Firestore.collection', arguments, 1); validateArgType('Firestore.collection', 'non-empty string', 1, pathString); if (!pathString) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Must provide a non-empty collection path to collection()'); } this.ensureClientConfigured(); return new CollectionReference(ResourcePath.fromString(pathString), this); }; Firestore.prototype.doc = function (pathString) { validateExactNumberOfArgs('Firestore.doc', arguments, 1); validateArgType('Firestore.doc', 'non-empty string', 1, pathString); if (!pathString) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Must provide a non-empty document path to doc()'); } this.ensureClientConfigured(); return DocumentReference.forPath(ResourcePath.fromString(pathString), this); }; Firestore.prototype.runTransaction = function (updateFunction) { var _this = this; validateExactNumberOfArgs('Firestore.runTransaction', arguments, 1); validateArgType('Firestore.runTransaction', 'function', 1, updateFunction); return this.ensureClientConfigured().transaction(function (transaction) { return updateFunction(new Transaction$1(_this, transaction)); }); }; Firestore.prototype.batch = function () { this.ensureClientConfigured(); return new WriteBatch(this); }; Object.defineProperty(Firestore, "logLevel", { get: function () { switch (getLogLevel()) { case LogLevel.DEBUG: return 'debug'; case LogLevel.ERROR: return 'error'; case LogLevel.SILENT: return 'silent'; default: return fail('Unknown log level: ' + getLogLevel()); } }, enumerable: true, configurable: true }); Firestore.setLogLevel = function (level) { validateExactNumberOfArgs('Firestore.setLogLevel', arguments, 1); validateArgType('Firestore.setLogLevel', 'non-empty string', 1, level); switch (level) { case 'debug': setLogLevel(LogLevel.DEBUG); break; case 'error': setLogLevel(LogLevel.ERROR); break; case 'silent': setLogLevel(LogLevel.SILENT); break; default: throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid log level: ' + level); } }; // Note: this is not a property because the minifier can't work correctly with // the way TypeScript compiler outputs properties. Firestore.prototype._areTimestampsInSnapshotsEnabled = function () { return this._config.settings.timestampsInSnapshots; }; return Firestore; }()); /** * A reference to a transaction. */ var Transaction$1 = /** @class */ (function () { function Transaction(_firestore, _transaction) { this._firestore = _firestore; this._transaction = _transaction; } Transaction.prototype.get = function (documentRef) { var _this = this; validateExactNumberOfArgs('Transaction.get', arguments, 1); var ref = validateReference('Transaction.get', documentRef, this._firestore); return this._transaction .lookup([ref._key]) .then(function (docs) { if (!docs || docs.length !== 1) { return fail('Mismatch in docs returned from document lookup.'); } var doc = docs[0]; if (doc instanceof NoDocument) { return new DocumentSnapshot(_this._firestore, ref._key, null, /* fromCache= */ false, /* hasPendingWrites= */ false); } else if (doc instanceof Document) { return new DocumentSnapshot(_this._firestore, ref._key, doc, /* fromCache= */ false, /* hasPendingWrites= */ false); } else { throw fail("BatchGetDocumentsRequest returned unexpected document type: " + doc.constructor.name); } }); }; Transaction.prototype.set = function (documentRef, value, options) { validateBetweenNumberOfArgs('Transaction.set', arguments, 2, 3); var ref = validateReference('Transaction.set', documentRef, this._firestore); options = validateSetOptions('Transaction.set', options); var parsed = options.merge || options.mergeFields ? this._firestore._dataConverter.parseMergeData('Transaction.set', value, options.mergeFields) : this._firestore._dataConverter.parseSetData('Transaction.set', value); this._transaction.set(ref._key, parsed); return this; }; Transaction.prototype.update = function (documentRef, fieldOrUpdateData, value) { var moreFieldsAndValues = []; for (var _i = 3; _i < arguments.length; _i++) { moreFieldsAndValues[_i - 3] = arguments[_i]; } var ref; var parsed; if (typeof fieldOrUpdateData === 'string' || fieldOrUpdateData instanceof FieldPath$1) { validateAtLeastNumberOfArgs('Transaction.update', arguments, 3); ref = validateReference('Transaction.update', documentRef, this._firestore); parsed = this._firestore._dataConverter.parseUpdateVarargs('Transaction.update', fieldOrUpdateData, value, moreFieldsAndValues); } else { validateExactNumberOfArgs('Transaction.update', arguments, 2); ref = validateReference('Transaction.update', documentRef, this._firestore); parsed = this._firestore._dataConverter.parseUpdateData('Transaction.update', fieldOrUpdateData); } this._transaction.update(ref._key, parsed); return this; }; Transaction.prototype.delete = function (documentRef) { validateExactNumberOfArgs('Transaction.delete', arguments, 1); var ref = validateReference('Transaction.delete', documentRef, this._firestore); this._transaction.delete(ref._key); return this; }; return Transaction; }()); var WriteBatch = /** @class */ (function () { function WriteBatch(_firestore) { this._firestore = _firestore; this._mutations = []; this._committed = false; } WriteBatch.prototype.set = function (documentRef, value, options) { validateBetweenNumberOfArgs('WriteBatch.set', arguments, 2, 3); this.verifyNotCommitted(); var ref = validateReference('WriteBatch.set', documentRef, this._firestore); options = validateSetOptions('WriteBatch.set', options); var parsed = options.merge || options.mergeFields ? this._firestore._dataConverter.parseMergeData('WriteBatch.set', value, options.mergeFields) : this._firestore._dataConverter.parseSetData('WriteBatch.set', value); this._mutations = this._mutations.concat(parsed.toMutations(ref._key, Precondition.NONE)); return this; }; WriteBatch.prototype.update = function (documentRef, fieldOrUpdateData, value) { var moreFieldsAndValues = []; for (var _i = 3; _i < arguments.length; _i++) { moreFieldsAndValues[_i - 3] = arguments[_i]; } this.verifyNotCommitted(); var ref; var parsed; if (typeof fieldOrUpdateData === 'string' || fieldOrUpdateData instanceof FieldPath$1) { validateAtLeastNumberOfArgs('WriteBatch.update', arguments, 3); ref = validateReference('WriteBatch.update', documentRef, this._firestore); parsed = this._firestore._dataConverter.parseUpdateVarargs('WriteBatch.update', fieldOrUpdateData, value, moreFieldsAndValues); } else { validateExactNumberOfArgs('WriteBatch.update', arguments, 2); ref = validateReference('WriteBatch.update', documentRef, this._firestore); parsed = this._firestore._dataConverter.parseUpdateData('WriteBatch.update', fieldOrUpdateData); } this._mutations = this._mutations.concat(parsed.toMutations(ref._key, Precondition.exists(true))); return this; }; WriteBatch.prototype.delete = function (documentRef) { validateExactNumberOfArgs('WriteBatch.delete', arguments, 1); this.verifyNotCommitted(); var ref = validateReference('WriteBatch.delete', documentRef, this._firestore); this._mutations = this._mutations.concat(new DeleteMutation(ref._key, Precondition.NONE)); return this; }; WriteBatch.prototype.commit = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { this.verifyNotCommitted(); this._committed = true; if (this._mutations.length > 0) { return [2 /*return*/, this._firestore.ensureClientConfigured().write(this._mutations)]; } return [2 /*return*/]; }); }); }; WriteBatch.prototype.verifyNotCommitted = function () { if (this._committed) { throw new FirestoreError(Code.FAILED_PRECONDITION, 'A write batch can no longer be used after commit() ' + 'has been called.'); } }; return WriteBatch; }()); /** * A reference to a particular document in a collection in the database. */ var DocumentReference = /** @class */ (function () { function DocumentReference(_key, firestore) { this._key = _key; this.firestore = firestore; this._firestoreClient = this.firestore.ensureClientConfigured(); } DocumentReference.forPath = function (path, firestore) { if (path.length % 2 !== 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid document reference. Document ' + 'references must have an even number of segments, but ' + (path.canonicalString() + " has " + path.length)); } return new DocumentReference(new DocumentKey(path), firestore); }; Object.defineProperty(DocumentReference.prototype, "id", { get: function () { return this._key.path.lastSegment(); }, enumerable: true, configurable: true }); Object.defineProperty(DocumentReference.prototype, "parent", { get: function () { return new CollectionReference(this._key.path.popLast(), this.firestore); }, enumerable: true, configurable: true }); Object.defineProperty(DocumentReference.prototype, "path", { get: function () { return this._key.path.canonicalString(); }, enumerable: true, configurable: true }); DocumentReference.prototype.collection = function (pathString) { validateExactNumberOfArgs('DocumentReference.collection', arguments, 1); validateArgType('DocumentReference.collection', 'non-empty string', 1, pathString); if (!pathString) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Must provide a non-empty collection name to collection()'); } var path = ResourcePath.fromString(pathString); return new CollectionReference(this._key.path.child(path), this.firestore); }; DocumentReference.prototype.isEqual = function (other) { if (!(other instanceof DocumentReference)) { throw invalidClassError('isEqual', 'DocumentReference', 1, other); } return this.firestore === other.firestore && this._key.isEqual(other._key); }; DocumentReference.prototype.set = function (value, options) { validateBetweenNumberOfArgs('DocumentReference.set', arguments, 1, 2); options = validateSetOptions('DocumentReference.set', options); var parsed = options.merge || options.mergeFields ? this.firestore._dataConverter.parseMergeData('DocumentReference.set', value, options.mergeFields) : this.firestore._dataConverter.parseSetData('DocumentReference.set', value); return this._firestoreClient.write(parsed.toMutations(this._key, Precondition.NONE)); }; DocumentReference.prototype.update = function (fieldOrUpdateData, value) { var moreFieldsAndValues = []; for (var _i = 2; _i < arguments.length; _i++) { moreFieldsAndValues[_i - 2] = arguments[_i]; } var parsed; if (typeof fieldOrUpdateData === 'string' || fieldOrUpdateData instanceof FieldPath$1) { validateAtLeastNumberOfArgs('DocumentReference.update', arguments, 2); parsed = this.firestore._dataConverter.parseUpdateVarargs('DocumentReference.update', fieldOrUpdateData, value, moreFieldsAndValues); } else { validateExactNumberOfArgs('DocumentReference.update', arguments, 1); parsed = this.firestore._dataConverter.parseUpdateData('DocumentReference.update', fieldOrUpdateData); } return this._firestoreClient.write(parsed.toMutations(this._key, Precondition.exists(true))); }; DocumentReference.prototype.delete = function () { validateExactNumberOfArgs('DocumentReference.delete', arguments, 0); return this._firestoreClient.write([ new DeleteMutation(this._key, Precondition.NONE) ]); }; DocumentReference.prototype.onSnapshot = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } validateBetweenNumberOfArgs('DocumentReference.onSnapshot', arguments, 1, 4); var options = { includeMetadataChanges: false }; var observer; var currArg = 0; if (typeof args[currArg] === 'object' && !isPartialObserver(args[currArg])) { options = args[currArg]; validateOptionNames('DocumentReference.onSnapshot', options, [ 'includeMetadataChanges' ]); validateNamedOptionalType('DocumentReference.onSnapshot', 'boolean', 'includeMetadataChanges', options.includeMetadataChanges); currArg++; } var internalOptions = { includeMetadataChanges: options.includeMetadataChanges }; if (isPartialObserver(args[currArg])) { observer = args[currArg]; } else { validateArgType('DocumentReference.onSnapshot', 'function', currArg, args[currArg]); validateOptionalArgType('DocumentReference.onSnapshot', 'function', currArg + 1, args[currArg + 1]); validateOptionalArgType('DocumentReference.onSnapshot', 'function', currArg + 2, args[currArg + 2]); observer = { next: args[currArg], error: args[currArg + 1], complete: args[currArg + 2] }; } return this.onSnapshotInternal(internalOptions, observer); }; DocumentReference.prototype.onSnapshotInternal = function (options, observer) { var _this = this; var errHandler = function (err) { console.error('Uncaught Error in onSnapshot:', err); }; if (observer.error) { errHandler = observer.error.bind(observer); } var asyncObserver = new AsyncObserver({ next: function (snapshot) { if (observer.next) { assert(snapshot.docs.size <= 1, 'Too many documents returned on a document query'); var doc = snapshot.docs.get(_this._key); observer.next(new DocumentSnapshot(_this.firestore, _this._key, doc, snapshot.fromCache, snapshot.hasPendingWrites)); } }, error: errHandler }); var internalListener = this._firestoreClient.listen(Query.atPath(this._key.path), asyncObserver, options); return function () { asyncObserver.mute(); _this._firestoreClient.unlisten(internalListener); }; }; DocumentReference.prototype.get = function (options) { var _this = this; validateBetweenNumberOfArgs('DocumentReference.get', arguments, 0, 1); validateGetOptions('DocumentReference.get', options); return new Promise(function (resolve, reject) { if (options && options.source === 'cache') { _this.firestore .ensureClientConfigured() .getDocumentFromLocalCache(_this._key) .then(function (doc) { resolve(new DocumentSnapshot(_this.firestore, _this._key, doc, /*fromCache=*/ true, doc instanceof Document ? doc.hasLocalMutations : false)); }, reject); } else { _this.getViaSnapshotListener(resolve, reject, options); } }); }; DocumentReference.prototype.getViaSnapshotListener = function (resolve, reject, options) { var unlisten = this.onSnapshotInternal({ includeMetadataChanges: true, waitForSyncWhenOnline: true }, { next: function (snap) { // Remove query first before passing event to user to avoid // user actions affecting the now stale query. unlisten(); if (!snap.exists && snap.metadata.fromCache) { // TODO(dimond): If we're online and the document doesn't // exist then we resolve with a doc.exists set to false. If // we're offline however, we reject the Promise in this // case. Two options: 1) Cache the negative response from // the server so we can deliver that even when you're // offline 2) Actually reject the Promise in the online case // if the document doesn't exist. reject(new FirestoreError(Code.UNAVAILABLE, 'Failed to get document because the client is ' + 'offline.')); } else if (snap.exists && snap.metadata.fromCache && options && options.source === 'server') { reject(new FirestoreError(Code.UNAVAILABLE, 'Failed to get document from server. (However, this ' + 'document does exist in the local cache. Run again ' + 'without setting source to "server" to ' + 'retrieve the cached document.)')); } else { resolve(snap); } }, error: reject }); }; return DocumentReference; }()); var SnapshotMetadata = /** @class */ (function () { function SnapshotMetadata(hasPendingWrites, fromCache) { this.hasPendingWrites = hasPendingWrites; this.fromCache = fromCache; } SnapshotMetadata.prototype.isEqual = function (other) { return (this.hasPendingWrites === other.hasPendingWrites && this.fromCache === other.fromCache); }; return SnapshotMetadata; }()); var DocumentSnapshot = /** @class */ (function () { function DocumentSnapshot(_firestore, _key, _document, _fromCache, _hasPendingWrites) { this._firestore = _firestore; this._key = _key; this._document = _document; this._fromCache = _fromCache; this._hasPendingWrites = _hasPendingWrites; } DocumentSnapshot.prototype.data = function (options) { validateBetweenNumberOfArgs('DocumentSnapshot.data', arguments, 0, 1); options = validateSnapshotOptions('DocumentSnapshot.data', options); return !this._document ? undefined : this.convertObject(this._document.data, FieldValueOptions.fromSnapshotOptions(options, this._firestore._areTimestampsInSnapshotsEnabled())); }; DocumentSnapshot.prototype.get = function (fieldPath, options) { validateBetweenNumberOfArgs('DocumentSnapshot.get', arguments, 1, 2); options = validateSnapshotOptions('DocumentSnapshot.get', options); if (this._document) { var value = this._document.data.field(fieldPathFromArgument('DocumentSnapshot.get', fieldPath)); if (value !== undefined) { return this.convertValue(value, FieldValueOptions.fromSnapshotOptions(options, this._firestore._areTimestampsInSnapshotsEnabled())); } } return undefined; }; Object.defineProperty(DocumentSnapshot.prototype, "id", { get: function () { return this._key.path.lastSegment(); }, enumerable: true, configurable: true }); Object.defineProperty(DocumentSnapshot.prototype, "ref", { get: function () { return new DocumentReference(this._key, this._firestore); }, enumerable: true, configurable: true }); Object.defineProperty(DocumentSnapshot.prototype, "exists", { get: function () { return this._document !== null; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentSnapshot.prototype, "metadata", { get: function () { return new SnapshotMetadata(this._hasPendingWrites, this._fromCache); }, enumerable: true, configurable: true }); DocumentSnapshot.prototype.isEqual = function (other) { if (!(other instanceof DocumentSnapshot)) { throw invalidClassError('isEqual', 'DocumentSnapshot', 1, other); } return (this._firestore === other._firestore && this._fromCache === other._fromCache && this._key.isEqual(other._key) && (this._document === null ? other._document === null : this._document.isEqual(other._document))); }; DocumentSnapshot.prototype.convertObject = function (data, options) { var _this = this; var result = {}; data.forEach(function (key, value) { result[key] = _this.convertValue(value, options); }); return result; }; DocumentSnapshot.prototype.convertValue = function (value, options) { if (value instanceof ObjectValue) { return this.convertObject(value, options); } else if (value instanceof ArrayValue) { return this.convertArray(value, options); } else if (value instanceof RefValue) { var key = value.value(options); var database = this._firestore.ensureClientConfigured().databaseId(); if (!value.databaseId.isEqual(database)) { // TODO(b/64130202): Somehow support foreign references. error("Document " + this._key.path + " contains a document " + "reference within a different database (" + (value.databaseId.projectId + "/" + value.databaseId.database + ") which is not ") + "supported. It will be treated as a reference in the current " + ("database (" + database.projectId + "/" + database.database + ") ") + "instead."); } return new DocumentReference(key, this._firestore); } else { return value.value(options); } }; DocumentSnapshot.prototype.convertArray = function (data, options) { var _this = this; return data.internalValue.map(function (value) { return _this.convertValue(value, options); }); }; return DocumentSnapshot; }()); var QueryDocumentSnapshot = /** @class */ (function (_super) { tslib_1.__extends(QueryDocumentSnapshot, _super); function QueryDocumentSnapshot(firestore, key, document, fromCache, hasPendingWrites) { return _super.call(this, firestore, key, document, fromCache, hasPendingWrites) || this; } QueryDocumentSnapshot.prototype.data = function (options) { var data = _super.prototype.data.call(this, options); assert(typeof data === 'object', 'Document in a QueryDocumentSnapshot should exist'); return data; }; return QueryDocumentSnapshot; }(DocumentSnapshot)); var Query$1 = /** @class */ (function () { function Query$$1(_query, firestore) { this._query = _query; this.firestore = firestore; } Query$$1.prototype.where = function (field, opStr, value) { validateExactNumberOfArgs('Query.where', arguments, 3); validateArgType('Query.where', 'non-empty string', 2, opStr); validateDefined('Query.where', 3, value); var fieldValue; var fieldPath = fieldPathFromArgument('Query.where', field); var relationOp = RelationOp.fromString(opStr); if (fieldPath.isKeyField()) { if (relationOp === RelationOp.ARRAY_CONTAINS) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid Query. You can't perform array-contains queries on " + 'FieldPath.documentId() since document IDs are not arrays.'); } if (typeof value === 'string') { if (value.indexOf('/') !== -1) { // TODO(dimond): Allow slashes once ancestor queries are supported throw new FirestoreError(Code.INVALID_ARGUMENT, 'Function Query.where() requires its third parameter to be a ' + 'valid document ID if the first parameter is ' + 'FieldPath.documentId(), but it contains a slash.'); } if (value === '') { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Function Query.where() requires its third parameter to be a ' + 'valid document ID if the first parameter is ' + 'FieldPath.documentId(), but it was an empty string.'); } var path = this._query.path.child(new ResourcePath([value])); assert(path.length % 2 === 0, 'Path should be a document key'); fieldValue = new RefValue(this.firestore._databaseId, new DocumentKey(path)); } else if (value instanceof DocumentReference) { var ref = value; fieldValue = new RefValue(this.firestore._databaseId, ref._key); } else { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function Query.where() requires its third parameter to be a " + "string or a DocumentReference if the first parameter is " + "FieldPath.documentId(), but it was: " + (valueDescription(value) + ".")); } } else { fieldValue = this.firestore._dataConverter.parseQueryValue('Query.where', value); } var filter = Filter.create(fieldPath, relationOp, fieldValue); this.validateNewFilter(filter); return new Query$$1(this._query.addFilter(filter), this.firestore); }; Query$$1.prototype.orderBy = function (field, directionStr) { validateBetweenNumberOfArgs('Query.orderBy', arguments, 1, 2); validateOptionalArgType('Query.orderBy', 'non-empty string', 2, directionStr); var direction; if (directionStr === undefined || directionStr === 'asc') { direction = Direction.ASCENDING; } else if (directionStr === 'desc') { direction = Direction.DESCENDING; } else { throw new FirestoreError(Code.INVALID_ARGUMENT, "Function Query.orderBy() has unknown direction '" + directionStr + "', " + "expected 'asc' or 'desc'."); } if (this._query.startAt !== null) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid query. You must not call Query.startAt() or ' + 'Query.startAfter() before calling Query.orderBy().'); } if (this._query.endAt !== null) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid query. You must not call Query.endAt() or ' + 'Query.endBefore() before calling Query.orderBy().'); } var fieldPath = fieldPathFromArgument('Query.orderBy', field); var orderBy = new OrderBy(fieldPath, direction); this.validateNewOrderBy(orderBy); return new Query$$1(this._query.addOrderBy(orderBy), this.firestore); }; Query$$1.prototype.limit = function (n) { validateExactNumberOfArgs('Query.limit', arguments, 1); validateArgType('Query.limit', 'number', 1, n); if (n <= 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid Query. Query limit (" + n + ") is invalid. Limit must be " + 'positive.'); } return new Query$$1(this._query.withLimit(n), this.firestore); }; Query$$1.prototype.startAt = function (docOrField) { var fields = []; for (var _i = 1; _i < arguments.length; _i++) { fields[_i - 1] = arguments[_i]; } validateAtLeastNumberOfArgs('Query.startAt', arguments, 1); var bound = this.boundFromDocOrFields('Query.startAt', docOrField, fields, /*before=*/ true); return new Query$$1(this._query.withStartAt(bound), this.firestore); }; Query$$1.prototype.startAfter = function (docOrField) { var fields = []; for (var _i = 1; _i < arguments.length; _i++) { fields[_i - 1] = arguments[_i]; } validateAtLeastNumberOfArgs('Query.startAfter', arguments, 1); var bound = this.boundFromDocOrFields('Query.startAfter', docOrField, fields, /*before=*/ false); return new Query$$1(this._query.withStartAt(bound), this.firestore); }; Query$$1.prototype.endBefore = function (docOrField) { var fields = []; for (var _i = 1; _i < arguments.length; _i++) { fields[_i - 1] = arguments[_i]; } validateAtLeastNumberOfArgs('Query.endBefore', arguments, 1); var bound = this.boundFromDocOrFields('Query.endBefore', docOrField, fields, /*before=*/ true); return new Query$$1(this._query.withEndAt(bound), this.firestore); }; Query$$1.prototype.endAt = function (docOrField) { var fields = []; for (var _i = 1; _i < arguments.length; _i++) { fields[_i - 1] = arguments[_i]; } validateAtLeastNumberOfArgs('Query.endAt', arguments, 1); var bound = this.boundFromDocOrFields('Query.endAt', docOrField, fields, /*before=*/ false); return new Query$$1(this._query.withEndAt(bound), this.firestore); }; Query$$1.prototype.isEqual = function (other) { if (!(other instanceof Query$$1)) { throw invalidClassError('isEqual', 'Query', 1, other); } return (this.firestore === other.firestore && this._query.isEqual(other._query)); }; /** Helper function to create a bound from a document or fields */ Query$$1.prototype.boundFromDocOrFields = function (methodName, docOrField, fields, before) { validateDefined(methodName, 1, docOrField); if (docOrField instanceof DocumentSnapshot) { if (fields.length > 0) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Too many arguments provided to " + methodName + "()."); } var snap = docOrField; if (!snap.exists) { throw new FirestoreError(Code.NOT_FOUND, "Can't use a DocumentSnapshot that doesn't exist for " + (methodName + "().")); } return this.boundFromDocument(methodName, snap._document, before); } else { var allFields = [docOrField].concat(fields); return this.boundFromFields(methodName, allFields, before); } }; /** * Create a Bound from a query and a document. * * Note that the Bound will always include the key of the document * and so only the provided document will compare equal to the returned * position. * * Will throw if the document does not contain all fields of the order by * of the query. */ Query$$1.prototype.boundFromDocument = function (methodName, doc, before) { var components = []; // Because people expect to continue/end a query at the exact document // provided, we need to use the implicit sort order rather than the explicit // sort order, because it's guaranteed to contain the document key. That way // the position becomes unambiguous and the query continues/ends exactly at // the provided document. Without the key (by using the explicit sort // orders), multiple documents could match the position, yielding duplicate // results. for (var _i = 0, _a = this._query.orderBy; _i < _a.length; _i++) { var orderBy = _a[_i]; if (orderBy.field.isKeyField()) { components.push(new RefValue(this.firestore._databaseId, doc.key)); } else { var value = doc.field(orderBy.field); if (value !== undefined) { components.push(value); } else { var field = orderBy.field.canonicalString(); throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid query. You are trying to start or end a query using a " + ("document for which the field '" + field + "' (used as the ") + "orderBy) does not exist."); } } } return new Bound(components, before); }; /** * Converts a list of field values to a Bound for the given query. */ Query$$1.prototype.boundFromFields = function (methodName, values$$1, before) { // Use explicit order by's because it has to match the query the user made var orderBy = this._query.explicitOrderBy; if (values$$1.length > orderBy.length) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Too many arguments provided to " + methodName + "(). " + "The number of arguments must be less than or equal to the " + "number of Query.orderBy() clauses"); } var components = []; for (var i = 0; i < values$$1.length; i++) { var rawValue = values$$1[i]; var orderByComponent = orderBy[i]; if (orderByComponent.field.isKeyField()) { if (typeof rawValue !== 'string') { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid query. Expected a string for document ID in " + (methodName + "(), but got a " + typeof rawValue)); } if (rawValue.indexOf('/') !== -1) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid query. Document ID '" + rawValue + "' contains a slash in " + (methodName + "()")); } var key = new DocumentKey(this._query.path.child(rawValue)); components.push(new RefValue(this.firestore._databaseId, key)); } else { var wrapped = this.firestore._dataConverter.parseQueryValue(methodName, rawValue); components.push(wrapped); } } return new Bound(components, before); }; Query$$1.prototype.onSnapshot = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } validateBetweenNumberOfArgs('Query.onSnapshot', arguments, 1, 4); var options = {}; var observer; var currArg = 0; if (typeof args[currArg] === 'object' && !isPartialObserver(args[currArg])) { options = args[currArg]; validateOptionNames('Query.onSnapshot', options, [ 'includeMetadataChanges' ]); validateNamedOptionalType('Query.onSnapshot', 'boolean', 'includeMetadataChanges', options.includeMetadataChanges); currArg++; } if (isPartialObserver(args[currArg])) { observer = args[currArg]; } else { validateArgType('Query.onSnapshot', 'function', currArg, args[currArg]); validateOptionalArgType('Query.onSnapshot', 'function', currArg + 1, args[currArg + 1]); validateOptionalArgType('Query.onSnapshot', 'function', currArg + 2, args[currArg + 2]); observer = { next: args[currArg], error: args[currArg + 1], complete: args[currArg + 2] }; } return this.onSnapshotInternal(options, observer); }; Query$$1.prototype.onSnapshotInternal = function (options, observer) { var _this = this; var errHandler = function (err) { console.error('Uncaught Error in onSnapshot:', err); }; if (observer.error) { errHandler = observer.error.bind(observer); } var asyncObserver = new AsyncObserver({ next: function (result) { if (observer.next) { observer.next(new QuerySnapshot(_this.firestore, _this._query, result)); } }, error: errHandler }); var firestoreClient = this.firestore.ensureClientConfigured(); var internalListener = firestoreClient.listen(this._query, asyncObserver, options); return function () { asyncObserver.mute(); firestoreClient.unlisten(internalListener); }; }; Query$$1.prototype.get = function (options) { var _this = this; validateBetweenNumberOfArgs('Query.get', arguments, 0, 1); validateGetOptions('Query.get', options); return new Promise(function (resolve, reject) { if (options && options.source === 'cache') { _this.firestore .ensureClientConfigured() .getDocumentsFromLocalCache(_this._query) .then(function (viewSnap) { resolve(new QuerySnapshot(_this.firestore, _this._query, viewSnap)); }, reject); } else { _this.getViaSnapshotListener(resolve, reject, options); } }); }; Query$$1.prototype.getViaSnapshotListener = function (resolve, reject, options) { var unlisten = this.onSnapshotInternal({ includeMetadataChanges: true, waitForSyncWhenOnline: true }, { next: function (result) { // Remove query first before passing event to user to avoid // user actions affecting the now stale query. unlisten(); if (result.metadata.fromCache && options && options.source === 'server') { reject(new FirestoreError(Code.UNAVAILABLE, 'Failed to get documents from server. (However, these ' + 'documents may exist in the local cache. Run again ' + 'without setting source to "server" to ' + 'retrieve the cached documents.)')); } else { resolve(result); } }, error: reject }); }; Query$$1.prototype.validateNewFilter = function (filter) { if (filter instanceof RelationFilter) { if (filter.isInequality()) { var existingField = this._query.getInequalityFilterField(); if (existingField !== null && !existingField.isEqual(filter.field)) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid query. All where filters with an inequality' + ' (<, <=, >, or >=) must be on the same field. But you have' + (" inequality filters on '" + existingField.toString() + "'") + (" and '" + filter.field.toString() + "'")); } var firstOrderByField = this._query.getFirstOrderByField(); if (firstOrderByField !== null) { this.validateOrderByAndInequalityMatch(filter.field, firstOrderByField); } } else if (filter.op === RelationOp.ARRAY_CONTAINS) { if (this._query.hasArrayContainsFilter()) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid query. Queries only support a single array-contains ' + 'filter.'); } } } }; Query$$1.prototype.validateNewOrderBy = function (orderBy) { if (this._query.getFirstOrderByField() === null) { // This is the first order by. It must match any inequality. var inequalityField = this._query.getInequalityFilterField(); if (inequalityField !== null) { this.validateOrderByAndInequalityMatch(inequalityField, orderBy.field); } } }; Query$$1.prototype.validateOrderByAndInequalityMatch = function (inequality, orderBy) { if (!orderBy.isEqual(inequality)) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid query. You have a where filter with an inequality " + ("(<, <=, >, or >=) on field '" + inequality.toString() + "' ") + ("and so you must also use '" + inequality.toString() + "' ") + "as your first Query.orderBy(), but your first Query.orderBy() " + ("is on field '" + orderBy.toString() + "' instead.")); } }; return Query$$1; }()); var QuerySnapshot = /** @class */ (function () { function QuerySnapshot(_firestore, _originalQuery, _snapshot) { this._firestore = _firestore; this._originalQuery = _originalQuery; this._snapshot = _snapshot; this._cachedChanges = null; this._cachedChangesIncludeMetadataChanges = null; this.metadata = new SnapshotMetadata(_snapshot.hasPendingWrites, _snapshot.fromCache); } Object.defineProperty(QuerySnapshot.prototype, "docs", { get: function () { var result = []; this.forEach(function (doc) { return result.push(doc); }); return result; }, enumerable: true, configurable: true }); Object.defineProperty(QuerySnapshot.prototype, "empty", { get: function () { return this._snapshot.docs.isEmpty(); }, enumerable: true, configurable: true }); Object.defineProperty(QuerySnapshot.prototype, "size", { get: function () { return this._snapshot.docs.size; }, enumerable: true, configurable: true }); QuerySnapshot.prototype.forEach = function (callback, thisArg) { var _this = this; validateBetweenNumberOfArgs('QuerySnapshot.forEach', arguments, 1, 2); validateArgType('QuerySnapshot.forEach', 'function', 1, callback); this._snapshot.docs.forEach(function (doc) { callback.call(thisArg, _this.convertToDocumentImpl(doc)); }); }; Object.defineProperty(QuerySnapshot.prototype, "query", { get: function () { return new Query$1(this._originalQuery, this._firestore); }, enumerable: true, configurable: true }); QuerySnapshot.prototype.docChanges = function (options) { if (options) { validateOptionNames('QuerySnapshot.docChanges', options, [ 'includeMetadataChanges' ]); validateNamedOptionalType('QuerySnapshot.docChanges', 'boolean', 'includeMetadataChanges', options.includeMetadataChanges); } var includeMetadataChanges = !!(options && options.includeMetadataChanges); if (includeMetadataChanges && this._snapshot.excludesMetadataChanges) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'To include metadata changes with your document changes, you must ' + 'also pass { includeMetadataChanges:true } to onSnapshot().'); } if (!this._cachedChanges || this._cachedChangesIncludeMetadataChanges !== includeMetadataChanges) { this._cachedChanges = changesFromSnapshot(this._firestore, includeMetadataChanges, this._snapshot); this._cachedChangesIncludeMetadataChanges = includeMetadataChanges; } return this._cachedChanges; }; /** Check the equality. The call can be very expensive. */ QuerySnapshot.prototype.isEqual = function (other) { if (!(other instanceof QuerySnapshot)) { throw invalidClassError('isEqual', 'QuerySnapshot', 1, other); } return (this._firestore === other._firestore && this._originalQuery.isEqual(other._originalQuery) && this._snapshot.isEqual(other._snapshot)); }; QuerySnapshot.prototype.convertToDocumentImpl = function (doc) { return new QueryDocumentSnapshot(this._firestore, doc.key, doc, this.metadata.fromCache, this._snapshot.mutatedKeys.has(doc.key)); }; return QuerySnapshot; }()); // TODO(2018/11/01): As of 2018/04/17 we're changing docChanges from an array // into a method. Because this is a runtime breaking change and somewhat subtle // (both Array and Function have a .length, etc.), we'll replace commonly-used // properties (including Symbol.iterator) to throw a custom error message. In // ~6 months we can delete the custom error as most folks will have hopefully // migrated. function throwDocChangesMethodError() { throw new FirestoreError(Code.INVALID_ARGUMENT, 'QuerySnapshot.docChanges has been changed from a property into a ' + 'method, so usages like "querySnapshot.docChanges" should become ' + '"querySnapshot.docChanges()"'); } var docChangesPropertiesToOverride = [ 'length', 'forEach', 'map' ].concat((typeof Symbol !== 'undefined' ? [Symbol.iterator] : [])); docChangesPropertiesToOverride.forEach(function (property) { /** * We are (re-)defining properties on QuerySnapshot.prototype.docChanges which * is a Function. This could fail, in particular in the case of 'length' which * already exists on Function.prototype and on IE11 is improperly defined with * `{ configurable: false }`. So we wrap this in a try/catch to ensure that we * still have a functional SDK. */ try { Object.defineProperty(QuerySnapshot.prototype.docChanges, property, { get: function () { return throwDocChangesMethodError(); } }); } catch (err) { } // Ignore this failure intentionally }); var CollectionReference = /** @class */ (function (_super) { tslib_1.__extends(CollectionReference, _super); function CollectionReference(path, firestore) { var _this = _super.call(this, Query.atPath(path), firestore) || this; if (path.length % 2 !== 1) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Invalid collection reference. Collection ' + 'references must have an odd number of segments, but ' + (path.canonicalString() + " has " + path.length)); } return _this; } Object.defineProperty(CollectionReference.prototype, "id", { get: function () { return this._query.path.lastSegment(); }, enumerable: true, configurable: true }); Object.defineProperty(CollectionReference.prototype, "parent", { get: function () { var parentPath = this._query.path.popLast(); if (parentPath.isEmpty()) { return null; } else { return new DocumentReference(new DocumentKey(parentPath), this.firestore); } }, enumerable: true, configurable: true }); Object.defineProperty(CollectionReference.prototype, "path", { get: function () { return this._query.path.canonicalString(); }, enumerable: true, configurable: true }); CollectionReference.prototype.doc = function (pathString) { validateBetweenNumberOfArgs('CollectionReference.doc', arguments, 0, 1); // We allow omission of 'pathString' but explicitly prohibit passing in both // 'undefined' and 'null'. if (arguments.length === 0) { pathString = AutoId.newId(); } validateArgType('CollectionReference.doc', 'non-empty string', 1, pathString); if (pathString === '') { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Document path must be a non-empty string'); } var path = ResourcePath.fromString(pathString); return DocumentReference.forPath(this._query.path.child(path), this.firestore); }; CollectionReference.prototype.add = function (value) { validateExactNumberOfArgs('CollectionReference.add', arguments, 1); validateArgType('CollectionReference.add', 'object', 1, value); var docRef = this.doc(); return docRef.set(value).then(function () { return docRef; }); }; return CollectionReference; }(Query$1)); function validateSetOptions(methodName, options) { if (options === undefined) { return { merge: false }; } validateOptionNames(methodName, options, ['merge', 'mergeFields']); validateNamedOptionalType(methodName, 'boolean', 'merge', options.merge); validateOptionalArrayElements(methodName, 'mergeFields', 'a string or a FieldPath', options.mergeFields, function (element) { return typeof element === 'string' || element instanceof FieldPath$1; }); if (options.mergeFields !== undefined && options.merge !== undefined) { throw new FirestoreError(Code.INVALID_ARGUMENT, "Invalid options passed to function " + methodName + "(): You cannot specify both \"merge\" " + "and \"mergeFields\"."); } return options; } function validateSnapshotOptions(methodName, options) { if (options === undefined) { return {}; } validateOptionNames(methodName, options, ['serverTimestamps']); validateNamedOptionalPropertyEquals(methodName, 'options', 'serverTimestamps', options.serverTimestamps, ['estimate', 'previous', 'none']); return options; } function validateGetOptions(methodName, options) { validateOptionalArgType(methodName, 'object', 1, options); if (options) { validateOptionNames(methodName, options, ['source']); validateNamedOptionalPropertyEquals(methodName, 'options', 'source', options.source, ['default', 'server', 'cache']); } } function validateReference(methodName, documentRef, firestore) { if (!(documentRef instanceof DocumentReference)) { throw invalidClassError(methodName, 'DocumentReference', 1, documentRef); } else if (documentRef.firestore !== firestore) { throw new FirestoreError(Code.INVALID_ARGUMENT, 'Provided document reference is from a different Firestore instance.'); } else { return documentRef; } } /** * Calculates the array of firestore.DocumentChange's for a given ViewSnapshot. * * Exported for testing. */ function changesFromSnapshot(firestore, includeMetadataChanges, snapshot) { if (snapshot.oldDocs.isEmpty()) { // Special case the first snapshot because index calculation is easy and // fast var lastDoc_1; var index_1 = 0; return snapshot.docChanges.map(function (change) { var doc = new QueryDocumentSnapshot(firestore, change.doc.key, change.doc, snapshot.fromCache, snapshot.mutatedKeys.has(change.doc.key)); assert(change.type === ChangeType.Added, 'Invalid event type for first snapshot'); assert(!lastDoc_1 || snapshot.query.docComparator(lastDoc_1, change.doc) < 0, 'Got added events in wrong order'); lastDoc_1 = change.doc; return { type: 'added', doc: doc, oldIndex: -1, newIndex: index_1++ }; }); } else { // A DocumentSet that is updated incrementally as changes are applied to use // to lookup the index of a document. var indexTracker_1 = snapshot.oldDocs; return snapshot.docChanges .filter(function (change) { return includeMetadataChanges || change.type !== ChangeType.Metadata; }) .map(function (change) { var doc = new QueryDocumentSnapshot(firestore, change.doc.key, change.doc, snapshot.fromCache, snapshot.mutatedKeys.has(change.doc.key)); var oldIndex = -1; var newIndex = -1; if (change.type !== ChangeType.Added) { oldIndex = indexTracker_1.indexOf(change.doc.key); assert(oldIndex >= 0, 'Index for document not found'); indexTracker_1 = indexTracker_1.delete(change.doc.key); } if (change.type !== ChangeType.Removed) { indexTracker_1 = indexTracker_1.add(change.doc); newIndex = indexTracker_1.indexOf(change.doc.key); } return { type: resultChangeType(change.type), doc: doc, oldIndex: oldIndex, newIndex: newIndex }; }); } } function resultChangeType(type) { switch (type) { case ChangeType.Added: return 'added'; case ChangeType.Modified: case ChangeType.Metadata: return 'modified'; case ChangeType.Removed: return 'removed'; default: return fail('Unknown change type: ' + type); } } // Export the classes with a private constructor (it will fail if invoked // at runtime). Note that this still allows instanceof checks. // We're treating the variables as class names, so disable checking for lower // case variable names. // tslint:disable:variable-name var PublicFirestore = makeConstructorPrivate(Firestore, 'Use firebase.firestore() instead.'); var PublicTransaction = makeConstructorPrivate(Transaction$1, 'Use firebase.firestore().runTransaction() instead.'); var PublicWriteBatch = makeConstructorPrivate(WriteBatch, 'Use firebase.firestore().batch() instead.'); var PublicDocumentReference = makeConstructorPrivate(DocumentReference, 'Use firebase.firestore().doc() instead.'); var PublicDocumentSnapshot = makeConstructorPrivate(DocumentSnapshot); var PublicQueryDocumentSnapshot = makeConstructorPrivate(QueryDocumentSnapshot); var PublicQuery = makeConstructorPrivate(Query$1); var PublicQuerySnapshot = makeConstructorPrivate(QuerySnapshot); var PublicCollectionReference = makeConstructorPrivate(CollectionReference, 'Use firebase.firestore().collection() instead.'); // tslint:enable:variable-name /** * Copyright 2017 Google Inc. * * 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. */ var firestoreNamespace = { Firestore: PublicFirestore, GeoPoint: GeoPoint, Timestamp: Timestamp, Blob: PublicBlob, Transaction: PublicTransaction, WriteBatch: PublicWriteBatch, DocumentReference: PublicDocumentReference, DocumentSnapshot: PublicDocumentSnapshot, Query: PublicQuery, QueryDocumentSnapshot: PublicQueryDocumentSnapshot, QuerySnapshot: PublicQuerySnapshot, CollectionReference: PublicCollectionReference, FieldPath: FieldPath$1, FieldValue: PublicFieldValue, setLogLevel: Firestore.setLogLevel }; /** * Configures Firestore as part of the Firebase SDK by calling registerService. */ function configureForFirebase(firebase$$1) { firebase$$1.INTERNAL.registerService('firestore', function (app) { return new Firestore(app); }, shallowCopy(firestoreNamespace)); } /** * Copyright 2017 Google Inc. * * 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. */ function registerFirestore(instance) { configureForFirebase(instance); } registerFirestore(firebase); exports.registerFirestore = registerFirestore; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../console-browserify/index.js */ "../../node_modules/console-browserify/index.js"))) /***/ }), /***/ "../../node_modules/@firebase/functions/dist/index.cjs.js": /*!*******************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/functions/dist/index.cjs.js ***! \*******************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var tslib_1 = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); var firebase = _interopDefault(__webpack_require__(/*! @firebase/app */ "../../node_modules/@firebase/app/dist/index.cjs.js")); /** * Copyright 2017 Google Inc. * * 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. */ /** * Standard error codes for different ways a request can fail, as defined by: * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto * * This map is used primarily to convert from a backend error code string to * a client SDK error code string, and make sure it's in the supported set. */ var errorCodeMap = { OK: 'ok', CANCELLED: 'cancelled', UNKNOWN: 'unknown', INVALID_ARGUMENT: 'invalid-argument', DEADLINE_EXCEEDED: 'deadline-exceeded', NOT_FOUND: 'not-found', ALREADY_EXISTS: 'already-exists', PERMISSION_DENIED: 'permission-denied', UNAUTHENTICATED: 'unauthenticated', RESOURCE_EXHAUSTED: 'resource-exhausted', FAILED_PRECONDITION: 'failed-precondition', ABORTED: 'aborted', OUT_OF_RANGE: 'out-of-range', UNIMPLEMENTED: 'unimplemented', INTERNAL: 'internal', UNAVAILABLE: 'unavailable', DATA_LOSS: 'data-loss' }; /** * An explicit error that can be thrown from a handler to send an error to the * client that called the function. */ var HttpsErrorImpl = /** @class */ (function (_super) { tslib_1.__extends(HttpsErrorImpl, _super); function HttpsErrorImpl(code, message, details) { var _this = _super.call(this, message) || this; // This is a workaround for a bug in TypeScript when extending Error: // tslint:disable-next-line // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work Object.setPrototypeOf(_this, HttpsErrorImpl.prototype); _this.code = code; _this.details = details; return _this; } return HttpsErrorImpl; }(Error)); /** * Takes an HTTP status code and returns the corresponding ErrorCode. * This is the standard HTTP status code -> error mapping defined in: * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto * * @param status An HTTP status code. * @return The corresponding ErrorCode, or ErrorCode.UNKNOWN if none. */ function codeForHTTPStatus(status) { // Make sure any successful status is OK. if (status >= 200 && status < 300) { return 'ok'; } switch (status) { case 0: // This can happen if the server returns 500. return 'internal'; case 400: return 'invalid-argument'; case 401: return 'unauthenticated'; case 403: return 'permission-denied'; case 404: return 'not-found'; case 409: return 'aborted'; case 429: return 'resource-exhausted'; case 499: return 'cancelled'; case 500: return 'internal'; case 501: return 'unimplemented'; case 503: return 'unavailable'; case 504: return 'deadline-exceeded'; } return 'unknown'; } /** * Takes an HTTP response and returns the corresponding Error, if any. */ function _errorForResponse(status, bodyJSON, serializer) { var code = codeForHTTPStatus(status); // Start with reasonable defaults from the status code. var description = code; var details = undefined; // Then look through the body for explicit details. try { var errorJSON = bodyJSON.error; if (errorJSON) { var status_1 = errorJSON.status; if (typeof status_1 === 'string') { if (!errorCodeMap[status_1]) { // They must've included an unknown error code in the body. return new HttpsErrorImpl('internal', 'internal'); } code = errorCodeMap[status_1]; } // TODO(klimt): Add better default descriptions for error enums. // The default description needs to be updated for the new code. description = status_1; var message = errorJSON.message; if (typeof message === 'string') { description = message; } details = errorJSON.details; if (details !== undefined) { details = serializer.decode(details); } } } catch (e) { // If we couldn't parse explicit error data, that's fine. } if (code === 'ok') { // Technically, there's an edge case where a developer could explicitly // return an error code of OK, and we will treat it as success, but that // seems reasonable. return null; } return new HttpsErrorImpl(code, description, details); } /** * Helper class to get metadata that should be included with a function call. */ var ContextProvider = /** @class */ (function () { function ContextProvider(app) { this.app = app; } ContextProvider.prototype.getAuthToken = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var token, e_1; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4 /*yield*/, this.app.INTERNAL.getToken()]; case 1: token = _a.sent(); if (!token) { return [2 /*return*/, undefined]; } return [2 /*return*/, token.accessToken]; case 2: e_1 = _a.sent(); // If there's any error when trying to get the auth token, leave it off. return [2 /*return*/, undefined]; case 3: return [2 /*return*/]; } }); }); }; ContextProvider.prototype.getInstanceIdToken = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var messaging, token, e_2; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); // HACK: Until we have a separate instanceId package, this is a quick way // to load in the messaging instance for this app. if (!this.app.messaging) { return [2 /*return*/, undefined]; } messaging = this.app.messaging(); return [4 /*yield*/, messaging.getToken()]; case 1: token = _a.sent(); if (!token) { return [2 /*return*/, undefined]; } return [2 /*return*/, token]; case 2: e_2 = _a.sent(); // We don't warn on this, because it usually means messaging isn't set up. // console.warn('Failed to retrieve instance id token.', e); // If there's any error when trying to get the token, leave it off. return [2 /*return*/, undefined]; case 3: return [2 /*return*/]; } }); }); }; ContextProvider.prototype.getContext = function () { return tslib_1.__awaiter(this, void 0, void 0, function () { var authToken, instanceIdToken; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.getAuthToken()]; case 1: authToken = _a.sent(); return [4 /*yield*/, this.getInstanceIdToken()]; case 2: instanceIdToken = _a.sent(); return [2 /*return*/, { authToken: authToken, instanceIdToken: instanceIdToken }]; } }); }); }; return ContextProvider; }()); /** * Copyright 2017 Google Inc. * * 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. */ var LONG_TYPE = 'type.googleapis.com/google.protobuf.Int64Value'; var UNSIGNED_LONG_TYPE = 'type.googleapis.com/google.protobuf.UInt64Value'; function mapValues(o, f) { var result = {}; for (var key in o) { if (o.hasOwnProperty(key)) { result[key] = f(o[key]); } } return result; } var Serializer = /** @class */ (function () { function Serializer() { } // Takes data and encodes it in a JSON-friendly way, such that types such as // Date are preserved. Serializer.prototype.encode = function (data) { var _this = this; if (data === null || data === undefined) { return null; } if (data instanceof Number) { data = data.valueOf(); } if (typeof data === 'number' && isFinite(data)) { // Any number in JS is safe to put directly in JSON and parse as a double // without any loss of precision. return data; } if (data === true || data === false) { return data; } if (Object.prototype.toString.call(data) === '[object String]') { return data; } if (Array.isArray(data)) { return data.map(function (x) { return _this.encode(x); }); } if (typeof data === 'function' || typeof data === 'object') { return mapValues(data, function (x) { return _this.encode(x); }); } // If we got this far, the data is not encodable. throw new Error('Data cannot be encoded in JSON: ' + data); }; // Takes data that's been encoded in a JSON-friendly form and returns a form // with richer datatypes, such as Dates, etc. Serializer.prototype.decode = function (json) { var _this = this; if (json === null) { return json; } if (json['@type']) { switch (json['@type']) { case LONG_TYPE: // Fall through and handle this the same as unsigned. case UNSIGNED_LONG_TYPE: { // Technically, this could work return a valid number for malformed // data if there was a number followed by garbage. But it's just not // worth all the extra code to detect that case. var value = parseFloat(json.value); if (isNaN(value)) { throw new Error('Data cannot be decoded from JSON: ' + json); } return value; } default: { throw new Error('Data cannot be decoded from JSON: ' + json); } } } if (Array.isArray(json)) { return json.map(function (x) { return _this.decode(x); }); } if (typeof json === 'function' || typeof json === 'object') { return mapValues(json, function (x) { return _this.decode(x); }); } // Anything else is safe to return. return json; }; return Serializer; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * The main class for the Firebase Functions SDK. */ var Service = /** @class */ (function () { /** * Creates a new Functions service for the given app and (optional) region. * @param app_ The FirebaseApp to use. * @param region_ The region to call functions in. */ function Service(app_, region_) { if (region_ === void 0) { region_ = 'us-central1'; } this.app_ = app_; this.region_ = region_; this.serializer = new Serializer(); this.emulatorOrigin = null; this.contextProvider = new ContextProvider(app_); } Object.defineProperty(Service.prototype, "app", { get: function () { return this.app_; }, enumerable: true, configurable: true }); /** * Returns the URL for a callable with the given name. * @param name The name of the callable. */ Service.prototype._url = function (name) { var projectId = this.app_.options.projectId; var region = this.region_; if (this.emulatorOrigin !== null) { var origin = this.emulatorOrigin; return origin + "/" + projectId + "/" + region + "/" + name; } return "https://" + region + "-" + projectId + ".cloudfunctions.net/" + name; }; /** * Changes this instance to point to a Cloud Functions emulator running * locally. See https://firebase.google.com/docs/functions/local-emulator * * @param origin The origin of the local emulator, such as * "http://localhost:5005". */ Service.prototype.useFunctionsEmulator = function (origin) { this.emulatorOrigin = origin; }; /** * Returns a reference to the callable https trigger with the given name. * @param name The name of the trigger. */ Service.prototype.httpsCallable = function (name) { var _this = this; var callable = function (data) { return _this.call(name, data); }; return callable; }; /** * Does an HTTP POST and returns the completed response. * @param url The url to post to. * @param body The JSON body of the post. * @param headers The HTTP headers to include in the request. * @return A Promise that will succeed when the request finishes. */ Service.prototype.postJSON = function (url, body, headers) { return tslib_1.__awaiter(this, void 0, void 0, function () { var response, e_1, json, e_2; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: headers.append('Content-Type', 'application/json'); _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4 /*yield*/, fetch(url, { method: 'POST', body: JSON.stringify(body), headers: headers })]; case 2: response = _a.sent(); return [3 /*break*/, 4]; case 3: e_1 = _a.sent(); // This could be an unhandled error on the backend, or it could be a // network error. There's no way to no, since an unhandled error on the // backend will fail to set the proper CORS header, and thus will be // treated as a network error by fetch. return [2 /*return*/, { status: 0, json: null }]; case 4: json = null; _a.label = 5; case 5: _a.trys.push([5, 7, , 8]); return [4 /*yield*/, response.json()]; case 6: json = _a.sent(); return [3 /*break*/, 8]; case 7: e_2 = _a.sent(); return [3 /*break*/, 8]; case 8: return [2 /*return*/, { status: response.status, json: json }]; } }); }); }; /** * Calls a callable function asynchronously and returns the result. * @param name The name of the callable trigger. * @param data The data to pass as params to the function.s */ Service.prototype.call = function (name, data) { return tslib_1.__awaiter(this, void 0, void 0, function () { var url, body, headers, context, response, error, responseData, decodedData; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: url = this._url(name); // Encode any special types, such as dates, in the input data. data = this.serializer.encode(data); body = { data: data }; headers = new Headers(); return [4 /*yield*/, this.contextProvider.getContext()]; case 1: context = _a.sent(); if (context.authToken) { headers.append('Authorization', 'Bearer ' + context.authToken); } if (context.instanceIdToken) { headers.append('Firebase-Instance-ID-Token', context.instanceIdToken); } return [4 /*yield*/, this.postJSON(url, body, headers)]; case 2: response = _a.sent(); error = _errorForResponse(response.status, response.json, this.serializer); if (error) { throw error; } if (!response.json) { throw new HttpsErrorImpl('internal', 'Response is not valid JSON object.'); } responseData = response.json.data; // TODO(klimt): For right now, allow "result" instead of "data", for // backwards compatibility. if (typeof responseData === 'undefined') { responseData = response.json.result; } if (typeof responseData === 'undefined') { // Consider the response malformed. throw new HttpsErrorImpl('internal', 'Response is missing data field.'); } decodedData = this.serializer.decode(responseData); return [2 /*return*/, { data: decodedData }]; } }); }); }; return Service; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Type constant for Firebase Functions. */ var FUNCTIONS_TYPE = 'functions'; function factory(app, unused, region) { return new Service(app, region); } function registerFunctions(instance) { var namespaceExports = { // no-inline Functions: Service }; instance.INTERNAL.registerService(FUNCTIONS_TYPE, factory, namespaceExports, // We don't need to wait on any AppHooks. undefined, // Allow multiple functions instances per app. true); } registerFunctions(firebase); exports.registerFunctions = registerFunctions; /***/ }), /***/ "../../node_modules/@firebase/logger/dist/index.esm.js": /*!****************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/logger/dist/index.esm.js ***! \****************************************************************************************************************************/ /*! exports provided: setLogLevel, Logger, LogLevel */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* WEBPACK VAR INJECTION */(function(console) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLogLevel", function() { return setLogLevel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Logger", function() { return Logger; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogLevel", function() { return LogLevel; }); /** * Copyright 2017 Google Inc. * * 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. */ /** * A container for all of the Logger instances */ var instances = []; /** * The JS SDK supports 5 log levels and also allows a user the ability to * silence the logs altogether. * * The order is a follows: * DEBUG < VERBOSE < INFO < WARN < ERROR * * All of the log types above the current log level will be captured (i.e. if * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and * `VERBOSE` logs will not) */ var LogLevel; (function (LogLevel) { LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG"; LogLevel[LogLevel["VERBOSE"] = 1] = "VERBOSE"; LogLevel[LogLevel["INFO"] = 2] = "INFO"; LogLevel[LogLevel["WARN"] = 3] = "WARN"; LogLevel[LogLevel["ERROR"] = 4] = "ERROR"; LogLevel[LogLevel["SILENT"] = 5] = "SILENT"; })(LogLevel || (LogLevel = {})); /** * The default log level */ var defaultLogLevel = LogLevel.INFO; /** * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR * messages on to their corresponding console counterparts (if the log method * is supported by the current log level) */ var defaultLogHandler = function (instance, logType) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } if (logType < instance.logLevel) return; var now = new Date().toISOString(); switch (logType) { /** * By default, `console.debug` is not displayed in the developer console (in * chrome). To avoid forcing users to have to opt-in to these logs twice * (i.e. once for firebase, and once in the console), we are sending `DEBUG` * logs to the `console.log` function. */ case LogLevel.DEBUG: console.log.apply(console, ["[" + now + "] " + instance.name + ":"].concat(args)); break; case LogLevel.VERBOSE: console.log.apply(console, ["[" + now + "] " + instance.name + ":"].concat(args)); break; case LogLevel.INFO: console.info.apply(console, ["[" + now + "] " + instance.name + ":"].concat(args)); break; case LogLevel.WARN: console.warn.apply(console, ["[" + now + "] " + instance.name + ":"].concat(args)); break; case LogLevel.ERROR: console.error.apply(console, ["[" + now + "] " + instance.name + ":"].concat(args)); break; default: throw new Error("Attempted to log a message with an invalid logType (value: " + logType + ")"); } }; var Logger = /** @class */ (function () { /** * Gives you an instance of a Logger to capture messages according to * Firebase's logging scheme. * * @param name The name that the logs will be associated with */ function Logger(name) { this.name = name; /** * The log level of the given Logger instance. */ this._logLevel = defaultLogLevel; /** * The log handler for the Logger instance. */ this._logHandler = defaultLogHandler; /** * Capture the current instance for later use */ instances.push(this); } Object.defineProperty(Logger.prototype, "logLevel", { get: function () { return this._logLevel; }, set: function (val) { if (!(val in LogLevel)) { throw new TypeError('Invalid value assigned to `logLevel`'); } this._logLevel = val; }, enumerable: true, configurable: true }); Object.defineProperty(Logger.prototype, "logHandler", { get: function () { return this._logHandler; }, set: function (val) { if (typeof val !== 'function') { throw new TypeError('Value assigned to `logHandler` must be a function'); } this._logHandler = val; }, enumerable: true, configurable: true }); /** * The functions below are all based on the `console` interface */ Logger.prototype.debug = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._logHandler.apply(this, [this, LogLevel.DEBUG].concat(args)); }; Logger.prototype.log = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._logHandler.apply(this, [this, LogLevel.VERBOSE].concat(args)); }; Logger.prototype.info = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._logHandler.apply(this, [this, LogLevel.INFO].concat(args)); }; Logger.prototype.warn = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._logHandler.apply(this, [this, LogLevel.WARN].concat(args)); }; Logger.prototype.error = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } this._logHandler.apply(this, [this, LogLevel.ERROR].concat(args)); }; return Logger; }()); /** * Copyright 2017 Google Inc. * * 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. */ function setLogLevel(level) { instances.forEach(function (inst) { inst.logLevel = level; }); } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../console-browserify/index.js */ "../../node_modules/console-browserify/index.js"))) /***/ }), /***/ "../../node_modules/@firebase/messaging/dist/index.esm.js": /*!*******************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/messaging/dist/index.esm.js ***! \*******************************************************************************************************************************/ /*! exports provided: registerMessaging, isSupported */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* WEBPACK VAR INJECTION */(function(console) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerMessaging", function() { return registerMessaging; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSupported", function() { return isSupported; }); /* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/util */ "../../node_modules/@firebase/util/dist/index.cjs.js"); /* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_util__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/app */ "../../node_modules/@firebase/app/dist/index.cjs.js"); /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_firebase_app__WEBPACK_IMPORTED_MODULE_2__); /** * Copyright 2018 Google Inc. * * 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. */ /** * Copyright 2017 Google Inc. * * 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. */ var ERROR_CODES = { AVAILABLE_IN_WINDOW: 'only-available-in-window', AVAILABLE_IN_SW: 'only-available-in-sw', SHOULD_BE_INHERITED: 'should-be-overriden', BAD_SENDER_ID: 'bad-sender-id', INCORRECT_GCM_SENDER_ID: 'incorrect-gcm-sender-id', PERMISSION_DEFAULT: 'permission-default', PERMISSION_BLOCKED: 'permission-blocked', UNSUPPORTED_BROWSER: 'unsupported-browser', NOTIFICATIONS_BLOCKED: 'notifications-blocked', FAILED_DEFAULT_REGISTRATION: 'failed-serviceworker-registration', SW_REGISTRATION_EXPECTED: 'sw-registration-expected', GET_SUBSCRIPTION_FAILED: 'get-subscription-failed', INVALID_SAVED_TOKEN: 'invalid-saved-token', SW_REG_REDUNDANT: 'sw-reg-redundant', TOKEN_SUBSCRIBE_FAILED: 'token-subscribe-failed', TOKEN_SUBSCRIBE_NO_TOKEN: 'token-subscribe-no-token', TOKEN_SUBSCRIBE_NO_PUSH_SET: 'token-subscribe-no-push-set', TOKEN_UNSUBSCRIBE_FAILED: 'token-unsubscribe-failed', TOKEN_UPDATE_FAILED: 'token-update-failed', TOKEN_UPDATE_NO_TOKEN: 'token-update-no-token', USE_SW_BEFORE_GET_TOKEN: 'use-sw-before-get-token', INVALID_DELETE_TOKEN: 'invalid-delete-token', DELETE_TOKEN_NOT_FOUND: 'delete-token-not-found', DELETE_SCOPE_NOT_FOUND: 'delete-scope-not-found', BG_HANDLER_FUNCTION_EXPECTED: 'bg-handler-function-expected', NO_WINDOW_CLIENT_TO_MSG: 'no-window-client-to-msg', UNABLE_TO_RESUBSCRIBE: 'unable-to-resubscribe', NO_FCM_TOKEN_FOR_RESUBSCRIBE: 'no-fcm-token-for-resubscribe', FAILED_TO_DELETE_TOKEN: 'failed-to-delete-token', NO_SW_IN_REG: 'no-sw-in-reg', BAD_SCOPE: 'bad-scope', BAD_VAPID_KEY: 'bad-vapid-key', BAD_SUBSCRIPTION: 'bad-subscription', BAD_TOKEN: 'bad-token', BAD_PUSH_SET: 'bad-push-set', FAILED_DELETE_VAPID_KEY: 'failed-delete-vapid-key', INVALID_PUBLIC_VAPID_KEY: 'invalid-public-vapid-key', USE_PUBLIC_KEY_BEFORE_GET_TOKEN: 'use-public-key-before-get-token', PUBLIC_KEY_DECRYPTION_FAILED: 'public-vapid-key-decryption-failed' }; var ERROR_MAP = (_a = {}, _a[ERROR_CODES.AVAILABLE_IN_WINDOW] = 'This method is available in a Window context.', _a[ERROR_CODES.AVAILABLE_IN_SW] = 'This method is available in a service worker ' + 'context.', _a[ERROR_CODES.SHOULD_BE_INHERITED] = 'This method should be overriden by ' + 'extended classes.', _a[ERROR_CODES.BAD_SENDER_ID] = "Please ensure that 'messagingSenderId' is set " + 'correctly in the options passed into firebase.initializeApp().', _a[ERROR_CODES.PERMISSION_DEFAULT] = 'The required permissions were not granted and ' + 'dismissed instead.', _a[ERROR_CODES.PERMISSION_BLOCKED] = 'The required permissions were not granted and ' + 'blocked instead.', _a[ERROR_CODES.UNSUPPORTED_BROWSER] = "This browser doesn't support the API's " + 'required to use the firebase SDK.', _a[ERROR_CODES.NOTIFICATIONS_BLOCKED] = 'Notifications have been blocked.', _a[ERROR_CODES.FAILED_DEFAULT_REGISTRATION] = 'We are unable to register the ' + 'default service worker. {$browserErrorMessage}', _a[ERROR_CODES.SW_REGISTRATION_EXPECTED] = 'A service worker registration was the ' + 'expected input.', _a[ERROR_CODES.GET_SUBSCRIPTION_FAILED] = 'There was an error when trying to get ' + 'any existing Push Subscriptions.', _a[ERROR_CODES.INVALID_SAVED_TOKEN] = 'Unable to access details of the saved token.', _a[ERROR_CODES.SW_REG_REDUNDANT] = 'The service worker being used for push was made ' + 'redundant.', _a[ERROR_CODES.TOKEN_SUBSCRIBE_FAILED] = 'A problem occured while subscribing the ' + 'user to FCM: {$message}', _a[ERROR_CODES.TOKEN_SUBSCRIBE_NO_TOKEN] = 'FCM returned no token when subscribing ' + 'the user to push.', _a[ERROR_CODES.TOKEN_SUBSCRIBE_NO_PUSH_SET] = 'FCM returned an invalid response ' + 'when getting an FCM token.', _a[ERROR_CODES.TOKEN_UNSUBSCRIBE_FAILED] = 'A problem occured while unsubscribing the ' + 'user from FCM: {$message}', _a[ERROR_CODES.TOKEN_UPDATE_FAILED] = 'A problem occured while updating the ' + 'user from FCM: {$message}', _a[ERROR_CODES.TOKEN_UPDATE_NO_TOKEN] = 'FCM returned no token when updating ' + 'the user to push.', _a[ERROR_CODES.USE_SW_BEFORE_GET_TOKEN] = 'The useServiceWorker() method may only be called once and must be ' + 'called before calling getToken() to ensure your service worker is used.', _a[ERROR_CODES.INVALID_DELETE_TOKEN] = 'You must pass a valid token into ' + 'deleteToken(), i.e. the token from getToken().', _a[ERROR_CODES.DELETE_TOKEN_NOT_FOUND] = 'The deletion attempt for token could not ' + 'be performed as the token was not found.', _a[ERROR_CODES.DELETE_SCOPE_NOT_FOUND] = 'The deletion attempt for service worker ' + 'scope could not be performed as the scope was not found.', _a[ERROR_CODES.BG_HANDLER_FUNCTION_EXPECTED] = 'The input to ' + 'setBackgroundMessageHandler() must be a function.', _a[ERROR_CODES.NO_WINDOW_CLIENT_TO_MSG] = 'An attempt was made to message a ' + 'non-existant window client.', _a[ERROR_CODES.UNABLE_TO_RESUBSCRIBE] = 'There was an error while re-subscribing ' + 'the FCM token for push messaging. Will have to resubscribe the ' + 'user on next visit. {$message}', _a[ERROR_CODES.NO_FCM_TOKEN_FOR_RESUBSCRIBE] = 'Could not find an FCM token ' + 'and as a result, unable to resubscribe. Will have to resubscribe the ' + 'user on next visit.', _a[ERROR_CODES.FAILED_TO_DELETE_TOKEN] = 'Unable to delete the currently saved token.', _a[ERROR_CODES.NO_SW_IN_REG] = 'Even though the service worker registration was ' + 'successful, there was a problem accessing the service worker itself.', _a[ERROR_CODES.INCORRECT_GCM_SENDER_ID] = "Please change your web app manifest's " + "'gcm_sender_id' value to '103953800507' to use Firebase messaging.", _a[ERROR_CODES.BAD_SCOPE] = 'The service worker scope must be a string with at ' + 'least one character.', _a[ERROR_CODES.BAD_VAPID_KEY] = 'The public VAPID key is not a Uint8Array with 65 bytes.', _a[ERROR_CODES.BAD_SUBSCRIPTION] = 'The subscription must be a valid ' + 'PushSubscription.', _a[ERROR_CODES.BAD_TOKEN] = 'The FCM Token used for storage / lookup was not ' + 'a valid token string.', _a[ERROR_CODES.BAD_PUSH_SET] = 'The FCM push set used for storage / lookup was not ' + 'not a valid push set string.', _a[ERROR_CODES.FAILED_DELETE_VAPID_KEY] = 'The VAPID key could not be deleted.', _a[ERROR_CODES.INVALID_PUBLIC_VAPID_KEY] = 'The public VAPID key must be a string.', _a[ERROR_CODES.PUBLIC_KEY_DECRYPTION_FAILED] = 'The public VAPID key did not equal ' + '65 bytes when decrypted.', _a); var errorFactory = new _firebase_util__WEBPACK_IMPORTED_MODULE_0__["ErrorFactory"]('messaging', 'Messaging', ERROR_MAP); var _a; /** * Copyright 2017 Google Inc. * * 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. */ var DEFAULT_PUBLIC_VAPID_KEY = new Uint8Array([ 0x04, 0x33, 0x94, 0xf7, 0xdf, 0xa1, 0xeb, 0xb1, 0xdc, 0x03, 0xa2, 0x5e, 0x15, 0x71, 0xdb, 0x48, 0xd3, 0x2e, 0xed, 0xed, 0xb2, 0x34, 0xdb, 0xb7, 0x47, 0x3a, 0x0c, 0x8f, 0xc4, 0xcc, 0xe1, 0x6f, 0x3c, 0x8c, 0x84, 0xdf, 0xab, 0xb6, 0x66, 0x3e, 0xf2, 0x0c, 0xd4, 0x8b, 0xfe, 0xe3, 0xf9, 0x76, 0x2f, 0x14, 0x1c, 0x63, 0x08, 0x6a, 0x6f, 0x2d, 0xb1, 0x1a, 0x95, 0xb0, 0xce, 0x37, 0xc0, 0x9c, 0x6e ]); var ENDPOINT = 'https://fcm.googleapis.com'; /** * Copyright 2017 Google Inc. * * 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. */ var MessageParameter; (function (MessageParameter) { MessageParameter["TYPE_OF_MSG"] = "firebase-messaging-msg-type"; MessageParameter["DATA"] = "firebase-messaging-msg-data"; })(MessageParameter || (MessageParameter = {})); var MessageType; (function (MessageType) { MessageType["PUSH_MSG_RECEIVED"] = "push-msg-received"; MessageType["NOTIFICATION_CLICKED"] = "notification-clicked"; })(MessageType || (MessageType = {})); /** * Copyright 2018 Google Inc. * * 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. */ function isArrayBufferEqual(a, b) { if (a == null || b == null) { return false; } if (a === b) { return true; } if (a.byteLength !== b.byteLength) { return false; } var viewA = new DataView(a); var viewB = new DataView(b); for (var i = 0; i < a.byteLength; i++) { if (viewA.getUint8(i) !== viewB.getUint8(i)) { return false; } } return true; } /** * Copyright 2017 Google Inc. * * 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. */ function toBase64(arrayBuffer) { var uint8Version = new Uint8Array(arrayBuffer); return btoa(String.fromCharCode.apply(null, uint8Version)); } function arrayBufferToBase64(arrayBuffer) { var base64String = toBase64(arrayBuffer); return base64String .replace(/=/g, '') .replace(/\+/g, '-') .replace(/\//g, '_'); } /** * Copyright 2017 Google Inc. * * 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. */ var IidModel = /** @class */ (function () { function IidModel() { } IidModel.prototype.getToken = function (senderId, subscription, publicVapidKey) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var p256dh, auth, fcmSubscribeBody, applicationPubKey, headers, subscribeOptions, responseData, response, err_1, message; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: p256dh = arrayBufferToBase64(subscription.getKey('p256dh')); auth = arrayBufferToBase64(subscription.getKey('auth')); fcmSubscribeBody = "authorized_entity=" + senderId + "&" + ("endpoint=" + subscription.endpoint + "&") + ("encryption_key=" + p256dh + "&") + ("encryption_auth=" + auth); if (!isArrayBufferEqual(publicVapidKey.buffer, DEFAULT_PUBLIC_VAPID_KEY.buffer)) { applicationPubKey = arrayBufferToBase64(publicVapidKey); fcmSubscribeBody += "&application_pub_key=" + applicationPubKey; } headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded'); subscribeOptions = { method: 'POST', headers: headers, body: fcmSubscribeBody }; _a.label = 1; case 1: _a.trys.push([1, 4, , 5]); return [4 /*yield*/, fetch(ENDPOINT + '/fcm/connect/subscribe', subscribeOptions)]; case 2: response = _a.sent(); return [4 /*yield*/, response.json()]; case 3: responseData = _a.sent(); return [3 /*break*/, 5]; case 4: err_1 = _a.sent(); throw errorFactory.create(ERROR_CODES.TOKEN_SUBSCRIBE_FAILED); case 5: if (responseData.error) { message = responseData.error.message; throw errorFactory.create(ERROR_CODES.TOKEN_SUBSCRIBE_FAILED, { message: message }); } if (!responseData.token) { throw errorFactory.create(ERROR_CODES.TOKEN_SUBSCRIBE_NO_TOKEN); } if (!responseData.pushSet) { throw errorFactory.create(ERROR_CODES.TOKEN_SUBSCRIBE_NO_PUSH_SET); } return [2 /*return*/, { token: responseData.token, pushSet: responseData.pushSet }]; } }); }); }; /** * Update the underlying token details for fcmToken. */ IidModel.prototype.updateToken = function (senderId, fcmToken, fcmPushSet, subscription, publicVapidKey) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var p256dh, auth, fcmUpdateBody, applicationPubKey, headers, updateOptions, responseData, response, err_2, message; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: p256dh = arrayBufferToBase64(subscription.getKey('p256dh')); auth = arrayBufferToBase64(subscription.getKey('auth')); fcmUpdateBody = "push_set=" + fcmPushSet + "&" + ("token=" + fcmToken + "&") + ("authorized_entity=" + senderId + "&") + ("endpoint=" + subscription.endpoint + "&") + ("encryption_key=" + p256dh + "&") + ("encryption_auth=" + auth); if (!isArrayBufferEqual(publicVapidKey.buffer, DEFAULT_PUBLIC_VAPID_KEY.buffer)) { applicationPubKey = arrayBufferToBase64(publicVapidKey); fcmUpdateBody += "&application_pub_key=" + applicationPubKey; } headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded'); updateOptions = { method: 'POST', headers: headers, body: fcmUpdateBody }; _a.label = 1; case 1: _a.trys.push([1, 4, , 5]); return [4 /*yield*/, fetch(ENDPOINT + '/fcm/connect/subscribe', updateOptions)]; case 2: response = _a.sent(); return [4 /*yield*/, response.json()]; case 3: responseData = _a.sent(); return [3 /*break*/, 5]; case 4: err_2 = _a.sent(); throw errorFactory.create(ERROR_CODES.TOKEN_UPDATE_FAILED); case 5: if (responseData.error) { message = responseData.error.message; throw errorFactory.create(ERROR_CODES.TOKEN_UPDATE_FAILED, { message: message }); } if (!responseData.token) { throw errorFactory.create(ERROR_CODES.TOKEN_UPDATE_NO_TOKEN); } return [2 /*return*/, responseData.token]; } }); }); }; /** * Given a fcmToken, pushSet and messagingSenderId, delete an FCM token. */ IidModel.prototype.deleteToken = function (senderId, fcmToken, fcmPushSet) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var fcmUnsubscribeBody, headers, unsubscribeOptions, response, responseData, message, err_3; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: fcmUnsubscribeBody = "authorized_entity=" + senderId + "&" + ("token=" + fcmToken + "&") + ("pushSet=" + fcmPushSet); headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded'); unsubscribeOptions = { method: 'POST', headers: headers, body: fcmUnsubscribeBody }; _a.label = 1; case 1: _a.trys.push([1, 4, , 5]); return [4 /*yield*/, fetch(ENDPOINT + '/fcm/connect/unsubscribe', unsubscribeOptions)]; case 2: response = _a.sent(); return [4 /*yield*/, response.json()]; case 3: responseData = _a.sent(); if (responseData.error) { message = responseData.error.message; throw errorFactory.create(ERROR_CODES.TOKEN_UNSUBSCRIBE_FAILED, { message: message }); } return [3 /*break*/, 5]; case 4: err_3 = _a.sent(); throw errorFactory.create(ERROR_CODES.TOKEN_UNSUBSCRIBE_FAILED); case 5: return [2 /*return*/]; } }); }); }; return IidModel; }()); /** * Copyright 2017 Google Inc. * * 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. */ function base64ToArrayBuffer(base64String) { var padding = '='.repeat((4 - base64String.length % 4) % 4); var base64 = (base64String + padding) .replace(/\-/g, '+') .replace(/_/g, '/'); var rawData = atob(base64); var outputArray = new Uint8Array(rawData.length); for (var i = 0; i < rawData.length; ++i) { outputArray[i] = rawData.charCodeAt(i); } return outputArray; } /** * Copyright 2017 Google Inc. * * 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. */ var OLD_DB_NAME = 'undefined'; var OLD_OBJECT_STORE_NAME = 'fcm_token_object_Store'; function handleDb(db) { if (!db.objectStoreNames.contains(OLD_OBJECT_STORE_NAME)) { // We found a database with the name 'undefined', but our expected object // store isn't defined. return; } var transaction = db.transaction(OLD_OBJECT_STORE_NAME); var objectStore = transaction.objectStore(OLD_OBJECT_STORE_NAME); var iidModel = new IidModel(); var openCursorRequest = objectStore.openCursor(); openCursorRequest.onerror = function (event) { // NOOP - Nothing we can do. console.warn('Unable to cleanup old IDB.', event); }; openCursorRequest.onsuccess = function () { var cursor = openCursorRequest.result; if (cursor) { // cursor.value contains the current record being iterated through // this is where you'd do something with the result var tokenDetails = cursor.value; iidModel.deleteToken(tokenDetails.fcmSenderId, tokenDetails.fcmToken, tokenDetails.fcmPushSet); cursor.continue(); } else { db.close(); indexedDB.deleteDatabase(OLD_DB_NAME); } }; } function cleanV1() { var request = indexedDB.open(OLD_DB_NAME); request.onerror = function (event) { // NOOP - Nothing we can do. }; request.onsuccess = function (event) { var db = request.result; handleDb(db); }; } /** * Copyright 2017 Google Inc. * * 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. */ var DbInterface = /** @class */ (function () { function DbInterface() { this.dbPromise = null; } /** Gets record(s) from the objectStore that match the given key. */ DbInterface.prototype.get = function (key) { return this.createTransaction(function (objectStore) { return objectStore.get(key); }); }; /** Gets record(s) from the objectStore that match the given index. */ DbInterface.prototype.getIndex = function (index, key) { function runRequest(objectStore) { var idbIndex = objectStore.index(index); return idbIndex.get(key); } return this.createTransaction(runRequest); }; /** Assigns or overwrites the record for the given value. */ // tslint:disable-next-line:no-any IndexedDB values are of type "any" DbInterface.prototype.put = function (value) { return this.createTransaction(function (objectStore) { return objectStore.put(value); }, 'readwrite'); }; /** Deletes record(s) from the objectStore that match the given key. */ DbInterface.prototype.delete = function (key) { return this.createTransaction(function (objectStore) { return objectStore.delete(key); }, 'readwrite'); }; /** * Close the currently open database. */ DbInterface.prototype.closeDatabase = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var db; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!this.dbPromise) return [3 /*break*/, 2]; return [4 /*yield*/, this.dbPromise]; case 1: db = _a.sent(); db.close(); this.dbPromise = null; _a.label = 2; case 2: return [2 /*return*/]; } }); }); }; /** * Creates an IndexedDB Transaction and passes its objectStore to the * runRequest function, which runs the database request. * * @return Promise that resolves with the result of the runRequest function */ DbInterface.prototype.createTransaction = function (runRequest, mode) { if (mode === void 0) { mode = 'readonly'; } return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var db, transaction, request, result; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.getDb()]; case 1: db = _a.sent(); transaction = db.transaction(this.objectStoreName, mode); request = transaction.objectStore(this.objectStoreName); return [4 /*yield*/, promisify(runRequest(request))]; case 2: result = _a.sent(); return [2 /*return*/, new Promise(function (resolve, reject) { transaction.oncomplete = function () { resolve(result); }; transaction.onerror = function () { reject(transaction.error); }; })]; } }); }); }; /** Gets the cached db connection or opens a new one. */ DbInterface.prototype.getDb = function () { var _this = this; if (!this.dbPromise) { this.dbPromise = new Promise(function (resolve, reject) { var request = indexedDB.open(_this.dbName, _this.dbVersion); request.onsuccess = function () { resolve(request.result); }; request.onerror = function () { _this.dbPromise = null; reject(request.error); }; request.onupgradeneeded = function (event) { return _this.onDbUpgrade(request, event); }; }); } return this.dbPromise; }; return DbInterface; }()); /** Promisifies an IDBRequest. Resolves with the IDBRequest's result. */ function promisify(request) { return new Promise(function (resolve, reject) { request.onsuccess = function () { resolve(request.result); }; request.onerror = function () { reject(request.error); }; }); } /** * Copyright 2017 Google Inc. * * 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. */ var TokenDetailsModel = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(TokenDetailsModel, _super); function TokenDetailsModel() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.dbName = 'fcm_token_details_db'; _this.dbVersion = 3; _this.objectStoreName = 'fcm_token_object_Store'; return _this; } TokenDetailsModel.prototype.onDbUpgrade = function (request, event) { var db = request.result; // Lack of 'break' statements is intentional. switch (event.oldVersion) { case 0: { // New IDB instance var objectStore = db.createObjectStore(this.objectStoreName, { keyPath: 'swScope' }); // Make sure the sender ID can be searched objectStore.createIndex('fcmSenderId', 'fcmSenderId', { unique: false }); objectStore.createIndex('fcmToken', 'fcmToken', { unique: true }); } case 1: { // Prior to version 2, we were using either 'fcm_token_details_db' // or 'undefined' as the database name due to bug in the SDK // So remove the old tokens and databases. cleanV1(); } case 2: { var objectStore = request.transaction.objectStore(this.objectStoreName); var cursorRequest_1 = objectStore.openCursor(); cursorRequest_1.onsuccess = function () { var cursor = cursorRequest_1.result; if (cursor) { var value = cursor.value; var newValue = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, value); if (!value.createTime) { newValue.createTime = Date.now(); } if (typeof value.vapidKey === 'string') { newValue.vapidKey = base64ToArrayBuffer(value.vapidKey); } if (typeof value.auth === 'string') { newValue.auth = base64ToArrayBuffer(value.auth).buffer; } if (typeof value.auth === 'string') { newValue.p256dh = base64ToArrayBuffer(value.p256dh).buffer; } cursor.update(newValue); cursor.continue(); } }; } } }; /** * Given a token, this method will look up the details in indexedDB. */ TokenDetailsModel.prototype.getTokenDetailsFromToken = function (fcmToken) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { if (!fcmToken) { throw errorFactory.create(ERROR_CODES.BAD_TOKEN); } validateInputs({ fcmToken: fcmToken }); return [2 /*return*/, this.getIndex('fcmToken', fcmToken)]; }); }); }; /** * Given a service worker scope, this method will look up the details in * indexedDB. * @return The details associated with that token. */ TokenDetailsModel.prototype.getTokenDetailsFromSWScope = function (swScope) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { if (!swScope) { throw errorFactory.create(ERROR_CODES.BAD_SCOPE); } validateInputs({ swScope: swScope }); return [2 /*return*/, this.get(swScope)]; }); }); }; /** * Save the details for the fcm token for re-use at a later date. * @param input A plain js object containing args to save. */ TokenDetailsModel.prototype.saveTokenDetails = function (tokenDetails) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { if (!tokenDetails.swScope) { throw errorFactory.create(ERROR_CODES.BAD_SCOPE); } if (!tokenDetails.vapidKey) { throw errorFactory.create(ERROR_CODES.BAD_VAPID_KEY); } if (!tokenDetails.endpoint || !tokenDetails.auth || !tokenDetails.p256dh) { throw errorFactory.create(ERROR_CODES.BAD_SUBSCRIPTION); } if (!tokenDetails.fcmSenderId) { throw errorFactory.create(ERROR_CODES.BAD_SENDER_ID); } if (!tokenDetails.fcmToken) { throw errorFactory.create(ERROR_CODES.BAD_TOKEN); } if (!tokenDetails.fcmPushSet) { throw errorFactory.create(ERROR_CODES.BAD_PUSH_SET); } validateInputs(tokenDetails); return [2 /*return*/, this.put(tokenDetails)]; }); }); }; /** * This method deletes details of the current FCM token. * It's returning a promise in case we need to move to an async * method for deleting at a later date. * * @return Resolves once the FCM token details have been deleted and returns * the deleted details. */ TokenDetailsModel.prototype.deleteToken = function (token) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var details; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (typeof token !== 'string' || token.length === 0) { return [2 /*return*/, Promise.reject(errorFactory.create(ERROR_CODES.INVALID_DELETE_TOKEN))]; } return [4 /*yield*/, this.getTokenDetailsFromToken(token)]; case 1: details = _a.sent(); if (!details) { throw errorFactory.create(ERROR_CODES.DELETE_TOKEN_NOT_FOUND); } return [4 /*yield*/, this.delete(details.swScope)]; case 2: _a.sent(); return [2 /*return*/, details]; } }); }); }; return TokenDetailsModel; }(DbInterface)); /** * This method takes an object and will check for known arguments and * validate the input. * @return Promise that resolves if input is valid, rejects otherwise. */ function validateInputs(input) { if (input.fcmToken) { if (typeof input.fcmToken !== 'string' || input.fcmToken.length === 0) { throw errorFactory.create(ERROR_CODES.BAD_TOKEN); } } if (input.swScope) { if (typeof input.swScope !== 'string' || input.swScope.length === 0) { throw errorFactory.create(ERROR_CODES.BAD_SCOPE); } } if (input.vapidKey) { if (!(input.vapidKey instanceof Uint8Array) || input.vapidKey.length !== 65) { throw errorFactory.create(ERROR_CODES.BAD_VAPID_KEY); } } if (input.endpoint) { if (typeof input.endpoint !== 'string' || input.endpoint.length === 0) { throw errorFactory.create(ERROR_CODES.BAD_SUBSCRIPTION); } } if (input.auth) { if (!(input.auth instanceof ArrayBuffer)) { throw errorFactory.create(ERROR_CODES.BAD_SUBSCRIPTION); } } if (input.p256dh) { if (!(input.p256dh instanceof ArrayBuffer)) { throw errorFactory.create(ERROR_CODES.BAD_SUBSCRIPTION); } } if (input.fcmSenderId) { if (typeof input.fcmSenderId !== 'string' || input.fcmSenderId.length === 0) { throw errorFactory.create(ERROR_CODES.BAD_SENDER_ID); } } if (input.fcmPushSet) { if (typeof input.fcmPushSet !== 'string' || input.fcmPushSet.length === 0) { throw errorFactory.create(ERROR_CODES.BAD_PUSH_SET); } } } /** * Copyright 2017 Google Inc. * * 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. */ var UNCOMPRESSED_PUBLIC_KEY_SIZE = 65; var VapidDetailsModel = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(VapidDetailsModel, _super); function VapidDetailsModel() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.dbName = 'fcm_vapid_details_db'; _this.dbVersion = 1; _this.objectStoreName = 'fcm_vapid_object_Store'; return _this; } VapidDetailsModel.prototype.onDbUpgrade = function (request) { var db = request.result; db.createObjectStore(this.objectStoreName, { keyPath: 'swScope' }); }; /** * Given a service worker scope, this method will look up the vapid key * in indexedDB. */ VapidDetailsModel.prototype.getVapidFromSWScope = function (swScope) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var result; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (typeof swScope !== 'string' || swScope.length === 0) { throw errorFactory.create(ERROR_CODES.BAD_SCOPE); } return [4 /*yield*/, this.get(swScope)]; case 1: result = _a.sent(); return [2 /*return*/, result ? result.vapidKey : undefined]; } }); }); }; /** * Save a vapid key against a swScope for later date. */ VapidDetailsModel.prototype.saveVapidDetails = function (swScope, vapidKey) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var details; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { if (typeof swScope !== 'string' || swScope.length === 0) { throw errorFactory.create(ERROR_CODES.BAD_SCOPE); } if (vapidKey === null || vapidKey.length !== UNCOMPRESSED_PUBLIC_KEY_SIZE) { throw errorFactory.create(ERROR_CODES.BAD_VAPID_KEY); } details = { swScope: swScope, vapidKey: vapidKey }; return [2 /*return*/, this.put(details)]; }); }); }; /** * This method deletes details of the current FCM VAPID key for a SW scope. * Resolves once the scope/vapid details have been deleted and returns the * deleted vapid key. */ VapidDetailsModel.prototype.deleteVapidDetails = function (swScope) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var vapidKey; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.getVapidFromSWScope(swScope)]; case 1: vapidKey = _a.sent(); if (!vapidKey) { throw errorFactory.create(ERROR_CODES.DELETE_SCOPE_NOT_FOUND); } return [4 /*yield*/, this.delete(swScope)]; case 2: _a.sent(); return [2 /*return*/, vapidKey]; } }); }); }; return VapidDetailsModel; }(DbInterface)); /** * Copyright 2017 Google Inc. * * 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. */ var SENDER_ID_OPTION_NAME = 'messagingSenderId'; // Database cache should be invalidated once a week. var TOKEN_EXPIRATION_MILLIS = 7 * 24 * 60 * 60 * 1000; // 7 days var BaseController = /** @class */ (function () { /** * An interface of the Messaging Service API */ function BaseController(app) { var _this = this; if (!app.options[SENDER_ID_OPTION_NAME] || typeof app.options[SENDER_ID_OPTION_NAME] !== 'string') { throw errorFactory.create(ERROR_CODES.BAD_SENDER_ID); } this.messagingSenderId = app.options[SENDER_ID_OPTION_NAME]; this.tokenDetailsModel = new TokenDetailsModel(); this.vapidDetailsModel = new VapidDetailsModel(); this.iidModel = new IidModel(); this.app = app; this.INTERNAL = { delete: function () { return _this.delete(); } }; } /** * @export */ BaseController.prototype.getToken = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var currentPermission, swReg, publicVapidKey, pushSubscription, tokenDetails; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: currentPermission = this.getNotificationPermission_(); if (currentPermission === 'denied') { throw errorFactory.create(ERROR_CODES.NOTIFICATIONS_BLOCKED); } else if (currentPermission !== 'granted') { // We must wait for permission to be granted return [2 /*return*/, null]; } return [4 /*yield*/, this.getSWRegistration_()]; case 1: swReg = _a.sent(); return [4 /*yield*/, this.getPublicVapidKey_()]; case 2: publicVapidKey = _a.sent(); return [4 /*yield*/, this.getPushSubscription(swReg, publicVapidKey)]; case 3: pushSubscription = _a.sent(); return [4 /*yield*/, this.tokenDetailsModel.getTokenDetailsFromSWScope(swReg.scope)]; case 4: tokenDetails = _a.sent(); if (tokenDetails) { return [2 /*return*/, this.manageExistingToken(swReg, pushSubscription, publicVapidKey, tokenDetails)]; } return [2 /*return*/, this.getNewToken(swReg, pushSubscription, publicVapidKey)]; } }); }); }; /** * manageExistingToken is triggered if there's an existing FCM token in the * database and it can take 3 different actions: * 1) Retrieve the existing FCM token from the database. * 2) If VAPID details have changed: Delete the existing token and create a * new one with the new VAPID key. * 3) If the database cache is invalidated: Send a request to FCM to update * the token, and to check if the token is still valid on FCM-side. */ BaseController.prototype.manageExistingToken = function (swReg, pushSubscription, publicVapidKey, tokenDetails) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var isTokenValid, now; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: isTokenValid = isTokenStillValid(pushSubscription, publicVapidKey, tokenDetails); if (isTokenValid) { now = Date.now(); if (now < tokenDetails.createTime + TOKEN_EXPIRATION_MILLIS) { return [2 /*return*/, tokenDetails.fcmToken]; } else { return [2 /*return*/, this.updateToken(swReg, pushSubscription, publicVapidKey, tokenDetails)]; } } // If the token is no longer valid (for example if the VAPID details // have changed), delete the existing token from the FCM client and server // database. No need to unsubscribe from the Service Worker as we have a // good push subscription that we'd like to use in getNewToken. return [4 /*yield*/, this.deleteTokenFromDB(tokenDetails.fcmToken)]; case 1: // If the token is no longer valid (for example if the VAPID details // have changed), delete the existing token from the FCM client and server // database. No need to unsubscribe from the Service Worker as we have a // good push subscription that we'd like to use in getNewToken. _a.sent(); return [2 /*return*/, this.getNewToken(swReg, pushSubscription, publicVapidKey)]; } }); }); }; BaseController.prototype.updateToken = function (swReg, pushSubscription, publicVapidKey, tokenDetails) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var updatedToken, allDetails, e_1; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 4, , 6]); return [4 /*yield*/, this.iidModel.updateToken(this.messagingSenderId, tokenDetails.fcmToken, tokenDetails.fcmPushSet, pushSubscription, publicVapidKey)]; case 1: updatedToken = _a.sent(); allDetails = { swScope: swReg.scope, vapidKey: publicVapidKey, fcmSenderId: this.messagingSenderId, fcmToken: updatedToken, fcmPushSet: tokenDetails.fcmPushSet, createTime: Date.now(), endpoint: pushSubscription.endpoint, auth: pushSubscription.getKey('auth'), p256dh: pushSubscription.getKey('p256dh') }; return [4 /*yield*/, this.tokenDetailsModel.saveTokenDetails(allDetails)]; case 2: _a.sent(); return [4 /*yield*/, this.vapidDetailsModel.saveVapidDetails(swReg.scope, publicVapidKey)]; case 3: _a.sent(); return [2 /*return*/, updatedToken]; case 4: e_1 = _a.sent(); return [4 /*yield*/, this.deleteToken(tokenDetails.fcmToken)]; case 5: _a.sent(); throw e_1; case 6: return [2 /*return*/]; } }); }); }; BaseController.prototype.getNewToken = function (swReg, pushSubscription, publicVapidKey) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var tokenDetails, allDetails; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.iidModel.getToken(this.messagingSenderId, pushSubscription, publicVapidKey)]; case 1: tokenDetails = _a.sent(); allDetails = { swScope: swReg.scope, vapidKey: publicVapidKey, fcmSenderId: this.messagingSenderId, fcmToken: tokenDetails.token, fcmPushSet: tokenDetails.pushSet, createTime: Date.now(), endpoint: pushSubscription.endpoint, auth: pushSubscription.getKey('auth'), p256dh: pushSubscription.getKey('p256dh') }; return [4 /*yield*/, this.tokenDetailsModel.saveTokenDetails(allDetails)]; case 2: _a.sent(); return [4 /*yield*/, this.vapidDetailsModel.saveVapidDetails(swReg.scope, publicVapidKey)]; case 3: _a.sent(); return [2 /*return*/, tokenDetails.token]; } }); }); }; /** * This method deletes tokens that the token manager looks after, * unsubscribes the token from FCM and then unregisters the push * subscription if it exists. It returns a promise that indicates * whether or not the unsubscribe request was processed successfully. */ BaseController.prototype.deleteToken = function (token) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var registration, pushSubscription; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: // Delete the token details from the database. return [4 /*yield*/, this.deleteTokenFromDB(token)]; case 1: // Delete the token details from the database. _a.sent(); return [4 /*yield*/, this.getSWRegistration_()]; case 2: registration = _a.sent(); if (!registration) return [3 /*break*/, 4]; return [4 /*yield*/, registration.pushManager.getSubscription()]; case 3: pushSubscription = _a.sent(); if (pushSubscription) { return [2 /*return*/, pushSubscription.unsubscribe()]; } _a.label = 4; case 4: // If there's no SW, consider it a success. return [2 /*return*/, true]; } }); }); }; /** * This method will delete the token from the client database, and make a * call to FCM to remove it from the server DB. Does not temper with the * push subscription. */ BaseController.prototype.deleteTokenFromDB = function (token) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var details; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.tokenDetailsModel.deleteToken(token)]; case 1: details = _a.sent(); return [4 /*yield*/, this.iidModel.deleteToken(details.fcmSenderId, details.fcmToken, details.fcmPushSet)]; case 2: _a.sent(); return [2 /*return*/]; } }); }); }; /** * Gets a PushSubscription for the current user. */ BaseController.prototype.getPushSubscription = function (swRegistration, publicVapidKey) { return swRegistration.pushManager.getSubscription().then(function (subscription) { if (subscription) { return subscription; } return swRegistration.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: publicVapidKey }); }); }; // // The following methods should only be available in the window. // BaseController.prototype.requestPermission = function () { throw errorFactory.create(ERROR_CODES.AVAILABLE_IN_WINDOW); }; BaseController.prototype.useServiceWorker = function (registration) { throw errorFactory.create(ERROR_CODES.AVAILABLE_IN_WINDOW); }; BaseController.prototype.usePublicVapidKey = function (b64PublicKey) { throw errorFactory.create(ERROR_CODES.AVAILABLE_IN_WINDOW); }; BaseController.prototype.onMessage = function (nextOrObserver, error, completed) { throw errorFactory.create(ERROR_CODES.AVAILABLE_IN_WINDOW); }; BaseController.prototype.onTokenRefresh = function (nextOrObserver, error, completed) { throw errorFactory.create(ERROR_CODES.AVAILABLE_IN_WINDOW); }; // // The following methods are used by the service worker only. // BaseController.prototype.setBackgroundMessageHandler = function (callback) { throw errorFactory.create(ERROR_CODES.AVAILABLE_IN_SW); }; // // The following methods are used by the service themselves and not exposed // publicly or not expected to be used by developers. // /** * This method is required to adhere to the Firebase interface. * It closes any currently open indexdb database connections. */ BaseController.prototype.delete = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, Promise.all([ this.tokenDetailsModel.closeDatabase(), this.vapidDetailsModel.closeDatabase() ])]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; /** * Returns the current Notification Permission state. */ BaseController.prototype.getNotificationPermission_ = function () { // TODO: Remove the cast when this issue is fixed: // https://github.com/Microsoft/TypeScript/issues/14701 // tslint:disable-next-line no-any return Notification.permission; }; BaseController.prototype.getTokenDetailsModel = function () { return this.tokenDetailsModel; }; BaseController.prototype.getVapidDetailsModel = function () { return this.vapidDetailsModel; }; // Visible for testing // TODO: make protected BaseController.prototype.getIidModel = function () { return this.iidModel; }; return BaseController; }()); /** * Checks if the tokenDetails match the details provided in the clients. */ function isTokenStillValid(pushSubscription, publicVapidKey, tokenDetails) { if (!tokenDetails.vapidKey || !isArrayBufferEqual(publicVapidKey.buffer, tokenDetails.vapidKey.buffer)) { return false; } var isEndpointEqual = pushSubscription.endpoint === tokenDetails.endpoint; var isAuthEqual = isArrayBufferEqual(pushSubscription.getKey('auth'), tokenDetails.auth); var isP256dhEqual = isArrayBufferEqual(pushSubscription.getKey('p256dh'), tokenDetails.p256dh); return isEndpointEqual && isAuthEqual && isP256dhEqual; } /** * Copyright 2017 Google Inc. * * 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. */ var FCM_MSG = 'FCM_MSG'; var SwController = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(SwController, _super); function SwController(app) { var _this = _super.call(this, app) || this; _this.bgMessageHandler = null; self.addEventListener('push', function (e) { _this.onPush(e); }); self.addEventListener('pushsubscriptionchange', function (e) { _this.onSubChange(e); }); self.addEventListener('notificationclick', function (e) { _this.onNotificationClick(e); }); return _this; } // Visible for testing // TODO: Make private SwController.prototype.onPush = function (event) { event.waitUntil(this.onPush_(event)); }; // Visible for testing // TODO: Make private SwController.prototype.onSubChange = function (event) { event.waitUntil(this.onSubChange_(event)); }; // Visible for testing // TODO: Make private SwController.prototype.onNotificationClick = function (event) { event.waitUntil(this.onNotificationClick_(event)); }; /** * A handler for push events that shows notifications based on the content of * the payload. * * The payload must be a JSON-encoded Object with a `notification` key. The * value of the `notification` property will be used as the NotificationOptions * object passed to showNotification. Additionally, the `title` property of the * notification object will be used as the title. * * If there is no notification data in the payload then no notification will be * shown. */ SwController.prototype.onPush_ = function (event) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var msgPayload, hasVisibleClients, notificationDetails, notificationTitle, reg, actions, maxActions; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!event.data) { return [2 /*return*/]; } try { msgPayload = event.data.json(); } catch (err) { // Not JSON so not an FCM message return [2 /*return*/]; } return [4 /*yield*/, this.hasVisibleClients_()]; case 1: hasVisibleClients = _a.sent(); if (hasVisibleClients) { // App in foreground. Send to page. return [2 /*return*/, this.sendMessageToWindowClients_(msgPayload)]; } notificationDetails = this.getNotificationData_(msgPayload); if (!notificationDetails) return [3 /*break*/, 3]; notificationTitle = notificationDetails.title || ''; return [4 /*yield*/, this.getSWRegistration_()]; case 2: reg = _a.sent(); actions = notificationDetails.actions; maxActions = Notification.maxActions; // tslint:enable no-any if (actions && maxActions && actions.length > maxActions) { console.warn("This browser only supports " + maxActions + " actions." + "The remaining actions will not be displayed."); } return [2 /*return*/, reg.showNotification(notificationTitle, notificationDetails)]; case 3: if (!this.bgMessageHandler) return [3 /*break*/, 5]; return [4 /*yield*/, this.bgMessageHandler(msgPayload)]; case 4: _a.sent(); return [2 /*return*/]; case 5: return [2 /*return*/]; } }); }); }; SwController.prototype.onSubChange_ = function (event) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var registration, err_1, err_2, tokenDetailsModel, tokenDetails; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4 /*yield*/, this.getSWRegistration_()]; case 1: registration = _a.sent(); return [3 /*break*/, 3]; case 2: err_1 = _a.sent(); throw errorFactory.create(ERROR_CODES.UNABLE_TO_RESUBSCRIBE, { message: err_1 }); case 3: _a.trys.push([3, 5, , 8]); return [4 /*yield*/, registration.pushManager.getSubscription()]; case 4: _a.sent(); return [3 /*break*/, 8]; case 5: err_2 = _a.sent(); tokenDetailsModel = this.getTokenDetailsModel(); return [4 /*yield*/, tokenDetailsModel.getTokenDetailsFromSWScope(registration.scope)]; case 6: tokenDetails = _a.sent(); if (!tokenDetails) { // This should rarely occure, but could if indexedDB // is corrupted or wiped throw err_2; } // Attempt to delete the token if we know it's bad return [4 /*yield*/, this.deleteToken(tokenDetails.fcmToken)]; case 7: // Attempt to delete the token if we know it's bad _a.sent(); throw err_2; case 8: return [2 /*return*/]; } }); }); }; SwController.prototype.onNotificationClick_ = function (event) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var msgPayload, link, windowClient, internalMsg; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!event.notification || !event.notification.data || !event.notification.data[FCM_MSG]) { // Not an FCM notification, do nothing. return [2 /*return*/]; } else if (event.action) { // User clicked on an action button. // This will allow devs to act on action button clicks by using a custom // onNotificationClick listener that they define. return [2 /*return*/]; } // Prevent other listeners from receiving the event event.stopImmediatePropagation(); event.notification.close(); msgPayload = event.notification.data[FCM_MSG]; if (!msgPayload.notification) { // Nothing to do. return [2 /*return*/]; } link = (msgPayload.fcmOptions && msgPayload.fcmOptions.link) || msgPayload.notification.click_action; if (!link) { // Nothing to do. return [2 /*return*/]; } return [4 /*yield*/, this.getWindowClient_(link)]; case 1: windowClient = _a.sent(); if (!!windowClient) return [3 /*break*/, 3]; return [4 /*yield*/, self.clients.openWindow(link)]; case 2: // Unable to find window client so need to open one. windowClient = _a.sent(); return [3 /*break*/, 5]; case 3: return [4 /*yield*/, windowClient.focus()]; case 4: windowClient = _a.sent(); _a.label = 5; case 5: if (!windowClient) { // Window Client will not be returned if it's for a third party origin. return [2 /*return*/]; } // Delete notification and fcmOptions data from payload before sending to // the page. delete msgPayload.notification; delete msgPayload.fcmOptions; internalMsg = createNewMsg(MessageType.NOTIFICATION_CLICKED, msgPayload); // Attempt to send a message to the client to handle the data // Is affected by: https://github.com/slightlyoff/ServiceWorker/issues/728 return [2 /*return*/, this.attemptToMessageClient_(windowClient, internalMsg)]; } }); }); }; // Visible for testing // TODO: Make private SwController.prototype.getNotificationData_ = function (msgPayload) { if (!msgPayload) { return; } if (typeof msgPayload.notification !== 'object') { return; } var notificationInformation = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, msgPayload.notification); // Put the message payload under FCM_MSG name so we can identify the // notification as being an FCM notification vs a notification from // somewhere else (i.e. normal web push or developer generated // notification). notificationInformation.data = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, msgPayload.notification.data, (_a = {}, _a[FCM_MSG] = msgPayload, _a)); return notificationInformation; var _a; }; /** * Calling setBackgroundMessageHandler will opt in to some specific * behaviours. * 1.) If a notification doesn't need to be shown due to a window already * being visible, then push messages will be sent to the page. * 2.) If a notification needs to be shown, and the message contains no * notification data this method will be called * and the promise it returns will be passed to event.waitUntil. * If you do not set this callback then all push messages will let and the * developer can handle them in a their own 'push' event callback * * @param callback The callback to be called when a push message is received * and a notification must be shown. The callback will be given the data from * the push message. */ SwController.prototype.setBackgroundMessageHandler = function (callback) { if (!callback || typeof callback !== 'function') { throw errorFactory.create(ERROR_CODES.BG_HANDLER_FUNCTION_EXPECTED); } this.bgMessageHandler = callback; }; /** * @param url The URL to look for when focusing a client. * @return Returns an existing window client or a newly opened WindowClient. */ // Visible for testing // TODO: Make private SwController.prototype.getWindowClient_ = function (url) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var parsedURL, clientList, suitableClient, i, parsedClientUrl; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: parsedURL = new URL(url, self.location.href).href; return [4 /*yield*/, getClientList()]; case 1: clientList = _a.sent(); suitableClient = null; for (i = 0; i < clientList.length; i++) { parsedClientUrl = new URL(clientList[i].url, self.location.href) .href; if (parsedClientUrl === parsedURL) { suitableClient = clientList[i]; break; } } return [2 /*return*/, suitableClient]; } }); }); }; /** * This message will attempt to send the message to a window client. * @param client The WindowClient to send the message to. * @param message The message to send to the client. * @returns Returns a promise that resolves after sending the message. This * does not guarantee that the message was successfully received. */ // Visible for testing // TODO: Make private SwController.prototype.attemptToMessageClient_ = function (client, message) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { // NOTE: This returns a promise in case this API is abstracted later on to // do additional work if (!client) { throw errorFactory.create(ERROR_CODES.NO_WINDOW_CLIENT_TO_MSG); } client.postMessage(message); return [2 /*return*/]; }); }); }; /** * @returns If there is currently a visible WindowClient, this method will * resolve to true, otherwise false. */ // Visible for testing // TODO: Make private SwController.prototype.hasVisibleClients_ = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var clientList; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, getClientList()]; case 1: clientList = _a.sent(); return [2 /*return*/, clientList.some(function (client) { return client.visibilityState === 'visible'; })]; } }); }); }; /** * @param msgPayload The data from the push event that should be sent to all * available pages. * @returns Returns a promise that resolves once the message has been sent to * all WindowClients. */ // Visible for testing // TODO: Make private SwController.prototype.sendMessageToWindowClients_ = function (msgPayload) { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var _this = this; var clientList, internalMsg; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, getClientList()]; case 1: clientList = _a.sent(); internalMsg = createNewMsg(MessageType.PUSH_MSG_RECEIVED, msgPayload); return [4 /*yield*/, Promise.all(clientList.map(function (client) { return _this.attemptToMessageClient_(client, internalMsg); }))]; case 2: _a.sent(); return [2 /*return*/]; } }); }); }; /** * This will register the default service worker and return the registration. * @return he service worker registration to be used for the push service. */ SwController.prototype.getSWRegistration_ = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { return [2 /*return*/, self.registration]; }); }); }; /** * This will return the default VAPID key or the uint8array version of the * public VAPID key provided by the developer. */ SwController.prototype.getPublicVapidKey_ = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var swReg, vapidKeyFromDatabase; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.getSWRegistration_()]; case 1: swReg = _a.sent(); if (!swReg) { throw errorFactory.create(ERROR_CODES.SW_REGISTRATION_EXPECTED); } return [4 /*yield*/, this.getVapidDetailsModel().getVapidFromSWScope(swReg.scope)]; case 2: vapidKeyFromDatabase = _a.sent(); if (vapidKeyFromDatabase == null) { return [2 /*return*/, DEFAULT_PUBLIC_VAPID_KEY]; } return [2 /*return*/, vapidKeyFromDatabase]; } }); }); }; return SwController; }(BaseController)); function getClientList() { return self.clients.matchAll({ type: 'window', includeUncontrolled: true // TS doesn't know that "type: 'window'" means it'll return WindowClient[] }); } function createNewMsg(msgType, msgData) { return _a = {}, _a[MessageParameter.TYPE_OF_MSG] = msgType, _a[MessageParameter.DATA] = msgData, _a; var _a; } /** * Copyright 2017 Google Inc. * * 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. */ var DEFAULT_SW_PATH = '/firebase-messaging-sw.js'; var DEFAULT_SW_SCOPE = '/firebase-cloud-messaging-push-scope'; /** * Copyright 2017 Google Inc. * * 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. */ var WindowController = /** @class */ (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(WindowController, _super); /** * A service that provides a MessagingService instance. */ function WindowController(app) { var _this = _super.call(this, app) || this; _this.registrationToUse = null; _this.publicVapidKeyToUse = null; _this.manifestCheckPromise = null; _this.messageObserver = null; // @ts-ignore: Unused variable error, this is not implemented yet. _this.tokenRefreshObserver = null; _this.onMessageInternal = Object(_firebase_util__WEBPACK_IMPORTED_MODULE_0__["createSubscribe"])(function (observer) { _this.messageObserver = observer; }); _this.onTokenRefreshInternal = Object(_firebase_util__WEBPACK_IMPORTED_MODULE_0__["createSubscribe"])(function (observer) { _this.tokenRefreshObserver = observer; }); _this.setupSWMessageListener_(); return _this; } /** * This method returns an FCM token if it can be generated. * The return promise will reject if the browser doesn't support * FCM, if permission is denied for notifications or it's not * possible to generate a token. * * @return Returns a promise that resolves to an FCM token or null if * permission isn't granted. */ WindowController.prototype.getToken = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (!this.manifestCheckPromise) { this.manifestCheckPromise = manifestCheck(); } return [4 /*yield*/, this.manifestCheckPromise]; case 1: _a.sent(); return [2 /*return*/, _super.prototype.getToken.call(this)]; } }); }); }; /** * Request permission if it is not currently granted * * @return Resolves if the permission was granted, otherwise rejects */ WindowController.prototype.requestPermission = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var permissionResult; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: if (this.getNotificationPermission_() === 'granted') { return [2 /*return*/]; } return [4 /*yield*/, Notification.requestPermission()]; case 1: permissionResult = _a.sent(); if (permissionResult === 'granted') { return [2 /*return*/]; } else if (permissionResult === 'denied') { throw errorFactory.create(ERROR_CODES.PERMISSION_BLOCKED); } else { throw errorFactory.create(ERROR_CODES.PERMISSION_DEFAULT); } return [2 /*return*/]; } }); }); }; /** * This method allows a developer to override the default service worker and * instead use a custom service worker. * * @param registration The service worker registration that should be used to * receive the push messages. */ WindowController.prototype.useServiceWorker = function (registration) { if (!(registration instanceof ServiceWorkerRegistration)) { throw errorFactory.create(ERROR_CODES.SW_REGISTRATION_EXPECTED); } if (this.registrationToUse != null) { throw errorFactory.create(ERROR_CODES.USE_SW_BEFORE_GET_TOKEN); } this.registrationToUse = registration; }; /** * This method allows a developer to override the default vapid key * and instead use a custom VAPID public key. * * @param publicKey A URL safe base64 encoded string. */ WindowController.prototype.usePublicVapidKey = function (publicKey) { if (typeof publicKey !== 'string') { throw errorFactory.create(ERROR_CODES.INVALID_PUBLIC_VAPID_KEY); } if (this.publicVapidKeyToUse != null) { throw errorFactory.create(ERROR_CODES.USE_PUBLIC_KEY_BEFORE_GET_TOKEN); } var parsedKey = base64ToArrayBuffer(publicKey); if (parsedKey.length !== 65) { throw errorFactory.create(ERROR_CODES.PUBLIC_KEY_DECRYPTION_FAILED); } this.publicVapidKeyToUse = parsedKey; }; /** * @export * @param nextOrObserver An observer object or a function triggered on * message. * @param error A function triggered on message error. * @param completed function triggered when the observer is removed. * @return The unsubscribe function for the observer. */ WindowController.prototype.onMessage = function (nextOrObserver, error, completed) { if (typeof nextOrObserver === 'function') { return this.onMessageInternal(nextOrObserver, error, completed); } else { return this.onMessageInternal(nextOrObserver); } }; /** * @param nextOrObserver An observer object or a function triggered on token * refresh. * @param error A function triggered on token refresh error. * @param completed function triggered when the observer is removed. * @return The unsubscribe function for the observer. */ WindowController.prototype.onTokenRefresh = function (nextOrObserver, error, completed) { if (typeof nextOrObserver === 'function') { return this.onTokenRefreshInternal(nextOrObserver, error, completed); } else { return this.onTokenRefreshInternal(nextOrObserver); } }; /** * Given a registration, wait for the service worker it relates to * become activer * @param registration Registration to wait for service worker to become active * @return Wait for service worker registration to become active */ // Visible for testing // TODO: Make private WindowController.prototype.waitForRegistrationToActivate_ = function (registration) { var serviceWorker = registration.installing || registration.waiting || registration.active; return new Promise(function (resolve, reject) { if (!serviceWorker) { // This is a rare scenario but has occured in firefox reject(errorFactory.create(ERROR_CODES.NO_SW_IN_REG)); return; } // Because the Promise function is called on next tick there is a // small chance that the worker became active or redundant already. if (serviceWorker.state === 'activated') { resolve(registration); return; } if (serviceWorker.state === 'redundant') { reject(errorFactory.create(ERROR_CODES.SW_REG_REDUNDANT)); return; } var stateChangeListener = function () { if (serviceWorker.state === 'activated') { resolve(registration); } else if (serviceWorker.state === 'redundant') { reject(errorFactory.create(ERROR_CODES.SW_REG_REDUNDANT)); } else { // Return early and wait to next state change return; } serviceWorker.removeEventListener('statechange', stateChangeListener); }; serviceWorker.addEventListener('statechange', stateChangeListener); }); }; /** * This will register the default service worker and return the registration * @return The service worker registration to be used for the push service. */ WindowController.prototype.getSWRegistration_ = function () { var _this = this; if (this.registrationToUse) { return this.waitForRegistrationToActivate_(this.registrationToUse); } // Make the registration null so we know useServiceWorker will not // use a new service worker as registrationToUse is no longer undefined this.registrationToUse = null; return navigator.serviceWorker .register(DEFAULT_SW_PATH, { scope: DEFAULT_SW_SCOPE }) .catch(function (err) { throw errorFactory.create(ERROR_CODES.FAILED_DEFAULT_REGISTRATION, { browserErrorMessage: err.message }); }) .then(function (registration) { return _this.waitForRegistrationToActivate_(registration).then(function () { _this.registrationToUse = registration; // We update after activation due to an issue with Firefox v49 where // a race condition occassionally causes the service work to not // install registration.update(); return registration; }); }); }; /** * This will return the default VAPID key or the uint8array version of the public VAPID key * provided by the developer. */ WindowController.prototype.getPublicVapidKey_ = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { if (this.publicVapidKeyToUse) { return [2 /*return*/, this.publicVapidKeyToUse]; } return [2 /*return*/, DEFAULT_PUBLIC_VAPID_KEY]; }); }); }; /** * This method will set up a message listener to handle * events from the service worker that should trigger * events in the page. */ // Visible for testing // TODO: Make private WindowController.prototype.setupSWMessageListener_ = function () { var _this = this; navigator.serviceWorker.addEventListener('message', function (event) { if (!event.data || !event.data[MessageParameter.TYPE_OF_MSG]) { // Not a message from FCM return; } var workerPageMessage = event.data; switch (workerPageMessage[MessageParameter.TYPE_OF_MSG]) { case MessageType.PUSH_MSG_RECEIVED: case MessageType.NOTIFICATION_CLICKED: var pushMessage = workerPageMessage[MessageParameter.DATA]; if (_this.messageObserver) { _this.messageObserver.next(pushMessage); } break; default: // Noop. break; } }, false); }; return WindowController; }(BaseController)); /** * The method checks that a manifest is defined and has the correct GCM * sender ID. * @return Returns a promise that resolves if the manifest matches * our required sender ID */ // Exported for testing function manifestCheck() { return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__awaiter"])(this, void 0, void 0, function () { var manifestTag, manifestContent, response, e_1; return Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__generator"])(this, function (_a) { switch (_a.label) { case 0: manifestTag = document.querySelector('link[rel="manifest"]'); if (!manifestTag) { return [2 /*return*/]; } _a.label = 1; case 1: _a.trys.push([1, 4, , 5]); return [4 /*yield*/, fetch(manifestTag.href)]; case 2: response = _a.sent(); return [4 /*yield*/, response.json()]; case 3: manifestContent = _a.sent(); return [3 /*break*/, 5]; case 4: e_1 = _a.sent(); // If the download or parsing fails allow check. // We only want to error if we KNOW that the gcm_sender_id is incorrect. return [2 /*return*/]; case 5: if (!manifestContent || !manifestContent.gcm_sender_id) { return [2 /*return*/]; } if (manifestContent.gcm_sender_id !== '103953800507') { throw errorFactory.create(ERROR_CODES.INCORRECT_GCM_SENDER_ID); } return [2 /*return*/]; } }); }); } /** * Copyright 2017 Google Inc. * * 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. */ function registerMessaging(instance) { var messagingName = 'messaging'; var factoryMethod = function (app) { if (!isSupported()) { throw errorFactory.create(ERROR_CODES.UNSUPPORTED_BROWSER); } if (self && 'ServiceWorkerGlobalScope' in self) { // Running in ServiceWorker context return new SwController(app); } else { // Assume we are in the window context. return new WindowController(app); } }; var namespaceExports = { isSupported: isSupported }; instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports); } registerMessaging(_firebase_app__WEBPACK_IMPORTED_MODULE_2___default.a); function isSupported() { if (self && 'ServiceWorkerGlobalScope' in self) { // Running in ServiceWorker context return isSWControllerSupported(); } else { // Assume we are in the window context. return isWindowControllerSupported(); } } /** * Checks to see if the required APIs exist. */ function isWindowControllerSupported() { return (navigator.cookieEnabled && 'serviceWorker' in navigator && 'PushManager' in window && 'Notification' in window && 'fetch' in window && ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && PushSubscription.prototype.hasOwnProperty('getKey')); } /** * Checks to see if the required APIs exist within SW Context. */ function isSWControllerSupported() { return ('PushManager' in self && 'Notification' in self && ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && PushSubscription.prototype.hasOwnProperty('getKey')); } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../console-browserify/index.js */ "../../node_modules/console-browserify/index.js"))) /***/ }), /***/ "../../node_modules/@firebase/polyfill/dist/index.esm.js": /*!******************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/polyfill/dist/index.esm.js ***! \******************************************************************************************************************************/ /*! no exports provided */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* WEBPACK VAR INJECTION */(function(setImmediate, console, global) {/* harmony import */ var whatwg_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! whatwg-fetch */ "../../node_modules/@firebase/polyfill/node_modules/whatwg-fetch/fetch.js"); /* harmony import */ var whatwg_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(whatwg_fetch__WEBPACK_IMPORTED_MODULE_0__); // Store setTimeout reference so promise-polyfill will be unaffected by // other code modifying setTimeout (like sinon.useFakeTimers()) var setTimeoutFunc = setTimeout; function noop() {} // Polyfill for Function.prototype.bind function bind(fn, thisArg) { return function() { fn.apply(thisArg, arguments); }; } function Promise(fn) { if (!(this instanceof Promise)) throw new TypeError('Promises must be constructed via new'); if (typeof fn !== 'function') throw new TypeError('not a function'); this._state = 0; this._handled = false; this._value = undefined; this._deferreds = []; doResolve(fn, this); } function handle(self, deferred) { while (self._state === 3) { self = self._value; } if (self._state === 0) { self._deferreds.push(deferred); return; } self._handled = true; Promise._immediateFn(function() { var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { (self._state === 1 ? resolve : reject)(deferred.promise, self._value); return; } var ret; try { ret = cb(self._value); } catch (e) { reject(deferred.promise, e); return; } resolve(deferred.promise, ret); }); } function resolve(self, newValue) { try { // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.'); if ( newValue && (typeof newValue === 'object' || typeof newValue === 'function') ) { var then = newValue.then; if (newValue instanceof Promise) { self._state = 3; self._value = newValue; finale(self); return; } else if (typeof then === 'function') { doResolve(bind(then, newValue), self); return; } } self._state = 1; self._value = newValue; finale(self); } catch (e) { reject(self, e); } } function reject(self, newValue) { self._state = 2; self._value = newValue; finale(self); } function finale(self) { if (self._state === 2 && self._deferreds.length === 0) { Promise._immediateFn(function() { if (!self._handled) { Promise._unhandledRejectionFn(self._value); } }); } for (var i = 0, len = self._deferreds.length; i < len; i++) { handle(self, self._deferreds[i]); } self._deferreds = null; } function Handler(onFulfilled, onRejected, promise) { this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; this.onRejected = typeof onRejected === 'function' ? onRejected : null; this.promise = promise; } /** * Take a potentially misbehaving resolver function and make sure * onFulfilled and onRejected are only called once. * * Makes no guarantees about asynchrony. */ function doResolve(fn, self) { var done = false; try { fn( function(value) { if (done) return; done = true; resolve(self, value); }, function(reason) { if (done) return; done = true; reject(self, reason); } ); } catch (ex) { if (done) return; done = true; reject(self, ex); } } Promise.prototype['catch'] = function(onRejected) { return this.then(null, onRejected); }; Promise.prototype.then = function(onFulfilled, onRejected) { var prom = new this.constructor(noop); handle(this, new Handler(onFulfilled, onRejected, prom)); return prom; }; Promise.prototype['finally'] = function(callback) { var constructor = this.constructor; return this.then( function(value) { return constructor.resolve(callback()).then(function() { return value; }); }, function(reason) { return constructor.resolve(callback()).then(function() { return constructor.reject(reason); }); } ); }; Promise.all = function(arr) { return new Promise(function(resolve, reject) { if (!arr || typeof arr.length === 'undefined') throw new TypeError('Promise.all accepts an array'); var args = Array.prototype.slice.call(arr); if (args.length === 0) return resolve([]); var remaining = args.length; function res(i, val) { try { if (val && (typeof val === 'object' || typeof val === 'function')) { var then = val.then; if (typeof then === 'function') { then.call( val, function(val) { res(i, val); }, reject ); return; } } args[i] = val; if (--remaining === 0) { resolve(args); } } catch (ex) { reject(ex); } } for (var i = 0; i < args.length; i++) { res(i, args[i]); } }); }; Promise.resolve = function(value) { if (value && typeof value === 'object' && value.constructor === Promise) { return value; } return new Promise(function(resolve) { resolve(value); }); }; Promise.reject = function(value) { return new Promise(function(resolve, reject) { reject(value); }); }; Promise.race = function(values) { return new Promise(function(resolve, reject) { for (var i = 0, len = values.length; i < len; i++) { values[i].then(resolve, reject); } }); }; // Use polyfill for setImmediate for performance gains Promise._immediateFn = (typeof setImmediate === 'function' && function(fn) { setImmediate(fn); }) || function(fn) { setTimeoutFunc(fn, 0); }; Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { if (typeof console !== 'undefined' && console) { console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console } }; var globalNS = (function() { // the only reliable means to get the global object is // `Function('return this')()` // However, this causes CSP violations in Chrome apps. if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } throw new Error('unable to locate global object'); })(); if (!globalNS.Promise) { globalNS.Promise = Promise; } function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var _global = createCommonjsModule(function (module) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef }); var _core = createCommonjsModule(function (module) { var core = module.exports = { version: '2.5.5' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef }); var _core_1 = _core.version; var _isObject = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; var _anObject = function (it) { if (!_isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; var _fails = function (exec) { try { return !!exec(); } catch (e) { return true; } }; // Thank's IE8 for his funny defineProperty var _descriptors = !_fails(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); var document = _global.document; // typeof document.createElement is 'object' in old IE var is = _isObject(document) && _isObject(document.createElement); var _domCreate = function (it) { return is ? document.createElement(it) : {}; }; var _ie8DomDefine = !_descriptors && !_fails(function () { return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7; }); // 7.1.1 ToPrimitive(input [, PreferredType]) // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string var _toPrimitive = function (it, S) { if (!_isObject(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; var dP = Object.defineProperty; var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { _anObject(O); P = _toPrimitive(P, true); _anObject(Attributes); if (_ie8DomDefine) try { return dP(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; var _objectDp = { f: f }; var _propertyDesc = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var _hide = _descriptors ? function (object, key, value) { return _objectDp.f(object, key, _propertyDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; var hasOwnProperty = {}.hasOwnProperty; var _has = function (it, key) { return hasOwnProperty.call(it, key); }; var id = 0; var px = Math.random(); var _uid = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; var _redefine = createCommonjsModule(function (module) { var SRC = _uid('src'); var TO_STRING = 'toString'; var $toString = Function[TO_STRING]; var TPL = ('' + $toString).split(TO_STRING); _core.inspectSource = function (it) { return $toString.call(it); }; (module.exports = function (O, key, val, safe) { var isFunction = typeof val == 'function'; if (isFunction) _has(val, 'name') || _hide(val, 'name', key); if (O[key] === val) return; if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); if (O === _global) { O[key] = val; } else if (!safe) { delete O[key]; _hide(O, key, val); } else if (O[key]) { O[key] = val; } else { _hide(O, key, val); } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString() { return typeof this == 'function' && this[SRC] || $toString.call(this); }); }); var _aFunction = function (it) { if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; // optional / simple context binding var _ctx = function (fn, that, length) { _aFunction(fn); if (that === undefined) return fn; switch (length) { case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); var key, own, out, exp; if (IS_GLOBAL) source = name; for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; // extend global if (target) _redefine(target, key, out, type & $export.U); // export if (exports[key] != out) _hide(exports, key, exp); if (IS_PROTO && expProto[key] != out) expProto[key] = out; } }; _global.core = _core; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` var _export = $export; var toString = {}.toString; var _cof = function (it) { return toString.call(it).slice(8, -1); }; // fallback for non-array-like ES3 and non-enumerable old V8 strings // eslint-disable-next-line no-prototype-builtins var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return _cof(it) == 'String' ? it.split('') : Object(it); }; // 7.2.1 RequireObjectCoercible(argument) var _defined = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; // 7.1.13 ToObject(argument) var _toObject = function (it) { return Object(_defined(it)); }; // 7.1.4 ToInteger var ceil = Math.ceil; var floor = Math.floor; var _toInteger = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; // 7.1.15 ToLength var min = Math.min; var _toLength = function (it) { return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; // 7.2.2 IsArray(argument) var _isArray = Array.isArray || function isArray(arg) { return _cof(arg) == 'Array'; }; var SHARED = '__core-js_shared__'; var store = _global[SHARED] || (_global[SHARED] = {}); var _shared = function (key) { return store[key] || (store[key] = {}); }; var _wks = createCommonjsModule(function (module) { var store = _shared('wks'); var Symbol = _global.Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name)); }; $exports.store = store; }); var SPECIES = _wks('species'); var _arraySpeciesConstructor = function (original) { var C; if (_isArray(original)) { C = original.constructor; // cross-realm fallback if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined; if (_isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return C === undefined ? Array : C; }; // 9.4.2.3 ArraySpeciesCreate(originalArray, length) var _arraySpeciesCreate = function (original, length) { return new (_arraySpeciesConstructor(original))(length); }; // 0 -> Array#forEach // 1 -> Array#map // 2 -> Array#filter // 3 -> Array#some // 4 -> Array#every // 5 -> Array#find // 6 -> Array#findIndex var _arrayMethods = function (TYPE, $create) { 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 NO_HOLES = TYPE == 5 || IS_FIND_INDEX; var create = $create || _arraySpeciesCreate; return function ($this, callbackfn, that) { var O = _toObject($this); var self = _iobject(O); var f = _ctx(callbackfn, that, 3); var length = _toLength(self.length); var index = 0; var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; var val, res; for (;length > index; index++) if (NO_HOLES || index in self) { val = self[index]; res = f(val, index, O); if (TYPE) { if (IS_MAP) result[index] = res; // map else if (res) switch (TYPE) { case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if (IS_EVERY) return false; // every } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; }; }; // 22.1.3.31 Array.prototype[@@unscopables] var UNSCOPABLES = _wks('unscopables'); var ArrayProto = Array.prototype; if (ArrayProto[UNSCOPABLES] == undefined) _hide(ArrayProto, UNSCOPABLES, {}); var _addToUnscopables = function (key) { ArrayProto[UNSCOPABLES][key] = true; }; // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) var $find = _arrayMethods(5); var KEY = 'find'; var forced = true; // Shouldn't skip holes if (KEY in []) Array(1)[KEY](function () { forced = false; }); _export(_export.P + _export.F * forced, 'Array', { find: function find(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); _addToUnscopables(KEY); var find = _core.Array.find; // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) var $find$1 = _arrayMethods(6); var KEY$1 = 'findIndex'; var forced$1 = true; // Shouldn't skip holes if (KEY$1 in []) Array(1)[KEY$1](function () { forced$1 = false; }); _export(_export.P + _export.F * forced$1, 'Array', { findIndex: function findIndex(callbackfn /* , that = undefined */) { return $find$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); _addToUnscopables(KEY$1); var findIndex = _core.Array.findIndex; // to indexed object, toObject with fallback for non-array-like ES3 strings var _toIobject = function (it) { return _iobject(_defined(it)); }; var max = Math.max; var min$1 = Math.min; var _toAbsoluteIndex = function (index, length) { index = _toInteger(index); return index < 0 ? max(index + length, 0) : min$1(index, length); }; // false -> Array#indexOf // true -> Array#includes var _arrayIncludes = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = _toIobject($this); var length = _toLength(O.length); var index = _toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) if (IS_INCLUDES || index in O) { if (O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; var shared = _shared('keys'); var _sharedKey = function (key) { return shared[key] || (shared[key] = _uid(key)); }; var arrayIndexOf = _arrayIncludes(false); var IE_PROTO = _sharedKey('IE_PROTO'); var _objectKeysInternal = function (object, names) { var O = _toIobject(object); var i = 0; var result = []; var key; for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (_has(O, key = names[i++])) { ~arrayIndexOf(result, key) || result.push(key); } return result; }; // IE 8- don't enum bug keys var _enumBugKeys = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); // 19.1.2.14 / 15.2.3.14 Object.keys(O) var _objectKeys = Object.keys || function keys(O) { return _objectKeysInternal(O, _enumBugKeys); }; var f$1 = Object.getOwnPropertySymbols; var _objectGops = { f: f$1 }; var f$2 = {}.propertyIsEnumerable; var _objectPie = { f: f$2 }; // 19.1.2.1 Object.assign(target, source, ...) var $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) var _objectAssign = !$assign || _fails(function () { var A = {}; var B = {}; // eslint-disable-next-line no-undef var S = Symbol(); var K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function (k) { B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars var T = _toObject(target); var aLen = arguments.length; var index = 1; var getSymbols = _objectGops.f; var isEnum = _objectPie.f; while (aLen > index) { var S = _iobject(arguments[index++]); var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S); var length = keys.length; var j = 0; var key; while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; } return T; } : $assign; // 19.1.3.1 Object.assign(target, source) _export(_export.S + _export.F, 'Object', { assign: _objectAssign }); var assign = _core.Object.assign; // 7.2.8 IsRegExp(argument) var MATCH = _wks('match'); var _isRegexp = function (it) { var isRegExp; return _isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : _cof(it) == 'RegExp'); }; // helper for String#{startsWith, endsWith, includes} var _stringContext = function (that, searchString, NAME) { if (_isRegexp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); return String(_defined(that)); }; var MATCH$1 = _wks('match'); var _failsIsRegexp = function (KEY) { var re = /./; try { '/./'[KEY](re); } catch (e) { try { re[MATCH$1] = false; return !'/./'[KEY](re); } catch (f) { /* empty */ } } return true; }; var STARTS_WITH = 'startsWith'; var $startsWith = ''[STARTS_WITH]; _export(_export.P + _export.F * _failsIsRegexp(STARTS_WITH), 'String', { startsWith: function startsWith(searchString /* , position = 0 */) { var that = _stringContext(this, searchString, STARTS_WITH); var index = _toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); var search = String(searchString); return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search; } }); var startsWith = _core.String.startsWith; var _stringRepeat = function repeat(count) { var str = String(_defined(this)); var res = ''; var n = _toInteger(count); if (n < 0 || n == Infinity) throw RangeError("Count can't be negative"); for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str; return res; }; _export(_export.P, 'String', { // 21.1.3.13 String.prototype.repeat(count) repeat: _stringRepeat }); var repeat = _core.String.repeat; var _meta = createCommonjsModule(function (module) { var META = _uid('meta'); var setDesc = _objectDp.f; var id = 0; var isExtensible = Object.isExtensible || function () { return true; }; var FREEZE = !_fails(function () { return isExtensible(Object.preventExtensions({})); }); var setMeta = function (it) { setDesc(it, META, { value: { i: 'O' + ++id, // object ID w: {} // weak collections IDs } }); }; var fastKey = function (it, create) { // return primitive with prefix if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!_has(it, META)) { // 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 setMeta(it); // return object ID } return it[META].i; }; var getWeak = function (it, create) { if (!_has(it, META)) { // 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 setMeta(it); // return hash weak collections IDs } return it[META].w; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it); return it; }; var meta = module.exports = { KEY: META, NEED: false, fastKey: fastKey, getWeak: getWeak, onFreeze: onFreeze }; }); var _meta_1 = _meta.KEY; var _meta_2 = _meta.NEED; var _meta_3 = _meta.fastKey; var _meta_4 = _meta.getWeak; var _meta_5 = _meta.onFreeze; var def = _objectDp.f; var TAG = _wks('toStringTag'); var _setToStringTag = function (it, tag, stat) { if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); }; var f$3 = _wks; var _wksExt = { f: f$3 }; var _library = false; var defineProperty = _objectDp.f; var _wksDefine = function (name) { var $Symbol = _core.Symbol || (_core.Symbol = _library ? {} : _global.Symbol || {}); if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) }); }; // all enumerable object keys, includes symbols var _enumKeys = function (it) { var result = _objectKeys(it); var getSymbols = _objectGops.f; if (getSymbols) { var symbols = getSymbols(it); var isEnum = _objectPie.f; var i = 0; var key; while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); } return result; }; var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) { _anObject(O); var keys = _objectKeys(Properties); var length = keys.length; var i = 0; var P; while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]); return O; }; var document$1 = _global.document; var _html = document$1 && document$1.documentElement; // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var IE_PROTO$1 = _sharedKey('IE_PROTO'); var Empty = function () { /* empty */ }; var PROTOTYPE$1 = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function () { // Thrash, waste and sodomy: IE GC bug var iframe = _domCreate('iframe'); var i = _enumBugKeys.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; _html.appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]]; return createDict(); }; var _objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty[PROTOTYPE$1] = _anObject(O); result = new Empty(); Empty[PROTOTYPE$1] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO$1] = O; } else result = createDict(); return Properties === undefined ? result : _objectDps(result, Properties); }; // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return _objectKeysInternal(O, hiddenKeys); }; var _objectGopn = { f: f$4 }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window var gOPN = _objectGopn.f; var toString$1 = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return gOPN(it); } catch (e) { return windowNames.slice(); } }; var f$5 = function getOwnPropertyNames(it) { return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it)); }; var _objectGopnExt = { f: f$5 }; var gOPD = Object.getOwnPropertyDescriptor; var f$6 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) { O = _toIobject(O); P = _toPrimitive(P, true); if (_ie8DomDefine) try { return gOPD(O, P); } catch (e) { /* empty */ } if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]); }; var _objectGopd = { f: f$6 }; // ECMAScript 6 symbols shim var META = _meta.KEY; var gOPD$1 = _objectGopd.f; var dP$1 = _objectDp.f; var gOPN$1 = _objectGopnExt.f; var $Symbol = _global.Symbol; var $JSON = _global.JSON; var _stringify = $JSON && $JSON.stringify; var PROTOTYPE$2 = 'prototype'; var HIDDEN = _wks('_hidden'); var TO_PRIMITIVE = _wks('toPrimitive'); var isEnum = {}.propertyIsEnumerable; var SymbolRegistry = _shared('symbol-registry'); var AllSymbols = _shared('symbols'); var OPSymbols = _shared('op-symbols'); var ObjectProto = Object[PROTOTYPE$2]; var USE_NATIVE = typeof $Symbol == 'function'; var QObject = _global.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDesc = _descriptors && _fails(function () { return _objectCreate(dP$1({}, 'a', { get: function () { return dP$1(this, 'a', { value: 7 }).a; } })).a != 7; }) ? function (it, key, D) { var protoDesc = gOPD$1(ObjectProto, key); if (protoDesc) delete ObjectProto[key]; dP$1(it, key, D); if (protoDesc && it !== ObjectProto) dP$1(ObjectProto, key, protoDesc); } : dP$1; var wrap = function (tag) { var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]); sym._k = tag; return sym; }; var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { return typeof it == 'symbol'; } : function (it) { return it instanceof $Symbol; }; var $defineProperty = function defineProperty(it, key, D) { if (it === ObjectProto) $defineProperty(OPSymbols, key, D); _anObject(it); key = _toPrimitive(key, true); _anObject(D); if (_has(AllSymbols, key)) { if (!D.enumerable) { if (!_has(it, HIDDEN)) dP$1(it, HIDDEN, _propertyDesc(1, {})); it[HIDDEN][key] = true; } else { if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; D = _objectCreate(D, { enumerable: _propertyDesc(0, false) }); } return setSymbolDesc(it, key, D); } return dP$1(it, key, D); }; var $defineProperties = function defineProperties(it, P) { _anObject(it); var keys = _enumKeys(P = _toIobject(P)); var i = 0; var l = keys.length; var key; while (l > i) $defineProperty(it, key = keys[i++], P[key]); return it; }; var $create = function create(it, P) { return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P); }; var $propertyIsEnumerable = function propertyIsEnumerable(key) { var E = isEnum.call(this, key = _toPrimitive(key, true)); if (this === ObjectProto && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false; return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { it = _toIobject(it); key = _toPrimitive(key, true); if (it === ObjectProto && _has(AllSymbols, key) && !_has(OPSymbols, key)) return; var D = gOPD$1(it, key); if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; return D; }; var $getOwnPropertyNames = function getOwnPropertyNames(it) { var names = gOPN$1(_toIobject(it)); var result = []; var i = 0; var key; while (names.length > i) { if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); } return result; }; var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { var IS_OP = it === ObjectProto; var names = gOPN$1(IS_OP ? OPSymbols : _toIobject(it)); var result = []; var i = 0; var key; while (names.length > i) { if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto, key) : true)) result.push(AllSymbols[key]); } return result; }; // 19.4.1.1 Symbol([description]) if (!USE_NATIVE) { $Symbol = function Symbol() { if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); var tag = _uid(arguments.length > 0 ? arguments[0] : undefined); var $set = function (value) { if (this === ObjectProto) $set.call(OPSymbols, value); if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; setSymbolDesc(this, tag, _propertyDesc(1, value)); }; if (_descriptors && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); return wrap(tag); }; _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() { return this._k; }); _objectGopd.f = $getOwnPropertyDescriptor; _objectDp.f = $defineProperty; _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames; _objectPie.f = $propertyIsEnumerable; _objectGops.f = $getOwnPropertySymbols; if (_descriptors && !_library) { _redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } _wksExt.f = function (name) { return wrap(_wks(name)); }; } _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Symbol: $Symbol }); for (var es6Symbols = ( // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' ).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]); for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]); _export(_export.S + _export.F * !USE_NATIVE, 'Symbol', { // 19.4.2.1 Symbol.for(key) 'for': function (key) { return _has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key); }, // 19.4.2.5 Symbol.keyFor(sym) keyFor: function keyFor(sym) { if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; }, useSetter: function () { setter = true; }, useSimple: function () { setter = false; } }); _export(_export.S + _export.F * !USE_NATIVE, 'Object', { // 19.1.2.2 Object.create(O [, Properties]) create: $create, // 19.1.2.4 Object.defineProperty(O, P, Attributes) defineProperty: $defineProperty, // 19.1.2.3 Object.defineProperties(O, Properties) defineProperties: $defineProperties, // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) getOwnPropertyDescriptor: $getOwnPropertyDescriptor, // 19.1.2.7 Object.getOwnPropertyNames(O) getOwnPropertyNames: $getOwnPropertyNames, // 19.1.2.8 Object.getOwnPropertySymbols(O) getOwnPropertySymbols: $getOwnPropertySymbols }); // 24.3.2 JSON.stringify(value [, replacer [, space]]) $JSON && _export(_export.S + _export.F * (!USE_NATIVE || _fails(function () { var S = $Symbol(); // MS Edge converts symbol values to JSON as {} // WebKit converts symbol values to JSON as null // V8 throws on boxed symbols return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; })), 'JSON', { stringify: function stringify(it) { var args = [it]; var i = 1; var replacer, $replacer; while (arguments.length > i) args.push(arguments[i++]); $replacer = replacer = args[1]; if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined if (!_isArray(replacer)) replacer = function (key, value) { if (typeof $replacer == 'function') value = $replacer.call(this, key, value); if (!isSymbol(value)) return value; }; args[1] = replacer; return _stringify.apply($JSON, args); } }); // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf); // 19.4.3.5 Symbol.prototype[@@toStringTag] _setToStringTag($Symbol, 'Symbol'); // 20.2.1.9 Math[@@toStringTag] _setToStringTag(Math, 'Math', true); // 24.3.3 JSON[@@toStringTag] _setToStringTag(_global.JSON, 'JSON', true); // getting tag from 19.1.3.6 Object.prototype.toString() var TAG$1 = _wks('toStringTag'); // ES3 wrong here var ARG = _cof(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (e) { /* empty */ } }; var _classof = function (it) { var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T // builtinTag case : ARG ? _cof(O) // ES3 arguments fallback : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; // 19.1.3.6 Object.prototype.toString() var test = {}; test[_wks('toStringTag')] = 'z'; if (test + '' != '[object z]') { _redefine(Object.prototype, 'toString', function toString() { return '[object ' + _classof(this) + ']'; }, true); } _wksDefine('asyncIterator'); _wksDefine('observable'); var symbol = _core.Symbol; // true -> String#at // false -> String#codePointAt var _stringAt = function (TO_STRING) { return function (that, pos) { var s = String(_defined(that)); var i = _toInteger(pos); var l = s.length; var a, b; if (i < 0 || i >= l) return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; var _iterators = {}; var IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() _hide(IteratorPrototype, _wks('iterator'), function () { return this; }); var _iterCreate = function (Constructor, NAME, next) { Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) }); _setToStringTag(Constructor, NAME + ' Iterator'); }; // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var IE_PROTO$2 = _sharedKey('IE_PROTO'); var ObjectProto$1 = Object.prototype; var _objectGpo = Object.getPrototypeOf || function (O) { O = _toObject(O); if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectProto$1 : null; }; var ITERATOR = _wks('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` var FF_ITERATOR = '@@iterator'; var KEYS = 'keys'; var VALUES = 'values'; var returnThis = function () { return this; }; var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { _iterCreate(Constructor, NAME, next); var getMethod = function (kind) { if (!BUGGY && kind in proto) return proto[kind]; switch (kind) { case KEYS: return function keys() { return new Constructor(this, kind); }; case VALUES: return function values() { return new Constructor(this, kind); }; } return function entries() { return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator'; var DEF_VALUES = DEFAULT == VALUES; var VALUES_BUG = false; var proto = Base.prototype; var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; var $default = $native || getMethod(DEFAULT); var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; var methods, key, IteratorPrototype; // Fix native if ($anyNative) { IteratorPrototype = _objectGpo($anyNative.call(new Base())); if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { // Set @@toStringTag to native iterators _setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF if (DEF_VALUES && $native && $native.name !== VALUES) { VALUES_BUG = true; $default = function values() { return $native.call(this); }; } // Define iterator if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { _hide(proto, ITERATOR, $default); } // Plug for library _iterators[NAME] = $default; _iterators[TAG] = returnThis; if (DEFAULT) { methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if (FORCED) for (key in methods) { if (!(key in proto)) _redefine(proto, key, methods[key]); } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; var $at = _stringAt(true); // 21.1.3.27 String.prototype[@@iterator]() _iterDefine(String, 'String', function (iterated) { this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function () { var O = this._t; var index = this._i; var point; if (index >= O.length) return { value: undefined, done: true }; point = $at(O, index); this._i += point.length; return { value: point, done: false }; }); var _iterStep = function (done, value) { return { value: value, done: !!done }; }; // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) { this._t = _toIobject(iterated); // target this._i = 0; // next index this._k = kind; // kind // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function () { var O = this._t; var kind = this._k; var index = this._i++; if (!O || index >= O.length) { this._t = undefined; return _iterStep(1); } if (kind == 'keys') return _iterStep(0, index); if (kind == 'values') return _iterStep(0, O[index]); return _iterStep(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) _iterators.Arguments = _iterators.Array; _addToUnscopables('keys'); _addToUnscopables('values'); _addToUnscopables('entries'); var ITERATOR$1 = _wks('iterator'); var TO_STRING_TAG = _wks('toStringTag'); var ArrayValues = _iterators.Array; var DOMIterables = { CSSRuleList: true, // TODO: Not spec compliant, should be false. CSSStyleDeclaration: false, CSSValueList: false, ClientRectList: false, DOMRectList: false, DOMStringList: false, DOMTokenList: true, DataTransferItemList: false, FileList: false, HTMLAllCollection: false, HTMLCollection: false, HTMLFormElement: false, HTMLSelectElement: false, MediaList: true, // TODO: Not spec compliant, should be false. MimeTypeArray: false, NamedNodeMap: false, NodeList: true, PaintRequestList: false, Plugin: false, PluginArray: false, SVGLengthList: false, SVGNumberList: false, SVGPathSegList: false, SVGPointList: false, SVGStringList: false, SVGTransformList: false, SourceBufferList: false, StyleSheetList: true, // TODO: Not spec compliant, should be false. TextTrackCueList: false, TextTrackList: false, TouchList: false }; for (var collections = _objectKeys(DOMIterables), i = 0; i < collections.length; i++) { var NAME = collections[i]; var explicit = DOMIterables[NAME]; var Collection = _global[NAME]; var proto = Collection && Collection.prototype; var key; if (proto) { if (!proto[ITERATOR$1]) _hide(proto, ITERATOR$1, ArrayValues); if (!proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME); _iterators[NAME] = ArrayValues; if (explicit) for (key in es6_array_iterator) if (!proto[key]) _redefine(proto, key, es6_array_iterator[key], true); } } var iterator = _wksExt.f('iterator'); /** * Copyright 2017 Google Inc. * * 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. */ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../timers-browserify/main.js */ "../../node_modules/timers-browserify/main.js").setImmediate, __webpack_require__(/*! ./../../../console-browserify/index.js */ "../../node_modules/console-browserify/index.js"), __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "../../node_modules/@firebase/polyfill/node_modules/whatwg-fetch/fetch.js": /*!***********************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/polyfill/node_modules/whatwg-fetch/fetch.js ***! \***********************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { (function(self) { 'use strict'; if (self.fetch) { return } var support = { searchParams: 'URLSearchParams' in self, iterable: 'Symbol' in self && 'iterator' in Symbol, blob: 'FileReader' in self && 'Blob' in self && (function() { try { new Blob() return true } catch(e) { return false } })(), formData: 'FormData' in self, arrayBuffer: 'ArrayBuffer' in self } if (support.arrayBuffer) { var viewClasses = [ '[object Int8Array]', '[object Uint8Array]', '[object Uint8ClampedArray]', '[object Int16Array]', '[object Uint16Array]', '[object Int32Array]', '[object Uint32Array]', '[object Float32Array]', '[object Float64Array]' ] var isDataView = function(obj) { return obj && DataView.prototype.isPrototypeOf(obj) } var isArrayBufferView = ArrayBuffer.isView || function(obj) { return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 } } function normalizeName(name) { if (typeof name !== 'string') { name = String(name) } if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) { throw new TypeError('Invalid character in header field name') } return name.toLowerCase() } function normalizeValue(value) { if (typeof value !== 'string') { value = String(value) } return value } // Build a destructive iterator for the value list function iteratorFor(items) { var iterator = { next: function() { var value = items.shift() return {done: value === undefined, value: value} } } if (support.iterable) { iterator[Symbol.iterator] = function() { return iterator } } return iterator } function Headers(headers) { this.map = {} if (headers instanceof Headers) { headers.forEach(function(value, name) { this.append(name, value) }, this) } else if (Array.isArray(headers)) { headers.forEach(function(header) { this.append(header[0], header[1]) }, this) } else if (headers) { Object.getOwnPropertyNames(headers).forEach(function(name) { this.append(name, headers[name]) }, this) } } Headers.prototype.append = function(name, value) { name = normalizeName(name) value = normalizeValue(value) var oldValue = this.map[name] this.map[name] = oldValue ? oldValue+','+value : value } Headers.prototype['delete'] = function(name) { delete this.map[normalizeName(name)] } Headers.prototype.get = function(name) { name = normalizeName(name) return this.has(name) ? this.map[name] : null } Headers.prototype.has = function(name) { return this.map.hasOwnProperty(normalizeName(name)) } Headers.prototype.set = function(name, value) { this.map[normalizeName(name)] = normalizeValue(value) } Headers.prototype.forEach = function(callback, thisArg) { for (var name in this.map) { if (this.map.hasOwnProperty(name)) { callback.call(thisArg, this.map[name], name, this) } } } Headers.prototype.keys = function() { var items = [] this.forEach(function(value, name) { items.push(name) }) return iteratorFor(items) } Headers.prototype.values = function() { var items = [] this.forEach(function(value) { items.push(value) }) return iteratorFor(items) } Headers.prototype.entries = function() { var items = [] this.forEach(function(value, name) { items.push([name, value]) }) return iteratorFor(items) } if (support.iterable) { Headers.prototype[Symbol.iterator] = Headers.prototype.entries } function consumed(body) { if (body.bodyUsed) { return Promise.reject(new TypeError('Already read')) } body.bodyUsed = true } function fileReaderReady(reader) { return new Promise(function(resolve, reject) { reader.onload = function() { resolve(reader.result) } reader.onerror = function() { reject(reader.error) } }) } function readBlobAsArrayBuffer(blob) { var reader = new FileReader() var promise = fileReaderReady(reader) reader.readAsArrayBuffer(blob) return promise } function readBlobAsText(blob) { var reader = new FileReader() var promise = fileReaderReady(reader) reader.readAsText(blob) return promise } function readArrayBufferAsText(buf) { var view = new Uint8Array(buf) var chars = new Array(view.length) for (var i = 0; i < view.length; i++) { chars[i] = String.fromCharCode(view[i]) } return chars.join('') } function bufferClone(buf) { if (buf.slice) { return buf.slice(0) } else { var view = new Uint8Array(buf.byteLength) view.set(new Uint8Array(buf)) return view.buffer } } function Body() { this.bodyUsed = false this._initBody = function(body) { this._bodyInit = body if (!body) { this._bodyText = '' } else if (typeof body === 'string') { this._bodyText = body } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { this._bodyBlob = body } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { this._bodyFormData = body } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { this._bodyText = body.toString() } else if (support.arrayBuffer && support.blob && isDataView(body)) { this._bodyArrayBuffer = bufferClone(body.buffer) // IE 10-11 can't handle a DataView body. this._bodyInit = new Blob([this._bodyArrayBuffer]) } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { this._bodyArrayBuffer = bufferClone(body) } else { throw new Error('unsupported BodyInit type') } if (!this.headers.get('content-type')) { if (typeof body === 'string') { this.headers.set('content-type', 'text/plain;charset=UTF-8') } else if (this._bodyBlob && this._bodyBlob.type) { this.headers.set('content-type', this._bodyBlob.type) } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8') } } } if (support.blob) { this.blob = function() { var rejected = consumed(this) if (rejected) { return rejected } if (this._bodyBlob) { return Promise.resolve(this._bodyBlob) } else if (this._bodyArrayBuffer) { return Promise.resolve(new Blob([this._bodyArrayBuffer])) } else if (this._bodyFormData) { throw new Error('could not read FormData body as blob') } else { return Promise.resolve(new Blob([this._bodyText])) } } this.arrayBuffer = function() { if (this._bodyArrayBuffer) { return consumed(this) || Promise.resolve(this._bodyArrayBuffer) } else { return this.blob().then(readBlobAsArrayBuffer) } } } this.text = function() { var rejected = consumed(this) if (rejected) { return rejected } if (this._bodyBlob) { return readBlobAsText(this._bodyBlob) } else if (this._bodyArrayBuffer) { return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) } else if (this._bodyFormData) { throw new Error('could not read FormData body as text') } else { return Promise.resolve(this._bodyText) } } if (support.formData) { this.formData = function() { return this.text().then(decode) } } this.json = function() { return this.text().then(JSON.parse) } return this } // HTTP methods whose capitalization should be normalized var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'] function normalizeMethod(method) { var upcased = method.toUpperCase() return (methods.indexOf(upcased) > -1) ? upcased : method } function Request(input, options) { options = options || {} var body = options.body if (input instanceof Request) { if (input.bodyUsed) { throw new TypeError('Already read') } this.url = input.url this.credentials = input.credentials if (!options.headers) { this.headers = new Headers(input.headers) } this.method = input.method this.mode = input.mode if (!body && input._bodyInit != null) { body = input._bodyInit input.bodyUsed = true } } else { this.url = String(input) } this.credentials = options.credentials || this.credentials || 'omit' if (options.headers || !this.headers) { this.headers = new Headers(options.headers) } this.method = normalizeMethod(options.method || this.method || 'GET') this.mode = options.mode || this.mode || null this.referrer = null if ((this.method === 'GET' || this.method === 'HEAD') && body) { throw new TypeError('Body not allowed for GET or HEAD requests') } this._initBody(body) } Request.prototype.clone = function() { return new Request(this, { body: this._bodyInit }) } function decode(body) { var form = new FormData() body.trim().split('&').forEach(function(bytes) { if (bytes) { var split = bytes.split('=') var name = split.shift().replace(/\+/g, ' ') var value = split.join('=').replace(/\+/g, ' ') form.append(decodeURIComponent(name), decodeURIComponent(value)) } }) return form } function parseHeaders(rawHeaders) { var headers = new Headers() // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space // https://tools.ietf.org/html/rfc7230#section-3.2 var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ') preProcessedHeaders.split(/\r?\n/).forEach(function(line) { var parts = line.split(':') var key = parts.shift().trim() if (key) { var value = parts.join(':').trim() headers.append(key, value) } }) return headers } Body.call(Request.prototype) function Response(bodyInit, options) { if (!options) { options = {} } this.type = 'default' this.status = options.status === undefined ? 200 : options.status this.ok = this.status >= 200 && this.status < 300 this.statusText = 'statusText' in options ? options.statusText : 'OK' this.headers = new Headers(options.headers) this.url = options.url || '' this._initBody(bodyInit) } Body.call(Response.prototype) Response.prototype.clone = function() { return new Response(this._bodyInit, { status: this.status, statusText: this.statusText, headers: new Headers(this.headers), url: this.url }) } Response.error = function() { var response = new Response(null, {status: 0, statusText: ''}) response.type = 'error' return response } var redirectStatuses = [301, 302, 303, 307, 308] Response.redirect = function(url, status) { if (redirectStatuses.indexOf(status) === -1) { throw new RangeError('Invalid status code') } return new Response(null, {status: status, headers: {location: url}}) } self.Headers = Headers self.Request = Request self.Response = Response self.fetch = function(input, init) { return new Promise(function(resolve, reject) { var request = new Request(input, init) var xhr = new XMLHttpRequest() xhr.onload = function() { var options = { status: xhr.status, statusText: xhr.statusText, headers: parseHeaders(xhr.getAllResponseHeaders() || '') } options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') var body = 'response' in xhr ? xhr.response : xhr.responseText resolve(new Response(body, options)) } xhr.onerror = function() { reject(new TypeError('Network request failed')) } xhr.ontimeout = function() { reject(new TypeError('Network request failed')) } xhr.open(request.method, request.url, true) if (request.credentials === 'include') { xhr.withCredentials = true } else if (request.credentials === 'omit') { xhr.withCredentials = false } if ('responseType' in xhr && support.blob) { xhr.responseType = 'blob' } request.headers.forEach(function(value, name) { xhr.setRequestHeader(name, value) }) xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit) }) } self.fetch.polyfill = true })(typeof self !== 'undefined' ? self : this); /***/ }), /***/ "../../node_modules/@firebase/storage/dist/index.esm.js": /*!*****************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/storage/dist/index.esm.js ***! \*****************************************************************************************************************************/ /*! exports provided: registerStorage */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerStorage", function() { return registerStorage; }); /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "../../node_modules/@firebase/app/dist/index.cjs.js"); /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_app__WEBPACK_IMPORTED_MODULE_0__); /** * Copyright 2017 Google Inc. * * 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. */ /** * @fileoverview Constants used in the Firebase Storage library. */ /** * Domain and scheme for API calls. */ var domainBase = 'https://firebasestorage.googleapis.com'; /** * Domain and scheme for object downloads. */ var downloadBase = 'https://firebasestorage.googleapis.com'; /** * Base URL for non-upload calls to the API. */ var apiBaseUrl = '/v0'; /** * Base URL for upload calls to the API. */ var apiUploadBaseUrl = '/v0'; var configOption = 'storageBucket'; /** * 2 minutes */ var defaultMaxOperationRetryTime = 2 * 60 * 1000; /** * 10 minutes */ var defaultMaxUploadRetryTime = 10 * 60 * 100; /** * This is the value of Number.MIN_SAFE_INTEGER, which is not well supported * enough for us to use it directly. */ var minSafeInteger = -9007199254740991; /** * Copyright 2017 Google Inc. * * 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. */ var FirebaseStorageError = /** @class */ (function () { function FirebaseStorageError(code, message) { this.code_ = prependCode(code); this.message_ = 'Firebase Storage: ' + message; this.serverResponse_ = null; this.name_ = 'FirebaseError'; } FirebaseStorageError.prototype.codeProp = function () { return this.code; }; FirebaseStorageError.prototype.codeEquals = function (code) { return prependCode(code) === this.codeProp(); }; FirebaseStorageError.prototype.serverResponseProp = function () { return this.serverResponse_; }; FirebaseStorageError.prototype.setServerResponseProp = function (serverResponse) { this.serverResponse_ = serverResponse; }; Object.defineProperty(FirebaseStorageError.prototype, "name", { get: function () { return this.name_; }, enumerable: true, configurable: true }); Object.defineProperty(FirebaseStorageError.prototype, "code", { get: function () { return this.code_; }, enumerable: true, configurable: true }); Object.defineProperty(FirebaseStorageError.prototype, "message", { get: function () { return this.message_; }, enumerable: true, configurable: true }); Object.defineProperty(FirebaseStorageError.prototype, "serverResponse", { get: function () { return this.serverResponse_; }, enumerable: true, configurable: true }); return FirebaseStorageError; }()); var Code = { // Shared between all platforms UNKNOWN: 'unknown', OBJECT_NOT_FOUND: 'object-not-found', BUCKET_NOT_FOUND: 'bucket-not-found', PROJECT_NOT_FOUND: 'project-not-found', QUOTA_EXCEEDED: 'quota-exceeded', UNAUTHENTICATED: 'unauthenticated', UNAUTHORIZED: 'unauthorized', RETRY_LIMIT_EXCEEDED: 'retry-limit-exceeded', INVALID_CHECKSUM: 'invalid-checksum', CANCELED: 'canceled', // JS specific INVALID_EVENT_NAME: 'invalid-event-name', INVALID_URL: 'invalid-url', INVALID_DEFAULT_BUCKET: 'invalid-default-bucket', NO_DEFAULT_BUCKET: 'no-default-bucket', CANNOT_SLICE_BLOB: 'cannot-slice-blob', SERVER_FILE_WRONG_SIZE: 'server-file-wrong-size', NO_DOWNLOAD_URL: 'no-download-url', INVALID_ARGUMENT: 'invalid-argument', INVALID_ARGUMENT_COUNT: 'invalid-argument-count', APP_DELETED: 'app-deleted', INVALID_ROOT_OPERATION: 'invalid-root-operation', INVALID_FORMAT: 'invalid-format', INTERNAL_ERROR: 'internal-error' }; function prependCode(code) { return 'storage/' + code; } function unknown() { var message = 'An unknown error occurred, please check the error payload for ' + 'server response.'; return new FirebaseStorageError(Code.UNKNOWN, message); } function objectNotFound(path) { return new FirebaseStorageError(Code.OBJECT_NOT_FOUND, "Object '" + path + "' does not exist."); } function quotaExceeded(bucket) { return new FirebaseStorageError(Code.QUOTA_EXCEEDED, "Quota for bucket '" + bucket + "' exceeded, please view quota on " + 'https://firebase.google.com/pricing/.'); } function unauthenticated() { var message = 'User is not authenticated, please authenticate using Firebase ' + 'Authentication and try again.'; return new FirebaseStorageError(Code.UNAUTHENTICATED, message); } function unauthorized(path) { return new FirebaseStorageError(Code.UNAUTHORIZED, "User does not have permission to access '" + path + "'."); } function retryLimitExceeded() { return new FirebaseStorageError(Code.RETRY_LIMIT_EXCEEDED, 'Max retry time for operation exceeded, please try again.'); } function canceled() { return new FirebaseStorageError(Code.CANCELED, 'User canceled the upload/download.'); } function invalidUrl(url) { return new FirebaseStorageError(Code.INVALID_URL, "Invalid URL '" + url + "'."); } function invalidDefaultBucket(bucket) { return new FirebaseStorageError(Code.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + bucket + "'."); } function cannotSliceBlob() { return new FirebaseStorageError(Code.CANNOT_SLICE_BLOB, 'Cannot slice blob for upload. Please retry the upload.'); } function serverFileWrongSize() { return new FirebaseStorageError(Code.SERVER_FILE_WRONG_SIZE, 'Server recorded incorrect upload file size, please retry the upload.'); } function noDownloadURL() { return new FirebaseStorageError(Code.NO_DOWNLOAD_URL, 'The given file does not have any download URLs.'); } function invalidArgument(index, fnName, message) { return new FirebaseStorageError(Code.INVALID_ARGUMENT, 'Invalid argument in `' + fnName + '` at index ' + index + ': ' + message); } function invalidArgumentCount(argMin, argMax, fnName, real) { var countPart; var plural; if (argMin === argMax) { countPart = argMin; plural = argMin === 1 ? 'argument' : 'arguments'; } else { countPart = 'between ' + argMin + ' and ' + argMax; plural = 'arguments'; } return new FirebaseStorageError(Code.INVALID_ARGUMENT_COUNT, 'Invalid argument count in `' + fnName + '`: Expected ' + countPart + ' ' + plural + ', received ' + real + '.'); } function appDeleted() { return new FirebaseStorageError(Code.APP_DELETED, 'The Firebase app was deleted.'); } /** * @param name The name of the operation that was invalid. */ function invalidRootOperation(name) { return new FirebaseStorageError(Code.INVALID_ROOT_OPERATION, "The operation '" + name + "' cannot be performed on a root reference, create a non-root " + "reference using child, such as .child('file.png')."); } /** * @param format The format that was not valid. * @param message A message describing the format violation. */ function invalidFormat(format, message) { return new FirebaseStorageError(Code.INVALID_FORMAT, "String does not match format '" + format + "': " + message); } /** * @param message A message describing the internal error. */ function internalError(message) { throw new FirebaseStorageError(Code.INTERNAL_ERROR, 'Internal error: ' + message); } /** * Copyright 2017 Google Inc. * * 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. */ var StringFormat = { RAW: 'raw', BASE64: 'base64', BASE64URL: 'base64url', DATA_URL: 'data_url' }; function formatValidator(stringFormat) { switch (stringFormat) { case StringFormat.RAW: case StringFormat.BASE64: case StringFormat.BASE64URL: case StringFormat.DATA_URL: return; default: throw 'Expected one of the event types: [' + StringFormat.RAW + ', ' + StringFormat.BASE64 + ', ' + StringFormat.BASE64URL + ', ' + StringFormat.DATA_URL + '].'; } } /** * @struct */ var StringData = /** @class */ (function () { function StringData(data, opt_contentType) { this.data = data; this.contentType = opt_contentType || null; } return StringData; }()); function dataFromString(format, string) { switch (format) { case StringFormat.RAW: return new StringData(utf8Bytes_(string)); case StringFormat.BASE64: case StringFormat.BASE64URL: return new StringData(base64Bytes_(format, string)); case StringFormat.DATA_URL: return new StringData(dataURLBytes_(string), dataURLContentType_(string)); } // assert(false); throw unknown(); } function utf8Bytes_(string) { var b = []; for (var i = 0; i < string.length; i++) { var c = string.charCodeAt(i); if (c <= 127) { b.push(c); } else { if (c <= 2047) { b.push(192 | (c >> 6), 128 | (c & 63)); } else { if ((c & 64512) == 55296) { // The start of a surrogate pair. var valid = i < string.length - 1 && (string.charCodeAt(i + 1) & 64512) == 56320; if (!valid) { // The second surrogate wasn't there. b.push(239, 191, 189); } else { var hi = c; var lo = string.charCodeAt(++i); c = 65536 | ((hi & 1023) << 10) | (lo & 1023); b.push(240 | (c >> 18), 128 | ((c >> 12) & 63), 128 | ((c >> 6) & 63), 128 | (c & 63)); } } else { if ((c & 64512) == 56320) { // Invalid low surrogate. b.push(239, 191, 189); } else { b.push(224 | (c >> 12), 128 | ((c >> 6) & 63), 128 | (c & 63)); } } } } } return new Uint8Array(b); } function percentEncodedBytes_(string) { var decoded; try { decoded = decodeURIComponent(string); } catch (e) { throw invalidFormat(StringFormat.DATA_URL, 'Malformed data URL.'); } return utf8Bytes_(decoded); } function base64Bytes_(format, string) { switch (format) { case StringFormat.BASE64: { var hasMinus = string.indexOf('-') !== -1; var hasUnder = string.indexOf('_') !== -1; if (hasMinus || hasUnder) { var invalidChar = hasMinus ? '-' : '_'; throw invalidFormat(format, "Invalid character '" + invalidChar + "' found: is it base64url encoded?"); } break; } case StringFormat.BASE64URL: { var hasPlus = string.indexOf('+') !== -1; var hasSlash = string.indexOf('/') !== -1; if (hasPlus || hasSlash) { var invalidChar = hasPlus ? '+' : '/'; throw invalidFormat(format, "Invalid character '" + invalidChar + "' found: is it base64 encoded?"); } string = string.replace(/-/g, '+').replace(/_/g, '/'); break; } } var bytes; try { bytes = atob(string); } catch (e) { throw invalidFormat(format, 'Invalid character found'); } var array = new Uint8Array(bytes.length); for (var i = 0; i < bytes.length; i++) { array[i] = bytes.charCodeAt(i); } return array; } /** * @struct */ var DataURLParts = /** @class */ (function () { function DataURLParts(dataURL) { this.base64 = false; this.contentType = null; var matches = dataURL.match(/^data:([^,]+)?,/); if (matches === null) { throw invalidFormat(StringFormat.DATA_URL, "Must be formatted 'data:[][;base64],"); } var middle = matches[1] || null; if (middle != null) { this.base64 = endsWith(middle, ';base64'); this.contentType = this.base64 ? middle.substring(0, middle.length - ';base64'.length) : middle; } this.rest = dataURL.substring(dataURL.indexOf(',') + 1); } return DataURLParts; }()); function dataURLBytes_(string) { var parts = new DataURLParts(string); if (parts.base64) { return base64Bytes_(StringFormat.BASE64, parts.rest); } else { return percentEncodedBytes_(parts.rest); } } function dataURLContentType_(string) { var parts = new DataURLParts(string); return parts.contentType; } function endsWith(s, end) { var longEnough = s.length >= end.length; if (!longEnough) { return false; } return s.substring(s.length - end.length) === end; } /** * Copyright 2017 Google Inc. * * 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. */ var TaskEvent = { /** Triggered whenever the task changes or progress is updated. */ STATE_CHANGED: 'state_changed' }; var InternalTaskState = { RUNNING: 'running', PAUSING: 'pausing', PAUSED: 'paused', SUCCESS: 'success', CANCELING: 'canceling', CANCELED: 'canceled', ERROR: 'error' }; var TaskState = { /** The task is currently transferring data. */ RUNNING: 'running', /** The task was paused by the user. */ PAUSED: 'paused', /** The task completed successfully. */ SUCCESS: 'success', /** The task was canceled. */ CANCELED: 'canceled', /** The task failed with an error. */ ERROR: 'error' }; function taskStateFromInternalTaskState(state) { switch (state) { case InternalTaskState.RUNNING: case InternalTaskState.PAUSING: case InternalTaskState.CANCELING: return TaskState.RUNNING; case InternalTaskState.PAUSED: return TaskState.PAUSED; case InternalTaskState.SUCCESS: return TaskState.SUCCESS; case InternalTaskState.CANCELED: return TaskState.CANCELED; case InternalTaskState.ERROR: return TaskState.ERROR; default: // TODO(andysoto): assert(false); return TaskState.ERROR; } } /** * Copyright 2017 Google Inc. * * 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. */ /** * @fileoverview Contains methods for working with objects. */ function contains(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } function forEach(obj, f) { for (var key in obj) { if (contains(obj, key)) { f(key, obj[key]); } } } function clone(obj) { if (obj == null) { return {}; } var c = {}; forEach(obj, function (key, val) { c[key] = val; }); return c; } /** * Copyright 2017 Google Inc. * * 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. */ /** * @fileoverview Implements the promise abstraction interface for external * (public SDK) packaging, which just passes through to the firebase-app impl. */ /** * @template T * @param {function((function(T): void), * (function(!Error): void))} resolver */ function make(resolver) { return new Promise(resolver); } /** * @template T */ function resolve(value) { return Promise.resolve(value); } function reject(error) { return Promise.reject(error); } /** * Copyright 2017 Google Inc. * * 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. */ /** * @return False if the object is undefined or null, true otherwise. */ function isDef(p) { return p != null; } function isJustDef(p) { return p !== void 0; } function isFunction(p) { return typeof p === 'function'; } function isObject(p) { return typeof p === 'object'; } function isNonNullObject(p) { return isObject(p) && p !== null; } function isNonArrayObject(p) { return isObject(p) && !Array.isArray(p); } function isString(p) { return typeof p === 'string' || p instanceof String; } function isNumber(p) { return typeof p === 'number' || p instanceof Number; } function isNativeBlob(p) { return isNativeBlobDefined() && p instanceof Blob; } function isNativeBlobDefined() { return typeof Blob !== 'undefined'; } /** * Copyright 2017 Google Inc. * * 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. */ /** * @enum{number} */ var ErrorCode; (function (ErrorCode) { ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR"; ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR"; ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT"; })(ErrorCode || (ErrorCode = {})); /** * Copyright 2017 Google Inc. * * 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. */ /** * We use this instead of goog.net.XhrIo because goog.net.XhrIo is hyuuuuge and * doesn't work in React Native on Android. */ var NetworkXhrIo = /** @class */ (function () { function NetworkXhrIo() { var _this = this; this.sent_ = false; this.xhr_ = new XMLHttpRequest(); this.errorCode_ = ErrorCode.NO_ERROR; this.sendPromise_ = make(function (resolve$$1, reject$$1) { _this.xhr_.addEventListener('abort', function (event) { _this.errorCode_ = ErrorCode.ABORT; resolve$$1(_this); }); _this.xhr_.addEventListener('error', function (event) { _this.errorCode_ = ErrorCode.NETWORK_ERROR; resolve$$1(_this); }); _this.xhr_.addEventListener('load', function (event) { resolve$$1(_this); }); }); } /** * @override */ NetworkXhrIo.prototype.send = function (url, method, opt_body, opt_headers) { var _this = this; if (this.sent_) { throw internalError('cannot .send() more than once'); } this.sent_ = true; this.xhr_.open(method, url, true); if (isDef(opt_headers)) { var headers = opt_headers; forEach(headers, function (key, val) { _this.xhr_.setRequestHeader(key, val.toString()); }); } if (isDef(opt_body)) { this.xhr_.send(opt_body); } else { this.xhr_.send(); } return this.sendPromise_; }; /** * @override */ NetworkXhrIo.prototype.getErrorCode = function () { if (!this.sent_) { throw internalError('cannot .getErrorCode() before sending'); } return this.errorCode_; }; /** * @override */ NetworkXhrIo.prototype.getStatus = function () { if (!this.sent_) { throw internalError('cannot .getStatus() before sending'); } try { return this.xhr_.status; } catch (e) { return -1; } }; /** * @override */ NetworkXhrIo.prototype.getResponseText = function () { if (!this.sent_) { throw internalError('cannot .getResponseText() before sending'); } return this.xhr_.responseText; }; /** * Aborts the request. * @override */ NetworkXhrIo.prototype.abort = function () { this.xhr_.abort(); }; /** * @override */ NetworkXhrIo.prototype.getResponseHeader = function (header) { return this.xhr_.getResponseHeader(header); }; /** * @override */ NetworkXhrIo.prototype.addUploadProgressListener = function (listener) { if (isDef(this.xhr_.upload)) { this.xhr_.upload.addEventListener('progress', listener); } }; /** * @override */ NetworkXhrIo.prototype.removeUploadProgressListener = function (listener) { if (isDef(this.xhr_.upload)) { this.xhr_.upload.removeEventListener('progress', listener); } }; return NetworkXhrIo; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Factory-like class for creating XhrIo instances. */ var XhrIoPool = /** @class */ (function () { function XhrIoPool() { } XhrIoPool.prototype.createXhrIo = function () { return new NetworkXhrIo(); }; return XhrIoPool; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Returns the Object resulting from parsing the given JSON, or null if the * given string does not represent a JSON object. */ function jsonObjectOrNull(s) { var obj; try { obj = JSON.parse(s); } catch (e) { return null; } if (isNonArrayObject(obj)) { return obj; } else { return null; } } /** * Copyright 2017 Google Inc. * * 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. */ /** * @struct */ var Location = /** @class */ (function () { function Location(bucket, path) { this.bucket = bucket; this.path_ = path; } Object.defineProperty(Location.prototype, "path", { get: function () { return this.path_; }, enumerable: true, configurable: true }); Location.prototype.fullServerUrl = function () { var encode = encodeURIComponent; return '/b/' + encode(this.bucket) + '/o/' + encode(this.path); }; Location.prototype.bucketOnlyServerUrl = function () { var encode = encodeURIComponent; return '/b/' + encode(this.bucket) + '/o'; }; Location.makeFromBucketSpec = function (bucketString) { var bucketLocation; try { bucketLocation = Location.makeFromUrl(bucketString); } catch (e) { // Not valid URL, use as-is. This lets you put bare bucket names in // config. return new Location(bucketString, ''); } if (bucketLocation.path === '') { return bucketLocation; } else { throw invalidDefaultBucket(bucketString); } }; Location.makeFromUrl = function (url) { var location = null; var bucketDomain = '([A-Za-z0-9.\\-_]+)'; function gsModify(loc) { if (loc.path.charAt(loc.path.length - 1) === '/') { loc.path_ = loc.path_.slice(0, -1); } } var gsPath = '(/(.*))?$'; var path = '(/([^?#]*).*)?$'; var gsRegex = new RegExp('^gs://' + bucketDomain + gsPath, 'i'); var gsIndices = { bucket: 1, path: 3 }; function httpModify(loc) { loc.path_ = decodeURIComponent(loc.path); } var version = 'v[A-Za-z0-9_]+'; var httpRegex = new RegExp('^https?://firebasestorage\\.googleapis\\.com/' + version + '/b/' + bucketDomain + '/o' + path, 'i'); var httpIndices = { bucket: 1, path: 3 }; var groups = [ { regex: gsRegex, indices: gsIndices, postModify: gsModify }, { regex: httpRegex, indices: httpIndices, postModify: httpModify } ]; for (var i = 0; i < groups.length; i++) { var group = groups[i]; var captures = group.regex.exec(url); if (captures) { var bucketValue = captures[group.indices.bucket]; var pathValue = captures[group.indices.path]; if (!pathValue) { pathValue = ''; } location = new Location(bucketValue, pathValue); group.postModify(location); break; } } if (location == null) { throw invalidUrl(url); } return location; }; return Location; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @fileoverview Contains helper methods for manipulating paths. */ /** * @return Null if the path is already at the root. */ function parent(path) { if (path.length == 0) { return null; } var index = path.lastIndexOf('/'); if (index === -1) { return ''; } var newPath = path.slice(0, index); return newPath; } function child(path, childPath) { var canonicalChildPath = childPath .split('/') .filter(function (component) { return component.length > 0; }) .join('/'); if (path.length === 0) { return canonicalChildPath; } else { return path + '/' + canonicalChildPath; } } /** * Returns the last component of a path. * '/foo/bar' -> 'bar' * '/foo/bar/baz/' -> 'baz/' * '/a' -> 'a' */ function lastComponent(path) { var index = path.lastIndexOf('/', path.length - 2); if (index === -1) { return path; } else { return path.slice(index + 1); } } /** * Copyright 2017 Google Inc. * * 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. */ function makeNormalUrl(urlPart) { return domainBase + apiBaseUrl + urlPart; } function makeDownloadUrl(urlPart) { return downloadBase + apiBaseUrl + urlPart; } function makeUploadUrl(urlPart) { return domainBase + apiUploadBaseUrl + urlPart; } function makeQueryString(params) { var encode = encodeURIComponent; var queryPart = '?'; forEach(params, function (key, val) { var nextPart = encode(key) + '=' + encode(val); queryPart = queryPart + nextPart + '&'; }); // Chop off the extra '&' or '?' on the end queryPart = queryPart.slice(0, -1); return queryPart; } /** * Copyright 2017 Google Inc. * * 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. */ function noXform_(metadata, value) { return value; } /** * @struct */ var Mapping = /** @class */ (function () { function Mapping(server, opt_local, opt_writable, opt_xform) { this.server = server; this.local = opt_local || server; this.writable = !!opt_writable; this.xform = opt_xform || noXform_; } return Mapping; }()); var mappings_ = null; function xformPath(fullPath) { var valid = isString(fullPath); if (!valid || fullPath.length < 2) { return fullPath; } else { fullPath = fullPath; return lastComponent(fullPath); } } function getMappings() { if (mappings_) { return mappings_; } var mappings = []; mappings.push(new Mapping('bucket')); mappings.push(new Mapping('generation')); mappings.push(new Mapping('metageneration')); mappings.push(new Mapping('name', 'fullPath', true)); function mappingsXformPath(metadata, fullPath) { return xformPath(fullPath); } var nameMapping = new Mapping('name'); nameMapping.xform = mappingsXformPath; mappings.push(nameMapping); /** * Coerces the second param to a number, if it is defined. */ function xformSize(metadata, size) { if (isDef(size)) { return +size; } else { return size; } } var sizeMapping = new Mapping('size'); sizeMapping.xform = xformSize; mappings.push(sizeMapping); mappings.push(new Mapping('timeCreated')); mappings.push(new Mapping('updated')); mappings.push(new Mapping('md5Hash', null, true)); mappings.push(new Mapping('cacheControl', null, true)); mappings.push(new Mapping('contentDisposition', null, true)); mappings.push(new Mapping('contentEncoding', null, true)); mappings.push(new Mapping('contentLanguage', null, true)); mappings.push(new Mapping('contentType', null, true)); mappings.push(new Mapping('metadata', 'customMetadata', true)); mappings_ = mappings; return mappings_; } function addRef(metadata, authWrapper) { function generateRef() { var bucket = metadata['bucket']; var path = metadata['fullPath']; var loc = new Location(bucket, path); return authWrapper.makeStorageReference(loc); } Object.defineProperty(metadata, 'ref', { get: generateRef }); } function fromResource(authWrapper, resource, mappings) { var metadata = {}; metadata['type'] = 'file'; var len = mappings.length; for (var i = 0; i < len; i++) { var mapping = mappings[i]; metadata[mapping.local] = mapping.xform(metadata, resource[mapping.server]); } addRef(metadata, authWrapper); return metadata; } function fromResourceString(authWrapper, resourceString, mappings) { var obj = jsonObjectOrNull(resourceString); if (obj === null) { return null; } var resource = obj; return fromResource(authWrapper, resource, mappings); } function downloadUrlFromResourceString(metadata, resourceString) { var obj = jsonObjectOrNull(resourceString); if (obj === null) { return null; } if (!isString(obj['downloadTokens'])) { // This can happen if objects are uploaded through GCS and retrieved // through list, so we don't want to throw an Error. return null; } var tokens = obj['downloadTokens']; if (tokens.length === 0) { return null; } var encode = encodeURIComponent; var tokensList = tokens.split(','); var urls = tokensList.map(function (token) { var bucket = metadata['bucket']; var path = metadata['fullPath']; var urlPart = '/b/' + encode(bucket) + '/o/' + encode(path); var base = makeDownloadUrl(urlPart); var queryString = makeQueryString({ alt: 'media', token: token }); return base + queryString; }); return urls[0]; } function toResourceString(metadata, mappings) { var resource = {}; var len = mappings.length; for (var i = 0; i < len; i++) { var mapping = mappings[i]; if (mapping.writable) { resource[mapping.server] = metadata[mapping.local]; } } return JSON.stringify(resource); } function metadataValidator(p) { var validType = p && isObject(p); if (!validType) { throw 'Expected Metadata object.'; } for (var key in p) { var val = p[key]; if (key === 'customMetadata') { if (!isObject(val)) { throw 'Expected object for \'customMetadata\' mapping.'; } } else { if (isNonNullObject(val)) { throw "Mapping for '" + key + "' cannot be an object."; } } } } /** * Copyright 2017 Google Inc. * * 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. */ /** * @param name Name of the function. * @param specs Argument specs. * @param passed The actual arguments passed to the function. * @throws {fbs.Error} If the arguments are invalid. */ function validate(name, specs, passed) { var minArgs = specs.length; var maxArgs = specs.length; for (var i = 0; i < specs.length; i++) { if (specs[i].optional) { minArgs = i; break; } } var validLength = minArgs <= passed.length && passed.length <= maxArgs; if (!validLength) { throw invalidArgumentCount(minArgs, maxArgs, name, passed.length); } for (var i = 0; i < passed.length; i++) { try { specs[i].validator(passed[i]); } catch (e) { if (e instanceof Error) { throw invalidArgument(i, name, e.message); } else { throw invalidArgument(i, name, e); } } } } /** * @struct */ var ArgSpec = /** @class */ (function () { function ArgSpec(validator, opt_optional) { var self = this; this.validator = function (p) { if (self.optional && !isJustDef(p)) { return; } validator(p); }; this.optional = !!opt_optional; } return ArgSpec; }()); function and_(v1, v2) { return function (p) { v1(p); v2(p); }; } function stringSpec(opt_validator, opt_optional) { function stringValidator(p) { if (!isString(p)) { throw 'Expected string.'; } } var validator; if (opt_validator) { validator = and_(stringValidator, opt_validator); } else { validator = stringValidator; } return new ArgSpec(validator, opt_optional); } function uploadDataSpec() { function validator(p) { var valid = p instanceof Uint8Array || p instanceof ArrayBuffer || (isNativeBlobDefined() && p instanceof Blob); if (!valid) { throw 'Expected Blob or File.'; } } return new ArgSpec(validator); } function metadataSpec(opt_optional) { return new ArgSpec(metadataValidator, opt_optional); } function nonNegativeNumberSpec() { function validator(p) { var valid = isNumber(p) && p >= 0; if (!valid) { throw 'Expected a number 0 or greater.'; } } return new ArgSpec(validator); } function looseObjectSpec(opt_validator, opt_optional) { function validator(p) { var isLooseObject = p === null || (isDef(p) && p instanceof Object); if (!isLooseObject) { throw 'Expected an Object.'; } if (opt_validator !== undefined && opt_validator !== null) { opt_validator(p); } } return new ArgSpec(validator, opt_optional); } function nullFunctionSpec(opt_optional) { function validator(p) { var valid = p === null || isFunction(p); if (!valid) { throw 'Expected a Function.'; } } return new ArgSpec(validator, opt_optional); } function getBlobBuilder() { if (typeof BlobBuilder !== 'undefined') { return BlobBuilder; } else if (typeof WebKitBlobBuilder !== 'undefined') { return WebKitBlobBuilder; } else { return undefined; } } /** * Concatenates one or more values together and converts them to a Blob. * * @param var_args The values that will make up the resulting blob. * @return The blob. */ function getBlob() { var var_args = []; for (var _i = 0; _i < arguments.length; _i++) { var_args[_i] = arguments[_i]; } var BlobBuilder = getBlobBuilder(); if (BlobBuilder !== undefined) { var bb = new BlobBuilder(); for (var i = 0; i < var_args.length; i++) { bb.append(var_args[i]); } return bb.getBlob(); } else { if (isNativeBlobDefined()) { return new Blob(var_args); } else { throw Error("This browser doesn't seem to support creating Blobs"); } } } /** * Slices the blob. The returned blob contains data from the start byte * (inclusive) till the end byte (exclusive). Negative indices cannot be used. * * @param blob The blob to be sliced. * @param start Index of the starting byte. * @param end Index of the ending byte. * @return The blob slice or null if not supported. */ function sliceBlob(blob, start, end) { if (blob.webkitSlice) { return blob.webkitSlice(start, end); } else if (blob.mozSlice) { return blob.mozSlice(start, end); } else if (blob.slice) { return blob.slice(start, end); } return null; } /** * Copyright 2017 Google Inc. * * 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. */ /** * @param opt_elideCopy If true, doesn't copy mutable input data * (e.g. Uint8Arrays). Pass true only if you know the objects will not be * modified after this blob's construction. */ var FbsBlob = /** @class */ (function () { function FbsBlob(data, opt_elideCopy) { var size = 0; var blobType = ''; if (isNativeBlob(data)) { this.data_ = data; size = data.size; blobType = data.type; } else if (data instanceof ArrayBuffer) { if (opt_elideCopy) { this.data_ = new Uint8Array(data); } else { this.data_ = new Uint8Array(data.byteLength); this.data_.set(new Uint8Array(data)); } size = this.data_.length; } else if (data instanceof Uint8Array) { if (opt_elideCopy) { this.data_ = data; } else { this.data_ = new Uint8Array(data.length); this.data_.set(data); } size = data.length; } this.size_ = size; this.type_ = blobType; } FbsBlob.prototype.size = function () { return this.size_; }; FbsBlob.prototype.type = function () { return this.type_; }; FbsBlob.prototype.slice = function (startByte, endByte) { if (isNativeBlob(this.data_)) { var realBlob = this.data_; var sliced = sliceBlob(realBlob, startByte, endByte); if (sliced === null) { return null; } return new FbsBlob(sliced); } else { var slice = new Uint8Array(this.data_.buffer, startByte, endByte - startByte); return new FbsBlob(slice, true); } }; FbsBlob.getBlob = function () { var var_args = []; for (var _i = 0; _i < arguments.length; _i++) { var_args[_i] = arguments[_i]; } if (isNativeBlobDefined()) { var blobby = var_args.map(function (val) { if (val instanceof FbsBlob) { return val.data_; } else { return val; } }); return new FbsBlob(getBlob.apply(null, blobby)); } else { var uint8Arrays = var_args.map(function (val) { if (isString(val)) { return dataFromString(StringFormat.RAW, val).data; } else { // Blobs don't exist, so this has to be a Uint8Array. return val.data_; } }); var finalLength_1 = 0; uint8Arrays.forEach(function (array) { finalLength_1 += array.byteLength; }); var merged_1 = new Uint8Array(finalLength_1); var index_1 = 0; uint8Arrays.forEach(function (array) { for (var i = 0; i < array.length; i++) { merged_1[index_1++] = array[i]; } }); return new FbsBlob(merged_1, true); } }; FbsBlob.prototype.uploadData = function () { return this.data_; }; return FbsBlob; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Returns true if the object is contained in the array (compared with ===). * @template T */ function contains$1(array, elem) { return array.indexOf(elem) !== -1; } /** * Returns a shallow copy of the array or array-like object (e.g. arguments). * @template T */ function clone$1(arraylike) { return Array.prototype.slice.call(arraylike); } /** * Removes the given element from the given array, if it is contained. * Directly modifies the passed-in array. * @template T */ function remove(array, elem) { var i = array.indexOf(elem); if (i !== -1) { array.splice(i, 1); } } var RequestInfo = /** @class */ (function () { function RequestInfo(url, method, /** * Returns the value with which to resolve the request's promise. Only called * if the request is successful. Throw from this function to reject the * returned Request's promise with the thrown error. * Note: The XhrIo passed to this function may be reused after this callback * returns. Do not keep a reference to it in any way. */ handler, timeout) { this.url = url; this.method = method; this.handler = handler; this.timeout = timeout; this.urlParams = {}; this.headers = {}; this.body = null; this.errorHandler = null; /** * Called with the current number of bytes uploaded and total size (-1 if not * computable) of the request body (i.e. used to report upload progress). */ this.progressCallback = null; this.successCodes = [200]; this.additionalRetryCodes = []; } return RequestInfo; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Throws the UNKNOWN FirebaseStorageError if cndn is false. */ function handlerCheck(cndn) { if (!cndn) { throw unknown(); } } function metadataHandler(authWrapper, mappings) { function handler(xhr, text) { var metadata = fromResourceString(authWrapper, text, mappings); handlerCheck(metadata !== null); return metadata; } return handler; } function downloadUrlHandler(authWrapper, mappings) { function handler(xhr, text) { var metadata = fromResourceString(authWrapper, text, mappings); handlerCheck(metadata !== null); return downloadUrlFromResourceString(metadata, text); } return handler; } function sharedErrorHandler(location) { function errorHandler(xhr, err) { var newErr; if (xhr.getStatus() === 401) { newErr = unauthenticated(); } else { if (xhr.getStatus() === 402) { newErr = quotaExceeded(location.bucket); } else { if (xhr.getStatus() === 403) { newErr = unauthorized(location.path); } else { newErr = err; } } } newErr.setServerResponseProp(err.serverResponseProp()); return newErr; } return errorHandler; } function objectErrorHandler(location) { var shared = sharedErrorHandler(location); function errorHandler(xhr, err) { var newErr = shared(xhr, err); if (xhr.getStatus() === 404) { newErr = objectNotFound(location.path); } newErr.setServerResponseProp(err.serverResponseProp()); return newErr; } return errorHandler; } function getMetadata(authWrapper, location, mappings) { var urlPart = location.fullServerUrl(); var url = makeNormalUrl(urlPart); var method = 'GET'; var timeout = authWrapper.maxOperationRetryTime(); var requestInfo = new RequestInfo(url, method, metadataHandler(authWrapper, mappings), timeout); requestInfo.errorHandler = objectErrorHandler(location); return requestInfo; } function getDownloadUrl(authWrapper, location, mappings) { var urlPart = location.fullServerUrl(); var url = makeNormalUrl(urlPart); var method = 'GET'; var timeout = authWrapper.maxOperationRetryTime(); var requestInfo = new RequestInfo(url, method, downloadUrlHandler(authWrapper, mappings), timeout); requestInfo.errorHandler = objectErrorHandler(location); return requestInfo; } function updateMetadata(authWrapper, location, metadata, mappings) { var urlPart = location.fullServerUrl(); var url = makeNormalUrl(urlPart); var method = 'PATCH'; var body = toResourceString(metadata, mappings); var headers = { 'Content-Type': 'application/json; charset=utf-8' }; var timeout = authWrapper.maxOperationRetryTime(); var requestInfo = new RequestInfo(url, method, metadataHandler(authWrapper, mappings), timeout); requestInfo.headers = headers; requestInfo.body = body; requestInfo.errorHandler = objectErrorHandler(location); return requestInfo; } function deleteObject(authWrapper, location) { var urlPart = location.fullServerUrl(); var url = makeNormalUrl(urlPart); var method = 'DELETE'; var timeout = authWrapper.maxOperationRetryTime(); function handler(xhr, text) { } var requestInfo = new RequestInfo(url, method, handler, timeout); requestInfo.successCodes = [200, 204]; requestInfo.errorHandler = objectErrorHandler(location); return requestInfo; } function determineContentType_(metadata, blob) { return ((metadata && metadata['contentType']) || (blob && blob.type()) || 'application/octet-stream'); } function metadataForUpload_(location, blob, opt_metadata) { var metadata = clone(opt_metadata); metadata['fullPath'] = location.path; metadata['size'] = blob.size(); if (!metadata['contentType']) { metadata['contentType'] = determineContentType_(null, blob); } return metadata; } function multipartUpload(authWrapper, location, mappings, blob, opt_metadata) { var urlPart = location.bucketOnlyServerUrl(); var headers = { 'X-Goog-Upload-Protocol': 'multipart' }; function genBoundary() { var str = ''; for (var i = 0; i < 2; i++) { str = str + Math.random() .toString() .slice(2); } return str; } var boundary = genBoundary(); headers['Content-Type'] = 'multipart/related; boundary=' + boundary; var metadata = metadataForUpload_(location, blob, opt_metadata); var metadataString = toResourceString(metadata, mappings); var preBlobPart = '--' + boundary + '\r\n' + 'Content-Type: application/json; charset=utf-8\r\n\r\n' + metadataString + '\r\n--' + boundary + '\r\n' + 'Content-Type: ' + metadata['contentType'] + '\r\n\r\n'; var postBlobPart = '\r\n--' + boundary + '--'; var body = FbsBlob.getBlob(preBlobPart, blob, postBlobPart); if (body === null) { throw cannotSliceBlob(); } var urlParams = { name: metadata['fullPath'] }; var url = makeUploadUrl(urlPart); var method = 'POST'; var timeout = authWrapper.maxUploadRetryTime(); var requestInfo = new RequestInfo(url, method, metadataHandler(authWrapper, mappings), timeout); requestInfo.urlParams = urlParams; requestInfo.headers = headers; requestInfo.body = body.uploadData(); requestInfo.errorHandler = sharedErrorHandler(location); return requestInfo; } /** * @param current The number of bytes that have been uploaded so far. * @param total The total number of bytes in the upload. * @param opt_finalized True if the server has finished the upload. * @param opt_metadata The upload metadata, should * only be passed if opt_finalized is true. * @struct */ var ResumableUploadStatus = /** @class */ (function () { function ResumableUploadStatus(current, total, finalized, metadata) { this.current = current; this.total = total; this.finalized = !!finalized; this.metadata = metadata || null; } return ResumableUploadStatus; }()); function checkResumeHeader_(xhr, opt_allowed) { var status; try { status = xhr.getResponseHeader('X-Goog-Upload-Status'); } catch (e) { handlerCheck(false); } var allowed = opt_allowed || ['active']; handlerCheck(contains$1(allowed, status)); return status; } function createResumableUpload(authWrapper, location, mappings, blob, opt_metadata) { var urlPart = location.bucketOnlyServerUrl(); var metadata = metadataForUpload_(location, blob, opt_metadata); var urlParams = { name: metadata['fullPath'] }; var url = makeUploadUrl(urlPart); var method = 'POST'; var headers = { 'X-Goog-Upload-Protocol': 'resumable', 'X-Goog-Upload-Command': 'start', 'X-Goog-Upload-Header-Content-Length': blob.size(), 'X-Goog-Upload-Header-Content-Type': metadata['contentType'], 'Content-Type': 'application/json; charset=utf-8' }; var body = toResourceString(metadata, mappings); var timeout = authWrapper.maxUploadRetryTime(); function handler(xhr, text) { checkResumeHeader_(xhr); var url; try { url = xhr.getResponseHeader('X-Goog-Upload-URL'); } catch (e) { handlerCheck(false); } handlerCheck(isString(url)); return url; } var requestInfo = new RequestInfo(url, method, handler, timeout); requestInfo.urlParams = urlParams; requestInfo.headers = headers; requestInfo.body = body; requestInfo.errorHandler = sharedErrorHandler(location); return requestInfo; } /** * @param url From a call to fbs.requests.createResumableUpload. */ function getResumableUploadStatus(authWrapper, location, url, blob) { var headers = { 'X-Goog-Upload-Command': 'query' }; function handler(xhr, text) { var status = checkResumeHeader_(xhr, ['active', 'final']); var sizeString; try { sizeString = xhr.getResponseHeader('X-Goog-Upload-Size-Received'); } catch (e) { handlerCheck(false); } var size = parseInt(sizeString, 10); handlerCheck(!isNaN(size)); return new ResumableUploadStatus(size, blob.size(), status === 'final'); } var method = 'POST'; var timeout = authWrapper.maxUploadRetryTime(); var requestInfo = new RequestInfo(url, method, handler, timeout); requestInfo.headers = headers; requestInfo.errorHandler = sharedErrorHandler(location); return requestInfo; } /** * Any uploads via the resumable upload API must transfer a number of bytes * that is a multiple of this number. */ var resumableUploadChunkSize = 256 * 1024; /** * @param url From a call to fbs.requests.createResumableUpload. * @param chunkSize Number of bytes to upload. * @param opt_status The previous status. * If not passed or null, we start from the beginning. * @throws fbs.Error If the upload is already complete, the passed in status * has a final size inconsistent with the blob, or the blob cannot be sliced * for upload. */ function continueResumableUpload(location, authWrapper, url, blob, chunkSize, mappings, opt_status, opt_progressCallback) { // TODO(andysoto): standardize on internal asserts // assert(!(opt_status && opt_status.finalized)); var status = new ResumableUploadStatus(0, 0); if (opt_status) { status.current = opt_status.current; status.total = opt_status.total; } else { status.current = 0; status.total = blob.size(); } if (blob.size() !== status.total) { throw serverFileWrongSize(); } var bytesLeft = status.total - status.current; var bytesToUpload = bytesLeft; if (chunkSize > 0) { bytesToUpload = Math.min(bytesToUpload, chunkSize); } var startByte = status.current; var endByte = startByte + bytesToUpload; var uploadCommand = bytesToUpload === bytesLeft ? 'upload, finalize' : 'upload'; var headers = { 'X-Goog-Upload-Command': uploadCommand, 'X-Goog-Upload-Offset': status.current }; var body = blob.slice(startByte, endByte); if (body === null) { throw cannotSliceBlob(); } function handler(xhr, text) { // TODO(andysoto): Verify the MD5 of each uploaded range: // the 'x-range-md5' header comes back with status code 308 responses. // We'll only be able to bail out though, because you can't re-upload a // range that you previously uploaded. var uploadStatus = checkResumeHeader_(xhr, ['active', 'final']); var newCurrent = status.current + bytesToUpload; var size = blob.size(); var metadata; if (uploadStatus === 'final') { metadata = metadataHandler(authWrapper, mappings)(xhr, text); } else { metadata = null; } return new ResumableUploadStatus(newCurrent, size, uploadStatus === 'final', metadata); } var method = 'POST'; var timeout = authWrapper.maxUploadRetryTime(); var requestInfo = new RequestInfo(url, method, handler, timeout); requestInfo.headers = headers; requestInfo.body = body.uploadData(); requestInfo.progressCallback = opt_progressCallback || null; requestInfo.errorHandler = sharedErrorHandler(location); return requestInfo; } /** * Copyright 2017 Google Inc. * * 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. */ /** * @struct */ var Observer = /** @class */ (function () { function Observer(nextOrObserver, opt_error, opt_complete) { var asFunctions = isFunction(nextOrObserver) || isDef(opt_error) || isDef(opt_complete); if (asFunctions) { this.next = nextOrObserver; this.error = opt_error || null; this.complete = opt_complete || null; } else { var observer = nextOrObserver; this.next = observer.next || null; this.error = observer.error || null; this.complete = observer.complete || null; } } return Observer; }()); var UploadTaskSnapshot = /** @class */ (function () { function UploadTaskSnapshot(bytesTransferred, totalBytes, state, metadata, task, ref) { this.bytesTransferred = bytesTransferred; this.totalBytes = totalBytes; this.state = state; this.metadata = metadata; this.task = task; this.ref = ref; } return UploadTaskSnapshot; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Returns a function that invokes f with its arguments asynchronously as a * microtask, i.e. as soon as possible after the current script returns back * into browser code. */ function async(f) { return function () { var argsToForward = []; for (var _i = 0; _i < arguments.length; _i++) { argsToForward[_i] = arguments[_i]; } resolve(true).then(function () { f.apply(null, argsToForward); }); }; } /** * Copyright 2017 Google Inc. * * 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. */ /** * Represents a blob being uploaded. Can be used to pause/resume/cancel the * upload and manage callbacks for various events. */ var UploadTask = /** @class */ (function () { /** * @param ref The firebaseStorage.Reference object this task came * from, untyped to avoid cyclic dependencies. * @param blob The blob to upload. */ function UploadTask(ref, authWrapper, location, mappings, blob, metadata) { if (metadata === void 0) { metadata = null; } var _this = this; this.transferred_ = 0; this.needToFetchStatus_ = false; this.needToFetchMetadata_ = false; this.observers_ = []; this.error_ = null; this.uploadUrl_ = null; this.request_ = null; this.chunkMultiplier_ = 1; this.resolve_ = null; this.reject_ = null; this.ref_ = ref; this.authWrapper_ = authWrapper; this.location_ = location; this.blob_ = blob; this.metadata_ = metadata; this.mappings_ = mappings; this.resumable_ = this.shouldDoResumable_(this.blob_); this.state_ = InternalTaskState.RUNNING; this.errorHandler_ = function (error) { _this.request_ = null; _this.chunkMultiplier_ = 1; if (error.codeEquals(Code.CANCELED)) { _this.needToFetchStatus_ = true; _this.completeTransitions_(); } else { _this.error_ = error; _this.transition_(InternalTaskState.ERROR); } }; this.metadataErrorHandler_ = function (error) { _this.request_ = null; if (error.codeEquals(Code.CANCELED)) { _this.completeTransitions_(); } else { _this.error_ = error; _this.transition_(InternalTaskState.ERROR); } }; this.promise_ = make(function (resolve$$1, reject$$1) { _this.resolve_ = resolve$$1; _this.reject_ = reject$$1; _this.start_(); }); // Prevent uncaught rejections on the internal promise from bubbling out // to the top level with a dummy handler. this.promise_.then(null, function () { }); } UploadTask.prototype.makeProgressCallback_ = function () { var _this = this; var sizeBefore = this.transferred_; return function (loaded, total) { _this.updateProgress_(sizeBefore + loaded); }; }; UploadTask.prototype.shouldDoResumable_ = function (blob) { return blob.size() > 256 * 1024; }; UploadTask.prototype.start_ = function () { if (this.state_ !== InternalTaskState.RUNNING) { // This can happen if someone pauses us in a resume callback, for example. return; } if (this.request_ !== null) { return; } if (this.resumable_) { if (this.uploadUrl_ === null) { this.createResumable_(); } else { if (this.needToFetchStatus_) { this.fetchStatus_(); } else { if (this.needToFetchMetadata_) { // Happens if we miss the metadata on upload completion. this.fetchMetadata_(); } else { this.continueUpload_(); } } } } else { this.oneShotUpload_(); } }; UploadTask.prototype.resolveToken_ = function (callback) { var _this = this; this.authWrapper_.getAuthToken().then(function (authToken) { switch (_this.state_) { case InternalTaskState.RUNNING: callback(authToken); break; case InternalTaskState.CANCELING: _this.transition_(InternalTaskState.CANCELED); break; case InternalTaskState.PAUSING: _this.transition_(InternalTaskState.PAUSED); break; default: } }); }; // TODO(andysoto): assert false UploadTask.prototype.createResumable_ = function () { var _this = this; this.resolveToken_(function (authToken) { var requestInfo = createResumableUpload(_this.authWrapper_, _this.location_, _this.mappings_, _this.blob_, _this.metadata_); var createRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); _this.request_ = createRequest; createRequest.getPromise().then(function (url) { _this.request_ = null; _this.uploadUrl_ = url; _this.needToFetchStatus_ = false; _this.completeTransitions_(); }, _this.errorHandler_); }); }; UploadTask.prototype.fetchStatus_ = function () { var _this = this; // TODO(andysoto): assert(this.uploadUrl_ !== null); var url = this.uploadUrl_; this.resolveToken_(function (authToken) { var requestInfo = getResumableUploadStatus(_this.authWrapper_, _this.location_, url, _this.blob_); var statusRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); _this.request_ = statusRequest; statusRequest.getPromise().then(function (status) { status = status; _this.request_ = null; _this.updateProgress_(status.current); _this.needToFetchStatus_ = false; if (status.finalized) { _this.needToFetchMetadata_ = true; } _this.completeTransitions_(); }, _this.errorHandler_); }); }; UploadTask.prototype.continueUpload_ = function () { var _this = this; var chunkSize = resumableUploadChunkSize * this.chunkMultiplier_; var status = new ResumableUploadStatus(this.transferred_, this.blob_.size()); // TODO(andysoto): assert(this.uploadUrl_ !== null); var url = this.uploadUrl_; this.resolveToken_(function (authToken) { var requestInfo; try { requestInfo = continueResumableUpload(_this.location_, _this.authWrapper_, url, _this.blob_, chunkSize, _this.mappings_, status, _this.makeProgressCallback_()); } catch (e) { _this.error_ = e; _this.transition_(InternalTaskState.ERROR); return; } var uploadRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); _this.request_ = uploadRequest; uploadRequest .getPromise() .then(function (newStatus) { _this.increaseMultiplier_(); _this.request_ = null; _this.updateProgress_(newStatus.current); if (newStatus.finalized) { _this.metadata_ = newStatus.metadata; _this.transition_(InternalTaskState.SUCCESS); } else { _this.completeTransitions_(); } }, _this.errorHandler_); }); }; UploadTask.prototype.increaseMultiplier_ = function () { var currentSize = resumableUploadChunkSize * this.chunkMultiplier_; // Max chunk size is 32M. if (currentSize < 32 * 1024 * 1024) { this.chunkMultiplier_ *= 2; } }; UploadTask.prototype.fetchMetadata_ = function () { var _this = this; this.resolveToken_(function (authToken) { var requestInfo = getMetadata(_this.authWrapper_, _this.location_, _this.mappings_); var metadataRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); _this.request_ = metadataRequest; metadataRequest.getPromise().then(function (metadata) { _this.request_ = null; _this.metadata_ = metadata; _this.transition_(InternalTaskState.SUCCESS); }, _this.metadataErrorHandler_); }); }; UploadTask.prototype.oneShotUpload_ = function () { var _this = this; this.resolveToken_(function (authToken) { var requestInfo = multipartUpload(_this.authWrapper_, _this.location_, _this.mappings_, _this.blob_, _this.metadata_); var multipartRequest = _this.authWrapper_.makeRequest(requestInfo, authToken); _this.request_ = multipartRequest; multipartRequest.getPromise().then(function (metadata) { _this.request_ = null; _this.metadata_ = metadata; _this.updateProgress_(_this.blob_.size()); _this.transition_(InternalTaskState.SUCCESS); }, _this.errorHandler_); }); }; UploadTask.prototype.updateProgress_ = function (transferred) { var old = this.transferred_; this.transferred_ = transferred; // A progress update can make the "transferred" value smaller (e.g. a // partial upload not completed by server, after which the "transferred" // value may reset to the value at the beginning of the request). if (this.transferred_ !== old) { this.notifyObservers_(); } }; UploadTask.prototype.transition_ = function (state) { if (this.state_ === state) { return; } switch (state) { case InternalTaskState.CANCELING: // TODO(andysoto): // assert(this.state_ === InternalTaskState.RUNNING || // this.state_ === InternalTaskState.PAUSING); this.state_ = state; if (this.request_ !== null) { this.request_.cancel(); } break; case InternalTaskState.PAUSING: // TODO(andysoto): // assert(this.state_ === InternalTaskState.RUNNING); this.state_ = state; if (this.request_ !== null) { this.request_.cancel(); } break; case InternalTaskState.RUNNING: // TODO(andysoto): // assert(this.state_ === InternalTaskState.PAUSED || // this.state_ === InternalTaskState.PAUSING); var wasPaused = this.state_ === InternalTaskState.PAUSED; this.state_ = state; if (wasPaused) { this.notifyObservers_(); this.start_(); } break; case InternalTaskState.PAUSED: // TODO(andysoto): // assert(this.state_ === InternalTaskState.PAUSING); this.state_ = state; this.notifyObservers_(); break; case InternalTaskState.CANCELED: // TODO(andysoto): // assert(this.state_ === InternalTaskState.PAUSED || // this.state_ === InternalTaskState.CANCELING); this.error_ = canceled(); this.state_ = state; this.notifyObservers_(); break; case InternalTaskState.ERROR: // TODO(andysoto): // assert(this.state_ === InternalTaskState.RUNNING || // this.state_ === InternalTaskState.PAUSING || // this.state_ === InternalTaskState.CANCELING); this.state_ = state; this.notifyObservers_(); break; case InternalTaskState.SUCCESS: // TODO(andysoto): // assert(this.state_ === InternalTaskState.RUNNING || // this.state_ === InternalTaskState.PAUSING || // this.state_ === InternalTaskState.CANCELING); this.state_ = state; this.notifyObservers_(); break; } }; UploadTask.prototype.completeTransitions_ = function () { switch (this.state_) { case InternalTaskState.PAUSING: this.transition_(InternalTaskState.PAUSED); break; case InternalTaskState.CANCELING: this.transition_(InternalTaskState.CANCELED); break; case InternalTaskState.RUNNING: this.start_(); break; default: // TODO(andysoto): assert(false); break; } }; Object.defineProperty(UploadTask.prototype, "snapshot", { get: function () { var externalState = taskStateFromInternalTaskState(this.state_); return new UploadTaskSnapshot(this.transferred_, this.blob_.size(), externalState, this.metadata_, this, this.ref_); }, enumerable: true, configurable: true }); /** * Adds a callback for an event. * @param type The type of event to listen for. */ UploadTask.prototype.on = function (type, nextOrObserver, error, completed) { if (nextOrObserver === void 0) { nextOrObserver = undefined; } if (error === void 0) { error = undefined; } if (completed === void 0) { completed = undefined; } function typeValidator(_p) { if (type !== TaskEvent.STATE_CHANGED) { throw "Expected one of the event types: [" + TaskEvent.STATE_CHANGED + "]."; } } var nextOrObserverMessage = 'Expected a function or an Object with one of ' + '`next`, `error`, `complete` properties.'; var nextValidator = nullFunctionSpec(true).validator; var observerValidator = looseObjectSpec(null, true).validator; function nextOrObserverValidator(p) { try { nextValidator(p); return; } catch (e) { } try { observerValidator(p); var anyDefined = isJustDef(p['next']) || isJustDef(p['error']) || isJustDef(p['complete']); if (!anyDefined) { throw ''; } return; } catch (e) { throw nextOrObserverMessage; } } var specs = [ stringSpec(typeValidator), looseObjectSpec(nextOrObserverValidator, true), nullFunctionSpec(true), nullFunctionSpec(true) ]; validate('on', specs, arguments); var self = this; function makeBinder(specs) { function binder(nextOrObserver, error, opt_complete) { if (specs !== null) { validate('on', specs, arguments); } var observer = new Observer(nextOrObserver, error, completed); self.addObserver_(observer); return function () { self.removeObserver_(observer); }; } return binder; } function binderNextOrObserverValidator(p) { if (p === null) { throw nextOrObserverMessage; } nextOrObserverValidator(p); } var binderSpecs = [ looseObjectSpec(binderNextOrObserverValidator), nullFunctionSpec(true), nullFunctionSpec(true) ]; var typeOnly = !(isJustDef(nextOrObserver) || isJustDef(error) || isJustDef(completed)); if (typeOnly) { return makeBinder(binderSpecs); } else { return makeBinder(null)(nextOrObserver, error, completed); } }; /** * This object behaves like a Promise, and resolves with its snapshot data * when the upload completes. * @param onFulfilled The fulfillment callback. Promise chaining works as normal. * @param onRejected The rejection callback. */ UploadTask.prototype.then = function (onFulfilled, onRejected) { // These casts are needed so that TypeScript can infer the types of the // resulting Promise. return this.promise_.then(onFulfilled, onRejected); }; /** * Equivalent to calling `then(null, onRejected)`. */ UploadTask.prototype.catch = function (onRejected) { return this.then(null, onRejected); }; /** * Adds the given observer. */ UploadTask.prototype.addObserver_ = function (observer) { this.observers_.push(observer); this.notifyObserver_(observer); }; /** * Removes the given observer. */ UploadTask.prototype.removeObserver_ = function (observer) { remove(this.observers_, observer); }; UploadTask.prototype.notifyObservers_ = function () { var _this = this; this.finishPromise_(); var observers = clone$1(this.observers_); observers.forEach(function (observer) { _this.notifyObserver_(observer); }); }; UploadTask.prototype.finishPromise_ = function () { if (this.resolve_ !== null) { var triggered = true; switch (taskStateFromInternalTaskState(this.state_)) { case TaskState.SUCCESS: async(this.resolve_.bind(null, this.snapshot))(); break; case TaskState.CANCELED: case TaskState.ERROR: var toCall = this.reject_; async(toCall.bind(null, this.error_))(); break; default: triggered = false; break; } if (triggered) { this.resolve_ = null; this.reject_ = null; } } }; UploadTask.prototype.notifyObserver_ = function (observer) { var externalState = taskStateFromInternalTaskState(this.state_); switch (externalState) { case TaskState.RUNNING: case TaskState.PAUSED: if (observer.next !== null) { async(observer.next.bind(observer, this.snapshot))(); } break; case TaskState.SUCCESS: if (observer.complete !== null) { async(observer.complete.bind(observer))(); } break; case TaskState.CANCELED: case TaskState.ERROR: if (observer.error !== null) { async(observer.error.bind(observer, this.error_))(); } break; default: // TODO(andysoto): assert(false); if (observer.error !== null) { async(observer.error.bind(observer, this.error_))(); } } }; /** * Resumes a paused task. Has no effect on a currently running or failed task. * @return True if the operation took effect, false if ignored. */ UploadTask.prototype.resume = function () { validate('resume', [], arguments); var valid = this.state_ === InternalTaskState.PAUSED || this.state_ === InternalTaskState.PAUSING; if (valid) { this.transition_(InternalTaskState.RUNNING); } return valid; }; /** * Pauses a currently running task. Has no effect on a paused or failed task. * @return True if the operation took effect, false if ignored. */ UploadTask.prototype.pause = function () { validate('pause', [], arguments); var valid = this.state_ === InternalTaskState.RUNNING; if (valid) { this.transition_(InternalTaskState.PAUSING); } return valid; }; /** * Cancels a currently running or paused task. Has no effect on a complete or * failed task. * @return True if the operation took effect, false if ignored. */ UploadTask.prototype.cancel = function () { validate('cancel', [], arguments); var valid = this.state_ === InternalTaskState.RUNNING || this.state_ === InternalTaskState.PAUSING; if (valid) { this.transition_(InternalTaskState.CANCELING); } return valid; }; return UploadTask; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Provides methods to interact with a bucket in the Firebase Storage service. * @param location An fbs.location, or the URL at * which to base this object, in one of the following forms: * gs:/// * http[s]://firebasestorage.googleapis.com/ * /b//o/ * Any query or fragment strings will be ignored in the http[s] * format. If no value is passed, the storage object will use a URL based on * the project ID of the base firebase.App instance. */ var Reference = /** @class */ (function () { function Reference(authWrapper, location) { this.authWrapper = authWrapper; if (location instanceof Location) { this.location = location; } else { this.location = Location.makeFromUrl(location); } } /** * @return The URL for the bucket and path this object references, * in the form gs:/// * @override */ Reference.prototype.toString = function () { validate('toString', [], arguments); return 'gs://' + this.location.bucket + '/' + this.location.path; }; Reference.prototype.newRef = function (authWrapper, location) { return new Reference(authWrapper, location); }; Reference.prototype.mappings = function () { return getMappings(); }; /** * @return A reference to the object obtained by * appending childPath, removing any duplicate, beginning, or trailing * slashes. */ Reference.prototype.child = function (childPath) { validate('child', [stringSpec()], arguments); var newPath = child(this.location.path, childPath); var location = new Location(this.location.bucket, newPath); return this.newRef(this.authWrapper, location); }; Object.defineProperty(Reference.prototype, "parent", { /** * @return A reference to the parent of the * current object, or null if the current object is the root. */ get: function () { var newPath = parent(this.location.path); if (newPath === null) { return null; } var location = new Location(this.location.bucket, newPath); return this.newRef(this.authWrapper, location); }, enumerable: true, configurable: true }); Object.defineProperty(Reference.prototype, "root", { /** * @return An reference to the root of this * object's bucket. */ get: function () { var location = new Location(this.location.bucket, ''); return this.newRef(this.authWrapper, location); }, enumerable: true, configurable: true }); Object.defineProperty(Reference.prototype, "bucket", { get: function () { return this.location.bucket; }, enumerable: true, configurable: true }); Object.defineProperty(Reference.prototype, "fullPath", { get: function () { return this.location.path; }, enumerable: true, configurable: true }); Object.defineProperty(Reference.prototype, "name", { get: function () { return lastComponent(this.location.path); }, enumerable: true, configurable: true }); Object.defineProperty(Reference.prototype, "storage", { get: function () { return this.authWrapper.service(); }, enumerable: true, configurable: true }); /** * Uploads a blob to this object's location. * @param data The blob to upload. * @return An UploadTask that lets you control and * observe the upload. */ Reference.prototype.put = function (data, metadata) { if (metadata === void 0) { metadata = null; } validate('put', [uploadDataSpec(), metadataSpec(true)], arguments); this.throwIfRoot_('put'); return new UploadTask(this, this.authWrapper, this.location, this.mappings(), new FbsBlob(data), metadata); }; /** * Uploads a string to this object's location. * @param string The string to upload. * @param opt_format The format of the string to upload. * @return An UploadTask that lets you control and * observe the upload. */ Reference.prototype.putString = function (string, format, opt_metadata) { if (format === void 0) { format = StringFormat.RAW; } validate('putString', [ stringSpec(), stringSpec(formatValidator, true), metadataSpec(true) ], arguments); this.throwIfRoot_('putString'); var data = dataFromString(format, string); var metadata = clone(opt_metadata); if (!isDef(metadata['contentType']) && isDef(data.contentType)) { metadata['contentType'] = data.contentType; } return new UploadTask(this, this.authWrapper, this.location, this.mappings(), new FbsBlob(data.data, true), metadata); }; /** * Deletes the object at this location. * @return A promise that resolves if the deletion succeeds. */ Reference.prototype.delete = function () { validate('delete', [], arguments); this.throwIfRoot_('delete'); var self = this; return this.authWrapper.getAuthToken().then(function (authToken) { var requestInfo = deleteObject(self.authWrapper, self.location); return self.authWrapper.makeRequest(requestInfo, authToken).getPromise(); }); }; /** * A promise that resolves with the metadata for this object. If this * object doesn't exist or metadata cannot be retreived, the promise is * rejected. */ Reference.prototype.getMetadata = function () { validate('getMetadata', [], arguments); this.throwIfRoot_('getMetadata'); var self = this; return this.authWrapper.getAuthToken().then(function (authToken) { var requestInfo = getMetadata(self.authWrapper, self.location, self.mappings()); return self.authWrapper.makeRequest(requestInfo, authToken).getPromise(); }); }; /** * Updates the metadata for this object. * @param metadata The new metadata for the object. * Only values that have been explicitly set will be changed. Explicitly * setting a value to null will remove the metadata. * @return A promise that resolves * with the new metadata for this object. * @see firebaseStorage.Reference.prototype.getMetadata */ Reference.prototype.updateMetadata = function (metadata) { validate('updateMetadata', [metadataSpec()], arguments); this.throwIfRoot_('updateMetadata'); var self = this; return this.authWrapper.getAuthToken().then(function (authToken) { var requestInfo = updateMetadata(self.authWrapper, self.location, metadata, self.mappings()); return self.authWrapper.makeRequest(requestInfo, authToken).getPromise(); }); }; /** * @return A promise that resolves with the download * URL for this object. */ Reference.prototype.getDownloadURL = function () { validate('getDownloadURL', [], arguments); this.throwIfRoot_('getDownloadURL'); var self = this; return this.authWrapper.getAuthToken().then(function (authToken) { var requestInfo = getDownloadUrl(self.authWrapper, self.location, self.mappings()); return self.authWrapper .makeRequest(requestInfo, authToken) .getPromise() .then(function (url) { if (url === null) { throw noDownloadURL(); } return url; }); }); }; Reference.prototype.throwIfRoot_ = function (name) { if (this.location.path === '') { throw invalidRootOperation(name); } }; return Reference; }()); /** * A request whose promise always fails. * @struct * @template T */ var FailRequest = /** @class */ (function () { function FailRequest(error) { this.promise_ = reject(error); } /** @inheritDoc */ FailRequest.prototype.getPromise = function () { return this.promise_; }; /** @inheritDoc */ FailRequest.prototype.cancel = function (appDelete) { if (appDelete === void 0) { appDelete = false; } }; return FailRequest; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @struct */ var RequestMap = /** @class */ (function () { function RequestMap() { this.map_ = {}; this.id_ = minSafeInteger; } /** * Registers the given request with this map. * The request is unregistered when it completes. * @param r The request to register. */ RequestMap.prototype.addRequest = function (r) { var id = this.id_; this.id_++; this.map_[id] = r; var self = this; function unmap() { delete self.map_[id]; } r.getPromise().then(unmap, unmap); }; /** * Cancels all registered requests. */ RequestMap.prototype.clear = function () { forEach(this.map_, function (key, val) { if (val) { val.cancel(true); } }); this.map_ = {}; }; return RequestMap; }()); /** * @param app If null, getAuthToken always resolves with null. * @param service The storage service associated with this auth wrapper. * Untyped to avoid circular type dependencies. * @struct */ var AuthWrapper = /** @class */ (function () { function AuthWrapper(app, maker, requestMaker, service, pool) { this.bucket_ = null; this.deleted_ = false; this.app_ = app; if (this.app_ !== null) { var options = this.app_.options; if (isDef(options)) { this.bucket_ = AuthWrapper.extractBucket_(options); } } this.storageRefMaker_ = maker; this.requestMaker_ = requestMaker; this.pool_ = pool; this.service_ = service; this.maxOperationRetryTime_ = defaultMaxOperationRetryTime; this.maxUploadRetryTime_ = defaultMaxUploadRetryTime; this.requestMap_ = new RequestMap(); } AuthWrapper.extractBucket_ = function (config) { var bucketString = config[configOption] || null; if (bucketString == null) { return null; } var loc = Location.makeFromBucketSpec(bucketString); return loc.bucket; }; AuthWrapper.prototype.getAuthToken = function () { // TODO(andysoto): remove ifDef checks after firebase-app implements stubs // (b/28673818). if (this.app_ !== null && isDef(this.app_.INTERNAL) && isDef(this.app_.INTERNAL.getToken)) { return this.app_.INTERNAL.getToken().then(function (response) { if (response !== null) { return response.accessToken; } else { return null; } }, function (_error) { return null; }); } else { return resolve(null); } }; AuthWrapper.prototype.bucket = function () { if (this.deleted_) { throw appDeleted(); } else { return this.bucket_; } }; /** * The service associated with this auth wrapper. Untyped to avoid circular * type dependencies. */ AuthWrapper.prototype.service = function () { return this.service_; }; /** * Returns a new firebaseStorage.Reference object referencing this AuthWrapper * at the given Location. * @param loc The Location. * @return Actually a firebaseStorage.Reference, typing not allowed * because of circular dependency problems. */ AuthWrapper.prototype.makeStorageReference = function (loc) { return this.storageRefMaker_(this, loc); }; AuthWrapper.prototype.makeRequest = function (requestInfo, authToken) { if (!this.deleted_) { var request = this.requestMaker_(requestInfo, authToken, this.pool_); this.requestMap_.addRequest(request); return request; } else { return new FailRequest(appDeleted()); } }; /** * Stop running requests and prevent more from being created. */ AuthWrapper.prototype.deleteApp = function () { this.deleted_ = true; this.app_ = null; this.requestMap_.clear(); }; AuthWrapper.prototype.maxUploadRetryTime = function () { return this.maxUploadRetryTime_; }; AuthWrapper.prototype.setMaxUploadRetryTime = function (time) { this.maxUploadRetryTime_ = time; }; AuthWrapper.prototype.maxOperationRetryTime = function () { return this.maxOperationRetryTime_; }; AuthWrapper.prototype.setMaxOperationRetryTime = function (time) { this.maxOperationRetryTime_ = time; }; return AuthWrapper; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @param f May be invoked * before the function returns. * @param callback Get all the arguments passed to the function * passed to f, including the initial boolean. */ function start(f, callback, timeout) { // TODO(andysoto): make this code cleaner (probably refactor into an actual // type instead of a bunch of functions with state shared in the closure) var waitSeconds = 1; // Would type this as "number" but that doesn't work for Node so ¯\_(ツ)_/¯ var timeoutId = null; var hitTimeout = false; var cancelState = 0; function canceled() { return cancelState === 2; } var triggeredCallback = false; function triggerCallback() { if (!triggeredCallback) { triggeredCallback = true; callback.apply(null, arguments); } } function callWithDelay(millis) { timeoutId = setTimeout(function () { timeoutId = null; f(handler, canceled()); }, millis); } function handler(success) { var var_args = []; for (var _i = 1; _i < arguments.length; _i++) { var_args[_i - 1] = arguments[_i]; } if (triggeredCallback) { return; } if (success) { triggerCallback.apply(null, arguments); return; } var mustStop = canceled() || hitTimeout; if (mustStop) { triggerCallback.apply(null, arguments); return; } if (waitSeconds < 64) { /* TODO(andysoto): don't back off so quickly if we know we're offline. */ waitSeconds *= 2; } var waitMillis; if (cancelState === 1) { cancelState = 2; waitMillis = 0; } else { waitMillis = (waitSeconds + Math.random()) * 1000; } callWithDelay(waitMillis); } var stopped = false; function stop(wasTimeout) { if (stopped) { return; } stopped = true; if (triggeredCallback) { return; } if (timeoutId !== null) { if (!wasTimeout) { cancelState = 2; } clearTimeout(timeoutId); callWithDelay(0); } else { if (!wasTimeout) { cancelState = 1; } } } callWithDelay(0); setTimeout(function () { hitTimeout = true; stop(true); }, timeout); return stop; } /** * Stops the retry loop from repeating. * If the function is currently "in between" retries, it is invoked immediately * with the second parameter as "true". Otherwise, it will be invoked once more * after the current invocation finishes iff the current invocation would have * triggered another retry. */ function stop(id) { id(false); } /** * Copyright 2017 Google Inc. * * 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. */ /** * @struct * @template T */ var NetworkRequest = /** @class */ (function () { function NetworkRequest(url, method, headers, body, successCodes, additionalRetryCodes, callback, errorCallback, timeout, progressCallback, pool) { this.pendingXhr_ = null; this.backoffId_ = null; this.resolve_ = null; this.reject_ = null; this.canceled_ = false; this.appDelete_ = false; this.url_ = url; this.method_ = method; this.headers_ = headers; this.body_ = body; this.successCodes_ = successCodes.slice(); this.additionalRetryCodes_ = additionalRetryCodes.slice(); this.callback_ = callback; this.errorCallback_ = errorCallback; this.progressCallback_ = progressCallback; this.timeout_ = timeout; this.pool_ = pool; var self = this; this.promise_ = make(function (resolve$$1, reject$$1) { self.resolve_ = resolve$$1; self.reject_ = reject$$1; self.start_(); }); } /** * Actually starts the retry loop. */ NetworkRequest.prototype.start_ = function () { var self = this; function doTheRequest(backoffCallback, canceled$$1) { if (canceled$$1) { backoffCallback(false, new RequestEndStatus(false, null, true)); return; } var xhr = self.pool_.createXhrIo(); self.pendingXhr_ = xhr; function progressListener(progressEvent) { var loaded = progressEvent.loaded; var total = progressEvent.lengthComputable ? progressEvent.total : -1; if (self.progressCallback_ !== null) { self.progressCallback_(loaded, total); } } if (self.progressCallback_ !== null) { xhr.addUploadProgressListener(progressListener); } xhr .send(self.url_, self.method_, self.body_, self.headers_) .then(function (xhr) { if (self.progressCallback_ !== null) { xhr.removeUploadProgressListener(progressListener); } self.pendingXhr_ = null; xhr = xhr; var hitServer = xhr.getErrorCode() === ErrorCode.NO_ERROR; var status = xhr.getStatus(); if (!hitServer || self.isRetryStatusCode_(status)) { var wasCanceled = xhr.getErrorCode() === ErrorCode.ABORT; backoffCallback(false, new RequestEndStatus(false, null, wasCanceled)); return; } var successCode = contains$1(self.successCodes_, status); backoffCallback(true, new RequestEndStatus(successCode, xhr)); }); } /** * @param requestWentThrough True if the request eventually went * through, false if it hit the retry limit or was canceled. */ function backoffDone(requestWentThrough, status) { var resolve$$1 = self.resolve_; var reject$$1 = self.reject_; var xhr = status.xhr; if (status.wasSuccessCode) { try { var result = self.callback_(xhr, xhr.getResponseText()); if (isJustDef(result)) { resolve$$1(result); } else { resolve$$1(); } } catch (e) { reject$$1(e); } } else { if (xhr !== null) { var err = unknown(); err.setServerResponseProp(xhr.getResponseText()); if (self.errorCallback_) { reject$$1(self.errorCallback_(xhr, err)); } else { reject$$1(err); } } else { if (status.canceled) { var err = self.appDelete_ ? appDeleted() : canceled(); reject$$1(err); } else { var err = retryLimitExceeded(); reject$$1(err); } } } } if (this.canceled_) { backoffDone(false, new RequestEndStatus(false, null, true)); } else { this.backoffId_ = start(doTheRequest, backoffDone, this.timeout_); } }; /** @inheritDoc */ NetworkRequest.prototype.getPromise = function () { return this.promise_; }; /** @inheritDoc */ NetworkRequest.prototype.cancel = function (appDelete) { this.canceled_ = true; this.appDelete_ = appDelete || false; if (this.backoffId_ !== null) { stop(this.backoffId_); } if (this.pendingXhr_ !== null) { this.pendingXhr_.abort(); } }; NetworkRequest.prototype.isRetryStatusCode_ = function (status) { // The codes for which to retry came from this page: // https://cloud.google.com/storage/docs/exponential-backoff var isFiveHundredCode = status >= 500 && status < 600; var extraRetryCodes = [ // Request Timeout: web server didn't receive full request in time. 408, // Too Many Requests: you're getting rate-limited, basically. 429 ]; var isExtraRetryCode = contains$1(extraRetryCodes, status); var isRequestSpecificRetryCode = contains$1(this.additionalRetryCodes_, status); return isFiveHundredCode || isExtraRetryCode || isRequestSpecificRetryCode; }; return NetworkRequest; }()); /** * A collection of information about the result of a network request. * @param opt_canceled Defaults to false. * @struct */ var RequestEndStatus = /** @class */ (function () { function RequestEndStatus(wasSuccessCode, xhr, opt_canceled) { this.wasSuccessCode = wasSuccessCode; this.xhr = xhr; this.canceled = !!opt_canceled; } return RequestEndStatus; }()); function addAuthHeader_(headers, authToken) { if (authToken !== null && authToken.length > 0) { headers['Authorization'] = 'Firebase ' + authToken; } } function addVersionHeader_(headers) { var number = typeof _firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a !== 'undefined' ? _firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.SDK_VERSION : 'AppManager'; headers['X-Firebase-Storage-Version'] = 'webjs/' + number; } /** * @template T */ function makeRequest(requestInfo, authToken, pool) { var queryPart = makeQueryString(requestInfo.urlParams); var url = requestInfo.url + queryPart; var headers = clone(requestInfo.headers); addAuthHeader_(headers, authToken); addVersionHeader_(headers); return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, pool); } /** * Copyright 2017 Google Inc. * * 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. */ /** * A service that provides firebaseStorage.Reference instances. * @param opt_url gs:// url to a custom Storage Bucket * * @struct */ var Service = /** @class */ (function () { function Service(app, pool, url) { this.bucket_ = null; function maker(authWrapper, loc) { return new Reference(authWrapper, loc); } this.authWrapper_ = new AuthWrapper(app, maker, makeRequest, this, pool); this.app_ = app; if (url != null) { this.bucket_ = Location.makeFromBucketSpec(url); } else { var authWrapperBucket = this.authWrapper_.bucket(); if (authWrapperBucket != null) { this.bucket_ = new Location(authWrapperBucket, ''); } } this.internals_ = new ServiceInternals(this); } /** * Returns a firebaseStorage.Reference for the given path in the default * bucket. */ Service.prototype.ref = function (path) { function validator(path) { if (/^[A-Za-z]+:\/\//.test(path)) { throw 'Expected child path but got a URL, use refFromURL instead.'; } } validate('ref', [stringSpec(validator, true)], arguments); if (this.bucket_ == null) { throw new Error('No Storage Bucket defined in Firebase Options.'); } var ref = new Reference(this.authWrapper_, this.bucket_); if (path != null) { return ref.child(path); } else { return ref; } }; /** * Returns a firebaseStorage.Reference object for the given absolute URL, * which must be a gs:// or http[s]:// URL. */ Service.prototype.refFromURL = function (url) { function validator(p) { if (!/^[A-Za-z]+:\/\//.test(p)) { throw 'Expected full URL but got a child path, use ref instead.'; } try { Location.makeFromUrl(p); } catch (e) { throw 'Expected valid full URL but got an invalid one.'; } } validate('refFromURL', [stringSpec(validator, false)], arguments); return new Reference(this.authWrapper_, url); }; Object.defineProperty(Service.prototype, "maxUploadRetryTime", { get: function () { return this.authWrapper_.maxUploadRetryTime(); }, enumerable: true, configurable: true }); Service.prototype.setMaxUploadRetryTime = function (time) { validate('setMaxUploadRetryTime', [nonNegativeNumberSpec()], arguments); this.authWrapper_.setMaxUploadRetryTime(time); }; Object.defineProperty(Service.prototype, "maxOperationRetryTime", { get: function () { return this.authWrapper_.maxOperationRetryTime(); }, enumerable: true, configurable: true }); Service.prototype.setMaxOperationRetryTime = function (time) { validate('setMaxOperationRetryTime', [nonNegativeNumberSpec()], arguments); this.authWrapper_.setMaxOperationRetryTime(time); }; Object.defineProperty(Service.prototype, "app", { get: function () { return this.app_; }, enumerable: true, configurable: true }); Object.defineProperty(Service.prototype, "INTERNAL", { get: function () { return this.internals_; }, enumerable: true, configurable: true }); return Service; }()); /** * @struct */ var ServiceInternals = /** @class */ (function () { function ServiceInternals(service) { this.service_ = service; } /** * Called when the associated app is deleted. * @see {!fbs.AuthWrapper.prototype.deleteApp} */ ServiceInternals.prototype.delete = function () { this.service_.authWrapper_.deleteApp(); return resolve(undefined); }; return ServiceInternals; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Type constant for Firebase Storage. */ var STORAGE_TYPE = 'storage'; function factory(app, unused, opt_url) { return new Service(app, new XhrIoPool(), opt_url); } function registerStorage(instance) { var namespaceExports = { // no-inline TaskState: TaskState, TaskEvent: TaskEvent, StringFormat: StringFormat, Storage: Service, Reference: Reference }; instance.INTERNAL.registerService(STORAGE_TYPE, factory, namespaceExports, undefined, // Allow multiple storage instances per app. true); } registerStorage(_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a); /***/ }), /***/ "../../node_modules/@firebase/util/dist/index.cjs.js": /*!**************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/util/dist/index.cjs.js ***! \**************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(console) { Object.defineProperty(exports, '__esModule', { value: true }); var tslib_1 = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js"); /** * Copyright 2017 Google Inc. * * 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. */ /** * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time. */ var CONSTANTS = { /** * @define {boolean} Whether this is the client Node.js SDK. */ NODE_CLIENT: false, /** * @define {boolean} Whether this is the Admin Node.js SDK. */ NODE_ADMIN: false, /** * Firebase SDK Version */ SDK_VERSION: '${JSCORE_VERSION}' }; /** * Copyright 2017 Google Inc. * * 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. */ /** * Throws an error if the provided assertion is falsy * @param {*} assertion The assertion to be tested for falsiness * @param {!string} message The message to display if the check fails */ var assert = function (assertion, message) { if (!assertion) { throw assertionError(message); } }; /** * Returns an Error object suitable for throwing. * @param {string} message * @return {!Error} */ var assertionError = function (message) { return new Error('Firebase Database (' + CONSTANTS.SDK_VERSION + ') INTERNAL ASSERT FAILED: ' + message); }; /** * Copyright 2017 Google Inc. * * 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. */ var stringToByteArray = function (str) { // TODO(user): Use native implementations if/when available var out = [], p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if ((c & 0xfc00) == 0xd800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xfc00) == 0xdc00) { // Surrogate Pair c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff); out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Turns an array of numbers into the string given by the concatenation of the * characters to which the numbers correspond. * @param {Array} bytes Array of numbers representing characters. * @return {string} Stringification of the array. */ var byteArrayToString = function (bytes) { // TODO(user): Use native implementations if/when available var out = [], pos = 0, c = 0; while (pos < bytes.length) { var c1 = bytes[pos++]; if (c1 < 128) { out[c++] = String.fromCharCode(c1); } else if (c1 > 191 && c1 < 224) { var c2 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); } else if (c1 > 239 && c1 < 365) { // Surrogate Pair var c2 = bytes[pos++]; var c3 = bytes[pos++]; var c4 = bytes[pos++]; var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) - 0x10000; out[c++] = String.fromCharCode(0xd800 + (u >> 10)); out[c++] = String.fromCharCode(0xdc00 + (u & 1023)); } else { var c2 = bytes[pos++]; var c3 = bytes[pos++]; out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); } } return out.join(''); }; // Static lookup maps, lazily populated by init_() var base64 = { /** * Maps bytes to characters. * @type {Object} * @private */ byteToCharMap_: null, /** * Maps characters to bytes. * @type {Object} * @private */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @type {Object} * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @type {Object} * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE * @type {string} */ ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789', /** * Our default alphabet. Value 64 (=) is special; it means "nothing." * @type {string} */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + '+/='; }, /** * Our websafe alphabet. * @type {string} */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + '-_.'; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * * @type {boolean} */ HAS_NATIVE_SUPPORT: typeof atob === 'function', /** * Base64-encode an array of bytes. * * @param {Array|Uint8Array} input An array of bytes (numbers with * value in [0, 255]) to encode. * @param {boolean=} opt_webSafe Boolean indicating we should use the * alternative alphabet. * @return {string} The base64 encoded string. */ encodeByteArray: function (input, opt_webSafe) { if (!Array.isArray(input)) { throw Error('encodeByteArray takes an array as a parameter'); } this.init_(); var byteToCharMap = opt_webSafe ? this.byteToCharMapWebSafe_ : this.byteToCharMap_; var output = []; for (var i = 0; i < input.length; i += 3) { var byte1 = input[i]; var haveByte2 = i + 1 < input.length; var byte2 = haveByte2 ? input[i + 1] : 0; var haveByte3 = i + 2 < input.length; var byte3 = haveByte3 ? input[i + 2] : 0; var outByte1 = byte1 >> 2; var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4); var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6); var outByte4 = byte3 & 0x3f; if (!haveByte3) { outByte4 = 64; if (!haveByte2) { outByte3 = 64; } } output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]); } return output.join(''); }, /** * Base64-encode a string. * * @param {string} input A string to encode. * @param {boolean=} opt_webSafe If true, we should use the * alternative alphabet. * @return {string} The base64 encoded string. */ encodeString: function (input, opt_webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !opt_webSafe) { return btoa(input); } return this.encodeByteArray(stringToByteArray(input), opt_webSafe); }, /** * Base64-decode a string. * * @param {string} input to decode. * @param {boolean=} opt_webSafe True if we should use the * alternative alphabet. * @return {string} string representing the decoded value. */ decodeString: function (input, opt_webSafe) { // Shortcut for Mozilla browsers that implement // a native base64 encoder in the form of "btoa/atob" if (this.HAS_NATIVE_SUPPORT && !opt_webSafe) { return atob(input); } return byteArrayToString(this.decodeStringToByteArray(input, opt_webSafe)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param {string} input Input to decode. * @param {boolean=} opt_webSafe True if we should use the web-safe alphabet. * @return {!Array} bytes representing the decoded value. */ decodeStringToByteArray: function (input, opt_webSafe) { this.init_(); var charToByteMap = opt_webSafe ? this.charToByteMapWebSafe_ : this.charToByteMap_; var output = []; for (var i = 0; i < input.length;) { var byte1 = charToByteMap[input.charAt(i++)]; var haveByte2 = i < input.length; var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0; ++i; var haveByte3 = i < input.length; var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64; ++i; var haveByte4 = i < input.length; var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64; ++i; if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) { throw Error(); } var outByte1 = (byte1 << 2) | (byte2 >> 4); output.push(outByte1); if (byte3 != 64) { var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2); output.push(outByte2); if (byte4 != 64) { var outByte3 = ((byte3 << 6) & 0xc0) | byte4; output.push(outByte3); } } } return output; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_: function () { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}; this.charToByteMap_ = {}; this.byteToCharMapWebSafe_ = {}; this.charToByteMapWebSafe_ = {}; // We want quick mappings back and forth, so we precompute two maps. for (var i = 0; i < this.ENCODED_VALS.length; i++) { this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i); this.charToByteMap_[this.byteToCharMap_[i]] = i; this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i); this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i; // Be forgiving when decoding and correctly decode both encodings. if (i >= this.ENCODED_VALS_BASE.length) { this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i; this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i; } } } } }; /** * URL-safe base64 encoding * @param {!string} str * @return {!string} */ var base64Encode = function (str) { var utf8Bytes = stringToByteArray(str); return base64.encodeByteArray(utf8Bytes, true); }; /** * URL-safe base64 decoding * * NOTE: DO NOT use the global atob() function - it does NOT support the * base64Url variant encoding. * * @param {string} str To be decoded * @return {?string} Decoded result, if possible */ var base64Decode = function (str) { try { return base64.decodeString(str, true); } catch (e) { console.error('base64Decode failed: ', e); } return null; }; /** * Copyright 2017 Google Inc. * * 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. */ /** * Do a deep-copy of basic JavaScript Objects or Arrays. */ function deepCopy(value) { return deepExtend(undefined, value); } /** * Copy properties from source to target (recursively allows extension * of Objects and Arrays). Scalar values in the target are over-written. * If target is undefined, an object of the appropriate type will be created * (and returned). * * We recursively copy all child properties of plain Objects in the source- so * that namespace- like dictionaries are merged. * * Note that the target can be a function, in which case the properties in * the source Object are copied onto it as static properties of the Function. */ function deepExtend(target, source) { if (!(source instanceof Object)) { return source; } switch (source.constructor) { case Date: // Treat Dates like scalars; if the target date object had any child // properties - they will be lost! var dateValue = source; return new Date(dateValue.getTime()); case Object: if (target === undefined) { target = {}; } break; case Array: // Always copy the array source and overwrite the target. target = []; break; default: // Not a plain Object - treat it as a scalar. return source; } for (var prop in source) { if (!source.hasOwnProperty(prop)) { continue; } target[prop] = deepExtend(target[prop], source[prop]); } return target; } // TODO: Really needed (for JSCompiler type checking)? function patchProperty(obj, prop, value) { obj[prop] = value; } /** * Copyright 2017 Google Inc. * * 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. */ var Deferred = /** @class */ (function () { function Deferred() { var _this = this; this.promise = new Promise(function (resolve, reject) { _this.resolve = resolve; _this.reject = reject; }); } /** * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback * and returns a node-style callback which will resolve or reject the Deferred's promise. * @param {((?function(?(Error)): (?|undefined))| (?function(?(Error),?=): (?|undefined)))=} callback * @return {!function(?(Error), ?=)} */ Deferred.prototype.wrapCallback = function (callback) { var _this = this; return function (error, value) { if (error) { _this.reject(error); } else { _this.resolve(value); } if (typeof callback === 'function') { // Attaching noop handler just in case developer wasn't expecting // promises _this.promise.catch(function () { }); // Some of our callbacks don't expect a value and our own tests // assert that the parameter length is 1 if (callback.length === 1) { callback(error); } else { callback(error, value); } } }; }; return Deferred; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Returns navigator.userAgent string or '' if it's not defined. * @return {string} user agent string */ var getUA = function () { if (typeof navigator !== 'undefined' && typeof navigator['userAgent'] === 'string') { return navigator['userAgent']; } else { return ''; } }; /** * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device. * * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap in the Ripple emulator) nor * Cordova `onDeviceReady`, which would normally wait for a callback. * * @return {boolean} isMobileCordova */ var isMobileCordova = function () { return (typeof window !== 'undefined' && !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())); }; /** * Detect React Native. * * @return {boolean} True if ReactNative environment is detected. */ var isReactNative = function () { return (typeof navigator === 'object' && navigator['product'] === 'ReactNative'); }; /** * Detect Node.js. * * @return {boolean} True if Node.js environment is detected. */ var isNodeSdk = function () { return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true; }; var ERROR_NAME = 'FirebaseError'; var captureStackTrace = Error .captureStackTrace; // Export for faking in tests function patchCapture(captureFake) { var result = captureStackTrace; captureStackTrace = captureFake; return result; } var FirebaseError = /** @class */ (function () { function FirebaseError(code, message) { this.code = code; this.message = message; // We want the stack value, if implemented by Error if (captureStackTrace) { // Patches this.stack, omitted calls above ErrorFactory#create captureStackTrace(this, ErrorFactory.prototype.create); } else { try { // In case of IE11, stack will be set only after error is raised. // https://docs.microsoft.com/en-us/scripting/javascript/reference/stack-property-error-javascript throw Error.apply(this, arguments); } catch (err) { this.name = ERROR_NAME; // Make non-enumerable getter for the property. Object.defineProperty(this, 'stack', { get: function () { return err.stack; } }); } } } return FirebaseError; }()); // Back-door inheritance FirebaseError.prototype = Object.create(Error.prototype); FirebaseError.prototype.constructor = FirebaseError; FirebaseError.prototype.name = ERROR_NAME; var ErrorFactory = /** @class */ (function () { function ErrorFactory(service, serviceName, errors) { this.service = service; this.serviceName = serviceName; this.errors = errors; // Matches {$name}, by default. this.pattern = /\{\$([^}]+)}/g; // empty } ErrorFactory.prototype.create = function (code, data) { if (data === undefined) { data = {}; } var template = this.errors[code]; var fullCode = this.service + '/' + code; var message; if (template === undefined) { message = 'Error'; } else { message = template.replace(this.pattern, function (match, key) { var value = data[key]; return value !== undefined ? value.toString() : '<' + key + '?>'; }); } // Service: Error message (service/code). message = this.serviceName + ': ' + message + ' (' + fullCode + ').'; var err = new FirebaseError(fullCode, message); // Populate the Error object with message parts for programmatic // accesses (e.g., e.file). for (var prop in data) { if (!data.hasOwnProperty(prop) || prop.slice(-1) === '_') { continue; } err[prop] = data[prop]; } return err; }; return ErrorFactory; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * Evaluates a JSON string into a javascript object. * * @param {string} str A string containing JSON. * @return {*} The javascript object representing the specified JSON. */ function jsonEval(str) { return JSON.parse(str); } /** * Returns JSON representing a javascript object. * @param {*} data Javascript object to be stringified. * @return {string} The JSON contents of the object. */ function stringify(data) { return JSON.stringify(data); } /** * Copyright 2017 Google Inc. * * 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. */ /** * Decodes a Firebase auth. token into constituent parts. * * Notes: * - May return with invalid / incomplete claims if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. * * @param {?string} token * @return {{header: *, claims: *, data: *, signature: string}} */ var decode = function (token) { var header = {}, claims = {}, data = {}, signature = ''; try { var parts = token.split('.'); header = jsonEval(base64Decode(parts[0]) || ''); claims = jsonEval(base64Decode(parts[1]) || ''); signature = parts[2]; data = claims['d'] || {}; delete claims['d']; } catch (e) { } return { header: header, claims: claims, data: data, signature: signature }; }; /** * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. * * @param {?string} token * @return {boolean} */ var isValidTimestamp = function (token) { var claims = decode(token).claims, now = Math.floor(new Date().getTime() / 1000), validSince, validUntil; if (typeof claims === 'object') { if (claims.hasOwnProperty('nbf')) { validSince = claims['nbf']; } else if (claims.hasOwnProperty('iat')) { validSince = claims['iat']; } if (claims.hasOwnProperty('exp')) { validUntil = claims['exp']; } else { // token will expire after 24h by default validUntil = validSince + 86400; } } return (now && validSince && validUntil && now >= validSince && now <= validUntil); }; /** * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise. * * Notes: * - May return null if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. * * @param {?string} token * @return {?number} */ var issuedAtTime = function (token) { var claims = decode(token).claims; if (typeof claims === 'object' && claims.hasOwnProperty('iat')) { return claims['iat']; } return null; }; /** * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. * * @param {?string} token * @return {boolean} */ var isValidFormat = function (token) { var decoded = decode(token), claims = decoded.claims; return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat'); }; /** * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion. * * Notes: * - May return a false negative if there's no native base64 decoding support. * - Doesn't check if the token is actually valid. * * @param {?string} token * @return {boolean} */ var isAdmin = function (token) { var claims = decode(token).claims; return typeof claims === 'object' && claims['admin'] === true; }; /** * Copyright 2017 Google Inc. * * 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. */ // See http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/ var contains = function (obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); }; var safeGet = function (obj, key) { if (Object.prototype.hasOwnProperty.call(obj, key)) return obj[key]; // else return undefined. }; /** * Enumerates the keys/values in an object, excluding keys defined on the prototype. * * @param {?Object.} obj Object to enumerate. * @param {!function(K, V)} fn Function to call for each key and value. * @template K,V */ var forEach = function (obj, fn) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { fn(key, obj[key]); } } }; /** * Copies all the (own) properties from one object to another. * @param {!Object} objTo * @param {!Object} objFrom * @return {!Object} objTo */ var extend = function (objTo, objFrom) { forEach(objFrom, function (key, value) { objTo[key] = value; }); return objTo; }; /** * Returns a clone of the specified object. * @param {!Object} obj * @return {!Object} cloned obj. */ var clone = function (obj) { return extend({}, obj); }; /** * Returns true if obj has typeof "object" and is not null. Unlike goog.isObject(), does not return true * for functions. * * @param obj {*} A potential object. * @returns {boolean} True if it's an object. */ var isNonNullObject = function (obj) { return typeof obj === 'object' && obj !== null; }; var isEmpty = function (obj) { for (var key in obj) { return false; } return true; }; var getCount = function (obj) { var rv = 0; for (var key in obj) { rv++; } return rv; }; var map = function (obj, f, opt_obj) { var res = {}; for (var key in obj) { res[key] = f.call(opt_obj, obj[key], key, obj); } return res; }; var findKey = function (obj, fn, opt_this) { for (var key in obj) { if (fn.call(opt_this, obj[key], key, obj)) { return key; } } return undefined; }; var findValue = function (obj, fn, opt_this) { var key = findKey(obj, fn, opt_this); return key && obj[key]; }; var getAnyKey = function (obj) { for (var key in obj) { return key; } }; var getValues = function (obj) { var res = []; var i = 0; for (var key in obj) { res[i++] = obj[key]; } return res; }; /** * Tests whether every key/value pair in an object pass the test implemented * by the provided function * * @param {?Object.} obj Object to test. * @param {!function(K, V)} fn Function to call for each key and value. * @template K,V */ var every = function (obj, fn) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { if (!fn(key, obj[key])) { return false; } } } return true; }; /** * Copyright 2017 Google Inc. * * 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. */ /** * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a params * object (e.g. {arg: 'val', arg2: 'val2'}) * Note: You must prepend it with ? when adding it to a URL. * * @param {!Object} querystringParams * @return {string} */ var querystring = function (querystringParams) { var params = []; forEach(querystringParams, function (key, value) { if (Array.isArray(value)) { value.forEach(function (arrayVal) { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal)); }); } else { params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); } }); return params.length ? '&' + params.join('&') : ''; }; /** * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object (e.g. {arg: 'val', arg2: 'val2'}) * * @param {string} querystring * @return {!Object} */ var querystringDecode = function (querystring) { var obj = {}; var tokens = querystring.replace(/^\?/, '').split('&'); tokens.forEach(function (token) { if (token) { var key = token.split('='); obj[key[0]] = key[1]; } }); return obj; }; /** * Copyright 2017 Google Inc. * * 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. */ // Copyright 2011 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. /** * @fileoverview Abstract cryptographic hash interface. * * See Sha1 and Md5 for sample implementations. * */ /** * Create a cryptographic hash instance. * * @constructor * @struct */ var Hash = /** @class */ (function () { function Hash() { /** * The block size for the hasher. * @type {number} */ this.blockSize = -1; } return Hash; }()); /** * Copyright 2017 Google Inc. * * 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. */ /** * @fileoverview SHA-1 cryptographic hash. * Variable names follow the notation in FIPS PUB 180-3: * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf. * * Usage: * var sha1 = new sha1(); * sha1.update(bytes); * var hash = sha1.digest(); * * Performance: * Chrome 23: ~400 Mbit/s * Firefox 16: ~250 Mbit/s * */ /** * SHA-1 cryptographic hash constructor. * * The properties declared here are discussed in the above algorithm document. * @constructor * @extends {Hash} * @final * @struct */ var Sha1 = /** @class */ (function (_super) { tslib_1.__extends(Sha1, _super); function Sha1() { var _this = _super.call(this) || this; /** * Holds the previous values of accumulated variables a-e in the compress_ * function. * @type {!Array} * @private */ _this.chain_ = []; /** * A buffer holding the partially computed hash result. * @type {!Array} * @private */ _this.buf_ = []; /** * An array of 80 bytes, each a part of the message to be hashed. Referred to * as the message schedule in the docs. * @type {!Array} * @private */ _this.W_ = []; /** * Contains data needed to pad messages less than 64 bytes. * @type {!Array} * @private */ _this.pad_ = []; /** * @private {number} */ _this.inbuf_ = 0; /** * @private {number} */ _this.total_ = 0; _this.blockSize = 512 / 8; _this.pad_[0] = 128; for (var i = 1; i < _this.blockSize; ++i) { _this.pad_[i] = 0; } _this.reset(); return _this; } Sha1.prototype.reset = function () { this.chain_[0] = 0x67452301; this.chain_[1] = 0xefcdab89; this.chain_[2] = 0x98badcfe; this.chain_[3] = 0x10325476; this.chain_[4] = 0xc3d2e1f0; this.inbuf_ = 0; this.total_ = 0; }; /** * Internal compress helper function. * @param {!Array|!Uint8Array|string} buf Block to compress. * @param {number=} opt_offset Offset of the block in the buffer. * @private */ Sha1.prototype.compress_ = function (buf, opt_offset) { if (!opt_offset) { opt_offset = 0; } var W = this.W_; // get 16 big endian words if (typeof buf === 'string') { for (var i = 0; i < 16; i++) { // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS // have a bug that turns the post-increment ++ operator into pre-increment // during JIT compilation. We have code that depends heavily on SHA-1 for // correctness and which is affected by this bug, so I've removed all uses // of post-increment ++ in which the result value is used. We can revert // this change once the Safari bug // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and // most clients have been updated. W[i] = (buf.charCodeAt(opt_offset) << 24) | (buf.charCodeAt(opt_offset + 1) << 16) | (buf.charCodeAt(opt_offset + 2) << 8) | buf.charCodeAt(opt_offset + 3); opt_offset += 4; } } else { for (var i = 0; i < 16; i++) { W[i] = (buf[opt_offset] << 24) | (buf[opt_offset + 1] << 16) | (buf[opt_offset + 2] << 8) | buf[opt_offset + 3]; opt_offset += 4; } } // expand to 80 words for (var i = 16; i < 80; i++) { var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff; } var a = this.chain_[0]; var b = this.chain_[1]; var c = this.chain_[2]; var d = this.chain_[3]; var e = this.chain_[4]; var f, k; // TODO(user): Try to unroll this loop to speed up the computation. for (var i = 0; i < 80; i++) { if (i < 40) { if (i < 20) { f = d ^ (b & (c ^ d)); k = 0x5a827999; } else { f = b ^ c ^ d; k = 0x6ed9eba1; } } else { if (i < 60) { f = (b & c) | (d & (b | c)); k = 0x8f1bbcdc; } else { f = b ^ c ^ d; k = 0xca62c1d6; } } var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff; e = d; d = c; c = ((b << 30) | (b >>> 2)) & 0xffffffff; b = a; a = t; } this.chain_[0] = (this.chain_[0] + a) & 0xffffffff; this.chain_[1] = (this.chain_[1] + b) & 0xffffffff; this.chain_[2] = (this.chain_[2] + c) & 0xffffffff; this.chain_[3] = (this.chain_[3] + d) & 0xffffffff; this.chain_[4] = (this.chain_[4] + e) & 0xffffffff; }; Sha1.prototype.update = function (bytes, opt_length) { // TODO(johnlenz): tighten the function signature and remove this check if (bytes == null) { return; } if (opt_length === undefined) { opt_length = bytes.length; } var lengthMinusBlock = opt_length - this.blockSize; var n = 0; // Using local instead of member variables gives ~5% speedup on Firefox 16. var buf = this.buf_; var inbuf = this.inbuf_; // The outer while loop should execute at most twice. while (n < opt_length) { // When we have no data in the block to top up, we can directly process the // input buffer (assuming it contains sufficient data). This gives ~25% // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that // the data is provided in large chunks (or in multiples of 64 bytes). if (inbuf == 0) { while (n <= lengthMinusBlock) { this.compress_(bytes, n); n += this.blockSize; } } if (typeof bytes === 'string') { while (n < opt_length) { buf[inbuf] = bytes.charCodeAt(n); ++inbuf; ++n; if (inbuf == this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } else { while (n < opt_length) { buf[inbuf] = bytes[n]; ++inbuf; ++n; if (inbuf == this.blockSize) { this.compress_(buf); inbuf = 0; // Jump to the outer loop so we use the full-block optimization. break; } } } } this.inbuf_ = inbuf; this.total_ += opt_length; }; /** @override */ Sha1.prototype.digest = function () { var digest = []; var totalBits = this.total_ * 8; // Add pad 0x80 0x00*. if (this.inbuf_ < 56) { this.update(this.pad_, 56 - this.inbuf_); } else { this.update(this.pad_, this.blockSize - (this.inbuf_ - 56)); } // Add # bits. for (var i = this.blockSize - 1; i >= 56; i--) { this.buf_[i] = totalBits & 255; totalBits /= 256; // Don't use bit-shifting here! } this.compress_(this.buf_); var n = 0; for (var i = 0; i < 5; i++) { for (var j = 24; j >= 0; j -= 8) { digest[n] = (this.chain_[i] >> j) & 255; ++n; } } return digest; }; return Sha1; }(Hash)); /** * Helper to make a Subscribe function (just like Promise helps make a * Thenable). * * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function createSubscribe(executor, onNoObservers) { var proxy = new ObserverProxy(executor, onNoObservers); return proxy.subscribe.bind(proxy); } /** * Implement fan-out for any number of Observers attached via a subscribe * function. */ var ObserverProxy = /** @class */ (function () { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ function ObserverProxy(executor, onNoObservers) { var _this = this; this.observers = []; this.unsubscribes = []; this.observerCount = 0; // Micro-task scheduling by calling task.then(). this.task = Promise.resolve(); this.finalized = false; this.onNoObservers = onNoObservers; // Call the executor asynchronously so subscribers that are called // synchronously after the creation of the subscribe function // can still receive the very first value generated in the executor. this.task .then(function () { executor(_this); }) .catch(function (e) { _this.error(e); }); } ObserverProxy.prototype.next = function (value) { this.forEachObserver(function (observer) { observer.next(value); }); }; ObserverProxy.prototype.error = function (error) { this.forEachObserver(function (observer) { observer.error(error); }); this.close(error); }; ObserverProxy.prototype.complete = function () { this.forEachObserver(function (observer) { observer.complete(); }); this.close(); }; /** * Subscribe function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber sychronously to their * call to subscribe(). */ ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) { var _this = this; var observer; if (nextOrObserver === undefined && error === undefined && complete === undefined) { throw new Error('Missing Observer.'); } // Assemble an Observer object when passed as callback functions. if (implementsAnyMethods(nextOrObserver, ['next', 'error', 'complete'])) { observer = nextOrObserver; } else { observer = { next: nextOrObserver, error: error, complete: complete }; } if (observer.next === undefined) { observer.next = noop; } if (observer.error === undefined) { observer.error = noop; } if (observer.complete === undefined) { observer.complete = noop; } var unsub = this.unsubscribeOne.bind(this, this.observers.length); // Attempt to subscribe to a terminated Observable - we // just respond to the Observer with the final error or complete // event. if (this.finalized) { this.task.then(function () { try { if (_this.finalError) { observer.error(_this.finalError); } else { observer.complete(); } } catch (e) { // nothing } return; }); } this.observers.push(observer); return unsub; }; // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. ObserverProxy.prototype.unsubscribeOne = function (i) { if (this.observers === undefined || this.observers[i] === undefined) { return; } delete this.observers[i]; this.observerCount -= 1; if (this.observerCount === 0 && this.onNoObservers !== undefined) { this.onNoObservers(this); } }; ObserverProxy.prototype.forEachObserver = function (fn) { if (this.finalized) { // Already closed by previous event....just eat the additional values. return; } // Since sendOne calls asynchronously - there is no chance that // this.observers will become undefined. for (var i = 0; i < this.observers.length; i++) { this.sendOne(i, fn); } }; // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. ObserverProxy.prototype.sendOne = function (i, fn) { var _this = this; // Execute the callback asynchronously this.task.then(function () { if (_this.observers !== undefined && _this.observers[i] !== undefined) { try { fn(_this.observers[i]); } catch (e) { // Ignore exceptions raised in Observers or missing methods of an // Observer. // Log error to console. b/31404806 if (typeof console !== 'undefined' && console.error) { console.error(e); } } } }); }; ObserverProxy.prototype.close = function (err) { var _this = this; if (this.finalized) { return; } this.finalized = true; if (err !== undefined) { this.finalError = err; } // Proxy is no longer needed - garbage collect references this.task.then(function () { _this.observers = undefined; _this.onNoObservers = undefined; }); }; return ObserverProxy; }()); /** Turn synchronous function into one called asynchronously. */ function async(fn, onError) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } Promise.resolve(true) .then(function () { fn.apply(void 0, args); }) .catch(function (error) { if (onError) { onError(error); } }); }; } /** * Return true if the object passed in implements any of the named methods. */ function implementsAnyMethods(obj, methods) { if (typeof obj !== 'object' || obj === null) { return false; } for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) { var method = methods_1[_i]; if (method in obj && typeof obj[method] === 'function') { return true; } } return false; } function noop() { // do nothing } /** * Copyright 2017 Google Inc. * * 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. */ /** * Check to make sure the appropriate number of arguments are provided for a public function. * Throws an error if it fails. * * @param {!string} fnName The function name * @param {!number} minCount The minimum number of arguments to allow for the function call * @param {!number} maxCount The maximum number of argument to allow for the function call * @param {!number} argCount The actual number of arguments provided. */ var validateArgCount = function (fnName, minCount, maxCount, argCount) { var argError; if (argCount < minCount) { argError = 'at least ' + minCount; } else if (argCount > maxCount) { argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount; } if (argError) { var error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.'; throw new Error(error); } }; /** * Generates a string to prefix an error message about failed argument validation * * @param {!string} fnName The function name * @param {!number} argumentNumber The index of the argument * @param {boolean} optional Whether or not the argument is optional * @return {!string} The prefix to add to the error thrown for validation. */ function errorPrefix(fnName, argumentNumber, optional) { var argName = ''; switch (argumentNumber) { case 1: argName = optional ? 'first' : 'First'; break; case 2: argName = optional ? 'second' : 'Second'; break; case 3: argName = optional ? 'third' : 'Third'; break; case 4: argName = optional ? 'fourth' : 'Fourth'; break; default: throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?'); } var error = fnName + ' failed: '; error += argName + ' argument '; return error; } /** * @param {!string} fnName * @param {!number} argumentNumber * @param {!string} namespace * @param {boolean} optional */ function validateNamespace(fnName, argumentNumber, namespace, optional) { if (optional && !namespace) return; if (typeof namespace !== 'string') { //TODO: I should do more validation here. We only allow certain chars in namespaces. throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid firebase namespace.'); } } function validateCallback(fnName, argumentNumber, callback, optional) { if (optional && !callback) return; if (typeof callback !== 'function') throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid function.'); } function validateContextObject(fnName, argumentNumber, context, optional) { if (optional && !context) return; if (typeof context !== 'object' || context === null) throw new Error(errorPrefix(fnName, argumentNumber, optional) + 'must be a valid context object.'); } /** * Copyright 2017 Google Inc. * * 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. */ // Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they // automatically replaced '\r\n' with '\n', and they didn't handle surrogate pairs, // so it's been modified. // Note that not all Unicode characters appear as single characters in JavaScript strings. // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate // pair). // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3 /** * @param {string} str * @return {Array} */ var stringToByteArray$1 = function (str) { var out = [], p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Is this the lead surrogate in a surrogate pair? if (c >= 0xd800 && c <= 0xdbff) { var high = c - 0xd800; // the high 10 bits. i++; assert(i < str.length, 'Surrogate pair missing trail surrogate.'); var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits. c = 0x10000 + (high << 10) + low; } if (c < 128) { out[p++] = c; } else if (c < 2048) { out[p++] = (c >> 6) | 192; out[p++] = (c & 63) | 128; } else if (c < 65536) { out[p++] = (c >> 12) | 224; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } else { out[p++] = (c >> 18) | 240; out[p++] = ((c >> 12) & 63) | 128; out[p++] = ((c >> 6) & 63) | 128; out[p++] = (c & 63) | 128; } } return out; }; /** * Calculate length without actually converting; useful for doing cheaper validation. * @param {string} str * @return {number} */ var stringLength = function (str) { var p = 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); if (c < 128) { p++; } else if (c < 2048) { p += 2; } else if (c >= 0xd800 && c <= 0xdbff) { // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent. p += 4; i++; // skip trail surrogate. } else { p += 3; } } return p; }; /** * Copyright 2017 Google Inc. * * 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. */ exports.assert = assert; exports.assertionError = assertionError; exports.base64 = base64; exports.base64Decode = base64Decode; exports.base64Encode = base64Encode; exports.CONSTANTS = CONSTANTS; exports.deepCopy = deepCopy; exports.deepExtend = deepExtend; exports.patchProperty = patchProperty; exports.Deferred = Deferred; exports.getUA = getUA; exports.isMobileCordova = isMobileCordova; exports.isNodeSdk = isNodeSdk; exports.isReactNative = isReactNative; exports.ErrorFactory = ErrorFactory; exports.FirebaseError = FirebaseError; exports.patchCapture = patchCapture; exports.jsonEval = jsonEval; exports.stringify = stringify; exports.decode = decode; exports.isAdmin = isAdmin; exports.issuedAtTime = issuedAtTime; exports.isValidFormat = isValidFormat; exports.isValidTimestamp = isValidTimestamp; exports.clone = clone; exports.contains = contains; exports.every = every; exports.extend = extend; exports.findKey = findKey; exports.findValue = findValue; exports.forEach = forEach; exports.getAnyKey = getAnyKey; exports.getCount = getCount; exports.getValues = getValues; exports.isEmpty = isEmpty; exports.isNonNullObject = isNonNullObject; exports.map = map; exports.safeGet = safeGet; exports.querystring = querystring; exports.querystringDecode = querystringDecode; exports.Sha1 = Sha1; exports.async = async; exports.createSubscribe = createSubscribe; exports.errorPrefix = errorPrefix; exports.validateArgCount = validateArgCount; exports.validateCallback = validateCallback; exports.validateContextObject = validateContextObject; exports.validateNamespace = validateNamespace; exports.stringLength = stringLength; exports.stringToByteArray = stringToByteArray$1; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../console-browserify/index.js */ "../../node_modules/console-browserify/index.js"))) /***/ }), /***/ "../../node_modules/@firebase/webchannel-wrapper/dist/index.esm.js": /*!****************************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/@firebase/webchannel-wrapper/dist/index.esm.js ***! \****************************************************************************************************************************************/ /*! exports provided: default, createWebChannelTransport, ErrorCode, EventType, WebChannel, XhrIoPool */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createWebChannelTransport", function() { return src_1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorCode", function() { return src_2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventType", function() { return src_3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebChannel", function() { return src_4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "XhrIoPool", function() { return src_5; }); var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; var e,goog=goog||{},h=commonjsGlobal;function l(a){return"string"==typeof a}function m(a,b){a=a.split(".");b=b||h;for(var c=0;c>>0),da=0;function ea(a,b,c){return a.call.apply(a.bind,arguments)} function fa(a,b,c){if(!a)throw Error();if(2c&&(c=Math.max(0,a.length+c));if(l(a))return l(b)&&1==b.length?a.lastIndexOf(b,c):-1;for(;0<=c;c--)if(c in a&&a[c]===b)return c;return-1},na= Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c);}:function(a,b,c){for(var d=a.length,f=l(a)?a.split(""):a,g=0;gb?null:l(a)?a.charAt(b):a[b]}function ra(a){if(!n(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0;}function sa(a,b){b=la(a,b);var c;(c=0<=b)&&Array.prototype.splice.call(a,b,1);return c}function ta(a){return Array.prototype.concat.apply([],arguments)}function ua(a){var b=a.length;if(0b?1:0}var A;a:{var ya=h.navigator;if(ya){var za=ya.userAgent;if(za){A=za;break a}}A="";}function B(a){return-1!=A.indexOf(a)}function Aa(a,b,c){for(var d in a)b.call(c,a[d],d,a);}function Ba(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function Ca(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function Da(a){var b={},c;for(c in a)b[c]=a[c];return b}var Ea="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "); function Fa(a,b){for(var c,d,f=1;fparseFloat(Qa)){Pa=String(Sa);break a}}Pa=Qa;}var Ia={}; function Ta(a){return Ha(a,function(){for(var b=0,c=wa(String(Pa)).split("."),d=wa(String(a)).split("."),f=Math.max(c.length,d.length),g=0;0==b&&g=a.keyCode)a.keyCode=-1;}catch(b){}};var ab="closure_listenable_"+(1E6*Math.random()|0);function F(a){return!(!a||!a[ab])}var bb=0;function cb(a,b,c,d,f){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.Ob=f;this.key=++bb;this.Sa=this.Eb=!1;}cb.prototype.Vb=function(){this.Sa=!0;this.Ob=this.src=this.proxy=this.listener=null;};function db(a){this.src=a;this.J={};this.xb=0;}e=db.prototype;e.add=function(a,b,c,d,f){var g=a.toString();a=this.J[g];a||(a=this.J[g]=[], this.xb++);var k=eb(a,b,d,f);-1c.keyCode||void 0!=c.returnValue)){a:{var f=!1;if(0==c.keyCode)try{c.keyCode=-1;break a}catch(k){f=!0;}if(f||void 0==c.returnValue)c.returnValue=!0;}c=[];for(f=b.currentTarget;f;f=f.parentNode)c.push(f);a=a.type;for(f=c.length-1;!b.Ea&&0<=f;f--){b.currentTarget=c[f];var g=rb(c[f],a,!0,b);d=d&&g;}for(f=0;!b.Ea&&f>>0);function kb(a){if(q(a))return a;a[tb]||(a[tb]=function(b){return a.handleEvent(b)});return a[tb]}function H(){z.call(this);this.ka=new db(this);this.Pe=this;this.Uc=null;}x(H,z);H.prototype[ab]=!0;e=H.prototype;e.addEventListener=function(a,b,c,d){ib(this,a,b,c,d);};e.removeEventListener=function(a,b,c,d){pb(this,a,b,c,d);}; e.dispatchEvent=function(a){var b,c=this.Uc;if(c)for(b=[];c;c=c.Uc)b.push(c);c=this.Pe;var d=a.type||a;if(l(a))a=new D(a,c);else if(a instanceof D)a.target=a.target||c;else{var f=a;a=new D(d,c);Fa(a,f);}f=!0;if(b)for(var g=b.length-1;!a.Ea&&0<=g;g--){var k=a.currentTarget=b[g];f=k.Lb(d,!0,a)&&f;}a.Ea||(k=a.currentTarget=c, f=k.Lb(d,!0,a)&&f, a.Ea||(f=k.Lb(d,!1,a)&&f));if(b)for(g=0;!a.Ea&&g=this.Qd().value};e.log=function(a,b,c){this.Pf(a)&&(q(b)&&(b=b()), this.gf(this.uf(a,b,c)));};e.uf=function(a,b,c){a=new J(a,String(b),this.pe);c&&a.Bg(c);return a};e.ca=function(a,b){this.log(Nb,a,b);};e.T=function(a,b){this.log(Ob,a,b);};e.info=function(a,b){this.log(Pb,a,b);};e.lf=function(a){this.log(Rb,a,void 0);}; e.gf=function(a){for(var b=this;b;)b.We(a), b=b.getParent();};e.We=function(a){if(this.Zd)for(var b=0,c;c=this.Zd[b];b++)c(a);};e.Fg=function(a){this.$b=a;};e.Qe=function(a,b){this.pf()[a]=b;};var Sb={},Tb=null;function Vb(a){Tb||(Tb=new Mb(""), Sb[""]=Tb, Tb.Ge(Qb));var b;if(!(b=Sb[a])){b=new Mb(a);var c=a.lastIndexOf("."),d=a.substr(c+1);c=Vb(a.substr(0,c));c.Qe(d,b);b.Fg(c);Sb[a]=b;}return b}function Wb(a,b){a&&a.info(b,void 0);}function L(a,b){a&&a.lf(b);}function Xb(){this.s=Vb("goog.labs.net.webChannel.WebChannelDebug");this.Wc=!0;}e=Xb.prototype;e.Id=function(){this.Wc=!1;};e.Tg=function(a,b,c,d,f){var g=this;this.info(function(){return"XMLHTTP REQ ("+c+") [attempt "+d+"]: "+a+"\n"+b+"\n"+g.Xf(f)});};e.Ug=function(a,b,c,d,f,g){this.info(function(){return"XMLHTTP RESP ("+c+") [ attempt "+d+"]: "+a+"\n"+b+"\n"+f+" "+g});};e.Wa=function(a,b,c){var d=this;this.info(function(){return"XMLHTTP TEXT ("+a+"): "+d.ng(b)+(c?" "+c:"")});}; e.Sg=function(a){this.info(function(){return"TIMEOUT: "+a});};e.debug=function(a){L(this.s,a);};e.cb=function(a,b){var c=this.s;c&&c.ca(b||"Exception",a);};e.info=function(a){Wb(this.s,a);};e.T=function(a){var b=this.s;b&&b.T(a,void 0);};e.ca=function(a){var b=this.s;b&&b.ca(a,void 0);}; e.ng=function(a){if(!this.Wc)return a;if(!a)return null;try{var b=JSON.parse(a);if(b)for(var c=0;ca.length||(a=a[1], !n(a)||1>a.length))){var b=a[0];if("noop"!=b&&"stop"!=b&&"close"!=b)for(b=1;ba||3==a&&!La&&!this.h.ya())){this.Za||4!=a||7==b||(8==b||0>=c?N(3):N(2));this.Fb();var d=this.h.za();this.w=d;b=this.h.ya();if(!b){var f=this;this.a.debug(function(){return"No response text for uri "+f.pa+" status "+d});}this.S=200==d;this.a.Ug(this.Fa,this.pa,this.R,this.Xc,a,d);if(this.S){if(this.Ig())if(c=this.sf())this.a.Wa(this.R,c,"Initial handshake response via X-HTTP-Initial-Response"), this.lb=!0, this.Yc(c);else{this.S=!1; this.I=3;O(12);this.a.T("XMLHTTP Missing X_HTTP_INITIAL_RESPONSE ("+this.R+")");this.Ia();this.Kb();return}this.yc?(this.Fd(a,b), La&&this.S&&3==a&&this.Ng()):(this.a.Wa(this.R,b,null), this.Yc(b));4==a&&this.Ia();this.S&&!this.Za&&(4==a?this.b.Tc(this):(this.S=!1, this.eb()));}else 400==d&&0a.length)return mc;a=a.substr(c,b);this.Bb=c+b;return a}; e.yg=function(a){this.ic=2;this.ua=a.clone().Ub();a=!1;h.navigator&&h.navigator.sendBeacon&&(a=h.navigator.sendBeacon(this.ua.toString(),""));!a&&h.Image&&((new Image).src=this.ua, a=!0);a||(this.h=this.b.Jb(null), this.h.send(this.ua));this.qb=w();this.eb();};e.cancel=function(){this.Za=!0;this.Ia();};e.tg=function(a){a&&this.setTimeout(a);this.Ga&&(this.Fb(), this.eb());};e.eb=function(){this.hd=w()+this.Ua;this.Ke(this.Ua);}; e.Ke=function(a){if(null!=this.Ga)throw Error("WatchDog timer not null");this.Ga=P(u(this.gg,this),a);};e.Fb=function(){this.Ga&&(h.clearTimeout(this.Ga), this.Ga=null);};e.gg=function(){this.Ga=null;var a=w();0<=a-this.hd?this.Df():(this.a.T("WatchDog timer called too early"), this.Ke(this.hd-a));};e.Df=function(){this.S&&this.a.ca("Received watchdog timeout even though request loaded successfully");this.a.Sg(this.pa);2!=this.ic&&(N(3), O(17));this.Ia();this.I=2;this.Kb();}; e.Kb=function(){this.b.de()||this.Za||this.b.Tc(this);};e.Ia=function(){this.Fb();var a=this.ac;a&&"function"==typeof a.bb&&a.bb();this.ac=null;this.Vc.stop();this.Fc.pb();this.h&&(a=this.h, this.h=null, a.abort(), a.bb());};e.Hc=function(){return this.I};e.Yc=function(a){try{this.b.ue(this,a), N(4);}catch(b){this.a.cb(b,"Error in httprequest callback");}};function nc(a){if(a.H&&"function"==typeof a.H)return a.H();if(l(a))return a.split("");if(ca(a)){for(var b=[],c=a.length,d=0;d2*this.j&&this.wc(), !0):!1};e.wc=function(){if(this.j!=this.o.length){for(var a=0,b=0;aa)throw Error("Bad port number "+a);this.Ca=a;}else this.Ca=null;};e.Ff=function(){return null!=this.Ca};e.ec=function(a,b){this.U();this.K=b?yc(a,!0):a;};e.ae=function(){return!!this.K};e.Gf=function(){return""!==this.P.toString()};e.bd=function(a,b){this.U();a instanceof rc?(this.P=a, this.P.ad(this.O)):(b||(a=sc(a,zc)), this.P=new rc(a,this.O));};e.Rd=function(){return this.P.toString()};e.getQuery=function(){return this.Rd()}; e.l=function(a,b){this.U();this.P.set(a,b);};e.dc=function(a,b){this.U();n(b)||(b=[String(b)]);this.P.Ie(a,b);};e.$c=function(a,b){this.U();this.ib=b?yc(a):a;};e.Ef=function(){return!!this.ib};e.Ub=function(){this.U();this.l("zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^w()).toString(36));return this};e.removeParameter=function(a){this.U();this.P.remove(a);return this};e.U=function(){if(this.Qf)throw Error("Tried to modify a read-only Uri");}; e.ad=function(a){this.O=a;this.P&&this.P.ad(a);};function Ac(a){return a instanceof U?a.clone():new U(a,void 0)}function Bc(a,b,c,d){var f=new U(null,void 0);a&&f.tb(a);b&&f.rb(b);c&&f.sb(c);d&&f.ec(d);return f}function yc(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function sc(a,b,c){return l(a)?(a=encodeURI(a).replace(b,Cc), c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")), a):null} function Cc(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var tc=/[#\/\?@]/g,wc=/[#\?:]/g,uc=/[#\?]/g,zc=/[#\?@]/g,xc=/#/g;function rc(a,b){this.j=this.m=null;this.ja=a||null;this.O=!!b;}e=rc.prototype;e.$=function(){if(!this.m&&(this.m=new S, this.j=0, this.ja)){var a=this;qc(this.ja,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c);});}};e.C=function(){this.$();return this.j}; e.add=function(a,b){this.$();this.Oa();a=this.Ma(a);var c=this.m.get(a);c||this.m.set(a,c=[]);c.push(b);this.j+=1;return this};e.remove=function(a){this.$();a=this.Ma(a);return this.m.va(a)?(this.Oa(), this.j-=this.m.get(a).length, this.m.remove(a)):!1};e.clear=function(){this.Oa();this.m=null;this.j=0;};e.X=function(){this.$();return 0==this.j};e.va=function(a){this.$();a=this.Ma(a);return this.m.va(a)}; e.forEach=function(a,b){this.$();this.m.forEach(function(c,d){na(c,function(c){a.call(b,c,d,this);},this);},this);};e.W=function(){this.$();for(var a=this.m.H(),b=this.m.W(),c=[],d=0;d=this.Xb:!1};e.xf=function(){return this.f?1:this.v?this.v.C():0};e.Jc=function(a){return this.f?this.f==a:this.v?this.v.contains(a):!1};e.oc=function(a){this.v?this.v.add(a):this.f=a;};e.ze=function(a){this.f&&this.f==a?this.f=null:this.v&&this.v.contains(a)&&this.v.remove(a);};e.cancel=function(){this.ba=this.la();this.f?(this.f.cancel(), this.f=null):this.v&&!this.v.X()&&(na(this.v.H(),function(a){a.cancel();}), this.v.clear());}; e.la=function(){if(null!=this.f)return this.ba.concat(this.f.la());if(null!=this.v&&!this.v.X()){var a=this.ba;na(this.v.H(),function(b){a=a.concat(b.la());});return a}return ua(this.ba)};e.Re=function(a){this.ba=this.ba.concat(a);};e.$e=function(){this.ba.length=0;};function Oc(){this.xg=this.rg=void 0;}Oc.prototype.stringify=function(a){return h.JSON.stringify(a,this.rg)};Oc.prototype.parse=function(a){return h.JSON.parse(a,this.xg)};function Pc(){this.jg=new Oc;}Pc.prototype.hf=function(a,b,c){var d=c||"";try{oc(a,function(a,c){var f=a;r(a)&&(f=ub(a));b.push(d+c+"="+encodeURIComponent(f));});}catch(f){throw b.push(d+"type="+encodeURIComponent("_badmap")), f;}};Pc.prototype.jf=function(a,b,c){for(var d=-1;;){var f=["count="+b];-1==d?0c&&(c=a.length);d=a.indexOf("?");if(0>d||d>c){d=c;var f="";}else f=a.substring(d+1,c);a=[a.substr(0,d),f,a.substr(c)];c=a[1];a[1]=b?c?c+"&"+b:b:c;a=a[0]+(a[1]?"?"+a[1]:"")+a[2];}return a}a.l(b,c);return a}function $c(a){this.Bd=22;this.De=0;this.M=[];this.a=new Xb;this.Ib=new Ic;this.na=this.md=this.hb=this.K=this.u=this.Kc=this.aa=this.gb=this.N=this.Rb=this.A=null;this.Te=!0;this.ag=this.Yb=0;this.kf=!!m("internalChannelParams.failFast",a);this.fd=this.Ja=this.wa=this.ia=this.ea=this.i=null;this.Se=!0;this.w=this.he=this.Sb=-1;this.rc=this.Ha=this.La=0;this.Ve=m("internalChannelParams.baseRetryDelayMs",a)||5E3;this.vg=m("internalChannelParams.retryDelaySeedMs",a)||1E4;this.nf=m("internalChannelParams.forwardChannelMaxRetries", a)||2;this.Od=m("internalChannelParams.forwardChannelRequestTimeoutMs",a)||2E4;this.Xa=a&&a.oh||void 0;this.Db=void 0;this.Ra=0;this.gc=a&&a.supportsCrossDomainXhr||!1;this.ra="";this.G=new Mc(a&&a.concurrentRequestLimit);this.kc=new Pc;this.ta=a&&void 0!==a.backgroundChannelTest?a.backgroundChannelTest:!0;(this.Nd=a&&a.fastHandshake||!1)&&!this.ta&&(this.a.T("Force backgroundChannelTest when fastHandshake is enabled."), this.ta=!0);a&&a.Id&&this.a.Id();}e=$c.prototype;e.tc=8;e.g=1; e.connect=function(a,b,c,d,f){this.a.debug("connect()");O(0);this.K=b;this.gb=c||{};d&&void 0!==f&&(this.gb.OSID=d, this.gb.OAID=f);this.ta&&(this.a.debug("connect() bypassed channel-test."), this.Ib.$d=[], this.Ib.od=!1);this.bf(a);};e.disconnect=function(){this.a.debug("disconnect()");this.qd();if(3==this.g){var a=this.Yb++,b=this.hb.clone();b.l("SID",this.ra);b.l("RID",a);b.l("TYPE","terminate");this.Ya(b);(new R(this,this.a,this.ra,a,void 0)).yg(b);}this.qe();}; e.bf=function(a){this.a.debug("connectTest_()");this.Ja=new Hc(this,this.a);null===this.N&&this.Ja.ga(this.A);var b=a;this.N&&this.A&&(b=Zc(a,this.N,this.A));this.Ja.connect(b);};e.af=function(){this.a.debug("connectChannel_()");this.hb=this.Sd(this.K);this.Dc();};e.qd=function(){this.Ja&&(this.Ja.abort(), this.Ja=null);this.u&&(this.u.cancel(), this.u=null);this.ia&&(h.clearTimeout(this.ia), this.ia=null);this.Hb();this.G.cancel();this.ea&&(h.clearTimeout(this.ea), this.ea=null);}; e.ga=function(a){this.A=a;};e.Eg=function(a){this.Rb=a;};e.Cg=function(a){this.N=a;};e.Dg=function(a){this.aa=a;};e.Fe=function(a){this.Kc=a;};e.He=function(a){this.Ra=a;};e.Hg=function(){this.gc=!0;};e.Ee=function(a){this.i=a;};e.Nf=function(){return!this.fd};e.Zc=function(a){1E3==this.M.length&&this.a.ca(function(){return"Already have 1000 queued maps upon queueing "+ub(a)});this.M.push(new Lc(this.ag++,a));3==this.g&&this.Dc();};e.qf=function(){return this.kf?0:this.nf};e.de=function(){return 0==this.g}; e.getState=function(){return this.g};e.Dc=function(){this.G.ee()||this.ea||(this.ea=P(u(this.we,this),0), this.La=0);};e.Yf=function(a){if(this.G.xf()>=this.G.Xb-(this.ea?1:0))return this.a.ca("Unexpected retry request is scheduled."), !1;if(this.ea)return this.a.debug("Use the retry request that is already scheduled."), this.M=a.la().concat(this.M), !0;if(1==this.g||2==this.g||this.La>=this.qf())return!1;this.a.debug("Going to retry POST");this.ea=P(u(this.we,this,a),this.Xd(this.La));this.La++;return!0}; e.we=function(a){this.ea=null;this.Mg(a);};e.Mg=function(a){this.a.debug("startForwardChannel_");1==this.g?a?this.a.ca("Not supposed to retry the open"):(this.ig(), this.g=2):3==this.g&&(a?this.le(a):0==this.M.length?this.a.debug("startForwardChannel_ returned: nothing to send"):this.G.ee()?this.a.ca("startForwardChannel_ returned: connection already in progress"):(this.le(), this.a.debug("startForwardChannel_ finished, sent request")));}; e.ig=function(){this.a.debug("open_()");this.Yb=Math.floor(1E5*Math.random());var a=this.Yb++,b=new R(this,this.a,"",a,void 0),c=this.A;this.Rb&&(c?(c=Da(c), Fa(c,this.Rb)):c=this.Rb);null===this.N&&b.ga(c);var d=this.Hd(b),f=this.hb.clone();f.l("RID",a);0a&&!this.Nf()&&0==this.Ha};e.$a=function(a){return this.Te?this.i?this.i.$a(a):a:null}; e.bg=function(){null!=this.wa&&(this.wa=null, this.u.cancel(), this.u=null, this.Qc(), O(19));};e.Hb=function(){null!=this.wa&&(h.clearTimeout(this.wa), this.wa=null);}; e.Tc=function(a){this.a.debug("Request complete");var b=null;if(this.u==a){this.Hb();this.u=null;var c=2;}else if(this.G.Jc(a))b=a.la(), this.G.ze(a), c=1;else return;this.w=a.w;if(0!=this.g)if(a.S)1==c?(ac(a.Da?a.Da.length:0,w()-a.qb,this.La), this.Dc()):this.Kd();else{var d=a.Hc();if(3==d||0==d&&0this.Wb)throw Error(id);this.fa=new gd;this.oa=new Jc;this.Ac=0;this.Nc=null;this.Cb();}x(hd,z);var id="[goog.structs.Pool] Min can not be greater than max";e=hd.prototype;e.Mb=function(){var a=w();if(!(null!=this.Nc&&a-this.Ncthis.Wb&&0=this.C()){for(var c=this.Y,d=0;d=b))return 1==b?ra(a):(a[0]=a.pop(), this.Zf()), c.gd}; e.Zf=function(){for(var a=0,b=this.Y,c=b.length,d=b[a];a>1;){var f=this.tf(a),g=this.zf(a);f=gd.getKey())break;b[a]=b[f];a=f;}b[a]=d;};e.$f=function(a){for(var b=this.Y,c=b[a];0c.getKey())b[a]=b[d], a=d;else break}b[a]=c;};e.tf=function(a){return 2*a+1};e.zf=function(a){return 2*a+2};e.wf=function(a){return a-1>>1};e.H=function(){for(var a=this.Y,b=[],c=a.length,d=0;d', // italic '4': '', // underscore '8': 'display:none', // hidden '9': '' // delete } var _closeTags = { '23': '', // reset italic '24': '', // reset underscore '29': '' // reset delete } ;[0, 21, 22, 27, 28, 39, 49].forEach(function (n) { _closeTags[n] = '' }) /** * Converts text with ANSI color codes to HTML markup. * @param {String} text * @returns {*} */ function ansiHTML (text) { // Returns the text if the string has no ANSI escape code. if (!_regANSI.test(text)) { return text } // Cache opened sequence. var ansiCodes = [] // Replace with markup. var ret = text.replace(/\033\[(\d+)*m/g, function (match, seq) { var ot = _openTags[seq] if (ot) { // If current sequence has been opened, close it. if (!!~ansiCodes.indexOf(seq)) { // eslint-disable-line no-extra-boolean-cast ansiCodes.pop() return '' } // Open tag. ansiCodes.push(seq) return ot[0] === '<' ? ot : '' } var ct = _closeTags[seq] if (ct) { // Pop sequence ansiCodes.pop() return ct } return '' }) // Make sure tags are closed. var l = ansiCodes.length ;(l > 0) && (ret += Array(l + 1).join('')) return ret } /** * Customize colors. * @param {Object} colors reference to _defColors */ ansiHTML.setColors = function (colors) { if (typeof colors !== 'object') { throw new Error('`colors` parameter must be an Object.') } var _finalColors = {} for (var key in _defColors) { var hex = colors.hasOwnProperty(key) ? colors[key] : null if (!hex) { _finalColors[key] = _defColors[key] continue } if ('reset' === key) { if (typeof hex === 'string') { hex = [hex] } if (!Array.isArray(hex) || hex.length === 0 || hex.some(function (h) { return typeof h !== 'string' })) { throw new Error('The value of `' + key + '` property must be an Array and each item could only be a hex string, e.g.: FF0000') } var defHexColor = _defColors[key] if (!hex[0]) { hex[0] = defHexColor[0] } if (hex.length === 1 || !hex[1]) { hex = [hex[0]] hex.push(defHexColor[1]) } hex = hex.slice(0, 2) } else if (typeof hex !== 'string') { throw new Error('The value of `' + key + '` property must be a hex string, e.g.: FF0000') } _finalColors[key] = hex } _setTags(_finalColors) } /** * Reset colors. */ ansiHTML.reset = function () { _setTags(_defColors) } /** * Expose tags, including open and close. * @type {Object} */ ansiHTML.tags = {} if (Object.defineProperty) { Object.defineProperty(ansiHTML.tags, 'open', { get: function () { return _openTags } }) Object.defineProperty(ansiHTML.tags, 'close', { get: function () { return _closeTags } }) } else { ansiHTML.tags.open = _openTags ansiHTML.tags.close = _closeTags } function _setTags (colors) { // reset all _openTags['0'] = 'font-weight:normal;opacity:1;color:#' + colors.reset[0] + ';background:#' + colors.reset[1] // inverse _openTags['7'] = 'color:#' + colors.reset[1] + ';background:#' + colors.reset[0] // dark grey _openTags['90'] = 'color:#' + colors.darkgrey for (var code in _styles) { var color = _styles[code] var oriColor = colors[color] || '000' _openTags[code] = 'color:#' + oriColor code = parseInt(code) _openTags[(code + 10).toString()] = 'background:#' + oriColor } } ansiHTML.reset() /***/ }), /***/ "../../node_modules/ansi-regex/index.js": /*!*************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/ansi-regex/index.js ***! \*************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function () { return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; }; /***/ }), /***/ "../../node_modules/ant-design-palettes/lib/generate.js": /*!*****************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/ant-design-palettes/lib/generate.js ***! \*****************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = generate; var _tinycolor = __webpack_require__(/*! tinycolor2 */ "../../node_modules/tinycolor2/tinycolor.js"); var _tinycolor2 = _interopRequireDefault(_tinycolor); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var hueStep = 2; // 色相阶梯 var saturationStep = 16; // 饱和度阶梯,浅色部分 var saturationStep2 = 5; // 饱和度阶梯,深色部分 var brightnessStep1 = 5; // 亮度阶梯,浅色部分 var brightnessStep2 = 15; // 亮度阶梯,深色部分 var lightColorCount = 5; // 浅色数量,主色上 var darkColorCount = 4; // 深色数量,主色下 function getHue(hsv, i, light) { var hue = void 0; // 根据色相不同,色相转向不同 if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) { hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i; } else { hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i; } if (hue < 0) { hue += 360; } else if (hue >= 360) { hue -= 360; } return hue; } function getSaturation(hsv, i, light) { // grey color don't change saturation if (hsv.h === 0 && hsv.s === 0) { return hsv.s; } var saturation = void 0; if (light) { saturation = Math.round(hsv.s * 100) - saturationStep * i; } else if (i === darkColorCount) { saturation = Math.round(hsv.s * 100) + saturationStep; } else { saturation = Math.round(hsv.s * 100) + saturationStep2 * i; } // 边界值修正 if (saturation > 100) { saturation = 100; } // 第一格的 s 限制在 6-10 之间 if (light && i === lightColorCount && saturation > 10) { saturation = 10; } if (saturation < 6) { saturation = 6; } return saturation; } function getValue(hsv, i, light) { if (light) { return Math.round(hsv.v * 100) + brightnessStep1 * i; } return Math.round(hsv.v * 100) - brightnessStep2 * i; } function generate(color) { var patterns = []; var pColor = (0, _tinycolor2.default)(color); for (var i = lightColorCount; i > 0; i -= 1) { var hsv = pColor.toHsv(); var colorString = (0, _tinycolor2.default)({ h: getHue(hsv, i, true), s: getSaturation(hsv, i, true), v: getValue(hsv, i, true) }).toHexString(); patterns.push(colorString); } patterns.push(pColor.toHexString()); for (var _i = 1; _i <= darkColorCount; _i += 1) { var _hsv = pColor.toHsv(); var _colorString = (0, _tinycolor2.default)({ h: getHue(_hsv, _i), s: getSaturation(_hsv, _i), v: getValue(_hsv, _i) }).toHexString(); patterns.push(_colorString); } return patterns; } /***/ }), /***/ "../../node_modules/ant-design-palettes/lib/index.js": /*!**************************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/ant-design-palettes/lib/index.js ***! \**************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.presetPrimaryColors = exports.presetPalettes = exports.generate = undefined; var _generate = __webpack_require__(/*! ./generate */ "../../node_modules/ant-design-palettes/lib/generate.js"); var _generate2 = _interopRequireDefault(_generate); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var presetPrimaryColors = { red: '#F5222D', volcano: '#FA541C', orange: '#FA8C16', gold: '#FAAD14', yellow: '#FADB14', lime: '#A0D911', green: '#52C41A', cyan: '#13C2C2', blue: '#1890FF', geekblue: '#2F54EB', purple: '#722ED1', magenta: '#EB2F96', grey: '#666666' }; var presetPalettes = {}; Object.keys(presetPrimaryColors).forEach(function (key) { presetPalettes[key] = (0, _generate2.default)(presetPrimaryColors[key]); }); exports.generate = _generate2.default; exports.presetPalettes = presetPalettes; exports.presetPrimaryColors = presetPrimaryColors; /***/ }), /***/ "../../node_modules/antd/dist/antd.min.css": /*!****************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/antd/dist/antd.min.css ***! \****************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(/*! !../../css-loader!../../sass-loader/lib/loader.js!./antd.min.css */ "../../node_modules/css-loader/index.js!../../node_modules/sass-loader/lib/loader.js!../../node_modules/antd/dist/antd.min.css"); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(/*! ../../style-loader/lib/addStyles.js */ "../../node_modules/style-loader/lib/addStyles.js")(content, options); if(content.locals) module.exports = content.locals; if(true) { module.hot.accept(/*! !../../css-loader!../../sass-loader/lib/loader.js!./antd.min.css */ "../../node_modules/css-loader/index.js!../../node_modules/sass-loader/lib/loader.js!../../node_modules/antd/dist/antd.min.css", function() { var newContent = __webpack_require__(/*! !../../css-loader!../../sass-loader/lib/loader.js!./antd.min.css */ "../../node_modules/css-loader/index.js!../../node_modules/sass-loader/lib/loader.js!../../node_modules/antd/dist/antd.min.css"); if(typeof newContent === 'string') newContent = [[module.i, newContent, '']]; var locals = (function(a, b) { var key, idx = 0; for(key in a) { if(!b || a[key] !== b[key]) return false; idx++; } for(key in b) idx--; return idx === 0; }(content.locals, newContent.locals)); if(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.'); update(newContent); }); module.hot.dispose(function() { update(); }); } /***/ }), /***/ "../../node_modules/antd/dist/antd.min.js": /*!***************************************************************************************************************!*\ !*** C:/Users/User/Desktop/Project/new-frontend-customer-redemption-point/node_modules/antd/dist/antd.min.js ***! \***************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(console) {/*! * * antd v3.11.0 * * Copyright 2015-present, Alipay, Inc. * All rights reserved. * */ !function(e,t){ true?module.exports=t(__webpack_require__(/*! react */ "../../node_modules/react/index.js"),__webpack_require__(/*! react-dom */ "../../node_modules/react-dom/index.js"),__webpack_require__(/*! moment */ "../../node_modules/moment/moment.js")):undefined}("undefined"!=typeof self?self:this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=566)}([function(t,n){t.exports=e},function(e,t,n){"use strict";t.__esModule=!0;var r=n(238),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default||function(e){for(var t=1;t>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?d(e)+t:t}function m(){return!0}function y(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function g(e,t){return C(e,t,0)}function b(e,t){return C(e,t,t)}function C(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}function w(e){this.next=e}function S(e,t,n,r){var o=0===e?t:1===e?n:[t,n];return r?r.value=o:r={value:o,done:!1},r}function x(){return{value:void 0,done:!0}}function M(e){return!!_(e)}function k(e){return e&&"function"==typeof e.next}function z(e){var t=_(e);return t&&t.call(e)}function _(e){var t=e&&(Sn&&e[Sn]||e[xn]);if("function"==typeof t)return t}function O(e){return e&&"number"==typeof e.length}function E(e){return null===e||void 0===e?I():i(e)?e.toSeq():F(e)}function T(e){return null===e||void 0===e?I().toKeyedSeq():i(e)?a(e)?e.toSeq():e.fromEntrySeq():R(e)}function N(e){return null===e||void 0===e?I():i(e)?a(e)?e.entrySeq():e.toIndexedSeq():j(e)}function V(e){return(null===e||void 0===e?I():i(e)?a(e)?e.entrySeq():e:j(e)).toSetSeq()}function P(e){this._array=e,this.size=e.length}function H(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function L(e){this._iterable=e,this.size=e.length||e.size}function D(e){this._iterator=e,this._iteratorCache=[]}function A(e){return!(!e||!e[kn])}function I(){return zn||(zn=new P([]))}function R(e){var t=Array.isArray(e)?new P(e).fromEntrySeq():k(e)?new D(e).fromEntrySeq():M(e)?new L(e).fromEntrySeq():"object"==typeof e?new H(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function j(e){var t=K(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function F(e){var t=K(e)||"object"==typeof e&&new H(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function K(e){return O(e)?new P(e):k(e)?new D(e):M(e)?new L(e):void 0}function B(e,t,n,r){var o=e._cache;if(o){for(var i=o.length-1,a=0;a<=i;a++){var c=o[n?i-a:a];if(!1===t(c[1],r?c[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function W(e,t,n,r){var o=e._cache;if(o){var i=o.length-1,a=0;return new w(function(){var e=o[n?i-a:a];return a++>i?x():S(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function U(e,t){return t?q(t,e,"",{"":e}):Y(e)}function q(e,t,n,r){return Array.isArray(t)?e.call(r,n,N(t).map(function(n,r){return q(e,n,r,t)})):G(t)?e.call(r,n,T(t).map(function(n,r){return q(e,n,r,t)})):t}function Y(e){return Array.isArray(e)?N(e).map(Y).toList():G(e)?T(e).map(Y).toMap():e}function G(e){return e&&(e.constructor===Object||void 0===e.constructor)}function X(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function $(e,t){if(e===t)return!0;if(!i(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||c(e)!==c(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!s(e);if(l(e)){var r=e.entries();return t.every(function(e,t){var o=r.next().value;return o&&X(o[1],e)&&(n||X(o[0],t))})&&r.next().done}var o=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{o=!0;var u=e;e=t,t=u}var p=!0,f=t.__iterate(function(t,r){if(n?!e.has(t):o?!X(t,e.get(r,mn)):!X(e.get(r,mn),t))return p=!1,!1});return p&&e.size===f}function J(e,t){if(!(this instanceof J))return new J(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(_n)return _n;_n=this}}function Z(e,t){if(!e)throw new Error(t)}function Q(e,t,n){if(!(this instanceof Q))return new Q(e,t,n);if(Z(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),t>>1&1073741824|3221225471&e}function ie(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return oe(n)}if("string"===t)return e.length>Dn?ae(e):ce(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return se(e);if("function"==typeof e.toString)return ce(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ae(e){var t=Rn[e];return void 0===t&&(t=ce(e),In===An&&(In=0,Rn={}),In++,Rn[e]=t),t}function ce(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function ue(e){Z(e!==1/0,"Cannot perform this action with an infinite size.")}function pe(e){return null===e||void 0===e?Se():fe(e)&&!l(e)?e:Se().withMutations(function(t){var r=n(e);ue(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function fe(e){return!(!e||!e[jn])}function he(e,t){this.ownerID=e,this.entries=t}function de(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function ve(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function me(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function ye(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function ge(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&Ce(e._root)}function be(e,t){return S(e,t[0],t[1])}function Ce(e,t){return{node:e,index:0,__prev:t}}function we(e,t,n,r){var o=Object.create(Fn);return o.size=e,o._root=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function Se(){return Kn||(Kn=we(0))}function xe(e,t,n){var r,o;if(e._root){var i=u(yn),a=u(gn);if(r=Me(e._root,e.__ownerID,0,void 0,t,n,i,a),!a.value)return e;o=e.size+(i.value?n===mn?-1:1:0)}else{if(n===mn)return e;o=1,r=new he(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=o,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?we(o,r):Se()}function Me(e,t,n,r,o,i,a,c){return e?e.update(t,n,r,o,i,a,c):i===mn?e:(p(c),p(a),new ye(t,r,[o,i]))}function ke(e){return e.constructor===ye||e.constructor===me}function ze(e,t,n,r,o){if(e.keyHash===r)return new me(t,r,[e.entry,o]);var i,a=(0===n?e.keyHash:e.keyHash>>>n)&vn,c=(0===n?r:r>>>n)&vn;return new de(t,1<>>=1)a[c]=1&n?t[i++]:void 0;return a[r]=o,new ve(e,i+1,a)}function Te(e,t,r){for(var o=[],a=0;a>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function De(e,t,n,r){var o=r?e:h(e);return o[t]=n,o}function Ae(e,t,n,r){var o=e.length+1;if(r&&t+1===o)return e[t]=n,e;for(var i=new Array(o),a=0,c=0;c0&&oi?0:i-n,l=a-n;return l>dn&&(l=dn),function(){if(o===l)return Xn;var e=t?--l:o++;return r&&r[e]}}function o(e,r,o){var c,s=e&&e.array,l=o>i?0:i-o>>r,u=1+(a-o>>r);return u>dn&&(u=dn),function(){for(;;){if(c){var e=c();if(e!==Xn)return e;c=null}if(l===u)return Xn;var i=t?--u:l++;c=n(s&&s[i],r-hn,o+(i<=e.size||t<0)return e.withMutations(function(e){t<0?Xe(e,t).set(0,n):Xe(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,o=e._root,i=u(gn);return t>=Je(e._capacity)?r=qe(r,e.__ownerID,0,t,n,i):o=qe(o,e.__ownerID,e._level,t,n,i),i.value?e.__ownerID?(e._root=o,e._tail=r,e.__hash=void 0,e.__altered=!0,e):Be(e._origin,e._capacity,e._level,o,r):e}function qe(e,t,n,r,o,i){var a=r>>>n&vn,c=e&&a0){var l=e&&e.array[a],u=qe(l,t,n-hn,r,o,i);return u===l?e:(s=Ye(e,t),s.array[a]=u,s)}return c&&e.array[a]===o?e:(p(i),s=Ye(e,t),void 0===o&&a===s.array.length-1?s.array.pop():s.array[a]=o,s)}function Ye(e,t){return t&&e&&t===e.ownerID?e:new Fe(e?e.array.slice():[],t)}function Ge(e,t){if(t>=Je(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&vn],r-=hn;return n}}function Xe(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new f,o=e._origin,i=e._capacity,a=o+t,c=void 0===n?i:n<0?i+n:o+n;if(a===o&&c===i)return e;if(a>=c)return e.clear();for(var s=e._level,l=e._root,u=0;a+u<0;)l=new Fe(l&&l.array.length?[void 0,l]:[],r),s+=hn,u+=1<=1<p?new Fe([],r):d;if(d&&h>p&&ahn;y-=hn){var g=p>>>y&vn;m=m.array[g]=Ye(m.array[g],r)}m.array[p>>>hn&vn]=d}if(c=h)a-=h,c-=h,s=hn,l=null,v=v&&v.removeBefore(r,0,a);else if(a>o||h>>s&vn;if(b!==h>>>s&vn)break;b&&(u+=(1<o&&(l=l.removeBefore(r,s,a-u)),l&&ha&&(a=l.size),i(s)||(l=l.map(function(e){return U(e)})),o.push(l)}return a>e.size&&(e=e.setSize(a)),Pe(e,t,o)}function Je(e){return e>>hn<=dn&&a.size>=2*i.size?(o=a.filter(function(e,t){return void 0!==e&&c!==t}),r=o.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=o.__ownerID=e.__ownerID)):(r=i.remove(t),o=c===a.size-1?a.pop():a.set(c,void 0))}else if(s){if(n===a.get(c)[1])return e;r=i,o=a.set(c,[t,n])}else r=i.set(t,a.size),o=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=o,e.__hash=void 0,e):et(r,o)}function rt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function ot(e){this._iter=e,this.size=e.size}function it(e){this._iter=e,this.size=e.size}function at(e){this._iter=e,this.size=e.size}function ct(e){var t=Ot(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Et,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===wn){var r=e.__iterator(t,n);return new w(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===Cn?bn:Cn,n)},t}function st(e,t,n){var r=Ot(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,o){var i=e.get(r,mn);return i===mn?o:t.call(n,i,r,e)},r.__iterateUncached=function(r,o){var i=this;return e.__iterate(function(e,o,a){return!1!==r(t.call(n,e,o,a),o,i)},o)},r.__iteratorUncached=function(r,o){var i=e.__iterator(wn,o);return new w(function(){var o=i.next();if(o.done)return o;var a=o.value,c=a[0];return S(r,c,t.call(n,a[1],c,e),o)})},r}function lt(e,t){var n=Ot(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=ct(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Et,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function ut(e,t,n,r){var o=Ot(e);return r&&(o.has=function(r){var o=e.get(r,mn);return o!==mn&&!!t.call(n,o,r,e)},o.get=function(r,o){var i=e.get(r,mn);return i!==mn&&t.call(n,i,r,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,c=0;return e.__iterate(function(e,i,s){if(t.call(n,e,i,s))return c++,o(e,r?i:c-1,a)},i),c},o.__iteratorUncached=function(o,i){var a=e.__iterator(wn,i),c=0;return new w(function(){for(;;){var i=a.next();if(i.done)return i;var s=i.value,l=s[0],u=s[1];if(t.call(n,u,l,e))return S(o,r?l:c++,u,i)}})},o}function pt(e,t,n){var r=pe().asMutable();return e.__iterate(function(o,i){r.update(t.call(n,o,i,e),0,function(e){return e+1})}),r.asImmutable()}function ft(e,t,n){var r=a(e),o=(l(e)?Ze():pe()).asMutable();e.__iterate(function(i,a){o.update(t.call(n,i,a,e),function(e){return e=e||[],e.push(r?[a,i]:i),e})});var i=_t(e);return o.map(function(t){return Mt(e,i(t))})}function ht(e,t,n,r){var o=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n|=0),y(t,n,o))return e;var i=g(t,o),a=b(n,o);if(i!==i||a!==a)return ht(e.toSeq().cacheResult(),t,n,r);var c,s=a-i;s===s&&(c=s<0?0:s);var l=Ot(e);return l.size=0===c?c:e.size&&c||void 0,!r&&A(e)&&c>=0&&(l.get=function(t,n){return t=v(this,t),t>=0&&tc)return x();var e=o.next();return r||t===Cn?e:t===bn?S(t,s-1,void 0,e):S(t,s-1,e.value[1],e)})},l}function dt(e,t,n){var r=Ot(e);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return e.__iterate(function(e,o,c){return t.call(n,e,o,c)&&++a&&r(e,o,i)}),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=e.__iterator(wn,o),c=!0;return new w(function(){if(!c)return x();var e=a.next();if(e.done)return e;var o=e.value,s=o[0],l=o[1];return t.call(n,l,s,i)?r===wn?e:S(r,s,l,e):(c=!1,x())})},r}function vt(e,t,n,r){var o=Ot(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var c=!0,s=0;return e.__iterate(function(e,i,l){if(!c||!(c=t.call(n,e,i,l)))return s++,o(e,r?i:s-1,a)}),s},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var c=e.__iterator(wn,i),s=!0,l=0;return new w(function(){var e,i,u;do{if(e=c.next(),e.done)return r||o===Cn?e:o===bn?S(o,l++,void 0,e):S(o,l++,e.value[1],e);var p=e.value;i=p[0],u=p[1],s&&(s=t.call(n,u,i,a))}while(s);return o===wn?e:S(o,i,u,e)})},o}function mt(e,t){var r=a(e),o=[e].concat(t).map(function(e){return i(e)?r&&(e=n(e)):e=r?R(e):j(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===o.length)return e;if(1===o.length){var s=o[0];if(s===e||r&&a(s)||c(e)&&c(s))return s}var l=new P(o);return r?l=l.toKeyedSeq():c(e)||(l=l.toSetSeq()),l=l.flatten(!0),l.size=o.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),l}function yt(e,t,n){var r=Ot(e);return r.__iterateUncached=function(r,o){function a(e,l){var u=this;e.__iterate(function(e,o){return(!t||l0}function xt(e,n,r){var o=Ot(e);return o.size=new P(r).map(function(e){return e.size}).min(),o.__iterate=function(e,t){for(var n,r=this.__iterator(Cn,t),o=0;!(n=r.next()).done&&!1!==e(n.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map(function(e){return e=t(e),z(o?e.reverse():e)}),a=0,c=!1;return new w(function(){var t;return c||(t=i.map(function(e){return e.next()}),c=t.some(function(e){return e.done})),c?x():S(e,a++,n.apply(null,t.map(function(e){return e.value})))})},o}function Mt(e,t){return A(e)?t:e.constructor(t)}function kt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function zt(e){return ue(e.size),d(e)}function _t(e){return a(e)?n:c(e)?r:o}function Ot(e){return Object.create((a(e)?T:c(e)?N:V).prototype)}function Et(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):E.prototype.cacheResult.call(this)}function Tt(e,t){return e>t?1:et?-1:0}function on(e){if(e.size===1/0)return 0;var t=l(e),n=a(e),r=t?1:0;return an(e.__iterate(n?t?function(e,t){r=31*r+cn(ie(e),ie(t))|0}:function(e,t){r=r+cn(ie(e),ie(t))|0}:t?function(e){r=31*r+ie(e)|0}:function(e){r=r+ie(e)|0}),r)}function an(e,t){return t=Tn(t,3432918353),t=Tn(t<<15|t>>>-15,461845907),t=Tn(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=Tn(t^t>>>16,2246822507),t=Tn(t^t>>>13,3266489909),t=oe(t^t>>>16)}function cn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var sn=Array.prototype.slice;e(n,t),e(r,t),e(o,t),t.isIterable=i,t.isKeyed=a,t.isIndexed=c,t.isAssociative=s,t.isOrdered=l,t.Keyed=n,t.Indexed=r,t.Set=o;var ln="@@__IMMUTABLE_ITERABLE__@@",un="@@__IMMUTABLE_KEYED__@@",pn="@@__IMMUTABLE_INDEXED__@@",fn="@@__IMMUTABLE_ORDERED__@@",hn=5,dn=1<r?x():S(e,o,n[t?r-o++:o++])})},e(H,T),H.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},H.prototype.has=function(e){return this._object.hasOwnProperty(e)},H.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,o=r.length-1,i=0;i<=o;i++){var a=r[t?o-i:i];if(!1===e(n[a],a,this))return i+1}return i},H.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,o=r.length-1,i=0;return new w(function(){var a=r[t?o-i:i];return i++>o?x():S(e,a,n[a])})},H.prototype[fn]=!0,e(L,N),L.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=z(n),o=0;if(k(r))for(var i;!(i=r.next()).done&&!1!==e(i.value,o++,this););return o},L.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=z(n);if(!k(r))return new w(x);var o=0;return new w(function(){var t=r.next();return t.done?t:S(e,o++,t.value)})},e(D,N),D.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,o=0;o=r.length){var t=n.next();if(t.done)return t;r[o]=t.value}return S(e,o,r[o++])})};var zn;e(J,N),J.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},J.prototype.get=function(e,t){return this.has(e)?this._value:t},J.prototype.includes=function(e){return X(this._value,e)},J.prototype.slice=function(e,t){var n=this.size;return y(e,t,n)?this:new J(this._value,b(t,n)-g(e,n))},J.prototype.reverse=function(){return this},J.prototype.indexOf=function(e){return X(this._value,e)?0:-1},J.prototype.lastIndexOf=function(e){return X(this._value,e)?this.size:-1},J.prototype.__iterate=function(e,t){for(var n=0;n1?" by "+this._step:"")+" ]"},Q.prototype.get=function(e,t){return this.has(e)?this._start+v(this,e)*this._step:t},Q.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t=0&&nn?x():S(e,i++,a)})},Q.prototype.equals=function(e){return e instanceof Q?this._start===e._start&&this._end===e._end&&this._step===e._step:$(this,e)};var On;e(ee,t),e(te,ee),e(ne,ee),e(re,ee),ee.Keyed=te,ee.Indexed=ne,ee.Set=re;var En,Tn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e|=0,t|=0;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Nn=Object.isExtensible,Vn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),Pn="function"==typeof WeakMap;Pn&&(En=new WeakMap);var Hn=0,Ln="__immutablehash__";"function"==typeof Symbol&&(Ln=Symbol(Ln));var Dn=16,An=255,In=0,Rn={};e(pe,te),pe.prototype.toString=function(){return this.__toString("Map {","}")},pe.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},pe.prototype.set=function(e,t){return xe(this,e,t)},pe.prototype.setIn=function(e,t){return this.updateIn(e,mn,function(){return t})},pe.prototype.remove=function(e){return xe(this,e,mn)},pe.prototype.deleteIn=function(e){return this.updateIn(e,function(){return mn})},pe.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},pe.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=He(this,Nt(e),t,n);return r===mn?void 0:r},pe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Se()},pe.prototype.merge=function(){return Te(this,void 0,arguments)},pe.prototype.mergeWith=function(e){return Te(this,e,sn.call(arguments,1))},pe.prototype.mergeIn=function(e){var t=sn.call(arguments,1);return this.updateIn(e,Se(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},pe.prototype.mergeDeep=function(){return Te(this,Ne,arguments)},pe.prototype.mergeDeepWith=function(e){var t=sn.call(arguments,1);return Te(this,Ve(e),t)},pe.prototype.mergeDeepIn=function(e){var t=sn.call(arguments,1);return this.updateIn(e,Se(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},pe.prototype.sort=function(e){return Ze(Ct(this,e))},pe.prototype.sortBy=function(e,t){return Ze(Ct(this,t,e))},pe.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},pe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new f)},pe.prototype.asImmutable=function(){return this.__ensureOwner()},pe.prototype.wasAltered=function(){return this.__altered},pe.prototype.__iterator=function(e,t){return new ge(this,e,t)},pe.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},pe.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?we(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},pe.isMap=fe;var jn="@@__IMMUTABLE_MAP__@@",Fn=pe.prototype;Fn[jn]=!0,Fn.delete=Fn.remove,Fn.removeIn=Fn.deleteIn,he.prototype.get=function(e,t,n,r){for(var o=this.entries,i=0,a=o.length;i=Bn)return _e(e,s,r,o);var d=e&&e===this.ownerID,v=d?s:h(s);return f?c?l===u-1?v.pop():v[l]=v.pop():v[l]=[r,o]:v.push([r,o]),d?(this.entries=v,this):new he(e,v)}},de.prototype.get=function(e,t,n,r){void 0===t&&(t=ie(n));var o=1<<((0===e?t:t>>>e)&vn),i=this.bitmap;return 0==(i&o)?r:this.nodes[Le(i&o-1)].get(e+hn,t,n,r)},de.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ie(r));var c=(0===t?n:n>>>t)&vn,s=1<=Wn)return Ee(e,f,l,c,d);if(u&&!d&&2===f.length&&ke(f[1^p]))return f[1^p];if(u&&d&&1===f.length&&ke(d))return d;var v=e&&e===this.ownerID,m=u?d?l:l^s:l|s,y=u?d?De(f,p,d,v):Ie(f,p,v):Ae(f,p,d,v);return v?(this.bitmap=m,this.nodes=y,this):new de(e,m,y)},ve.prototype.get=function(e,t,n,r){void 0===t&&(t=ie(n));var o=(0===e?t:t>>>e)&vn,i=this.nodes[o];return i?i.get(e+hn,t,n,r):r},ve.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ie(r));var c=(0===t?n:n>>>t)&vn,s=o===mn,l=this.nodes,u=l[c];if(s&&!u)return this;var p=Me(u,e,t+hn,n,r,o,i,a);if(p===u)return this;var f=this.count;if(u){if(!p&&--f=0&&e>>t&vn;if(r>=this.array.length)return new Fe([],e);var o,i=0===r;if(t>0){var a=this.array[r];if((o=a&&a.removeBefore(e,t-hn,n))===a&&i)return this}if(i&&!o)return this;var c=Ye(this,e);if(!i)for(var s=0;s>>t&vn;if(r>=this.array.length)return this;var o;if(t>0){var i=this.array[r];if((o=i&&i.removeAfter(e,t-hn,n))===i&&r===this.array.length-1)return this}var a=Ye(this,e);return a.array.splice(r+1),o&&(a.array[r]=o),a};var Gn,Xn={};e(Ze,pe),Ze.of=function(){return this(arguments)},Ze.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ze.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},Ze.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):tt()},Ze.prototype.set=function(e,t){return nt(this,e,t)},Ze.prototype.remove=function(e){return nt(this,e,mn)},Ze.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ze.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},Ze.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},Ze.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?et(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},Ze.isOrderedMap=Qe,Ze.prototype[fn]=!0,Ze.prototype.delete=Ze.prototype.remove;var $n;e(rt,T),rt.prototype.get=function(e,t){return this._iter.get(e,t)},rt.prototype.has=function(e){return this._iter.has(e)},rt.prototype.valueSeq=function(){return this._iter.valueSeq()},rt.prototype.reverse=function(){var e=this,t=lt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},rt.prototype.map=function(e,t){var n=this,r=st(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},rt.prototype.__iterate=function(e,t){var n,r=this;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?zt(this):0,function(o){return e(o,t?--n:n++,r)}),t)},rt.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(Cn,t),r=t?zt(this):0;return new w(function(){var o=n.next();return o.done?o:S(e,t?--r:r++,o.value,o)})},rt.prototype[fn]=!0,e(ot,N),ot.prototype.includes=function(e){return this._iter.includes(e)},ot.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},ot.prototype.__iterator=function(e,t){var n=this._iter.__iterator(Cn,t),r=0;return new w(function(){var t=n.next();return t.done?t:S(e,r++,t.value,t)})},e(it,V),it.prototype.has=function(e){return this._iter.includes(e)},it.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},it.prototype.__iterator=function(e,t){var n=this._iter.__iterator(Cn,t);return new w(function(){var t=n.next();return t.done?t:S(e,t.value,t.value,t)})},e(at,T),at.prototype.entrySeq=function(){return this._iter.toSeq()},at.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){kt(t);var r=i(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},at.prototype.__iterator=function(e,t){var n=this._iter.__iterator(Cn,t);return new w(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){kt(r);var o=i(r);return S(e,o?r.get(0):r[0],o?r.get(1):r[1],t)}}})},ot.prototype.cacheResult=rt.prototype.cacheResult=it.prototype.cacheResult=at.prototype.cacheResult=Et,e(Vt,te),Vt.prototype.toString=function(){return this.__toString(Ht(this)+" {","}")},Vt.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Vt.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},Vt.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=Pt(this,Se()))},Vt.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Ht(this));var n=this._map&&this._map.set(e,t);return this.__ownerID||n===this._map?this:Pt(this,n)},Vt.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:Pt(this,t)},Vt.prototype.wasAltered=function(){return this._map.wasAltered()},Vt.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)},Vt.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterate(e,t)},Vt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?Pt(this,t,e):(this.__ownerID=e,this._map=t,this)};var Jn=Vt.prototype;Jn.delete=Jn.remove,Jn.deleteIn=Jn.removeIn=Fn.removeIn,Jn.merge=Fn.merge,Jn.mergeWith=Fn.mergeWith,Jn.mergeIn=Fn.mergeIn,Jn.mergeDeep=Fn.mergeDeep,Jn.mergeDeepWith=Fn.mergeDeepWith,Jn.mergeDeepIn=Fn.mergeDeepIn,Jn.setIn=Fn.setIn,Jn.update=Fn.update,Jn.updateIn=Fn.updateIn,Jn.withMutations=Fn.withMutations,Jn.asMutable=Fn.asMutable,Jn.asImmutable=Fn.asImmutable,e(At,re),At.of=function(){return this(arguments)},At.fromKeys=function(e){return this(n(e).keySeq())},At.prototype.toString=function(){return this.__toString("Set {","}")},At.prototype.has=function(e){return this._map.has(e)},At.prototype.add=function(e){return Rt(this,this._map.set(e,!0))},At.prototype.remove=function(e){return Rt(this,this._map.remove(e))},At.prototype.clear=function(){return Rt(this,this._map.clear())},At.prototype.union=function(){var e=sn.call(arguments,0);return e=e.filter(function(e){return 0!==e.size}),0===e.length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(t){for(var n=0;n=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Gt(e,t)},qt.prototype.pushAll=function(e){if(e=r(e),0===e.size)return this;ue(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Gt(t,n)},qt.prototype.pop=function(){return this.slice(1)},qt.prototype.unshift=function(){return this.push.apply(this,arguments)},qt.prototype.unshiftAll=function(e){return this.pushAll(e)},qt.prototype.shift=function(){return this.pop.apply(this,arguments)},qt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Xt()},qt.prototype.slice=function(e,t){if(y(e,t,this.size))return this;var n=g(e,this.size);if(b(t,this.size)!==this.size)return ne.prototype.slice.call(this,e,t);for(var r=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=r,this._head=o,this.__hash=void 0,this.__altered=!0,this):Gt(r,o)},qt.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Gt(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},qt.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},qt.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new w(function(){if(r){var t=r.value;return r=r.next,S(e,n++,t)}return x()})},qt.isStack=Yt;var rr="@@__IMMUTABLE_STACK__@@",or=qt.prototype;or[rr]=!0,or.withMutations=Fn.withMutations,or.asMutable=Fn.asMutable,or.asImmutable=Fn.asImmutable,or.wasAltered=Fn.wasAltered;var ir;t.Iterator=w,$t(t,{toArray:function(){ue(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new ot(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new rt(this,!0)},toMap:function(){return pe(this.toKeyedSeq())},toObject:function(){ue(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Ze(this.toKeyedSeq())},toOrderedSet:function(){return Kt(a(this)?this.valueSeq():this)},toSet:function(){return At(a(this)?this.valueSeq():this)},toSetSeq:function(){return new it(this)},toSeq:function(){return c(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return qt(a(this)?this.valueSeq():this)},toList:function(){return Re(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return Mt(this,mt(this,sn.call(arguments,0)))},includes:function(e){return this.some(function(t){return X(t,e)})},entries:function(){return this.__iterator(wn)},every:function(e,t){ue(this.size);var n=!0;return this.__iterate(function(r,o,i){if(!e.call(t,r,o,i))return n=!1,!1}),n},filter:function(e,t){return Mt(this,ut(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},findEntry:function(e,t){var n;return this.__iterate(function(r,o,i){if(e.call(t,r,o,i))return n=[o,r],!1}),n},findLastEntry:function(e,t){return this.toSeq().reverse().findEntry(e,t)},forEach:function(e,t){return ue(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){ue(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(bn)},map:function(e,t){return Mt(this,st(this,e,t))},reduce:function(e,t,n){ue(this.size);var r,o;return arguments.length<2?o=!0:r=t,this.__iterate(function(t,i,a){o?(o=!1,r=t):r=e.call(n,r,t,i,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Mt(this,lt(this,!0))},slice:function(e,t){return Mt(this,ht(this,e,t,!0))},some:function(e,t){return!this.every(Qt(e),t)},sort:function(e){return Mt(this,Ct(this,e))},values:function(){return this.__iterator(Cn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return d(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return pt(this,e,t)},equals:function(e){return $(this,e)},entrySeq:function(){var e=this;if(e._cache)return new P(e._cache);var t=e.toSeq().map(Zt).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Qt(e),t)},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},first:function(){return this.find(m)},flatMap:function(e,t){return Mt(this,gt(this,e,t))},flatten:function(e){return Mt(this,yt(this,e,!0))},fromEntrySeq:function(){return new at(this)},get:function(e,t){return this.find(function(t,n){return X(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,o=Nt(e);!(n=o.next()).done;){var i=n.value;if((r=r&&r.get?r.get(i,mn):mn)===mn)return t}return r},groupBy:function(e,t){return ft(this,e,t)},has:function(e){return this.get(e,mn)!==mn},hasIn:function(e){return this.getIn(e,mn)!==mn},isSubset:function(e){return e="function"==typeof e.includes?e:t(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e="function"==typeof e.isSubset?e:t(e),e.isSubset(this)},keySeq:function(){return this.toSeq().map(Jt).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(e){return wt(this,e)},maxBy:function(e,t){return wt(this,t,e)},min:function(e){return wt(this,e?en(e):rn)},minBy:function(e,t){return wt(this,t?en(t):rn,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Mt(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Mt(this,vt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Qt(e),t)},sortBy:function(e,t){return Mt(this,Ct(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Mt(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Mt(this,dt(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Qt(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var ar=t.prototype;ar[ln]=!0,ar[Mn]=ar.values,ar.__toJS=ar.toArray,ar.__toStringMapper=tn,ar.inspect=ar.toSource=function(){return this.toString()},ar.chain=ar.flatMap,ar.contains=ar.includes,function(){try{Object.defineProperty(ar,"length",{get:function(){if(!t.noLengthWarning){var e;try{throw new Error}catch(t){e=t.stack}if(-1===e.indexOf("_wrapObject"))return console&&console.warn&&console.warn("iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. "+e),this.size}}})}catch(e){}}(),$t(n,{flip:function(){return Mt(this,ct(this))},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLastKey:function(e,t){return this.toSeq().reverse().findKey(e,t)},keyOf:function(e){return this.findKey(function(t){return X(t,e)})},lastKeyOf:function(e){return this.findLastKey(function(t){return X(t,e)})},mapEntries:function(e,t){var n=this,r=0;return Mt(this,this.toSeq().map(function(o,i){return e.call(t,[i,o],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Mt(this,this.toSeq().flip().map(function(r,o){return e.call(t,r,o,n)}).flip())}});var cr=n.prototype;return cr[un]=!0,cr[Mn]=ar.entries,cr.__toJS=ar.toObject,cr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+tn(e)},$t(r,{toKeyedSeq:function(){return new rt(this,!1)},filter:function(e,t){return Mt(this,ut(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.toKeyedSeq().keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.toKeyedSeq().reverse().keyOf(e);return void 0===t?-1:t},reverse:function(){return Mt(this,lt(this,!1))},slice:function(e,t){return Mt(this,ht(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=g(e,e<0?this.count():this.size);var r=this.slice(0,e);return Mt(this,1===n?r:r.concat(h(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.toKeyedSeq().findLastKey(e,t);return void 0===n?-1:n},first:function(){return this.get(0)},flatten:function(e){return Mt(this,yt(this,e,!1))},get:function(e,t){return e=v(this,e),e<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=v(this,e))>=0&&(void 0!==this.size?this.size===1/0||e=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,n){return M.set(e,{selection:t,forceSelection:n,nativelyRenderedContent:null,inlineStyleOverride:null})}function i(e,t){return e.getBlockMap().map(function(n){return d.generate(e,n,t)}).toOrderedMap()}function a(e,t,n,r){var o=e.getCurrentContent().set("entityMap",n),i=o.getBlockMap();return e.getImmutable().get("treeMap").merge(t.toSeq().filter(function(e,t){return e!==i.get(t)}).map(function(e){return d.generate(o,e,r)}))}function c(e,t,n,r,o){return n.merge(t.toSeq().filter(function(t){return r.getDecorations(t,e)!==o.getDecorations(t,e)}).map(function(t){return d.generate(e,t,r)}))}function s(e,t){return t!==e.getLastChangeType()||"insert-characters"!==t&&"backspace-character"!==t&&"delete-character"!==t}function l(e,t){var n=t.getStartKey(),r=t.getStartOffset(),o=e.getBlockForKey(n);return r>0?o.getInlineStyleAt(r-1):o.getLength()?o.getInlineStyleAt(0):p(e,n)}function u(e,t){var n=t.getStartKey(),r=t.getStartOffset(),o=e.getBlockForKey(n);return r0?o.getInlineStyleAt(r-1):p(e,n)}function p(e,t){var n=e.getBlockMap().reverse().skipUntil(function(e,n){return n===t}).skip(1).skipUntil(function(e,t){return e.getLength()}).first();return n?n.getInlineStyleAt(n.getLength()-1):b()}var f=n(20),h=f||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:v;return r(this,t),o(this,e.call(this,g(n)))}return i(t,e),t.prototype.getKey=function(){return this.get("key")},t.prototype.getType=function(){return this.get("type")},t.prototype.getText=function(){return this.get("text")},t.prototype.getCharacterList=function(){return this.get("characterList")},t.prototype.getLength=function(){return this.getText().length},t.prototype.getDepth=function(){return this.get("depth")},t.prototype.getData=function(){return this.get("data")},t.prototype.getInlineStyleAt=function(e){var t=this.getCharacterList().get(e);return t?t.getStyle():d},t.prototype.getEntityAt=function(e){var t=this.getCharacterList().get(e);return t?t.getEntity():null},t.prototype.getChildKeys=function(){return this.get("children")},t.prototype.getParentKey=function(){return this.get("parent")},t.prototype.getPrevSiblingKey=function(){return this.get("prevSibling")},t.prototype.getNextSiblingKey=function(){return this.get("nextSibling")},t.prototype.findStyleRanges=function(e,t){s(this.getCharacterList(),m,e,t)},t.prototype.findEntityRanges=function(e,t){s(this.getCharacterList(),y,e,t)},t}(f(v));e.exports=b},function(e,t,n){var r=n(99)("wks"),o=n(72),i=n(38).Symbol,a="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:o)("Symbol."+e))}).store=r},function(e,t,n){(function(t){for(var r=n(281),o="undefined"==typeof window?t:window,i=["moz","webkit"],a="AnimationFrame",c=o["request"+a],s=o["cancel"+a]||o["cancelRequest"+a],l=0;!c&&lr||n<=0)return"";var o=0;if(t>0){for(;t>0&&o=r)return""}else if(t<0){for(o=r;t<0&&00&&c=a},t.prototype.isCollapsed=function(){return this.getAnchorKey()===this.getFocusKey()&&this.getAnchorOffset()===this.getFocusOffset()},t.prototype.getStartKey=function(){return this.getIsBackward()?this.getFocusKey():this.getAnchorKey()},t.prototype.getStartOffset=function(){return this.getIsBackward()?this.getFocusOffset():this.getAnchorOffset()},t.prototype.getEndKey=function(){return this.getIsBackward()?this.getAnchorKey():this.getFocusKey()},t.prototype.getEndOffset=function(){return this.getIsBackward()?this.getAnchorOffset():this.getFocusOffset()},t.createEmpty=function(e){return new t({anchorKey:e,anchorOffset:0,focusKey:e,focusOffset:0,isBackward:!1,hasFocus:!1})},t}(l);e.exports=u},function(e,t,n){"use strict";function r(e){return"object"==typeof e?Object.keys(e).filter(function(t){return e[t]}).map(o).join(" "):Array.prototype.map.call(arguments,o).join(" ")}function o(e){return e.replace(/\//g,"-")}e.exports=r},function(e,t,n){!function(t,n){e.exports=n()}(0,function(){"use strict";function e(e,t){t&&(e.prototype=Object.create(t.prototype)),e.prototype.constructor=e}function t(e){return i(e)?e:E(e)}function n(e){return a(e)?e:T(e)}function r(e){return c(e)?e:N(e)}function o(e){return i(e)&&!s(e)?e:V(e)}function i(e){return!(!e||!e[ln])}function a(e){return!(!e||!e[un])}function c(e){return!(!e||!e[pn])}function s(e){return a(e)||c(e)}function l(e){return!(!e||!e[fn])}function u(e){return e.value=!1,e}function p(e){e&&(e.value=!0)}function f(){}function h(e,t){t=t||0;for(var n=Math.max(0,e.length-t),r=new Array(n),o=0;o>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?d(e)+t:t}function m(){return!0}function y(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function g(e,t){return C(e,t,0)}function b(e,t){return C(e,t,t)}function C(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}function w(e){this.next=e}function S(e,t,n,r){var o=0===e?t:1===e?n:[t,n];return r?r.value=o:r={value:o,done:!1},r}function x(){return{value:void 0,done:!0}}function M(e){return!!_(e)}function k(e){return e&&"function"==typeof e.next}function z(e){var t=_(e);return t&&t.call(e)}function _(e){var t=e&&(Sn&&e[Sn]||e[xn]);if("function"==typeof t)return t}function O(e){return e&&"number"==typeof e.length}function E(e){return null===e||void 0===e?I():i(e)?e.toSeq():F(e)}function T(e){return null===e||void 0===e?I().toKeyedSeq():i(e)?a(e)?e.toSeq():e.fromEntrySeq():R(e)}function N(e){return null===e||void 0===e?I():i(e)?a(e)?e.entrySeq():e.toIndexedSeq():j(e)}function V(e){return(null===e||void 0===e?I():i(e)?a(e)?e.entrySeq():e:j(e)).toSetSeq()}function P(e){this._array=e,this.size=e.length}function H(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function L(e){this._iterable=e,this.size=e.length||e.size}function D(e){this._iterator=e,this._iteratorCache=[]}function A(e){return!(!e||!e[kn])}function I(){return zn||(zn=new P([]))}function R(e){var t=Array.isArray(e)?new P(e).fromEntrySeq():k(e)?new D(e).fromEntrySeq():M(e)?new L(e).fromEntrySeq():"object"==typeof e?new H(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function j(e){var t=K(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function F(e){var t=K(e)||"object"==typeof e&&new H(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function K(e){return O(e)?new P(e):k(e)?new D(e):M(e)?new L(e):void 0}function B(e,t,n,r){var o=e._cache;if(o){for(var i=o.length-1,a=0;a<=i;a++){var c=o[n?i-a:a];if(!1===t(c[1],r?c[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function W(e,t,n,r){var o=e._cache;if(o){var i=o.length-1,a=0;return new w(function(){var e=o[n?i-a:a];return a++>i?x():S(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function U(e,t){return t?q(t,e,"",{"":e}):Y(e)}function q(e,t,n,r){return Array.isArray(t)?e.call(r,n,N(t).map(function(n,r){return q(e,n,r,t)})):G(t)?e.call(r,n,T(t).map(function(n,r){return q(e,n,r,t)})):t}function Y(e){return Array.isArray(e)?N(e).map(Y).toList():G(e)?T(e).map(Y).toMap():e}function G(e){return e&&(e.constructor===Object||void 0===e.constructor)}function X(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function $(e,t){if(e===t)return!0;if(!i(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||c(e)!==c(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!s(e);if(l(e)){var r=e.entries();return t.every(function(e,t){var o=r.next().value;return o&&X(o[1],e)&&(n||X(o[0],t))})&&r.next().done}var o=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{o=!0;var u=e;e=t,t=u}var p=!0,f=t.__iterate(function(t,r){if(n?!e.has(t):o?!X(t,e.get(r,mn)):!X(e.get(r,mn),t))return p=!1,!1});return p&&e.size===f}function J(e,t){if(!(this instanceof J))return new J(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(_n)return _n;_n=this}}function Z(e,t){if(!e)throw new Error(t)}function Q(e,t,n){if(!(this instanceof Q))return new Q(e,t,n);if(Z(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),t>>1&1073741824|3221225471&e}function ie(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!==e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return oe(n)}if("string"===t)return e.length>Dn?ae(e):ce(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return se(e);if("function"==typeof e.toString)return ce(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ae(e){var t=Rn[e];return void 0===t&&(t=ce(e),In===An&&(In=0,Rn={}),In++,Rn[e]=t),t}function ce(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function ue(e){Z(e!==1/0,"Cannot perform this action with an infinite size.")}function pe(e){return null===e||void 0===e?Se():fe(e)&&!l(e)?e:Se().withMutations(function(t){var r=n(e);ue(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function fe(e){return!(!e||!e[jn])}function he(e,t){this.ownerID=e,this.entries=t}function de(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function ve(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function me(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function ye(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function ge(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&Ce(e._root)}function be(e,t){return S(e,t[0],t[1])}function Ce(e,t){return{node:e,index:0,__prev:t}}function we(e,t,n,r){var o=Object.create(Fn);return o.size=e,o._root=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function Se(){return Kn||(Kn=we(0))}function xe(e,t,n){var r,o;if(e._root){var i=u(yn),a=u(gn);if(r=Me(e._root,e.__ownerID,0,void 0,t,n,i,a),!a.value)return e;o=e.size+(i.value?n===mn?-1:1:0)}else{if(n===mn)return e;o=1,r=new he(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=o,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?we(o,r):Se()}function Me(e,t,n,r,o,i,a,c){return e?e.update(t,n,r,o,i,a,c):i===mn?e:(p(c),p(a),new ye(t,r,[o,i]))}function ke(e){return e.constructor===ye||e.constructor===me}function ze(e,t,n,r,o){if(e.keyHash===r)return new me(t,r,[e.entry,o]);var i,a=(0===n?e.keyHash:e.keyHash>>>n)&vn,c=(0===n?r:r>>>n)&vn;return new de(t,1<>>=1)a[c]=1&n?t[i++]:void 0;return a[r]=o,new ve(e,i+1,a)}function Te(e,t,r){for(var o=[],a=0;a>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function De(e,t,n,r){var o=r?e:h(e);return o[t]=n,o}function Ae(e,t,n,r){var o=e.length+1;if(r&&t+1===o)return e[t]=n,e;for(var i=new Array(o),a=0,c=0;c0&&oi?0:i-n,l=a-n;return l>dn&&(l=dn),function(){if(o===l)return Xn;var e=t?--l:o++;return r&&r[e]}}function o(e,r,o){var c,s=e&&e.array,l=o>i?0:i-o>>r,u=1+(a-o>>r);return u>dn&&(u=dn),function(){for(;;){if(c){var e=c();if(e!==Xn)return e;c=null}if(l===u)return Xn;var i=t?--u:l++;c=n(s&&s[i],r-hn,o+(i<=e.size||t<0)return e.withMutations(function(e){t<0?Xe(e,t).set(0,n):Xe(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,o=e._root,i=u(gn);return t>=Je(e._capacity)?r=qe(r,e.__ownerID,0,t,n,i):o=qe(o,e.__ownerID,e._level,t,n,i),i.value?e.__ownerID?(e._root=o,e._tail=r,e.__hash=void 0,e.__altered=!0,e):Be(e._origin,e._capacity,e._level,o,r):e}function qe(e,t,n,r,o,i){var a=r>>>n&vn,c=e&&a0){var l=e&&e.array[a],u=qe(l,t,n-hn,r,o,i);return u===l?e:(s=Ye(e,t),s.array[a]=u,s)}return c&&e.array[a]===o?e:(p(i),s=Ye(e,t),void 0===o&&a===s.array.length-1?s.array.pop():s.array[a]=o,s)}function Ye(e,t){return t&&e&&t===e.ownerID?e:new Fe(e?e.array.slice():[],t)}function Ge(e,t){if(t>=Je(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&vn],r-=hn;return n}}function Xe(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new f,o=e._origin,i=e._capacity,a=o+t,c=void 0===n?i:n<0?i+n:o+n;if(a===o&&c===i)return e;if(a>=c)return e.clear();for(var s=e._level,l=e._root,u=0;a+u<0;)l=new Fe(l&&l.array.length?[void 0,l]:[],r),s+=hn,u+=1<=1<p?new Fe([],r):d;if(d&&h>p&&ahn;y-=hn){var g=p>>>y&vn;m=m.array[g]=Ye(m.array[g],r)}m.array[p>>>hn&vn]=d}if(c=h)a-=h,c-=h,s=hn,l=null,v=v&&v.removeBefore(r,0,a);else if(a>o||h>>s&vn;if(b!==h>>>s&vn)break;b&&(u+=(1<o&&(l=l.removeBefore(r,s,a-u)),l&&ha&&(a=l.size),i(s)||(l=l.map(function(e){return U(e)})),o.push(l)}return a>e.size&&(e=e.setSize(a)),Pe(e,t,o)}function Je(e){return e>>hn<=dn&&a.size>=2*i.size?(o=a.filter(function(e,t){return void 0!==e&&c!==t}),r=o.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=o.__ownerID=e.__ownerID)):(r=i.remove(t),o=c===a.size-1?a.pop():a.set(c,void 0))}else if(s){if(n===a.get(c)[1])return e;r=i,o=a.set(c,[t,n])}else r=i.set(t,a.size),o=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=o,e.__hash=void 0,e):et(r,o)}function rt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function ot(e){this._iter=e,this.size=e.size}function it(e){this._iter=e,this.size=e.size}function at(e){this._iter=e,this.size=e.size}function ct(e){var t=Ot(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Et,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===wn){var r=e.__iterator(t,n);return new w(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===Cn?bn:Cn,n)},t}function st(e,t,n){var r=Ot(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,o){var i=e.get(r,mn);return i===mn?o:t.call(n,i,r,e)},r.__iterateUncached=function(r,o){var i=this;return e.__iterate(function(e,o,a){return!1!==r(t.call(n,e,o,a),o,i)},o)},r.__iteratorUncached=function(r,o){var i=e.__iterator(wn,o);return new w(function(){var o=i.next();if(o.done)return o;var a=o.value,c=a[0];return S(r,c,t.call(n,a[1],c,e),o)})},r}function lt(e,t){var n=Ot(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=ct(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Et,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function ut(e,t,n,r){var o=Ot(e);return r&&(o.has=function(r){var o=e.get(r,mn);return o!==mn&&!!t.call(n,o,r,e)},o.get=function(r,o){var i=e.get(r,mn);return i!==mn&&t.call(n,i,r,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,c=0;return e.__iterate(function(e,i,s){if(t.call(n,e,i,s))return c++,o(e,r?i:c-1,a)},i),c},o.__iteratorUncached=function(o,i){var a=e.__iterator(wn,i),c=0;return new w(function(){for(;;){var i=a.next();if(i.done)return i;var s=i.value,l=s[0],u=s[1];if(t.call(n,u,l,e))return S(o,r?l:c++,u,i)}})},o}function pt(e,t,n){var r=pe().asMutable();return e.__iterate(function(o,i){r.update(t.call(n,o,i,e),0,function(e){return e+1})}),r.asImmutable()}function ft(e,t,n){var r=a(e),o=(l(e)?Ze():pe()).asMutable();e.__iterate(function(i,a){o.update(t.call(n,i,a,e),function(e){return e=e||[],e.push(r?[a,i]:i),e})});var i=_t(e);return o.map(function(t){return Mt(e,i(t))})}function ht(e,t,n,r){var o=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=o:n|=0),y(t,n,o))return e;var i=g(t,o),a=b(n,o);if(i!==i||a!==a)return ht(e.toSeq().cacheResult(),t,n,r);var c,s=a-i;s===s&&(c=s<0?0:s);var l=Ot(e);return l.size=0===c?c:e.size&&c||void 0,!r&&A(e)&&c>=0&&(l.get=function(t,n){return t=v(this,t),t>=0&&tc)return x();var e=o.next();return r||t===Cn?e:t===bn?S(t,s-1,void 0,e):S(t,s-1,e.value[1],e)})},l}function dt(e,t,n){var r=Ot(e);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return e.__iterate(function(e,o,c){return t.call(n,e,o,c)&&++a&&r(e,o,i)}),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=e.__iterator(wn,o),c=!0;return new w(function(){if(!c)return x();var e=a.next();if(e.done)return e;var o=e.value,s=o[0],l=o[1];return t.call(n,l,s,i)?r===wn?e:S(r,s,l,e):(c=!1,x())})},r}function vt(e,t,n,r){var o=Ot(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var c=!0,s=0;return e.__iterate(function(e,i,l){if(!c||!(c=t.call(n,e,i,l)))return s++,o(e,r?i:s-1,a)}),s},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var c=e.__iterator(wn,i),s=!0,l=0;return new w(function(){var e,i,u;do{if(e=c.next(),e.done)return r||o===Cn?e:o===bn?S(o,l++,void 0,e):S(o,l++,e.value[1],e);var p=e.value;i=p[0],u=p[1],s&&(s=t.call(n,u,i,a))}while(s);return o===wn?e:S(o,i,u,e)})},o}function mt(e,t){var r=a(e),o=[e].concat(t).map(function(e){return i(e)?r&&(e=n(e)):e=r?R(e):j(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===o.length)return e;if(1===o.length){var s=o[0];if(s===e||r&&a(s)||c(e)&&c(s))return s}var l=new P(o);return r?l=l.toKeyedSeq():c(e)||(l=l.toSetSeq()),l=l.flatten(!0),l.size=o.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),l}function yt(e,t,n){var r=Ot(e);return r.__iterateUncached=function(r,o){function a(e,l){var u=this;e.__iterate(function(e,o){return(!t||l0}function xt(e,n,r){var o=Ot(e);return o.size=new P(r).map(function(e){return e.size}).min(),o.__iterate=function(e,t){for(var n,r=this.__iterator(Cn,t),o=0;!(n=r.next()).done&&!1!==e(n.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map(function(e){return e=t(e),z(o?e.reverse():e)}),a=0,c=!1;return new w(function(){var t;return c||(t=i.map(function(e){return e.next()}),c=t.some(function(e){return e.done})),c?x():S(e,a++,n.apply(null,t.map(function(e){return e.value})))})},o}function Mt(e,t){return A(e)?t:e.constructor(t)}function kt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function zt(e){return ue(e.size),d(e)}function _t(e){return a(e)?n:c(e)?r:o}function Ot(e){return Object.create((a(e)?T:c(e)?N:V).prototype)}function Et(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):E.prototype.cacheResult.call(this)}function Tt(e,t){return e>t?1:et?-1:0}function on(e){if(e.size===1/0)return 0;var t=l(e),n=a(e),r=t?1:0;return an(e.__iterate(n?t?function(e,t){r=31*r+cn(ie(e),ie(t))|0}:function(e,t){r=r+cn(ie(e),ie(t))|0}:t?function(e){r=31*r+ie(e)|0}:function(e){r=r+ie(e)|0}),r)}function an(e,t){return t=Tn(t,3432918353),t=Tn(t<<15|t>>>-15,461845907),t=Tn(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=Tn(t^t>>>16,2246822507),t=Tn(t^t>>>13,3266489909),t=oe(t^t>>>16)}function cn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var sn=Array.prototype.slice;e(n,t),e(r,t),e(o,t),t.isIterable=i,t.isKeyed=a,t.isIndexed=c,t.isAssociative=s,t.isOrdered=l,t.Keyed=n,t.Indexed=r,t.Set=o;var ln="@@__IMMUTABLE_ITERABLE__@@",un="@@__IMMUTABLE_KEYED__@@",pn="@@__IMMUTABLE_INDEXED__@@",fn="@@__IMMUTABLE_ORDERED__@@",hn=5,dn=1<r?x():S(e,o,n[t?r-o++:o++])})},e(H,T),H.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},H.prototype.has=function(e){return this._object.hasOwnProperty(e)},H.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,o=r.length-1,i=0;i<=o;i++){var a=r[t?o-i:i];if(!1===e(n[a],a,this))return i+1}return i},H.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,o=r.length-1,i=0;return new w(function(){var a=r[t?o-i:i];return i++>o?x():S(e,a,n[a])})},H.prototype[fn]=!0,e(L,N),L.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=z(n),o=0;if(k(r))for(var i;!(i=r.next()).done&&!1!==e(i.value,o++,this););return o},L.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=z(n);if(!k(r))return new w(x);var o=0;return new w(function(){var t=r.next();return t.done?t:S(e,o++,t.value)})},e(D,N),D.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,o=0;o=r.length){var t=n.next();if(t.done)return t;r[o]=t.value}return S(e,o,r[o++])})};var zn;e(J,N),J.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},J.prototype.get=function(e,t){return this.has(e)?this._value:t},J.prototype.includes=function(e){return X(this._value,e)},J.prototype.slice=function(e,t){var n=this.size;return y(e,t,n)?this:new J(this._value,b(t,n)-g(e,n))},J.prototype.reverse=function(){return this},J.prototype.indexOf=function(e){return X(this._value,e)?0:-1},J.prototype.lastIndexOf=function(e){return X(this._value,e)?this.size:-1},J.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?x():S(e,i++,a)})},Q.prototype.equals=function(e){return e instanceof Q?this._start===e._start&&this._end===e._end&&this._step===e._step:$(this,e)};var On;e(ee,t),e(te,ee),e(ne,ee),e(re,ee),ee.Keyed=te,ee.Indexed=ne,ee.Set=re;var En,Tn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e|=0,t|=0;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Nn=Object.isExtensible,Vn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),Pn="function"==typeof WeakMap;Pn&&(En=new WeakMap);var Hn=0,Ln="__immutablehash__";"function"==typeof Symbol&&(Ln=Symbol(Ln));var Dn=16,An=255,In=0,Rn={};e(pe,te),pe.of=function(){var e=sn.call(arguments,0);return Se().withMutations(function(t){for(var n=0;n=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}})},pe.prototype.toString=function(){return this.__toString("Map {","}")},pe.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},pe.prototype.set=function(e,t){return xe(this,e,t)},pe.prototype.setIn=function(e,t){return this.updateIn(e,mn,function(){return t})},pe.prototype.remove=function(e){return xe(this,e,mn)},pe.prototype.deleteIn=function(e){return this.updateIn(e,function(){return mn})},pe.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},pe.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=He(this,Nt(e),t,n);return r===mn?void 0:r},pe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Se()},pe.prototype.merge=function(){return Te(this,void 0,arguments)},pe.prototype.mergeWith=function(e){return Te(this,e,sn.call(arguments,1))},pe.prototype.mergeIn=function(e){var t=sn.call(arguments,1);return this.updateIn(e,Se(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},pe.prototype.mergeDeep=function(){return Te(this,Ne,arguments)},pe.prototype.mergeDeepWith=function(e){var t=sn.call(arguments,1);return Te(this,Ve(e),t)},pe.prototype.mergeDeepIn=function(e){var t=sn.call(arguments,1);return this.updateIn(e,Se(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},pe.prototype.sort=function(e){return Ze(Ct(this,e))},pe.prototype.sortBy=function(e,t){return Ze(Ct(this,t,e))},pe.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},pe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new f)},pe.prototype.asImmutable=function(){return this.__ensureOwner()},pe.prototype.wasAltered=function(){return this.__altered},pe.prototype.__iterator=function(e,t){return new ge(this,e,t)},pe.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},pe.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?we(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},pe.isMap=fe;var jn="@@__IMMUTABLE_MAP__@@",Fn=pe.prototype;Fn[jn]=!0,Fn.delete=Fn.remove,Fn.removeIn=Fn.deleteIn,he.prototype.get=function(e,t,n,r){for(var o=this.entries,i=0,a=o.length;i=Bn)return _e(e,s,r,o);var d=e&&e===this.ownerID,v=d?s:h(s);return f?c?l===u-1?v.pop():v[l]=v.pop():v[l]=[r,o]:v.push([r,o]),d?(this.entries=v,this):new he(e,v)}},de.prototype.get=function(e,t,n,r){void 0===t&&(t=ie(n));var o=1<<((0===e?t:t>>>e)&vn),i=this.bitmap;return 0==(i&o)?r:this.nodes[Le(i&o-1)].get(e+hn,t,n,r)},de.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ie(r));var c=(0===t?n:n>>>t)&vn,s=1<=Wn)return Ee(e,f,l,c,d);if(u&&!d&&2===f.length&&ke(f[1^p]))return f[1^p];if(u&&d&&1===f.length&&ke(d))return d;var v=e&&e===this.ownerID,m=u?d?l:l^s:l|s,y=u?d?De(f,p,d,v):Ie(f,p,v):Ae(f,p,d,v);return v?(this.bitmap=m,this.nodes=y,this):new de(e,m,y)},ve.prototype.get=function(e,t,n,r){void 0===t&&(t=ie(n));var o=(0===e?t:t>>>e)&vn,i=this.nodes[o];return i?i.get(e+hn,t,n,r):r},ve.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ie(r));var c=(0===t?n:n>>>t)&vn,s=o===mn,l=this.nodes,u=l[c];if(s&&!u)return this;var p=Me(u,e,t+hn,n,r,o,i,a);if(p===u)return this;var f=this.count;if(u){if(!p&&--f=0&&e>>t&vn;if(r>=this.array.length)return new Fe([],e);var o,i=0===r;if(t>0){var a=this.array[r];if((o=a&&a.removeBefore(e,t-hn,n))===a&&i)return this}if(i&&!o)return this;var c=Ye(this,e);if(!i)for(var s=0;s>>t&vn;if(r>=this.array.length)return this;var o;if(t>0){var i=this.array[r];if((o=i&&i.removeAfter(e,t-hn,n))===i&&r===this.array.length-1)return this}var a=Ye(this,e);return a.array.splice(r+1),o&&(a.array[r]=o),a};var Gn,Xn={};e(Ze,pe),Ze.of=function(){return this(arguments)},Ze.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ze.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},Ze.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):tt()},Ze.prototype.set=function(e,t){return nt(this,e,t)},Ze.prototype.remove=function(e){return nt(this,e,mn)},Ze.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ze.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},Ze.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},Ze.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?et(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},Ze.isOrderedMap=Qe,Ze.prototype[fn]=!0,Ze.prototype.delete=Ze.prototype.remove;var $n;e(rt,T),rt.prototype.get=function(e,t){return this._iter.get(e,t)},rt.prototype.has=function(e){return this._iter.has(e)},rt.prototype.valueSeq=function(){return this._iter.valueSeq()},rt.prototype.reverse=function(){var e=this,t=lt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},rt.prototype.map=function(e,t){var n=this,r=st(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},rt.prototype.__iterate=function(e,t){var n,r=this;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?zt(this):0,function(o){return e(o,t?--n:n++,r)}),t)},rt.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(Cn,t),r=t?zt(this):0;return new w(function(){var o=n.next();return o.done?o:S(e,t?--r:r++,o.value,o)})},rt.prototype[fn]=!0,e(ot,N),ot.prototype.includes=function(e){return this._iter.includes(e)},ot.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},ot.prototype.__iterator=function(e,t){var n=this._iter.__iterator(Cn,t),r=0;return new w(function(){var t=n.next();return t.done?t:S(e,r++,t.value,t)})},e(it,V),it.prototype.has=function(e){return this._iter.includes(e)},it.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},it.prototype.__iterator=function(e,t){var n=this._iter.__iterator(Cn,t);return new w(function(){var t=n.next();return t.done?t:S(e,t.value,t.value,t)})},e(at,T),at.prototype.entrySeq=function(){return this._iter.toSeq()},at.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){kt(t);var r=i(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},at.prototype.__iterator=function(e,t){var n=this._iter.__iterator(Cn,t);return new w(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){kt(r);var o=i(r);return S(e,o?r.get(0):r[0],o?r.get(1):r[1],t)}}})},ot.prototype.cacheResult=rt.prototype.cacheResult=it.prototype.cacheResult=at.prototype.cacheResult=Et,e(Vt,te),Vt.prototype.toString=function(){return this.__toString(Ht(this)+" {","}")},Vt.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Vt.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},Vt.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=Pt(this,Se()))},Vt.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Ht(this));if(this._map&&!this._map.has(e)){if(t===this._defaultValues[e])return this}var n=this._map&&this._map.set(e,t);return this.__ownerID||n===this._map?this:Pt(this,n)},Vt.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:Pt(this,t)},Vt.prototype.wasAltered=function(){return this._map.wasAltered()},Vt.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)},Vt.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterate(e,t)},Vt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?Pt(this,t,e):(this.__ownerID=e,this._map=t,this)};var Jn=Vt.prototype;Jn.delete=Jn.remove,Jn.deleteIn=Jn.removeIn=Fn.removeIn,Jn.merge=Fn.merge,Jn.mergeWith=Fn.mergeWith,Jn.mergeIn=Fn.mergeIn,Jn.mergeDeep=Fn.mergeDeep,Jn.mergeDeepWith=Fn.mergeDeepWith,Jn.mergeDeepIn=Fn.mergeDeepIn,Jn.setIn=Fn.setIn,Jn.update=Fn.update,Jn.updateIn=Fn.updateIn,Jn.withMutations=Fn.withMutations,Jn.asMutable=Fn.asMutable,Jn.asImmutable=Fn.asImmutable,e(At,re),At.of=function(){return this(arguments)},At.fromKeys=function(e){return this(n(e).keySeq())},At.prototype.toString=function(){return this.__toString("Set {","}")},At.prototype.has=function(e){return this._map.has(e)},At.prototype.add=function(e){return Rt(this,this._map.set(e,!0))},At.prototype.remove=function(e){return Rt(this,this._map.remove(e))},At.prototype.clear=function(){return Rt(this,this._map.clear())},At.prototype.union=function(){var e=sn.call(arguments,0);return e=e.filter(function(e){return 0!==e.size}),0===e.length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(t){for(var n=0;n=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Gt(e,t)},qt.prototype.pushAll=function(e){if(e=r(e),0===e.size)return this;ue(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Gt(t,n)},qt.prototype.pop=function(){return this.slice(1)},qt.prototype.unshift=function(){return this.push.apply(this,arguments)},qt.prototype.unshiftAll=function(e){return this.pushAll(e)},qt.prototype.shift=function(){return this.pop.apply(this,arguments)},qt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Xt()},qt.prototype.slice=function(e,t){if(y(e,t,this.size))return this;var n=g(e,this.size);if(b(t,this.size)!==this.size)return ne.prototype.slice.call(this,e,t);for(var r=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=r,this._head=o,this.__hash=void 0,this.__altered=!0,this):Gt(r,o)},qt.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Gt(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},qt.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},qt.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new w(function(){if(r){var t=r.value;return r=r.next,S(e,n++,t)}return x()})},qt.isStack=Yt;var rr="@@__IMMUTABLE_STACK__@@",or=qt.prototype;or[rr]=!0,or.withMutations=Fn.withMutations,or.asMutable=Fn.asMutable,or.asImmutable=Fn.asImmutable,or.wasAltered=Fn.wasAltered;var ir;t.Iterator=w,$t(t,{toArray:function(){ue(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new ot(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new rt(this,!0)},toMap:function(){return pe(this.toKeyedSeq())},toObject:function(){ue(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Ze(this.toKeyedSeq())},toOrderedSet:function(){return Kt(a(this)?this.valueSeq():this)},toSet:function(){return At(a(this)?this.valueSeq():this)},toSetSeq:function(){return new it(this)},toSeq:function(){return c(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return qt(a(this)?this.valueSeq():this)},toList:function(){return Re(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return Mt(this,mt(this,sn.call(arguments,0)))},includes:function(e){return this.some(function(t){return X(t,e)})},entries:function(){return this.__iterator(wn)},every:function(e,t){ue(this.size);var n=!0;return this.__iterate(function(r,o,i){if(!e.call(t,r,o,i))return n=!1,!1}),n},filter:function(e,t){return Mt(this,ut(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return ue(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){ue(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(bn)},map:function(e,t){return Mt(this,st(this,e,t))},reduce:function(e,t,n){ue(this.size);var r,o;return arguments.length<2?o=!0:r=t,this.__iterate(function(t,i,a){o?(o=!1,r=t):r=e.call(n,r,t,i,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Mt(this,lt(this,!0))},slice:function(e,t){return Mt(this,ht(this,e,t,!0))},some:function(e,t){return!this.every(Qt(e),t)},sort:function(e){return Mt(this,Ct(this,e))},values:function(){return this.__iterator(Cn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return d(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return pt(this,e,t)},equals:function(e){return $(this,e)},entrySeq:function(){var e=this;if(e._cache)return new P(e._cache);var t=e.toSeq().map(Zt).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Qt(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate(function(n,o,i){if(e.call(t,n,o,i))return r=[o,n],!1}),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(m)},flatMap:function(e,t){return Mt(this,gt(this,e,t))},flatten:function(e){return Mt(this,yt(this,e,!0))},fromEntrySeq:function(){return new at(this)},get:function(e,t){return this.find(function(t,n){return X(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,o=Nt(e);!(n=o.next()).done;){var i=n.value;if((r=r&&r.get?r.get(i,mn):mn)===mn)return t}return r},groupBy:function(e,t){return ft(this,e,t)},has:function(e){return this.get(e,mn)!==mn},hasIn:function(e){return this.getIn(e,mn)!==mn},isSubset:function(e){return e="function"==typeof e.includes?e:t(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e="function"==typeof e.isSubset?e:t(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return X(t,e)})},keySeq:function(){return this.toSeq().map(Jt).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return wt(this,e)},maxBy:function(e,t){return wt(this,t,e)},min:function(e){return wt(this,e?en(e):rn)},minBy:function(e,t){return wt(this,t?en(t):rn,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Mt(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Mt(this,vt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Qt(e),t)},sortBy:function(e,t){return Mt(this,Ct(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Mt(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Mt(this,dt(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Qt(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var ar=t.prototype;ar[ln]=!0,ar[Mn]=ar.values,ar.__toJS=ar.toArray,ar.__toStringMapper=tn,ar.inspect=ar.toSource=function(){return this.toString()},ar.chain=ar.flatMap,ar.contains=ar.includes,$t(n,{flip:function(){return Mt(this,ct(this))},mapEntries:function(e,t){var n=this,r=0;return Mt(this,this.toSeq().map(function(o,i){return e.call(t,[i,o],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Mt(this,this.toSeq().flip().map(function(r,o){return e.call(t,r,o,n)}).flip())}});var cr=n.prototype;return cr[un]=!0,cr[Mn]=ar.entries,cr.__toJS=ar.toObject,cr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+tn(e)},$t(r,{toKeyedSeq:function(){return new rt(this,!1)},filter:function(e,t){return Mt(this,ut(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Mt(this,lt(this,!1))},slice:function(e,t){return Mt(this,ht(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=g(e,e<0?this.count():this.size);var r=this.slice(0,e);return Mt(this,1===n?r:r.concat(h(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return Mt(this,yt(this,e,!1))},get:function(e,t){return e=v(this,e),e<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=v(this,e))>=0&&(void 0!==this.size?this.size===1/0||e=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){function r(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}try{var o=n(161)}catch(e){var o=n(161)}var i=/\s+/,a=Object.prototype.toString;e.exports=function(e){return new r(e)},r.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~o(t,e)||t.push(e),this.el.className=t.join(" "),this},r.prototype.remove=function(e){if("[object RegExp]"==a.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=o(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},r.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n=t||n<0||z&&r>=C}function h(){var e=i();if(f(e))return d(e);S=setTimeout(h,p(e))}function d(e){return S=void 0,_&&g?r(e):(g=b=void 0,w)}function v(){void 0!==S&&clearTimeout(S),M=0,g=x=b=S=void 0}function m(){return void 0===S?w:d(i())}function y(){var e=i(),n=f(e);if(g=arguments,b=this,x=e,n){if(void 0===S)return u(x);if(z)return S=setTimeout(h,t),r(x)}return void 0===S&&(S=setTimeout(h,t)),w}var g,b,C,w,S,x,M=0,k=!1,z=!1,_=!0;if("function"!=typeof e)throw new TypeError(c);return t=a(t)||0,o(n)&&(k=!!n.leading,z="maxWait"in n,C=z?s(a(n.maxWait)||0,t):C,_="trailing"in n?!!n.trailing:_),y.cancel=v,y.flush=m,y}var o=n(29),i=n(312),a=n(313),c="Expected a function",s=Math.max,l=Math.min;e.exports=r},function(e,t,n){function r(e){return"symbol"==typeof e||i(e)&&o(e)==a}var o=n(48),i=n(40),a="[object Symbol]";e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.canUseDOM=t.slidesOnLeft=t.slidesOnRight=t.siblingDirection=t.getTotalSlides=t.getPostClones=t.getPreClones=t.getTrackLeft=t.getTrackAnimateCSS=t.getTrackCSS=t.checkSpecKeys=t.getSlideCount=t.checkNavigable=t.getNavigableIndexes=t.swipeEnd=t.swipeMove=t.swipeStart=t.keyHandler=t.changeSlide=t.slideHandler=t.initializedState=t.extractObject=t.canGoNext=t.getSwipeDirection=t.getHeight=t.getWidth=t.lazySlidesOnRight=t.lazySlidesOnLeft=t.lazyEndIndex=t.lazyStartIndex=t.getRequiredLazySlides=t.getOnDemandLazySlides=void 0;var o=Object.assign||function(e){for(var t=1;t0?1:0):0},h=t.lazySlidesOnRight=function(e){return e.centerMode?Math.floor((e.slidesToShow-1)/2)+1+(parseInt(e.centerPadding)>0?1:0):e.slidesToShow},d=t.getWidth=function(e){return e&&e.offsetWidth||0},v=t.getHeight=function(e){return e&&e.offsetHeight||0},m=t.getSwipeDirection=function(e){var t,n,r,o,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t=e.startX-e.curX,n=e.startY-e.curY,r=Math.atan2(n,t),o=Math.round(180*r/Math.PI),o<0&&(o=360-Math.abs(o)),o<=45&&o>=0||o<=360&&o>=315?"left":o>=135&&o<=225?"right":!0===i?o>=35&&o<=135?"up":"down":"vertical"},y=t.canGoNext=function(e){var t=!0;return e.infinite||(e.centerMode&&e.currentSlide>=e.slideCount-1?t=!1:(e.slideCount<=e.slidesToShow||e.currentSlide>=e.slideCount-e.slidesToShow)&&(t=!1)),t},g=(t.extractObject=function(e,t){var n={};return t.forEach(function(t){return n[t]=e[t]}),n},t.initializedState=function(e){var t=a.default.Children.count(e.children),n=Math.ceil(d(s.default.findDOMNode(e.listRef))),r=Math.ceil(d(s.default.findDOMNode(e.trackRef))),o=void 0;if(e.vertical)o=n;else{var i=e.centerMode&&2*parseInt(e.centerPadding);"string"==typeof e.centerPadding&&"%"===e.centerPadding.slice(-1)&&(i*=n/100),o=Math.ceil((n-i)/e.slidesToShow)}var c=s.default.findDOMNode(e.listRef)&&v(s.default.findDOMNode(e.listRef).querySelector('[data-index="0"]')),u=c*e.slidesToShow,p=void 0===e.currentSlide?e.initialSlide:e.currentSlide;e.rtl&&void 0===e.currentSlide&&(p=t-1-e.initialSlide);var f=e.lazyLoadedList||[],h=l({currentSlide:p,lazyLoadedList:f},e);f.concat(h);var m={slideCount:t,slideWidth:o,listWidth:n,trackWidth:r,currentSlide:p,slideHeight:c,listHeight:u,lazyLoadedList:f};return null===e.autoplaying&&e.autoplay&&(m.autoplaying="playing"),m},t.slideHandler=function(e){var t=e.waitForAnimate,n=e.animating,r=e.fade,i=e.infinite,a=e.index,c=e.slideCount,s=e.lazyLoadedList,u=e.lazyLoad,p=e.currentSlide,f=e.centerMode,h=e.slidesToScroll,d=e.slidesToShow,v=e.useCSS;if(t&&n)return{};var m=a,g=void 0,b=void 0,C=void 0,w={},k={};if(r){if(!i&&(a<0||a>=c))return{};a<0?m=a+c:a>=c&&(m=a-c),u&&s.indexOf(m)<0&&s.push(m),w={animating:!0,currentSlide:m,lazyLoadedList:s},k={animating:!1}}else g=m,m<0?(g=m+c,i?c%h!=0&&(g=c-c%h):g=0):!y(e)&&m>p?m=g=p:f&&m>=c?(m=i?c:c-1,g=i?0:c-1):m>=c&&(g=m-c,i?c%h!=0&&(g=0):g=c-d),b=M(o({},e,{slideIndex:m})),C=M(o({},e,{slideIndex:g})),i||(b===C&&(m=g),b=C),u&&s.concat(l(o({},e,{currentSlide:m}))),v?(w={animating:!0,currentSlide:g,trackStyle:x(o({},e,{left:b})),lazyLoadedList:s},k={animating:!1,currentSlide:g,trackStyle:S(o({},e,{left:C})),swipeLeft:null}):w={currentSlide:g,trackStyle:S(o({},e,{left:C})),lazyLoadedList:s};return{state:w,nextState:k}},t.changeSlide=function(e,t){var n,r,i,a,c,s=e.slidesToScroll,l=e.slidesToShow,u=e.slideCount,p=e.currentSlide,f=e.lazyLoad,h=e.infinite;if(a=u%s!=0,n=a?0:(u-p)%s,"previous"===t.message)i=0===n?s:l-n,c=p-i,f&&!h&&(r=p-i,c=-1===r?u-1:r);else if("next"===t.message)i=0===n?s:n,c=p+i,f&&!h&&(c=(p+s)%u+n);else if("dots"===t.message){if((c=t.index*t.slidesToScroll)===t.currentSlide)return null}else if("children"===t.message){if((c=t.index)===t.currentSlide)return null;if(h){var d=O(o({},e,{targetSlide:c}));c>t.currentSlide&&"left"===d?c-=u:c10)return{scrolling:!0};c&&(C.swipeLength=E);var T=(s?-1:1)*(C.curX>C.startX?1:-1);c&&(T=C.curY>C.startY?1:-1);var N=Math.ceil(v/g),V=m(t.touchObject,c),P=C.swipeLength;return b||(0===l&&"right"===V||l+1>=N&&"left"===V||!y(t)&&"left"===V)&&(P=C.swipeLength*u,!1===p&&f&&(f(V),_.edgeDragged=!0)),(!h&&w&&(w(V),_.swiped=!0),z=i?O+P*(x/k)*T:s?O-P*T:O+P*T,c&&(z=O+P*T),_=o({},_,{touchObject:C,swipeLeft:z,trackStyle:S(o({},t,{left:z}))}),Math.abs(C.curX-C.startX)<.8*Math.abs(C.curY-C.startY))?_:(C.swipeLength>10&&(_.swiping=!0,e.preventDefault()),_)}},t.swipeEnd=function(e,t){var n=t.dragging,r=t.swipe,i=t.touchObject,a=t.listWidth,c=t.touchThreshold,s=t.verticalSwiping,l=t.listHeight,u=t.currentSlide,p=t.swipeToSlide,f=t.scrolling,h=t.onSwipe;if(!n)return r&&e.preventDefault(),{};var d=s?l/c:a/c,v=m(i,s),y={dragging:!1,edgeDragged:!1,scrolling:!1,swiping:!1,swiped:!1,swipeLeft:null,touchObject:{}};if(f)return y;if(!i.swipeLength)return y;if(i.swipeLength>d){e.preventDefault(),h&&h(v);var g=void 0,w=void 0;switch(v){case"left":case"up":w=u+C(t),g=p?b(t,w):w,y.currentDirection=0;break;case"right":case"down":w=u-C(t),g=p?b(t,w):w,y.currentDirection=1;break;default:g=u}y.triggerSlideHandler=g}else{var S=M(t);y.trackStyle=x(o({},t,{left:S}))}return y},t.getNavigableIndexes=function(e){for(var t=e.infinite?2*e.slideCount:e.slideCount,n=e.infinite?-1*e.slidesToShow:0,r=e.infinite?-1*e.slidesToShow:0,o=[];nn[n.length-1])t=n[n.length-1];else for(var o in n){if(t-1*e.swipeLeft)return n=r,!1}else if(r.offsetLeft-t+d(r)/2>-1*e.swipeLeft)return n=r,!1;return!0}),!n)return 0;var i=!0===e.rtl?e.slideCount-e.currentSlide:e.currentSlide;return Math.abs(n.dataset.index-i)||1}return e.slidesToScroll},w=t.checkSpecKeys=function(e,t){return t.reduce(function(t,n){return t&&e.hasOwnProperty(n)},!0)?null:console.error("Keys Missing:",e)},S=t.getTrackCSS=function(e){w(e,["left","variableWidth","slideCount","slidesToShow","slideWidth"]);var t=void 0,n=void 0,r=e.slideCount+2*e.slidesToShow;e.vertical?n=r*e.slideHeight:t=_(e)*e.slideWidth;var i={opacity:1,transition:"",WebkitTransition:""};if(e.useTransform){var a=e.vertical?"translate3d(0px, "+e.left+"px, 0px)":"translate3d("+e.left+"px, 0px, 0px)",c=e.vertical?"translate3d(0px, "+e.left+"px, 0px)":"translate3d("+e.left+"px, 0px, 0px)",s=e.vertical?"translateY("+e.left+"px)":"translateX("+e.left+"px)";i=o({},i,{WebkitTransform:a,transform:c,msTransform:s})}else e.vertical?i.top=e.left:i.left=e.left;return e.fade&&(i={opacity:1}),t&&(i.width=t),n&&(i.height=n),window&&!window.addEventListener&&window.attachEvent&&(e.vertical?i.marginTop=e.left+"px":i.marginLeft=e.left+"px"),i},x=t.getTrackAnimateCSS=function(e){w(e,["left","variableWidth","slideCount","slidesToShow","slideWidth","speed","cssEase"]);var t=S(e);return e.useTransform?(t.WebkitTransition="-webkit-transform "+e.speed+"ms "+e.cssEase,t.transition="transform "+e.speed+"ms "+e.cssEase):e.vertical?t.transition="top "+e.speed+"ms "+e.cssEase:t.transition="left "+e.speed+"ms "+e.cssEase,t},M=t.getTrackLeft=function(e){if(e.unslick)return 0;w(e,["slideIndex","trackRef","infinite","centerMode","slideCount","slidesToShow","slidesToScroll","slideWidth","listWidth","variableWidth","slideHeight"]);var t,n,r=e.slideIndex,o=e.trackRef,i=e.infinite,a=e.centerMode,c=e.slideCount,l=e.slidesToShow,u=e.slidesToScroll,p=e.slideWidth,f=e.listWidth,h=e.variableWidth,d=e.slideHeight,v=e.fade,m=e.vertical,y=0,g=0;if(v||1===e.slideCount)return 0;var b=0;if(i?(b=-k(e),c%u!=0&&r+u>c&&(b=-(r>c?l-(r-c):c%u)),a&&(b+=parseInt(l/2))):(c%u!=0&&r+u>c&&(b=l-c%u),a&&(b=parseInt(l/2))),y=b*p,g=b*d,t=m?r*d*-1+g:r*p*-1+y,!0===h){var C,S=s.default.findDOMNode(o);if(C=r+k(e),n=S&&S.childNodes[C],t=n?-1*n.offsetLeft:0,!0===a){C=i?r+k(e):r,n=S&&S.children[C],t=0;for(var x=0;xe.currentSlide?e.targetSlide>e.currentSlide+E(e)?"left":"right":e.targetSlide0&&(i+=1),r&&t%2==0&&(i+=1),i}return r?0:t-1},T=t.slidesOnLeft=function(e){var t=e.slidesToShow,n=e.centerMode,r=e.rtl,o=e.centerPadding;if(n){var i=(t-1)/2+1;return parseInt(o)>0&&(i+=1),r||t%2!=0||(i+=1),i}return r?t-1:0};t.canUseDOM=function(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}},function(e,t,n){var r=n(49),o=r(Object,"create");e.exports=o},function(e,t,n){function r(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0?r:n)(e)}},function(e,t,n){var r=n(99)("keys"),o=n(72);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(19),o=n(38),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(71)?"pure":"global",copyright:"\xa9 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(44),o=n(248),i=n(100),a=n(98)("IE_PROTO"),c=function(){},s=function(){var e,t=n(150)("iframe"),r=i.length;for(t.style.display="none",n(249).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("