decord/source/components_native/common/VoiceSensitivity.tsx

336 lines
12 KiB
TypeScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 12551
// Function ID: 12552
2026-07-20 16:05:17 +00:00
// Name: VoiceSensitivity
2026-08-15 05:55:55 +00:00
// Dependencies: [5, 32, 19, 17, 4497, 4774, 7383, 676, 4839, 21, 4661, 712, 4223, 1494, 589, 4840, 4569, 1351, 1236, 1297, 8083, 8105, 500, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-15 05:55:55 +00:00
// Module 12551 (VoiceSensitivity)
2026-07-29 08:29:29 +00:00
import anyoneHasFlagInContext from "anyoneHasFlagInContext";
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import Button from "Button";
import { View } from "AccessibilityAnnouncer";
import _detectH265HardwareDecode from "_detectH265HardwareDecode";
import closure_8 from "anyoneHasFlagInContext";
import getState from "getState";
2026-07-23 10:11:24 +00:00
import { AppStates } from "ME";
import { NativePermissionTypes } from "NativePermissionStatus";
2026-07-29 08:29:29 +00:00
import jsxProd from "_getRequireWildcardCache";
import createCacheKey from "createCacheKey";
import hexToRgba from "hexToRgba";
2026-07-23 10:11:24 +00:00
let closure_12;
2026-07-29 08:29:29 +00:00
let map1;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
({ jsx: closure_12, jsxs: map1 } = jsxProd);
createCacheKey = { sensitivity: { position: "relative", height: 20 }, sensitivityBar: { position: "absolute", top: 7, left: 0, right: 0, bottom: 7, flexDirection: "row" }, sensitivityFill: null, sensitivityCommon: null, sensitivityMin: null, sensitivityMax: null, sensitivityDefault: null, sensitivitySpeaking: null, sensitivitySlider: null };
createCacheKey = { position: "absolute", backgroundColor: require("Themes").unsafe_rawColors.WHITE, opacity: 0.5, top: 7, left: 0, right: 0, bottom: 7 };
createCacheKey[2] = createCacheKey;
createCacheKey[3] = { height: 6, borderRadius: 3 };
createCacheKey[4] = { backgroundColor: require("Themes").unsafe_rawColors.YELLOW_300 };
let obj1 = { backgroundColor: require("Themes").unsafe_rawColors.YELLOW_300 };
createCacheKey[5] = { backgroundColor: require("Themes").unsafe_rawColors.GREEN_360 };
let obj3 = { flex: 1, backgroundColor: null };
obj3[1] = hexToRgba.hexWithOpacity(require("Themes").unsafe_rawColors.PRIMARY_400, 0.6);
createCacheKey[6] = obj3;
let obj2 = { backgroundColor: require("Themes").unsafe_rawColors.GREEN_360 };
createCacheKey[7] = { flex: 1, backgroundColor: require("Themes").unsafe_rawColors.GREEN_360 };
createCacheKey[8] = { flex: 1, backgroundColor: "transparent", marginVertical: -10 };
createCacheKey = createCacheKey.createStyles(createCacheKey);
let obj4 = { flex: 1, backgroundColor: require("Themes").unsafe_rawColors.GREEN_360 };
const result = require("noop").fileFinishedImporting("components_native/common/VoiceSensitivity.tsx");
2026-07-20 16:05:17 +00:00
export default function VoiceSensitivity(auto) {
2026-07-29 08:29:29 +00:00
let c10;
let tmp17;
2026-07-20 16:05:17 +00:00
auto = auto.auto;
2026-07-23 10:11:24 +00:00
const onThresholdChange = auto.onThresholdChange;
2026-07-29 08:29:29 +00:00
let first;
let anyoneHasFlagInContext;
let width;
let stateFromStores;
let first1;
let _detectH265HardwareDecode;
let first2;
let getState;
c10 = undefined;
let closure_11;
let callback;
callback = undefined;
let createCacheKey;
let closure_15;
let tmp = createCacheKey();
2026-07-20 16:05:17 +00:00
const sum = auto.threshold + 100;
2026-07-23 10:11:24 +00:00
const ref = stateFromStores.useRef(null);
const ref1 = stateFromStores.useRef(null);
const tmp6 = width(stateFromStores.useState(first2.isCurrentUserSpeaking()), 2);
2026-07-29 08:29:29 +00:00
first = tmp6[0];
anyoneHasFlagInContext = tmp6[1];
2026-07-23 10:11:24 +00:00
width = onThresholdChange(first[13])().width;
let obj = auto(first[14]);
2026-07-29 08:29:29 +00:00
const items = [getState];
2026-07-23 10:11:24 +00:00
stateFromStores = obj.useStateFromStores(items, () => state.getState(), []);
2026-07-29 08:29:29 +00:00
const tmp12 = width(stateFromStores.useState(0), 2);
first1 = tmp12[0];
_detectH265HardwareDecode = tmp12[1];
const tmp14 = width(stateFromStores.useState(sum), 2);
first2 = tmp14[0];
getState = tmp14[1];
2026-07-23 10:11:24 +00:00
const ref2 = stateFromStores.useRef(null);
2026-07-29 08:29:29 +00:00
const tmp8 = onThresholdChange;
[tmp17, c10] = width(stateFromStores.useState(first2 / 100), 2);
const tmp18 = width(stateFromStores.useState(width * (1 - first1 / -100)), 2);
closure_11 = tmp18[1];
2026-07-20 16:05:17 +00:00
const items1 = [auto, first2];
2026-07-23 10:11:24 +00:00
const effect = stateFromStores.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (!auto) {
2026-07-29 08:29:29 +00:00
_undefined(first2 / 100);
2026-07-20 16:05:17 +00:00
}
}, items1);
const items2 = [auto, first1, width];
2026-07-23 10:11:24 +00:00
const effect1 = stateFromStores.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (!auto) {
2026-07-29 08:29:29 +00:00
callback3(width * (1 - first1 / -100));
2026-07-20 16:05:17 +00:00
}
}, items2);
2026-07-29 08:29:29 +00:00
callback = stateFromStores.useCallback((arg0, arg1) => {
2026-07-20 16:05:17 +00:00
callback(arg1);
callback2(arg0);
}, []);
const items3 = [callback, stateFromStores];
2026-07-23 10:11:24 +00:00
const callback1 = stateFromStores.useCallback((arg0) => {
2026-07-20 16:05:17 +00:00
state(arg0);
}, []);
2026-07-23 10:11:24 +00:00
const effect2 = stateFromStores.useEffect(() => {
2026-07-20 16:05:17 +00:00
function _listenOnlyIfWeHavePermission() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback(function*() {
if (c2 === 2) {
c2 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-15 05:55:55 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c2 = 2;
if (0 === c1) {
if (arg0 === 1) {
c2 = 3;
throw arg1;
} else if (arg0 === 2) {
c2 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let closure_0 = tmp4;
let obj2 = v0(outer2_2[15]);
c1 = 1;
c2 = 1;
const obj1 = { value: null, done: false };
obj1[0] = obj2.hasPermission(outer2_11.AUDIO, { showAuthorizationError: false });
return obj1;
}
} else if (arg0 === 1) {
c2 = 3;
throw arg1;
} else if (arg0 === 2) {
c2 = 3;
obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else {
let tmp5 = arg1;
if (arg1) {
tmp5 = !closure_0;
}
if (tmp5) {
const mediaEngine = outer2_7.getMediaEngine();
mediaEngine.on(outer2_0(outer2_2[16]).MediaEngineEvent.VoiceActivity, outer1_12);
}
c2 = 3;
2026-08-15 05:55:55 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} catch (tmp17) {
c2 = tmp;
throw tmp17;
}
}
});
const _listenOnlyIfWeHavePermission = tmp;
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (stateFromStores === _undefined.ACTIVE) {
2026-07-23 10:11:24 +00:00
let c0 = false;
(function listenOnlyIfWeHavePermission() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _listenOnlyIfWeHavePermission.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-23 10:11:24 +00:00
})();
2026-07-20 16:05:17 +00:00
return () => {
2026-07-23 10:11:24 +00:00
let c0 = true;
mediaEngine = mediaEngine.getMediaEngine();
mediaEngine.removeListener(auto(first[16]).MediaEngineEvent.VoiceActivity, outer1_12);
2026-07-20 16:05:17 +00:00
};
}
}, items3);
2026-07-23 10:11:24 +00:00
callback = stateFromStores.useRef(false);
2026-07-29 08:29:29 +00:00
createCacheKey = stateFromStores.useRef(false);
closure_15 = stateFromStores.useRef(null);
2026-07-20 16:05:17 +00:00
const items4 = [auto, first];
2026-07-23 10:11:24 +00:00
const effect3 = stateFromStores.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (ref.current) {
if (auto) {
if (tmp3.current) {
if (first) {
if (null != tmp5.current) {
2026-07-23 10:11:24 +00:00
let _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp5.current);
tmp5.current = null;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let AccessibilityAnnouncer = auto(first[17]).AccessibilityAnnouncer;
let intl = auto(first[18]).intl;
2026-07-20 16:05:17 +00:00
AccessibilityAnnouncer.announce(intl.string(auto(first[18]).t.haLKZ0));
} else {
const _setTimeout = setTimeout;
tmp5.current = setTimeout(() => {
2026-07-29 08:29:29 +00:00
closure_15.current = null;
const AccessibilityAnnouncer = outer1_0(outer1_2[17]).AccessibilityAnnouncer;
const intl = outer1_0(outer1_2[18]).intl;
AccessibilityAnnouncer.announce(intl.string(outer1_0(outer1_2[18]).t.X2hJL7));
2026-07-20 16:05:17 +00:00
}, 1000);
}
return () => {
2026-07-29 08:29:29 +00:00
if (null != ref.current) {
2026-07-20 16:05:17 +00:00
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
};
}
} else {
tmp3.current = false;
}
} else {
2026-07-29 08:29:29 +00:00
tmp.current = true;
2026-07-20 16:05:17 +00:00
}
}, items4);
if (auto) {
2026-07-29 08:29:29 +00:00
obj = { accessible: true, role: "meter", "aria-label": null, "aria-valuenow": null, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuetext": null, onAccessibilityFocus: null, onAccessibilityBlur: null, style: null, children: null };
let intl = tmp10(tmp9[18]).intl;
obj[2] = intl.string(tmp10(tmp9[18]).t.yZcOjo);
let num = 0;
2026-07-20 16:05:17 +00:00
if (first) {
2026-07-29 08:29:29 +00:00
num = 100;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = num;
const intl2 = tmp10(tmp9[18]).intl;
2026-07-20 16:05:17 +00:00
const string = intl2.string;
2026-07-29 08:29:29 +00:00
const t = tmp10(tmp9[18]).t;
2026-07-20 16:05:17 +00:00
if (first) {
let stringResult = string(t.haLKZ0);
} else {
stringResult = string(t.X2hJL7);
}
2026-07-29 08:29:29 +00:00
obj = { children: null };
obj[6] = stringResult;
obj[7] = function onAccessibilityFocus() {
2026-07-20 16:05:17 +00:00
closure_14.current = true;
};
2026-07-29 08:29:29 +00:00
obj[8] = function onAccessibilityBlur() {
2026-07-20 16:05:17 +00:00
closure_14.current = false;
if (null != ref2.current) {
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
obj[9] = tmp.sensitivity;
let obj1 = { style: null, children: null };
obj1[0] = tmp.sensitivityBar;
let obj2 = { style: null };
2026-07-20 16:05:17 +00:00
const items5 = [tmp.sensitivityCommon, first ? tmp.sensitivitySpeaking : tmp.sensitivityDefault];
2026-07-29 08:29:29 +00:00
obj2[0] = items5;
obj1[1] = callback(first1, obj2);
obj[10] = callback(first1, obj1);
const items6 = [callback(tmp10(tmp9[19]).AccessibilityFocusView, obj), ];
const obj3 = { inset: true, children: null };
const intl3 = tmp10(tmp9[18]).intl;
obj3[1] = intl3.string(tmp10(tmp9[18]).t.W3K5Im);
items6[1] = callback(tmp10(tmp9[20]).FormHint, obj3);
obj[0] = items6;
2026-07-23 10:11:24 +00:00
return callback(first1, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const obj4 = { style: null, children: null };
obj4[0] = tmp.sensitivity;
const obj5 = { style: null, children: null };
obj5[0] = tmp.sensitivityBar;
const obj6 = { ref: null, style: null };
obj6[0] = ref;
2026-07-20 16:05:17 +00:00
const items7 = [, , ];
({ sensitivityCommon: arr6[0], sensitivityMin: arr6[1] } = tmp);
2026-07-29 08:29:29 +00:00
const obj7 = { flex: null };
obj7[0] = tmp17;
2026-07-20 16:05:17 +00:00
items7[2] = obj7;
2026-07-29 08:29:29 +00:00
obj6[1] = items7;
2026-07-23 10:11:24 +00:00
const items8 = [callback(first1, obj6), ];
2026-07-29 08:29:29 +00:00
const obj8 = { ref: null, style: null };
obj8[0] = ref1;
2026-07-20 16:05:17 +00:00
const items9 = [, , ];
({ sensitivityCommon: arr8[0], sensitivityMax: arr8[1] } = tmp);
2026-07-29 08:29:29 +00:00
const obj9 = { flex: null };
obj9[0] = 1 - tmp17;
2026-07-20 16:05:17 +00:00
items9[2] = obj9;
2026-07-29 08:29:29 +00:00
obj8[1] = items9;
2026-07-23 10:11:24 +00:00
items8[1] = callback(first1, obj8);
2026-07-29 08:29:29 +00:00
obj5[1] = items8;
2026-07-23 10:11:24 +00:00
const items10 = [callback(first1, obj5), , ];
2026-07-29 08:29:29 +00:00
const obj10 = { ref: null, style: null };
obj10[0] = ref2;
2026-07-20 16:05:17 +00:00
const items11 = [tmp.sensitivityFill, ];
2026-07-29 08:29:29 +00:00
const obj11 = { left: null };
obj11[0] = tmp18[0];
2026-07-20 16:05:17 +00:00
items11[1] = obj11;
2026-07-29 08:29:29 +00:00
obj10[1] = items11;
2026-07-23 10:11:24 +00:00
items10[1] = callback(first1, obj10);
2026-07-29 08:29:29 +00:00
const obj12 = { style: null, value: null, minimumValue: 0, maximumValue: 100, minimumTrackTintColor: "transparent", maximumTrackTintColor: "transparent", onValueChange: null, onSlidingComplete: null, onResponderGrant: null };
obj12[0] = tmp.sensitivitySlider;
obj12[1] = sum;
obj12[6] = callback1;
obj12[7] = function handleSlidingComplete(arg0) {
onThresholdChange(-1 * (100 - arg0));
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
const tmp25 = callback;
const tmp26 = first1;
const tmp27 = callback;
const tmp8Result = tmp8(tmp9[21]);
2026-07-20 16:05:17 +00:00
let fn;
2026-07-29 08:29:29 +00:00
if (tmp10Result.isAndroid()) {
2026-07-20 16:05:17 +00:00
fn = () => true;
}
2026-07-29 08:29:29 +00:00
obj12[8] = fn;
items10[2] = tmp27(tmp8Result, obj12);
obj4[1] = items10;
return tmp25(tmp26, obj4);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmp16 = width(stateFromStores.useState(first2 / 100), 2);
2026-07-20 16:05:17 +00:00
};