Files
2026-07-28 01:06:53 +03:00

228 lines
15 KiB
TypeScript

/* Metro module 6239; source: design/components/Card/native/Card.native.tsx; dependencies: [29, 31, 27, 33, 4017, 697, 6234, 4501, 1357, 3860, 477, 4577, 4581, 6240, 2] */
import ObjectWithoutProperties from '../../../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */
import Native from '../../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import MobileVisualRefreshExperiment from '../../../../modules/themes/experiments/MobileVisualRefreshExperiment.tsx'; /* Metro dependency 1357 */
import ReanimatedRexport from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
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 UseTokenModule from '../../../tokens/native/useToken.tsx'; /* Metro dependency 3860 */
import * as ReanimatedRexportModule from '../../../../modules/reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import * as CreateStylesModule from '../../Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as SpringPresetsModule from '../../../animation/reanimated/spring/springPresets.tsx'; /* Metro dependency 4581 */
import * as CardTokensNativeModule from './CardTokens.native.tsx'; /* Metro dependency 6234 */
import * as AnimatedPressableHighlightNativeModule from '../../experimental/Pressables/native/AnimatedPressableHighlight.native.tsx'; /* Metro dependency 6240 */
function _fun49318(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#49318, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:6, offset: 0x011f570d, size: 324 bytes, params: 8, frame: 20
const env0_0 = require;
const Card_493202 = Card_49320;
const env0_3 = ['accessibilityRole'];
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Pressable = ReactNativeModule.Pressable;
const env0_8 = (ReanimatedRexport).createAnimatedComponent(Pressable);
const env0_9 = (CreateStylesModule).createStyleProperties(_fun49328);
const env0_10 = (CreateStylesModule).createStyles(_fun49329);
object = {code: "function CardNativeTsx1(){const{withSpring,interpolateColor,pressed,backgroundColor,backgroundColorPressed,ON_PRESS_SPRING}=this.__closure;const pressedColor=withSpring(interpolateColor(pressed.get(),[0,1],[backgroundColor,backgroundColorPressed]),ON_PRESS_SPRING,'animate-always');return{backgroundColor:pressedColor};}"};
(FileImportTrackerModule).fileFinishedImporting('design/components/Card/native/Card.native.tsx');
exports.Card = Card_493202;
exports.InternalCard = Card_493202;
function getCardBackgroundToken(a0) { // fn#49319, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:228, offset: 0x011f5851, size: 291 bytes, params: 2, frame: 11
if (a0 === 'primary') {
return (require(6234) /* metro dependency 6234: CardTokensNative */).CARD_PRIMARY_BG;
}
if (a0 === 'secondary') {
return (importDefault(697) /* metro dependency 697: native */).colors.CARD_SECONDARY_BACKGROUND_DEFAULT;
}
if (a0 === 'muted') {
return (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_MUTED;
}
if (a0 === 'transparent') {
return (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.TRANSPARENT;
}
if (a0 === 'control-secondary') {
return (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_SECONDARY_BACKGROUND_DEFAULT;
}
if (a0 === 'surface-high') {
return (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
}
}
function Card_49320(a0) { // fn#49320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:1923, offset: 0x011f5974, size: 449 bytes, params: 2, frame: 28
var accessibilityRole;
let start = a0.start;
start = start === undefined || start;
let end = a0.end;
end = end === undefined || end;
let shadow = a0.shadow;
shadow = shadow === undefined ? 'none' : shadow;
let border = a0.border;
border = border === undefined ? 'faint' : border;
let variant = a0.variant;
variant = variant === undefined ? 'primary' : variant;
let object = {'start': 0, 'end': 0, 'shadow': 0, 'border': 0, 'variant': 0};
silentSetPrototypeOf(object, null, undefined);
let value = copyDataProperties({}, a0, object, undefined);
const value3 = (MobileVisualRefreshExperiment)('Card');
const useToken = UseTokenModule.useToken;
const CARD_DEFAULT_RADIUS = (Native).modules.mobile.CARD_DEFAULT_RADIUS;
const r2 = value.radius ?? Reflect.apply(useToken, UseTokenModule, [CARD_DEFAULT_RADIUS]);
const styles = useStyles(start, end, variant, shadow, border, r2);
object = [styles.spacing];
object[1] = styles.card;
object[2] = value.style;
if ('onPress' in value) {
if (value.onPress != null) {
accessibilityRole = value.accessibilityRole;
value = ObjectWithoutProperties(value, env0_3);
return (
<PressableCard
accessibilityRole={accessibilityRole ?? 'button'}
{...value}
{...{['start']: start}}
{...{['end']: end}}
{...{['style']: object}}
{...{['variant']: variant}}
{...{['isRefreshEnabled']: value3}}
{...{['radius']: r2}}
/>
);
}
}
return <View {...value} {...{['style']: object}} />;
}
function PressableCard(a0) { // fn#49321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:2401, offset: 0x011f5b35, size: 67 bytes, params: 2, frame: 13
return PlatformUtilsModule.isAndroid() ? PressableCardAndroid(a0) : PressableCardiOS(a0);
function PressableCardAndroid(a0) { // fn#49322, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:2455, owner: PressableCard.PressableCardAndroid, offset: 0x011f5b78, size: 184 bytes, params: 2, frame: 20
const children = a0.children;
const start = a0.start;
const end = a0.end;
const radius = a0.radius;
a0.isRefreshEnabled;
const object = {'children': 0, 'start': 0, 'end': 0, 'radius': 0, 'isRefreshEnabled': 0};
silentSetPrototypeOf(object, null, undefined);
const value = copyDataProperties({}, a0, object, start);
const value3 = env1_5.useMemo(function() {
return {cornerRadius: start || end ? radius : 0};
}, [start, end, radius]);
const AnimatedPressableHighlight = (AnimatedPressableHighlightNativeModule).AnimatedPressableHighlight;
return (
<AnimatedPressableHighlight androidRippleConfig={value3} {...value}>
{children}
</AnimatedPressableHighlight>
);
}
function PressableCardiOS(a0) { // fn#49324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:2693, owner: PressableCard.PressableCardiOS, offset: 0x011f5c50, size: 457 bytes, params: 2, frame: 28
const children = a0.children;
const style = a0.style;
const variant = a0.variant;
const onPressIn = a0.onPressIn;
const onPressOut = a0.onPressOut;
const isRefreshEnabled = a0.isRefreshEnabled;
a0.radius;
a0.start;
a0.end;
const object = {'children': 0, 'style': 0, 'variant': 0, 'onPressIn': 0, 'onPressOut': 0, 'isRefreshEnabled': 0,
'radius': 0, 'start': 0, 'end': 0};
silentSetPrototypeOf(object, null, undefined);
const value = copyDataProperties({}, a0, object, undefined);
const value3 = (ReanimatedRexportModule).useSharedValue(0);
const value4 = env1_5.useCallback(_fun49325, [value3, onPressIn]);
const value5 = env1_5.useCallback(_fun49326, [value3, onPressOut]);
const {backgroundColor, backgroundColorPressed} = env1_9(variant, isRefreshEnabled);
const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
const PressableCardiOSB2 = PressableCardiOSB;
const object2 = {};
object2.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
object2.interpolateColor = ReanimatedRexportModule.interpolateColor;
object2.pressed = value3;
object2.backgroundColor = backgroundColor;
object2.backgroundColorPressed = backgroundColorPressed;
const ON_PRESS_SPRING = (SpringPresetsModule).ON_PRESS_SPRING;
object2.ON_PRESS_SPRING = ON_PRESS_SPRING;
PressableCardiOSB2.__closure = object2;
PressableCardiOSB2.__workletHash = 14943431549291;
PressableCardiOSB2.__initData = env1_11;
return ((Component) => <Component {...value} {...{['onPressIn']: value4}} {...{['onPressOut']: value5}} {...{['style']: [style,
Reflect.apply(useAnimatedStyle, ReanimatedRexportModule,
[PressableCardiOSB2])]}} {...{['unstable_pressDelay']: 130}}>{children}</Component>)(env1_8);
function _fun49325(a0) { // fn#49325, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:2872, offset: 0x011f5e19, size: 48 bytes, params: 2, frame: 12
env0_2.set(1);
if (onPressIn != null) {
onPressIn(a0);
}
}
function _fun49326(a0) { // fn#49326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:2925, offset: 0x011f5e49, size: 47 bytes, params: 2, frame: 12
env0_2.set(0);
if (onPressOut != null) {
onPressOut(a0);
}
}
function PressableCardiOSB() { // fn#49327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:3047, owner: PressableCard.PressableCardiOS.B, offset: 0x011f5e78, size: 140 bytes, params: 1, frame: 22
let value = environment.__proto__.__proto__;
value = require(4577) /* metro dependency 4577: spring */;
const withSpring = value.withSpring;
const value4 = ReanimatedRexportModule.interpolateColor(env0_2.get(), [0, 1], [backgroundColor,
backgroundColorPressed]);
const ON_PRESS_SPRING = (SpringPresetsModule).ON_PRESS_SPRING;
return {backgroundColor: Reflect.apply(withSpring, value, [value4, ON_PRESS_SPRING, 'animate-always'])};
}
}
}
function _fun49328(a0) { // fn#49328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:693, offset: 0x011f5f04, size: 327 bytes, params: 2, frame: 16
var r1;
let value = a1;
const value2 = undefined;
let r3 = value !== value2 ? value : false;
const cardBackgroundToken = getCardBackgroundToken(a0);
r3 = !(r3 === value2) && r3;
if (a0 === 'primary') {
r1 = (require(6234) /* metro dependency 6234: CardTokensNative */).CARD_PRIMARY_PRESSED_BG;
} else if (a0 === 'secondary') {
r1 = (importDefault(697) /* metro dependency 697: native */).colors.CARD_SECONDARY_BACKGROUND_ACTIVE;
} else if (a0 === 'muted') {
r1 = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_SUBTLE;
} else if (a0 === 'transparent') {
value = importDefault(697) /* metro dependency 697: native */;
r3 = r3 ? value.colors.BACKGROUND_MOD_SUBTLE : value.unsafe_rawColors.TRANSPARENT;
r1 = r3;
} else {
r1 = a0 === 'control-secondary' ? (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_SECONDARY_BACKGROUND_ACTIVE : a0 !== 'surface-high' ? value2 : (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
}
return {backgroundColor: cardBackgroundToken, backgroundColorPressed: r1};
}
function _fun49329(a0, a1, a2, a3, a4, a5) { // fn#49329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6417:1304, offset: 0x011f604b, size: 402 bytes, params: 7, frame: 22
const value = a5;
const getCardBackgroundTokenBinding = getCardBackgroundToken;
const value3 = undefined;
const cardBackgroundTokenBinding = getCardBackgroundTokenBinding(a2);
const value5 = null;
const r0 = a4 === 'none' ? value5 : a4 === 'subtle' ? (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE : a4 === 'strong' ? (importDefault(697) /* metro dependency 697: native */).colors.BORDER_STRONG : a4 === 'faint' ? (importDefault(697) /* metro dependency 697: native */).colors.BORDER_MUTED : a4 === 'control-secondary' ? (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_SECONDARY_BORDER_DEFAULT : value3;
const r6 = value5 == r0 ? cardBackgroundTokenBinding : r0;
const object2 = {};
copyDataProperties(object2, CardTokensNativeModule.createCardShadowToken(a3), CardTokensNativeModule);
object2['borderTopStartRadius'] = a0 ? value : value3;
object2['borderTopEndRadius'] = a0 ? value : value3;
object2['borderBottomStartRadius'] = a1 ? value : value3;
object2['borderBottomEndRadius'] = a1 ? value : value3;
object2['borderColor'] = r6;
object2['borderWidth'] = a4 === 'none' ? 0 : 1;
object2['backgroundColor'] = cardBackgroundTokenBinding;
return {card: object2, spacing: {padding: 16}};
}
}
global.__d(_fun49318, 6239, [29, 31, 27, 33, 4017, 697, 6234, 4501, 1357, 3860, 477, 4577, 4581, 6240,
2]) /* metro module 6239, dependencies: [29, 31, 27, 33, 4017, 697, 6234, 4501, 1357, 3860, 477, 4577, 4581, 6240, 2] */;