decord/source/components_native/common/VoiceSensitivity.tsx

240 lines
9.6 KiB
TypeScript
Raw Normal View History

2026-07-24 07:16:23 +00:00
// Module ID: 10743
// Function ID: 83585
2026-07-20 16:05:17 +00:00
// Name: VoiceSensitivity
2026-07-24 07:16:23 +00:00
// Dependencies: [5, 57, 31, 27, 4177, 4952, 6651, 653, 4344, 33, 4130, 689, 3974, 1450, 566, 4675, 4227, 3843, 1212, 1273, 7636, 7658, 477, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-24 07:16:23 +00:00
// Module 10743 (VoiceSensitivity)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import _slicedToArray from "_slicedToArray";
import result from "result";
import { View } from "get ActivityIndicator";
import closure_7 from "_isNativeReflectConstruct";
import closure_8 from "_isNativeReflectConstruct";
import closure_9 from "_isNativeReflectConstruct";
import { AppStates } from "ME";
import { NativePermissionTypes } from "NativePermissionStatus";
import jsxProd from "jsxProd";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
import hexToRgb from "hexToRgb";
let closure_12;
let closure_13;
const require = arg1;
({ jsx: closure_12, jsxs: closure_13 } = jsxProd);
_createForOfIteratorHelperLoose = { sensitivity: { position: "relative", height: 20 }, sensitivityBar: { position: "absolute", top: 7, left: 0, right: 0, bottom: 7, flexDirection: "row" } };
_createForOfIteratorHelperLoose = { position: "absolute", backgroundColor: require("_createForOfIteratorHelperLoose").unsafe_rawColors.WHITE, opacity: 0.5, top: 7, left: 0, right: 0, bottom: 7 };
_createForOfIteratorHelperLoose.sensitivityFill = _createForOfIteratorHelperLoose;
_createForOfIteratorHelperLoose.sensitivityCommon = { height: 6, borderRadius: 3 };
_createForOfIteratorHelperLoose.sensitivityMin = { backgroundColor: require("_createForOfIteratorHelperLoose").unsafe_rawColors.YELLOW_300 };
let obj1 = { backgroundColor: require("_createForOfIteratorHelperLoose").unsafe_rawColors.YELLOW_300 };
_createForOfIteratorHelperLoose.sensitivityMax = { backgroundColor: require("_createForOfIteratorHelperLoose").unsafe_rawColors.GREEN_360 };
let obj3 = { flex: 1 };
obj3.backgroundColor = hexToRgb.hexWithOpacity(require("_createForOfIteratorHelperLoose").unsafe_rawColors.PRIMARY_400, 0.6);
_createForOfIteratorHelperLoose.sensitivityDefault = obj3;
let obj2 = { backgroundColor: require("_createForOfIteratorHelperLoose").unsafe_rawColors.GREEN_360 };
_createForOfIteratorHelperLoose.sensitivitySpeaking = { flex: 1, backgroundColor: require("_createForOfIteratorHelperLoose").unsafe_rawColors.GREEN_360 };
_createForOfIteratorHelperLoose.sensitivitySlider = { flex: 1, backgroundColor: "transparent", marginVertical: -10 };
_createForOfIteratorHelperLoose = _createForOfIteratorHelperLoose.createStyles(_createForOfIteratorHelperLoose);
let obj4 = { flex: 1, backgroundColor: require("_createForOfIteratorHelperLoose").unsafe_rawColors.GREEN_360 };
const result = require("result").fileFinishedImporting("components_native/common/VoiceSensitivity.tsx");
2026-07-20 16:05:17 +00:00
export default function VoiceSensitivity(auto) {
2026-07-23 10:11:24 +00:00
let AppStates;
2026-07-20 16:05:17 +00:00
let tmp14;
auto = auto.auto;
2026-07-23 10:11:24 +00:00
const onThresholdChange = auto.onThresholdChange;
const tmp = _createForOfIteratorHelperLoose();
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-20 16:05:17 +00:00
const first = tmp6[0];
2026-07-23 10:11:24 +00:00
let _isNativeReflectConstruct = tmp6[1];
width = onThresholdChange(first[13])().width;
let obj = auto(first[14]);
2026-07-20 16:05:17 +00:00
const items = [closure_9];
2026-07-23 10:11:24 +00:00
stateFromStores = obj.useStateFromStores(items, () => state.getState(), []);
const tmp9 = width(stateFromStores.useState(0), 2);
2026-07-20 16:05:17 +00:00
const first1 = tmp9[0];
let closure_7 = tmp9[1];
2026-07-23 10:11:24 +00:00
const tmp11 = width(stateFromStores.useState(sum), 2);
first2 = tmp11[0];
2026-07-20 16:05:17 +00:00
closure_9 = tmp11[1];
2026-07-23 10:11:24 +00:00
const ref2 = stateFromStores.useRef(null);
[tmp14, AppStates] = width(stateFromStores.useState(first2 / 100), 2);
const tmp15 = width(stateFromStores.useState(width * (1 - first1 / -100)), 2);
2026-07-20 16:05:17 +00:00
let closure_11 = tmp15[1];
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-23 10:11:24 +00:00
callback3(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-23 10:11:24 +00:00
callback4(width * (1 - first1 / -100));
2026-07-20 16:05:17 +00:00
}
}, items2);
2026-07-23 10:11:24 +00:00
let 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() {
// CreateGeneratorClosureLongIndex (0x67)
2026-07-23 10:11:24 +00:00
const obj = callback(tmp);
2026-07-20 16:05:17 +00:00
return obj(...arguments);
}
2026-07-23 10:11:24 +00:00
if (stateFromStores === outer1_10.ACTIVE) {
let c0 = false;
(function listenOnlyIfWeHavePermission() {
2026-07-20 16:05:17 +00:00
return _listenOnlyIfWeHavePermission(...arguments);
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);
_createForOfIteratorHelperLoose = stateFromStores.useRef(false);
let 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-20 16:05:17 +00:00
clearTimeout(ref2.current);
ref2.current = null;
}
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-23 10:11:24 +00:00
outer1_15.current = null;
const AccessibilityAnnouncer = auto(first[17]).AccessibilityAnnouncer;
const intl = auto(first[18]).intl;
AccessibilityAnnouncer.announce(intl.string(auto(first[18]).t.X2hJL7));
2026-07-20 16:05:17 +00:00
}, 1000);
}
return () => {
2026-07-23 10:11:24 +00:00
if (null != outer1_15.current) {
2026-07-20 16:05:17 +00:00
const _clearTimeout = clearTimeout;
2026-07-23 10:11:24 +00:00
clearTimeout(outer1_15.current);
outer1_15.current = null;
2026-07-20 16:05:17 +00:00
}
};
}
} else {
tmp3.current = false;
}
} else {
ref.current = true;
}
}, items4);
if (auto) {
obj = {};
2026-07-23 10:11:24 +00:00
obj = { accessible: true, role: "meter", "aria-label": null, "aria-valuenow": null, "aria-valuemin": 0, "aria-valuemax": 100 };
let intl = auto(first[18]).intl;
obj["aria-label"] = intl.string(auto(first[18]).t.yZcOjo);
2026-07-20 16:05:17 +00:00
let num5 = 0;
if (first) {
num5 = 100;
}
2026-07-23 10:11:24 +00:00
obj["aria-valuenow"] = num5;
const intl2 = auto(first[18]).intl;
2026-07-20 16:05:17 +00:00
const string = intl2.string;
2026-07-23 10:11:24 +00:00
const t = auto(first[18]).t;
2026-07-20 16:05:17 +00:00
if (first) {
let stringResult = string(t.haLKZ0);
} else {
stringResult = string(t.X2hJL7);
}
2026-07-23 10:11:24 +00:00
obj["aria-valuetext"] = stringResult;
2026-07-20 16:05:17 +00:00
obj.onAccessibilityFocus = function onAccessibilityFocus() {
closure_14.current = true;
};
obj.onAccessibilityBlur = function onAccessibilityBlur() {
closure_14.current = false;
if (null != ref2.current) {
const _clearTimeout = clearTimeout;
clearTimeout(ref2.current);
ref2.current = null;
}
};
obj.style = tmp.sensitivity;
const obj1 = { style: tmp.sensitivityBar };
const obj2 = {};
const items5 = [tmp.sensitivityCommon, first ? tmp.sensitivitySpeaking : tmp.sensitivityDefault];
obj2.style = items5;
2026-07-23 10:11:24 +00:00
obj1.children = callback(first1, obj2);
obj.children = callback(first1, obj1);
const items6 = [callback(auto(first[19]).AccessibilityFocusView, obj), ];
2026-07-20 16:05:17 +00:00
const obj3 = { inset: true };
2026-07-23 10:11:24 +00:00
const intl3 = auto(first[18]).intl;
obj3.children = intl3.string(auto(first[18]).t.W3K5Im);
items6[1] = callback(auto(first[20]).FormHint, obj3);
2026-07-20 16:05:17 +00:00
obj.children = items6;
2026-07-23 10:11:24 +00:00
return callback(first1, obj);
2026-07-20 16:05:17 +00:00
} else {
const obj4 = { style: tmp.sensitivity };
const obj5 = { style: tmp.sensitivityBar };
const obj6 = { ref };
const items7 = [, , ];
({ sensitivityCommon: arr6[0], sensitivityMin: arr6[1] } = tmp);
const obj7 = { flex: tmp14 };
items7[2] = obj7;
obj6.style = items7;
2026-07-23 10:11:24 +00:00
const items8 = [callback(first1, obj6), ];
2026-07-20 16:05:17 +00:00
const obj8 = { ref: ref1 };
const items9 = [, , ];
({ sensitivityCommon: arr8[0], sensitivityMax: arr8[1] } = tmp);
const obj9 = { flex: 1 - tmp14 };
items9[2] = obj9;
obj8.style = items9;
2026-07-23 10:11:24 +00:00
items8[1] = callback(first1, obj8);
2026-07-20 16:05:17 +00:00
obj5.children = items8;
2026-07-23 10:11:24 +00:00
const items10 = [callback(first1, obj5), , ];
2026-07-20 16:05:17 +00:00
let obj10 = { ref: ref2 };
const items11 = [tmp.sensitivityFill, ];
const obj11 = { left: tmp15[0] };
items11[1] = obj11;
obj10.style = items11;
2026-07-23 10:11:24 +00:00
items10[1] = callback(first1, obj10);
2026-07-20 16:05:17 +00:00
const obj12 = {
style: tmp.sensitivitySlider,
value: sum,
2026-07-23 10:11:24 +00:00
minimumValue: 0,
maximumValue: 100,
minimumTrackTintColor: "transparent",
maximumTrackTintColor: "transparent",
2026-07-20 16:05:17 +00:00
onValueChange: callback1,
onSlidingComplete: function handleSlidingComplete(arg0) {
onThresholdChange(-1 * (100 - arg0));
}
};
2026-07-23 10:11:24 +00:00
obj10 = auto(first[22]);
2026-07-20 16:05:17 +00:00
let fn;
if (obj10.isAndroid()) {
fn = () => true;
}
obj12.onResponderGrant = fn;
2026-07-23 10:11:24 +00:00
items10[2] = callback(onThresholdChange(first[21]), obj12);
2026-07-20 16:05:17 +00:00
obj4.children = items10;
2026-07-23 10:11:24 +00:00
return callback(first1, obj4);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const tmp13 = width(stateFromStores.useState(first2 / 100), 2);
2026-07-20 16:05:17 +00:00
};