decord/source/modules/calls/native/VideoBackground.tsx

210 lines
6.9 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 8458
// Function ID: 8459
2026-07-20 16:05:17 +00:00
// Name: useDominantRGBFromImage
2026-08-25 06:04:03 +00:00
// Dependencies: [32, 19, 17, 676, 21, 4380, 12, 8459, 8460, 4228, 712, 8461, 1297, 4826, 2]
2026-07-29 08:29:29 +00:00
// Exports: useDominantColorFromImage
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 8458 (useDominantRGBFromImage)
import Button from "Button" /* 1297 */;
import LinearGradientDefault from "LinearGradient" /* 4826 */;
import useProfileTileGradientDefault from "useProfileTileGradient" /* 8461 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "_slicedToArray" /* 32 */;
import importAllResult from "noop" /* 19 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
2026-08-25 06:04:03 +00:00
import { NOOP } from "ME" /* 676 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
2026-08-25 06:04:03 +00:00
import createCacheKey from "createCacheKey" /* 4380 */;
2026-08-24 06:08:38 +00:00
import importDefaultResult from "apply" /* 12 */;
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function useDominantRGBFromImage(arg0, arg1) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
let first = arg1;
2026-07-20 16:05:17 +00:00
let tmp = arg1;
if (Array.isArray(arg1)) {
2026-07-23 10:11:24 +00:00
first = arg1[0];
2026-07-20 16:05:17 +00:00
tmp = first;
}
2026-08-25 06:04:03 +00:00
let tmp5 = first(8459)();
2026-08-24 06:08:38 +00:00
dependencyMap = tmp5;
2026-07-20 16:05:17 +00:00
let hexToRgbResult;
if (null != arg0) {
2026-08-25 06:04:03 +00:00
hexToRgbResult = tmp3(8460).cachedDominantColors[arg0];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (hexToRgbResult == null) {
2026-08-25 06:04:03 +00:00
hexToRgbResult = _require(4228).hexToRgb(tmp3(712).unsafe_rawColors.PRIMARY_800);
const obj2 = _require(4228);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmp8 = callback(importAllResult.useState(hexToRgbResult), 2);
callback = tmp8[1];
const items = [tmp, arg0, tmp5];
2026-07-20 16:05:17 +00:00
const effect = importAllResult.useEffect(() => {
2026-07-29 08:29:29 +00:00
let tmp2 = null != first;
if (tmp2) {
tmp2 = null != closure_0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp2) {
2026-08-24 06:08:38 +00:00
if (null == first(table[8]).cachedDominantColors[closure_0]) {
2026-08-04 21:03:28 +00:00
if (typeof tmp === "number") {
2026-08-24 06:08:38 +00:00
const ImageManager = closure_1_6.ImageManager;
let dominantColorsLocalAsset = ImageManager.getDominantColorsLocalAsset(closure_1_7.resolveAssetSource(tmp));
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
const ImageManager2 = closure_1_6.ImageManager;
dominantColorsLocalAsset = ImageManager2.getDominantColors(closure_1_7.resolveAssetSource(tmp));
2026-07-20 16:05:17 +00:00
}
dominantColorsLocalAsset.then((arg0) => {
2026-07-29 08:29:29 +00:00
if (callback()) {
const obj = { r: null, g: null, b: null };
2026-08-24 06:08:38 +00:00
[obj[0], obj[1], obj[2]] = closure_1_3(arg0[0], 3);
2026-07-29 08:29:29 +00:00
callback2(obj);
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_2[8]).cachedDominantColors[closure_0] = obj;
const tmp3 = closure_1_3(arg0[0], 3);
2026-07-20 16:05:17 +00:00
}
2026-08-25 06:04:03 +00:00
}).catch(closure_1_8);
2026-07-20 16:05:17 +00:00
const nextPromise = dominantColorsLocalAsset.then((arg0) => {
2026-07-29 08:29:29 +00:00
if (callback()) {
const obj = { r: null, g: null, b: null };
2026-08-24 06:08:38 +00:00
[obj[0], obj[1], obj[2]] = closure_1_3(arg0[0], 3);
2026-07-29 08:29:29 +00:00
callback2(obj);
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_2[8]).cachedDominantColors[closure_0] = obj;
const tmp3 = closure_1_3(arg0[0], 3);
2026-07-20 16:05:17 +00:00
}
});
} else {
2026-07-29 08:29:29 +00:00
callback(tmp4(tmp5[8]).cachedDominantColors[tmp6]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = first;
2026-08-24 06:08:38 +00:00
tmp5 = table;
2026-07-20 16:05:17 +00:00
}
}, items);
2026-07-29 08:29:29 +00:00
return tmp8[0];
2026-07-20 16:05:17 +00:00
}
class VideoBackground {
constructor(arg0) {
({ url, isStageCall } = global);
if (isStageCall === undefined) {
isStageCall = false;
}
2026-08-25 06:04:03 +00:00
({ user, renderVideoDetails } = global);
({ avatarStyle, guildId } = global);
2026-07-29 08:29:29 +00:00
merged = Object.assign(global, Object.create(null));
2026-08-25 06:04:03 +00:00
tmp2 = closure_11();
tmp3 = closure_12(url);
2026-07-29 08:29:29 +00:00
tmp4 = useDominantRGBFromImage(url, tmp3);
combined = "rgb(" + tmp4.r + ", " + tmp4.g + ", " + tmp4.b + ")";
2026-08-24 06:08:38 +00:00
tmp7 = closure_2;
2026-08-25 06:04:03 +00:00
tmp6 = closure_1;
2026-07-20 16:05:17 +00:00
id = undefined;
2026-08-25 06:04:03 +00:00
tmp8 = require("useProfileTileGradient");
2026-07-29 08:29:29 +00:00
if (user != null) {
2026-07-20 16:05:17 +00:00
id = user.id;
}
2026-08-25 06:04:03 +00:00
tmp8Result = tmp8({ userId: id, guildId, location: "VideoBackground-native" });
tmp11 = null != tmp8Result;
2026-07-29 08:29:29 +00:00
if (null == tmp3) {
2026-07-20 16:05:17 +00:00
return null;
} else {
renderVideoDetailsResult = undefined;
2026-07-29 08:29:29 +00:00
if (renderVideoDetails != null) {
2026-07-20 16:05:17 +00:00
renderVideoDetailsResult = renderVideoDetails();
}
2026-07-29 08:29:29 +00:00
if (renderVideoDetailsResult == null) {
renderVideoDetailsResult = null;
2026-07-20 16:05:17 +00:00
}
2026-08-25 06:04:03 +00:00
items = [, , , ];
items[0] = global.style;
items[1] = tmp2.videoBackground;
tmp13 = null;
if (!tmp11) {
2026-07-29 08:29:29 +00:00
obj = { backgroundColor: null };
obj[0] = combined;
2026-08-25 06:04:03 +00:00
tmp13 = obj;
2026-07-20 16:05:17 +00:00
}
2026-08-25 06:04:03 +00:00
items[2] = tmp13;
2026-07-20 16:05:17 +00:00
videoDetailsSpacer = null;
2026-07-29 08:29:29 +00:00
if (null != renderVideoDetailsResult) {
videoDetailsSpacer = tmp2.videoDetailsSpacer;
2026-07-20 16:05:17 +00:00
}
2026-08-25 06:04:03 +00:00
items[3] = videoDetailsSpacer;
tmp15 = null;
2026-07-20 16:05:17 +00:00
if (isStageCall) {
2026-08-25 06:04:03 +00:00
tmp15 = null;
if (!tmp11) {
obj = { backgroundColor: null };
obj[0] = combined;
tmp15 = obj;
2026-07-20 16:05:17 +00:00
}
}
2026-08-25 06:04:03 +00:00
tmp16 = jsx;
tmp17 = closure_0;
obj1 = { source: null };
obj1[0] = tmp3;
tmp18 = obj1;
tmp19 = merged;
2026-07-20 16:05:17 +00:00
merged1 = Object.assign(merged);
2026-08-25 06:04:03 +00:00
items1 = [, ];
items1[0] = avatarStyle;
items1[1] = tmp15;
obj1.avatarStyle = items1;
obj1.isStageCall = isStageCall;
tmp21 = jsx(require("Button").Avatar, obj1);
if (null != tmp8Result) {
tmp25 = jsxs;
obj2 = { colors: null, start: null, end: null, style: null, children: null };
obj2[0] = tmp8Result;
obj2[1] = { x: 0, y: 0 };
obj2[2] = { x: 0, y: 1 };
obj2[3] = items;
items2 = [, ];
items2[0] = tmp21;
items2[1] = renderVideoDetailsResult;
obj2[4] = items2;
tmp24 = jsxs(require("LinearGradient"), obj2);
} else {
tmp22 = jsxs;
tmp23 = View;
obj3 = { style: null, children: null };
obj3[0] = items;
2026-07-20 16:05:17 +00:00
items3 = [, ];
2026-08-25 06:04:03 +00:00
items3[0] = tmp21;
2026-07-29 08:29:29 +00:00
items3[1] = renderVideoDetailsResult;
2026-08-25 06:04:03 +00:00
obj3[1] = items3;
tmp24 = jsxs(View, obj3);
2026-07-20 16:05:17 +00:00
}
2026-08-25 06:04:03 +00:00
return tmp24;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
let c4 = importAllResult;
({ View: c5, NativeModules: closure_6, Image: error } = get_ActivityIndicator);
2026-08-25 06:04:03 +00:00
({ jsx: c9, jsxs: c10 } = jsxProd);
let closure_11 = createCacheKey.createStyles({ videoBackground: { alignItems: "center" }, videoDetailsSpacer: { paddingTop: 12 } });
2026-08-24 06:08:38 +00:00
const memoizeResult = importDefaultResult.memoize((num) => {
2026-07-20 16:05:17 +00:00
let tmp = null;
2026-08-04 21:03:28 +00:00
if (null != num) {
2026-07-20 16:05:17 +00:00
tmp = null;
2026-08-04 21:03:28 +00:00
if ("" !== num) {
let tmp2 = num;
if (typeof num !== "number") {
2026-07-29 08:29:29 +00:00
const obj = { uri: null };
2026-08-04 21:03:28 +00:00
obj[0] = num;
2026-07-20 16:05:17 +00:00
tmp2 = obj;
}
tmp = tmp2;
}
}
return tmp;
});
2026-07-23 10:11:24 +00:00
VideoBackground.AvatarSizes = require("Button").AvatarSizes;
const memoResult = importAllResult.memo(VideoBackground);
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/calls/native/VideoBackground.tsx");
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
export default memoResult;
export const AvatarSizes = require("Button").AvatarSizes;
2026-07-20 16:05:17 +00:00
export const memoizedImageSource = memoizeResult;
export { useDominantRGBFromImage };
2026-07-29 08:29:29 +00:00
export const useDominantColorFromImage = function useDominantColorFromImage(arg0, arg1) {
const tmp = useDominantRGBFromImage(arg0, arg1);
return "rgb(" + tmp.r + ", " + tmp.g + ", " + tmp.b + ")";
};