342 lines
17 KiB
TypeScript
342 lines
17 KiB
TypeScript
/* Metro module 9026; source: modules/phone/native/CodeField.tsx; dependencies: [57, 31, 27, 33, 4501, 697, 1305, 7981, 1244, 4578, 4573, 5467, 2] */
|
|
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import KeyboardAwareView from '../../keyboard/native/KeyboardAwareView.tsx'; /* Metro dependency 5467 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
|
|
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
|
|
import * as TextInputNativeModule from '../../../design/components/TextInput/native/TextInput.native.tsx'; /* Metro dependency 7981 */
|
|
|
|
function _fun70213(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#70213, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:6, offset: 0x01cf2a09, size: 601 bytes, params: 8, frame: 25
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ReactNativeModule;
|
|
const env0_5 = value.View;
|
|
const env0_6 = value.ScrollView;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_7 = value.jsx;
|
|
const env0_8 = value.jsxs;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
const object2 = {};
|
|
object2.viewWrapper = {flex: 1};
|
|
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
|
|
object2.background = {backgroundColor: BACKGROUND_BASE_LOW, flex: 1};
|
|
object2.backgroundFlex = {'flex': 1, 'justifyContent': 'space-between'};
|
|
object2.container = {padding: 16};
|
|
object2.title = {textAlign: 'center'};
|
|
object2.subtitle = {'marginTop': 8, 'lineHeight': 18, 'textAlign': 'center'};
|
|
object2.inputContainer = {'marginTop': 20, 'width': '100%', 'alignItems': 'center'};
|
|
object2.codeContainer = {'maxWidth': 336, 'width': '100%', 'flexDirection': 'row', 'justifyContent': 'space-around'};
|
|
object2.spacer = {width: 4};
|
|
const object4 = {'borderWidth': 1, 'borderRadius': 5, 'alignItems': 'center'};
|
|
let BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
|
|
object4.backgroundColor = BACKGROUND_BASE_LOWEST;
|
|
BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
|
|
object4.borderColor = BACKGROUND_BASE_LOWEST;
|
|
object2.inputWrapper = object4;
|
|
const RED_400 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.RED_400;
|
|
object2.inputWrapperError = {borderColor: RED_400};
|
|
object2.input = {textAlign: 'center'};
|
|
object2.singleInputWrapper = {width: '100%'};
|
|
object2.singleInputButton = {'marginTop': 8, 'justifyContent': 'flex-end'};
|
|
const env0_10 = Reflect.apply(createStyles, value, [object2]);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/phone/native/CodeField.tsx');
|
|
exports.default = CodeField;
|
|
exports.CodeType = {NUMERIC: 'numeric', ALPHANUMERIC: 'alphanumeric'};
|
|
exports.CodeBlocks = CodeBlocks;
|
|
function SingleCodeInput({loading, error, count, codeType = env0_9.NUMERIC, onCodeEntered, disabled, code, setCode}) { // fn#70214, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:1066, offset: 0x01cf2c62, size: 500 bytes, params: 2, frame: 29
|
|
loading = !(loading === undefined) && loading;
|
|
count = count === undefined ? 6 : count;
|
|
const styles = useStyles();
|
|
const TextInput = (TextInputNativeModule).TextInput;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
const NUMERIC = env0_9.NUMERIC;
|
|
const textInput = (
|
|
<TextInput
|
|
errorMessage={error}
|
|
value={code}
|
|
autoCapitalize="characters"
|
|
maxLength={count}
|
|
accessibilityLabel={Reflect.apply(string, intl, [t['ysthA+']])}
|
|
textContentType="oneTimeCode"
|
|
keyboardType={codeType !== NUMERIC ? 'default' : 'number-pad'}
|
|
onChange={onChange_70215}
|
|
isDisabled={disabled}
|
|
isClearable
|
|
autoFocus
|
|
/>
|
|
);
|
|
const Button = (ButtonNativeModule).Button;
|
|
return (
|
|
<View style={styles.singleInputWrapper}>
|
|
{textInput}
|
|
<View style={styles.singleInputButton}>
|
|
<Button
|
|
loading={loading}
|
|
variant="primary"
|
|
size="lg"
|
|
text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['13ofGu'])}
|
|
onPress={function() {
|
|
return onCodeEntered(code);
|
|
}}
|
|
disabled={code.length !== count || disabled}
|
|
/>
|
|
</View>
|
|
</View>
|
|
);
|
|
function SingleCodeInputOnChange(a0) { // fn#70215, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:1482, owner: SingleCodeInput.onChange, offset: 0x01cf2e56, size: 85 bytes, params: 2, frame: 14
|
|
const binding = env0_0;
|
|
const NUMERIC = env1_9.NUMERIC;
|
|
setCode(a0.replace(binding === NUMERIC ? RegExp('\\D', 'g') : RegExp('[^A-Z0-9]', 'g'), ''));
|
|
}
|
|
|
|
}
|
|
|
|
function CodeFieldInner({title, description, error, onCodeEntered, loading, count, codeType = env0_9.NUMERIC, actions, footer, backgroundStyle, disabled}) { // fn#70217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:1783, offset: 0x01cf2ebf, size: 515 bytes, params: 2, frame: 37
|
|
loading = !(loading === undefined) && loading;
|
|
count = count === undefined ? 6 : count;
|
|
const styles = useStyles();
|
|
const [property, property2] = Module00057(ReactModule.useState(''), 2);
|
|
const items3 = [styles.background, backgroundStyle];
|
|
const Text = (TextModule).Text;
|
|
const items2 = [
|
|
<Text
|
|
style={styles.title}
|
|
accessibilityRole="header"
|
|
variant="heading-xl/extrabold"
|
|
color="mobile-text-heading-primary"
|
|
>
|
|
{title}
|
|
</Text>,
|
|
];
|
|
items2[1] = (
|
|
<Text
|
|
style={styles.subtitle}
|
|
variant="text-sm/medium"
|
|
color="text-default"
|
|
>
|
|
{description}
|
|
</Text>
|
|
);
|
|
items2[2] = (
|
|
<View style={styles.inputContainer}>
|
|
<SingleCodeInput
|
|
loading={loading}
|
|
error={error}
|
|
count={count}
|
|
onCodeEntered={onCodeEntered}
|
|
codeType={codeType}
|
|
disabled={disabled}
|
|
code={property}
|
|
setCode={property2}
|
|
/>
|
|
</View>
|
|
);
|
|
items2[3] = actions;
|
|
return (
|
|
<ScrollView
|
|
style={items3}
|
|
contentContainerStyle={styles.backgroundFlex}
|
|
keyboardShouldPersistTaps="handled"
|
|
alwaysBounceVertical={false}
|
|
>
|
|
<View style={styles.container}>
|
|
{items2}
|
|
</View>
|
|
{((Component) => <Component>{footer}</Component>)(KeyboardAwareView)}
|
|
</ScrollView>
|
|
);
|
|
}
|
|
|
|
function CodeField(a0) { // fn#70218, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:2661, offset: 0x01cf30c2, size: 123 bytes, params: 2, frame: 19
|
|
const styles = useStyles();
|
|
return (
|
|
a0.disableKeyboardAvoidingView
|
|
? (
|
|
<CodeFieldInner {...a0} />
|
|
)
|
|
: ((Component) => <Component style={styles.viewWrapper}><CodeFieldInner {...a0} /></Component>)(importDefault(5467) /* metro dependency 5467: KeyboardAwareView */)
|
|
);
|
|
}
|
|
|
|
function CodeBlocks({hasError, onCodeEntered, count, codeType}) { // fn#70219, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:2853, offset: 0x01cf313d, size: 362 bytes, params: 2, frame: 22
|
|
var environment;
|
|
var r0;
|
|
var r2;
|
|
var value;
|
|
var NUMERIC;
|
|
var value7;
|
|
reducibleJoin2: while (true) {
|
|
if (count !== undefined) {
|
|
break reducibleJoin2;
|
|
}
|
|
value = 6;
|
|
count = value;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (codeType !== undefined) {
|
|
r0 = codeType;
|
|
break reducibleJoin4;
|
|
}
|
|
value = environment;
|
|
NUMERIC = env0_9.NUMERIC;
|
|
r0 = NUMERIC;
|
|
break reducibleJoin4;
|
|
}
|
|
const env0_3 = r0;
|
|
const styles = useStyles();
|
|
const styles2 = styles;
|
|
let binding = styles2;
|
|
const useState = binding.useState;
|
|
let Array = global.Array;
|
|
const value2 = Array(count);
|
|
const value4 = env0_3(Reflect.apply(useState, binding, [value2.fill('')]), 2);
|
|
const property = value4[0];
|
|
const env0_6 = value4[1];
|
|
binding = styles2;
|
|
const useRef = binding.useRef;
|
|
Array = global.Array;
|
|
const value6 = Array(count);
|
|
const env0_7 = Reflect.apply(useRef, binding, [value6.fill(null)]);
|
|
const env0_8 = styles2.useRef(onCodeEntered);
|
|
styles2.useEffect(_fun70220);
|
|
styles2.useEffect(_fun70221, [property]);
|
|
if (0 < count) {
|
|
r2 = 0;
|
|
reducibleLoop5: while (true) {
|
|
CodeBlocks_loop(r2);
|
|
value7 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value7 < count) {
|
|
r2 = value7;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return <View style={styles.codeContainer} />;
|
|
function _fun70220() { // fn#70220, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:3058, offset: 0x01c78d36, size: 21 bytes, params: 1, frame: 2
|
|
env0_8.current = onCodeEntered;
|
|
}
|
|
|
|
function _fun70221() { // fn#70221, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:3091, offset: 0x01cf32a7, size: 60 bytes, params: 1, frame: 14
|
|
var current;
|
|
var binding2;
|
|
let binding = env0_5;
|
|
if (((a0) => a0.every(_fun70223))(binding)) {
|
|
binding = env0_8;
|
|
current = binding.current;
|
|
binding2 = env0_5;
|
|
Reflect.apply(current, binding, [binding2.join('')]);
|
|
}
|
|
function isCodeEntered(a0) { // fn#70222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:3102, offset: 0x01cf32e3, size: 25 bytes, params: 2, frame: 11
|
|
return a0.every(function(a0) {
|
|
return a0.trim() !== '';
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
function CodeBlocks_loop(a0) { // fn#70224, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:3218, owner: CodeBlocks._loop, offset: 0x01cf3313, size: 406 bytes, params: 2, frame: 26
|
|
var environment;
|
|
var binding;
|
|
var push;
|
|
var value2;
|
|
const env0_0 = a0;
|
|
if (a0 === count / 2) {
|
|
binding = env0_9;
|
|
push = binding.push;
|
|
value2 = environment.__proto__;
|
|
Reflect.apply(push, binding, [<View style={styles.spacer} key="spacer" />]);
|
|
}
|
|
binding = env0_9;
|
|
push = binding.push;
|
|
const items2 = [styles.inputWrapper];
|
|
items2[1] = hasError ? styles.inputWrapperError : null;
|
|
const TextInput = (NativeModule).TextInput;
|
|
const binding2 = env0_3;
|
|
const NUMERIC = env1_9.NUMERIC;
|
|
Reflect.apply(push, binding, [<View style={items2} key={a0}><TextInput ref={ref_70225} style={[{height: 42,
|
|
width: 252 / count}, styles.input]} keyboardType={binding2 !== NUMERIC ? 'default' : 'phone-pad'} autoFocus={a0 === 0} value={env0_5[a0]} onKeyPress={onKeyPress} onChangeText={onChangeText_70228} selection={{start: env0_5[a0].length, end: env0_5[a0].length}} autoCapitalize="characters" autoCorrect={false} /></View>]);
|
|
function _loopRef(a0) { // fn#70225, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:3374, owner: CodeBlocks._loop.ref, offset: 0x01cf34a9, size: 30 bytes, params: 2, frame: 3
|
|
env1_7.current[env0_0] = a0;
|
|
}
|
|
|
|
function onKeyPress(a0) { // fn#70226, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:3521, owner: CodeBlocks._loop.onKeyPress, offset: 0x01cf34c7, size: 29 bytes, params: 2, frame: 13
|
|
onKeyPress_body(env0_0, a0);
|
|
function onKeyPress_body(a0, {nativeEvent}) { // fn#70227, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:3524, owner: CodeBlocks._loop.onKeyPress.body, offset: 0x01cf34e4, size: 163 bytes, params: 3, frame: 19
|
|
var value;
|
|
var binding;
|
|
var binding2;
|
|
var value2;
|
|
var items2;
|
|
var property;
|
|
if (nativeEvent.key !== 'Backspace') {
|
|
value = environment.__proto__.__proto__;
|
|
property = env2_7.current[a0 + 1];
|
|
if (property != null) {
|
|
property.focus();
|
|
}
|
|
} else {
|
|
value = environment.__proto__.__proto__;
|
|
if (env2_5[a0] === '') {
|
|
binding = env2_6;
|
|
binding2 = env2_5;
|
|
value2 = a0 - 1;
|
|
items2 = [];
|
|
arraySpread(items2, binding2, 0, undefined);
|
|
items2[value2] = '';
|
|
binding(items2);
|
|
property = env2_7.current[a0 - 1];
|
|
if (property != null) {
|
|
property.focus();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function _loopOnChangeText(a0) { // fn#70228, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:3770, owner: CodeBlocks._loop.onChangeText, offset: 0x01cf3587, size: 202 bytes, params: 2, frame: 17
|
|
var r6;
|
|
let value = a0;
|
|
const binding = env0_0;
|
|
if (value[0] !== env1_5[binding]) {
|
|
r6 = value;
|
|
} else {
|
|
value = value.slice(1);
|
|
r6 = value;
|
|
}
|
|
value = r6.replace('-', '');
|
|
value = value.trim();
|
|
value = value.toUpperCase();
|
|
r6 = value !== '' ? value.split('') : [''];
|
|
const binding2 = env1_5;
|
|
const items3 = [];
|
|
arraySpread(items3, binding2, 0, r6);
|
|
const splice = items3.splice;
|
|
const items2 = [binding, 1];
|
|
arraySpread(items2, r6, 2, r6);
|
|
apply(splice, items2, items3, r6);
|
|
env1_6(items3.slice(0, count));
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _fun70223(a0) { // fn#70223, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9211:3144, offset: 0x01cf32fc, size: 23 bytes, params: 2, frame: 9
|
|
return a0.trim() !== '';
|
|
}
|
|
|
|
global.__d(_fun70213, 9026, [57, 31, 27, 33, 4501, 697, 1305, 7981, 1244, 4578, 4573, 5467,
|
|
2]) /* metro module 9026, dependencies: [57, 31, 27, 33, 4501, 697, 1305, 7981, 1244, 4578, 4573, 5467, 2] */;
|