{"version":3,"sources":["node_modules/@newrelic/browser-agent/dist/esm/common/util/invoke.js"],"sourcesContent":["/**\n * Reduce the invocation of the supplied function so that it is only invoked\n * once within a given timeout.\n *\n * If `wait` is `0`, the function will be invoked during the next tick.\n * If `options.leading` is false or not provided, the function will be invoked\n * N milliseconds after the last invocation of the returned function where\n * N is the `timeout` value.\n * If `options.leading` is true, the function will be invoked immediately upon\n * the first invocation of the returned function and not again for N milliseconds\n * where N is the `timeout` value.\n * @param {function} func Function whose invocation should be limited so it is only invoked\n * once within a given timeout period.\n * @param {number} timeout Time in milliseconds that the function should only be invoked\n * once within.\n * @param {object} options Debounce options\n * @param {boolean} options.leading Forces the function to be invoked on the first\n * invocation of the returned function instead of N milliseconds after the last\n * invocation.\n * @returns {function} A wrapping function that will ensure the provided function\n * is invoked only once within the given timeout.\n */\nexport function debounce(func) {\n var _this = this;\n let timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n const leading = options?.leading || false;\n let timer;\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (leading && timer === undefined) {\n func.apply(_this, args);\n timer = setTimeout(() => {\n timer = clearTimeout(timer);\n }, timeout);\n }\n if (!leading) {\n clearTimeout(timer);\n timer = setTimeout(() => {\n func.apply(_this, args);\n }, timeout);\n }\n };\n}\n\n/**\n * Reduce the invocation of the supplied function so that it is only invoked\n * once.\n * @param {function} func Function whose invocation should be limited so it is only invoked\n * once.\n * @returns {function} A wrapping function that will ensure the provided function\n * is invoked only once.\n */\nexport function single(func) {\n var _this2 = this;\n let called = false;\n return function () {\n if (!called) {\n called = true;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n func.apply(_this2, args);\n }\n };\n}"],"mappings":"AAsBO,SAASA,EAASC,EAAM,CAC7B,IAAIC,EAAQ,KACZ,IAAIC,EAAU,UAAU,OAAS,GAAK,UAAU,CAAC,IAAM,OAAY,UAAU,CAAC,EAAI,IAE5EC,GADQ,UAAU,OAAS,GAAK,UAAU,CAAC,IAAM,OAAY,UAAU,CAAC,EAAI,CAAC,IAC1D,SAAW,GAChCC,EACJ,OAAO,UAAY,CACjB,QAASC,EAAO,UAAU,OAAQC,EAAO,IAAI,MAAMD,CAAI,EAAGE,EAAO,EAAGA,EAAOF,EAAME,IAC/ED,EAAKC,CAAI,EAAI,UAAUA,CAAI,EAEzBJ,GAAWC,IAAU,SACvBJ,EAAK,MAAMC,EAAOK,CAAI,EACtBF,EAAQ,WAAW,IAAM,CACvBA,EAAQ,aAAaA,CAAK,CAC5B,EAAGF,CAAO,GAEPC,IACH,aAAaC,CAAK,EAClBA,EAAQ,WAAW,IAAM,CACvBJ,EAAK,MAAMC,EAAOK,CAAI,CACxB,EAAGJ,CAAO,EAEd,CACF,CAUO,SAASM,EAAOR,EAAM,CAC3B,IAAIS,EAAS,KACb,IAAIC,EAAS,GACb,OAAO,UAAY,CACjB,GAAI,CAACA,EAAQ,CACXA,EAAS,GACT,QAASC,EAAQ,UAAU,OAAQL,EAAO,IAAI,MAAMK,CAAK,EAAGC,EAAQ,EAAGA,EAAQD,EAAOC,IACpFN,EAAKM,CAAK,EAAI,UAAUA,CAAK,EAE/BZ,EAAK,MAAMS,EAAQH,CAAI,CACzB,CACF,CACF","names":["debounce","func","_this","timeout","leading","timer","_len","args","_key","single","_this2","called","_len2","_key2"],"x_google_ignoreList":[0]}