88 lines
3.7 KiB
TypeScript
88 lines
3.7 KiB
TypeScript
// Metro module 14043 (f14044).
|
|
import { useState, useCallback } from "react";
|
|
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
|
|
import { useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
|
|
import * as _useBountiesRecapScroll from "./useBountiesRecapScroll";
|
|
let getRecapOrbCountFromPullProgress, __initData, __initData2;
|
|
const getRecapOrbCountFromPullProgress2 = function getRecapOrbCountFromPullProgress(a0, a1) {
|
|
if (!(a1 <= 0) && Number.isFinite(a1)) {
|
|
return Math.round(Math.min(1, Math.max(0, a0)) * a1);
|
|
}
|
|
return 0;
|
|
};
|
|
getRecapOrbCountFromPullProgress2.__closure = {};
|
|
getRecapOrbCountFromPullProgress2.__workletHash = 14295638108053;
|
|
getRecapOrbCountFromPullProgress2.__initData = {
|
|
code: "function getRecapOrbCountFromPullProgress_useBountiesRecapOrbCountTsx1(progress,targetOrbAmount){if(targetOrbAmount<=0||!Number.isFinite(targetOrbAmount)){return 0;}const clampedProgress=Math.min(1,Math.max(0,progress));return Math.round(clampedProgress*targetOrbAmount);}"
|
|
};
|
|
getRecapOrbCountFromPullProgress = getRecapOrbCountFromPullProgress2;
|
|
__initData = {
|
|
code: "function useBountiesRecapOrbCountTsx2(){const{enabled,recapRevealHeight,getRevealProgress,scrollY,lastBountyScrollOffset,RECAP_ORB_COUNT_REACHES_TARGET_AT_PROGRESS,getRecapOrbCountFromPullProgress,targetOrbAmount}=this.__closure;if(!enabled||recapRevealHeight<=0){return{count:0,revealed:false};}const pullProgress=getRevealProgress(scrollY.get(),lastBountyScrollOffset,recapRevealHeight)/RECAP_ORB_COUNT_REACHES_TARGET_AT_PROGRESS;if(pullProgress<=0.1){return{count:0,revealed:false};}return{count:getRecapOrbCountFromPullProgress(pullProgress,targetOrbAmount),revealed:true};}"
|
|
};
|
|
__initData2 = {
|
|
code: "function useBountiesRecapOrbCountTsx3({count:count,revealed:revealed}){const{runOnJS,resetDisplayCount,setDisplayCountMonotonic}=this.__closure;if(!revealed){runOnJS(resetDisplayCount)();return;}runOnJS(setDisplayCountMonotonic)(count);}"
|
|
};
|
|
export { getRecapOrbCountFromPullProgress };
|
|
export function useBountiesRecapOrbCount({ scrollY, lastBountyScrollOffset, recapRevealHeight, targetOrbAmount, enabled }) {
|
|
let callback2;
|
|
callback2 = void 0;
|
|
const [state, setState] = useState(0);
|
|
const callback = useCallback((c27616_0) => {
|
|
setState((prevState) => {
|
|
let r0 = prevState;
|
|
if (c27616_0 > prevState) {
|
|
r0 = c27616_0;
|
|
}
|
|
return r0;
|
|
});
|
|
}, []);
|
|
callback2 = useCallback(() => {
|
|
setState(0);
|
|
}, []);
|
|
const b = function b() {
|
|
if (enabled && !(recapRevealHeight <= 0)) {
|
|
const r21 = _useBountiesRecapScroll.getRevealProgress(scrollY.get(), lastBountyScrollOffset, recapRevealHeight) / 0.95;
|
|
return r21 <= 0.1 ? {
|
|
count: 0,
|
|
revealed: false
|
|
} : {
|
|
count: targetOrbAmount <= 0 ? 0 : Number.isFinite(targetOrbAmount) ? Math.round(Math.min(1, Math.max(0, r21)) * targetOrbAmount) : 0,
|
|
revealed: true
|
|
};
|
|
}
|
|
return {
|
|
count: 0,
|
|
revealed: false
|
|
};
|
|
};
|
|
b.__closure = {
|
|
enabled,
|
|
recapRevealHeight,
|
|
getRevealProgress: _useBountiesRecapScroll.getRevealProgress,
|
|
scrollY,
|
|
lastBountyScrollOffset,
|
|
RECAP_ORB_COUNT_REACHES_TARGET_AT_PROGRESS: 0.95,
|
|
getRecapOrbCountFromPullProgress,
|
|
targetOrbAmount
|
|
};
|
|
b.__workletHash = 2855285055570;
|
|
b.__initData = __initData;
|
|
const r39 = function(a0) {
|
|
const count = a0.count;
|
|
if (a0.revealed) {
|
|
_ReanimatedRexport.runOnJS(callback)(count);
|
|
} else {
|
|
_ReanimatedRexport.runOnJS(callback2)();
|
|
}
|
|
};
|
|
r39.__closure = {
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
resetDisplayCount: callback2,
|
|
setDisplayCountMonotonic: callback
|
|
};
|
|
r39.__workletHash = 12006414940221;
|
|
r39.__initData = __initData2;
|
|
useAnimatedReaction(b, r39);
|
|
return state;
|
|
}
|