413 lines
15 KiB
TypeScript
413 lines
15 KiB
TypeScript
/* Metro module 5194; source: modules/user_profile/WidgetStore.tsx; dependencies: [57, 6, 7, 15, 17, 18, 1878, 5189, 22, 566, 694, 2] */
|
|
function _fun45829(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#45829, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:6, offset: 0x011993f7, size: 469 bytes, params: 8, frame: 18
|
|
const _arrayLikeToArray_45832 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_3 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_4 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_5 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_6 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_7 = importDefault(18) /* metro dependency 18 */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const userProfileStore = importDefault(5189) /* metro dependency 5189: UserProfileStore */;
|
|
object = {suggestedGamesIds: [], suggestedWishlistGamesIds: []};
|
|
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
|
|
let value = _fun45836(Store);
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{WIDGET_PENDING_SET: WIDGET_PENDING_SET, WIDGET_PENDING_SAVE_START: function() {
|
|
env0_12 = true;
|
|
}, WIDGET_PENDING_SAVE_SUCCESS: WIDGET_PENDING_SAVE_SUCCESS, WIDGET_PENDING_SAVE_FAILURE: function() {
|
|
env0_12 = false;
|
|
}, WIDGET_SUGGESTED_FETCH_SUCCESS: WIDGET_SUGGESTED_FETCH_SUCCESS, WIDGET_SUGGESTED_FETCH_FAILURE: function() {
|
|
env0_14 = true;
|
|
env0_15 = false;
|
|
}, WIDGET_SUGGESTED_FETCH_START: function() {
|
|
env0_15 = true;
|
|
env0_14 = false;
|
|
env0_16 = true;
|
|
}, WIDGET_PENDING_CLEAR: function() {
|
|
env0_10 = null;
|
|
env0_11 = null;
|
|
}, WIDGET_SUGGESTED_REMOVE_GAME: WIDGET_SUGGESTED_REMOVE_GAME});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_profile/WidgetStore.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_45830(a0, a1) { // fn#45830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:189, offset: 0x011995cc, size: 370 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun45831;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_45832(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_45832(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_45832(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun45831;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
}
|
|
|
|
function _isNativeReflectConstruct_45833() { // fn#45833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:1099, offset: 0x0119973e, size: 94 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_45833_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun45836(a0) { // fn#45836, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:1390, offset: 0x0119979c, size: 385 bytes, params: 2, frame: 16
|
|
const closure = WidgetStore;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{key: 'initialize', value: function() {
|
|
this.waitFor(UserStore);
|
|
}}, {key: 'getPendingWidgets', value: value_45839}, {key: 'getSaveablePendingWidgets', value: value_45840},
|
|
{key: 'hasPendingChanges', value: value_45842}, {key: 'getWidgetUpdates', value: value_45843},
|
|
{key: 'getChangedWidgets', value: function() {
|
|
return this.getWidgetUpdates().changedWidgets;
|
|
}}, {key: 'getRemovedWidgets', value: function() {
|
|
return this.getWidgetUpdates().removedWidgets;
|
|
}}, {key: 'hasUnsavedChanges', value: function() {
|
|
var r0;
|
|
var {changedWidgets, removedWidgets, hasOrderChanges} = this.getWidgetUpdates();
|
|
r0 = changedWidgets.length > 0 || removedWidgets.length > 0;
|
|
r0 = !r0 ? hasOrderChanges : r0;
|
|
return r0;
|
|
}}, {key: 'canSaveChanges', value: function() {
|
|
var r0;
|
|
var value = this.getSaveablePendingWidgets();
|
|
var value2 = value != null;
|
|
if (value2) {
|
|
value = value.every(_fun45850);
|
|
r0 = value;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}}, {key: 'isSubmitting', get: get_45851}, {key: 'suggestedFetchError', get: get_45852},
|
|
{key: 'suggestedFetchIsLoading', get: get_45853}, {key: 'suggestedFetchAttempted', get: get_45854},
|
|
{key: 'suggestedGameIds', get: get_45855}]);
|
|
}
|
|
|
|
function WIDGET_PENDING_SET({widgets}) { // fn#45856, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:3436, offset: 0x01199c0f, size: 94 bytes, params: 2, frame: 13
|
|
var r0;
|
|
var currentUser;
|
|
if (env0_11 === null) {
|
|
currentUser = UserStore.getCurrentUser();
|
|
if (currentUser != null) {
|
|
r0 = UserProfileStore.getUserProfile(currentUser.id)?.widgets ?? [];
|
|
}
|
|
}
|
|
}
|
|
|
|
function WIDGET_PENDING_SAVE_SUCCESS() { // fn#45858, offset: 0x01199c6d, size: 31 bytes, params: 1, frame: 3
|
|
if (env0_10 === null) {
|
|
}
|
|
}
|
|
|
|
function WIDGET_SUGGESTED_FETCH_SUCCESS({suggestedGamesIds, suggestedWishlistGamesIds}) { // fn#45860, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:3896, offset: 0x01199c8c, size: 48 bytes, params: 2, frame: 4
|
|
const binding = env0_13;
|
|
binding.suggestedGamesIds = suggestedGamesIds;
|
|
binding.suggestedWishlistGamesIds = suggestedWishlistGamesIds;
|
|
}
|
|
|
|
function WIDGET_SUGGESTED_REMOVE_GAME({applicationId}) { // fn#45864, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:4316, offset: 0x01199cf7, size: 79 bytes, params: 2, frame: 13
|
|
const binding = env0_13;
|
|
binding.suggestedGamesIds = binding.suggestedGamesIds.filter(function(a0) {
|
|
return a0 !== applicationId;
|
|
});
|
|
binding.suggestedWishlistGamesIds = binding.suggestedWishlistGamesIds.filter(function(a0) {
|
|
return a0 !== applicationId;
|
|
});
|
|
}
|
|
|
|
function value_45840() { // fn#45840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:1796, offset: 0x0119991d, size: 39 bytes, params: 1, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
const value2 = null;
|
|
return value2 == env1_10 ? value2 : env1_10.filter(function(a0) {
|
|
return !a0.isDiscardable();
|
|
});
|
|
}
|
|
|
|
function value_45842() { // fn#45842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:1894, offset: 0x01199958, size: 77 bytes, params: 1, frame: 15
|
|
var r1;
|
|
var r0;
|
|
var value3;
|
|
var defaultImport;
|
|
const value = environment.__proto__;
|
|
const value2 = env1_10 !== null;
|
|
if (value2) {
|
|
value3 = env1_11 === null;
|
|
if (value3) {
|
|
r1 = value3;
|
|
} else {
|
|
defaultImport = importDefault(22) /* metro dependency 22 */;
|
|
r1 = !defaultImport.isEqual(env1_10, env1_11);
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_45843() { // fn#45843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:1989, offset: 0x011999a5, size: 457 bytes, params: 1, frame: 26
|
|
var r6;
|
|
var r0;
|
|
var r3;
|
|
var r8;
|
|
var id;
|
|
var id2;
|
|
var value13;
|
|
var value14;
|
|
var property;
|
|
var property2;
|
|
var value15;
|
|
var value16;
|
|
var isEqual2;
|
|
var value17;
|
|
var value20;
|
|
var value21;
|
|
var property3;
|
|
var has;
|
|
var value22;
|
|
var id3;
|
|
var value24;
|
|
var value25;
|
|
const saveablePendingWidgets = this.getSaveablePendingWidgets();
|
|
if (saveablePendingWidgets == null) {
|
|
return {changedWidgets: saveablePendingWidgets ?? [], removedWidgets: [], hasOrderChanges: false};
|
|
}
|
|
if (env1_11 == null) {
|
|
return {changedWidgets: saveablePendingWidgets ?? [], removedWidgets: [], hasOrderChanges: false};
|
|
}
|
|
let Map = global.Map;
|
|
const binding = env1_11;
|
|
let map = binding.map;
|
|
map = new Map(Reflect.apply(map, binding, [function(a0) {
|
|
return [a0.id, a0];
|
|
}]));
|
|
Map = global.Map;
|
|
map = new Map(saveablePendingWidgets.map(function(a0) {
|
|
return [a0.id, a0];
|
|
}));
|
|
const items2 = [];
|
|
const items3 = [];
|
|
const _createForOfIteratorHelperLoose_45830Binding = _createForOfIteratorHelperLoose_45830;
|
|
const value9 = undefined;
|
|
const value10 = _createForOfIteratorHelperLoose_45830Binding(map);
|
|
const value11 = value10();
|
|
let done = value11.done;
|
|
const value12 = 0;
|
|
if (!done) {
|
|
r6 = value11;
|
|
while (true) {
|
|
value13 = r6.value;
|
|
value14 = env1_2(value13, 2);
|
|
property = value14[value12];
|
|
property2 = value14[1];
|
|
value15 = map.get(property);
|
|
value16 = value15 != null;
|
|
if (value16) {
|
|
isEqual2 = property2.isEqual(value15);
|
|
r0 = isEqual2;
|
|
} else {
|
|
r0 = value16;
|
|
}
|
|
if (r0) {
|
|
continue;
|
|
}
|
|
items2.push(property2);
|
|
value17 = value10();
|
|
done = value17.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r6 = value17;
|
|
continue;
|
|
}
|
|
}
|
|
const value18 = _createForOfIteratorHelperLoose_45830(map);
|
|
const value19 = value18();
|
|
done = value19.done;
|
|
if (!done) {
|
|
r3 = value19;
|
|
while (true) {
|
|
value20 = r3.value;
|
|
value21 = env1_2(value20, 2);
|
|
property = value21[value12];
|
|
property3 = value21[1];
|
|
has = map.has;
|
|
if (!Reflect.apply(has, map, [property])) {
|
|
items3.push(property3);
|
|
}
|
|
value22 = value18();
|
|
done = value22.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r3 = value22;
|
|
continue;
|
|
}
|
|
}
|
|
let length = saveablePendingWidgets.length;
|
|
const value23 = false;
|
|
if (value12 < length) {
|
|
r8 = value12;
|
|
while (true) {
|
|
property = saveablePendingWidgets[r8];
|
|
id = property == null ? value9 : property.id;
|
|
property = env1_11[r8];
|
|
if (property == null) {
|
|
id2 = value9;
|
|
continue;
|
|
}
|
|
id3 = property.id;
|
|
id2 = id3;
|
|
value24 = true;
|
|
if (id !== id2) {
|
|
r3 = value24;
|
|
break;
|
|
}
|
|
value25 = typeof r8 === 'bigint' ? r8 + 1n : +r8 + 1;
|
|
length = saveablePendingWidgets.length;
|
|
if (value25 < length) {
|
|
r8 = value25;
|
|
continue;
|
|
}
|
|
r3 = value23;
|
|
break;
|
|
}
|
|
} else {
|
|
r3 = value23;
|
|
}
|
|
return {changedWidgets: items2, removedWidgets: items3, hasOrderChanges: r3};
|
|
}
|
|
|
|
function value_45849() { // fn#45849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5372:3022, offset: 0x01199bd6, size: 42 bytes, params: 1, frame: 12
|
|
var r0;
|
|
let value = this.getSaveablePendingWidgets();
|
|
const value2 = value != null;
|
|
if (value2) {
|
|
value = value.every(function(a0) {
|
|
return a0.isValid();
|
|
});
|
|
r0 = value;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|