/* 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] */ import UseWindowDimensionsNative from '../../screen/useWindowDimensions.native.tsx'; /* Metro dependency 1478 */ import UseSafeAreaInsetsNative from '../../safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */ import ToastActionCreators from './ToastActionCreators.tsx'; /* Metro dependency 3857 */ import AccessibilityStore from '../../a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */ import ToastStore from './ToastStore.tsx'; /* Metro dependency 15308 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */ import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */ import * as ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */ import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */ import * as TransitionGroupModule from '../../../design/components/TransitionGroup/TransitionGroup.tsx'; /* Metro dependency 4508 */ import * as UseIsScreenReaderEnabledNativeModule from '../../a11y/native/useIsScreenReaderEnabled.native.tsx'; /* Metro dependency 4559 */ import * as LegacyTokensModule from '../../../design/migrations/native/LegacyTokens.tsx'; /* Metro dependency 6235 */ import * as YouBarConstantsModule from '../../main_tabs_v2/native/YouBarConstants.tsx'; /* Metro dependency 7553 */ import * as UseTabsVisibleModule from '../../main_tabs_v2/native/utils/useTabsVisible.tsx'; /* Metro dependency 13574 */ 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 const env0_0 = require; const getItemKey_117028 = function(a0) { return a0.key; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ReactModule; const createStyles = CreateStylesModule.createStyles; const TOAST_CONTAINER_SHADOW_COLOR = (LegacyTokensModule).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}}]); object = {START: 0}; object[0] = 'START'; object.END = 1; object[1] = 'END'; const START = object.START; const items2 = [START]; const END = object.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}; object = {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};}"}; object = {code: 'function ToastContainerTsx2(finished){const{state,TransitionStates,runOnJS,cleanUp}=this.__closure;if(finished&&state===TransitionStates.YEETED){runOnJS(cleanUp)();}}'}; value = value.memo(_fun117030); (FileImportTrackerModule).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 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(); let useSharedValue = ReanimatedRexportModule.useSharedValue; const value5 = Reflect.apply(useSharedValue, ReanimatedRexportModule, [0]); const env0_3 = value5; const {width, height} = (UseWindowDimensionsNative)(); const value7 = (UseTabsVisibleModule).useMainTabsHeight(); const top = (UseSafeAreaInsetsNative)().top; const value8 = (FluxModule).useStateFromStores([AccessibilityStore], _fun117021); const content = value3.content; const content2 = content; const value9 = (UseIsScreenReaderEnabledNativeModule).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; useSharedValue = ReanimatedRexportModule.useSharedValue; const binding = content2; const value13 = Reflect.apply(useSharedValue, ReanimatedRexportModule, [value8 ? binding.END : binding.START]); const env0_12 = value13; const value14 = useYouBarTotalHeight(8); const env0_13 = value14; const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle; const AnimatedToastN2 = AnimatedToastN; object = {position: r28, safeAreaTop: top, CONTAINER_DISTANCE_VERTICAL: 8, screenHeight: height, toastHeight: value5, bottomTabsHeight: value7, youBarHeight: value14}; object.interpolate = ReanimatedRexportModule.interpolate; object.animationState = value13; object.ANIMATION_STATE_INPUT = env0_10; object.CONTAINER_TOP_POSITION_START = -30; object.isReducedMotion = value8; object.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring; object.OPACITY_SPRING_PHYSICS = env0_11; object.TOAST_SPRING_PHYSICS = env0_12; object.state = state; const TransitionStates = (TransitionGroupModule).TransitionStates; object.TransitionStates = TransitionStates; object.runOnJS = ReanimatedRexportModule.runOnJS; object.cleanUp = cleanUp; object.screenWidth = width; object.CONTAINER_DISTANCE_SIDES = 16; AnimatedToastN2.__closure = object; AnimatedToastN2.__workletHash = 3455640999355; AnimatedToastN2.__initData = env0_13; const value15 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [AnimatedToastN2]); 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 = ( {((Component) => )(value)} ); 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 = ( {((Component) => )(value)} ); r0 = value; } return r0; 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 object3; var r2; var moduleValue2; var withSpring; var moduleValue3; var NT2; var object; const r7 = env0_11 === 'top' ? top + 8 : height - env0_3.get() - YouBarConstantsModule.useYouBarTotalHeight - 8 - env0_13; const interpolate = ReanimatedRexportModule.interpolate; let binding = env0_12; const value12 = Reflect.apply(interpolate, ReanimatedRexportModule, [binding.get(), env1_10, [env0_11 === 'top' ? -30 : height - YouBarConstantsModule.useYouBarTotalHeight - env0_3.get() - env0_13, r7]]); object3 = {}; if (env0_8) { r2 = env0_12.get(); } else { moduleValue2 = require(4577) /* metro dependency 4577: spring */; r2 = moduleValue2.withSpring(env0_12.get(), env1_11); } object3.opacity = r2; if (env0_8) { r2 = value12; } else { moduleValue3 = require(4577) /* metro dependency 4577: spring */; withSpring = moduleValue3.withSpring; binding = env1_12; NT2 = NT; object = {}; object.state = state; object.TransitionStates = (require(4508) /* metro dependency 4508: TransitionGroup */).TransitionStates; object.runOnJS = ReanimatedRexportModule.runOnJS; object.cleanUp = cleanUp; NT2.__closure = object; NT2.__workletHash = 633151838569; NT2.__initData = env1_14; r2 = Reflect.apply(withSpring, moduleValue3, [value12, binding, 'respect-motion-settings', NT2]); } object3.transform = [{translateY: r2}]; object3.maxWidth = width - 32; return object3; 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 _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 = (TransitionGroupModule).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 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 ( ); } 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 = (NativeModule).NonExpandingOverlayView; return ( {a0} ); } 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 = (FluxModule).useStateFromStoresArray([ToastStore], _fun117031); env0_3.useEffect(_fun117032, [value2]); const TransitionGroup = (TransitionGroupModule).TransitionGroup; return ( ); 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 _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 (ToastActionCreators).close(); } function _fun117034() { // fn#117034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15504:4163, offset: 0x016d7e7e, size: 24 bytes, params: 1, frame: 11 return global.clearTimeout(env0_0); } } } } global.__d(_fun117019, 15307, [31, 4502, 15308, 7553, 33, 4501, 6235, 4017, 1478, 13574, 1585, 566, 4559, 4577, 4508, 3869, 15309, 1305, 3857, 2]) /* metro module 15307, dependencies: [31, 4502, 15308, 7553, 33, 4501, 6235, 4017, 1478, 13574, 1585, 566, 4559, 4577, 4508, 3869, 15309, 1305, 3857, 2] */;