403 lines
16 KiB
React
403 lines
16 KiB
React
/* Metro module 6937; source: unknown; dependencies: [6938, 6939] */
|
|
function _fun55151(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#55151, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:6, offset: 0x013774c7, size: 201 bytes, params: 8, frame: 20
|
|
var object2;
|
|
let closure = function(a0) {
|
|
var value = a0;
|
|
return value ? typeof value !== 'object' ? {default: value} : 'default' in value ? value : {default: value} : {default: value};
|
|
};
|
|
const closure2 = matchSorter;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_0 = closure(require(6938) /* metro dependency 6938 */);
|
|
const env0_1 = closure(require(6939) /* metro dependency 6939 */);
|
|
object2 = {'CASE_SENSITIVE_EQUAL': 7, 'EQUAL': 6, 'STARTS_WITH': 5, 'WORD_STARTS_WITH': 4, 'CONTAINS': 3,
|
|
'ACRONYM': 2, 'MATCHES': 1, 'NO_MATCH': 0};
|
|
closure2.rankings = object2;
|
|
closure = function(a0, a1) {
|
|
var String = global.String;
|
|
var value = String(a0.rankedValue);
|
|
String = global.String;
|
|
return value.localeCompare(String(a1.rankedValue));
|
|
};
|
|
const env0_4 = {'maxRanking': Infinity, 'minRanking': -Infinity};
|
|
exports.defaultBaseSortFn = closure;
|
|
exports.matchSorter = closure2;
|
|
exports.rankings = object2;
|
|
}
|
|
|
|
function matchSorter(a0, a1, a2) { // fn#55153, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:496, offset: 0x013775ba, size: 153 bytes, params: 4, frame: 16
|
|
const value = a2;
|
|
const env0_0 = a1;
|
|
const r1 = value !== undefined ? value : {};
|
|
const env0_2 = r1.keys;
|
|
const threshold = r1.threshold;
|
|
let r2 = threshold !== undefined ? threshold : env0_2.MATCHES;
|
|
const baseSort = r1.baseSort;
|
|
r2 = baseSort !== undefined ? baseSort : defaultBaseSortFn;
|
|
const sorter = r1.sorter;
|
|
return (sorter !== undefined ? sorter : function(a0) {
|
|
return a0.sort(_fun55155);
|
|
})(a0.reduce(reduceItemsToRanked, [])).map(function(a0) {
|
|
return a0.item;
|
|
});
|
|
}
|
|
|
|
function getMatchRanking(a0, a1, a2) { // fn#55160, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:1779, offset: 0x013778cf, size: 280 bytes, params: 4, frame: 16
|
|
var r0;
|
|
var value4;
|
|
var value5;
|
|
var matchRankingGetAcronym;
|
|
const prepareValueForComparisonBinding = prepareValueForComparison;
|
|
const value2 = prepareValueForComparisonBinding(a0, a2);
|
|
const value3 = prepareValueForComparisonBinding(a1, a2);
|
|
if (value3.length > value2.length) {
|
|
r0 = env0_2.NO_MATCH;
|
|
} else if (value2 === value3) {
|
|
r0 = env0_2.CASE_SENSITIVE_EQUAL;
|
|
} else {
|
|
value4 = value2.toLowerCase();
|
|
value5 = value3.toLowerCase();
|
|
if (value4 === value5) {
|
|
r0 = env0_2.EQUAL;
|
|
} else if (value4.startsWith(value5)) {
|
|
r0 = env0_2.STARTS_WITH;
|
|
} else if (value4.includes(' ' + value5)) {
|
|
r0 = env0_2.WORD_STARTS_WITH;
|
|
} else if (value4.includes(value5)) {
|
|
r0 = env0_2.CONTAINS;
|
|
} else if (value5.length === 1) {
|
|
r0 = env0_2.NO_MATCH;
|
|
} else {
|
|
matchRankingGetAcronym = getMatchRankingGetAcronym(value4);
|
|
r0 = matchRankingGetAcronym.includes(value5) ? env0_2.ACRONYM : getClosenessRanking(value4, value5);
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function prepareValueForComparison(a0, a1) { // fn#55166, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:2677, offset: 0x01377b52, size: 42 bytes, params: 3, frame: 12
|
|
var r0;
|
|
let value = String(a0);
|
|
if (a1.keepDiacritics) {
|
|
r0 = value;
|
|
} else {
|
|
value = env0_1.default(value);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getItemValues(a0, a1) { // fn#55167, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:2768, offset: 0x01377b7c, size: 444 bytes, params: 3, frame: 34
|
|
var r8;
|
|
var r9;
|
|
var r16;
|
|
var r17;
|
|
var r22;
|
|
var r14;
|
|
var r7;
|
|
var r3;
|
|
var value2;
|
|
var items2;
|
|
var length;
|
|
var value3;
|
|
var property;
|
|
var length2;
|
|
var property2;
|
|
var value4;
|
|
var property3;
|
|
var value5;
|
|
var value6;
|
|
var Array;
|
|
let value = a1;
|
|
const r1 = typeof value !== 'object' ? value : value.key;
|
|
if (typeof r1 === 'function') {
|
|
r3 = r1(a0);
|
|
} else {
|
|
value = null;
|
|
if (value == a0) {
|
|
r3 = value;
|
|
return r3 == null ? [] : global.Array.isArray(r3) ? r3 : [global.String(r3)];
|
|
}
|
|
var Object = global.Object;
|
|
var hasOwnProperty = Object.hasOwnProperty;
|
|
var call = hasOwnProperty.call;
|
|
if (Reflect.apply(call, hasOwnProperty, [a0, r1])) {
|
|
r3 = a0[r1];
|
|
return r3 == null ? [] : global.Array.isArray(r3) ? r3 : [global.String(r3)];
|
|
}
|
|
if (r1.includes('.')) {
|
|
value2 = r1.split('.');
|
|
items2 = [a0];
|
|
length = value2.length;
|
|
value3 = 0;
|
|
if (value3 < length) {
|
|
r8 = value3;
|
|
r9 = items2;
|
|
while (true) {
|
|
property = value2[r8];
|
|
items2 = [];
|
|
length2 = r9.length;
|
|
if (value3 < length2) {
|
|
r16 = value3;
|
|
r17 = items2;
|
|
while (true) {
|
|
property2 = r9[r16];
|
|
if (value != property2) {
|
|
Object = global.Object;
|
|
hasOwnProperty = Object.hasOwnProperty;
|
|
call = hasOwnProperty.call;
|
|
if (Reflect.apply(call, hasOwnProperty, [property2, property])) {
|
|
property3 = property2[property];
|
|
if (value == property3) {
|
|
r22 = r17;
|
|
break;
|
|
}
|
|
r17.push(property3);
|
|
r22 = r17;
|
|
break;
|
|
}
|
|
if (property !== '*') {
|
|
r22 = r17;
|
|
break;
|
|
}
|
|
value4 = r17.concat(property2);
|
|
r22 = value4;
|
|
break;
|
|
}
|
|
r22 = r17;
|
|
value5 = typeof r16 === 'bigint' ? r16 + 1n : +r16 + 1;
|
|
if (value5 < length2) {
|
|
r16 = value5;
|
|
r17 = r22;
|
|
continue;
|
|
}
|
|
r14 = r22;
|
|
break;
|
|
}
|
|
} else {
|
|
r14 = items2;
|
|
}
|
|
value6 = typeof r8 === 'bigint' ? r8 + 1n : +r8 + 1;
|
|
if (value6 < length) {
|
|
r8 = value6;
|
|
r9 = r14;
|
|
continue;
|
|
}
|
|
r7 = r14;
|
|
break;
|
|
}
|
|
} else {
|
|
r7 = items2;
|
|
}
|
|
Array = global.Array;
|
|
return Array.isArray(r7[value3]) ? [].concat.apply([], r7) : r7;
|
|
}
|
|
r3 = value;
|
|
}
|
|
return r3 == null ? [] : global.Array.isArray(r3) ? r3 : [global.String(r3)];
|
|
}
|
|
|
|
function getKeyAttributes(a0) { // fn#55168, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:3382, offset: 0x01377d38, size: 50 bytes, params: 2, frame: 15
|
|
return typeof a0 === 'string' ? env0_4 : env0_0.default({}, env0_4, a0);
|
|
}
|
|
|
|
function _fun55154(a0) { // fn#55154, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:653, offset: 0x01377653, size: 23 bytes, params: 2, frame: 11
|
|
return a0.sort(_fun55155);
|
|
}
|
|
|
|
function reduceItemsToRanked(a0, a1, a2) { // fn#55156, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:859, owner: matchSorter.reduceItemsToRanked, offset: 0x013776c8, size: 109 bytes, params: 4, frame: 19
|
|
var environment;
|
|
var push;
|
|
const highestRanking = getHighestRanking(a1, keys, require, importDefault);
|
|
const rank = highestRanking.rank;
|
|
const keyThreshold = highestRanking.keyThreshold;
|
|
if (rank >= (keyThreshold !== undefined ? keyThreshold : env0_3)) {
|
|
push = a0.push;
|
|
value = environment.__proto__;
|
|
Reflect.apply(push, a0, [env1_0.default({}, highestRanking, {item: a1, index: a2})]);
|
|
}
|
|
return a0;
|
|
}
|
|
|
|
function getMatchRankingGetAcronym(a0) { // fn#55161, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:2108, owner: getMatchRanking.getAcronym, offset: 0x013779e7, size: 50 bytes, params: 2, frame: 12
|
|
const env0_0 = '';
|
|
a0.split(' ').forEach(function(a0) {
|
|
a0.split('-').forEach(_fun55163);
|
|
});
|
|
return env0_0;
|
|
}
|
|
|
|
function getClosenessRanking(a0, a1) { // fn#55164, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:2266, owner: getMatchRanking.getClosenessRanking, offset: 0x01377a66, size: 168 bytes, params: 3, frame: 24
|
|
var environment;
|
|
var r5;
|
|
var r6;
|
|
var value3;
|
|
var value4;
|
|
var value5;
|
|
var value6;
|
|
const closure = findMatchingCharacter;
|
|
const env0_0 = 0;
|
|
let value = closure(a1[0], a0, 0);
|
|
if (value < 0) {
|
|
value = environment.__proto__;
|
|
return env1_2.NO_MATCH;
|
|
}
|
|
const length = a1.length;
|
|
const value2 = 1;
|
|
if (value2 < length) {
|
|
r5 = value2;
|
|
r6 = value;
|
|
loopExit2: while (true) {
|
|
value3 = closure(a1[r5], a0, r6);
|
|
if (value3 > -1) {
|
|
value4 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
|
|
if (!(value4 < length)) {
|
|
value = value3 - value;
|
|
value5 = env0_0 / a1.length;
|
|
value6 = environment.__proto__;
|
|
return env1_2.MATCHES + value5 * (value2 / value);
|
|
}
|
|
r5 = value4;
|
|
r6 = value3;
|
|
continue;
|
|
}
|
|
break loopExit2;
|
|
}
|
|
value = environment.__proto__;
|
|
return env1_2.NO_MATCH;
|
|
}
|
|
value = value - value;
|
|
value5 = env0_0 / a1.length;
|
|
const MATCHES = env1_2.MATCHES;
|
|
return MATCHES + value5 * (value2 / value);
|
|
}
|
|
|
|
function _fun55155(a0, a1) { // fn#55155, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:680, offset: 0x0137766a, size: 94 bytes, params: 3, frame: 17
|
|
const value = environment.__proto__;
|
|
const binding = env1_4;
|
|
const rank = a0.rank;
|
|
const keyIndex = a0.keyIndex;
|
|
const rank2 = a1.rank;
|
|
const keyIndex2 = a1.keyIndex;
|
|
return rank === rank2 ? keyIndex === keyIndex2 ? binding(a0,
|
|
a1) : keyIndex < keyIndex2 ? -1 : 1 : rank > rank2 ? -1 : 1;
|
|
}
|
|
|
|
function getHighestRanking(a0, a1, a2, a3) { // fn#55157, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:901, owner: matchSorter.reduceItemsToRanked.getHighestRanking, offset: 0x01377735, size: 242 bytes, params: 5, frame: 27
|
|
var environment;
|
|
var r1;
|
|
var r10;
|
|
var object;
|
|
var value;
|
|
var length;
|
|
var value2;
|
|
var property;
|
|
var keyAttributes;
|
|
var itemValues;
|
|
var length2;
|
|
var push;
|
|
var value5;
|
|
var value6;
|
|
const env0_0 = a2;
|
|
const env0_1 = a3;
|
|
if (a1) {
|
|
object = [];
|
|
length = a1.length;
|
|
value = 0;
|
|
value2 = environment.__proto__.__proto__;
|
|
if (value < length) {
|
|
r1 = value;
|
|
reducibleLoop3: while (true) {
|
|
property = a1[r1];
|
|
keyAttributes = getKeyAttributes(property);
|
|
itemValues = getItemValues(a0, property);
|
|
length2 = itemValues.length;
|
|
if (value < length2) {
|
|
r10 = value;
|
|
reducibleLoop4: while (true) {
|
|
push = object.push;
|
|
Reflect.apply(push, object, [{itemValue: itemValues[r10], attributes: keyAttributes}]);
|
|
value5 = typeof r10 === 'bigint' ? r10 + 1n : +r10 + 1;
|
|
if (value5 < length2) {
|
|
r10 = value5;
|
|
continue reducibleLoop4;
|
|
}
|
|
break reducibleLoop4;
|
|
}
|
|
}
|
|
value6 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
|
|
if (value6 < length) {
|
|
r1 = value6;
|
|
continue reducibleLoop3;
|
|
}
|
|
break reducibleLoop3;
|
|
}
|
|
}
|
|
return object.reduce(_fun55158, {rankedValue: a0, rank: env2_2.NO_MATCH, keyIndex: -1,
|
|
keyThreshold: a3.threshold});
|
|
}
|
|
object = {rankedValue: a0};
|
|
value = environment.__proto__.__proto__;
|
|
object.rank = getMatchRanking(a0, a2, a3);
|
|
object.keyIndex = -1;
|
|
object.keyThreshold = a3.threshold;
|
|
return object;
|
|
}
|
|
|
|
function _fun55162(a0) { // fn#55162, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:2169, offset: 0x01377a19, size: 38 bytes, params: 2, frame: 11
|
|
a0.split('-').forEach(_fun55163);
|
|
}
|
|
|
|
function findMatchingCharacter(a0, a1, a2) { // fn#55165, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:2312, owner: getMatchRanking.getClosenessRanking.findMatchingCharacter, offset: 0x01377b0e, size: 68 bytes, params: 4, frame: 6
|
|
var r2;
|
|
let value = a2;
|
|
const length = a1.length;
|
|
if (value < length) {
|
|
r2 = value;
|
|
loopExit1: while (true) {
|
|
if (a1[r2] === a0) {
|
|
value = environment;
|
|
env0_0 += 1;
|
|
return r2 + 1;
|
|
}
|
|
value = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value < length) {
|
|
r2 = value;
|
|
continue;
|
|
}
|
|
break loopExit1;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
function _fun55158({rank, rankedValue, keyIndex, keyThreshold}, {itemValue, attributes}, a2) { // fn#55158, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:1257, offset: 0x01377827, size: 158 bytes, params: 4, frame: 22
|
|
var r1;
|
|
var r2;
|
|
var r3;
|
|
var r4;
|
|
const value = a2;
|
|
const matchRanking = getMatchRanking(itemValue, importDefault, importAll);
|
|
const minRanking = attributes.minRanking;
|
|
const maxRanking = attributes.maxRanking;
|
|
const threshold = attributes.threshold;
|
|
const r7 = matchRanking < minRanking && matchRanking >= env3_2.MATCHES ? minRanking : matchRanking > maxRanking ? maxRanking : matchRanking;
|
|
if (r7 > rank) {
|
|
r1 = threshold;
|
|
r2 = value;
|
|
r3 = r7;
|
|
r4 = itemValue;
|
|
} else {
|
|
r1 = keyThreshold;
|
|
r2 = keyIndex;
|
|
r3 = rank;
|
|
r4 = rankedValue;
|
|
}
|
|
return {rankedValue: r4, rank: r3, keyIndex: r2, keyThreshold: r1};
|
|
}
|
|
|
|
function _fun55163(a0) { // fn#55163, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7115:2203, offset: 0x01377a3f, size: 39 bytes, params: 2, frame: 15
|
|
env1_0 = env1_0 + a0.substr(0, 1);
|
|
}
|
|
|