decord/source/modules/quests/native/QuestDock/QuestDockVideoBackground.tsx
github-actions e510164e6b chore: update source for alpha 346.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
2026-09-10 05:38:07 +00:00

259 lines
12 KiB
TypeScript

// Module ID: 15232
// Function ID: 15233
// Name: QuestDockVideoBackground
// Dependencies: [32, 19, 17, 4566, 5458, 15125, 1074, 21, 4574, 15126, 4310, 4988, 7087, 15129, 15212, 8295, 504, 672, 1115, 11798, 8335, 5601, 5001, 2]
// Module 15232 (QuestDockVideoBackground)
import _modDef672 from "module_672" /* 672 */;
import spring from "spring" /* 4988 */;
import ReanimatedNativeViewDefault from "ReanimatedNativeView" /* 7087 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
import AccessibilityStore from "AccessibilityStore" /* 4566 */;
const require = globalThis.__r;
require = fn;
function QuestDockBackgroundMediaFade(children) {
let activeQuestDockMode;
activeQuestDockMode = noop.useContext(activeQuestDockMode(15126).QuestDockGestureContext).activeQuestDockMode;
const tmp = closure_16();
const fn = function s() {
let num = 0;
if (activeQuestDockMode.get() === QuestDockMode.EXPANDED) {
num = 1;
}
return { opacity: spring.withSpring(num, QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED) };
};
let obj = activeQuestDockMode(4310);
fn.__closure = { withSpring: activeQuestDockMode(4988).withSpring, activeQuestDockMode, QuestDockMode, QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED };
fn.__workletHash = 5908890006198;
fn.__initData = __initData;
const animatedStyle = obj.useAnimatedStyle(fn);
const obj3 = { style: null, children: children.children };
const items = [tmp.fullHeightMedia, animatedStyle];
obj3.style = items;
return closure_11(ReanimatedNativeViewDefault, obj3);
}
get_ActivityIndicator = fn(17);
({ AppState: hasOwnProperty, StyleSheet } = get_ActivityIndicator);
const QuestDockMode = fn(5458).QuestDockMode;
const QuestDockConstants = fn(15125);
({ QUEST_DOCK_EXPANDED_HEIGHT, QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED: closure_8, QUEST_DOCK_UNENROLLED_HEADER_INSET_EXPANDED: closure_9 } = QuestDockConstants);
const VerticalGradient = fn(1074).VerticalGradient;
const jsxProd = fn(21);
({ jsx: closure_11, jsxs: closure_12 } = jsxProd);
let closure_13 = [0, 0.1, 0.8, 1];
const locations = [0, 0.33, 0.76, 1];
const QuestDockBackgroundCollapsedMediaMode = { PAUSED: "paused", HIDDEN: "hidden" };
const createStyles = fn(4574);
let obj2 = { backgroundWrapper: null, backgroundImage: null, backgroundVideo: null, fullHeightMedia: null, backgroundGradient: null };
let obj4 = {};
const merged = Object.assign(StyleSheet.absoluteFillObject);
obj4.right = undefined;
obj4.bottom = undefined;
obj4.height = QUEST_DOCK_EXPANDED_HEIGHT;
obj4.zIndex = 1;
obj2.backgroundWrapper = obj4;
let obj5 = {};
const merged1 = Object.assign(StyleSheet.absoluteFillObject);
obj5.height = QUEST_DOCK_EXPANDED_HEIGHT;
obj5.resizeMode = "cover";
obj2.backgroundImage = obj5;
const merged2 = Object.assign(StyleSheet.absoluteFillObject);
obj2.backgroundVideo = {};
let obj7 = {};
const merged3 = Object.assign(StyleSheet.absoluteFillObject);
obj7.height = QUEST_DOCK_EXPANDED_HEIGHT;
obj2.fullHeightMedia = obj7;
let obj8 = {};
const merged4 = Object.assign(StyleSheet.absoluteFillObject);
obj8.height = QUEST_DOCK_EXPANDED_HEIGHT;
obj2.backgroundGradient = obj8;
let closure_16 = createStyles.createStyles(obj2);
const __initData = { code: "function QuestDockVideoBackgroundTsx1(){const{withSpring,activeQuestDockMode,QuestDockMode,QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED}=this.__closure;return{opacity:withSpring(activeQuestDockMode.get()===QuestDockMode.EXPANDED?1:0,QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED)};}" };
const __initData2 = { code: "function QuestDockVideoBackgroundTsx2(){const{withSpring,activeQuestDockMode,QuestDockMode,QUEST_DOCK_UNENROLLED_HEADER_INSET_EXPANDED,QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED,windowDimensions}=this.__closure;return{transform:[{translateX:withSpring(activeQuestDockMode.get()===QuestDockMode.COLLAPSED?QUEST_DOCK_UNENROLLED_HEADER_INSET_EXPANDED*-1:0,QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED)},{translateY:withSpring(activeQuestDockMode.get()===QuestDockMode.COLLAPSED?QUEST_DOCK_UNENROLLED_HEADER_INSET_EXPANDED*-1:0,QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED)}],width:windowDimensions.get().width};}" };
const __initData3 = { code: "function QuestDockVideoBackgroundTsx3(){const{withSpring,shouldShowVideo,videoLoaded,isMediaHiddenWhenCollapsed,activeQuestDockMode,QuestDockMode,QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED}=this.__closure;return{opacity:withSpring(shouldShowVideo&&videoLoaded&&(isMediaHiddenWhenCollapsed||activeQuestDockMode.get()===QuestDockMode.EXPANDED)?0:1,QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED)};}" };
const size = fn(2);
const result = size.fileFinishedImporting("modules/quests/native/QuestDock/QuestDockVideoBackground.tsx");
export default noop.memo(function QuestDockVideoBackground(gradientBaseColor) {
({ imageUrl, videoUrl, collapsedMediaMode } = gradientBaseColor);
if (collapsedMediaMode === undefined) {
collapsedMediaMode = obj.PAUSED;
}
gradientBaseColor = gradientBaseColor.gradientBaseColor;
let activeQuestDockMode;
let setRestingQuestDockMode;
currentState = undefined;
let isRendered;
let first1;
QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED = undefined;
importDefault = tmp2;
let tmp3 = closure_16();
const context = setRestingQuestDockMode.useContext(gradientBaseColor(activeQuestDockMode[9]).QuestDockGestureContext);
activeQuestDockMode = context.activeQuestDockMode;
const windowDimensions = context.windowDimensions;
setRestingQuestDockMode = setRestingQuestDockMode.useContext(gradientBaseColor(activeQuestDockMode[13]).QuestDockExternalCoordinationContext).setRestingQuestDockMode;
const tmp8 = require("useStateFromSharedValue")(activeQuestDockMode);
let items = [isRendered];
const items1 = [gradientBaseColor];
const stateFromStores = gradientBaseColor(activeQuestDockMode[16]).useStateFromStores(items, () => isRendered.useReducedMotion);
const memo = setRestingQuestDockMode.useMemo(() => {
closure_0 = _modDef672(gradientBaseColor);
return closure_13.map((item) => closure_0.alpha(item).hex());
}, items1);
let obj2 = gradientBaseColor(activeQuestDockMode[16]);
class P {
constructor() {
tmp = closure_0;
tmp2 = closure_2;
obj = closure_0(closure_2[11]);
obj2 = activeQuestDockMode;
num = 0;
tmp3 = QuestDockMode;
if (activeQuestDockMode.get() === QuestDockMode.COLLAPSED) {
tmp4 = closure_9;
num2 = -1;
num = -1 * closure_9;
}
obj1 = { translateX: obj.withSpring(num, closure_8) };
tmp5 = closure_8;
items = [, ];
items[0] = obj1;
tmpResult = tmp(tmp2[11]);
num3 = 0;
if (obj2.get() === tmp3.COLLAPSED) {
tmp6 = closure_9;
num4 = -1;
num3 = -1 * closure_9;
}
obj7 = { transform: null, width: null };
obj8 = { translateY: tmpResult.withSpring(num3, tmp5) };
items[1] = obj8;
obj7.transform = items;
obj7.width = windowDimensions.get().width;
return obj7;
}
}
let obj3 = gradientBaseColor(activeQuestDockMode[10]);
P.__closure = { withSpring: gradientBaseColor(activeQuestDockMode[11]).withSpring, activeQuestDockMode, QuestDockMode: first1, QUEST_DOCK_UNENROLLED_HEADER_INSET_EXPANDED: closure_9, QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED, windowDimensions };
P.__workletHash = 1105448000732;
P.__initData = __initData2;
const animatedStyle = obj3.useAnimatedStyle(P);
const tmp16 = windowDimensions(setRestingQuestDockMode.useState(tmp8 === first1.EXPANDED), 2);
const first = tmp16[0];
let tmp18 = !first;
if (!first) {
tmp18 = tmp14;
}
if (tmp18) {
tmp16[1](true);
}
let obj4 = { withSpring: gradientBaseColor(activeQuestDockMode[11]).withSpring, activeQuestDockMode, QuestDockMode: first1, QUEST_DOCK_UNENROLLED_HEADER_INSET_EXPANDED: closure_9, QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED, windowDimensions };
const tmp12 = QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED;
[tmp21, c5] = windowDimensions(setRestingQuestDockMode.useState("active" !== currentState.currentState), 2);
const items2 = [activeQuestDockMode, setRestingQuestDockMode];
const effect = obj.useEffect(() => {
closure_0 = _undefined.addEventListener("change", (event) => {
_undefined("active" !== event);
let tmp3 = gradientBaseColor(activeQuestDockMode[18]).isIOS() && tmp;
if (tmp3) {
tmp3 = closure_1_2.get() === first1.EXPANDED;
}
if (tmp3) {
setRestingQuestDockMode(first1.COLLAPSED);
}
});
return () => {
closure_0.remove();
};
}, items2);
isRendered = !tmp21;
if (!tmp21) {
isRendered = setRestingQuestDockMode.useContext(require("QuestDockVisibilityContext")).isRendered;
}
if (isRendered) {
isRendered = !stateFromStores;
}
if (isRendered) {
isRendered = null != videoUrl;
}
if (isRendered) {
isRendered = !tmp4(tmp5[18]).isAndroid();
const tmp4Result = tmp4(tmp5[18]);
}
if (isRendered) {
isRendered = tmp4(tmp5[19]).isHeroVideoSupported(gradientBaseColor.videoMimetype);
const tmp4Result3 = tmp4(tmp5[19]);
}
if (isRendered) {
let tmp24 = !tmp2;
if (tmp2) {
tmp24 = first;
}
isRendered = tmp24;
}
const tmp15Result2 = windowDimensions(setRestingQuestDockMode.useState(false), 2);
first1 = tmp15Result2[0];
QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED = tmp15Result2[1];
const callback = obj.useCallback(() => {
closure_8(true);
}, []);
const tmp15Result = windowDimensions(setRestingQuestDockMode.useState("active" !== currentState.currentState), 2);
const fn = function z() {
let num = 1;
if (isRendered) {
num = 1;
if (first1) {
if (closure_1) {
num = 0;
} else {
num = 1;
}
}
}
return { opacity: spring.withSpring(num, QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED) };
};
const tmp4Result4 = gradientBaseColor(activeQuestDockMode[10]);
fn.__closure = { withSpring: gradientBaseColor(activeQuestDockMode[11]).withSpring, shouldShowVideo: isRendered, videoLoaded: first1, isMediaHiddenWhenCollapsed: collapsedMediaMode === setRestingQuestDockMode.HIDDEN, activeQuestDockMode, QuestDockMode: first1, QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED: tmp12 };
fn.__workletHash = 10281907446713;
fn.__initData = __initData3;
let tmp30 = null;
const animatedStyle1 = tmp4Result4.useAnimatedStyle(fn);
if (isRendered) {
const obj6 = { style: tmp3.backgroundVideo, onLoad: callback, source: null, paused: null, resizeMode: "cover", muted: true, disableFocus: true, preventsDisplaySleepDuringVideoPlayback: false };
const obj7 = { uri: videoUrl };
obj6.source = obj7;
obj6.paused = tmp8 !== tmp11.EXPANDED;
tmp30 = closure_11(tmp4(tmp5[20]).VideoComponent, obj6);
}
const items3 = [tmp30, ];
let tmp32 = null;
if (null != imageUrl) {
const obj8 = { style: null, children: null };
const items4 = [tmp3.fullHeightMedia, animatedStyle1];
obj8.style = items4;
const obj9 = { style: tmp3.backgroundImage, source: null };
const obj10 = { uri: imageUrl };
obj9.source = obj10;
obj8.children = closure_11(tmp7(tmp5[21]), obj9);
tmp32 = closure_11(tmp7(tmp5[12]), obj8);
const tmp7Result = tmp7(tmp5[12]);
}
items3[1] = tmp32;
const tmp29Result = closure_12(setRestingQuestDockMode.Fragment, { children: items3 });
const obj11 = { style: null, pointerEvents: "none", accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: null };
const items5 = [tmp3.backgroundWrapper, animatedStyle];
obj11.style = items5;
let tmp37 = tmp29Result;
const obj5 = { withSpring: gradientBaseColor(activeQuestDockMode[11]).withSpring, shouldShowVideo: isRendered, videoLoaded: first1, isMediaHiddenWhenCollapsed: collapsedMediaMode === obj.HIDDEN, activeQuestDockMode, QuestDockMode: first1, QUEST_DOCK_MODE_CHANGE_PHYSICS_CLAMPED: tmp12 };
if (collapsedMediaMode === obj.HIDDEN) {
const obj12 = { children: tmp29Result };
tmp37 = closure_11(QuestDockBackgroundMediaFade, obj12);
}
const items6 = [tmp37, closure_11(require("LinearGradient"), { locations, style: tmp3.backgroundGradient, start: VerticalGradient.START, end: VerticalGradient.END, colors: memo })];
obj11.children = items6;
return closure_12(require("ReanimatedNativeView"), obj11);
});
export { QuestDockBackgroundCollapsedMediaMode };