/* Metro module 15316; source: modules/launchpad/native/useLaunchPadGesture.tsx; dependencies: [31, 11324, 4007, 1585, 5321, 477, 14283, 11282, 4017, 4081, 2] */ import UseSafeAreaInsetsNative from '../../safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */ import UpdateSharedValueIfChangedNative from '../../reanimated/utils/updateSharedValueIfChanged.native.tsx'; /* Metro dependency 11282 */ 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 PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */ import * as NavigationRouteUtilsNativeModule from '../../main_tabs_v2/helpers/NavigationRouteUtils.native.tsx'; /* Metro dependency 4007 */ import * as HapticUtilsNativeModule from '../../haptics/HapticUtils.native.tsx'; /* Metro dependency 4081 */ import * as Module05321Module from '../../../by-id/module-05321.js'; /* Metro dependency 5321 */ import * as LaunchPadConstantsModule from './LaunchPadConstants.tsx'; /* Metro dependency 11324 */ import * as UseWindowDimensionsSharedValueNativeModule from '../../screen/useWindowDimensionsSharedValue.native.tsx'; /* Metro dependency 14283 */ function _fun117082(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#117082, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15513:6, offset: 0x024a2c40, size: 309 bytes, params: 8, frame: 18 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); object = {code: 'function useLaunchPadGestureTsx1(){const{updateSharedValueIfChanged,gestureState,updaters}=this.__closure;updateSharedValueIfChanged(gestureState,{active:false,initialLaunchPadPosition:0,initialPullTabPosition:0,initialTouchX:0,initialTouchY:0,positionOffsetX:0,positionOffsetY:0,startTime:-1});updaters.setLaunchPadPullTabScale(1.0);}'}; object = {code: 'function useLaunchPadGestureTsx2(){const{gestureState,updaters,updateSharedValueIfChanged}=this.__closure;const{initialLaunchPadPosition:initialLaunchPadPosition,active:active}=gestureState.get();if(active){if(initialLaunchPadPosition===1){updaters.setLaunchPadPosition(1);}else{updaters.setLaunchPadPosition(0);}}updateSharedValueIfChanged(gestureState,{active:false,initialLaunchPadPosition:0,initialPullTabPosition:0,initialTouchX:0,initialTouchY:0,positionOffsetX:0,positionOffsetY:0,startTime:-1});}'}; object = {code: 'function useLaunchPadGestureTsx3({velocityX:velocityX,velocityY:velocityY,translationX:translationX,translationY:translationY}){const{gestureState,launchPadType,LaunchPadTypes,LAUNCH_PAD_END_TRANSLATION_THRESHOLD,LAUNCH_PAD_END_VELOCITY_THRESHOLD,updaters,launchPadSharedState}=this.__closure;const{requiresPop:requiresPop,startShown:startShown}=gestureState.get();if(requiresPop){if(!startShown){const isPullTabTapComplete=launchPadType===LaunchPadTypes.PULL_TAB&&Math.abs(translationX)<=LAUNCH_PAD_END_TRANSLATION_THRESHOLD&&Math.abs(translationY)<=LAUNCH_PAD_END_TRANSLATION_THRESHOLD&&Math.abs(velocityX)<=LAUNCH_PAD_END_VELOCITY_THRESHOLD&&Math.abs(velocityY)<=LAUNCH_PAD_END_VELOCITY_THRESHOLD;if(isPullTabTapComplete){updaters.setLaunchPadPosition(1);}else{updaters.setLaunchPadPosition(0);}}else{updaters.setLaunchPadPosition(1);}}else if(Math.abs(velocityX)=0.5){updaters.setLaunchPadPosition(1);}else{updaters.setLaunchPadPosition(0);}}else if(velocityX>0){updaters.setLaunchPadPosition(0);}else{updaters.setLaunchPadPosition(1);}}'}; object = {code: 'function useLaunchPadGestureTsx4({translationX:translationX,translationY:translationY,absoluteX:absoluteX}){const{gestureState,getWindowDimensionsWorklet,POP_RESISTANCE,launchPadType,LaunchPadTypes,PIP_POP_DISTANCE,updaters,updateSharedValueIfChanged,runOnJS,triggerHapticFeedback,HapticFeedbackTypes}=this.__closure;if(!gestureState.get().active)return;const{initialTouchX:initialTouchX,requiresPop:requiresPop}=gestureState.get();const{width:windowWidth}=getWindowDimensionsWorklet();const newXOffset=absoluteX-initialTouchX;const distance=Math.max(newXOffset*-1,0);const resistance=distance*POP_RESISTANCE;const positionOffsetX=absoluteX-gestureState.get().initialTouchX;const launchPadPosition=1-(gestureState.get().initialTouchX+translationX-(launchPadType!==LaunchPadTypes.PULL_TAB?40:0))/windowWidth;if(requiresPop&&distance<=PIP_POP_DISTANCE){if(launchPadType!==LaunchPadTypes.PULL_TAB){const a=(distance-resistance)/windowWidth;updaters.setLaunchPadPosition(a);}else{updaters.setLaunchPadPullTabTranslation(translationY);}updateSharedValueIfChanged(gestureState,{positionOffsetX:positionOffsetX});}else{if(requiresPop){updateSharedValueIfChanged(gestureState,{requiresPop:false,positionOffsetX:positionOffsetX});runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.IMPACT_MEDIUM);}else{updateSharedValueIfChanged(gestureState,{positionOffsetX:positionOffsetX});}updaters.setLaunchPadPosition(launchPadPosition);}}'}; object = {code: 'function useLaunchPadGestureTsx5(event,manager){const{gestureState,State,getWindowDimensionsWorklet,launchPadType,LaunchPadTypes,LAUNCH_PAD_EDGE_GESTURE_AFFORDANCE,LAUNCH_PAD_PULL_TAB_WIDTH,LAUNCH_PAD_PULL_TAB_HIT_SLOP,launchPadPullTabState,LAUNCH_PAD_PULL_TAB_HEIGHT,updaters,LAUNCH_PAD_PULL_TAB_SCALE_FACTOR,launchPadSharedState,MANUAL_ACTIVATION_THRESHOLD}=this.__closure;const{active:active,initialLaunchPadPosition:initialLaunchPadPosition,initialTouchX:initialTouchX,initialTouchY:initialTouchY}=gestureState.get();if(event.state!==State.BEGAN||active)return;const currentTouch=event.changedTouches[0];const{x:x,y:y}=currentTouch;const{width:windowWidth}=getWindowDimensionsWorklet();if(currentTouch==null||launchPadType===LaunchPadTypes.GESTURE_EDGE&&initialLaunchPadPosition===0&&initialTouchXwindowWidth-LAUNCH_PAD_PULL_TAB_WIDTH-LAUNCH_PAD_PULL_TAB_HIT_SLOP&&xlaunchPadPullTabState.get().position-LAUNCH_PAD_PULL_TAB_HIT_SLOP&&y0){const horizontalDistance=x-initialTouchX;const verticalDistance=Math.abs(y-initialTouchY);const hasMovedCorrectDirection=launchPadSharedState.get()>0&&horizontalDistance>0||launchPadSharedState.get()<=0&&horizontalDistance<0;if(hasMovedCorrectDirection&&Math.abs(horizontalDistance)>verticalDistance){if(Math.abs(horizontalDistance) position - LAUNCH_PAD_PULL_TAB_HIT_SLOP; reducibleJoin11: while (true) { if (value4) { launchPadPullTabStateBinding = launchPadPullTabState; get = launchPadPullTabStateBinding.get; position = Reflect.apply(get, launchPadPullTabStateBinding, []).position; value5 = position + LAUNCH_PAD_PULL_TAB_HEIGHT; value6 = y < value5 + LAUNCH_PAD_PULL_TAB_HIT_SLOP; r9 = value6; break reducibleJoin11; } r9 = value4; break reducibleJoin11; } value7 = width - LAUNCH_PAD_PULL_TAB_WIDTH; if (x > value7 - LAUNCH_PAD_PULL_TAB_HIT_SLOP) { if (x < width) { if (r9) { gestureStateBinding = gestureState; set = gestureStateBinding.set; object = {}; get = gestureStateBinding.get; copyDataProperties(object, Reflect.apply(get, gestureStateBinding, []), value7); launchPadPullTabStateBinding = launchPadPullTabState; get = launchPadPullTabStateBinding.get; object['initialPullTabPosition'] = Reflect.apply(get, launchPadPullTabStateBinding, []).position; object['active'] = true; Reflect.apply(set, gestureStateBinding, [object]); updatersBinding = updaters; updatersBinding.setLaunchPadPullTabScale(LAUNCH_PAD_PULL_TAB_SCALE_FACTOR); updatersBinding.setLaunchPadShown(true); a1.activate(); return undefined; } r13 = value7; break reducibleJoin14; } r13 = value7; break reducibleJoin14; } r13 = value7; break reducibleJoin14; } } launchPadTypeBinding = launchPadType; PULL_TAB = LaunchPadTypes.PULL_TAB; if (launchPadTypeBinding === PULL_TAB) { launchPadTypeBinding = launchPadType; PULL_TAB = LaunchPadTypes.PULL_TAB; reducibleJoin17: while (true) { reducibleJoin28: while (true) { if (launchPadTypeBinding !== PULL_TAB) { a1.fail(); break reducibleJoin28; } if (initialLaunchPadPosition > 0) { break reducibleJoin17; } fail = a1.fail; Reflect.apply(fail, a1, []); break reducibleJoin28; } return undefined; } } value8 = x - initialTouchX; Math = global.Math; abs = Math.abs; value9 = Reflect.apply(abs, Math, [y - initialTouchY]); launchPadSharedStateBinding = launchPadSharedState; get = launchPadSharedStateBinding.get; if (Reflect.apply(get, launchPadSharedStateBinding, []) > 0) { reducibleJoin19: while (true) { if (value8 > 0) { Math = global.Math; abs = Math.abs; if (Reflect.apply(abs, Math, [value8]) > value9) { Math = global.Math; if (Math.abs(value8) < 3) { return undefined; } gestureStateBinding = gestureState; set = gestureStateBinding.set; object = {}; copyDataProperties(object, gestureStateBinding.get(), r13); object['active'] = true; Reflect.apply(set, gestureStateBinding, [object]); updatersBinding = updaters; updatersBinding.setLaunchPadShown(true); a1.activate(); return undefined; } fail = a1.fail; Reflect.apply(fail, a1, []); break reducibleJoin28; } break reducibleJoin19; } } launchPadSharedStateBinding = launchPadSharedState; get = launchPadSharedStateBinding.get; if (Reflect.apply(get, launchPadSharedStateBinding, []) <= 0) { reducibleJoin22: while (true) { if (value8 < 0) { Math = global.Math; abs = Math.abs; if (Reflect.apply(abs, Math, [value8]) > value9) { Math = global.Math; if (Math.abs(value8) < 3) { return undefined; } gestureStateBinding = gestureState; set = gestureStateBinding.set; object = {}; copyDataProperties(object, gestureStateBinding.get(), r13); object['active'] = true; Reflect.apply(set, gestureStateBinding, [object]); updatersBinding = updaters; updatersBinding.setLaunchPadShown(true); a1.activate(); return undefined; } break reducibleJoin22; } break reducibleJoin22; } } fail = a1.fail; Reflect.apply(fail, a1, []); break reducibleJoin28; } } fail = a1.fail; Reflect.apply(fail, a1, []); break reducibleJoin28; } } } function I_117087({translationX, translationY, absoluteX}) { // fn#117087, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15513:8579, offset: 0x024a3571, size: 498 bytes, params: 2, frame: 23 var value2; var initialTouchX; var requiresPop; var value3; var moduleValue; var width; var Math; var value4; var value5; var value6; var value9; var defaultImport; const triggerHapticFeedback = (HapticUtilsNativeModule).triggerHapticFeedback; const HapticFeedbackTypes = (HapticUtilsNativeModule).HapticFeedbackTypes; let get = gestureState.get; if (Reflect.apply(get, gestureStateBinding, []).active) { gestureStateBinding = gestureState; value2 = gestureStateBinding.get(); initialTouchX = value2.initialTouchX; requiresPop = value2.requiresPop; value3 = environment.__proto__.__proto__; moduleValue = require(14283) /* metro dependency 14283: useWindowDimensionsSharedValueNative */; width = moduleValue.getWindowDimensionsWorklet().width; Math = global.Math; value4 = 0; value5 = Math.max(-1 * (absoluteX - initialTouchX), value4); get = gestureStateBinding.get; initialTouchX = Reflect.apply(get, gestureStateBinding, []).initialTouchX; value6 = absoluteX - initialTouchX; get = gestureStateBinding.get; initialTouchX = Reflect.apply(get, gestureStateBinding, []).initialTouchX; value9 = (initialTouchX + translationX - (launchPadType === LaunchPadTypes.PULL_TAB ? value4 : 40)) / width; if (requiresPop) { if (value5 <= 70) { if (launchPadType !== LaunchPadTypes.PULL_TAB) { updaters.setLaunchPadPosition((value5 - 0.5 * value5) / width); } else { updaters.setLaunchPadPullTabTranslation(translationY); } (importDefault(11282) /* metro dependency 11282: updateSharedValueIfChangedNative */)(gestureState, {positionOffsetX: value6}); } else { defaultImport = importDefault(11282) /* metro dependency 11282: updateSharedValueIfChangedNative */; gestureStateBinding = gestureState; if (requiresPop) { defaultImport(gestureStateBinding, {requiresPop: false, positionOffsetX: value6}); (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.IMPACT_MEDIUM); } else { defaultImport(gestureStateBinding, {positionOffsetX: value6}); } updaters.setLaunchPadPosition(1 - value9); } } else { defaultImport = importDefault(11282) /* metro dependency 11282: updateSharedValueIfChangedNative */; gestureStateBinding = gestureState; if (requiresPop) { defaultImport(gestureStateBinding, {requiresPop: false, positionOffsetX: value6}); (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS(triggerHapticFeedback)(HapticFeedbackTypes.IMPACT_MEDIUM); } else { defaultImport(gestureStateBinding, {positionOffsetX: value6}); } updaters.setLaunchPadPosition(1 - value9); } } } function v_117088({velocityX, velocityY, translationX, translationY}) { // fn#117088, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15513:9567, offset: 0x024a3763, size: 382 bytes, params: 2, frame: 18 var value3; var value4; var launchPadTypeBinding; var value6; const value2 = gestureState.get(); if (value2.requiresPop) { if (value2.startShown) { updaters.setLaunchPadPosition(1); } else { launchPadTypeBinding = launchPadType; value6 = environment.__proto__.__proto__; if (launchPadTypeBinding !== LaunchPadTypes.PULL_TAB) { updaters.setLaunchPadPosition(0); } else if (global.Math.abs(translationX) <= LAUNCH_PAD_END_TRANSLATION_THRESHOLD) { if (global.Math.abs(translationY) <= LAUNCH_PAD_END_TRANSLATION_THRESHOLD) { if (global.Math.abs(velocityX) <= LAUNCH_PAD_END_VELOCITY_THRESHOLD) { if (global.Math.abs(velocityY) <= LAUNCH_PAD_END_VELOCITY_THRESHOLD) { updaters.setLaunchPadPosition(1); } else { updaters.setLaunchPadPosition(0); } } else { updaters.setLaunchPadPosition(0); } } else { updaters.setLaunchPadPosition(0); } } else { updaters.setLaunchPadPosition(0); } } } else { value3 = global.Math.abs(velocityX); value4 = environment.__proto__.__proto__; if (value3 < LAUNCH_PAD_END_VELOCITY_THRESHOLD) { if (launchPadSharedState.get() >= 0.5) { updaters.setLaunchPadPosition(1); } else { updaters.setLaunchPadPosition(0); } } else if (velocityX > 0) { updaters.setLaunchPadPosition(0); } else { updaters.setLaunchPadPosition(1); } } } function t_117090() { // fn#117090, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15513:10611, offset: 0x024a395c, size: 72 bytes, params: 1, frame: 14 const value = environment.__proto__.__proto__; (UpdateSharedValueIfChangedNative)(gestureState, {'active': false, 'initialLaunchPadPosition': 0, 'initialPullTabPosition': 0, 'initialTouchX': 0, 'initialTouchY': 0, 'positionOffsetX': 0, 'positionOffsetY': 0, 'startTime': -1}); updaters.setLaunchPadPullTabScale(1); } } } } global.__d(_fun117082, 15316, [31, 11324, 4007, 1585, 5321, 477, 14283, 11282, 4017, 4081, 2]) /* metro module 15316, dependencies: [31, 11324, 4007, 1585, 5321, 477, 14283, 11282, 4017, 4081, 2] */;