Files
discord-decomp/modules/quests/native/BountiesModal/BountiesModalContentScroll.tsx
T
2026-11-01 12:12:55 +02:00

800 lines
37 KiB
TypeScript

// Metro module 14035 (f14036).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useRef, useState, useCallback, useMemo, useEffect } from "react";
import { StyleSheet, View } from "react-native";
import BountyStore from "../../BountyStore";
import { DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID, QuestsExperimentLocations } from "../../QuestConstants";
import { AnalyticEvents } from "../../../../Constants";
import { ContentDismissActionType } from "../../../dismissible_content/DismissibleContentConstants";
import * as _Module501 from "../../../../_bundle/Module501";
import Module712 from "../../../../_bundle/Module712";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle, useSharedValue, useAnimatedScrollHandler, useAnimatedReaction, useDerivedValue } from "../../../reanimated/ReanimatedRexport";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import BountiesScrollPromptFooter, { BOUNTIES_MODAL_BASE_FOOTER_HEIGHT } from "./BountiesScrollPromptFooter";
import { useQuestHomeBounties } from "../../hooks/QuestHooks";
import { useBountiesExperience } from "../../experiments/useBountiesExperience";
import * as _BountiesVerticalScrollExperiment from "../../experiments/BountiesVerticalScrollExperiment";
import { useStateFromStores } from "../../../../_bundle/Module589";
import * as _useBountiesRecapScroll from "./useBountiesRecapScroll";
import { useBountiesRecapScroll } from "./useBountiesRecapScroll";
import { useBountySwipeUpNux } from "./useBountySwipeUpNux";
import { v4 } from "../../../../_bundle/Module514";
import * as _AnalyticsTypes from "../../lib/analytics/AnalyticsTypes";
import { BountyScrollingType, getQuestContentName } from "../../lib/analytics/AnalyticsTypes";
import { trackBountyAutoScrollDismissed, trackBountyVerticalScroll, trackAdContentEvent } from "../../lib/analytics/AnalyticsActions";
import { useBountiesAutoScroll, AUTO_SCROLL_PEEK_TOP_OFFSET, AUTO_SCROLL_PEEK_SCALE } from "./useBountiesAutoScroll";
import { useBountiesRecapOrbCount } from "./useBountiesRecapOrbCount";
import { markAdContentSeen } from "../../QuestActionCreators";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { QuestContent } from "../../../../_bundle/Module5038";
import { formatVideoProgressRatio } from "../../utils/VideoQuestUtils";
import BountiesModalActionCreators from "./BountiesModalActionCreators";
import { BountiesScrollVideoItem } from "./BountiesScrollVideoItem";
import BountiesScrollPromptNuxFooter from "./BountiesScrollPromptNuxFooter";
import { BountiesScrollRecapFooter } from "./BountiesScrollRecapFooter";
import BountiesAutoScrollOverlayNuxGradient from "./BountiesAutoScrollOverlayNuxGradient";
import { QuestContentImpressionTrackerNative } from "../QuestContentImpressionTracker.native";
import { BountiesScrollRecapPage } from "./BountiesScrollRecapPage";
import { AnimatedFlashList } from "../../../../_bundle/noop_6676";
import Module4611 from "../../../../_bundle/Module4611";
import BountiesModalCloseButton from "./BountiesModalCloseButton";
import BountiesAutoScrollIndicator from "./BountiesAutoScrollIndicator";
import { ThemeContextProvider } from "../../../../_bundle/Module3913";
import { ThemeTypes } from "../../../../_bundle/Module6678";
let isAndroid, zIndex, zIndex2, zIndex3, zIndex4, c9811_19, PX_8, _excluded, FOOTER_FADE_START_PROGRESS, FOOTER_FADE_END_PROGRESS, isScrollEventInBounds, BountiesRecapPullZone, useStyles, __initData, BountiesScrollVideoItemContainer, __initData2, __initData3, __initData4, __initData5, __initData6, __initData7, __initData8, __initData9, __initData10, __initData11, __initData12, __initData13, __initData14, __initData15, __initData16, __initData17, __initData18, __initData19, __initData20, BountiesModalContentScrollInner;
const ItemSeparator = function ItemSeparator(props) {
return props.trailingItem != null ? <View style={{
height: PX_8
}} /> : null;
};
BountiesRecapPullZone = function BountiesRecapPullZone(props) {
return <View style={{
height: props.height
}} />;
};
BountiesScrollVideoItemContainer = function BountiesScrollVideoItemContainer(props) {
const { index, slotHeight, scrollY, style, isPeekEnabled, children: children2 } = props;
const c = function c() {
const r19 = (scrollY.get() - index * slotHeight) / slotHeight;
return {
opacity: _ReanimatedRexport.interpolate(Math.abs(r19), [0, 0.3, 1], [1, 1, isPeekEnabled ? r19 < 0 ? index === 1 ? 0.8 : 0 : 0 : 0], _ReanimatedRexport.Extrapolation.CLAMP)
};
};
c.__closure = {
scrollY,
index,
slotHeight,
isPeekEnabled,
PEEK_OPACITY: 0.8,
interpolate: _ReanimatedRexport.interpolate,
FADE_DEADBAND: 0.3,
Extrapolation: _ReanimatedRexport.Extrapolation
};
c.__workletHash = 6532652233494;
c.__initData = __initData;
return <ReanimatedRexport.View style={[style, useAnimatedStyle(c)]}>{children2}</ReanimatedRexport.View>;
};
BountiesModalContentScrollInner = function BountiesModalContentScrollInner(props) {
let memo, questHomeBounties, state, orbAmount, ownedByVerticalScrollExperiment, rewardTimerSeconds, ownedByVerticalScrollExperiment2, isAutoScrollEnabled, c20862_13, height2, slotHeight2, c20862_16, c20862_17, height3, lastBounty, fullRecap, handleRecapMomentumEnd, state2, setState2, state3, setState3, setState4, setState5, state4, setState6, sharedValue, sharedValue2, sharedValue3, hasSingleUseSwipeUpNux, dismissSingleUseSwipeUpNux, hasRecurringSwipeUpNux, dismissRecurringSwipeUpNux, hasRecurringSwipeUpNux2, hasRecurringSwipeUpNux3, memo2, ref, ref2, peekScale, cancel, dismissOnClose, takeDidAutoScroll, onPlaybackTimeChange, onEndCardVisible, pauseCountdown, resumeCountdown, memo3, callback, callback2, bountiesRecapOrbCount, callback3, memo4, derivedValue;
let state5, width, height4, c20863_3;
const { initialBountyId, sourceQuestContent } = props;
memo = void 0;
questHomeBounties = void 0;
state = void 0;
orbAmount = void 0;
ownedByVerticalScrollExperiment = void 0;
rewardTimerSeconds = void 0;
ownedByVerticalScrollExperiment2 = void 0;
isAutoScrollEnabled = void 0;
c20862_13 = void 0;
height2 = void 0;
slotHeight2 = void 0;
c20862_16 = void 0;
c20862_17 = void 0;
height3 = void 0;
lastBounty = void 0;
fullRecap = void 0;
handleRecapMomentumEnd = void 0;
state2 = void 0;
setState2 = void 0;
state3 = void 0;
setState3 = void 0;
setState4 = void 0;
setState5 = void 0;
state4 = void 0;
setState6 = void 0;
sharedValue = void 0;
sharedValue2 = void 0;
sharedValue3 = void 0;
hasSingleUseSwipeUpNux = void 0;
dismissSingleUseSwipeUpNux = void 0;
hasRecurringSwipeUpNux = void 0;
dismissRecurringSwipeUpNux = void 0;
hasRecurringSwipeUpNux2 = void 0;
hasRecurringSwipeUpNux3 = void 0;
memo2 = void 0;
ref = void 0;
ref2 = void 0;
peekScale = void 0;
cancel = void 0;
dismissOnClose = void 0;
takeDidAutoScroll = void 0;
onPlaybackTimeChange = void 0;
onEndCardVisible = void 0;
pauseCountdown = void 0;
resumeCountdown = void 0;
memo3 = void 0;
callback = void 0;
callback2 = void 0;
bountiesRecapOrbCount = void 0;
callback3 = void 0;
memo4 = void 0;
derivedValue = void 0;
const styles = useStyles();
const height = useWindowDimensions_native().height;
const ref3 = useRef(null);
const [state6, setState] = useState(BOUNTIES_MODAL_BASE_FOOTER_HEIGHT);
const callback4 = useCallback((a0) => {
setState(Math.ceil(a0.nativeEvent.layout.height));
}, []);
state5 = state6;
width = void 0;
height4 = void 0;
c20863_3 = void 0;
const windowDimensions_native = useWindowDimensions_native();
width = windowDimensions_native.width;
height4 = windowDimensions_native.height;
const safeAreaInsets_native = useSafeAreaInsets_native();
c20863_3 = safeAreaInsets_native;
memo = useMemo(() => {
const r9 = width - c20863_3.left - c20863_3.right;
const r16 = height4 - c20863_3.top - state5;
let r18 = r9 / c9811_19;
let r7 = r9;
if (r18 > r16) {
r7 = r16 * c9811_19;
r18 = r16;
}
return {
top: c20863_3.top,
left: Math.floor(c20863_3.left + (r9 - r7) / 2),
width: Math.floor(r7),
height: Math.floor(r18)
};
}, [width, height4, safeAreaInsets_native.top, safeAreaInsets_native.left, safeAreaInsets_native.right, state5]);
questHomeBounties = useQuestHomeBounties().questHomeBounties;
state = _slicedToArray(useState(() => {
const r5 = questHomeBounties.findIndex((questHomeBounty) => questHomeBounty.id === initialBountyId);
return r5 <= 0 ? questHomeBounties : [...questHomeBounties.slice(r5), ...questHomeBounties.slice(0, r5)];
}), 1)[0];
const bountiesExperience = useBountiesExperience(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
orbAmount = bountiesExperience.orbAmount;
ownedByVerticalScrollExperiment = bountiesExperience.ownedByVerticalScrollExperiment;
rewardTimerSeconds = bountiesExperience.rewardTimerSeconds;
const scrollAffordanceVariant = bountiesExperience.scrollAffordanceVariant;
ownedByVerticalScrollExperiment2 = ownedByVerticalScrollExperiment;
isAutoScrollEnabled = scrollAffordanceVariant === "auto";
const shouldUseScrollIndicatorOverlay = _BountiesVerticalScrollExperiment.shouldUseScrollIndicatorOverlay(scrollAffordanceVariant);
const stateFromStores = useStateFromStores([BountyStore], () => BountyStore.getCompletedBountyCount(state) * orbAmount, [state, orbAmount]);
const r121 = state[0];
c20862_13 = r121;
const stateFromStores2 = useStateFromStores([BountyStore], () => {
if (c20862_13 == null) {
return false;
}
const bountyVideoProgress = BountyStore.getBountyVideoProgress(c20862_13.id);
return bountyVideoProgress != null && bountyVideoProgress.maxTimestampSec >= rewardTimerSeconds;
}, [r121, rewardTimerSeconds]);
height2 = memo.height;
slotHeight2 = height2 + PX_8;
const lastBountyIndex = state.length - 1;
c20862_16 = lastBountyIndex;
const enabled = stateFromStores > 0;
c20862_17 = enabled;
height3 = height2;
lastBounty = lastBountyIndex * slotHeight2;
fullRecap = lastBounty + height2;
handleRecapMomentumEnd = useBountiesRecapScroll({
listRef: ref3,
enabled,
offsets: useMemo(() => ({
lastBounty,
fullRecap,
revealHeight: height3
}), [fullRecap, lastBounty, height2])
}).handleRecapMomentumEnd;
const memo5 = useMemo(() => {
const r5 = state.map((item, index) => index * slotHeight2);
if (c20862_17) {
r5.push(fullRecap);
}
return r5;
}, [state, fullRecap, enabled, slotHeight2]);
[state2, setState2] = useState(false);
[state3, setState3] = useState(false);
let state7;
[state7, setState4] = useState(true);
let state8;
[state8, setState5] = useState(false);
[state4, setState6] = useState(0);
sharedValue = useSharedValue(false);
sharedValue2 = useSharedValue(false);
sharedValue3 = useSharedValue(0);
const bountySwipeUpNux = useBountySwipeUpNux({
isEligible: state.length > 1,
location: QuestsExperimentLocations.VIDEO_MODAL_MOBILE
});
hasSingleUseSwipeUpNux = bountySwipeUpNux.hasSingleUseSwipeUpNux;
dismissSingleUseSwipeUpNux = bountySwipeUpNux.dismissSingleUseSwipeUpNux;
hasRecurringSwipeUpNux = bountySwipeUpNux.hasRecurringSwipeUpNux;
dismissRecurringSwipeUpNux = bountySwipeUpNux.dismissRecurringSwipeUpNux;
const r179 = state4 === 0;
let visible2 = r179 && hasSingleUseSwipeUpNux && stateFromStores2;
hasRecurringSwipeUpNux2 = scrollAffordanceVariant === "peek" && hasRecurringSwipeUpNux;
hasRecurringSwipeUpNux3 = shouldUseScrollIndicatorOverlay && hasRecurringSwipeUpNux;
memo2 = useMemo(() => v4(), []);
ref = useRef(0);
ref2 = useRef(0);
useEffect(() => {
ref.current = Date.now();
}, []);
const callback5 = useCallback((a0) => {
if (a0 === _AnalyticsTypes.VerticalScrollingDirection.DOWN) {
trackBountyAutoScrollDismissed({
verticalScrollingPosition: state4,
scrollSessionId: memo2
});
}
}, [state4, memo2]);
const enabled2 = isAutoScrollEnabled ? state4 < lastBountyIndex : isAutoScrollEnabled;
const mode = r179 ? hasRecurringSwipeUpNux ? "countdown" : "hint" : "hint";
let activeBountyId = state[state4]?.id;
if (activeBountyId == null) {
activeBountyId = null;
}
const bountiesAutoScroll = useBountiesAutoScroll({
listRef: ref3,
enabled: enabled2,
mode,
activeIndex: state4,
activeBountyId,
slotHeight: slotHeight2,
onCountdownCancelled: callback5
});
const { visible, peekActive, progress, showProgressRing } = bountiesAutoScroll;
peekScale = bountiesAutoScroll.peekScale;
cancel = bountiesAutoScroll.cancel;
dismissOnClose = bountiesAutoScroll.dismissOnClose;
takeDidAutoScroll = bountiesAutoScroll.takeDidAutoScroll;
onPlaybackTimeChange = bountiesAutoScroll.onPlaybackTimeChange;
onEndCardVisible = bountiesAutoScroll.onEndCardVisible;
pauseCountdown = bountiesAutoScroll.pauseCountdown;
resumeCountdown = bountiesAutoScroll.resumeCountdown;
memo3 = useMemo(() => ({
onPlaybackTimeChange,
onPaused: pauseCountdown,
onResumed: resumeCountdown,
onEndCardVisible
}), [onEndCardVisible, onPlaybackTimeChange, pauseCountdown, resumeCountdown]);
callback = useCallback(function(a0, scrollingType = BountyScrollingType.MANUAL) {
const current = ref2.current;
if (a0 !== current) {
ref2.current = a0;
const current2 = Date.now();
const timeWatchedPreScrollMs = current2 - ref.current;
ref.current = current2;
trackBountyVerticalScroll({
scrollingType,
scrollingDirection: a0 > current ? _AnalyticsTypes.VerticalScrollingDirection.DOWN : _AnalyticsTypes.VerticalScrollingDirection.UP,
verticalScrollingPosition: a0,
scrollSessionId: memo2,
timeWatchedPreScrollMs
});
}
}, [memo2]);
callback2 = useCallback((a0) => {
const r7 = takeDidAutoScroll();
setState6(a0);
callback(a0, r7 ? BountyScrollingType.AUTO : BountyScrollingType.MANUAL);
if (state4 === 0 && a0 > 0) {
if (hasSingleUseSwipeUpNux) {
dismissSingleUseSwipeUpNux(ContentDismissActionType.USER_DISMISS);
} else if (hasRecurringSwipeUpNux) {
dismissRecurringSwipeUpNux(ContentDismissActionType.USER_DISMISS);
}
}
}, [takeDidAutoScroll, callback, state4, hasSingleUseSwipeUpNux, hasRecurringSwipeUpNux, dismissSingleUseSwipeUpNux, dismissRecurringSwipeUpNux]);
bountiesRecapOrbCount = useBountiesRecapOrbCount({
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty,
recapRevealHeight: height2,
targetOrbAmount: stateFromStores,
enabled
});
useEffect(() => {
const r7 = state[state4];
if (r7 != null) {
markAdContentSeen(AdCreativeType.BOUNTY, [r7.id]);
}
}, [state, state4]);
const callback6 = useCallback(() => {
dismissOnClose();
const r10 = state[state4];
if (r10 != null) {
const bountyVideoProgress = BountyStore.getBountyVideoProgress(r10.id);
let r11 = bountyVideoProgress?.maxTimestampSec;
if (r11 == null) {
r11 = 0;
}
let r14 = bountyVideoProgress?.duration;
if (r14 == null) {
r14 = 0;
}
const r1 = 1000 * rewardTimerSeconds;
trackAdContentEvent({
adContentId: r10.id,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_MODAL_CLOSED,
properties: {
content_name: getQuestContentName(QuestContent.VIDEO_MODAL_MOBILE),
content_id: QuestContent.VIDEO_MODAL_MOBILE,
video_progress: formatVideoProgressRatio(r11, r14),
threshold_met: 1000 * r11 >= r1,
reward_timer_seconds: r1 / 1000
},
sourceQuestContent
});
}
BountiesModalActionCreators.hideModal();
}, [state, state4, dismissOnClose, rewardTimerSeconds, sourceQuestContent]);
callback3 = useCallback(() => {
trackAdContentEvent({
adContentId: DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_MODAL_CLOSED,
properties: {
content_name: getQuestContentName(QuestContent.BOUNTIES_END_INTERSTITIAL),
content_id: QuestContent.BOUNTIES_END_INTERSTITIAL
},
sourceQuestContent
});
BountiesModalActionCreators.hideModal();
}, [sourceQuestContent]);
const Tt = function Tt(a0) {
sharedValue3.set(a0.contentOffset.y);
if (sharedValue2.get()) {
const r28 = Math.max(0, a0.contentSize.height - a0.layoutMeasurement.height);
sharedValue.set(a0.contentOffset.y >= 0 && a0.contentOffset.y <= r28);
}
};
Tt.__closure = {
scrollY: sharedValue3,
isDraggingSharedValue: sharedValue2,
isScrollingInBoundsSharedValue: sharedValue,
isScrollEventInBounds
};
Tt.__workletHash = 7942598540397;
Tt.__initData = __initData2;
const Bt = function Bt(a0) {
sharedValue2.set(true);
const r23 = Math.max(0, a0.contentSize.height - a0.layoutMeasurement.height);
sharedValue.set(a0.contentOffset.y >= 0 && a0.contentOffset.y <= r23);
};
Bt.__closure = {
isDraggingSharedValue: sharedValue2,
isScrollingInBoundsSharedValue: sharedValue,
isScrollEventInBounds
};
Bt.__workletHash = 14039038912528;
Bt.__initData = __initData3;
const Ct = function Ct(a0) {
const r6 = a0.contentOffset.y < 0 ? _AnalyticsTypes.VerticalScrollingDirection.DOWN : _AnalyticsTypes.VerticalScrollingDirection.UP;
_ReanimatedRexport.runOnJS(cancel)(r6);
sharedValue2.set(false);
if (!isAndroid) {
sharedValue.set(false);
}
};
Ct.__closure = {
VerticalScrollingDirection: _AnalyticsTypes.VerticalScrollingDirection,
runOnJS: _ReanimatedRexport.runOnJS,
cancelScrollAffordance: cancel,
isDraggingSharedValue: sharedValue2,
IS_ANDROID: isAndroid,
isScrollingInBoundsSharedValue: sharedValue
};
Ct.__workletHash = 10752087179842;
Ct.__initData = __initData4;
const It = function It(a0) {
if (c20862_17) {
_ReanimatedRexport.runOnJS(handleRecapMomentumEnd)(a0);
}
sharedValue.set(false);
};
It.__closure = {
showRecapPullZone: enabled,
runOnJS: _ReanimatedRexport.runOnJS,
handleRecapMomentumEnd,
isScrollingInBoundsSharedValue: sharedValue
};
It.__workletHash = 13684210320337;
It.__initData = __initData5;
const animatedScrollHandler = useAnimatedScrollHandler({
onScroll: Tt,
onBeginDrag: Bt,
onEndDrag: Ct,
onMomentumEnd: It
});
const xt = () => Math.min(Math.max(Math.round(sharedValue3.get() / slotHeight2), 0), c20862_16);
xt.__closure = {
scrollY: sharedValue3,
slotHeight: slotHeight2,
lastBountyIndex
};
xt.__workletHash = 14048843158960;
xt.__initData = __initData6;
const mt = function mt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(callback2)(a0);
}
};
mt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
commitSwipe: callback2
};
mt.__workletHash = 14015091539518;
mt.__initData = __initData7;
useAnimatedReaction(xt, mt);
const wt = () => c20862_17 && sharedValue3.get() >= lastBounty - _useBountiesRecapScroll.RECAP_SNAP_EPSILON;
wt.__closure = {
showRecapPullZone: enabled,
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty,
RECAP_SNAP_EPSILON: _useBountiesRecapScroll.RECAP_SNAP_EPSILON
};
wt.__workletHash = 6584708256992;
wt.__initData = __initData8;
const yt = function yt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState5)(a0);
}
};
yt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setShowRecapFooter: setState5
};
yt.__workletHash = 10788669301891;
yt.__initData = __initData9;
useAnimatedReaction(wt, yt);
const Nt = () => c20862_17 && sharedValue3.get() > lastBounty;
Nt.__closure = {
showRecapPullZone: enabled,
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty
};
Nt.__workletHash = 6186370630693;
Nt.__initData = __initData10;
const Mt = function Mt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState2)(a0);
}
};
Mt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setIsRecapPageRevealed: setState2
};
Mt.__workletHash = 12713474352874;
Mt.__initData = __initData11;
useAnimatedReaction(Nt, Mt);
const Vt = () => c20862_17 && sharedValue3.get() >= fullRecap - _useBountiesRecapScroll.RECAP_SNAP_EPSILON;
Vt.__closure = {
showRecapPullZone: enabled,
scrollY: sharedValue3,
fullRecapScrollOffset: fullRecap,
RECAP_SNAP_EPSILON: _useBountiesRecapScroll.RECAP_SNAP_EPSILON
};
Vt.__workletHash = 5669564400667;
Vt.__initData = __initData12;
const bt = function bt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState3)(a0);
}
};
bt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setIsRecapPageOnTop: setState3
};
bt.__workletHash = 8102193741774;
bt.__initData = __initData13;
useAnimatedReaction(Vt, bt);
const memo6 = useMemo(() => c20862_17 ? <BountiesRecapPullZone height={height3} /> : null, [height2, enabled]);
const memo7 = useMemo(() => [styles.listWrapper, {
top: 0,
left: memo.left,
width: memo.width,
height: memo.top + memo.height + 97
}], [styles.listWrapper, memo]);
const memo8 = useMemo(() => ({
paddingTop: memo.top,
paddingBottom: 97
}), [memo.top]);
memo4 = useMemo(() => ({
width: memo.width,
height: memo.height
}), [memo.width, memo.height]);
const memo9 = useMemo(() => [styles.closeButton, {
top: memo.top + Module712.space.PX_8,
left: memo.left + memo.width - Module712.space.PX_32 - Module712.space.PX_8
}], [styles.closeButton, memo.top, memo.left, memo.width]);
const memo10 = useMemo(() => [styles.autoScrollIndicator, {
top: memo.top + AUTO_SCROLL_PEEK_TOP_OFFSET + memo.height * AUTO_SCROLL_PEEK_SCALE + Module712.space.PX_32,
left: memo.left,
width: memo.width
}], [styles.autoScrollIndicator, memo.top, memo.height, memo.left, memo.width]);
const memo11 = useMemo(() => [styles.recapPage, {
top: memo.top,
left: memo.left,
width: memo.width,
height: height - memo.top,
...state3 ? {
zIndex: zIndex4
} : null
}], [state3, styles.recapPage, memo.top, memo.left, memo.width, height]);
const Ft = () => _useBountiesRecapScroll.getRevealProgress(sharedValue3.get(), lastBounty, height3);
Ft.__closure = {
getRevealProgress: _useBountiesRecapScroll.getRevealProgress,
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty,
recapRevealHeight: height2
};
Ft.__workletHash = 8427964721554;
Ft.__initData = __initData14;
derivedValue = useDerivedValue(Ft);
const Yt = () => ({
opacity: _ReanimatedRexport.interpolate(derivedValue.get(), [0, 1], [0, 1], _ReanimatedRexport.Extrapolation.CLAMP)
});
Yt.__closure = {
interpolate: _ReanimatedRexport.interpolate,
recapPullProgress: derivedValue,
Extrapolation: _ReanimatedRexport.Extrapolation
};
Yt.__workletHash = 1497321349449;
Yt.__initData = __initData15;
const animatedStyle = useAnimatedStyle(Yt);
const Jt = () => ({
opacity: _ReanimatedRexport.interpolate(derivedValue.get(), [FOOTER_FADE_START_PROGRESS, FOOTER_FADE_END_PROGRESS], [1, 0], _ReanimatedRexport.Extrapolation.CLAMP)
});
Jt.__closure = {
interpolate: _ReanimatedRexport.interpolate,
recapPullProgress: derivedValue,
FOOTER_FADE_START_PROGRESS,
FOOTER_FADE_END_PROGRESS,
Extrapolation: _ReanimatedRexport.Extrapolation
};
Jt.__workletHash = 3685190194249;
Jt.__initData = __initData16;
const animatedStyle2 = useAnimatedStyle(Jt);
const Ut = function Ut() {
return {
opacity: _ReanimatedRexport.interpolate(sharedValue3.get() >= lastBounty - slotHeight2 / 2 ? derivedValue.get() : _useBountiesRecapScroll.getRevealProgress(sharedValue3.get(), 0, height3), [FOOTER_FADE_START_PROGRESS, FOOTER_FADE_END_PROGRESS], [1, 0], _ReanimatedRexport.Extrapolation.CLAMP)
};
};
Ut.__closure = {
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty,
slotHeight: slotHeight2,
recapPullProgress: derivedValue,
getRevealProgress: _useBountiesRecapScroll.getRevealProgress,
recapRevealHeight: height2,
interpolate: _ReanimatedRexport.interpolate,
FOOTER_FADE_START_PROGRESS,
FOOTER_FADE_END_PROGRESS,
Extrapolation: _ReanimatedRexport.Extrapolation
};
Ut.__workletHash = 15092194442650;
Ut.__initData = __initData17;
const animatedStyle3 = useAnimatedStyle(Ut);
const memo12 = useMemo(() => [styles.peekGradient, {
left: memo.left,
width: memo.width,
top: memo.top + memo.height,
bottom: 0
}], [styles.peekGradient, memo.left, memo.width, memo.top, memo.height]);
const Gt = () => ({
opacity: _ReanimatedRexport.interpolate(sharedValue3.get(), [0, slotHeight2], [1, 0], _ReanimatedRexport.Extrapolation.CLAMP)
});
Gt.__closure = {
interpolate: _ReanimatedRexport.interpolate,
scrollY: sharedValue3,
slotHeight: slotHeight2,
Extrapolation: _ReanimatedRexport.Extrapolation
};
Gt.__workletHash = 5908400559291;
Gt.__initData = __initData18;
const animatedStyle4 = useAnimatedStyle(Gt);
const Zt = () => derivedValue.get() < FOOTER_FADE_END_PROGRESS;
Zt.__closure = {
recapPullProgress: derivedValue,
FOOTER_FADE_END_PROGRESS
};
Zt.__workletHash = 547045699209;
Zt.__initData = __initData19;
const Qt = function Qt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState4)(a0);
}
};
Qt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setIsCloseButtonPressable: setState4
};
Qt.__workletHash = 6290671204687;
Qt.__initData = __initData20;
useAnimatedReaction(Zt, Qt);
const callback7 = useCallback(({ item, index: index2 }) => {
const shouldLoadHls = ownedByVerticalScrollExperiment ? index2 === state4 || index2 === state4 + 1 : true;
const isActive = index2 === state4;
let isScrollIndicatorOverlayEnabled = hasRecurringSwipeUpNux3;
if (hasRecurringSwipeUpNux3) {
isScrollIndicatorOverlayEnabled = index2 === 0;
}
return <BountiesScrollVideoItemContainer index={index2} slotHeight={slotHeight2} scrollY={sharedValue3} style={memo4} isPeekEnabled={hasRecurringSwipeUpNux2}>
<BountiesScrollVideoItem key={item.id} bounty={item} sourceQuestContent={sourceQuestContent} width={memo.width} height={memo.height} index={index2} isActive={isActive} isRecapPageRevealed={state2} isRecapPageOnTop={state3} isScrollingInBoundsSharedValue={sharedValue} isScrollIndicatorOverlayEnabled={isScrollIndicatorOverlayEnabled} shouldLoadHls={shouldLoadHls} scrollAffordance={isAutoScrollEnabled ? memo3 : void 0} peekScale={isActive ? isAutoScrollEnabled ? peekScale : void 0 : void 0} softDownloadCapsEnabled={ownedByVerticalScrollExperiment2} />
</BountiesScrollVideoItemContainer>;
}, [slotHeight2, sharedValue3, memo4, hasRecurringSwipeUpNux2, isAutoScrollEnabled, peekScale, sourceQuestContent, memo.width, memo.height, state4, state2, state3, sharedValue, hasRecurringSwipeUpNux3, memo3, ownedByVerticalScrollExperiment, ownedByVerticalScrollExperiment]);
const memo13 = useMemo(() => ({
activeIndex: state4,
isRecapPageRevealed: state2,
isRecapPageOnTop: state3,
width: memo.width,
height: memo.height,
isPeekEnabled: hasRecurringSwipeUpNux2,
isAutoScrollEnabled,
canShowScrollIndicatorOverlay: hasRecurringSwipeUpNux3,
ownedByVerticalScrollExperiment,
isSoftCapPreload: ownedByVerticalScrollExperiment2
}), [state4, state2, state3, memo.width, memo.height, hasRecurringSwipeUpNux2, isAutoScrollEnabled, hasRecurringSwipeUpNux3, ownedByVerticalScrollExperiment, ownedByVerticalScrollExperiment]);
const callback8 = useCallback((a0) => {
a0.size = height2;
}, [height2]);
if (state.length === 0) {
return null;
}
const r496 = visible2 ? <BountiesScrollPromptNuxFooter /> : state8 ? <BountiesScrollRecapFooter orbAmount={stateFromStores} /> : null;
const r515 = [<BountiesAutoScrollOverlayNuxGradient active={peekActive} />, enabled ? <ReanimatedRexport.View style={[memo11, animatedStyle]} pointerEvents={state3 ? "box-none" : "none"}>
<QuestContentImpressionTrackerNative adContentId={DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID} adCreativeType={AdCreativeType.BOUNTY} questContent={QuestContent.BOUNTIES_END_INTERSTITIAL} overrideVisibility={state3} sourceQuestContent={sourceQuestContent}>
{() => <BountiesScrollRecapPage orbAmount={bountiesRecapOrbCount} onClose={callback3} style={{
flex: 1
}} />}
</QuestContentImpressionTrackerNative>
</ReanimatedRexport.View> : null, <View style={memo7}>
<AnimatedFlashList ref={ref3} data={state} keyExtractor={(item) => item.id} renderItem={callback7} extraData={memo13} overrideItemLayout={callback8} ItemSeparatorComponent={ItemSeparator} ListFooterComponent={memo6} snapToOffsets={memo5} snapToEnd={false} decelerationRate={0.85} showsVerticalScrollIndicator={false} drawDistance={slotHeight2} onScroll={animatedScrollHandler} scrollEventThrottle={16} contentContainerStyle={memo8} />
</View>, hasRecurringSwipeUpNux2 ? state.length > 1 ? <ReanimatedRexport.View pointerEvents="none" style={[memo12, animatedStyle4]}>
<Module4611 colors={_excluded} style={StyleSheet.absoluteFill} />
</ReanimatedRexport.View> : null : null, <ReanimatedRexport.View style={[memo9, animatedStyle2]} pointerEvents={state7 ? "box-none" : "none"}>
{state7 ? <BountiesModalCloseButton onPress={callback6} /> : null}
</ReanimatedRexport.View>, visible ? <View style={memo10} pointerEvents="none">
<BountiesAutoScrollIndicator progress={progress} showProgressRing={showProgressRing} />
</View> : null, ,];
if (!visible2) {
visible2 = state8;
}
r515[6] = <BountiesScrollPromptFooter visible={visible2} onContentLayout={callback4} zIndex={zIndex4} opacityStyle={animatedStyle3}>{r496}</BountiesScrollPromptFooter>;
return <View style={styles.root}>{r515}</View>;
};
isAndroid = _Module501.isAndroid();
zIndex = 0;
zIndex2 = 1;
zIndex3 = 2;
zIndex4 = 3;
c9811_19 = 0.5625;
PX_8 = Module712.space.PX_8;
_excluded = ["rgba(0,0,0,0)", "rgba(0,0,0,0.75)"];
FOOTER_FADE_START_PROGRESS = 0.05;
FOOTER_FADE_END_PROGRESS = 0.1;
const isScrollEventInBounds2 = function isScrollEventInBounds(a0) {
const r12 = Math.max(0, a0.contentSize.height - a0.layoutMeasurement.height);
return a0.contentOffset.y >= 0 && a0.contentOffset.y <= r12;
};
isScrollEventInBounds2.__closure = {};
isScrollEventInBounds2.__workletHash = 14148486927190;
isScrollEventInBounds2.__initData = {
code: "function isScrollEventInBounds_BountiesModalContentScrollTsx1(event){const maxOffset=Math.max(0,event.contentSize.height-event.layoutMeasurement.height);return event.contentOffset.y>=0&&event.contentOffset.y<=maxOffset;}"
};
isScrollEventInBounds = isScrollEventInBounds2;
useStyles = createStyles(() => ({
root: {
flex: 1
},
recapPage: {
position: "absolute",
zIndex
},
listWrapper: {
position: "absolute",
zIndex: zIndex2,
overflow: "hidden"
},
closeButton: {
position: "absolute",
zIndex: zIndex4
},
peekGradient: {
position: "absolute",
zIndex: zIndex3
},
autoScrollIndicator: {
position: "absolute",
zIndex: zIndex4,
alignItems: "center"
}
}));
__initData = {
code: "function BountiesModalContentScrollTsx2(){const{scrollY,index,slotHeight,isPeekEnabled,PEEK_OPACITY,interpolate,FADE_DEADBAND,Extrapolation}=this.__closure;const signedDistance=(scrollY.get()-index*slotHeight)/slotHeight;const distance=Math.abs(signedDistance);const peekOpacity=isPeekEnabled&&signedDistance<0&&index===1?PEEK_OPACITY:0;const opacity=interpolate(distance,[0,FADE_DEADBAND,1],[1,1,peekOpacity],Extrapolation.CLAMP);return{opacity:opacity};}"
};
__initData2 = {
code: "function BountiesModalContentScrollTsx3(event){const{scrollY,isDraggingSharedValue,isScrollingInBoundsSharedValue,isScrollEventInBounds}=this.__closure;scrollY.set(event.contentOffset.y);if(isDraggingSharedValue.get()){isScrollingInBoundsSharedValue.set(isScrollEventInBounds(event));}}"
};
__initData3 = {
code: "function BountiesModalContentScrollTsx4(event){const{isDraggingSharedValue,isScrollingInBoundsSharedValue,isScrollEventInBounds}=this.__closure;isDraggingSharedValue.set(true);isScrollingInBoundsSharedValue.set(isScrollEventInBounds(event));}"
};
__initData4 = {
code: "function BountiesModalContentScrollTsx5(event){const{VerticalScrollingDirection,runOnJS,cancelScrollAffordance,isDraggingSharedValue,IS_ANDROID,isScrollingInBoundsSharedValue}=this.__closure;const scrollingDirection=event.contentOffset.y<0?VerticalScrollingDirection.DOWN:VerticalScrollingDirection.UP;runOnJS(cancelScrollAffordance)(scrollingDirection);isDraggingSharedValue.set(false);if(!IS_ANDROID){isScrollingInBoundsSharedValue.set(false);}}"
};
__initData5 = {
code: "function BountiesModalContentScrollTsx6(event){const{showRecapPullZone,runOnJS,handleRecapMomentumEnd,isScrollingInBoundsSharedValue}=this.__closure;if(showRecapPullZone){runOnJS(handleRecapMomentumEnd)(event);}isScrollingInBoundsSharedValue.set(false);}"
};
__initData6 = {
code: "function BountiesModalContentScrollTsx7(){const{scrollY,slotHeight,lastBountyIndex}=this.__closure;return Math.min(Math.max(Math.round(scrollY.get()/slotHeight),0),lastBountyIndex);}"
};
__initData7 = {
code: "function BountiesModalContentScrollTsx8(next,prev){const{runOnJS,commitSwipe}=this.__closure;if(next!==prev){runOnJS(commitSwipe)(next);}}"
};
__initData8 = {
code: "function BountiesModalContentScrollTsx9(){const{showRecapPullZone,scrollY,lastBountyScrollOffset,RECAP_SNAP_EPSILON}=this.__closure;return showRecapPullZone&&scrollY.get()>=lastBountyScrollOffset-RECAP_SNAP_EPSILON;}"
};
__initData9 = {
code: "function BountiesModalContentScrollTsx10(show,previousShow){const{runOnJS,setShowRecapFooter}=this.__closure;if(show!==previousShow){runOnJS(setShowRecapFooter)(show);}}"
};
__initData10 = {
code: "function BountiesModalContentScrollTsx11(){const{showRecapPullZone,scrollY,lastBountyScrollOffset}=this.__closure;return showRecapPullZone&&scrollY.get()>lastBountyScrollOffset;}"
};
__initData11 = {
code: "function BountiesModalContentScrollTsx12(revealed,previousRevealed){const{runOnJS,setIsRecapPageRevealed}=this.__closure;if(revealed!==previousRevealed){runOnJS(setIsRecapPageRevealed)(revealed);}}"
};
__initData12 = {
code: "function BountiesModalContentScrollTsx13(){const{showRecapPullZone,scrollY,fullRecapScrollOffset,RECAP_SNAP_EPSILON}=this.__closure;return showRecapPullZone&&scrollY.get()>=fullRecapScrollOffset-RECAP_SNAP_EPSILON;}"
};
__initData13 = {
code: "function BountiesModalContentScrollTsx14(onTop,previousOnTop){const{runOnJS,setIsRecapPageOnTop}=this.__closure;if(onTop!==previousOnTop){runOnJS(setIsRecapPageOnTop)(onTop);}}"
};
__initData14 = {
code: "function BountiesModalContentScrollTsx15(){const{getRevealProgress,scrollY,lastBountyScrollOffset,recapRevealHeight}=this.__closure;return getRevealProgress(scrollY.get(),lastBountyScrollOffset,recapRevealHeight);}"
};
__initData15 = {
code: "function BountiesModalContentScrollTsx16(){const{interpolate,recapPullProgress,Extrapolation}=this.__closure;return{opacity:interpolate(recapPullProgress.get(),[0,1],[0,1],Extrapolation.CLAMP)};}"
};
__initData16 = {
code: "function BountiesModalContentScrollTsx17(){const{interpolate,recapPullProgress,FOOTER_FADE_START_PROGRESS,FOOTER_FADE_END_PROGRESS,Extrapolation}=this.__closure;return{opacity:interpolate(recapPullProgress.get(),[FOOTER_FADE_START_PROGRESS,FOOTER_FADE_END_PROGRESS],[1,0],Extrapolation.CLAMP)};}"
};
__initData17 = {
code: "function BountiesModalContentScrollTsx18(){const{scrollY,lastBountyScrollOffset,slotHeight,recapPullProgress,getRevealProgress,recapRevealHeight,interpolate,FOOTER_FADE_START_PROGRESS,FOOTER_FADE_END_PROGRESS,Extrapolation}=this.__closure;const progress=scrollY.get()>=lastBountyScrollOffset-slotHeight/2?recapPullProgress.get():getRevealProgress(scrollY.get(),0,recapRevealHeight);return{opacity:interpolate(progress,[FOOTER_FADE_START_PROGRESS,FOOTER_FADE_END_PROGRESS],[1,0],Extrapolation.CLAMP)};}"
};
__initData18 = {
code: "function BountiesModalContentScrollTsx19(){const{interpolate,scrollY,slotHeight,Extrapolation}=this.__closure;return{opacity:interpolate(scrollY.get(),[0,slotHeight],[1,0],Extrapolation.CLAMP)};}"
};
__initData19 = {
code: "function BountiesModalContentScrollTsx20(){const{recapPullProgress,FOOTER_FADE_END_PROGRESS}=this.__closure;return recapPullProgress.get()<FOOTER_FADE_END_PROGRESS;}"
};
__initData20 = {
code: "function BountiesModalContentScrollTsx21(pressable,previousPressable){const{runOnJS,setIsCloseButtonPressable}=this.__closure;if(pressable!==previousPressable){runOnJS(setIsCloseButtonPressable)(pressable);}}"
};
export default function BountiesModalContentScroll(props) {
return <ThemeContextProvider theme={ThemeTypes.DARKER}>
<BountiesModalContentScrollInner initialBountyId={props.bountyId} sourceQuestContent={props.sourceQuestContent} />
</ThemeContextProvider>;
};