/* Metro module 1308; source: design/void/Button/native/Button.tsx; dependencies: [31, 27, 661, 1309, 33, 4501, 697, 4000, 6235, 477, 11977, 8002, 4002, 6748, 4578, 2] */ 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 ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */ import * as FormConstantsModule from '../../Form/native/FormConstants.tsx'; /* Metro dependency 1309 */ import * as ColorUtilsModule from '../../../../utils/ColorUtils.tsx'; /* Metro dependency 4000 */ import * as SharedModule from '../../../shared.tsx'; /* Metro dependency 4002 */ import * as CreateStylesModule from '../../../components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */ import * as LegacyTokensModule from '../../../migrations/native/LegacyTokens.tsx'; /* Metro dependency 6235 */ import * as RedesignCompatNativeModule from '../../../components/RedesignCompat/native/RedesignCompat.native.tsx'; /* Metro dependency 6748 */ import * as StylesheetUtilsModule from '../../../../utils/StylesheetUtils.tsx'; /* Metro dependency 11977 */ function _fun14423(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#14423, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:6, offset: 0x00e05963, size: 2372 bytes, params: 8, frame: 34 const env0_0 = require; const getButtonStyles2 = getButtonStyles; const ButtonText2 = ButtonText; const getRedesignVariant2 = getRedesignVariant; const getRedesignSize2 = getRedesignSize; const Button_144322 = Button_14432; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ReactNativeModule; const env0_4 = value.ActivityIndicator; const env0_5 = value.Pressable; const env0_6 = value.View; const Fonts = (ConstantsModule).Fonts; value = require(33) /* metro dependency 33 */; const env0_8 = value.jsx; const env0_9 = value.Fragment; const env0_10 = value.jsxs; const createStyles = (CreateStylesModule).createStyles; object = {button: {'flexDirection': 'row', 'flexGrow': 1, 'justifyContent': 'center', 'alignItems': 'center', 'alignSelf': 'stretch', 'borderRadius': 3}, buttonShrink: {'flexGrow': 0, 'alignSelf': 'flex-start', 'paddingHorizontal': 10}}; const BACKGROUND_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BRAND; object.buttonBrandDefault = {backgroundColor: BACKGROUND_BRAND}; let BRAND_600 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.BRAND_600; object.buttonBrandDarkDefault = {backgroundColor: BRAND_600}; let RED_400 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.RED_400; object.buttonRedDefault = {backgroundColor: RED_400}; let RED_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.RED_500; object.buttonRedDarkDefault = {backgroundColor: RED_500}; const CONTROL_CONNECTED_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_CONNECTED_BACKGROUND_DEFAULT; object.buttonGreenDefault = {backgroundColor: CONTROL_CONNECTED_BACKGROUND_DEFAULT}; let GREEN_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.GREEN_500; object.buttonGreenDarkDefault = {backgroundColor: GREEN_500}; let PRIMARY_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_500; object.buttonGreyDarkDefault = {backgroundColor: PRIMARY_500}; PRIMARY_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_500; object.buttonLightgreyDefault = {backgroundColor: PRIMARY_500}; PRIMARY_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_500; object.buttonLightgreyDarkDefault = {backgroundColor: PRIMARY_500}; let hexWithOpacity = ColorUtilsModule.hexWithOpacity; const BRAND_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.BRAND_500; object.buttonBrandDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [BRAND_500, 0.5])}; hexWithOpacity = ColorUtilsModule.hexWithOpacity; BRAND_600 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.BRAND_600; object.buttonBrandDarkDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [BRAND_600, 0.5])}; hexWithOpacity = ColorUtilsModule.hexWithOpacity; RED_400 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.RED_400; object.buttonRedDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [RED_400, 0.5])}; hexWithOpacity = ColorUtilsModule.hexWithOpacity; RED_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.RED_500; object.buttonRedDarkDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [RED_500, 0.5])}; hexWithOpacity = ColorUtilsModule.hexWithOpacity; const GREEN_360 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.GREEN_360; object.buttonGreenDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [GREEN_360, 0.5])}; hexWithOpacity = ColorUtilsModule.hexWithOpacity; GREEN_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.GREEN_500; object.buttonGreenDarkDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [GREEN_500, 0.5])}; hexWithOpacity = ColorUtilsModule.hexWithOpacity; PRIMARY_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_500; object.buttonGreyDarkDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [PRIMARY_500, 0.5])}; hexWithOpacity = ColorUtilsModule.hexWithOpacity; PRIMARY_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_500; object.buttonLightgreyDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [PRIMARY_500, 0.5])}; hexWithOpacity = ColorUtilsModule.hexWithOpacity; PRIMARY_500 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_500; object.buttonLightgreyDarkDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [PRIMARY_500, 0.5])}; object.buttonTransparentDefault = {backgroundColor: 'transparent'}; object.buttonTransparentDarkDefault = {backgroundColor: 'transparent'}; object.buttonTransparentDisabled = {backgroundColor: 'transparent'}; object.buttonTransparentDarkDisabled = {backgroundColor: 'transparent'}; let WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object.buttonWhiteDefault = {backgroundColor: WHITE}; hexWithOpacity = ColorUtilsModule.hexWithOpacity; WHITE = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.WHITE; object.buttonWhiteDisabled = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [WHITE, 0.5])}; object.buttonFilled = {}; object.buttonLink = {}; object.buttonLinkDefault = {}; const BUTTON_OUTLINED_BORDER = (LegacyTokensModule).BUTTON_OUTLINED_BORDER; object.buttonOutlined = {'backgroundColor': 'transparent', 'borderWidth': 1, 'borderStyle': 'solid', borderColor: BUTTON_OUTLINED_BORDER}; object.buttonXsmall = {minHeight: 24}; object.buttonSmall = {minHeight: 32}; object.buttonMedium = {minHeight: 40}; object.buttonLarge = {minHeight: 46}; WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; const PRIMARY_SEMIBOLD = Fonts.PRIMARY_SEMIBOLD; object.text = {color: WHITE, fontFamily: PRIMARY_SEMIBOLD, flexShrink: 1}; object.textXsmall = {fontSize: 12}; object.textSmall = {fontSize: 14}; object.textMedium = {fontSize: 14}; object.textLarge = {fontSize: 20}; object.textDisabled = {opacity: 0.6}; object.textDefault = {opacity: 1}; WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object.textBrand = {color: WHITE}; WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object.textRed = {color: WHITE}; WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object.textGreen = {color: WHITE}; WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object.textGrey = {color: WHITE}; WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object.textLightgrey = {color: WHITE}; WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object.textWhite = {color: WHITE}; object.textFilled = {}; const DARK_PRIMARY_100_LIGHT_PRIMARY_500 = (LegacyTokensModule).DARK_PRIMARY_100_LIGHT_PRIMARY_500; object.textOutlined = {color: DARK_PRIMARY_100_LIGHT_PRIMARY_500}; object.faded = {opacity: 0.5}; WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object.buttonWhiteDarkDefault = {backgroundColor: WHITE}; const TEXT_LINK = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_LINK; object.textLink = {color: TEXT_LINK}; object.buttonPrimaryDefault = {backgroundColor: DARK_PRIMARY_100_LIGHT_PRIMARY_500}; object.buttonPrimaryDarkDefault = {backgroundColor: DARK_PRIMARY_100_LIGHT_PRIMARY_500}; const DARK_PRIMARY_500_LIGHT_PRIMARY_430 = (LegacyTokensModule).DARK_PRIMARY_500_LIGHT_PRIMARY_430; object.buttonGreyDefault = {backgroundColor: DARK_PRIMARY_500_LIGHT_PRIMARY_430}; const DARK_PRIMARY_500_LIGHT_PRIMARY_100 = (LegacyTokensModule).DARK_PRIMARY_500_LIGHT_PRIMARY_100; object.textPrimary = {color: DARK_PRIMARY_500_LIGHT_PRIMARY_100}; object.textTransparent = {color: DARK_PRIMARY_100_LIGHT_PRIMARY_500}; const BUTTON_PRIMARY_DISABLED_BACKGROUND = (LegacyTokensModule).BUTTON_PRIMARY_DISABLED_BACKGROUND; object.buttonPrimaryDisabled = {backgroundColor: BUTTON_PRIMARY_DISABLED_BACKGROUND}; object.buttonPrimaryDarkDisabled = {backgroundColor: BUTTON_PRIMARY_DISABLED_BACKGROUND}; const BUTTON_GREY_DISABLED_BACKGROUND = (LegacyTokensModule).BUTTON_GREY_DISABLED_BACKGROUND; object.buttonGreyDisabled = {backgroundColor: BUTTON_GREY_DISABLED_BACKGROUND}; value = Reflect.apply(createStyles, value, [object]); object = {FILLED: 'filled', LINK: 'link', OUTLINED: 'outlined'}; const object5 = {BRAND: 'brand', RED: 'red', GREEN: 'green', PRIMARY: 'primary', TRANSPARENT: 'transparent', GREY: 'grey', LIGHTGREY: 'lightgrey', WHITE: 'white', LINK: 'link'}; const env0_14 = {DEFAULT: 'Default', DISABLED: 'Disabled'}; const object6 = {XSMALL: 'xsmall', SMALL: 'small', MEDIUM: 'medium', LARGE: 'large'}; Button_144322.Looks = object; Button_144322.Colors = object5; Button_144322.Sizes = object6; (FileImportTrackerModule).fileFinishedImporting('design/void/Button/native/Button.tsx'); exports.default = Button_144322; exports.BUTTON_CORNER_RADIUS = 3; exports.useButtonStyles = value; exports.ButtonLooks = object; exports.ButtonColors = object5; exports.ButtonSizes = object6; exports.getButtonStyles = getButtonStyles2; exports.ButtonText = ButtonText2; exports.getRedesignVariant = getRedesignVariant2; exports.getRedesignSize = getRedesignSize2; function getButtonColorsToTextStyles({textBrand, textRed, textGreen, textPrimary, textTransparent, textGrey, textLightgrey, textWhite, textLink}) { // fn#14424, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:4472, offset: 0x00e062a7, size: 199 bytes, params: 2, frame: 5 const BRAND = env0_13.BRAND; const RED = env0_13.RED; const GREEN = env0_13.GREEN; const PRIMARY = env0_13.PRIMARY; const TRANSPARENT = env0_13.TRANSPARENT; const GREY = env0_13.GREY; const LIGHTGREY = env0_13.LIGHTGREY; const WHITE = env0_13.WHITE; const LINK = env0_13.LINK; return {[BRAND]: textBrand, [RED]: textRed, [GREEN]: textGreen, [PRIMARY]: textPrimary, [TRANSPARENT]: textTransparent, [GREY]: textGrey, [LIGHTGREY]: textLightgrey, [WHITE]: textWhite, [LINK]: textLink}; } function getButtonSizesToTextStyles({textXsmall, textSmall, textMedium, textLarge}) { // fn#14425, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:4734, offset: 0x00e0636e, size: 94 bytes, params: 2, frame: 5 const XSMALL = env0_15.XSMALL; const SMALL = env0_15.SMALL; const MEDIUM = env0_15.MEDIUM; const LARGE = env0_15.LARGE; return {[XSMALL]: textXsmall, [SMALL]: textSmall, [MEDIUM]: textMedium, [LARGE]: textLarge}; } function getButtonLooksToTextStyles({textFilled, textLink, textOutlined}) { // fn#14426, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:4873, offset: 0x00e063cc, size: 73 bytes, params: 2, frame: 5 const FILLED = env0_12.FILLED; const LINK = env0_12.LINK; const OUTLINED = env0_12.OUTLINED; return {[FILLED]: textFilled, [LINK]: textLink, [OUTLINED]: textOutlined}; } function getTextStyles({color, look, size, disabled}, a1) { // fn#14427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:4992, offset: 0x00e06415, size: 125 bytes, params: 3, frame: 17 disabled = !(disabled === undefined) && disabled; const items2 = [a1.text]; items2[1] = getButtonColorsToTextStyles(a1)[color]; items2[2] = getButtonLooksToTextStyles(a1)[look]; items2[3] = disabled ? a1.textDisabled : a1.textDefault; items2[4] = getButtonSizesToTextStyles(a1)[size]; return items2; } function getButtonStyles({color, size, look, disabled, shrink, pressed, darkenOnPress, style}, a1) { // fn#14428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:5202, offset: 0x00e06492, size: 366 bytes, params: 3, frame: 28 var r15; var faded; var moduleValue; var moduleValue5; disabled = !(disabled === undefined) && disabled; shrink = !(shrink === undefined) && shrink; pressed = !(pressed === undefined) && pressed; darkenOnPress = !(darkenOnPress === undefined) && darkenOnPress; const binding = env0_14; const r16 = disabled ? binding.DISABLED : binding.DEFAULT; if (pressed) { moduleValue = require(477) /* metro dependency 477: PlatformUtils */; r15 = moduleValue.isAndroid() ? color : '' + color + 'Dark'; } else { r15 = color; } const items2 = [a1.button]; items2[1] = shrink ? a1.buttonShrink : null; let getClass = StylesheetUtilsModule.getClass; items2[2] = Reflect.apply(getClass, StylesheetUtilsModule, [a1, 'button', r15, r16]); getClass = StylesheetUtilsModule.getClass; items2[3] = Reflect.apply(getClass, StylesheetUtilsModule, [a1, 'button', size]); getClass = StylesheetUtilsModule.getClass; items2[4] = Reflect.apply(getClass, StylesheetUtilsModule, [a1, 'button', look]); if (darkenOnPress) { faded = undefined; } else { moduleValue5 = require(477) /* metro dependency 477: PlatformUtils */; faded = moduleValue5.isAndroid() ? undefined : pressed ? a1.faded : undefined; } items2[5] = faded; items2[6] = style; return items2; } function ButtonText({children, color, look, size, disabled, style}) { // fn#14429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:5569, offset: 0x00e06600, size: 227 bytes, params: 2, frame: 25 var r0; var jsxRuntimeEnv0_9Binding; var LegacyText; var value; const styles = useStyles(); if (typeof children !== 'function') { LegacyText = importDefault(8002) /* metro dependency 8002: LegacyText */; value = getTextStyles({color: color, look: look, size: size, disabled: disabled}, styles); value = ( {children} ); r0 = value; } else { jsxRuntimeEnv0_9Binding = jsxRuntimeEnv0_9; value = getTextStyles({color: color, look: look, size: size, disabled: disabled}, styles); value = ( <> {children({style: [value, style]})} ); r0 = value; } return r0; } function getRedesignVariant(a0) { // fn#14430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:5891, offset: 0x00e066e3, size: 124 bytes, params: 2, frame: 3 const GREEN = env0_13.GREEN; if (GREEN === a0) { return 'active'; } const RED = env0_13.RED; if (RED === a0) { return 'destructive'; } const GREY = env0_13.GREY; if (GREY === a0) { return 'secondary'; } const LIGHTGREY = env0_13.LIGHTGREY; if (LIGHTGREY === a0) { return 'secondary'; } const TRANSPARENT = env0_13.TRANSPARENT; if (TRANSPARENT === a0) { return 'secondary'; } const WHITE = env0_13.WHITE; if (WHITE === a0) { return 'primary-overlay'; } return 'primary'; } function getRedesignSize(a0) { // fn#14431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:6119, offset: 0x00e0675f, size: 84 bytes, params: 2, frame: 3 const LARGE = env0_15.LARGE; if (LARGE === a0) { return 'lg'; } const MEDIUM = env0_15.MEDIUM; if (MEDIUM === a0) { return 'md'; } const SMALL = env0_15.SMALL; if (SMALL === a0) { return 'sm'; } const XSMALL = env0_15.XSMALL; if (XSMALL === a0) { return 'sm'; } } function Button_14432({look = env0_12.FILLED, color = env0_13.BRAND, size = env0_15.MEDIUM, text, shrink, disabled, loading, loadingColorDark = importDefault(dependencyMap[6]).unsafe_rawColors.WHITE, loadingColorLight = importDefault(dependencyMap[6]).unsafe_rawColors.PRIMARY_500, textStyle, style, accessibilityRole, accessibilityLabel, accessibilityHint, accessibilityState, accessibilityActions, onAccessibilityAction, accessibilityValue, darkenOnPress, renderIcon, renderRightIcon, renderShine, renderLinearGradient, testID, onPress, onPressIn, onPressOut, onTouchStart, onTouchEnd, onLongPress, foregroundRipple, cornerRadius}) { // fn#14432, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1435:6245, offset: 0x00e067b3, size: 1182 bytes, params: 2, frame: 52 var r3; var r26; var r27; var r7; var r13; var r0; var value16; var items2; var Button; var value21; let value = undefined; const text2 = text; shrink = !(shrink === value) && shrink; disabled = !(disabled === value) && disabled; loading = !(loading === value) && loading; accessibilityRole = accessibilityRole === value ? 'button' : accessibilityRole; const styles = useStyles(); const useThemeContext = SharedModule.useThemeContext; const theme = Reflect.apply(useThemeContext, SharedModule, []).theme; let binding = text2; const useMemo = binding.useMemo; let object = [color, disabled, loading, look, size, text, textStyle, loadingColorDark, loadingColorLight, theme]; const value12 = Reflect.apply(useMemo, binding, [_fun14433, object]); const value13 = text2.useMemo(function() { var r2; var object = {}; copyDataProperties(object, accessibilityState, r2); object['disabled'] = disabled; return object; }, [disabled, accessibilityState]); const value14 = text2.useCallback(_fun14435, [color, darkenOnPress, size, look, disabled, shrink, style, styles]); const value15 = text2.useMemo(function() { return getThemedRippleConfig({foreground: foregroundRipple, cornerRadius: cornerRadius ?? 3}); }, [foregroundRipple, cornerRadius]); binding = text2; const useContext = binding.useContext; const RedesignCompatContext = (RedesignCompatNativeModule).RedesignCompatContext; if (Reflect.apply(useContext, binding, [RedesignCompatContext])) { if (look !== env0_12.LINK) { object = {style: style}; Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button; var buttonProps = {text: text, variant: getRedesignVariant(color), size: getRedesignSize(size), accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, accessibilityActions: accessibilityActions, onAccessibilityAction: onAccessibilityAction, onPress: onPress, onPressIn: onPressIn, onPressOut: onPressOut, onTouchStart: onTouchStart, disabled: disabled || loading}; value21 = null; r13 = value21 == renderIcon ? value : renderIcon(); r13 = value21 == r13 ? value21 == renderRightIcon ? value : renderRightIcon() : r13; buttonProps.icon = value21 != r13 ? r13 : value21; buttonProps.iconPosition = value21 != renderIcon ? 'start' : value21 != renderRightIcon ? 'end' : value; buttonProps.grow = !shrink; value = (