tfcconnection/.shadow-cljs/builds/app/dev/goog-js/goog.functions.functions.js

1 line
48 KiB
JavaScript

["^ ","~:resource-id",["~:shadow.build.classpath/resource","goog/functions/functions.js"],"~:js","goog.provide(\"goog.functions\");\ngoog.functions.constant = function(retValue) {\n return function() {\n return retValue;\n };\n};\ngoog.functions.FALSE = function() {\n return false;\n};\ngoog.functions.TRUE = function() {\n return true;\n};\ngoog.functions.NULL = function() {\n return null;\n};\ngoog.functions.UNDEFINED = function() {\n return undefined;\n};\ngoog.functions.EMPTY = goog.functions.UNDEFINED;\ngoog.functions.identity = function(opt_returnValue, var_args) {\n return opt_returnValue;\n};\ngoog.functions.error = function(message) {\n return function() {\n throw new Error(message);\n };\n};\ngoog.functions.fail = function(err) {\n return function() {\n throw err;\n };\n};\ngoog.functions.lock = function(f, opt_numArgs) {\n opt_numArgs = opt_numArgs || 0;\n return function() {\n const self = this;\n return f.apply(self, Array.prototype.slice.call(arguments, 0, opt_numArgs));\n };\n};\ngoog.functions.nth = function(n) {\n return function() {\n return arguments[n];\n };\n};\ngoog.functions.partialRight = function(fn, var_args) {\n const rightArgs = Array.prototype.slice.call(arguments, 1);\n return function() {\n let self = this;\n if (self === goog.global) {\n self = undefined;\n }\n const newArgs = Array.prototype.slice.call(arguments);\n newArgs.push.apply(newArgs, rightArgs);\n return fn.apply(self, newArgs);\n };\n};\ngoog.functions.withReturnValue = function(f, retValue) {\n return goog.functions.sequence(f, goog.functions.constant(retValue));\n};\ngoog.functions.equalTo = function(value, opt_useLooseComparison) {\n return function(other) {\n return opt_useLooseComparison ? value == other : value === other;\n };\n};\ngoog.functions.compose = function(fn, var_args) {\n const functions = arguments;\n const length = functions.length;\n return function() {\n const self = this;\n let result;\n if (length) {\n result = functions[length - 1].apply(self, arguments);\n }\n for (let i = length - 2; i >= 0; i--) {\n result = functions[i].call(self, result);\n }\n return result;\n };\n};\ngoog.functions.sequence = function(var_args) {\n const functions = arguments;\n const length = functions.length;\n return function() {\n const self = this;\n let result;\n for (let i = 0; i < length; i++) {\n result = functions[i].apply(self, arguments);\n }\n return result;\n };\n};\ngoog.functions.and = function(var_args) {\n const functions = arguments;\n const length = functions.length;\n return function() {\n const self = this;\n for (let i = 0; i < length; i++) {\n if (!functions[i].apply(self, arguments)) {\n return false;\n }\n }\n return true;\n };\n};\ngoog.functions.or = function(var_args) {\n const functions = arguments;\n const length = functions.length;\n return function() {\n const self = this;\n for (let i = 0; i < length; i++) {\n if (functions[i].apply(self, arguments)) {\n return true;\n }\n }\n return false;\n };\n};\ngoog.functions.not = function(f) {\n return function() {\n const self = this;\n return !f.apply(self, arguments);\n };\n};\ngoog.functions.create = function(constructor, var_args) {\n const temp = function() {\n };\n temp.prototype = constructor.prototype;\n const obj = new temp();\n constructor.apply(obj, Array.prototype.slice.call(arguments, 1));\n return obj;\n};\ngoog.functions.CACHE_RETURN_VALUE = goog.define(\"goog.functions.CACHE_RETURN_VALUE\", true);\ngoog.functions.cacheReturnValue = function(fn) {\n let called = false;\n let value;\n return function() {\n if (!goog.functions.CACHE_RETURN_VALUE) {\n return fn();\n }\n if (!called) {\n value = fn();\n called = true;\n }\n return value;\n };\n};\ngoog.functions.once = function(f) {\n let inner = f;\n return function() {\n if (inner) {\n const tmp = inner;\n inner = null;\n tmp();\n }\n };\n};\ngoog.functions.debounce = function(f, interval, opt_scope) {\n let timeout = 0;\n return function(var_args) {\n goog.global.clearTimeout(timeout);\n const args = arguments;\n timeout = goog.global.setTimeout(function() {\n f.apply(opt_scope, args);\n }, interval);\n };\n};\ngoog.functions.throttle = function(f, interval, opt_scope) {\n let timeout = 0;\n let shouldFire = false;\n let storedArgs = [];\n const handleTimeout = function() {\n timeout = 0;\n if (shouldFire) {\n shouldFire = false;\n fire();\n }\n };\n const fire = function() {\n timeout = goog.global.setTimeout(handleTimeout, interval);\n let args = storedArgs;\n storedArgs = [];\n f.apply(opt_scope, args);\n };\n return function(var_args) {\n storedArgs = arguments;\n if (!timeout) {\n fire();\n } else {\n shouldFire = true;\n }\n };\n};\ngoog.functions.rateLimit = function(f, interval, opt_scope) {\n let timeout = 0;\n const handleTimeout = function() {\n timeout = 0;\n };\n return function(var_args) {\n if (!timeout) {\n timeout = goog.global.setTimeout(handleTimeout, interval);\n f.apply(opt_scope, arguments);\n }\n };\n};\ngoog.functions.isFunction = val => {\n return typeof val === \"function\";\n};\n","~:source","/**\n * @license\n * Copyright The Closure Library Authors.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Utilities for creating functions. Loosely inspired by these\n * java classes from the Guava library:\n * com.google.common.base.Functions\n * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Functions.html\n *\n * com.google.common.base.Predicates\n * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Predicates.html\n *\n * More about these can be found at\n * https://github.com/google/guava/wiki/FunctionalExplained\n */\n\n\ngoog.provide('goog.functions');\n\n\n/**\n * Creates a function that always returns the same value.\n * @param {T} retValue The value to return.\n * @return {function():T} The new function.\n * @template T\n */\ngoog.functions.constant = function(retValue) {\n 'use strict';\n return function() {\n 'use strict';\n return retValue;\n };\n};\n\n\n/**\n * Always returns false.\n * @type {function(...): boolean}\n */\ngoog.functions.FALSE = function() {\n 'use strict';\n return false;\n};\n\n\n/**\n * Always returns true.\n * @type {function(...): boolean}\n */\ngoog.functions.TRUE = function() {\n 'use strict';\n return true;\n};\n\n\n/**\n * Always returns `null`.\n * @type {function(...): null}\n */\ngoog.functions.NULL = function() {\n 'use strict';\n return null;\n};\n\n\n/**\n * Always returns `undefined`.\n * @type {function(...): undefined}\n */\ngoog.functions.UNDEFINED = function() {\n return undefined;\n};\n\n/**\n * Always returns `undefined` (loosely-typed version).\n * @type {!Function}\n */\ngoog.functions.EMPTY = /** @type {?} */ (goog.functions.UNDEFINED);\n\n\n/**\n * A simple function that returns the first argument of whatever is passed\n * into it.\n * @param {T=} opt_returnValue The single value that will be returned.\n * @param {...*} var_args Optional trailing arguments. These are ignored.\n * @return {T} The first argument passed in, or undefined if nothing was passed.\n * @template T\n */\ngoog.functions.identity = function(opt_returnValue, var_args) {\n 'use strict';\n return opt_returnValue;\n};\n\n\n/**\n * Creates a function that always throws an error with the given message.\n * @param {string} message The error message.\n * @return {!Function} The error-throwing function.\n */\ngoog.functions.error = function(message) {\n 'use strict';\n return function() {\n 'use strict';\n throw new Error(message);\n };\n};\n\n\n/**\n * Creates a function that throws the given object.\n * @param {*} err An object to be thrown.\n * @return {!Function} The error-throwing function.\n */\ngoog.functions.fail = function(err) {\n 'use strict';\n return function() {\n 'use strict';\n throw err;\n };\n};\n\n\n/**\n * Given a function, create a function that keeps opt_numArgs arguments and\n * silently discards all additional arguments.\n * @param {Function} f The original function.\n * @param {number=} opt_numArgs The number of arguments to keep. Defaults to 0.\n * @return {!Function} A version of f that only keeps the first opt_numArgs\n * arguments.\n */\ngoog.functions.lock = function(f, opt_numArgs) {\n 'use strict';\n opt_numArgs = opt_numArgs || 0;\n return function() {\n 'use strict';\n const self = /** @type {*} */ (this);\n return f.apply(self, Array.prototype.slice.call(arguments, 0, opt_numArgs));\n };\n};\n\n\n/**\n * Creates a function that returns its nth argument.\n * @param {number} n The position of the return argument.\n * @return {!Function} A new function.\n */\ngoog.functions.nth = function(n) {\n 'use strict';\n return function() {\n 'use strict';\n return arguments[n];\n };\n};\n\n\n/**\n * Like goog.partial(), except that arguments are added after arguments to the\n * returned function.\n *\n * Usage:\n * function f(arg1, arg2, arg3, arg4) { ... }\n * var g = goog.functions.partialRight(f, arg3, arg4);\n * g(arg1, arg2);\n *\n * @param {!Function} fn A function to partially apply.\n * @param {...*} var_args Additional arguments that are partially applied to fn\n * at the end.\n * @return {!Function} A partially-applied form of the function goog.partial()\n * was invoked as a method of.\n */\ngoog.functions.partialRight = function(fn, var_args) {\n 'use strict';\n const rightArgs = Array.prototype.slice.call(arguments, 1);\n return function() {\n 'use strict';\n // Even in strict mode, IE10/11 and Edge (non-Chromium) use global context\n // when free-calling functions. To catch cases where people were using this\n // erroneously, we explicitly change the context to undefined to match\n // strict mode specifications.\n let self = /** @type {*} */ (this);\n if (self === goog.global) {\n self = undefined;\n }\n const newArgs = Array.prototype.slice.call(arguments);\n newArgs.push.apply(newArgs, rightArgs);\n return fn.apply(self, newArgs);\n };\n};\n\n\n/**\n * Given a function, create a new function that swallows its return value\n * and replaces it with a new one.\n * @param {Function} f A function.\n * @param {T} retValue A new return value.\n * @return {function(...?):T} A new function.\n * @template T\n */\ngoog.functions.withReturnValue = function(f, retValue) {\n 'use strict';\n return goog.functions.sequence(f, goog.functions.constant(retValue));\n};\n\n\n/**\n * Creates a function that returns whether its argument equals the given value.\n *\n * Example:\n * var key = goog.object.findKey(obj, goog.functions.equalTo('needle'));\n *\n * @param {*} value The value to compare to.\n * @param {boolean=} opt_useLooseComparison Whether to use a loose (==)\n * comparison rather than a strict (===) one. Defaults to false.\n * @return {function(*):boolean} The new function.\n */\ngoog.functions.equalTo = function(value, opt_useLooseComparison) {\n 'use strict';\n return function(other) {\n 'use strict';\n return opt_useLooseComparison ? (value == other) : (value === other);\n };\n};\n\n\n/**\n * Creates the composition of the functions passed in.\n * For example, (goog.functions.compose(f, g))(a) is equivalent to f(g(a)).\n * @param {function(...?):T} fn The final function.\n * @param {...Function} var_args A list of functions.\n * @return {function(...?):T} The composition of all inputs.\n * @template T\n */\ngoog.functions.compose = function(fn, var_args) {\n 'use strict';\n const functions = arguments;\n const length = functions.length;\n return function() {\n 'use strict';\n const self = /** @type {*} */ (this);\n let result;\n if (length) {\n result = functions[length - 1].apply(self, arguments);\n }\n\n for (let i = length - 2; i >= 0; i--) {\n result = functions[i].call(self, result);\n }\n return result;\n };\n};\n\n\n/**\n * Creates a function that calls the functions passed in in sequence, and\n * returns the value of the last function. For example,\n * (goog.functions.sequence(f, g))(x) is equivalent to f(x),g(x).\n * @param {...Function} var_args A list of functions.\n * @return {!Function} A function that calls all inputs in sequence.\n */\ngoog.functions.sequence = function(var_args) {\n 'use strict';\n const functions = arguments;\n const length = functions.length;\n return function() {\n 'use strict';\n const self = /** @type {*} */ (this);\n let result;\n for (let i = 0; i < length; i++) {\n result = functions[i].apply(self, arguments);\n }\n return result;\n };\n};\n\n\n/**\n * Creates a function that returns true if each of its components evaluates\n * to true. The components are evaluated in order, and the evaluation will be\n * short-circuited as soon as a function returns false.\n * For example, (goog.functions.and(f, g))(x) is equivalent to f(x) && g(x).\n * @param {...Function} var_args A list of functions.\n * @return {function(...?):boolean} A function that ANDs its component\n * functions.\n */\ngoog.functions.and = function(var_args) {\n 'use strict';\n const functions = arguments;\n const length = functions.length;\n return function() {\n 'use strict';\n const self = /** @type {*} */ (this);\n for (let i = 0; i < length; i++) {\n if (!functions[i].apply(self, arguments)) {\n return false;\n }\n }\n return true;\n };\n};\n\n\n/**\n * Creates a function that returns true if any of its components evaluates\n * to true. The components are evaluated in order, and the evaluation will be\n * short-circuited as soon as a function returns true.\n * For example, (goog.functions.or(f, g))(x) is equivalent to f(x) || g(x).\n * @param {...Function} var_args A list of functions.\n * @return {function(...?):boolean} A function that ORs its component\n * functions.\n */\ngoog.functions.or = function(var_args) {\n 'use strict';\n const functions = arguments;\n const length = functions.length;\n return function() {\n 'use strict';\n const self = /** @type {*} */ (this);\n for (let i = 0; i < length; i++) {\n if (functions[i].apply(self, arguments)) {\n return true;\n }\n }\n return false;\n };\n};\n\n\n/**\n * Creates a function that returns the Boolean opposite of a provided function.\n * For example, (goog.functions.not(f))(x) is equivalent to !f(x).\n * @param {!Function} f The original function.\n * @return {function(...?):boolean} A function that delegates to f and returns\n * opposite.\n */\ngoog.functions.not = function(f) {\n 'use strict';\n return function() {\n 'use strict';\n const self = /** @type {*} */ (this);\n return !f.apply(self, arguments);\n };\n};\n\n\n/**\n * Generic factory function to construct an object given the constructor\n * and the arguments. Intended to be bound to create object factories.\n *\n * Example:\n *\n * var factory = goog.partial(goog.functions.create, Class);\n *\n * @param {function(new:T, ...)} constructor The constructor for the Object.\n * @param {...*} var_args The arguments to be passed to the constructor.\n * @return {T} A new instance of the class given in `constructor`.\n * @template T\n * @deprecated This function does not work with ES6 class constructors. Use\n * arrow functions + spread args instead.\n */\ngoog.functions.create = function(constructor, var_args) {\n 'use strict';\n /**\n * @constructor\n * @final\n */\n const temp = function() {};\n temp.prototype = constructor.prototype;\n\n // obj will have constructor's prototype in its chain and\n // 'obj instanceof constructor' will be true.\n const obj = new temp();\n\n // obj is initialized by constructor.\n // arguments is only array-like so lacks shift(), but can be used with\n // the Array prototype function.\n constructor.apply(obj, Array.prototype.slice.call(arguments, 1));\n return obj;\n};\n\n\n/**\n * @define {boolean} Whether the return value cache should be used.\n * This should only be used to disable caches when testing.\n */\ngoog.functions.CACHE_RETURN_VALUE =\n goog.define('goog.functions.CACHE_RETURN_VALUE', true);\n\n\n/**\n * Gives a wrapper function that caches the return value of a parameterless\n * function when first called.\n *\n * When called for the first time, the given function is called and its\n * return value is cached (thus this is only appropriate for idempotent\n * functions). Subsequent calls will return the cached return value. This\n * allows the evaluation of expensive functions to be delayed until first used.\n *\n * To cache the return values of functions with parameters, see goog.memoize.\n *\n * @param {function():T} fn A function to lazily evaluate.\n * @return {function():T} A wrapped version the function.\n * @template T\n */\ngoog.functions.cacheReturnValue = function(fn) {\n 'use strict';\n let called = false;\n let value;\n\n return function() {\n 'use strict';\n if (!goog.functions.CACHE_RETURN_VALUE) {\n return fn();\n }\n\n if (!called) {\n value = fn();\n called = true;\n }\n\n return value;\n };\n};\n\n\n/**\n * Wraps a function to allow it to be called, at most, once. All\n * additional calls are no-ops.\n *\n * This is particularly useful for initialization functions\n * that should be called, at most, once.\n *\n * @param {function():*} f Function to call.\n * @return {function():undefined} Wrapped function.\n */\ngoog.functions.once = function(f) {\n 'use strict';\n // Keep a reference to the function that we null out when we're done with\n // it -- that way, the function can be GC'd when we're done with it.\n let inner = f;\n return function() {\n 'use strict';\n if (inner) {\n const tmp = inner;\n inner = null;\n tmp();\n }\n };\n};\n\n\n/**\n * Wraps a function to allow it to be called, at most, once per interval\n * (specified in milliseconds). If the wrapper function is called N times within\n * that interval, only the Nth call will go through.\n *\n * This is particularly useful for batching up repeated actions where the\n * last action should win. This can be used, for example, for refreshing an\n * autocomplete pop-up every so often rather than updating with every keystroke,\n * since the final text typed by the user is the one that should produce the\n * final autocomplete results. For more stateful debouncing with support for\n * pausing, resuming, and canceling debounced actions, use\n * `goog.async.Debouncer`.\n *\n * @param {function(this:SCOPE, ...?)} f Function to call.\n * @param {number} interval Interval over which to debounce. The function will\n * only be called after the full interval has elapsed since the last call.\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\n * @return {function(...?): undefined} Wrapped function.\n * @template SCOPE\n */\ngoog.functions.debounce = function(f, interval, opt_scope) {\n 'use strict';\n let timeout = 0;\n return /** @type {function(...?)} */ (function(var_args) {\n 'use strict';\n goog.global.clearTimeout(timeout);\n const args = arguments;\n timeout = goog.global.setTimeout(function() {\n 'use strict';\n f.apply(opt_scope, args);\n }, interval);\n });\n};\n\n\n/**\n * Wraps a function to allow it to be called, at most, once per interval\n * (specified in milliseconds). If the wrapper function is called N times in\n * that interval, both the 1st and the Nth calls will go through.\n *\n * This is particularly useful for limiting repeated user requests where the\n * the last action should win, but you also don't want to wait until the end of\n * the interval before sending a request out, as it leads to a perception of\n * slowness for the user.\n *\n * @param {function(this:SCOPE, ...?)} f Function to call.\n * @param {number} interval Interval over which to throttle. The function can\n * only be called once per interval.\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\n * @return {function(...?): undefined} Wrapped function.\n * @template SCOPE\n */\ngoog.functions.throttle = function(f, interval, opt_scope) {\n 'use strict';\n let timeout = 0;\n let shouldFire = false;\n let storedArgs = [];\n\n const handleTimeout = function() {\n 'use strict';\n timeout = 0;\n if (shouldFire) {\n shouldFire = false;\n fire();\n }\n };\n\n const fire = function() {\n 'use strict';\n timeout = goog.global.setTimeout(handleTimeout, interval);\n let args = storedArgs;\n storedArgs = []; // Avoid a space leak by clearing stored arguments.\n f.apply(opt_scope, args);\n };\n\n return /** @type {function(...?)} */ (function(var_args) {\n 'use strict';\n storedArgs = arguments;\n if (!timeout) {\n fire();\n } else {\n shouldFire = true;\n }\n });\n};\n\n\n/**\n * Wraps a function to allow it to be called, at most, once per interval\n * (specified in milliseconds). If the wrapper function is called N times within\n * that interval, only the 1st call will go through.\n *\n * This is particularly useful for limiting repeated user requests where the\n * first request is guaranteed to have all the data required to perform the\n * final action, so there's no need to wait until the end of the interval before\n * sending the request out.\n *\n * @param {function(this:SCOPE, ...?)} f Function to call.\n * @param {number} interval Interval over which to rate-limit. The function will\n * only be called once per interval, and ignored for the remainer of the\n * interval.\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\n * @return {function(...?): undefined} Wrapped function.\n * @template SCOPE\n */\ngoog.functions.rateLimit = function(f, interval, opt_scope) {\n 'use strict';\n let timeout = 0;\n\n const handleTimeout = function() {\n 'use strict';\n timeout = 0;\n };\n\n return /** @type {function(...?)} */ (function(var_args) {\n 'use strict';\n if (!timeout) {\n timeout = goog.global.setTimeout(handleTimeout, interval);\n f.apply(opt_scope, arguments);\n }\n });\n};\n\n/**\n * Returns true if the specified value is a function.\n * @param {*} val Variable to test.\n * @return {boolean} Whether variable is a function.\n */\ngoog.functions.isFunction = (val) => {\n return typeof val === 'function';\n};\n","~:compiled-at",1684858197862,"~:source-map-json","{\n\"version\":3,\n\"file\":\"goog.functions.functions.js\",\n\"lineCount\":208,\n\"mappings\":\"AAoBAA,IAAKC,CAAAA,OAAL,CAAa,gBAAb,CAAA;AASAD,IAAKE,CAAAA,SAAUC,CAAAA,QAAf,GAA0BC,QAAQ,CAACC,QAAD,CAAW;AAE3C,SAAO,QAAQ,EAAG;AAEhB,WAAOA,QAAP;AAFgB,GAAlB;AAF2C,CAA7C;AAaAL,IAAKE,CAAAA,SAAUI,CAAAA,KAAf,GAAuBC,QAAQ,EAAG;AAEhC,SAAO,KAAP;AAFgC,CAAlC;AAUAP,IAAKE,CAAAA,SAAUM,CAAAA,IAAf,GAAsBC,QAAQ,EAAG;AAE/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OAAL,CAAc;AACZA,aAAA,GAAUtF,IAAK6C,CAAAA,MAAO4C,CAAAA,UAAZ,CAAuBK,aAAvB,EAAsCV,QAAtC,CAAV;AACAvD,OAAEG,CAAAA,KAAF,CAAQqD,SAAR,EAAmBhD,SAAnB,CAAA;AAFY;AAFyC,GAAzD;AAT0D,CAA5D;AAuBArC,IAAKE,CAAAA,SAAUgG,CAAAA,UAAf,GAA6BC,GAADC,IAAS;AACnC,SAAO,MAAOD,IAAd,KAAsB,UAAtB;AADmC,CAArC;;\",\n\"sources\":[\"goog/functions/functions.js\"],\n\"sourcesContent\":[\"/**\\n * @license\\n * Copyright The Closure Library Authors.\\n * SPDX-License-Identifier: Apache-2.0\\n */\\n\\n/**\\n * @fileoverview Utilities for creating functions. Loosely inspired by these\\n * java classes from the Guava library:\\n * com.google.common.base.Functions\\n * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Functions.html\\n *\\n * com.google.common.base.Predicates\\n * https://google.github.io/guava/releases/snapshot-jre/api/docs/index.html?com/google/common/base/Predicates.html\\n *\\n * More about these can be found at\\n * https://github.com/google/guava/wiki/FunctionalExplained\\n */\\n\\n\\ngoog.provide('goog.functions');\\n\\n\\n/**\\n * Creates a function that always returns the same value.\\n * @param {T} retValue The value to return.\\n * @return {function():T} The new function.\\n * @template T\\n */\\ngoog.functions.constant = function(retValue) {\\n 'use strict';\\n return function() {\\n 'use strict';\\n return retValue;\\n };\\n};\\n\\n\\n/**\\n * Always returns false.\\n * @type {function(...): boolean}\\n */\\ngoog.functions.FALSE = function() {\\n 'use strict';\\n return false;\\n};\\n\\n\\n/**\\n * Always returns true.\\n * @type {function(...): boolean}\\n */\\ngoog.functions.TRUE = function() {\\n 'use strict';\\n return true;\\n};\\n\\n\\n/**\\n * Always returns `null`.\\n * @type {function(...): null}\\n */\\ngoog.functions.NULL = function() {\\n 'use strict';\\n return null;\\n};\\n\\n\\n/**\\n * Always returns `undefined`.\\n * @type {function(...): undefined}\\n */\\ngoog.functions.UNDEFINED = function() {\\n return undefined;\\n};\\n\\n/**\\n * Always returns `undefined` (loosely-typed version).\\n * @type {!Function}\\n */\\ngoog.functions.EMPTY = /** @type {?} */ (goog.functions.UNDEFINED);\\n\\n\\n/**\\n * A simple function that returns the first argument of whatever is passed\\n * into it.\\n * @param {T=} opt_returnValue The single value that will be returned.\\n * @param {...*} var_args Optional trailing arguments. These are ignored.\\n * @return {T} The first argument passed in, or undefined if nothing was passed.\\n * @template T\\n */\\ngoog.functions.identity = function(opt_returnValue, var_args) {\\n 'use strict';\\n return opt_returnValue;\\n};\\n\\n\\n/**\\n * Creates a function that always throws an error with the given message.\\n * @param {string} message The error message.\\n * @return {!Function} The error-throwing function.\\n */\\ngoog.functions.error = function(message) {\\n 'use strict';\\n return function() {\\n 'use strict';\\n throw new Error(message);\\n };\\n};\\n\\n\\n/**\\n * Creates a function that throws the given object.\\n * @param {*} err An object to be thrown.\\n * @return {!Function} The error-throwing function.\\n */\\ngoog.functions.fail = function(err) {\\n 'use strict';\\n return function() {\\n 'use strict';\\n throw err;\\n };\\n};\\n\\n\\n/**\\n * Given a function, create a function that keeps opt_numArgs arguments and\\n * silently discards all additional arguments.\\n * @param {Function} f The original function.\\n * @param {number=} opt_numArgs The number of arguments to keep. Defaults to 0.\\n * @return {!Function} A version of f that only keeps the first opt_numArgs\\n * arguments.\\n */\\ngoog.functions.lock = function(f, opt_numArgs) {\\n 'use strict';\\n opt_numArgs = opt_numArgs || 0;\\n return function() {\\n 'use strict';\\n const self = /** @type {*} */ (this);\\n return f.apply(self, Array.prototype.slice.call(arguments, 0, opt_numArgs));\\n };\\n};\\n\\n\\n/**\\n * Creates a function that returns its nth argument.\\n * @param {number} n The position of the return argument.\\n * @return {!Function} A new function.\\n */\\ngoog.functions.nth = function(n) {\\n 'use strict';\\n return function() {\\n 'use strict';\\n return arguments[n];\\n };\\n};\\n\\n\\n/**\\n * Like goog.partial(), except that arguments are added after arguments to the\\n * returned function.\\n *\\n * Usage:\\n * function f(arg1, arg2, arg3, arg4) { ... }\\n * var g = goog.functions.partialRight(f, arg3, arg4);\\n * g(arg1, arg2);\\n *\\n * @param {!Function} fn A function to partially apply.\\n * @param {...*} var_args Additional arguments that are partially applied to fn\\n * at the end.\\n * @return {!Function} A partially-applied form of the function goog.partial()\\n * was invoked as a method of.\\n */\\ngoog.functions.partialRight = function(fn, var_args) {\\n 'use strict';\\n const rightArgs = Array.prototype.slice.call(arguments, 1);\\n return function() {\\n 'use strict';\\n // Even in strict mode, IE10/11 and Edge (non-Chromium) use global context\\n // when free-calling functions. To catch cases where people were using this\\n // erroneously, we explicitly change the context to undefined to match\\n // strict mode specifications.\\n let self = /** @type {*} */ (this);\\n if (self === goog.global) {\\n self = undefined;\\n }\\n const newArgs = Array.prototype.slice.call(arguments);\\n newArgs.push.apply(newArgs, rightArgs);\\n return fn.apply(self, newArgs);\\n };\\n};\\n\\n\\n/**\\n * Given a function, create a new function that swallows its return value\\n * and replaces it with a new one.\\n * @param {Function} f A function.\\n * @param {T} retValue A new return value.\\n * @return {function(...?):T} A new function.\\n * @template T\\n */\\ngoog.functions.withReturnValue = function(f, retValue) {\\n 'use strict';\\n return goog.functions.sequence(f, goog.functions.constant(retValue));\\n};\\n\\n\\n/**\\n * Creates a function that returns whether its argument equals the given value.\\n *\\n * Example:\\n * var key = goog.object.findKey(obj, goog.functions.equalTo('needle'));\\n *\\n * @param {*} value The value to compare to.\\n * @param {boolean=} opt_useLooseComparison Whether to use a loose (==)\\n * comparison rather than a strict (===) one. Defaults to false.\\n * @return {function(*):boolean} The new function.\\n */\\ngoog.functions.equalTo = function(value, opt_useLooseComparison) {\\n 'use strict';\\n return function(other) {\\n 'use strict';\\n return opt_useLooseComparison ? (value == other) : (value === other);\\n };\\n};\\n\\n\\n/**\\n * Creates the composition of the functions passed in.\\n * For example, (goog.functions.compose(f, g))(a) is equivalent to f(g(a)).\\n * @param {function(...?):T} fn The final function.\\n * @param {...Function} var_args A list of functions.\\n * @return {function(...?):T} The composition of all inputs.\\n * @template T\\n */\\ngoog.functions.compose = function(fn, var_args) {\\n 'use strict';\\n const functions = arguments;\\n const length = functions.length;\\n return function() {\\n 'use strict';\\n const self = /** @type {*} */ (this);\\n let result;\\n if (length) {\\n result = functions[length - 1].apply(self, arguments);\\n }\\n\\n for (let i = length - 2; i >= 0; i--) {\\n result = functions[i].call(self, result);\\n }\\n return result;\\n };\\n};\\n\\n\\n/**\\n * Creates a function that calls the functions passed in in sequence, and\\n * returns the value of the last function. For example,\\n * (goog.functions.sequence(f, g))(x) is equivalent to f(x),g(x).\\n * @param {...Function} var_args A list of functions.\\n * @return {!Function} A function that calls all inputs in sequence.\\n */\\ngoog.functions.sequence = function(var_args) {\\n 'use strict';\\n const functions = arguments;\\n const length = functions.length;\\n return function() {\\n 'use strict';\\n const self = /** @type {*} */ (this);\\n let result;\\n for (let i = 0; i < length; i++) {\\n result = functions[i].apply(self, arguments);\\n }\\n return result;\\n };\\n};\\n\\n\\n/**\\n * Creates a function that returns true if each of its components evaluates\\n * to true. The components are evaluated in order, and the evaluation will be\\n * short-circuited as soon as a function returns false.\\n * For example, (goog.functions.and(f, g))(x) is equivalent to f(x) && g(x).\\n * @param {...Function} var_args A list of functions.\\n * @return {function(...?):boolean} A function that ANDs its component\\n * functions.\\n */\\ngoog.functions.and = function(var_args) {\\n 'use strict';\\n const functions = arguments;\\n const length = functions.length;\\n return function() {\\n 'use strict';\\n const self = /** @type {*} */ (this);\\n for (let i = 0; i < length; i++) {\\n if (!functions[i].apply(self, arguments)) {\\n return false;\\n }\\n }\\n return true;\\n };\\n};\\n\\n\\n/**\\n * Creates a function that returns true if any of its components evaluates\\n * to true. The components are evaluated in order, and the evaluation will be\\n * short-circuited as soon as a function returns true.\\n * For example, (goog.functions.or(f, g))(x) is equivalent to f(x) || g(x).\\n * @param {...Function} var_args A list of functions.\\n * @return {function(...?):boolean} A function that ORs its component\\n * functions.\\n */\\ngoog.functions.or = function(var_args) {\\n 'use strict';\\n const functions = arguments;\\n const length = functions.length;\\n return function() {\\n 'use strict';\\n const self = /** @type {*} */ (this);\\n for (let i = 0; i < length; i++) {\\n if (functions[i].apply(self, arguments)) {\\n return true;\\n }\\n }\\n return false;\\n };\\n};\\n\\n\\n/**\\n * Creates a function that returns the Boolean opposite of a provided function.\\n * For example, (goog.functions.not(f))(x) is equivalent to !f(x).\\n * @param {!Function} f The original function.\\n * @return {function(...?):boolean} A function that delegates to f and returns\\n * opposite.\\n */\\ngoog.functions.not = function(f) {\\n 'use strict';\\n return function() {\\n 'use strict';\\n const self = /** @type {*} */ (this);\\n return !f.apply(self, arguments);\\n };\\n};\\n\\n\\n/**\\n * Generic factory function to construct an object given the constructor\\n * and the arguments. Intended to be bound to create object factories.\\n *\\n * Example:\\n *\\n * var factory = goog.partial(goog.functions.create, Class);\\n *\\n * @param {function(new:T, ...)} constructor The constructor for the Object.\\n * @param {...*} var_args The arguments to be passed to the constructor.\\n * @return {T} A new instance of the class given in `constructor`.\\n * @template T\\n * @deprecated This function does not work with ES6 class constructors. Use\\n * arrow functions + spread args instead.\\n */\\ngoog.functions.create = function(constructor, var_args) {\\n 'use strict';\\n /**\\n * @constructor\\n * @final\\n */\\n const temp = function() {};\\n temp.prototype = constructor.prototype;\\n\\n // obj will have constructor's prototype in its chain and\\n // 'obj instanceof constructor' will be true.\\n const obj = new temp();\\n\\n // obj is initialized by constructor.\\n // arguments is only array-like so lacks shift(), but can be used with\\n // the Array prototype function.\\n constructor.apply(obj, Array.prototype.slice.call(arguments, 1));\\n return obj;\\n};\\n\\n\\n/**\\n * @define {boolean} Whether the return value cache should be used.\\n * This should only be used to disable caches when testing.\\n */\\ngoog.functions.CACHE_RETURN_VALUE =\\n goog.define('goog.functions.CACHE_RETURN_VALUE', true);\\n\\n\\n/**\\n * Gives a wrapper function that caches the return value of a parameterless\\n * function when first called.\\n *\\n * When called for the first time, the given function is called and its\\n * return value is cached (thus this is only appropriate for idempotent\\n * functions). Subsequent calls will return the cached return value. This\\n * allows the evaluation of expensive functions to be delayed until first used.\\n *\\n * To cache the return values of functions with parameters, see goog.memoize.\\n *\\n * @param {function():T} fn A function to lazily evaluate.\\n * @return {function():T} A wrapped version the function.\\n * @template T\\n */\\ngoog.functions.cacheReturnValue = function(fn) {\\n 'use strict';\\n let called = false;\\n let value;\\n\\n return function() {\\n 'use strict';\\n if (!goog.functions.CACHE_RETURN_VALUE) {\\n return fn();\\n }\\n\\n if (!called) {\\n value = fn();\\n called = true;\\n }\\n\\n return value;\\n };\\n};\\n\\n\\n/**\\n * Wraps a function to allow it to be called, at most, once. All\\n * additional calls are no-ops.\\n *\\n * This is particularly useful for initialization functions\\n * that should be called, at most, once.\\n *\\n * @param {function():*} f Function to call.\\n * @return {function():undefined} Wrapped function.\\n */\\ngoog.functions.once = function(f) {\\n 'use strict';\\n // Keep a reference to the function that we null out when we're done with\\n // it -- that way, the function can be GC'd when we're done with it.\\n let inner = f;\\n return function() {\\n 'use strict';\\n if (inner) {\\n const tmp = inner;\\n inner = null;\\n tmp();\\n }\\n };\\n};\\n\\n\\n/**\\n * Wraps a function to allow it to be called, at most, once per interval\\n * (specified in milliseconds). If the wrapper function is called N times within\\n * that interval, only the Nth call will go through.\\n *\\n * This is particularly useful for batching up repeated actions where the\\n * last action should win. This can be used, for example, for refreshing an\\n * autocomplete pop-up every so often rather than updating with every keystroke,\\n * since the final text typed by the user is the one that should produce the\\n * final autocomplete results. For more stateful debouncing with support for\\n * pausing, resuming, and canceling debounced actions, use\\n * `goog.async.Debouncer`.\\n *\\n * @param {function(this:SCOPE, ...?)} f Function to call.\\n * @param {number} interval Interval over which to debounce. The function will\\n * only be called after the full interval has elapsed since the last call.\\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\\n * @return {function(...?): undefined} Wrapped function.\\n * @template SCOPE\\n */\\ngoog.functions.debounce = function(f, interval, opt_scope) {\\n 'use strict';\\n let timeout = 0;\\n return /** @type {function(...?)} */ (function(var_args) {\\n 'use strict';\\n goog.global.clearTimeout(timeout);\\n const args = arguments;\\n timeout = goog.global.setTimeout(function() {\\n 'use strict';\\n f.apply(opt_scope, args);\\n }, interval);\\n });\\n};\\n\\n\\n/**\\n * Wraps a function to allow it to be called, at most, once per interval\\n * (specified in milliseconds). If the wrapper function is called N times in\\n * that interval, both the 1st and the Nth calls will go through.\\n *\\n * This is particularly useful for limiting repeated user requests where the\\n * the last action should win, but you also don't want to wait until the end of\\n * the interval before sending a request out, as it leads to a perception of\\n * slowness for the user.\\n *\\n * @param {function(this:SCOPE, ...?)} f Function to call.\\n * @param {number} interval Interval over which to throttle. The function can\\n * only be called once per interval.\\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\\n * @return {function(...?): undefined} Wrapped function.\\n * @template SCOPE\\n */\\ngoog.functions.throttle = function(f, interval, opt_scope) {\\n 'use strict';\\n let timeout = 0;\\n let shouldFire = false;\\n let storedArgs = [];\\n\\n const handleTimeout = function() {\\n 'use strict';\\n timeout = 0;\\n if (shouldFire) {\\n shouldFire = false;\\n fire();\\n }\\n };\\n\\n const fire = function() {\\n 'use strict';\\n timeout = goog.global.setTimeout(handleTimeout, interval);\\n let args = storedArgs;\\n storedArgs = []; // Avoid a space leak by clearing stored arguments.\\n f.apply(opt_scope, args);\\n };\\n\\n return /** @type {function(...?)} */ (function(var_args) {\\n 'use strict';\\n storedArgs = arguments;\\n if (!timeout) {\\n fire();\\n } else {\\n shouldFire = true;\\n }\\n });\\n};\\n\\n\\n/**\\n * Wraps a function to allow it to be called, at most, once per interval\\n * (specified in milliseconds). If the wrapper function is called N times within\\n * that interval, only the 1st call will go through.\\n *\\n * This is particularly useful for limiting repeated user requests where the\\n * first request is guaranteed to have all the data required to perform the\\n * final action, so there's no need to wait until the end of the interval before\\n * sending the request out.\\n *\\n * @param {function(this:SCOPE, ...?)} f Function to call.\\n * @param {number} interval Interval over which to rate-limit. The function will\\n * only be called once per interval, and ignored for the remainer of the\\n * interval.\\n * @param {SCOPE=} opt_scope Object in whose scope to call the function.\\n * @return {function(...?): undefined} Wrapped function.\\n * @template SCOPE\\n */\\ngoog.functions.rateLimit = function(f, interval, opt_scope) {\\n 'use strict';\\n let timeout = 0;\\n\\n const handleTimeout = function() {\\n 'use strict';\\n timeout = 0;\\n };\\n\\n return /** @type {function(...?)} */ (function(var_args) {\\n 'use strict';\\n if (!timeout) {\\n timeout = goog.global.setTimeout(handleTimeout, interval);\\n f.apply(opt_scope, arguments);\\n }\\n });\\n};\\n\\n/**\\n * Returns true if the specified value is a function.\\n * @param {*} val Variable to test.\\n * @return {boolean} Whether variable is a function.\\n */\\ngoog.functions.isFunction = (val) => {\\n return typeof val === 'function';\\n};\\n\"],\n\"names\":[\"goog\",\"provide\",\"functions\",\"constant\",\"goog.functions.constant\",\"retValue\",\"FALSE\",\"goog.functions.FALSE\",\"TRUE\",\"goog.functions.TRUE\",\"NULL\",\"goog.functions.NULL\",\"UNDEFINED\",\"goog.functions.UNDEFINED\",\"undefined\",\"EMPTY\",\"identity\",\"goog.functions.identity\",\"opt_returnValue\",\"var_args\",\"error\",\"goog.functions.error\",\"message\",\"Error\",\"fail\",\"goog.functions.fail\",\"err\",\"lock\",\"goog.functions.lock\",\"f\",\"opt_numArgs\",\"self\",\"apply\",\"Array\",\"prototype\",\"slice\",\"call\",\"arguments\",\"nth\",\"goog.functions.nth\",\"n\",\"partialRight\",\"goog.functions.partialRight\",\"fn\",\"rightArgs\",\"global\",\"newArgs\",\"push\",\"withReturnValue\",\"goog.functions.withReturnValue\",\"sequence\",\"equalTo\",\"goog.functions.equalTo\",\"value\",\"opt_useLooseComparison\",\"other\",\"compose\",\"goog.functions.compose\",\"length\",\"result\",\"i\",\"goog.functions.sequence\",\"and\",\"goog.functions.and\",\"or\",\"goog.functions.or\",\"not\",\"goog.functions.not\",\"create\",\"goog.functions.create\",\"constructor\",\"temp\",\"obj\",\"CACHE_RETURN_VALUE\",\"define\",\"cacheReturnValue\",\"goog.functions.cacheReturnValue\",\"called\",\"once\",\"goog.functions.once\",\"inner\",\"tmp\",\"debounce\",\"goog.functions.debounce\",\"interval\",\"opt_scope\",\"timeout\",\"clearTimeout\",\"args\",\"setTimeout\",\"throttle\",\"goog.functions.throttle\",\"shouldFire\",\"storedArgs\",\"handleTimeout\",\"fire\",\"rateLimit\",\"goog.functions.rateLimit\",\"isFunction\",\"val\",\"goog.functions.isFunction\"]\n}\n"]