278 lines
15 KiB
TypeScript
278 lines
15 KiB
TypeScript
/* Metro module 15307; source: modules/toast/native/ToastContainer.tsx; dependencies: [31, 4502, 15308, 7553, 33, 4501, 6235, 4017, 1478, 13574, 1585, 566, 4559, 4577, 4508, 3869, 15309, 1305, 3857, 2] */
|
|
function _fun117019(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#117019, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:6, offset: 0x024a07e5, size: 445 bytes, params: 8, frame: 23
|
|
var object2;
|
|
const env0_0 = require;
|
|
const getItemKey_117028 = function(a0) {
|
|
return a0.key;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const accessibilityStore = importDefault(4502) /* metro dependency 4502: AccessibilityStore */;
|
|
const toastStore = importDefault(15308) /* metro dependency 15308: ToastStore */;
|
|
const env0_6 = (require(7553) /* metro dependency 7553: YouBarConstants */).useYouBarTotalHeight;
|
|
const env0_7 = (require(33) /* metro dependency 33 */).jsx;
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = createStylesModule.createStyles;
|
|
const TOAST_CONTAINER_SHADOW_COLOR = (require(6235) /* metro dependency 6235: LegacyTokens */).TOAST_CONTAINER_SHADOW_COLOR;
|
|
const env0_8 = Reflect.apply(createStyles, createStylesModule, [{container: {'position': 'absolute',
|
|
'alignSelf': 'center', 'flexDirection': 'row', 'justifyContent': 'center',
|
|
shadowColor: TOAST_CONTAINER_SHADOW_COLOR}}]);
|
|
object2 = {START: 0};
|
|
object2[0] = 'START';
|
|
object2.END = 1;
|
|
object2[1] = 'END';
|
|
const START = object2.START;
|
|
const items2 = [START];
|
|
const END = object2.END;
|
|
items2[1] = END;
|
|
const env0_11 = {'mass': 0.1, 'damping': 10, 'stiffness': 100, 'overshootClamping': true};
|
|
const env0_12 = {'mass': 0.35, 'damping': 15, 'stiffness': 350, 'restDisplacementThreshold': 0.1,
|
|
'restSpeedThreshold': 0.1};
|
|
object2 = {code: "function ToastContainerTsx1(){const{position,safeAreaTop,CONTAINER_DISTANCE_VERTICAL,screenHeight,toastHeight,bottomTabsHeight,youBarHeight,interpolate,animationState,ANIMATION_STATE_INPUT,CONTAINER_TOP_POSITION_START,isReducedMotion,withSpring,OPACITY_SPRING_PHYSICS,TOAST_SPRING_PHYSICS,state,TransitionStates,runOnJS,cleanUp,screenWidth,CONTAINER_DISTANCE_SIDES}=this.__closure;const verticalPositionEnd=position==='top'?safeAreaTop+CONTAINER_DISTANCE_VERTICAL:screenHeight-toastHeight.get()-bottomTabsHeight-CONTAINER_DISTANCE_VERTICAL-youBarHeight;const translateY=interpolate(animationState.get(),ANIMATION_STATE_INPUT,[position==='top'?CONTAINER_TOP_POSITION_START:screenHeight-bottomTabsHeight-toastHeight.get()-youBarHeight,verticalPositionEnd]);return{opacity:!isReducedMotion?withSpring(animationState.get(),OPACITY_SPRING_PHYSICS):animationState.get(),transform:[{translateY:!isReducedMotion?withSpring(translateY,TOAST_SPRING_PHYSICS,'respect-motion-settings',function(finished){if(finished&&state===TransitionStates.YEETED){runOnJS(cleanUp)();}}):translateY}],maxWidth:screenWidth-CONTAINER_DISTANCE_SIDES*2};}"};
|
|
object2 = {code: 'function ToastContainerTsx2(finished){const{state,TransitionStates,runOnJS,cleanUp}=this.__closure;if(finished&&state===TransitionStates.YEETED){runOnJS(cleanUp)();}}'};
|
|
value = value.memo(_fun117030);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/toast/native/ToastContainer.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function AnimatedToast({toast, state, cleanUp}) { // fn#117020, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:1889, offset: 0x024a09a2, size: 869 bytes, params: 2, frame: 39
|
|
var object2;
|
|
var r28;
|
|
var r0;
|
|
var View;
|
|
const key = toast.key;
|
|
let value = null;
|
|
const value2 = Object.create(value);
|
|
value2.key = 0;
|
|
const value3 = copyDataProperties({}, toast, value2, r28);
|
|
const styles = useStyles();
|
|
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
let useSharedValue = reanimatedRexportModule.useSharedValue;
|
|
const value5 = Reflect.apply(useSharedValue, reanimatedRexportModule, [0]);
|
|
const env0_3 = value5;
|
|
const {width, height} = (importDefault(1478) /* metro dependency 1478: useWindowDimensionsNative */)();
|
|
const value7 = (require(13574) /* metro dependency 13574: useTabsVisible */).useMainTabsHeight();
|
|
const top = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)().top;
|
|
const value8 = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore], _fun117021);
|
|
const content = value3.content;
|
|
const env0_9 = content;
|
|
const value9 = (require(4559) /* metro dependency 4559: useIsScreenReaderEnabledNative */).useIsScreenReaderEnabled();
|
|
const r3 = value != content && typeof content === 'string';
|
|
const env0_10 = r3;
|
|
const position = value3.position;
|
|
r28 = position === undefined ? 'top' : position;
|
|
const env0_11 = r28;
|
|
const moduleValue5 = reanimatedRexportModule;
|
|
useSharedValue = moduleValue5.useSharedValue;
|
|
const binding = env0_9;
|
|
const value13 = Reflect.apply(useSharedValue, moduleValue5, [value8 ? binding.END : binding.START]);
|
|
const env0_12 = value13;
|
|
const value14 = useYouBarTotalHeight(8);
|
|
const env0_13 = value14;
|
|
const moduleValue6 = reanimatedRexportModule;
|
|
const useAnimatedStyle = moduleValue6.useAnimatedStyle;
|
|
const closure = AnimatedToastN;
|
|
object2 = {position: r28, safeAreaTop: top, CONTAINER_DISTANCE_VERTICAL: 8, screenHeight: height,
|
|
toastHeight: value5, bottomTabsHeight: value7, youBarHeight: value14};
|
|
object2.interpolate = reanimatedRexportModule.interpolate;
|
|
object2.animationState = value13;
|
|
object2.ANIMATION_STATE_INPUT = env0_10;
|
|
object2.CONTAINER_TOP_POSITION_START = -30;
|
|
object2.isReducedMotion = value8;
|
|
object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
|
|
object2.OPACITY_SPRING_PHYSICS = env0_11;
|
|
object2.TOAST_SPRING_PHYSICS = env0_12;
|
|
object2.state = state;
|
|
const TransitionStates = (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionStates;
|
|
object2.TransitionStates = TransitionStates;
|
|
object2.runOnJS = reanimatedRexportModule.runOnJS;
|
|
object2.cleanUp = cleanUp;
|
|
object2.screenWidth = width;
|
|
object2.CONTAINER_DISTANCE_SIDES = 16;
|
|
closure.__closure = object2;
|
|
closure.__workletHash = 3455640999355;
|
|
closure.__initData = env0_13;
|
|
const value15 = Reflect.apply(useAnimatedStyle, moduleValue6, [closure]);
|
|
env0_3.useEffect(_fun117024, [state, value13, value8, cleanUp]);
|
|
env0_3.useEffect(_fun117025, [r3, content]);
|
|
if (r3) {
|
|
if (value9) {
|
|
r0 = value;
|
|
} else {
|
|
View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
|
|
var viewProps = {pointerEvents: 'none', style: [styles.container, value15], onLayout: onLayout_117026};
|
|
value = importDefault(15309) /* metro dependency 15309: Toast */;
|
|
value = <View {...viewProps}>{((Component) => <Component {...value3} key={key} />)(value)}</View>;
|
|
r0 = value;
|
|
}
|
|
} else {
|
|
View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
|
|
var viewProps = {pointerEvents: 'none', style: [styles.container, value15], onLayout: onLayout_117026};
|
|
value = importDefault(15309) /* metro dependency 15309: Toast */;
|
|
value = <View {...viewProps}>{((Component) => <Component {...value3} key={key} />)(value)}</View>;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function renderItem_117027(a0, a1, a2, a3) { // fn#117027, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:3711, offset: 0x024a1046, size: 50 bytes, params: 5, frame: 15
|
|
return (
|
|
<AnimatedToast
|
|
toast={a1}
|
|
state={a2}
|
|
cleanUp={a3}
|
|
key={a0}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function wrapChildren(a0) { // fn#117029, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:3830, offset: 0x024a1078, size: 52 bytes, params: 2, frame: 14
|
|
const NonExpandingOverlayView = (require(1305) /* metro dependency 1305: native */).NonExpandingOverlayView;
|
|
return (
|
|
<NonExpandingOverlayView>
|
|
{a0}
|
|
</NonExpandingOverlayView>
|
|
);
|
|
}
|
|
|
|
function _fun117030() { // fn#117030, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:3925, offset: 0x024a10ac, size: 156 bytes, params: 1, frame: 19
|
|
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([ToastStore], _fun117031);
|
|
env0_3.useEffect(_fun117032, [value2]);
|
|
const TransitionGroup = (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionGroup;
|
|
return (
|
|
<TransitionGroup
|
|
items={value2}
|
|
renderItem={renderItem_117027}
|
|
getItemKey={getItemKey_117028}
|
|
wrapChildren={wrapChildren}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function _fun117021() { // fn#117021, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:2107, offset: 0x024a0d07, size: 43 bytes, params: 1, frame: 3
|
|
const value = environment.__proto__;
|
|
const useReducedMotion = AccessibilityStore.useReducedMotion;
|
|
const r1 = useReducedMotion || env0_0.disableAnimations;
|
|
return r1 != null && r1;
|
|
}
|
|
|
|
function AnimatedToastN() { // fn#117022, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:2375, owner: AnimatedToast.N, offset: 0x024a0d32, size: 465 bytes, params: 1, frame: 27
|
|
var object4;
|
|
var r2;
|
|
var moduleValue2;
|
|
var withSpring;
|
|
var moduleValue3;
|
|
var closure;
|
|
var object2;
|
|
const r7 = env0_11 === 'top' ? top + 8 : height - env0_3.get() - env0_6 - 8 - env0_13;
|
|
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
const interpolate = reanimatedRexportModule.interpolate;
|
|
let binding = env0_12;
|
|
const value12 = Reflect.apply(interpolate, reanimatedRexportModule, [binding.get(), env1_10,
|
|
[env0_11 === 'top' ? -30 : height - env0_6 - env0_3.get() - env0_13, r7]]);
|
|
object4 = {};
|
|
if (env0_8) {
|
|
r2 = env0_12.get();
|
|
} else {
|
|
moduleValue2 = require(4577) /* metro dependency 4577: spring */;
|
|
r2 = moduleValue2.withSpring(env0_12.get(), env1_11);
|
|
}
|
|
object4.opacity = r2;
|
|
if (env0_8) {
|
|
r2 = value12;
|
|
} else {
|
|
moduleValue3 = require(4577) /* metro dependency 4577: spring */;
|
|
withSpring = moduleValue3.withSpring;
|
|
binding = env1_12;
|
|
closure = NT;
|
|
object2 = {};
|
|
object2.state = state;
|
|
object2.TransitionStates = (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionStates;
|
|
object2.runOnJS = reanimatedRexportModule.runOnJS;
|
|
object2.cleanUp = cleanUp;
|
|
closure.__closure = object2;
|
|
closure.__workletHash = 633151838569;
|
|
closure.__initData = env1_14;
|
|
r2 = Reflect.apply(withSpring, moduleValue3, [value12, binding, 'respect-motion-settings', closure]);
|
|
}
|
|
object4.transform = [{translateY: r2}];
|
|
object4.maxWidth = width - 32;
|
|
return object4;
|
|
}
|
|
|
|
function _fun117024() { // fn#117024, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:3395, offset: 0x024a0f6e, size: 115 bytes, params: 1, frame: 14
|
|
var binding;
|
|
const stateBinding = state;
|
|
const TransitionStates = (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionStates;
|
|
const YEETED = TransitionStates.YEETED;
|
|
if (stateBinding === YEETED) {
|
|
binding = env0_12;
|
|
binding.set(env1_9.START);
|
|
if (env0_8) {
|
|
cleanUp();
|
|
}
|
|
} else {
|
|
binding = env0_12;
|
|
binding.set(env1_9.END);
|
|
}
|
|
}
|
|
|
|
function _fun117025() { // fn#117025, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:3500, offset: 0x024a0fe1, size: 60 bytes, params: 1, frame: 12
|
|
var value2;
|
|
var AccessibilityAnnouncer;
|
|
if (env0_10) {
|
|
value2 = environment.__proto__;
|
|
AccessibilityAnnouncer = (require(3869) /* metro dependency 3869: AccessibilityAnnouncerAndroid */).AccessibilityAnnouncer;
|
|
AccessibilityAnnouncer.announce(content);
|
|
}
|
|
}
|
|
|
|
function AnimatedToastOnLayout({nativeEvent}) { // fn#117026, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:3639, owner: AnimatedToast.onLayout, offset: 0x024a101d, size: 41 bytes, params: 2, frame: 11
|
|
const binding = env0_3;
|
|
binding.set(nativeEvent.layout.height);
|
|
}
|
|
|
|
function _fun117031() { // fn#117031, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:3980, offset: 0x024a1148, size: 39 bytes, params: 1, frame: 9
|
|
let value = environment.__proto__;
|
|
value = ToastStore.getContent();
|
|
return value == null ? [] : [value];
|
|
}
|
|
|
|
function _fun117032() { // fn#117032, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:4051, offset: 0x024a116f, size: 92 bytes, params: 1, frame: 14
|
|
if (env0_0Binding.length !== 0) {
|
|
var env0_0Binding = global.setTimeout(_fun117033, env0_0[0].toastDurationMs ?? 2000);
|
|
return _fun117034;
|
|
}
|
|
}
|
|
|
|
function NT(a0) { // fn#117023, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:2625, owner: AnimatedToast.N.t, offset: 0x024a0f03, size: 107 bytes, params: 2, frame: 13
|
|
var r0;
|
|
var stateBinding;
|
|
var runOnJS;
|
|
var value2;
|
|
let value = a0;
|
|
if (value) {
|
|
value = environment.__proto__;
|
|
stateBinding = state;
|
|
value = environment.__proto__.__proto__;
|
|
value = stateBinding === (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionStates.YEETED;
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
if (r0) {
|
|
value = environment.__proto__.__proto__;
|
|
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
runOnJS = value.runOnJS;
|
|
value2 = environment.__proto__;
|
|
Reflect.apply(runOnJS, value, [cleanUp])();
|
|
}
|
|
}
|
|
|
|
function _fun117033() { // fn#117033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:4097, offset: 0x024a11cb, size: 37 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__.__proto__;
|
|
return (importDefault(3857) /* metro dependency 3857: ToastActionCreators */).close();
|
|
}
|
|
|