mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 01:51:03 +00:00
1 line
17 KiB
Plaintext
1 line
17 KiB
Plaintext
{"dependencies":[{"name":"../bn/toBn.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":4,"column":18,"index":127},"end":{"line":4,"column":42,"index":151}}],"key":"H17FLHahEUdM5YAMjIvTFqUxlYc=","exportNames":["*"],"imports":1}},{"name":"../is/boolean.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":5,"column":21,"index":174},"end":{"line":5,"column":48,"index":201}}],"key":"1Ex1/+23k7bl1JHRUAPQZaUeroo=","exportNames":["*"],"imports":1}},{"name":"./formatDecimal.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":6,"column":27,"index":230},"end":{"line":6,"column":56,"index":259}}],"key":"ea+5HXvxCez7OfPOIVGhq4b5Qbo=","exportNames":["*"],"imports":1}},{"name":"./getSeparator.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":7,"column":26,"index":287},"end":{"line":7,"column":54,"index":315}}],"key":"1rwcwRN1INChBgEJKYve7TSyuEk=","exportNames":["*"],"imports":1}},{"name":"./si.js","data":{"asyncType":null,"isESMImport":false,"locs":[{"start":{"line":8,"column":16,"index":333},"end":{"line":8,"column":34,"index":351}}],"key":"vdgo+GP7uMS4T+IwRM536Lpy1jo=","exportNames":["*"],"imports":1}}],"output":[{"data":{"code":"__d(function (global, require, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {\n \"use strict\";\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.formatBalance = void 0;\n const toBn_js_1 = require(_dependencyMap[0], \"../bn/toBn.js\");\n const boolean_js_1 = require(_dependencyMap[1], \"../is/boolean.js\");\n const formatDecimal_js_1 = require(_dependencyMap[2], \"./formatDecimal.js\");\n const getSeparator_js_1 = require(_dependencyMap[3], \"./getSeparator.js\");\n const si_js_1 = require(_dependencyMap[4], \"./si.js\");\n const DEFAULT_DECIMALS = 0;\n const DEFAULT_UNIT = si_js_1.SI[si_js_1.SI_MID].text;\n let defaultDecimals = DEFAULT_DECIMALS;\n let defaultUnit = DEFAULT_UNIT;\n function _formatBalance(input, {\n decimals = defaultDecimals,\n forceUnit,\n locale = 'en',\n withAll = false,\n withSi = true,\n withSiFull = false,\n withUnit = true,\n withZero = true\n } = {}) {\n // we only work with string inputs here - convert anything\n // into the string-only value\n let text = (0, toBn_js_1.bnToBn)(input).toString();\n if (text.length === 0 || text === '0') {\n return '0';\n }\n // strip the negative sign so we can work with clean groupings, re-add this in the\n // end when we return the result (from here on we work with positive numbers)\n let sign = '';\n if (text[0].startsWith('-')) {\n sign = '-';\n text = text.substring(1);\n }\n // We start at midpoint (8) minus 1 - this means that values display as\n // 123.4567 instead of 0.1234 k (so we always have the most relevant).\n const si = (0, si_js_1.calcSi)(text, decimals, forceUnit);\n const mid = text.length - (decimals + si.power);\n const pre = mid <= 0 ? '0' : text.substring(0, mid);\n // get the post from the midpoint onward and then first add max decimals\n // before trimming to the correct (calculated) amount of decimals again\n let post = text.padStart(mid < 0 ? decimals : 1, '0').substring(mid < 0 ? 0 : mid).padEnd(withAll ? Math.max(decimals, 4) : 4, '0').substring(0, withAll ? Math.max(4, decimals + si.power) : 4);\n // remove all trailing 0's (if required via flag)\n if (!withZero) {\n let end = post.length - 1;\n // This looks inefficient, however it is better to do the checks and\n // only make one final slice than it is to do it in multiples\n do {\n if (post[end] === '0') {\n end--;\n }\n } while (post[end] === '0');\n post = post.substring(0, end + 1);\n }\n // the display unit\n const unit = (0, boolean_js_1.isBoolean)(withUnit) ? si_js_1.SI[si_js_1.SI_MID].text : withUnit;\n // format the units for display based on the flags\n const units = withSi || withSiFull ? si.value === '-' ? withUnit ? ` ${unit}` : '' : ` ${withSiFull ? `${si.text}${withUnit ? ' ' : ''}` : si.value}${withUnit ? unit : ''}` : '';\n const {\n decimal,\n thousand\n } = (0, getSeparator_js_1.getSeparator)(locale);\n return `${sign}${(0, formatDecimal_js_1.formatDecimal)(pre, thousand)}${post && `${decimal}${post}`}${units}`;\n }\n exports.formatBalance = _formatBalance;\n exports.formatBalance.calcSi = (text, decimals = defaultDecimals) => (0, si_js_1.calcSi)(text, decimals);\n exports.formatBalance.findSi = si_js_1.findSi;\n exports.formatBalance.getDefaults = () => {\n return {\n decimals: defaultDecimals,\n unit: defaultUnit\n };\n };\n exports.formatBalance.getOptions = (decimals = defaultDecimals) => {\n return si_js_1.SI.filter(({\n power\n }) => power < 0 ? decimals + power >= 0 : true);\n };\n exports.formatBalance.setDefaults = ({\n decimals,\n unit\n }) => {\n defaultDecimals = (Array.isArray(decimals) ? decimals[0] : decimals) ?? defaultDecimals;\n defaultUnit = (Array.isArray(unit) ? unit[0] : unit) ?? defaultUnit;\n si_js_1.SI[si_js_1.SI_MID].text = defaultUnit;\n };\n});","lineCount":92,"map":[[2,2,1,0],[2,14,1,12],[4,2,2,0,"Object"],[4,8,2,6],[4,9,2,7,"defineProperty"],[4,23,2,21],[4,24,2,22,"exports"],[4,31,2,29],[4,33,2,31],[4,45,2,43],[4,47,2,45],[5,4,2,47,"value"],[5,9,2,52],[5,11,2,54],[6,2,2,59],[6,3,2,60],[6,4,2,61],[7,2,3,0,"exports"],[7,9,3,7],[7,10,3,8,"formatBalance"],[7,23,3,21],[7,26,3,24],[7,31,3,29],[7,32,3,30],[8,2,4,0],[8,8,4,6,"toBn_js_1"],[8,17,4,15],[8,20,4,18,"require"],[8,27,4,25],[8,28,4,25,"_dependencyMap"],[8,42,4,25],[8,62,4,41],[8,63,4,42],[9,2,5,0],[9,8,5,6,"boolean_js_1"],[9,20,5,18],[9,23,5,21,"require"],[9,30,5,28],[9,31,5,28,"_dependencyMap"],[9,45,5,28],[9,68,5,47],[9,69,5,48],[10,2,6,0],[10,8,6,6,"formatDecimal_js_1"],[10,26,6,24],[10,29,6,27,"require"],[10,36,6,34],[10,37,6,34,"_dependencyMap"],[10,51,6,34],[10,76,6,55],[10,77,6,56],[11,2,7,0],[11,8,7,6,"getSeparator_js_1"],[11,25,7,23],[11,28,7,26,"require"],[11,35,7,33],[11,36,7,33,"_dependencyMap"],[11,50,7,33],[11,74,7,53],[11,75,7,54],[12,2,8,0],[12,8,8,6,"si_js_1"],[12,15,8,13],[12,18,8,16,"require"],[12,25,8,23],[12,26,8,23,"_dependencyMap"],[12,40,8,23],[12,54,8,33],[12,55,8,34],[13,2,9,0],[13,8,9,6,"DEFAULT_DECIMALS"],[13,24,9,22],[13,27,9,25],[13,28,9,26],[14,2,10,0],[14,8,10,6,"DEFAULT_UNIT"],[14,20,10,18],[14,23,10,21,"si_js_1"],[14,30,10,28],[14,31,10,29,"SI"],[14,33,10,31],[14,34,10,32,"si_js_1"],[14,41,10,39],[14,42,10,40,"SI_MID"],[14,48,10,46],[14,49,10,47],[14,50,10,48,"text"],[14,54,10,52],[15,2,11,0],[15,6,11,4,"defaultDecimals"],[15,21,11,19],[15,24,11,22,"DEFAULT_DECIMALS"],[15,40,11,38],[16,2,12,0],[16,6,12,4,"defaultUnit"],[16,17,12,15],[16,20,12,18,"DEFAULT_UNIT"],[16,32,12,30],[17,2,13,0],[17,11,13,9,"_formatBalance"],[17,25,13,23,"_formatBalance"],[17,26,13,24,"input"],[17,31,13,29],[17,33,13,31],[18,4,13,33,"decimals"],[18,12,13,41],[18,15,13,44,"defaultDecimals"],[18,30,13,59],[19,4,13,61,"forceUnit"],[19,13,13,70],[20,4,13,72,"locale"],[20,10,13,78],[20,13,13,81],[20,17,13,85],[21,4,13,87,"withAll"],[21,11,13,94],[21,14,13,97],[21,19,13,102],[22,4,13,104,"withSi"],[22,10,13,110],[22,13,13,113],[22,17,13,117],[23,4,13,119,"withSiFull"],[23,14,13,129],[23,17,13,132],[23,22,13,137],[24,4,13,139,"withUnit"],[24,12,13,147],[24,15,13,150],[24,19,13,154],[25,4,13,156,"withZero"],[25,12,13,164],[25,15,13,167],[26,2,13,172],[26,3,13,173],[26,6,13,176],[26,7,13,177],[26,8,13,178],[26,10,13,180],[27,4,14,4],[28,4,15,4],[29,4,16,4],[29,8,16,8,"text"],[29,12,16,12],[29,15,16,15],[29,16,16,16],[29,17,16,17],[29,19,16,19,"toBn_js_1"],[29,28,16,28],[29,29,16,29,"bnToBn"],[29,35,16,35],[29,37,16,37,"input"],[29,42,16,42],[29,43,16,43],[29,44,16,44,"toString"],[29,52,16,52],[29,53,16,53],[29,54,16,54],[30,4,17,4],[30,8,17,8,"text"],[30,12,17,12],[30,13,17,13,"length"],[30,19,17,19],[30,24,17,24],[30,25,17,25],[30,29,17,29,"text"],[30,33,17,33],[30,38,17,38],[30,41,17,41],[30,43,17,43],[31,6,18,8],[31,13,18,15],[31,16,18,18],[32,4,19,4],[33,4,20,4],[34,4,21,4],[35,4,22,4],[35,8,22,8,"sign"],[35,12,22,12],[35,15,22,15],[35,17,22,17],[36,4,23,4],[36,8,23,8,"text"],[36,12,23,12],[36,13,23,13],[36,14,23,14],[36,15,23,15],[36,16,23,16,"startsWith"],[36,26,23,26],[36,27,23,27],[36,30,23,30],[36,31,23,31],[36,33,23,33],[37,6,24,8,"sign"],[37,10,24,12],[37,13,24,15],[37,16,24,18],[38,6,25,8,"text"],[38,10,25,12],[38,13,25,15,"text"],[38,17,25,19],[38,18,25,20,"substring"],[38,27,25,29],[38,28,25,30],[38,29,25,31],[38,30,25,32],[39,4,26,4],[40,4,27,4],[41,4,28,4],[42,4,29,4],[42,10,29,10,"si"],[42,12,29,12],[42,15,29,15],[42,16,29,16],[42,17,29,17],[42,19,29,19,"si_js_1"],[42,26,29,26],[42,27,29,27,"calcSi"],[42,33,29,33],[42,35,29,35,"text"],[42,39,29,39],[42,41,29,41,"decimals"],[42,49,29,49],[42,51,29,51,"forceUnit"],[42,60,29,60],[42,61,29,61],[43,4,30,4],[43,10,30,10,"mid"],[43,13,30,13],[43,16,30,16,"text"],[43,20,30,20],[43,21,30,21,"length"],[43,27,30,27],[43,31,30,31,"decimals"],[43,39,30,39],[43,42,30,42,"si"],[43,44,30,44],[43,45,30,45,"power"],[43,50,30,50],[43,51,30,51],[44,4,31,4],[44,10,31,10,"pre"],[44,13,31,13],[44,16,31,16,"mid"],[44,19,31,19],[44,23,31,23],[44,24,31,24],[44,27,31,27],[44,30,31,30],[44,33,31,33,"text"],[44,37,31,37],[44,38,31,38,"substring"],[44,47,31,47],[44,48,31,48],[44,49,31,49],[44,51,31,51,"mid"],[44,54,31,54],[44,55,31,55],[45,4,32,4],[46,4,33,4],[47,4,34,4],[47,8,34,8,"post"],[47,12,34,12],[47,15,34,15,"text"],[47,19,34,19],[47,20,35,9,"padStart"],[47,28,35,17],[47,29,35,18,"mid"],[47,32,35,21],[47,35,35,24],[47,36,35,25],[47,39,35,28,"decimals"],[47,47,35,36],[47,50,35,39],[47,51,35,40],[47,53,35,42],[47,56,35,45],[47,57,35,46],[47,58,36,9,"substring"],[47,67,36,18],[47,68,36,19,"mid"],[47,71,36,22],[47,74,36,25],[47,75,36,26],[47,78,36,29],[47,79,36,30],[47,82,36,33,"mid"],[47,85,36,36],[47,86,36,37],[47,87,37,9,"padEnd"],[47,93,37,15],[47,94,37,16,"withAll"],[47,101,37,23],[47,104,37,26,"Math"],[47,108,37,30],[47,109,37,31,"max"],[47,112,37,34],[47,113,37,35,"decimals"],[47,121,37,43],[47,123,37,45],[47,124,37,46],[47,125,37,47],[47,128,37,50],[47,129,37,51],[47,131,37,53],[47,134,37,56],[47,135,37,57],[47,136,38,9,"substring"],[47,145,38,18],[47,146,38,19],[47,147,38,20],[47,149,38,22,"withAll"],[47,156,38,29],[47,159,38,32,"Math"],[47,163,38,36],[47,164,38,37,"max"],[47,167,38,40],[47,168,38,41],[47,169,38,42],[47,171,38,44,"decimals"],[47,179,38,52],[47,182,38,55,"si"],[47,184,38,57],[47,185,38,58,"power"],[47,190,38,63],[47,191,38,64],[47,194,38,67],[47,195,38,68],[47,196,38,69],[48,4,39,4],[49,4,40,4],[49,8,40,8],[49,9,40,9,"withZero"],[49,17,40,17],[49,19,40,19],[50,6,41,8],[50,10,41,12,"end"],[50,13,41,15],[50,16,41,18,"post"],[50,20,41,22],[50,21,41,23,"length"],[50,27,41,29],[50,30,41,32],[50,31,41,33],[51,6,42,8],[52,6,43,8],[53,6,44,8],[53,9,44,11],[54,8,45,12],[54,12,45,16,"post"],[54,16,45,20],[54,17,45,21,"end"],[54,20,45,24],[54,21,45,25],[54,26,45,30],[54,29,45,33],[54,31,45,35],[55,10,46,16,"end"],[55,13,46,19],[55,15,46,21],[56,8,47,12],[57,6,48,8],[57,7,48,9],[57,15,48,17,"post"],[57,19,48,21],[57,20,48,22,"end"],[57,23,48,25],[57,24,48,26],[57,29,48,31],[57,32,48,34],[58,6,49,8,"post"],[58,10,49,12],[58,13,49,15,"post"],[58,17,49,19],[58,18,49,20,"substring"],[58,27,49,29],[58,28,49,30],[58,29,49,31],[58,31,49,33,"end"],[58,34,49,36],[58,37,49,39],[58,38,49,40],[58,39,49,41],[59,4,50,4],[60,4,51,4],[61,4,52,4],[61,10,52,10,"unit"],[61,14,52,14],[61,17,52,17],[61,18,52,18],[61,19,52,19],[61,21,52,21,"boolean_js_1"],[61,33,52,33],[61,34,52,34,"isBoolean"],[61,43,52,43],[61,45,52,45,"withUnit"],[61,53,52,53],[61,54,52,54],[61,57,53,10,"si_js_1"],[61,64,53,17],[61,65,53,18,"SI"],[61,67,53,20],[61,68,53,21,"si_js_1"],[61,75,53,28],[61,76,53,29,"SI_MID"],[61,82,53,35],[61,83,53,36],[61,84,53,37,"text"],[61,88,53,41],[61,91,54,10,"withUnit"],[61,99,54,18],[62,4,55,4],[63,4,56,4],[63,10,56,10,"units"],[63,15,56,15],[63,18,56,18,"withSi"],[63,24,56,24],[63,28,56,28,"withSiFull"],[63,38,56,38],[63,41,57,10,"si"],[63,43,57,12],[63,44,57,13,"value"],[63,49,57,18],[63,54,57,23],[63,57,57,26],[63,60,58,14,"withUnit"],[63,68,58,22],[63,71,59,18],[63,75,59,22,"unit"],[63,79,59,26],[63,81,59,28],[63,84,60,18],[63,86,60,20],[63,89,61,14],[63,93,61,18,"withSiFull"],[63,103,61,28],[63,106,61,31],[63,109,61,34,"si"],[63,111,61,36],[63,112,61,37,"text"],[63,116,61,41],[63,119,61,44,"withUnit"],[63,127,61,52],[63,130,61,55],[63,133,61,58],[63,136,61,61],[63,138,61,63],[63,140,61,65],[63,143,61,68,"si"],[63,145,61,70],[63,146,61,71,"value"],[63,151,61,76],[63,154,61,79,"withUnit"],[63,162,61,87],[63,165,61,90,"unit"],[63,169,61,94],[63,172,61,97],[63,174,61,99],[63,176,61,101],[63,179,62,10],[63,181,62,12],[64,4,63,4],[64,10,63,10],[65,6,63,12,"decimal"],[65,13,63,19],[66,6,63,21,"thousand"],[67,4,63,30],[67,5,63,31],[67,8,63,34],[67,9,63,35],[67,10,63,36],[67,12,63,38,"getSeparator_js_1"],[67,29,63,55],[67,30,63,56,"getSeparator"],[67,42,63,68],[67,44,63,70,"locale"],[67,50,63,76],[67,51,63,77],[68,4,64,4],[68,11,64,11],[68,14,64,14,"sign"],[68,18,64,18],[68,21,64,21],[68,22,64,22],[68,23,64,23],[68,25,64,25,"formatDecimal_js_1"],[68,43,64,43],[68,44,64,44,"formatDecimal"],[68,57,64,57],[68,59,64,59,"pre"],[68,62,64,62],[68,64,64,64,"thousand"],[68,72,64,72],[68,73,64,73],[68,76,64,76,"post"],[68,80,64,80],[68,84,64,84],[68,87,64,87,"decimal"],[68,94,64,94],[68,97,64,97,"post"],[68,101,64,101],[68,103,64,103],[68,106,64,106,"units"],[68,111,64,111],[68,113,64,113],[69,2,65,0],[70,2,66,0,"exports"],[70,9,66,7],[70,10,66,8,"formatBalance"],[70,23,66,21],[70,26,66,24,"_formatBalance"],[70,40,66,38],[71,2,67,0,"exports"],[71,9,67,7],[71,10,67,8,"formatBalance"],[71,23,67,21],[71,24,67,22,"calcSi"],[71,30,67,28],[71,33,67,31],[71,34,67,32,"text"],[71,38,67,36],[71,40,67,38,"decimals"],[71,48,67,46],[71,51,67,49,"defaultDecimals"],[71,66,67,64],[71,71,67,69],[71,72,67,70],[71,73,67,71],[71,75,67,73,"si_js_1"],[71,82,67,80],[71,83,67,81,"calcSi"],[71,89,67,87],[71,91,67,89,"text"],[71,95,67,93],[71,97,67,95,"decimals"],[71,105,67,103],[71,106,67,104],[72,2,68,0,"exports"],[72,9,68,7],[72,10,68,8,"formatBalance"],[72,23,68,21],[72,24,68,22,"findSi"],[72,30,68,28],[72,33,68,31,"si_js_1"],[72,40,68,38],[72,41,68,39,"findSi"],[72,47,68,45],[73,2,69,0,"exports"],[73,9,69,7],[73,10,69,8,"formatBalance"],[73,23,69,21],[73,24,69,22,"getDefaults"],[73,35,69,33],[73,38,69,36],[73,44,69,42],[74,4,70,4],[74,11,70,11],[75,6,71,8,"decimals"],[75,14,71,16],[75,16,71,18,"defaultDecimals"],[75,31,71,33],[76,6,72,8,"unit"],[76,10,72,12],[76,12,72,14,"defaultUnit"],[77,4,73,4],[77,5,73,5],[78,2,74,0],[78,3,74,1],[79,2,75,0,"exports"],[79,9,75,7],[79,10,75,8,"formatBalance"],[79,23,75,21],[79,24,75,22,"getOptions"],[79,34,75,32],[79,37,75,35],[79,38,75,36,"decimals"],[79,46,75,44],[79,49,75,47,"defaultDecimals"],[79,64,75,62],[79,69,75,67],[80,4,76,4],[80,11,76,11,"si_js_1"],[80,18,76,18],[80,19,76,19,"SI"],[80,21,76,21],[80,22,76,22,"filter"],[80,28,76,28],[80,29,76,29],[80,30,76,30],[81,6,76,32,"power"],[82,4,76,38],[82,5,76,39],[82,10,76,44,"power"],[82,15,76,49],[82,18,76,52],[82,19,76,53],[82,22,77,11,"decimals"],[82,30,77,19],[82,33,77,22,"power"],[82,38,77,27],[82,42,77,32],[82,43,77,33],[82,46,78,10],[82,50,78,14],[82,51,78,15],[83,2,79,0],[83,3,79,1],[84,2,80,0,"exports"],[84,9,80,7],[84,10,80,8,"formatBalance"],[84,23,80,21],[84,24,80,22,"setDefaults"],[84,35,80,33],[84,38,80,36],[84,39,80,37],[85,4,80,39,"decimals"],[85,12,80,47],[86,4,80,49,"unit"],[87,2,80,54],[87,3,80,55],[87,8,80,60],[88,4,81,4,"defaultDecimals"],[88,19,81,19],[88,22,81,22],[88,23,81,23,"Array"],[88,28,81,28],[88,29,81,29,"isArray"],[88,36,81,36],[88,37,81,37,"decimals"],[88,45,81,45],[88,46,81,46],[88,49,82,10,"decimals"],[88,57,82,18],[88,58,82,19],[88,59,82,20],[88,60,82,21],[88,63,83,10,"decimals"],[88,71,83,18],[88,76,83,23,"defaultDecimals"],[88,91,83,38],[89,4,84,4,"defaultUnit"],[89,15,84,15],[89,18,84,18],[89,19,84,19,"Array"],[89,24,84,24],[89,25,84,25,"isArray"],[89,32,84,32],[89,33,84,33,"unit"],[89,37,84,37],[89,38,84,38],[89,41,85,10,"unit"],[89,45,85,14],[89,46,85,15],[89,47,85,16],[89,48,85,17],[89,51,86,10,"unit"],[89,55,86,14],[89,60,86,19,"defaultUnit"],[89,71,86,30],[90,4,87,4,"si_js_1"],[90,11,87,11],[90,12,87,12,"SI"],[90,14,87,14],[90,15,87,15,"si_js_1"],[90,22,87,22],[90,23,87,23,"SI_MID"],[90,29,87,29],[90,30,87,30],[90,31,87,31,"text"],[90,35,87,35],[90,38,87,38,"defaultUnit"],[90,49,87,49],[91,2,88,0],[91,3,88,1],[92,0,88,2],[92,3]],"functionMap":{"names":["<global>","_formatBalance","exports.formatBalance.calcSi","exports.formatBalance.getDefaults","exports.formatBalance.getOptions","si_js_1.SI.filter$argument_0","exports.formatBalance.setDefaults"],"mappings":"AAA;ACY;CDoD;+BEE,yEF;oCGE;CHK;mCIC;6BCC;cDE;CJC;oCMC;CNQ"},"hasCjsExports":true},"type":"js/module"}]} |