Files
discord-decomp/sources/by-id/module-01291-parseNumberSkeleton.js
2026-07-28 01:06:53 +03:00

738 lines
45 KiB
JavaScript

/* Metro module 1291; source: unknown; dependencies: [1292, 1289] */
import * as Module01289Module from './module-01289.js'; /* Metro dependency 1289 */
function _fun14252(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#14252, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:6, offset: 0x00dffc70, size: 197 bytes, params: 8, frame: 16
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.parseNumberSkeletonFromString = undefined;
exports.parseNumberSkeleton = undefined;
exports.parseNumberSkeletonFromString = parseNumberSkeletonFromString;
const env0_2 = RegExp('^\\.(?:(0+)(\\*)?|(#+)|(0+)(#+))$', 'g');
const env0_3 = RegExp('^(@+)?(\\+|#+)?[rs]?$', 'g');
const env0_4 = RegExp('(\\*)(0+)|(#+)(0+)|(0+)', 'g');
const env0_5 = RegExp('^(0+)$', '');
exports.parseNumberSkeleton = parseNumberSkeleton;
function parseSignificantPrecision(a0) { // fn#14253, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:743, offset: 0x00dffd35, size: 107 bytes, params: 2, frame: 15
const object = {};
if (a0[a0.length - 1] === 'r') {
object.roundingPriority = 'morePrecision';
} else if (a0[a0.length - 1] === 's') {
object.roundingPriority = 'lessPrecision';
}
a0.replace(env0_3, _fun14254);
return object;
function _fun14254(a0, a1, a2) { // fn#14254, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:922, offset: 0x00dffda0, size: 162 bytes, params: 4, frame: 7
var length;
var value2;
var binding;
var length2;
const value = typeof a2;
if (value !== 'string') {
binding = env0_0;
length = a1.length;
binding.minimumSignificantDigits = length;
length = a1.length;
binding.maximumSignificantDigits = length;
} else if (a2 === '+') {
env0_0.minimumSignificantDigits = a1.length;
} else {
value2 = 0;
if (a1[value2] === '#') {
env0_0.maximumSignificantDigits = a1.length;
} else {
binding = env0_0;
length = a1.length;
binding.minimumSignificantDigits = length;
length2 = a1.length;
length = value !== 'string' ? value2 : a2.length;
binding.maximumSignificantDigits = length2 + length;
}
}
return '';
}
}
function parseConciseScientificAndEngineeringStem(a0) { // fn#14256, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:1755, offset: 0x00dfff41, size: 257 bytes, params: 2, frame: 16
var r0;
var r4;
var r1;
var binding;
let value = a0;
if (value[0] !== 'E') {
if (value[0] !== 'E') {
r0 = undefined;
r4 = value;
} else {
value = value.slice(1);
r0 = {notation: 'scientific'};
r4 = value;
}
} else if (value[1] === 'E') {
value = value.slice(2);
r0 = {notation: 'engineering'};
r4 = value;
} else if (value[0] !== 'E') {
r0 = undefined;
r4 = value;
} else {
value = value.slice(1);
r0 = {notation: 'scientific'};
r4 = value;
}
if (r0) {
value = r4.slice(0, 2);
if (value === '+!') {
r0.signDisplay = 'always';
r1 = r4.slice(2);
} else if (value !== '+?') {
r1 = r4;
} else {
r0.signDisplay = 'exceptZero';
r1 = r4.slice(2);
}
binding = env0_5;
if (binding.test(r1)) {
r0.minimumIntegerDigits = r1.length;
return r0;
}
throw new global.Error('Malformed concise eng/scientific notation');
}
return r0;
}
function parseNotationOptions(a0) { // fn#14257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:2172, offset: 0x00e00042, size: 24 bytes, params: 2, frame: 11
return parseSign(a0) || ({});
}
function parseNumberSkeletonFromString(a0) { // fn#14258, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:185, offset: 0x00e0005a, size: 319 bytes, params: 2, frame: 18
var r2;
var r7;
var property;
var value5;
var slice;
var value6;
var value7;
var push;
var value8;
let length = a0.length;
const value = 0;
if (value === length) {
throw new global.Error('Number skeleton cannot be empty');
}
const items2 = [];
let split = a0.split;
const WHITE_SPACE_REGEX = require(dependencyMap[value]).WHITE_SPACE_REGEX;
const value4 = Reflect.apply(split, a0, [WHITE_SPACE_REGEX]).filter(function(a0) {
return a0.length > 0;
});
length = value4.length;
if (value < length) {
r2 = value;
reducibleLoop2: while (true) {
property = value4[r2];
split = property.split;
value5 = Reflect.apply(split, property, ['/']);
length = value5.length;
if (value === length) {
throw new global.Error('Invalid number skeleton');
}
property = value5[value];
slice = value5.slice;
value6 = Reflect.apply(slice, value5, [1]);
length = value6.length;
if (value < length) {
r7 = value;
reducibleLoop4: while (true) {
length = value6[r7].length;
if (value === length) {
throw new global.Error('Invalid number skeleton');
}
value7 = typeof r7 === 'bigint' ? r7 + 1n : +r7 + 1;
length = value6.length;
if (value7 < length) {
r7 = value7;
continue reducibleLoop4;
}
break reducibleLoop4;
}
}
push = items2.push;
Reflect.apply(push, items2, [{stem: property, options: value6}]);
value8 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
length = value4.length;
if (!(value8 < length)) {
return items2;
}
r2 = value8;
continue reducibleLoop2;
}
}
return items2;
}
function parseNumberSkeleton(a0) { // fn#14260, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:2259, offset: 0x00e00199, size: 2139 bytes, params: 2, frame: 86
var r5;
var r6;
var r76;
var r65;
var r0;
var property;
var stem;
var binding;
var test;
var parseSignBinding;
var sign;
var moduleValue;
var __assign;
var moduleValue2;
var __assign2;
var value3;
var parseConciseScientificAndEngineeringStemBinding;
var conciseScientificAndEngineeringStem;
var moduleValue3;
var moduleValue4;
var __assign3;
var value4;
var moduleValue5;
var moduleValue6;
var __assign4;
var value5;
var value6;
var options;
var replace;
var moduleValue7;
var moduleValue8;
var __assign5;
var value7;
var value8;
var moduleValue9;
var moduleValue10;
var __assign6;
var value9;
var value10;
var parseFloat;
var moduleValue11;
var moduleValue12;
var __assign7;
var moduleValue13;
var __assign8;
var value11;
var value12;
var reduce;
var closure;
var value13;
var moduleValue14;
var moduleValue15;
var __assign9;
var moduleValue16;
var __assign10;
var value14;
var value15;
var value16;
var value17;
const object = {};
var env0_0;
let length = a0.length;
const value = 0;
if (value < length) {
r5 = value;
r6 = object;
reducibleLoop1: while (true) {
property = a0[r5];
stem = property.stem;
if (stem !== 'percent') {
reducibleJoin71: while (true) {
if (stem === '%') {
break reducibleJoin71;
}
if (stem === '%x100') {
r6.style = 'percent';
r6.scale = 100;
r65 = r6;
} else if (stem === 'currency') {
r6.style = 'currency';
options = property.options;
r6.currency = options[value];
r65 = r6;
} else {
reducibleJoin72: while (true) {
reducibleJoin68: while (true) {
if (stem === 'group-off') {
break reducibleJoin68;
}
if (stem === ',_') {
break reducibleJoin68;
}
if (stem !== 'precision-integer') {
reducibleJoin67: while (true) {
if (stem === '.') {
break reducibleJoin67;
}
if (stem !== 'measure-unit') {
reducibleJoin66: while (true) {
if (stem === 'unit') {
break reducibleJoin66;
}
if (stem !== 'compact-short') {
reducibleJoin65: while (true) {
if (stem === 'K') {
break reducibleJoin65;
}
if (stem !== 'compact-long') {
reducibleJoin64: while (true) {
if (stem === 'KK') {
break reducibleJoin64;
}
if (stem === 'scientific') {
moduleValue14 = require(1289) /* metro dependency 1289 */;
__assign = moduleValue14.__assign;
moduleValue15 = require(1289) /* metro dependency 1289 */;
__assign9 = moduleValue15.__assign;
moduleValue16 = require(1289) /* metro dependency 1289 */;
__assign10 = moduleValue16.__assign;
value14 = Reflect.apply(__assign10, moduleValue16,
[{},
r6]);
value15 = Reflect.apply(__assign9, moduleValue15,
[value14,
{notation: 'scientific'}]);
options = property.options;
reduce = options.reduce;
closure = function(a0, a1) {
return require(dependencyMap[1]).__assign(require(dependencyMap[1]).__assign({},
a0),
parseNotationOptions(a1));
};
value16 = Reflect.apply(__assign, moduleValue14,
[value15,
Reflect.apply(reduce,
options,
[closure,
{}])]);
env0_0 = value16;
r65 = value16;
break reducibleJoin72;
}
if (stem === 'engineering') {
moduleValue11 = require(1289) /* metro dependency 1289 */;
__assign = moduleValue11.__assign;
moduleValue12 = require(1289) /* metro dependency 1289 */;
__assign7 = moduleValue12.__assign;
moduleValue13 = require(1289) /* metro dependency 1289 */;
__assign8 = moduleValue13.__assign;
value11 = Reflect.apply(__assign8, moduleValue13,
[{},
r6]);
value12 = Reflect.apply(__assign7, moduleValue12,
[value11,
{notation: 'engineering'}]);
options = property.options;
reduce = options.reduce;
closure = _fun14262;
value13 = Reflect.apply(__assign, moduleValue11,
[value12,
Reflect.apply(reduce,
options,
[closure,
{}])]);
env0_0 = value13;
r65 = value13;
break reducibleJoin72;
}
if (stem === 'notation-simple') {
r6.notation = 'standard';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'unit-width-narrow') {
r6.currencyDisplay = 'narrowSymbol';
r6.unitDisplay = 'narrow';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'unit-width-short') {
r6.currencyDisplay = 'code';
r6.unitDisplay = 'short';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'unit-width-full-name') {
r6.currencyDisplay = 'name';
r6.unitDisplay = 'long';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'unit-width-iso-code') {
r6.currencyDisplay = 'symbol';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'scale') {
parseFloat = global.parseFloat;
options = property.options;
r6.scale = parseFloat(options[value]);
r65 = r6;
break reducibleJoin72;
}
if (stem === 'rounding-mode-floor') {
r6.roundingMode = 'floor';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'rounding-mode-ceiling') {
r6.roundingMode = 'ceil';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'rounding-mode-down') {
r6.roundingMode = 'trunc';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'rounding-mode-up') {
r6.roundingMode = 'expand';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'rounding-mode-half-even') {
r6.roundingMode = 'halfEven';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'rounding-mode-half-down') {
r6.roundingMode = 'halfTrunc';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'rounding-mode-half-up') {
r6.roundingMode = 'halfExpand';
r65 = r6;
break reducibleJoin72;
}
if (stem === 'integer-width') {
options = property.options;
length = options.length;
if (length > 1) {
throw new global.RangeError('integer-width stems only accept a single optional option');
}
options = property.options;
property = options[value];
replace = property.replace;
Reflect.apply(replace, property, [env0_4,
_fun14263]);
r65 = r6;
break reducibleJoin72;
}
binding = env0_5;
test = binding.test;
stem = property.stem;
if (Reflect.apply(test, binding, [stem])) {
length = property.stem.length;
r6.minimumIntegerDigits = length;
r65 = r6;
break reducibleJoin72;
}
binding = env0_2;
test = binding.test;
stem = property.stem;
if (Reflect.apply(test, binding, [stem])) {
options = property.options;
length = options.length;
if (length > 1) {
throw new global.RangeError('Fraction-precision stems only accept a single optional option');
}
stem = property.stem;
replace = stem.replace;
Reflect.apply(replace, stem, [env0_2, _fun14264]);
options = property.options;
property = options[value];
if (property === 'w') {
moduleValue9 = require(1289) /* metro dependency 1289 */;
__assign = moduleValue9.__assign;
moduleValue10 = require(1289) /* metro dependency 1289 */;
__assign6 = moduleValue10.__assign;
value9 = Reflect.apply(__assign6, moduleValue10,
[{},
r6]);
value10 = Reflect.apply(__assign, moduleValue9,
[value9,
{trailingZeroDisplay: 'stripIfInteger'}]);
env0_0 = value10;
r65 = value10;
break reducibleJoin72;
}
if (property) {
moduleValue7 = require(1289) /* metro dependency 1289 */;
__assign = moduleValue7.__assign;
moduleValue8 = require(1289) /* metro dependency 1289 */;
__assign5 = moduleValue8.__assign;
value7 = Reflect.apply(__assign5, moduleValue8,
[{},
r6]);
value8 = Reflect.apply(__assign, moduleValue7,
[value7,
parseSignificantPrecision(property)]);
env0_0 = value8;
r65 = value8;
break reducibleJoin72;
}
r65 = r6;
break reducibleJoin72;
}
binding = env0_3;
test = binding.test;
stem = property.stem;
if (Reflect.apply(test, binding, [stem])) {
moduleValue5 = require(1289) /* metro dependency 1289 */;
__assign = moduleValue5.__assign;
moduleValue6 = require(1289) /* metro dependency 1289 */;
__assign4 = moduleValue6.__assign;
value5 = Reflect.apply(__assign4, moduleValue6, [{},
r6]);
value6 = Reflect.apply(__assign, moduleValue5,
[value5,
parseSignificantPrecision(property.stem)]);
env0_0 = value6;
r65 = value6;
break reducibleJoin72;
}
parseSignBinding = parseSign;
stem = property.stem;
sign = parseSignBinding(stem);
reducibleJoin36: while (true) {
if (sign) {
moduleValue = require(1289) /* metro dependency 1289 */;
__assign = moduleValue.__assign;
moduleValue2 = require(1289) /* metro dependency 1289 */;
__assign2 = moduleValue2.__assign;
value3 = Reflect.apply(__assign, moduleValue,
[Reflect.apply(__assign2,
moduleValue2,
[{},
r6]),
sign]);
env0_0 = value3;
r76 = value3;
break reducibleJoin36;
}
r76 = r6;
break reducibleJoin36;
}
parseConciseScientificAndEngineeringStemBinding = parseConciseScientificAndEngineeringStem;
stem = property.stem;
conciseScientificAndEngineeringStem = parseConciseScientificAndEngineeringStemBinding(stem);
if (conciseScientificAndEngineeringStem) {
moduleValue3 = require(1289) /* metro dependency 1289 */;
__assign = moduleValue3.__assign;
moduleValue4 = require(1289) /* metro dependency 1289 */;
__assign3 = moduleValue4.__assign;
value4 = Reflect.apply(__assign, moduleValue3,
[Reflect.apply(__assign3,
moduleValue4,
[{},
r76]),
conciseScientificAndEngineeringStem]);
env0_0 = value4;
r65 = value4;
break reducibleJoin72;
}
r65 = r76;
break reducibleJoin72;
}
}
r6.notation = 'compact';
r6.compactDisplay = 'long';
r65 = r6;
break reducibleJoin72;
}
}
r6.notation = 'compact';
r6.compactDisplay = 'short';
r65 = r6;
break reducibleJoin72;
}
}
r6.style = 'unit';
options = property.options;
property = options[value];
replace = property.replace;
r6.unit = Reflect.apply(replace, property, [RegExp('^(.*?)-', ''), '']);
r65 = r6;
break reducibleJoin72;
}
}
r6.maximumFractionDigits = value;
r65 = r6;
break reducibleJoin72;
}
r6.useGrouping = false;
r65 = r6;
break reducibleJoin72;
}
}
value17 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
length = a0.length;
if (!(value17 < length)) {
return r65;
}
r5 = value17;
r6 = r65;
continue reducibleLoop1;
}
}
r6.style = 'percent';
r65 = r6;
value17 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
length = a0.length;
if (!(value17 < length)) {
return r65;
}
r5 = value17;
r6 = r65;
continue reducibleLoop1;
}
} else {
r0 = object;
}
return r0;
function _fun14262(a0, a1) { // fn#14262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:3242, offset: 0x00e009f4, size: 77 bytes, params: 3, frame: 17
return Module01289Module.__assign(Module01289Module.__assign({}, a0), parseNotationOptions(a1));
}
function _fun14263(a0, a1, a2, a3, a4, a5) { // fn#14263, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:4336, offset: 0x00e00a41, size: 123 bytes, params: 7, frame: 11
if (a1) {
env0_0.minimumIntegerDigits = a2.length;
} else {
if (a3) {
if (a4) {
throw new global.Error('We currently do not support maximum integer digits');
}
if (a5) {
throw new global.Error('We currently do not support exact integer digits');
}
return '';
}
if (a5) {
throw new global.Error('We currently do not support exact integer digits');
}
}
return '';
}
function _fun14264(a0, a1, a2, a3, a4, a5) { // fn#14264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:4777, offset: 0x00e00abc, size: 172 bytes, params: 7, frame: 7
var binding;
var length;
if (a2 === '*') {
env0_0.minimumFractionDigits = a1.length;
} else if (a3) {
if (a3[0] === '#') {
env0_0.maximumFractionDigits = a3.length;
} else if (a4) {
if (a5) {
binding = env0_0;
length = a4.length;
binding.minimumFractionDigits = length;
binding = env0_0;
length = a4.length;
binding.maximumFractionDigits = length + a5.length;
} else {
binding = env0_0;
length = a1.length;
binding.minimumFractionDigits = length;
binding = env0_0;
length = a1.length;
binding.maximumFractionDigits = length;
}
} else {
binding = env0_0;
length = a1.length;
binding.minimumFractionDigits = length;
binding = env0_0;
length = a1.length;
binding.maximumFractionDigits = length;
}
} else if (a4) {
if (a5) {
binding = env0_0;
length = a4.length;
binding.minimumFractionDigits = length;
binding = env0_0;
length = a4.length;
binding.maximumFractionDigits = length + a5.length;
} else {
binding = env0_0;
length = a1.length;
binding.minimumFractionDigits = length;
binding = env0_0;
length = a1.length;
binding.maximumFractionDigits = length;
}
} else {
binding = env0_0;
length = a1.length;
binding.minimumFractionDigits = length;
binding = env0_0;
length = a1.length;
binding.maximumFractionDigits = length;
}
return '';
}
}
}
function parseSign(a0) { // fn#14255, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1418:1242, offset: 0x00dffe42, size: 255 bytes, params: 2, frame: 2
if (a0 === 'sign-auto') {
return {signDisplay: 'auto'};
}
if (a0 === 'sign-accounting') {
return {currencySign: 'accounting'};
}
if (a0 === '()') {
return {currencySign: 'accounting'};
}
if (a0 === 'sign-always') {
return {signDisplay: 'always'};
}
if (a0 === '+!') {
return {signDisplay: 'always'};
}
if (a0 === 'sign-accounting-always') {
return {'signDisplay': 'always', 'currencySign': 'accounting'};
}
if (a0 === '()!') {
return {'signDisplay': 'always', 'currencySign': 'accounting'};
}
if (a0 === 'sign-except-zero') {
return {signDisplay: 'exceptZero'};
}
if (a0 === '+?') {
return {signDisplay: 'exceptZero'};
}
if (a0 === 'sign-accounting-except-zero') {
return {'signDisplay': 'exceptZero', 'currencySign': 'accounting'};
}
if (a0 === '()?') {
return {'signDisplay': 'exceptZero', 'currencySign': 'accounting'};
}
if (a0 === 'sign-never') {
return {signDisplay: 'never'};
}
if (a0 === '+_') {
return {signDisplay: 'never'};
}
}
global.__d(_fun14252, 1291, [1292, 1289]) /* metro module 1291, dependencies: [1292, 1289] */;