UNPKG

@railzai/railz-visualizations

Version:
1,217 lines (1,131 loc) 141 kB
/*! * Accounting Data as a Service™ is the solution that makes sense of your business customers' financial data. * Built with Stencil * Copyright (c) FIS. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); const index = require('./index-7829b74b.js'); const en = require('./en-4ea7a4ad.js'); const chart_utils = require('./chart.utils-652dfce2.js'); const financialRatios = require('./financial-ratios-8bba8608.js'); const isEmpty = require('./isEmpty-a87fbcad.js'); const isEqual = require('./isEqual-d0f95783.js'); const fonts = require('./fonts-877d8e4b.js'); const accessibility = require('./accessibility-729c1598.js'); const _commonjsHelpers = require('./_commonjsHelpers-7cfde13a.js'); const colors = require('./colors-c18d54d3.js'); require('./endpoints-d1a2add3.js'); /** Used to match a single whitespace character. */ var reWhitespace = /\s/; /** * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace * character of `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the index of the last non-whitespace character. */ function trimmedEndIndex(string) { var index = string.length; while (index-- && reWhitespace.test(string.charAt(index))) {} return index; } /** Used to match leading whitespace. */ var reTrimStart = /^\s+/; /** * The base implementation of `_.trim`. * * @private * @param {string} string The string to trim. * @returns {string} Returns the trimmed string. */ function baseTrim(string) { return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') : string; } /** Used as references for various `Number` constants. */ var NAN = 0 / 0; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (chart_utils.isSymbol(value)) { return NAN; } if (isEmpty.isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isEmpty.isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = baseTrim(value); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } /** * The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function baseSlice(array, start, end) { var index = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : (length + start); } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : ((end - start) >>> 0); start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } /** * Casts `array` to a slice if it's needed. * * @private * @param {Array} array The array to inspect. * @param {number} start The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the cast slice. */ function castSlice(array, start, end) { var length = array.length; end = end === undefined ? length : end; return (!start && end >= length) ? array : baseSlice(array, start, end); } /** Used to compose unicode character classes. */ var rsAstralRange$2 = '\\ud800-\\udfff', rsComboMarksRange$3 = '\\u0300-\\u036f', reComboHalfMarksRange$3 = '\\ufe20-\\ufe2f', rsComboSymbolsRange$3 = '\\u20d0-\\u20ff', rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3, rsVarRange$2 = '\\ufe0e\\ufe0f'; /** Used to compose unicode capture groups. */ var rsZWJ$2 = '\\u200d'; /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ var reHasUnicode = RegExp('[' + rsZWJ$2 + rsAstralRange$2 + rsComboRange$3 + rsVarRange$2 + ']'); /** * Checks if `string` contains Unicode symbols. * * @private * @param {string} string The string to inspect. * @returns {boolean} Returns `true` if a symbol is found, else `false`. */ function hasUnicode(string) { return reHasUnicode.test(string); } /** * Converts an ASCII `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function asciiToArray(string) { return string.split(''); } /** Used to compose unicode character classes. */ var rsAstralRange$1 = '\\ud800-\\udfff', rsComboMarksRange$2 = '\\u0300-\\u036f', reComboHalfMarksRange$2 = '\\ufe20-\\ufe2f', rsComboSymbolsRange$2 = '\\u20d0-\\u20ff', rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2, rsVarRange$1 = '\\ufe0e\\ufe0f'; /** Used to compose unicode capture groups. */ var rsAstral = '[' + rsAstralRange$1 + ']', rsCombo$2 = '[' + rsComboRange$2 + ']', rsFitz$1 = '\\ud83c[\\udffb-\\udfff]', rsModifier$1 = '(?:' + rsCombo$2 + '|' + rsFitz$1 + ')', rsNonAstral$1 = '[^' + rsAstralRange$1 + ']', rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsZWJ$1 = '\\u200d'; /** Used to compose unicode regexes. */ var reOptMod$1 = rsModifier$1 + '?', rsOptVar$1 = '[' + rsVarRange$1 + ']?', rsOptJoin$1 = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*', rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1, rsSymbol = '(?:' + [rsNonAstral$1 + rsCombo$2 + '?', rsCombo$2, rsRegional$1, rsSurrPair$1, rsAstral].join('|') + ')'; /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reUnicode = RegExp(rsFitz$1 + '(?=' + rsFitz$1 + ')|' + rsSymbol + rsSeq$1, 'g'); /** * Converts a Unicode `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function unicodeToArray(string) { return string.match(reUnicode) || []; } /** * Converts `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function stringToArray(string) { return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); } /** * Creates a function like `_.lowerFirst`. * * @private * @param {string} methodName The name of the `String` case method to use. * @returns {Function} Returns the new case function. */ function createCaseFirst(methodName) { return function(string) { string = chart_utils.toString(string); var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined; var chr = strSymbols ? strSymbols[0] : string.charAt(0); var trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1); return chr[methodName]() + trailing; }; } /** * Converts the first character of `string` to upper case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.upperFirst('fred'); * // => 'Fred' * * _.upperFirst('FRED'); * // => 'FRED' */ var upperFirst = createCaseFirst('toUpperCase'); /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * The base implementation of `_.propertyOf` without support for deep paths. * * @private * @param {Object} object The object to query. * @returns {Function} Returns the new accessor function. */ function basePropertyOf(object) { return function(key) { return object == null ? undefined : object[key]; }; } /** Used to map Latin Unicode letters to basic Latin letters. */ var deburredLetters = { // Latin-1 Supplement block. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss', // Latin Extended-A block. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', '\u0134': 'J', '\u0135': 'j', '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', '\u0163': 't', '\u0165': 't', '\u0167': 't', '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', '\u0174': 'W', '\u0175': 'w', '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', '\u0132': 'IJ', '\u0133': 'ij', '\u0152': 'Oe', '\u0153': 'oe', '\u0149': "'n", '\u017f': 's' }; /** * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A * letters to basic Latin letters. * * @private * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ var deburrLetter = basePropertyOf(deburredLetters); /** Used to match Latin Unicode letters (excluding mathematical operators). */ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; /** Used to compose unicode character classes. */ var rsComboMarksRange$1 = '\\u0300-\\u036f', reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f', rsComboSymbolsRange$1 = '\\u20d0-\\u20ff', rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1; /** Used to compose unicode capture groups. */ var rsCombo$1 = '[' + rsComboRange$1 + ']'; /** * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). */ var reComboMark = RegExp(rsCombo$1, 'g'); /** * Deburrs `string` by converting * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) * letters to basic Latin letters and removing * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); * // => 'deja vu' */ function deburr(string) { string = chart_utils.toString(string); return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); } /** Used to match words composed of alphanumeric characters. */ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; /** * Splits an ASCII `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function asciiWords(string) { return string.match(reAsciiWord) || []; } /** Used to detect strings that need a more robust regexp to match words. */ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** * Checks if `string` contains a word composed of Unicode symbols. * * @private * @param {string} string The string to inspect. * @returns {boolean} Returns `true` if a word is found, else `false`. */ function hasUnicodeWord(string) { return reHasUnicodeWord.test(string); } /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f', reComboHalfMarksRange = '\\ufe20-\\ufe2f', rsComboSymbolsRange = '\\u20d0-\\u20ff', rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsPunctuationRange = '\\u2000-\\u206f', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; /** Used to compose unicode capture groups. */ var rsApos$1 = "['\u2019]", rsBreak = '[' + rsBreakRange + ']', rsCombo = '[' + rsComboRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; /** Used to compose unicode regexes. */ var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', rsOptContrLower = '(?:' + rsApos$1 + '(?:d|ll|m|re|s|t|ve))?', rsOptContrUpper = '(?:' + rsApos$1 + '(?:D|LL|M|RE|S|T|VE))?', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq; /** Used to match complex or compound words. */ var reUnicodeWord = RegExp([ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji ].join('|'), 'g'); /** * Splits a Unicode `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function unicodeWords(string) { return string.match(reUnicodeWord) || []; } /** * Splits `string` into an array of its words. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the words of `string`. * @example * * _.words('fred, barney, & pebbles'); * // => ['fred', 'barney', 'pebbles'] * * _.words('fred, barney, & pebbles', /[^, ]+/g); * // => ['fred', 'barney', '&', 'pebbles'] */ function words(string, pattern, guard) { string = chart_utils.toString(string); pattern = guard ? undefined : pattern; if (pattern === undefined) { return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); } return string.match(pattern) || []; } /** Used to compose unicode capture groups. */ var rsApos = "['\u2019]"; /** Used to match apostrophes. */ var reApos = RegExp(rsApos, 'g'); /** * Creates a function like `_.camelCase`. * * @private * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { return function(string) { return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); }; } /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @since 2.4.0 * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => Logs the number of milliseconds it took for the deferred invocation. */ var now = function() { return isEmpty.root.Date.now(); }; /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max, nativeMin = Math.min; /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide `options` to indicate whether `func` should be invoked on the * leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent * calls to the debounced function return the result of the last `func` * invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=false] * Specify invoking on the leading edge of the timeout. * @param {number} [options.maxWait] * The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isEmpty.isObject(options)) { leading = !!options.leading; maxing = 'maxWait' in options; maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { if (timerId !== undefined) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { return timerId === undefined ? result : trailingEdge(now()); } function debounced() { var time = now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } /** * Converts `string` to * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). * * @static * @memberOf _ * @since 3.1.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the start cased string. * @example * * _.startCase('--foo-bar--'); * // => 'Foo Bar' * * _.startCase('fooBar'); * // => 'Foo Bar' * * _.startCase('__FOO_BAR__'); * // => 'FOO BAR' */ var startCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + upperFirst(word); }); /** * Make API call based on expected parameters for table account data type */ const getReportData$6 = async ({ filter, }) => { let reportData; const pickedFilter = Object.assign({}, chart_utils.pick(filter, [financialRatios.RVParams.CONNECTION_UUID])); //TODO END try { reportData = await chart_utils.RequestServiceInstance.getReportData({ path: financialRatios.RVReportTypesUrlMapping[filter.reportType], filter: pickedFilter, }); } catch (error) { chart_utils.errorLog(en.Translations.RV_NOT_ABLE_TO_RETRIEVE_REPORT_DATA, error); reportData = { error }; } return reportData; }; const bankAccountsCss = "@font-face{font-family:Inter;src:url(\"../assets/fonts/Inter-italic-var.woff2\");font-family:Inter;src:url(\"../assets/fonts/Inter-upright-var.woff2\")}body,div[class^=railz-],div[class*=\" railz-\"]{font-family:Inter, Roboto, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}.rv-container{display:flex;padding:16px;position:relative;border:1px solid #eee;border-radius:7px;flex-direction:column;height:202px;line-height:21px}.rv-container *{font-family:Inter, Roboto, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}.rv-container .rv-bank-list{overflow:auto}.rv-header-container{display:flex}.rv-title{display:flex;color:#015b7e;font-size:18px;font-weight:600;margin:0;padding:0;text-align:left;flex-grow:1;line-height:1.235}.rv-bank-accounts-ul{list-style-type:none;font-weight:400;margin:0;padding:8px 0}.rv-bank-accounts-ul-title{padding-top:8px;color:black;line-height:28px;font-size:14px;font-weight:500;text-align:left}.rv-bank-accounts-item-container{display:flex;justify-content:space-between;padding:4px 0}.rv-bank-accounts-item-name{color:#424242;font-size:14px;font-weight:500}.rv-bank-accounts-item-dot{margin:0 16px 8px;display:flex;flex-grow:1;border-bottom:1px dashed #9e9e9e}.rv-bank-accounts-item-value{text-align:end;color:#212121;font-size:14px;font-weight:700}"; const BanksAccounts = class { constructor(hostRef) { index.registerInstance(this, hostRef); this.loading = ''; this.propsUpdated = async (triggerRequest = true) => { await this.validateParams(this.configuration, this.filter, this.options, triggerRequest); }; /** * Validates if configuration was passed correctly before setting filter * @param configuration - Config for authentication * @param filter - filter to decide chart type to show * @param options: Whitelabeling options * @param triggerRequest - indicate if api request should be made */ this.validateParams = async (configuration, filter, options, triggerRequest = true) => { this._configuration = chart_utils.getConfiguration(configuration); if (this._configuration) { chart_utils.ConfigurationInstance.configuration = this._configuration; try { this._filter = chart_utils.getFilter(filter); this._options = chart_utils.getOptions(options); if (chart_utils.validateRequiredParams(this._filter)) { if (chart_utils.isBankAccounts(this._filter.reportType)) { if (triggerRequest) { await this.requestReportData(); } } else { this.errorStatusCode = 500; chart_utils.errorLog(en.Translations.RV_ERROR_INVALID_REPORT_TYPE); } } else { this.errorStatusCode = 204; } } catch (e) { this.errorStatusCode = 500; chart_utils.errorLog(e); } } else { this.errorStatusCode = 0; } }; /** * Request report data based on filter and configuration param */ this.requestReportData = async () => { var _a; this.errorStatusCode = undefined; this.loading = en.Translations.RV_LOADING_REPORT; try { const reportData = (await getReportData$6({ filter: this._filter, })); this._summary = reportData.data; if (((_a = reportData === null || reportData === void 0 ? void 0 : reportData.error) === null || _a === void 0 ? void 0 : _a.message[0]) === 'Service provider not supported') { chart_utils.errorLog(en.Translations.DASHBOARD_FINANCIAL_SUMMARY_CHART_ERROR_ASP_NOT_SUPPORTED); this.errorStatusCode = 404; } else if (isEmpty.isEmpty(this._summary)) { this.errorStatusCode = 204; } } catch (error) { chart_utils.errorLog(en.Translations.RV_NOT_ABLE_TO_PARSE_REPORT_DATA, error); } finally { this.loading = ''; } }; this.renderMain = () => { var _a, _b, _c, _d; if (this.errorStatusCode !== undefined) { return (index.h("railz-error-image", Object.assign({ statusCode: this.errorStatusCode || 500 }, (_a = this._options) === null || _a === void 0 ? void 0 : _a.errorIndicator))); } if (!isEmpty.isEmpty(this.loading)) { return index.h("railz-loading", Object.assign({ loadingText: this.loading }, (_b = this._options) === null || _b === void 0 ? void 0 : _b.loadingIndicator)); } const diffBanks = this.getAllBanks(); return (!isEmpty.isEmpty(this._summary) && (index.h("div", { class: "rv-bank-list" }, index.h("ul", { class: "rv-bank-accounts-ul", style: (_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.table) === null || _d === void 0 ? void 0 : _d.style }, Object.keys(diffBanks).map((bank) => { var _a, _b; return (index.h("div", null, index.h("li", { class: "rv-bank-accounts-ul-title", style: (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.table) === null || _b === void 0 ? void 0 : _b.title }, bank), diffBanks[bank].map((bankAccount) => { var _a, _b, _c, _d, _e, _f, _g, _h; return (index.h("li", null, index.h("div", { class: "rv-bank-accounts-item-container", style: (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.table) === null || _b === void 0 ? void 0 : _b.itemContainer }, index.h("span", { class: "rv-bank-accounts-item-name", style: (_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.table) === null || _d === void 0 ? void 0 : _d.itemName }, bankAccount.accountName), index.h("span", { class: "rv-bank-accounts-item-dot", style: (_f = (_e = this._options) === null || _e === void 0 ? void 0 : _e.table) === null || _f === void 0 ? void 0 : _f.itemSeperator }), index.h("span", { class: "rv-bank-accounts-item-value", style: (_h = (_g = this._options) === null || _g === void 0 ? void 0 : _g.table) === null || _h === void 0 ? void 0 : _h.itemValue }, "$", chart_utils.formatNumber(bankAccount.currentBalance, 2, 2))))); }))); }))))); }; } async watchConfiguration(newValue, oldValue) { if (newValue && oldValue && !isEqual.isEqual(oldValue, newValue)) { await this.validateParams(newValue, this.filter, this.options); } } async watchFilter(newValue, oldValue) { if (newValue && oldValue && !isEqual.isEqual(oldValue, newValue)) { await this.validateParams(this.configuration, newValue, this.options); } } async watchOptions(newValue, oldValue) { if (newValue && oldValue && !isEqual.isEqual(oldValue, newValue)) { await this.validateParams(this.configuration, this.filter, newValue); } } componentWillLoad() { this.propsUpdated && this.propsUpdated(); } getAllBanks() { var _a; const institutionNames = (_a = this._summary) === null || _a === void 0 ? void 0 : _a.map(({ institutionName }) => institutionName); const uniqueBankAccounts = new Set(institutionNames); const diffBanks = {}; uniqueBankAccounts.forEach((institutionName) => { var _a; diffBanks[institutionName] = (_a = this._summary) === null || _a === void 0 ? void 0 : _a.filter(({ institutionName: internalInstitutionName }) => internalInstitutionName === institutionName); }); return diffBanks; } render() { var _a, _b, _c, _d; if (this.errorStatusCode === 0) { return null; } const TitleElement = () => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r; return (index.h("p", { class: "rv-title", style: (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.title) === null || _b === void 0 ? void 0 : _b.style }, ((_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.title) || chart_utils.getTitleByReportType((_e = this._filter) === null || _e === void 0 ? void 0 : _e.reportType) || '', ' ', ((_g = (_f = this._options) === null || _f === void 0 ? void 0 : _f.tooltipIndicator) === null || _g === void 0 ? void 0 : _g.visible) && ((_k = (_j = (_h = this._options) === null || _h === void 0 ? void 0 : _h.content) === null || _j === void 0 ? void 0 : _j.tooltip) === null || _k === void 0 ? void 0 : _k.description) ? (index.h("railz-tooltip", { tooltipStyle: Object.assign(Object.assign({ position: 'bottom-center' }, (_l = this._options) === null || _l === void 0 ? void 0 : _l.tooltipIndicator), { style: Object.assign({ marginLeft: '5px' }, (_o = (_m = this._options) === null || _m === void 0 ? void 0 : _m.tooltipIndicator) === null || _o === void 0 ? void 0 : _o.style) }), tooltipText: (_r = (_q = (_p = this._options) === null || _p === void 0 ? void 0 : _p.content) === null || _q === void 0 ? void 0 : _q.tooltip) === null || _r === void 0 ? void 0 : _r.description })) : null)); }; return (index.h("div", { class: "rv-container", style: (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.container) === null || _b === void 0 ? void 0 : _b.style }, index.h("div", { class: "rv-header-container" }, ((_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.title) === null || _d === void 0 ? void 0 : _d.visible) === false ? '' : index.h(TitleElement, null)), this.renderMain())); } static get watchers() { return { "configuration": ["watchConfiguration"], "filter": ["watchFilter"], "options": ["watchOptions"] }; } }; BanksAccounts.style = bankAccountsCss; /* eslint-disable @typescript-eslint/no-unused-vars */ const CheckCircleIcon = () => { return (index.h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M8 0C3.584 0 0 3.584 0 8C0 12.416 3.584 16 8 16C12.416 16 16 12.416 16 8C16 3.584 12.416 0 8 0ZM6.4 12L2.4 8L3.528 6.872L6.4 9.736L12.472 3.664L13.6 4.8L6.4 12Z", fill: "#30A665" }))); }; const ErrorIcon = () => { return (index.h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M8 0C3.584 0 0 3.584 0 8C0 12.416 3.584 16 8 16C12.416 16 16 12.416 16 8C16 3.584 12.416 0 8 0ZM8.8 12H7.2V10.4H8.8V12ZM8.8 8.8H7.2V4H8.8V8.8Z", fill: "#F2A74C" }))); }; const formatReconciliatedData = (data) => { let matchedItems = 0; let unmatchedItems = 0; let bankTransactionsValue = 0; let accountingTransactionsValue = 0; let reconciledTransactionsAbsValue = 0; if (data === null || data === void 0 ? void 0 : data.reports) { for (const reportItem of data.reports) { for (const dataItem of reportItem.data) { bankTransactionsValue += dataItem.bankTransactionsTotalValue ? dataItem.bankTransactionsTotalValue : 0; accountingTransactionsValue += dataItem.accountingTransactionsTotalValue ? dataItem.accountingTransactionsTotalValue : 0; if (dataItem['unreconciledBankTransactions']) { unmatchedItems += dataItem['unreconciledBankTransactions'].length; } if (dataItem['reconciledBankTransactions']) { for (const transaction of dataItem['reconciledBankTransactions']) { matchedItems++; reconciledTransactionsAbsValue += Math.abs(transaction.amount); } } } } } return { accuracyScore: Math.round((reconciledTransactionsAbsValue / bankTransactionsValue) * 100), bankBalance: bankTransactionsValue, accountingBalance: accountingTransactionsValue, matchedTransactions: matchedItems, totalTransations: unmatchedItems + matchedItems, }; }; /** * Make API call based on expected parameters for score data type */ const getReportData$5 = async ({ filter, }) => { let reportData; try { let startDate; let endDate; try { startDate = chart_utils.format(chart_utils.parseISO(filter.startDate), chart_utils.RAILZ_DATE_FORMAT); } catch (error) { chart_utils.errorLog(en.Translations.RV_ERROR_START_DATE); } try { endDate = chart_utils.format(chart_utils.parseISO(filter.endDate), chart_utils.RAILZ_DATE_FORMAT); } catch (error) { chart_utils.errorLog(en.Translations.RV_ERROR_END_DATE); } const allParameters = chart_utils.pick(Object.assign(Object.assign({}, filter), { startDate, endDate }), [ 'startDate', 'endDate', 'connectionUuid', ]); allParameters.offset = 0; allParameters.limit = 100; allParameters.orderBy = '-date'; reportData = await chart_utils.RequestServiceInstance.getReportData({ path: financialRatios.RVReportTypesUrlMapping[filter.reportType], filter: allParameters, }); } catch (error) { chart_utils.errorLog(en.Translations.RV_NOT_ABLE_TO_RETRIEVE_REPORT_DATA, error); reportData = { error }; } return reportData; }; const bankReconciliationCss = "@font-face{font-family:Inter;src:url(\"../assets/fonts/Inter-italic-var.woff2\");font-family:Inter;src:url(\"../assets/fonts/Inter-upright-var.woff2\")}body,div[class^=railz-],div[class*=\" railz-\"]{font-family:Inter, Roboto, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}.rv-container{display:flex;gap:24px;position:relative;flex-direction:row}@media screen and (max-width: 600px){.rv-container{flex-direction:column}}.rv-container p{margin-block:0}.rv-container *{font-family:Inter, Roboto, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}.rv-grid{padding:16px;min-height:102px;box-shadow:0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);border-radius:4px;display:flex;flex-direction:column;gap:24px;width:100%}@media screen and (max-width: 600px){.rv-grid{width:\"auto\"}}.rv-grid-accuracy-score{padding:16px;min-height:102px;box-shadow:0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);border-radius:4px;display:flex;flex-direction:column;gap:24px;width:100%;max-width:264px}@media screen and (max-width: 600px){.rv-grid-accuracy-score{max-width:100%}}.rv-title{font-size:18px;font-weight:600;color:#616161;line-height:1.235}.rv-subtitle{font-size:12px;font-weight:500;overflow-wrap:break-word;color:rgba(0, 0, 0, 0.87);line-height:1.235}.rv-section-container{display:flex;flex-direction:row;align-items:center;gap:16px}.rv-matched-insight-section-container{align-items:unset}@media screen and (max-width: 600px){.rv-matched-insight-section-container{flex-direction:column}}.rv-section-child-container{display:flex;flex-direction:column;justify-content:space-between;text-align:center;gap:8px;width:calc(100% + 8px);margin:-4px}.rv-bar-text{font-size:12px;font-weight:500;color:rgba(0, 0, 0, 0.87);text-align:center}.rv-section-item{padding:4px;width:100%;max-width:100%}.rv-section-number{font-size:18px;font-weight:600;flex:1}.rv-section-equals{margin-top:-8px;align-self:center}.rv-section-number-icon{font-size:18px;font-weight:600;flex:0}.rv-section-icon{flex:1;gap:8px;display:flex;flex-direction:row;justify-content:center}.rv-icon{margin-top:4px}@media screen and (max-width: 900px){.rv-icon{display:none}}.rv-matched-insight-subtitle{font-weight:600;letter-spacing:0.06em;color:#616161;text-transform:uppercase}@media screen and (max-width: 600px){.rv-matched-insight-subtitle{text-align:center;margin-left:0}}"; const BankReconciliation = class { constructor(hostRef) { index.registerInstance(this, hostRef); this.loading = ''; this.updateBankReconciliationParams = (summary) => { const params = formatReconciliatedData(summary); if (params) { this.loading = ''; this.accuracyScore = params.accuracyScore; this.bankBalance = params.bankBalance; this.accountingBalance = params.accountingBalance; this.matchedTransactions = params.matchedTransactions; this.totalTransations = params.totalTransations; } }; /** * Validates if configuration was passed correctly before setting filter * @param configuration - Config for authentication * @param filter - filter to decide chart type to show * @param options: Whitelabeling options * @param triggerRequest - indicate if api request should be made */ this.validateParams = async (configuration, filter, options, triggerRequest = true) => { this._configuration = chart_utils.getConfiguration(configuration); if (this._configuration) { chart_utils.ConfigurationInstance.configuration = this._configuration; try { this._filter = chart_utils.getFilter(filter); this._options = chart_utils.getOptions(options); if (chart_utils.validateRequiredParams(this._filter)) { if (chart_utils.isBankReconciliation(this._filter.reportType)) { if (triggerRequest) { await this.requestReportData(); } } else { this.errorStatusCode = 500; chart_utils.errorLog(en.Translations.RV_ERROR_INVALID_REPORT_TYPE); } } else { this.errorStatusCode = 204; } } catch (e) { this.errorStatusCode = 500; chart_utils.errorLog(e); } } else { this.errorStatusCode = 0; } }; this.propsUpdated = async (triggerRequest = true) => { await this.validateParams(this.configuration, this.filter, this.options, triggerRequest); }; /** * Request report data based on filter and configuration param * Formats retrieved data into Highcharts format using formatData */ this.requestReportData = async () => { var _a; this.errorStatusCode = undefined; this.loading = en.Translations.RV_LOADING_REPORT; try { const reportData = (await getReportData$5({ filter: this._filter, })); if (reportData === null || reportData === void 0 ? void 0 : reportData.reports) { this.updateBankReconciliationParams(reportData); } else if (((_a = reportData === null || reportData === void 0 ? void 0 : reportData.error) === null || _a === void 0 ? void 0 : _a.message[0]) === 'Business has no bank data') { chart_utils.errorLog(en.Translations.RV_ERROR_422_TITLE); this.errorStatusCode = 422; } else { this.errorStatusCode = chart_utils.handleError(reportData); } } catch (error) { chart_utils.errorLog(en.Translations.RV_NOT_ABLE_TO_PARSE_REPORT_DATA, error); } finally { this.loading = ''; } }; } async watchConfiguration(newValue, oldValue) { if (newValue && oldValue && !isEqual.isEqual(oldValue, newValue)) { await this.validateParams(newValue, this.filter, this.options); } } async watchFilter(newValue, oldValue) { if (newValue && oldValue && !isEqual.isEqual(oldValue, newValue)) { await this.validateParams(this.configuration, newValue, this.options); } } async watchOptions(newValue, oldValue) { if (newValue && oldValue && !isEqual.isEqual(oldValue, newValue)) { await this.validateParams(this.configuration, this.filter, newValue); } } componentWillLoad() { this._options = chart_utils.getBankReconciliationOptionsStyle(this.options); this.propsUpdated && this.propsUpdated(); } render() { var _a, _b, _c; if (this.errorStatusCode !== undefined) { return (index.h("railz-error-image", Object.assign({ statusCode: this.errorStatusCode || 500 }, (_a = this._options) === null || _a === void 0 ? void 0 : _a.errorIndicator))); } if (chart_utils.isNil(this.accuracyScore) || chart_utils.isNil(this.bankBalance) || chart_utils.isNil(this.accountingBalance) || chart_utils.isNil(this.matchedTransactions) || chart_utils.isNil(this.totalTransations) || !isEmpty.isEmpty(this.loading)) { return index.h("span", null); } const getColor = (score) => { if (score < 50) { return '#FFD738'; } if (score < 75) { return '#009BBD'; } return '#00884F'; }; const getData = (score) => { return [score]; }; const accuracyScoreChartOptions = { chart: { height: '64px', width: '64px', type: 'circle', gauge: { startAngle: 0, endAngle: 360, size: '100%', innerRadius: '80%', getColor: getColor, getData: getData, maxScore: 100, }, }, }; const AccuracyScore = () => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; return (index.h("div", { class: "rv-grid-accuracy-score", style: (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.reconciliation) === null || _b === void 0 ? void 0 : _b.gridAccuracyScore }, index.h("div", { class: "rv-section-container", style: (_d = (_c = this._options) === null || _c === void 0 ? void 0 : _c.reconciliation) === null || _d === void 0 ? void 0 : _d.sectionContainer }, index.h("p", { class: "rv-title", style: (_f = (_e = this._options) === null || _e === void 0 ? void 0 : _e.reconciliation) === null || _f === void 0 ? void 0 : _f.title }, en.Translations.RV_BANK_RECONCILIATION_ACCURACY_SCORE), index.h("railz-tooltip", { tooltipStyle: Object.assign(Object.assign({ position: 'bottom-center' }, (_g = this._options) === null || _g === void 0 ? void 0 : _g.tooltipIndicator), { style: Object.assign({ marginLeft: '5px' }, (_j = (_h = this._options) === null || _h === void 0 ? void 0 : _h.tooltipIndicator) === null || _j === void 0 ? void 0 : _j.style) }), tooltipText: ((_o = (_m = (_l = (_k = this._options) === null || _k === void 0 ? void 0 : _k.reconciliation) === null || _l === void 0 ? void 0 : _l.accuracyScoreContent) === null || _m === void 0 ? void 0 : _m.tooltip) === null || _o === void 0 ? void 0 : _o.description) || en.Translations[`RV_TOOLTIP_ACCURACY_SCORE`] })), index.h("div", { class: "rv-section-container", style: (_q = (_p = this._options) === null || _p === void 0 ? void 0 : _p.reconciliation) === null || _q === void 0 ? void 0 : _q.sectionContainer }, index.h("railz-gauge-chart", { options: accuracyScoreChartOptions, data: { score: this.accuracyScore, rating: '', lastUpdated: ''