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

330 lines
15 KiB
TypeScript

/* Metro module 9019; source: modules/phone/native/CountryCallingCodeSelect.tsx; dependencies: [57, 31, 27, 3837, 33, 4501, 697, 8973, 3838, 7705, 6590, 6238, 4573, 6984, 9020, 9021, 1244, 8671, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import UseScaledRowHeight from '../../main_tabs_v2/native/shared_components/user_list/useScaledRowHeight.tsx'; /* Metro dependency 7705 */
import UseWideAuthView from '../../auth/native/useWideAuthView.tsx'; /* Metro dependency 8973 */
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 JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as CountryCodeUtilsModule from '../../i18n/CountryCodeUtils.tsx'; /* Metro dependency 3837 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as TableRowNativeModule from '../../../design/components/TableRow/native/TableRow.native.tsx'; /* Metro dependency 6238 */
import * as SearchFieldNativeModule from '../../../design/components/TextField/native/SearchField.native.tsx'; /* Metro dependency 6984 */
function _fun70176(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#70176, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:6, offset: 0x01cf1608, size: 265 bytes, params: 8, frame: 19
const env0_0 = require;
const _arrayLikeToArray_70179 = 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});
let value = JsxRuntimeModule;
const env0_7 = value.jsx;
const env0_8 = value.jsxs;
const env0_9 = (CreateStylesModule).createStyles(_fun70180);
(FileImportTrackerModule).fileFinishedImporting('modules/phone/native/CountryCallingCodeSelect.tsx');
exports.default = CountryCallingCodeSelect;
function _createForOfIteratorHelperLoose_70177(a0, a1) { // fn#70177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:197, offset: 0x01cf1711, size: 372 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 _fun70178;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_70179(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_70179(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_70179(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun70178;
}
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 _fun70178() { // fn#70178, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:768, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function _fun70180(a0) { // fn#70180, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1136, offset: 0x01cf1885, size: 217 bytes, params: 2, frame: 17
const object = {};
const object2 = {};
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
object2.backgroundColor = BACKGROUND_BASE_LOW;
let space = (importDefault(697) /* metro dependency 697: native */).space;
object2.paddingHorizontal = a0 ? space.PX_24 : space.PX_12;
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.paddingTop = PX_16;
space = (importDefault(697) /* metro dependency 697: native */).space;
object2.paddingBottom = a0 ? space.PX_24 : space.PX_16;
object2.flex = 1;
object.container = object2;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.searchFieldContainer = {paddingBottom: PX_16};
return object;
}
function CountryCallingCodeSelect({onCountrySelected, onClose}) { // fn#70181, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1522, offset: 0x01cf195e, size: 530 bytes, params: 2, frame: 27
var r5;
var ViewEmptyState;
var object2;
var intl;
var value;
const styles = useStyles((UseWideAuthView)());
const [property, property2] = Module00057(ReactModule.useState(''), 2);
const value5 = ReactModule.useMemo(_fun70182, []);
const value6 = (UseScaledRowHeight)();
const {rows, sections} = ReactModule.useMemo(_fun70185, [value5, property]);
const value8 = ReactModule.useCallback(_fun70186, [onClose, onCountrySelected, rows]);
const SearchField = (SearchFieldNativeModule).SearchField;
const view = (
<View style={styles.searchFieldContainer}>
<SearchField size="md" onChange={property2} />
</View>
);
if (property === '') {
value = importDefault(8671) /* metro dependency 8671: FastestListAndroid */;
value = ((Component) => <Component sections={sections} renderItem={value8} itemSize={value6} estimatedListSize="windowSize" keyboardShouldPersistTaps="always" />)(value);
r5 = value;
} else if (rows.length === 0) {
ViewEmptyState = importDefault(9020) /* metro dependency 9020: ViewEmptyState */;
object2 = {source: importDefault(9021) /* metro dependency 9021 */};
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
object2.text = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.wEHnxW);
r5 = <ViewEmptyState {...object2} />;
} else {
value = importDefault(8671) /* metro dependency 8671: FastestListAndroid */;
value = ((Component) => <Component sections={sections} renderItem={value8} itemSize={value6} estimatedListSize="windowSize" keyboardShouldPersistTaps="always" />)(value);
r5 = value;
}
return (
<View style={styles.container}>
{view}
{r5}
</View>
);
function _fun70182() { // fn#70182, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1666, offset: 0x01cf1b70, size: 47 bytes, params: 1, frame: 11
var environment;
const value = environment.__proto__;
return (importDefault(3838) /* metro dependency 3838: Countries */).flatMap(function(a0, a1) {
var alpha2 = a0.alpha2;
var env0_0 = alpha2;
var phoneCountryCodes = a0.phoneCountryCodes;
var env0_1 = a0.name;
var env0_2 = a1;
var env0_3 = getI18NCountryName(alpha2);
return phoneCountryCodes.map(_fun70184);
});
function _fun70183({alpha2, phoneCountryCodes, name}, a1) { // fn#70183, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1688, offset: 0x01cf1b9f, size: 74 bytes, params: 3, frame: 13
const env0_2 = a1;
const env0_3 = getI18NCountryName(alpha2);
return phoneCountryCodes.map(_fun70184);
function _fun70184(a0) { // fn#70184, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1757, offset: 0x01cf1be9, size: 83 bytes, params: 2, frame: 17
return {translatedName: env0_3, key: '' + require + '-' + a0, country: {code: a0, alpha2: alpha2, name: name}};
}
}
}
function _fun70185() { // fn#70185, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:1866, offset: 0x01cf1c3c, size: 321 bytes, params: 1, frame: 25
var r2;
var r0;
var value5;
var length;
var value6;
var country;
var code;
var replace;
var value7;
var startsWith;
var binding;
var value8;
var defaultImport;
var toLowerCase;
var value9;
var name;
var value10;
var defaultImport2;
var value11;
var translatedName;
var value12;
var value13;
let items2 = [];
const value3 = _createForOfIteratorHelperLoose_70177(Module00057);
const value4 = value3();
let done = value4.done;
if (!done) {
r2 = value4;
while (true) {
value5 = r2.value;
length = env0_2.length;
value6 = length === 0;
if (value6) {
r0 = value6;
} else {
code = value5.country.code;
value7 = code.replace(RegExp('\\+|\\s', 'g'), '');
startsWith = value7.startsWith;
binding = env0_2;
replace = binding.replace;
value8 = Reflect.apply(startsWith, value7, [Reflect.apply(replace, binding, [RegExp('\\+|\\s', 'g'),
''])]);
r0 = value8;
}
if (r0) {
continue;
}
defaultImport = importDefault(6590) /* metro dependency 6590 */;
binding = env0_2;
value9 = binding.toLowerCase();
country = value5.country;
name = country.name;
toLowerCase = name.toLowerCase;
value10 = defaultImport(value9, Reflect.apply(toLowerCase, name, []));
r0 = value10;
if (r0) {
continue;
}
defaultImport2 = importDefault(6590) /* metro dependency 6590 */;
binding = env0_2;
value11 = binding.toLowerCase();
translatedName = value5.translatedName;
toLowerCase = translatedName.toLowerCase;
value12 = defaultImport2(value11, Reflect.apply(toLowerCase, translatedName, []));
r0 = value12;
if (!r0) {
continue;
}
items2.push(value5);
value13 = value3();
done = value13.done;
if (done) {
break;
}
r2 = value13;
continue;
}
}
const object = {rows: items2};
items2 = [items2.length];
object.sections = items2;
return object;
}
function _fun70186(a0, a1) { // fn#70186, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9204:2250, offset: 0x01cf1d7d, size: 169 bytes, params: 3, frame: 21
const rowsBinding = rows;
const {translatedName, country} = rowsBinding[a1];
const TableRow = (TableRowNativeModule).TableRow;
const length = rowsBinding.length;
const Text = (TextModule).Text;
return (
<TableRow
start={a1 === 0}
end={a1 === length - 1}
label={translatedName}
trailing={<Text variant="text-md/semibold">
{country.code}
</Text>}
onPress={function() {
onCountrySelected(country);
if (onClose != null) {
onClose();
}
}}
/>
);
}
}
}
global.__d(_fun70176, 9019, [57, 31, 27, 3837, 33, 4501, 697, 8973, 3838, 7705, 6590, 6238, 4573, 6984, 9020, 9021,
1244, 8671,
2]) /* metro module 9019, dependencies: [57, 31, 27, 3837, 33, 4501, 697, 8973, 3838, 7705, 6590, 6238, 4573, 6984, 9020, 9021, 1244, 8671, 2] */;