186 lines
9.1 KiB
TypeScript
186 lines
9.1 KiB
TypeScript
/* Metro module 11743; source: modules/polls/native/useFocusHelper.tsx; dependencies: [7, 6, 31, 44, 6518, 2] */
|
|
import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import Module00044 from '../../../by-id/module-00044.js'; /* Metro dependency 44 */
|
|
import UseInitialValue from '../../../hooks/useInitialValue.tsx'; /* Metro dependency 6518 */
|
|
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 */
|
|
|
|
function _fun90009(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#90009, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:6, offset: 0x020269b2, size: 184 bytes, params: 8, frame: 18
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_5 = CreateClass(FocusHelperState);
|
|
const env0_6 = _fun90011();
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/polls/native/useFocusHelper.tsx');
|
|
exports.default = useFocusHelper;
|
|
function FocusHelperState() { // fn#90010, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:131, offset: 0x02026a6a, size: 42 bytes, params: 1, frame: 13
|
|
ClassCallCheck(this, FocusHelperState);
|
|
this.refsByKey = {};
|
|
this.keyOrder = [];
|
|
}
|
|
|
|
function _fun90011() { // fn#90011, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:224, offset: 0x02026a94, size: 113 bytes, params: 1, frame: 15
|
|
return env0_2(FocusHelperImpl, [{key: 'restartState', value: value_90015}, {key: 'commitState', value: function() {
|
|
var pendingState = this.pendingState;
|
|
if (pendingState != null) {
|
|
this.validState = pendingState;
|
|
}
|
|
this.pendingState = undefined;
|
|
}}, {key: 'refWithKey', value: value_90017}]);
|
|
function FocusHelperImpl() { // fn#90012, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:245, offset: 0x02026b05, size: 89 bytes, params: 1, frame: 15
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
env1_3(this, FocusHelperImpl);
|
|
this.validState = new env1_5();
|
|
this.focusNext = focusNext;
|
|
this.focus = focus_90014;
|
|
function focusNext() { // fn#90013, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:333, owner: FocusHelperImpl.focusNext, offset: 0x02026b5e, size: 249 bytes, params: 1, frame: 25
|
|
var r11;
|
|
var r5;
|
|
var r6;
|
|
var r3;
|
|
var r4;
|
|
var propertyName;
|
|
var propertyName2;
|
|
var property;
|
|
var current;
|
|
var isFocused2;
|
|
var value3;
|
|
var onAddAnswer;
|
|
var value;
|
|
const {refsByKey, keyOrder} = env0_0.validState;
|
|
const value2 = undefined;
|
|
const properties = Object.keys(refsByKey);
|
|
const properties2 = 0;
|
|
const properties3 = properties.length;
|
|
if (properties === value2) {
|
|
r6 = value2;
|
|
} else {
|
|
r11 = properties2;
|
|
while (true) {
|
|
propertyName = properties[r11];
|
|
propertyName2 = r11 + 1;
|
|
if (propertyName === value2) {
|
|
r6 = value2;
|
|
break;
|
|
}
|
|
property = refsByKey[propertyName];
|
|
if (property == null) {
|
|
r5 = value2;
|
|
continue;
|
|
}
|
|
current = property.current;
|
|
if (current == null) {
|
|
r5 = value2;
|
|
continue;
|
|
}
|
|
isFocused2 = current.isFocused();
|
|
r5 = isFocused2;
|
|
if (r5 !== true) {
|
|
r11 = propertyName2;
|
|
continue;
|
|
}
|
|
r6 = propertyName;
|
|
break;
|
|
}
|
|
}
|
|
if (r6 != null) {
|
|
value3 = keyOrder.indexOf(r6);
|
|
if (value3 === -1) {
|
|
onAddAnswer = env0_0.onAddAnswer;
|
|
if (onAddAnswer != null) {
|
|
onAddAnswer.call(env0_0);
|
|
}
|
|
} else if (value3 >= keyOrder.length - 1) {
|
|
onAddAnswer = env0_0.onAddAnswer;
|
|
if (onAddAnswer != null) {
|
|
onAddAnswer.call(env0_0);
|
|
}
|
|
} else {
|
|
property = refsByKey[env0_0.validState.keyOrder[value3 + 1]];
|
|
value = property == null;
|
|
if (value) {
|
|
r3 = value;
|
|
r4 = property;
|
|
} else {
|
|
current = property.current;
|
|
r3 = current == null;
|
|
r4 = current;
|
|
}
|
|
if (!r3) {
|
|
r4.focus();
|
|
}
|
|
}
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function FocusHelperImplFocus(a0) { // fn#90014, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:684, owner: FocusHelperImpl.focus, offset: 0x02026c57, size: 67 bytes, params: 2, frame: 12
|
|
var r0;
|
|
var r1;
|
|
var current;
|
|
const property = env0_0.validState.refsByKey[a0];
|
|
const value = property == null;
|
|
if (value) {
|
|
r0 = value;
|
|
r1 = property;
|
|
} else {
|
|
current = property.current;
|
|
r0 = current == null;
|
|
r1 = current;
|
|
}
|
|
if (!r0) {
|
|
r1.focus();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function value_90015() { // fn#90015, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:795, offset: 0x02026c9a, size: 40 bytes, params: 1, frame: 9
|
|
const value = environment.__proto__;
|
|
this.pendingState = new env1_5();
|
|
}
|
|
|
|
function value_90017(a0) { // fn#90017, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:972, offset: 0x02026ce1, size: 113 bytes, params: 2, frame: 17
|
|
const pendingState = this.pendingState;
|
|
let value = environment.__proto__;
|
|
(Module00044)(pendingState != null, 'Called refWithKey without a valid state');
|
|
pendingState.keyOrder.push(a0);
|
|
const property = pendingState.refsByKey[a0];
|
|
if (property != null) {
|
|
return property;
|
|
}
|
|
value = env1_4.createRef();
|
|
pendingState.refsByKey[a0] = value;
|
|
return value;
|
|
}
|
|
|
|
}
|
|
|
|
function useFocusHelper() { // fn#90018, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:1263, offset: 0x02026d52, size: 101 bytes, params: 1, frame: 14
|
|
const value = a0;
|
|
const env0_0 = (value !== undefined ? value : {}).onAddAnswer;
|
|
const value2 = (UseInitialValue)(_fun90019);
|
|
value2.restartState();
|
|
ReactModule.useEffect(_fun90020);
|
|
return value2;
|
|
function _fun90019() { // fn#90019, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:1322, offset: 0x02026db7, size: 29 bytes, params: 1, frame: 9
|
|
let value = environment.__proto__;
|
|
const binding = env1_6;
|
|
value = Object.create(binding.prototype, {constructor: {value: binding}});
|
|
const binding2 = new binding();
|
|
return binding2 instanceof Object ? binding2 : value;
|
|
}
|
|
|
|
function _fun90020() { // fn#90020, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11929:1371, offset: 0x02026dd4, size: 37 bytes, params: 1, frame: 10
|
|
env0_1.onAddAnswer = onAddAnswer;
|
|
env0_1.commitState();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun90009, 11743, [7, 6, 31, 44, 6518,
|
|
2]) /* metro module 11743, dependencies: [7, 6, 31, 44, 6518, 2] */;
|