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

244 lines
11 KiB
TypeScript

/* Metro module 13115; source: modules/keyboard/native/KeyCommandsView.tsx; dependencies: [57, 31, 33, 4501, 13116, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import KeyCommandsNativeComponent from '../../../external/discord_common/js/packages/rtn-codegen/js/KeyCommandsNativeComponent.tsx'; /* Metro dependency 13116 */
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 CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
function _fun100223(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#100223, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:6, offset: 0x021e1b0b, size: 278 bytes, params: 8, frame: 21
const _arrayLikeToArray_100226 = 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 = ReactModule;
const env0_5 = (CreateStylesModule).createStyles({viewDefaults: {flex: 1}});
const env0_6 = value.createContext({keyCommands: [], addKeyCommand: function() {
}, removeKeyCommand: function() {
}});
(FileImportTrackerModule).fileFinishedImporting('modules/keyboard/native/KeyCommandsView.tsx');
exports.default = KeyCommandsView;
exports.useKeyCommands = useKeyCommands;
function _createForOfIteratorHelperLoose_100224(a0, a1) { // fn#100224, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:136, offset: 0x021e1c21, 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 _fun100225;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_100226(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_100226(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_100226(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun100225;
}
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 _fun100225() { // fn#100225, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:707, 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 KeyCommandsView(a0) { // fn#100229, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1263, offset: 0x021e1d95, size: 304 bytes, params: 2, frame: 23
const style = a0.style;
const value = Object.create(null);
value.style = 0;
const value2 = copyDataProperties({}, a0, value, undefined);
const styles = useStyles();
const binding = env0_3;
const [property, env0_1] = Module00057(binding.useState([]), 2);
const value8 = binding.useMemo(_fun100235, [property, binding.useCallback(_fun100230, []),
binding.useCallback(_fun100232, [])]);
const Provider = env0_6.Provider;
return (
<Provider value={value8}>
{((Component) => <Component {...value2} {...{['style']: [styles.viewDefaults,
style]}} {...{['keyCommands']: property}} {...{['onKeyCommand']: KeyCommandsViewOnKeyCommand}} />)(KeyCommandsNativeComponent)}
</Provider>
);
function _fun100230(a0) { // fn#100230, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1371, offset: 0x021e1ec5, size: 32 bytes, params: 2, frame: 11
const env0_0 = a0;
env0_1(_fun100231);
function _fun100231(a0) { // fn#100231, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1378, offset: 0x01bd074a, size: 37 bytes, params: 2, frame: 13
const items2 = [];
const value = arraySpread(items2, a0, 0, undefined);
items2[value] = env0_0;
value + 1;
return items2;
}
}
function _fun100232(a0) { // fn#100232, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1415, offset: 0x021e1ee5, size: 32 bytes, params: 2, frame: 11
const env0_0 = a0;
env0_1(function(a0) {
return a0.filter(_fun100234);
});
function _fun100233(a0) { // fn#100233, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1422, offset: 0x021e1f05, size: 24 bytes, params: 2, frame: 11
return a0.filter(_fun100234);
function _fun100234({eventName}) { // fn#100234, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1435, offset: 0x021e1f1d, size: 22 bytes, params: 2, frame: 2
return eventName !== env1_0;
}
}
}
function _fun100235() { // fn#100235, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1477, offset: 0x021e1f33, size: 34 bytes, params: 1, frame: 3
return {keyCommands: env0_0, addKeyCommand: Module00057, removeKeyCommand: env0_3};
}
function KeyCommandsViewOnKeyCommand({nativeEvent}) { // fn#100236, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1650, owner: KeyCommandsView.onKeyCommand, offset: 0x021e1f55, size: 61 bytes, params: 2, frame: 12
const value = nativeEvent.find(function({eventName}) {
return eventName === nativeEvent.eventName;
});
if (value != null) {
value.onKeyCommand(nativeEvent);
}
}
}
function useKeyCommands(a0) { // fn#100238, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1768, offset: 0x021e1fae, size: 89 bytes, params: 2, frame: 16
const env0_0 = a0;
const binding = env0_3;
const value = binding.useContext(env0_6);
binding.useEffect(_fun100239, [value.addKeyCommand, value.removeKeyCommand, a0]);
function _fun100239() { // fn#100239, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1869, offset: 0x021e2007, size: 73 bytes, params: 1, frame: 14
var r1;
var value4;
var value5;
const value2 = _createForOfIteratorHelperLoose_100224(env0_0);
const value3 = value2();
let done = value3.done;
if (!done) {
for (r1 = value3; true; r1 = value5) {
value4 = r1.value;
addKeyCommand(value4);
value5 = value2();
done = value5.done;
if (done) {
break;
}
}
}
return _fun100240;
function _fun100240() { // fn#100240, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13305:1962, offset: 0x021e2050, size: 70 bytes, params: 1, frame: 14
var r2;
var value4;
var removeKeyCommandBinding;
var eventName;
var value5;
const value2 = _createForOfIteratorHelperLoose_100224(env1_0);
const value3 = value2();
let done = value3.done;
if (!done) {
for (r2 = value3; true; r2 = value5) {
value4 = r2.value;
removeKeyCommandBinding = removeKeyCommand;
eventName = value4.eventName;
removeKeyCommandBinding(eventName);
value5 = value2();
done = value5.done;
if (done) {
break;
}
}
}
}
}
}
}
global.__d(_fun100223, 13115, [57, 31, 33, 4501, 13116,
2]) /* metro module 13115, dependencies: [57, 31, 33, 4501, 13116, 2] */;