Files
2026-07-28 01:06:53 +03:00

205 lines
10 KiB
TypeScript

/* Metro module 4046; source: modules/client_themes/SavedCustomThemeStore.tsx; dependencies: [6, 7, 15, 17, 18, 1313, 1216, 566, 694, 2] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import SentryUtilsNative from '../../utils/SentryUtils.native.tsx'; /* Metro dependency 1216 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ThemeConstantsModule from '../user_settings/ThemeConstants.tsx'; /* Metro dependency 1313 */
function _fun33372(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#33372, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:6, offset: 0x0102d43b, size: 422 bytes, params: 8, frame: 22
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ThemeConstantsModule;
value.PROTO_THEME_MAP_WEB_REFRESH;
const env0_7 = value.PROTO_THEME_MAP_MOBILE;
object = {NOT_FETCHED: 0};
object[0] = 'NOT_FETCHED';
object.IS_FETCHING = 1;
object[1] = 'IS_FETCHING';
object.HAS_FETCHED = 2;
object[2] = 'HAS_FETCHED';
object.ERROR = 3;
object[3] = 'ERROR';
const env0_9 = [];
const env0_10 = object.NOT_FETCHED;
const PersistedStore = (Flux).PersistedStore;
value = _fun33377(PersistedStore);
value.displayName = 'SavedCustomThemeStore';
value.persistKey = 'SavedCustomThemeStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{SAVED_CUSTOM_THEMES_FETCH_START: SAVED_CUSTOM_THEMES_FETCH_START,
SAVED_CUSTOM_THEMES_FETCH_SUCCESS: SAVED_CUSTOM_THEMES_FETCH_SUCCESS,
SAVED_CUSTOM_THEMES_FETCH_FAILURE: SAVED_CUSTOM_THEMES_FETCH_FAILURE});
(FileImportTrackerModule).fileFinishedImporting('modules/client_themes/SavedCustomThemeStore.tsx');
exports.default = value;
exports.FetchState = object;
function _isNativeReflectConstruct_33373() { // fn#33373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:217, offset: 0x0102d5e1, 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_33373_isNativeReflectConstruct = function() {
return !!result;
})();
}
function validateSavedTheme(a0) { // fn#33376, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:583, offset: 0x0102d63f, size: 180 bytes, params: 2, frame: 17
var r5;
var r2;
var r0;
var value;
var base_theme;
var property;
var colors;
var length;
var value2;
var gradient_angle;
var value3;
var base_mix;
var value4;
var value5;
var error;
var captureMessage;
var value6;
try {
value = environment;
base_theme = a0.base_theme;
property = PROTO_THEME_MAP_MOBILE[base_theme];
colors = a0.colors;
length = colors.length;
value2 = length > 0;
if (value2) {
gradient_angle = a0.gradient_angle;
value3 = typeof gradient_angle === 'number';
r5 = value3;
} else {
r5 = value2;
}
if (r5) {
base_mix = a0.base_mix;
value4 = typeof base_mix === 'number';
r2 = value4;
} else {
r2 = r5;
}
if (r2) {
value5 = property != null;
r0 = value5;
} else {
r0 = r2;
}
} catch (error) {
value = importDefault(1216) /* metro dependency 1216: SentryUtilsNative */;
captureMessage = value.captureMessage;
value6 = 'Invalid saved custom theme: ' + error;
Reflect.apply(captureMessage, value, [value6, {tags: {app_context: 'SavedCustomThemeStore'}}]);
return false;
}
return r0;
}
function _fun33377(a0) { // fn#33377, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:866, offset: 0x0102d6f3, size: 233 bytes, params: 2, frame: 16
const SavedCustomThemeStore2 = SavedCustomThemeStore;
Inherits(SavedCustomThemeStore2, a0);
return CreateClass(SavedCustomThemeStore2, [{key: 'initialize', value: value_33379}, {key: 'getState',
value: value_33380}, {key: 'getSavedCustomTheme', value: value_33381}, {key: 'getFetchState',
value: function() {
return NOT_FETCHED;
}}, {key: 'hasSavedCustomThemes', value: value_33383}, {key: 'isFetching', value: value_33384}, {key: 'hasFetched',
value: value_33385}, {key: 'hasError', value: value_33386}]);
function SavedCustomThemeStore() { // fn#33378, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:878, offset: 0x00ff71a7, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_2(this, SavedCustomThemeStore);
const value3 = env1_5(SavedCustomThemeStore);
return env1_4(this, _isNativeReflectConstruct_33373() ? global.Reflect.construct(value3, arguments,
env1_5(this).constructor) : value3.apply(this, arguments));
}
function value_33379(a0) { // fn#33379, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1201, offset: 0x0102d7dc, size: 43 bytes, params: 2, frame: 2
var savedCustomThemes;
var value;
if (a0 != null) {
savedCustomThemes = a0.savedCustomThemes;
value = environment.__proto__;
}
env1_10 = env1_8.NOT_FETCHED;
}
function value_33380() { // fn#33380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1286, offset: 0x0102d807, size: 32 bytes, params: 1, frame: 4
return {savedCustomThemes: env1_9 ?? []};
}
function value_33381() { // fn#33381, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1371, offset: 0x0102d827, size: 71 bytes, params: 1, frame: 5
const binding = env1_9;
const value2 = null;
return (value2 == binding ? undefined : binding.length) > 0 && env1_9[0].colors.length > 0 ? env1_9[0] : value2;
}
function value_33383() { // fn#33383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1543, offset: 0x0102d86e, size: 31 bytes, params: 1, frame: 3
const value = environment.__proto__;
return env1_9?.length > 0;
}
function value_33384() { // fn#33384, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1624, offset: 0x0102d88d, size: 23 bytes, params: 1, frame: 2
const IS_FETCHING = env1_8.IS_FETCHING;
return NOT_FETCHED === IS_FETCHING;
}
function value_33385() { // fn#33385, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1686, offset: 0x0102d8a4, size: 23 bytes, params: 1, frame: 2
const HAS_FETCHED = env1_8.HAS_FETCHED;
return NOT_FETCHED === HAS_FETCHED;
}
function value_33386() { // fn#33386, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1746, offset: 0x0102d8bb, size: 23 bytes, params: 1, frame: 2
const ERROR = env1_8.ERROR;
return NOT_FETCHED === ERROR;
}
}
function SAVED_CUSTOM_THEMES_FETCH_START() { // fn#33387, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:1933, offset: 0x0102d8d2, size: 21 bytes, params: 1, frame: 2
env0_10 = env0_8.IS_FETCHING;
}
function SAVED_CUSTOM_THEMES_FETCH_SUCCESS({themes}) { // fn#33388, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:2024, offset: 0x0102d8e7, size: 65 bytes, params: 2, frame: 12
env0_10 = env0_8.HAS_FETCHED;
env0_9 = themes.filter(validateSavedTheme).map(function(a0) {
return {colors: a0.colors, gradient_angle: a0.gradient_angle, base_mix: a0.base_mix,
base_theme: PROTO_THEME_MAP_MOBILE[a0.base_theme]};
});
}
function SAVED_CUSTOM_THEMES_FETCH_FAILURE({error}) { // fn#33390, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4204:2244, offset: 0x0102d964, size: 81 bytes, params: 2, frame: 16
env0_10 = env0_8.ERROR;
(SentryUtilsNative).captureException(error,
{tags: {app_context: 'SavedCustomThemeStore'}});
}
}
global.__d(_fun33372, 4046, [6, 7, 15, 17, 18, 1313, 1216, 566, 694,
2]) /* metro module 4046, dependencies: [6, 7, 15, 17, 18, 1313, 1216, 566, 694, 2] */;