252 lines
12 KiB
TypeScript
252 lines
12 KiB
TypeScript
/* Metro module 14156; source: modules/settings/native/renderer/SettingSegmentedControlRenderer.tsx; dependencies: [57, 31, 27, 13172, 9693, 33, 4501, 697, 14147, 13177, 44, 13175, 8853, 9221, 8861, 2] */
|
|
import Module00044 from '../../../../by-id/module-00044.js'; /* Metro dependency 44 */
|
|
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import UserSettingSearchStore from '../../../user_settings/UserSettingSearchStore.tsx'; /* Metro dependency 13172 */
|
|
import SettingTreeManager from './SettingTreeManager.tsx'; /* Metro dependency 14147 */
|
|
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 SegmentedControlPagesNativeModule from '../../../../design/components/SegmentedControl/native/SegmentedControlPages.native.tsx'; /* Metro dependency 8861 */
|
|
import * as SegmentedControlNativeModule from '../../../../design/components/SegmentedControl/native/SegmentedControl.native.tsx'; /* Metro dependency 9221 */
|
|
import * as SettingRendererConstantsModule from './SettingRendererConstants.tsx'; /* Metro dependency 9693 */
|
|
import * as SettingsRendererConfigModule from '../../../user_settings/core/native/SettingsRendererConfig.tsx'; /* Metro dependency 13177 */
|
|
|
|
function _fun107121(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#107121, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14353:6, offset: 0x022f3f3d, size: 354 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_107124 = 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_8 = value.jsx;
|
|
const env0_9 = value.Fragment;
|
|
const env0_10 = value.jsxs;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
const object2 = {};
|
|
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object2.paddingHorizontal = PX_16;
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object2.paddingTop = PX_16;
|
|
const env0_11 = Reflect.apply(createStyles, value, [{controlContainer: object2, pageContainer: {flex: 1}}]);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/settings/native/renderer/SettingSegmentedControlRenderer.tsx');
|
|
exports.default = SettingSegmentedControl;
|
|
function _createForOfIteratorHelperLoose_107122(a0, a1) { // fn#107122, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14353:208, offset: 0x022f409f, 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 _fun107123;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_107124(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_107124(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_107124(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun107123;
|
|
}
|
|
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 _fun107123() { // fn#107123, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14353:779, 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 SettingSegmentedControl({node}) { // fn#107125, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14353:1375, offset: 0x022f4213, size: 366 bytes, params: 2, frame: 23
|
|
const env0_0 = node.defaultIndex;
|
|
const settings = node.settings;
|
|
const styles = useStyles();
|
|
let useState = ReactModule.useState;
|
|
const value2 = Reflect.apply(useState, ReactModule, [0]);
|
|
const value3 = Module00057(value2, 2);
|
|
const property = value3[0];
|
|
const env0_2 = value3[1];
|
|
useState = ReactModule.useState;
|
|
const value4 = Module00057(Reflect.apply(useState, ReactModule, [_fun107126]), 2);
|
|
const property2 = value4[0];
|
|
value4[1];
|
|
const value5 = ReactModule.useCallback(_fun107127, []);
|
|
const value7 = (require(8853) /* metro dependency 8853: SegmentedControlStateNative */).useSegmentedControlState({items: ReactModule.useMemo(function() {
|
|
settings.forEach(_fun107129);
|
|
return [];
|
|
}, [settings]), pageWidth: property, defaultIndex: property2});
|
|
const jsxRuntimeEnv0_9Binding = jsxRuntimeEnv0_9;
|
|
const SegmentedControl = (SegmentedControlNativeModule).SegmentedControl;
|
|
const view = (
|
|
<View style={styles.controlContainer} onLayout={value5}>
|
|
<SegmentedControl state={value7} />
|
|
</View>
|
|
);
|
|
const SegmentedControlPages = (SegmentedControlPagesNativeModule).SegmentedControlPages;
|
|
return (
|
|
<>
|
|
{view}
|
|
<View style={styles.pageContainer}>
|
|
<SegmentedControlPages state={value7} />
|
|
</View>
|
|
</>
|
|
);
|
|
function _fun107126() { // fn#107126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14353:1511, offset: 0x022f4381, size: 170 bytes, params: 1, frame: 17
|
|
var value6;
|
|
var value7;
|
|
var value8;
|
|
let value = environment.__proto__;
|
|
const field = UserSettingSearchStore.getField('selected');
|
|
if (field == null) {
|
|
return defaultIndex;
|
|
}
|
|
let settingsBinding = settings;
|
|
let indexOf = settingsBinding.indexOf;
|
|
const value4 = Reflect.apply(indexOf, settingsBinding, [field]);
|
|
if (value4 !== -1) {
|
|
return value4;
|
|
}
|
|
const _createForOfIteratorHelperLoose_107122Binding = _createForOfIteratorHelperLoose_107122;
|
|
const getAncestors = (SettingTreeManager).getAncestors;
|
|
value = _createForOfIteratorHelperLoose_107122Binding(Reflect.apply(getAncestors, value, [field]));
|
|
const value5 = value();
|
|
let done = value5.done;
|
|
if (done) {
|
|
value = environment;
|
|
return defaultIndex;
|
|
}
|
|
let r3 = value5;
|
|
loopExit3: while (true) {
|
|
value6 = r3.value;
|
|
settingsBinding = settings;
|
|
indexOf = settingsBinding.indexOf;
|
|
value7 = Reflect.apply(indexOf, settingsBinding, [value6]);
|
|
if (value7 !== -1) {
|
|
break loopExit3;
|
|
}
|
|
value8 = value();
|
|
done = value8.done;
|
|
if (done) {
|
|
value = environment;
|
|
return defaultIndex;
|
|
}
|
|
r3 = value8;
|
|
continue;
|
|
}
|
|
return value7;
|
|
}
|
|
|
|
function _fun107127({nativeEvent}) { // fn#107127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14353:1780, offset: 0x0170cbca, size: 36 bytes, params: 2, frame: 11
|
|
env0_2(nativeEvent.layout.width);
|
|
}
|
|
|
|
function _fun107128() { // fn#107128, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14353:1842, offset: 0x022f442b, size: 36 bytes, params: 1, frame: 12
|
|
settings.forEach(_fun107129);
|
|
return [];
|
|
function _fun107129(a0) { // fn#107129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14353:1874, offset: 0x022f444f, size: 188 bytes, params: 2, frame: 20
|
|
const SETTING_RENDERER_CONFIG = (SettingsRendererConfigModule).SETTING_RENDERER_CONFIG;
|
|
const property = SETTING_RENDERER_CONFIG[a0];
|
|
const defaultImport = Module00044;
|
|
const type = property.type;
|
|
const ROUTE = NodeType.ROUTE;
|
|
defaultImport(type === ROUTE, 'Invalid setting type for segmented control: ' + a0);
|
|
const component = property.screen.getComponent();
|
|
const binding = env0_0;
|
|
const push = binding.push;
|
|
const object = {};
|
|
object.label = (require(13175) /* metro dependency 13175: SettingRendererUtils */).getSettingTitle(a0);
|
|
object.id = a0;
|
|
object.page = ((Component) => <Component />)(component);
|
|
Reflect.apply(push, binding, [object]);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun107121, 14156, [57, 31, 27, 13172, 9693, 33, 4501, 697, 14147, 13177, 44, 13175, 8853, 9221, 8861,
|
|
2]) /* metro module 14156, dependencies: [57, 31, 27, 13172, 9693, 33, 4501, 697, 14147, 13177, 44, 13175, 8853, 9221, 8861, 2] */;
|