Files
discord-decomp/sources/modules/mfa/native/screens/BackupScreen.tsx
T
2026-07-28 01:06:53 +03:00

248 lines
13 KiB
TypeScript

/* Metro module 14221; source: modules/mfa/native/screens/BackupScreen.tsx; dependencies: [5, 57, 31, 33, 14219, 4573, 1244, 8973, 14214, 14220, 14217, 2] */
import Module00005 from '../../../../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
import UseWideAuthView from '../../../auth/native/useWideAuthView.tsx'; /* Metro dependency 8973 */
import MfaOptionScreen from './MfaOptionScreen.tsx'; /* Metro dependency 14214 */
import Button from '../components/button.tsx'; /* Metro dependency 14217 */
import ClipboardCopyInput from '../components/ClipboardCopyInput.tsx'; /* Metro dependency 14220 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as TextModule from '../../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
function _fun107537(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#107537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:6, offset: 0x022ffef2, size: 215 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/mfa/native/screens/BackupScreen.tsx');
exports.default = BackupScreen;
function isValidClipboardCode_107538(a0) { // fn#107538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:166, offset: 0x022fffc9, size: 80 bytes, params: 2, frame: 15
const length = a0.length;
const BACKUP_CODE_MIN_LENGTH = (require(14219) /* metro dependency 14219: MFA */).BACKUP_CODE_MIN_LENGTH;
return length >= BACKUP_CODE_MIN_LENGTH && a0.length <= (require(14219) /* metro dependency 14219: MFA */).BACKUP_CODE_MAX_LENGTH;
}
function getFormattedExplainer(a0) { // fn#107539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:289, offset: 0x02300019, size: 328 bytes, params: 2, frame: 21
var object2;
const intl = (IndexNativeModule).intl;
var string;
const t = (IndexNativeModule).t;
var items2;
const Text = (TextModule).Text;
if (a0 > 0) {
object2 = {variant: 'text-md/normal', children: [intl.string(t.RRtlLg), intl.format(t.tsWkAE,
{countdown: a0})]};
} else {
string = intl.string;
items2 = [Reflect.apply(string, intl, [t.RRtlLg])];
string = intl.string;
items2[1] = Reflect.apply(string, intl, [t.v3a6Pd]);
object2 = {variant: 'text-md/normal', children: items2};
}
return <Text {...object2} />;
}
function BackupScreen({mfaChallenge, finish}) { // fn#107540, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:680, offset: 0x02300161, size: 852 bytes, params: 2, frame: 37
const value2 = (UseWideAuthView)();
const binding = env0_5;
let useState = binding.useState;
const value3 = Reflect.apply(useState, binding, [false]);
const binding2 = env0_4;
const value4 = binding2(value3, 2);
const property = value4[0];
const env0_1 = value4[1];
useState = binding.useState;
const value5 = binding2(Reflect.apply(useState, binding, ['']), 2);
const property2 = value5[0];
const env0_3 = value5[1];
useState = binding.useState;
const value6 = binding2(Reflect.apply(useState, binding, [undefined]), 2);
const property3 = value6[0];
var env0_4 = value6[1];
useState = binding.useState;
const value7 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property4 = value7[0];
var env0_5 = value7[1];
useState = binding.useState;
const value8 = binding2(Reflect.apply(useState, binding, [10]), 2);
const property5 = value8[0];
const env0_7 = value8[1];
binding.useEffect(_fun107541, [property5]);
const env0_8 = binding.useCallback(_fun107545(), [finish]);
object = {};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const B2T1HD = (require(1244) /* metro dependency 1244: indexNative */).t.B2T1HD;
object.headerText = Reflect.apply(string, intl, [B2T1HD]);
object.subtitle = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.c5J7O0);
const jsxRuntimeEnv0_8Binding = jsxRuntimeEnv0_8;
const formattedExplainer = getFormattedExplainer(property5);
const clipboardCopyInputProps = {label: intl.string((require(1244) /* metro dependency 1244: indexNative */).t['C/ZAw/']),
placeholder: intl.string((require(1244) /* metro dependency 1244: indexNative */).t.fZSi1D),
isValidClipboardCode: isValidClipboardCode_107538};
const BACKUP_CODE_MAX_LENGTH = (require(14219) /* metro dependency 14219: MFA */).BACKUP_CODE_MAX_LENGTH;
clipboardCopyInputProps.maxLength = BACKUP_CODE_MAX_LENGTH;
clipboardCopyInputProps.onChangeCode = onChangeCode;
clipboardCopyInputProps.error = property3;
clipboardCopyInputProps.isDisabled = property || property4;
clipboardCopyInputProps.autoFocus = !value2;
object.input = (
<>
{formattedExplainer}
<ClipboardCopyInput {...clipboardCopyInputProps} />
</>
);
const defaultImport3 = Button;
const defaultImport3Props = {variant: 'primary',
text: intl.string((require(1244) /* metro dependency 1244: indexNative */).t.geKm7t),
loading: property || property4, onPress: onPress_107550};
let r9 = property || property4;
r9 = !r9 ? property2.length < (require(14219) /* metro dependency 14219: MFA */).BACKUP_CODE_MIN_LENGTH : r9;
r9 = !r9 ? property5 > 0 : r9;
defaultImport3Props.disabled = r9;
object.submit = ((Component) => <Component {...defaultImport3Props} />)(defaultImport3);
object.screenProps = {mfaChallenge: mfaChallenge, finish: finish};
object.mfaMethod = 'backup';
return <MfaOptionScreen {...object} />;
function _fun107541() { // fn#107541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:962, offset: 0x023004b5, size: 61 bytes, params: 1, frame: 14
if (JsxRuntimeModule.jsxs <= 0) {
return undefined;
}
const env0_0 = global.setTimeout(_fun107542, 1000);
return _fun107544;
function _fun107542() { // fn#107542, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:997, offset: 0x023004f2, size: 25 bytes, params: 1, frame: 11
env1_7(function(a0) {
return a0 - 1;
});
}
function _fun107544() { // fn#107544, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:1027, offset: 0x016d7e7e, size: 24 bytes, params: 1, frame: 11
return global.clearTimeout(env0_0);
}
}
function _fun107545() { // fn#107545, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:1075, offset: 0x0230050b, size: 36 bytes, params: 1, frame: 12
const env0_0 = env1_3(_fun107547);
return _fun107548;
function* _fun107547(a0) { // fn#107547, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:1095, offset: 0x0230053a, size: 174 bytes, params: 2, frame: 19
var message;
var r3;
var object;
var moduleValue;
var value4;
var value5;
var binding;
var error;
var body;
let value = undefined;
if (true) {
value = undefined;
env2_4(value);
importDefault(true);
reducibleJoin3: while (true) {
reduciblePort20: while (true) {
exceptionLanding14: while (true) {
try {
} catch (error) {
break exceptionLanding14;
}
break reducibleJoin3;
}
binding = env2_4;
reducibleJoin17: while (true) {
if (error == null) {
message = value;
break reducibleJoin17;
}
body = error.body;
if (body == null) {
message = value;
break reducibleJoin17;
}
message = body.message;
break reducibleJoin17;
}
reducibleJoin19: while (true) {
if (message != null) {
r3 = message;
break reducibleJoin19;
}
message = error.message;
r3 = message;
break reducibleJoin19;
}
binding(r3);
break reduciblePort20;
}
importDefault(false);
return value;
}
try {
object = {};
} catch (error) {
break exceptionLanding14;
}
try {
object.mfaType = 'backup';
} catch (error) {
break exceptionLanding14;
}
try {
object.data = a0;
} catch (error) {
break exceptionLanding14;
}
try {
moduleValue = require(object);
} catch (error) {
break exceptionLanding14;
}
yield moduleValue;
try {
value4 = undefined;
value5 = false;
} catch (error) {
break exceptionLanding14;
}
if (value5) {
return value4;
}
try {
binding = env2_5;
} catch (error) {
break exceptionLanding14;
}
try {
binding(true);
} catch (error) {
break exceptionLanding14;
}
importDefault(false);
}
return value;
}
function _fun107548() { // fn#107548, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:1270, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return env0_0.apply(this, arguments);
}
}
function onChangeCode(a0) { // fn#107549, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:1685, owner: BackupScreen.onChangeCode, offset: 0x023005e8, size: 28 bytes, params: 2, frame: 12
env0_3(a0);
env0_4(undefined);
}
function BackupScreenOnPress() { // fn#107550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14418:1856, owner: BackupScreen.onPress, offset: 0x02300604, size: 20 bytes, params: 1, frame: 11
return env0_8(env0_2);
}
}
}
global.__d(_fun107537, 14221, [5, 57, 31, 33, 14219, 4573, 1244, 8973, 14214, 14220, 14217,
2]) /* metro module 14221, dependencies: [5, 57, 31, 33, 14219, 4573, 1244, 8973, 14214, 14220, 14217, 2] */;