decord/alpha/source/utils/native/ChatInputUtils.tsx
github-actions c6aa9eb120 chore: update source for alpha 349.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5030.js (118.4 MB)
2026-10-01 06:55:13 +00:00

252 lines
7.4 KiB
TypeScript

// Module ID: 4730
// Function ID: 4731
// Name: ChatInputUtils
// Dependencies: [4731, 1876, 4732, 1611, 1483, 4733, 2]
// Exports: createInputRefTracker, dismissKeyboard, getBestActiveInputForChannelId, getChatInputRef, getHighestActiveScreenIndex
// Module 4730 (ChatInputUtils)
import KeyboardTypes from "KeyboardTypes" /* 1611 */;
import KeyboardManagerUtils from "KeyboardManagerUtils" /* 1876 */;
import ScreenIndexFrozen from "ScreenIndexFrozen" /* 4731 */;
import useKeyboardType from "useKeyboardType" /* 4732 */;
import PortalKeyboardUIStore from "PortalKeyboardUIStore" /* 4733 */;
import size from "module_2" /* 2 */;
function getBestActiveInput() {
let str;
if (0 !== map1.size) {
str = "voice-panel";
if (!obj.has("voice-panel")) {
str = "message-request";
if (!obj.has("message-request")) {
str = "new-message";
if (!obj.has("new-message")) {
str = "vibegrations-preview";
if (!obj.has("vibegrations-preview")) {
const _Array = Array;
const found = Array.from(obj.keys()).filter((item) => {
let tmp = typeof item === "number";
if (typeof item === "number") {
tmp = !ScreenIndexFrozen.isScreenIndexFrozen(item);
}
return tmp;
});
if (0 !== found.length) {
const _Math = Math;
const items = [];
HermesBuiltin.arraySpread(found, 0);
const _Math2 = Math;
str = HermesBuiltin.apply(items, Math);
}
const arr = Array.from(obj.keys());
}
}
}
}
}
value = undefined;
if (null != str) {
value = obj.get(str);
}
let current;
if (value != null) {
current = value.current;
}
return current;
}
const map = new Map();
const map1 = new Map();
let result = size.fileFinishedImporting("utils/native/ChatInputUtils.tsx");
export function createInputRefTracker(id, screenIndex) {
closure_0 = screenIndex;
let obj = { current: id };
return {
handleRef(current, id) {
obj.current = id;
if (null == current) {
if (null != obj) {
value = map.get(id);
if (null != value) {
value.delete(tmp16);
if (0 === value.size) {
map.delete(id);
}
map1.delete(tmp16);
}
obj = null;
}
} else if (null == obj) {
obj = { current };
value2 = map.get(id);
if (value2 == null) {
const _Map = Map;
value2 = new Map();
}
const result = value2.set(tmp2, obj);
const result1 = map.set(id, value2);
const result2 = map1.set(tmp2, obj);
const _process = process;
if ("development" === process.env.DEVELOPMENT) {
const hasItem = map1.has(tmp2);
}
} else {
obj.current = current;
}
},
register() {
if (null != obj) {
const current2 = obj.current;
value = map.get(current2);
if (null != value) {
value.delete(tmp15);
if (0 === value.size) {
obj3.delete(current2);
}
map1.delete(tmp15);
}
const current = obj.current;
value2 = obj3.get(current);
if (value2 == null) {
const _Map = Map;
value2 = new Map();
}
const result = value2.set(tmp15, tmp5);
const result1 = obj3.set(current, value2);
const result2 = map1.set(tmp15, tmp5);
const _process = process;
if ("development" === process.env.DEVELOPMENT) {
const hasItem = obj2.has(tmp15);
}
obj2 = map1;
}
},
unregister() {
if (null != obj) {
const current = obj.current;
value = map.get(current);
if (null != value) {
value.delete(tmp2);
if (0 === value.size) {
obj.delete(current);
}
map1.delete(tmp2);
}
}
}
};
}
export const getHighestActiveScreenIndex = function getHighestActiveScreenIndex() {
let obj = arg0;
if (arg0 === undefined) {
obj = map1;
}
if (0 !== obj.size) {
if (obj.has("voice-panel")) {
return "voice-panel";
} else if (obj.has("message-request")) {
return "message-request";
} else if (obj.has("new-message")) {
return "new-message";
} else if (obj.has("vibegrations-preview")) {
return "vibegrations-preview";
} else {
const _Array = Array;
const found = Array.from(obj.keys()).filter((item) => {
let tmp = typeof item === "number";
if (typeof item === "number") {
tmp = !ScreenIndexFrozen.isScreenIndexFrozen(item);
}
return tmp;
});
if (0 !== found.length) {
const _Math = Math;
const items = [];
HermesBuiltin.arraySpread(found, 0);
const _Math2 = Math;
return HermesBuiltin.apply(items, Math);
}
const arr = Array.from(obj.keys());
}
}
};
export const getChatInputRef = function getChatInputRef(id, screenIndex) {
if (null != id) {
value = map.get(id);
let current;
if (value != null) {
value2 = value.get(screenIndex);
if (value2 != null) {
current = value2.current;
}
}
return current;
}
};
export const getBestActiveInputForChannelId = function getBestActiveInputForChannelId(id) {
if (null != id) {
value = map.get(id);
if (null != value) {
let obj2 = value;
if (value === undefined) {
obj2 = map1;
}
let str;
if (0 !== obj2.size) {
str = "voice-panel";
if (!obj2.has("voice-panel")) {
str = "message-request";
if (!obj2.has("message-request")) {
str = "new-message";
if (!obj2.has("new-message")) {
str = "vibegrations-preview";
if (!obj2.has("vibegrations-preview")) {
const _Array = Array;
const found = Array.from(obj2.keys()).filter((item) => {
let tmp = typeof item === "number";
if (typeof item === "number") {
tmp = !ScreenIndexFrozen.isScreenIndexFrozen(item);
}
return tmp;
});
if (0 !== found.length) {
const _Math = Math;
const items = [];
HermesBuiltin.arraySpread(found, 0);
const _Math2 = Math;
str = HermesBuiltin.apply(items, Math);
}
const arr = Array.from(obj2.keys());
}
}
}
}
}
value2 = undefined;
if (null != str) {
value2 = value.get(str);
}
let current;
if (value2 != null) {
current = value2.current;
}
return current;
}
}
};
export { getBestActiveInput };
export const dismissKeyboard = function dismissKeyboard() {
const result = KeyboardManagerUtils.dismissGlobalKeyboard();
const obj2 = getBestActiveInput();
if (null != obj2) {
obj2.closeCustomKeyboard();
}
const keyboardType = useKeyboardType.getKeyboardType();
if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) {
const obj3 = { type: tmp(1611).KeyboardTypes.SYSTEM };
tmp(1483).setKeyboardType(obj3);
const tmpResult3 = tmp(1483);
}
const tmpResult = useKeyboardType;
const result1 = PortalKeyboardUIStore.closePortalKeyboardRequest();
};