386 lines
22 KiB
TypeScript
386 lines
22 KiB
TypeScript
/* Metro module 12761; source: design/components/Menu/native/Menu.tsx; dependencies: [57, 31, 27, 661, 33, 12751, 4501, 697, 4017, 3875, 1585, 1478, 477, 3869, 1244, 4570, 4504, 12755, 12749, 4577, 2] */
|
|
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import UseWindowDimensionsNative from '../../../../modules/screen/useWindowDimensions.native.tsx'; /* Metro dependency 1478 */
|
|
import UseSafeAreaInsetsNative from '../../../../modules/safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */
|
|
import ReanimatedRexport from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import PassthroughTouchView from '../../../void/PassthroughTouchView/native/PassthroughTouchView.tsx'; /* Metro dependency 12749 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
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 PlatformUtilsModule from '../../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
|
|
import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as AccessibilityPreferencesContextModule from '../../../../external/discord_common/js/packages/design/components/AccessibilityPreferencesContext/AccessibilityPreferencesContext.tsx'; /* Metro dependency 3875 */
|
|
import * as ReanimatedRexportModule from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import * as CreateStylesModule from '../../Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
import * as TimingModule from '../../../animation/reanimated/timing/timing.tsx'; /* Metro dependency 4504 */
|
|
import * as SetAccessibilityFocusAndroidModule from '../../../../modules/a11y/native/setAccessibilityFocus.android.tsx'; /* Metro dependency 4570 */
|
|
import * as SpringModule from '../../../animation/reanimated/spring/spring.tsx'; /* Metro dependency 4577 */
|
|
import * as EasingModule from '../../../void/Easing/native/Easing.tsx'; /* Metro dependency 12751 */
|
|
import * as ShadowsModule from '../../../void/Shadows/native/Shadows.tsx'; /* Metro dependency 12755 */
|
|
|
|
function _fun97523(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#97523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:6, offset: 0x02187616, size: 515 bytes, params: 8, frame: 24
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ReactModule;
|
|
const StyleSheet = ReactNativeModule.StyleSheet;
|
|
const NOOP = (ConstantsModule).NOOP;
|
|
const env0_8 = {'mass': 1, 'stiffness': 300, 'damping': 25, 'restSpeedThreshold': 0.01,
|
|
'restDisplacementThreshold': 0.01};
|
|
object = {duration: 250};
|
|
const STANDARD_EASING = (EasingModule).STANDARD_EASING;
|
|
object.easing = STANDARD_EASING;
|
|
const createStyles = CreateStylesModule.createStyles;
|
|
object = {};
|
|
const object2 = {};
|
|
copyDataProperties(object2, StyleSheet.absoluteFillObject, undefined);
|
|
object2['zIndex'] = 1;
|
|
object.backdrop = object2;
|
|
const object3 = {position: 'absolute'};
|
|
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
|
|
object3.backgroundColor = BACKGROUND_SURFACE_HIGH;
|
|
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
object3.width = 220;
|
|
object.menu = object3;
|
|
const env0_10 = Reflect.apply(createStyles, CreateStylesModule, [object]);
|
|
value = value.createContext({menuClose: NOOP, menuDismiss: NOOP});
|
|
object = {code: 'function measureButtonRef_MenuTsx1(ref,setDimensions){const{measure,runOnJS}=this.__closure;const measurements=measure(ref);if(measurements==null)return;runOnJS(setDimensions)(measurements);}'};
|
|
const env0_13 = _fun97524();
|
|
object = {code: 'function MenuTsx2(){const{runOnJS,openMenuCallback}=this.__closure;return runOnJS(openMenuCallback)();}'};
|
|
object = {code: 'function MenuTsx3(){const{runOnJS,closeMenuCallback}=this.__closure;return runOnJS(closeMenuCallback)();}'};
|
|
object = {code: "function MenuTsx4(){const{visible,useReducedMotion,interpolate,dirX,size,offsetAnimated,dirY}=this.__closure;var _offsetAnimated,_offsetAnimated$get,_offsetAnimated2,_offsetAnimated$get2;return{opacity:visible.get(),transform:useReducedMotion?[]:[{translateX:interpolate(visible.get(),[0,1],[(dirX==='left'?-1:1)*size.get().width/4,((_offsetAnimated=offsetAnimated)===null||_offsetAnimated===void 0||(_offsetAnimated=_offsetAnimated.get())===null||_offsetAnimated===void 0?void 0:_offsetAnimated.x)!=null?(_offsetAnimated$get=offsetAnimated.get())===null||_offsetAnimated$get===void 0?void 0:_offsetAnimated$get.x:0])},{translateY:interpolate(visible.get(),[0,1],[(dirY==='top'?-1:1)*size.get().height/4,((_offsetAnimated2=offsetAnimated)===null||_offsetAnimated2===void 0||(_offsetAnimated2=_offsetAnimated2.get())===null||_offsetAnimated2===void 0?void 0:_offsetAnimated2.y)!=null?(_offsetAnimated$get2=offsetAnimated.get())===null||_offsetAnimated$get2===void 0?void 0:_offsetAnimated$get2.y:0])},{scale:visible.get()/2+0.5}]};}"};
|
|
(FileImportTrackerModule).fileFinishedImporting('design/components/Menu/native/Menu.tsx');
|
|
exports.MENU_OFFSET = 10;
|
|
exports.MenuContext = value;
|
|
exports.Menu = Menu;
|
|
function _fun97524() { // fn#97524, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:770, offset: 0x02187819, size: 99 bytes, params: 1, frame: 16
|
|
const measureButtonRef2 = measureButtonRef;
|
|
const object = {};
|
|
object.measure = (require(4017) /* metro dependency 4017: ReanimatedRexport */).measure;
|
|
object.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS;
|
|
measureButtonRef2.__closure = object;
|
|
measureButtonRef2.__workletHash = 15651320687527;
|
|
measureButtonRef2.__initData = env0_12;
|
|
return measureButtonRef2;
|
|
function measureButtonRef(a0, a1) { // fn#97525, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:802, offset: 0x0218787c, size: 82 bytes, params: 3, frame: 14
|
|
let value = environment.__proto__;
|
|
const value2 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).measure(a0);
|
|
if (value2 != null) {
|
|
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
value.runOnJS(a1)(value2);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function Menu({toggleButtonRef, onClose, position, align, offset, offsetAnimated, style, children}) { // fn#97526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:2440, offset: 0x021878ce, size: 878 bytes, params: 2, frame: 32
|
|
if (position !== undefined) {
|
|
}
|
|
if (align !== undefined) {
|
|
}
|
|
const offsetAnimated2 = offsetAnimated;
|
|
const menuClose2 = menuClose;
|
|
const onTouchDown2 = onTouchDown;
|
|
const styles = useStyles();
|
|
const binding = offsetAnimated2;
|
|
const useContext = binding.useContext;
|
|
const AccessibilityPreferencesContext = (AccessibilityPreferencesContextModule).AccessibilityPreferencesContext;
|
|
const enabled = Reflect.apply(useContext, binding, [AccessibilityPreferencesContext]).reducedMotion.enabled;
|
|
const env0_6 = (UseSafeAreaInsetsNative)();
|
|
const env0_7 = (UseWindowDimensionsNative)();
|
|
const env0_8 = binding.useRef(null);
|
|
let [property, env0_10] = offset(binding.useState(null), 2);
|
|
const value4 = (ReanimatedRexportModule).useSharedValue(0);
|
|
const env0_11 = value4;
|
|
const value5 = (ReanimatedRexportModule).useSharedValue({'width': 0,
|
|
'height': 0});
|
|
binding.useLayoutEffect(_fun97531, [toggleButtonRef, property]);
|
|
const env0_13 = onClose ?? NOOP;
|
|
const generateBoxShadowStyle = ShadowsModule.generateBoxShadowStyle;
|
|
const EIGHT_DP_ELEVATION_SHADOW_PARAMS = ShadowsModule.EIGHT_DP_ELEVATION_SHADOW_PARAMS;
|
|
const value6 = Reflect.apply(generateBoxShadowStyle, ShadowsModule, [EIGHT_DP_ELEVATION_SHADOW_PARAMS]);
|
|
const value8 = offset(_fun97532(), 3);
|
|
property = value8[0];
|
|
const property2 = value8[1];
|
|
const property3 = value8[2];
|
|
const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
|
|
const MenuP2 = MenuP;
|
|
object = {visible: value4, useReducedMotion: enabled};
|
|
object.interpolate = ReanimatedRexportModule.interpolate;
|
|
object.dirX = property2;
|
|
object.size = value5;
|
|
object.offsetAnimated = offsetAnimated;
|
|
object.dirY = property3;
|
|
MenuP2.__closure = object;
|
|
MenuP2.__workletHash = 7884133597410;
|
|
MenuP2.__initData = env0_16;
|
|
const value9 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [MenuP2]);
|
|
const items2 = [styles.backdrop];
|
|
const View = (ReanimatedRexport).View;
|
|
const Provider = env0_11.Provider;
|
|
const Children = offsetAnimated2.Children;
|
|
return (
|
|
<PassthroughTouchView
|
|
style={items2}
|
|
accessibilityViewIsModal
|
|
importantForAccessibility="yes"
|
|
onTouchDown={onTouchDown2}
|
|
onAccessibilityEscape={onTouchDown2}
|
|
>
|
|
<View
|
|
accessibilityRole="list"
|
|
style={[styles.menu, value6, property, value9, style]}
|
|
onLayout={onLayout_97534}
|
|
>
|
|
<ScrollView>
|
|
<Provider value={{menuClose: menuClose2, menuDismiss: onTouchDown2}}>
|
|
{Children.map(children, _fun97536)}
|
|
</Provider>
|
|
</ScrollView>
|
|
</View>
|
|
</PassthroughTouchView>
|
|
);
|
|
function openMenuCallback() { // fn#97527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:2811, owner: Menu.openMenuCallback, offset: 0x02187c3c, size: 168 bytes, params: 1, frame: 17
|
|
var AccessibilityAnnouncer;
|
|
var announce;
|
|
var intl;
|
|
const value = environment.__proto__;
|
|
if (PlatformUtilsModule.isAndroid()) {
|
|
AccessibilityAnnouncer = (require(3869) /* metro dependency 3869: AccessibilityAnnouncerAndroid */).AccessibilityAnnouncer;
|
|
announce = AccessibilityAnnouncer.announce;
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
Reflect.apply(announce, AccessibilityAnnouncer,
|
|
[intl.string((require(1244) /* metro dependency 1244: indexNative */).t.ZqK0uI)]);
|
|
}
|
|
(SetAccessibilityFocusAndroidModule).setAccessibilityFocus({ref: env0_8});
|
|
}
|
|
|
|
function menuClose() { // fn#97528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3101, owner: Menu.menuClose, offset: 0x02187ce4, size: 146 bytes, params: 1, frame: 24
|
|
const binding = env0_11;
|
|
const set = binding.set;
|
|
const withTiming = TimingModule.withTiming;
|
|
const binding2 = env1_9;
|
|
const menuCloseT2 = menuCloseT;
|
|
const object = {};
|
|
object.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS;
|
|
object.closeMenuCallback = env0_13;
|
|
menuCloseT2.__closure = object;
|
|
menuCloseT2.__workletHash = 5879184549724;
|
|
menuCloseT2.__initData = env1_15;
|
|
Reflect.apply(set, binding, [Reflect.apply(withTiming, TimingModule, [0, binding2, 'respect-motion-settings',
|
|
menuCloseT2])]);
|
|
function menuCloseT() { // fn#97529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3190, owner: Menu.menuClose.t, offset: 0x02187d76, size: 48 bytes, params: 1, frame: 12
|
|
let value = environment.__proto__.__proto__;
|
|
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
return value.runOnJS(env1_13)();
|
|
}
|
|
|
|
}
|
|
|
|
function menuDismiss() { // fn#97530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3322, owner: Menu.menuDismiss, offset: 0x02187da6, size: 59 bytes, params: 1, frame: 14
|
|
const value = environment.__proto__;
|
|
(SetAccessibilityFocusAndroidModule).setAccessibilityFocus({ref: toggleButtonRef});
|
|
menuClose();
|
|
}
|
|
|
|
function _fun97531() { // fn#97531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3002, offset: 0x02187de1, size: 101 bytes, params: 1, frame: 15
|
|
var value5;
|
|
const toggleButtonRefBinding = toggleButtonRef;
|
|
const value2 = undefined;
|
|
if ((toggleButtonRefBinding == null ? value2 : toggleButtonRef.current) != null && env0_9 == null) {
|
|
value5 = environment.__proto__;
|
|
(require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnUI(env1_13)(toggleButtonRef, env0_10);
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function _fun97532() { // fn#97532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3487, offset: 0x02187e46, size: 489 bytes, params: 1, frame: 11
|
|
var r1;
|
|
var r2;
|
|
var r0;
|
|
var r5;
|
|
var pageX;
|
|
var pageY;
|
|
var value5;
|
|
var value6;
|
|
var value7;
|
|
var value8;
|
|
var value16;
|
|
var value18;
|
|
var value21;
|
|
let positionBinding = position;
|
|
const value2 = 'left';
|
|
const r8 = value2 === positionBinding ? 'column' : position !== 'right' ? 'row' : 'column';
|
|
if (env0_9 == null) {
|
|
r0 = {'x': 0, 'y': 0};
|
|
} else {
|
|
pageX = env0_9.pageX;
|
|
pageY = env0_9.pageY;
|
|
positionBinding = position;
|
|
value5 = 0;
|
|
value6 = pageX + (positionBinding !== 'right' ? value5 : env0_9.width);
|
|
value7 = pageY + (position !== 'bottom' ? value5 : env0_9.height);
|
|
if (align !== 'end') {
|
|
r1 = value7;
|
|
r2 = value6;
|
|
} else {
|
|
value8 = value6 + (r8 !== 'row' ? value5 : env0_9.width);
|
|
r1 = value7 + (r8 !== 'column' ? value5 : env0_9.height);
|
|
r2 = value8;
|
|
}
|
|
r0 = {x: r2, y: r1};
|
|
}
|
|
const height = env0_7.height;
|
|
r2 = value2 === position ? 'right' : r8 !== 'row' || align !== 'end' ? value2 : 'right';
|
|
positionBinding = position;
|
|
const value11 = 'top';
|
|
r1 = value11 === positionBinding ? 'bottom' : r8 !== 'column' || align !== 'end' ? value11 : 'bottom';
|
|
const r10 = value2 === r2 ? r0.x : env0_7.width - r0.x;
|
|
const value14 = value11 === r1;
|
|
const y = r0.y;
|
|
const r9 = value14 ? y : height - y;
|
|
let offsetBinding = offset;
|
|
if (offsetBinding != null) {
|
|
offsetBinding = offset;
|
|
value21 = r10 + offsetBinding.x;
|
|
r0 = r9 + offsetBinding.y;
|
|
r5 = value21;
|
|
} else {
|
|
value16 = 0;
|
|
r5 = r8 !== 'column' ? value16 : 10;
|
|
value18 = r10 + r5;
|
|
r0 = r8 !== 'row' ? value16 : 10;
|
|
r0 = r9 + r0;
|
|
r5 = value18;
|
|
}
|
|
const value23 = height - r0;
|
|
const binding = env0_6;
|
|
return [{[r2]: r5, [r1]: r0, ['maxHeight']: value23 - (value14 ? binding.bottom : binding.top) - 12}, r2, r1];
|
|
}
|
|
|
|
function MenuP() { // fn#97533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:4104, owner: Menu.P, offset: 0x0218802f, size: 510 bytes, params: 1, frame: 28
|
|
var r4;
|
|
var x;
|
|
var r1;
|
|
var r10;
|
|
var y;
|
|
var value2;
|
|
var value3;
|
|
var moduleValue;
|
|
var interpolate;
|
|
var value4;
|
|
var value5;
|
|
var items4;
|
|
var value8;
|
|
var value9;
|
|
var value10;
|
|
var items2;
|
|
var moduleValue2;
|
|
var value11;
|
|
var items3;
|
|
var value14;
|
|
var value15;
|
|
var object;
|
|
const object4 = {};
|
|
let binding = env0_11;
|
|
object4.opacity = binding.get();
|
|
if (enabled) {
|
|
r1 = [];
|
|
} else {
|
|
value2 = environment.__proto__;
|
|
value3 = undefined;
|
|
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
interpolate = moduleValue.interpolate;
|
|
binding = env0_11;
|
|
value4 = binding.get();
|
|
value5 = 1;
|
|
r4 = env0_14 !== 'left' ? value5 : -1;
|
|
binding = env0_12;
|
|
get = binding.get;
|
|
items4 = [r4 * Reflect.apply(get, binding, []).width / 4];
|
|
if (offsetAnimated == null) {
|
|
x = value3;
|
|
} else {
|
|
value8 = offsetAnimated.get();
|
|
x = value8 == null ? value3 : value8.x;
|
|
}
|
|
value9 = 0;
|
|
if (x != null) {
|
|
value10 = offsetAnimated.get();
|
|
r1 = value10 == null ? value3 : value10.x;
|
|
} else {
|
|
r1 = value9;
|
|
}
|
|
items4[1] = r1;
|
|
items2 = [{translateX: Reflect.apply(interpolate, moduleValue, [value4, [0, 1], items4])}];
|
|
moduleValue2 = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
interpolate = moduleValue2.interpolate;
|
|
binding = env0_11;
|
|
value11 = binding.get();
|
|
r10 = env0_15 !== 'top' ? value5 : -1;
|
|
binding = env0_12;
|
|
get = binding.get;
|
|
items3 = [r10 * Reflect.apply(get, binding, []).height / 4];
|
|
if (offsetAnimated == null) {
|
|
y = value3;
|
|
} else {
|
|
value14 = offsetAnimated.get();
|
|
y = value14 == null ? value3 : value14.y;
|
|
}
|
|
if (y != null) {
|
|
value15 = offsetAnimated.get();
|
|
r4 = value15 == null ? value3 : value15.y;
|
|
} else {
|
|
r4 = value9;
|
|
}
|
|
items3[1] = r4;
|
|
items2[1] = {translateY: Reflect.apply(interpolate, moduleValue2, [value11, [0, 1], items3])};
|
|
object = {};
|
|
binding = env0_11;
|
|
object.scale = binding.get() / 2 + 0.5;
|
|
items2[2] = object;
|
|
r1 = items2;
|
|
}
|
|
object4.transform = r1;
|
|
return object4;
|
|
}
|
|
|
|
function MenuOnLayout(a0) { // fn#97534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:4909, owner: Menu.onLayout, offset: 0x0218822d, size: 208 bytes, params: 2, frame: 24
|
|
let binding = env0_12;
|
|
let set = binding.set;
|
|
Reflect.apply(set, binding, [{width: a0.nativeEvent.layout.width, height: a0.nativeEvent.layout.height}]);
|
|
binding = env0_11;
|
|
set = binding.set;
|
|
const withSpring = SpringModule.withSpring;
|
|
const binding2 = env1_8;
|
|
const onLayoutN2 = onLayoutN;
|
|
object = {};
|
|
object.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS;
|
|
object.openMenuCallback = openMenuCallback;
|
|
onLayoutN2.__closure = object;
|
|
onLayoutN2.__workletHash = 14966618105405;
|
|
onLayoutN2.__initData = env1_14;
|
|
Reflect.apply(set, binding, [Reflect.apply(withSpring, SpringModule, [1, binding2, 'respect-motion-settings',
|
|
onLayoutN2])]);
|
|
function onLayoutN() { // fn#97535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:5064, owner: Menu.onLayout.n, offset: 0x021882fd, size: 48 bytes, params: 1, frame: 12
|
|
let value = environment.__proto__.__proto__;
|
|
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
return value.runOnJS(openMenuCallback)();
|
|
}
|
|
|
|
}
|
|
|
|
function _fun97536(a0, a1) { // fn#97536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:5346, offset: 0x0218832d, size: 70 bytes, params: 3, frame: 15
|
|
const value = a0;
|
|
return a1 !== 0 ? value : env1_4.isValidElement(value) ? env1_4.cloneElement(value, {ref: env0_8}) : value;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun97523, 12761, [57, 31, 27, 661, 33, 12751, 4501, 697, 4017, 3875, 1585, 1478, 477, 3869, 1244, 4570,
|
|
4504, 12755, 12749, 4577,
|
|
2]) /* metro module 12761, dependencies: [57, 31, 27, 661, 33, 12751, 4501, 697, 4017, 3875, 1585, 1478, 477, 3869, 1244, 4570, 4504, 12755, 12749, 4577, 2] */;
|