Files
discord-decomp/sources/by-id/module-05394.jsx
T
2026-07-27 16:20:00 +03:00

415 lines
20 KiB
React

/* Metro module 5394; source: unknown; dependencies: [6, 7, 15, 17, 18, 31, 27, 33, 5326, 5351, 5339] */
function _fun47600(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#47600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:6, offset: 0x011c5810, size: 430 bytes, params: 8, frame: 26
var object2;
const env0_0 = require;
let Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
importAll(31) /* metro dependency 31 */;
const Component = (require(31) /* metro dependency 31 */).Component;
let value = require(27) /* metro dependency 27 */;
const env0_7 = value.Animated;
const StyleSheet = value.StyleSheet;
const env0_8 = value.View;
const I18nManager = value.I18nManager;
value = require(33) /* metro dependency 33 */;
const env0_9 = value.jsx;
const env0_10 = value.jsxs;
value = _fun47604(Component);
value.defaultProps = {'friction': 1, 'overshootFriction': 1, 'useNativeAnimations': true};
const create = StyleSheet.create;
object2 = {};
object2.container = {overflow: 'hidden'};
Object = global.Object;
const assign = Object.assign;
const absoluteFillObject = StyleSheet.absoluteFillObject;
const isRTL = I18nManager.isRTL;
const value2 = 'row';
object2.leftActions = Reflect.apply(assign, Object, [{}, absoluteFillObject,
{flexDirection: isRTL ? 'row-reverse' : value2}]);
Object = global.Object;
object2.rightActions = Object.assign({}, StyleSheet.absoluteFillObject,
{flexDirection: I18nManager.isRTL ? value2 : 'row-reverse'});
const env0_11 = Reflect.apply(create, StyleSheet, [object2]);
exports.default = value;
}
function _isNativeReflectConstruct_47601() { // fn#47601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:268, offset: 0x011c59be, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_47601_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun47604(a0) { // fn#47604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:493, offset: 0x011c5a1c, size: 91 bytes, params: 2, frame: 16
const closure = Swipeable;
env0_6(closure, a0);
return env0_3(closure, [{key: 'shouldComponentUpdate', value: value_47618}, {key: 'render', value: value_47619}]);
}
function Swipeable(a0) { // fn#47605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:505, offset: 0x011c5a77, size: 412 bytes, params: 2, frame: 22
var environment;
const value = environment.__proto__;
env1_2(this, Swipeable);
let object = [a0];
const value3 = env1_5(Swipeable);
const value6 = env1_4(this, _isNativeReflectConstruct_47601() ? global.Reflect.construct(value3, object,
env1_5(this).constructor) : value3.apply(this, object));
value6.updateAnimatedEvent = updateAnimatedEvent;
value6.onTapHandlerStateChange = onTapHandlerStateChange;
value6.onHandlerStateChange = onHandlerStateChange;
value6.handleRelease = handleRelease;
value6.animateRow = animateRow;
value6.onRowLayout = onRowLayout;
value6.currentOffset = currentOffset;
value6.close = close_47614;
value6.openLeft = openLeft;
value6.openRight = openRight;
value6.reset = reset_47617;
let Value = Animated.Value;
const value7 = new Value(0);
object = {dragX: value7};
Value = Animated.Value;
const value8 = Object.create(Value.prototype, {constructor: {value: Value}});
const value9 = new Value(0);
object.rowTranslation = value9 instanceof Object ? value9 : value8;
object.rowState = 0;
object.leftWidth = undefined;
object.rightOffset = undefined;
object.rowWidth = undefined;
value6.state = object;
value6.updateAnimatedEvent(a0, value6.state);
const event = Animated.event;
const useNativeAnimations = a0.useNativeAnimations;
value6.onGestureEvent = Reflect.apply(event, Animated, [[{nativeEvent: {translationX: value7}}],
{useNativeDriver: useNativeAnimations}]);
return value6;
}
function value_47618(a0, a1) { // fn#47618, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:4737, offset: 0x011c65de, size: 193 bytes, params: 3, frame: 15
let r0 = this.props.friction === a0.friction && this.props.overshootLeft === a0.overshootLeft && this.props.overshootRight === a0.overshootRight;
r0 = r0 && this.props.overshootFriction === a0.overshootFriction && this.state.leftWidth === a1.leftWidth;
r0 = r0 && this.state.rightOffset === a1.rightOffset && this.state.rowWidth === a1.rowWidth;
if (!r0) {
this.updateAnimatedEvent(a0, a1);
}
return true;
}
function value_47619() { // fn#47619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:5121, offset: 0x011c669f, size: 737 bytes, params: 1, frame: 33
const rowState = this.state.rowState;
let props = this.props;
const children = props.children;
const renderLeftActions = props.renderLeftActions;
const renderRightActions = props.renderRightActions;
const dragOffsetFromLeftEdge = props.dragOffsetFromLeftEdge;
const value = 10;
const r4 = dragOffsetFromLeftEdge === undefined ? value : dragOffsetFromLeftEdge;
const dragOffsetFromRightEdge = props.dragOffsetFromRightEdge;
const r0 = dragOffsetFromRightEdge === undefined ? value : dragOffsetFromRightEdge;
const r21 = renderLeftActions && <Animated.View style={[env1_11.leftActions,
{transform: [{translateX: this.leftActionTranslate}]}]}>{renderLeftActions(this.showLeftAction, this.transX,
this)}<View onLayout={onLayout_47620} /></Animated.View>;
const r19 = renderRightActions && <Animated.View style={[env1_11.rightActions,
{transform: [{translateX: this.rightActionTranslate}]}]}>{renderRightActions(this.showRightAction, this.transX,
this)}<View onLayout={onLayout_47621} /></Animated.View>;
const PanGestureHandler = (require(5351) /* metro dependency 5351 */).PanGestureHandler;
const Object = global.Object;
const assign = Object.assign;
const object2 = {activeOffsetX: [-r0, r4], touchAction: 'pan-y'};
props = this.props;
const object3 = {};
object3.onGestureEvent = this.onGestureEvent;
object3.onHandlerStateChange = this.onHandlerStateChange;
const View4 = Animated.View;
const onRowLayout = this.onRowLayout;
const items8 = [env1_11.container];
items8[1] = this.props.containerStyle;
const TapGestureHandler = require(dependencyMap[value]).TapGestureHandler;
const onTapHandlerStateChange = this.onTapHandlerStateChange;
const View5 = Animated.View;
object3.children = <View4 onLayout={onRowLayout} style={items8}>{r21}{r19}<TapGestureHandler enabled={rowState !== 0} touchAction="pan-y" onHandlerStateChange={onTapHandlerStateChange}><View5 pointerEvents={rowState !== 0 ? 'box-only' : 'auto'} style={[{transform: [{translateX: this.transX}]},
this.props.childrenContainerStyle]}>{children}</View5></TapGestureHandler></View4>;
return <PanGestureHandler {...Reflect.apply(assign, Object, [object2, props, object3])} />;
}
function SwipeableUpdateAnimatedEvent({friction, overshootFriction, overshootLeft, overshootRight}, {dragX, rowTranslation, leftWidth, rowWidth, rightOffset}) { // fn#47606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:727, owner: Swipeable.updateAnimatedEvent, offset: 0x011c5c13, size: 689 bytes, params: 3, frame: 26
var r3;
var value15;
var value19;
const r13 = leftWidth === undefined ? 0 : leftWidth;
const r8 = rowWidth === undefined ? 0 : rowWidth;
let r2 = rightOffset !== undefined ? rightOffset : r8;
const Math = global.Math;
const value2 = Math.max(0, r8 - r2);
const r10 = overshootLeft !== undefined ? overshootLeft : r13 > 0;
const r14 = overshootRight !== undefined ? overshootRight : value2 > 0;
const add = Animated.add;
let interpolate = dragX.interpolate;
const value12 = Reflect.apply(add, Animated, [rowTranslation, Reflect.apply(interpolate, dragX, [{inputRange: [0,
friction], outputRange: [0, 1]}])]).interpolate({inputRange: [-value2 - 1, -value2, r13, r13 + 1],
outputRange: [-value2 - (r14 ? 1 / overshootFriction : 0), -value2, r13, r13 + (r10 ? 1 / overshootFriction : 0)]});
let binding = env0_0;
binding.transX = value12;
if (r13 > 0) {
r3 = value12.interpolate({inputRange: [-1, 0, r13], outputRange: [0, 0, 1]});
} else {
value15 = new Animated.Value(0);
}
binding.showLeftAction = r3;
binding = env0_0;
const showLeftAction = binding.showLeftAction;
interpolate = showLeftAction.interpolate;
let Number = global.Number;
let MIN_VALUE = Number.MIN_VALUE;
binding.leftActionTranslate = Reflect.apply(interpolate, showLeftAction, [{inputRange: [0, MIN_VALUE],
outputRange: [-10000, 0], extrapolate: 'clamp'}]);
if (value2 > 0) {
r2 = value12.interpolate({inputRange: [-value2, 0, 1], outputRange: [1, 0, 0]});
} else {
value19 = new Animated.Value(0);
}
binding.showRightAction = r2;
binding = env0_0;
const showRightAction = binding.showRightAction;
interpolate = showRightAction.interpolate;
Number = global.Number;
MIN_VALUE = Number.MIN_VALUE;
binding.rightActionTranslate = Reflect.apply(interpolate, showRightAction, [{inputRange: [0, MIN_VALUE],
outputRange: [-10000, 0], extrapolate: 'clamp'}]);
}
function SwipeableOnTapHandlerStateChange({nativeEvent}) { // fn#47607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:1626, owner: Swipeable.onTapHandlerStateChange, offset: 0x011c5ec4, size: 75 bytes, params: 2, frame: 12
const oldState = nativeEvent.oldState;
const State = (require(5326) /* metro dependency 5326 */).State;
const ACTIVE = State.ACTIVE;
if (oldState === ACTIVE) {
env0_0.close();
}
}
function SwipeableOnHandlerStateChange(a0) { // fn#47608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:1719, owner: Swipeable.onHandlerStateChange, offset: 0x011c5f0f, size: 319 bytes, params: 2, frame: 17
var r3;
var binding;
var velocityX;
var translationX;
var rowState;
var friction;
var value3;
let nativeEvent = a0.nativeEvent;
const oldState = nativeEvent.oldState;
const State = (require(5326) /* metro dependency 5326 */).State;
let ACTIVE = State.ACTIVE;
if (oldState === ACTIVE) {
env0_0.handleRelease(a0);
}
const state = a0.nativeEvent.state;
ACTIVE = State.ACTIVE;
if (state === ACTIVE) {
nativeEvent = a0.nativeEvent;
velocityX = nativeEvent.velocityX;
translationX = nativeEvent.translationX;
binding = env0_0;
rowState = binding.state.rowState;
friction = binding.props.friction;
value3 = 'right';
r3 = rowState === -1 ? value3 : rowState === 1 || (translationX + 0.05 * velocityX) / friction > 0 ? 'left' : value3;
if (rowState === 0) {
if (env0_0.props.onSwipeableOpenStartDrag != null) {
env0_0.props.onSwipeableOpenStartDrag(r3);
}
} else if (env0_0.props.onSwipeableCloseStartDrag != null) {
env0_0.props.onSwipeableCloseStartDrag(r3);
}
}
}
function SwipeableHandleRelease({nativeEvent}) { // fn#47609, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:2164, owner: Swipeable.handleRelease, offset: 0x011c604e, size: 277 bytes, params: 2, frame: 23
const velocityX = nativeEvent.velocityX;
const translationX = nativeEvent.translationX;
const state = env0_0.state;
const leftWidth = state.leftWidth;
const r11 = leftWidth === undefined ? 0 : leftWidth;
const rowWidth = state.rowWidth;
const r3 = rowWidth === undefined ? 0 : rowWidth;
const rowState = state.rowState;
const rightOffset = env0_0.state.rightOffset;
const value3 = r3 - (rightOffset !== undefined ? rightOffset : r3);
const props = env0_0.props;
const friction = props.friction;
const leftThreshold = props.leftThreshold;
const r10 = leftThreshold !== undefined ? leftThreshold : r11 / 2;
const rightThreshold = props.rightThreshold;
const r7 = rightThreshold !== undefined ? rightThreshold : value3 / 2;
const value7 = env0_0.currentOffset() + translationX / friction;
const value8 = (translationX + 0.05 * velocityX) / friction;
env0_0.animateRow(value7,
rowState === 0 ? value8 > r10 ? r11 : value8 < -r7 ? -value3 : 0 : rowState === 1 ? value8 > -r10 ? r11 : 0 : value8 < r7 ? -value3 : 0,
velocityX / friction);
}
function animateRow(a0, a1, a2) { // fn#47610, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:2587, owner: Swipeable.animateRow, offset: 0x011c6163, size: 456 bytes, params: 4, frame: 22
const env0_0 = a0;
const env0_1 = a1;
const binding = env0_0;
const {dragX, rowTranslation} = binding.state;
dragX.setValue(0);
rowTranslation.setValue(a0);
const setState = binding.setState;
const object2 = {};
const Math = global.Math;
object2.rowState = Math.sign(a1);
Reflect.apply(setState, binding, [object2]);
const spring = Animated.spring;
const Object = global.Object;
const assign = Object.assign;
let props = binding.props;
const useNativeAnimations = props.useNativeAnimations;
Reflect.apply(spring, Animated, [rowTranslation, Reflect.apply(assign, Object, [{'restSpeedThreshold': 1.7,
'restDisplacementThreshold': 0.4, 'velocity': null, 'bounciness': 0, velocity: a2, toValue: a1,
useNativeDriver: useNativeAnimations}, binding.props.animationOptions])]).start(_fun47611);
if (a1 > 0) {
props = env0_0.props;
if (props.onSwipeableLeftWillOpen != null) {
env0_0.props.onSwipeableLeftWillOpen();
}
props = env0_0.props;
if (props.onSwipeableWillOpen != null) {
env0_0.props.onSwipeableWillOpen('left');
}
} else if (a1 < 0) {
props = env0_0.props;
if (props.onSwipeableRightWillOpen != null) {
env0_0.props.onSwipeableRightWillOpen();
}
props = env0_0.props;
if (props.onSwipeableWillOpen != null) {
env0_0.props.onSwipeableWillOpen('right');
}
} else if (env0_0.props.onSwipeableWillClose != null) {
env0_0.props.onSwipeableWillClose(a0 > 0 ? 'left' : 'right');
}
}
function onRowLayout({nativeEvent}) { // fn#47612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:3729, owner: Swipeable.onRowLayout, offset: 0x011c644e, size: 49 bytes, params: 2, frame: 12
env0_0.setState({rowWidth: nativeEvent.layout.width});
}
function currentOffset() { // fn#47613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:3816, owner: Swipeable.currentOffset, offset: 0x011c647f, size: 103 bytes, params: 1, frame: 8
const state = env0_0.state;
const leftWidth = state.leftWidth;
const value2 = 0;
let r0 = leftWidth === undefined ? value2 : leftWidth;
const rowWidth = state.rowWidth;
const r3 = rowWidth === undefined ? value2 : rowWidth;
const rowState = state.rowState;
const rightOffset = env0_0.state.rightOffset;
r0 = rowState !== 1 ? rowState !== -1 ? value2 : -(r3 - (rightOffset !== undefined ? rightOffset : r3)) : r0;
return r0;
}
function SwipeableClose() { // fn#47614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:3992, owner: Swipeable.close, offset: 0x011c64e6, size: 35 bytes, params: 1, frame: 13
const binding = env0_0;
binding.animateRow(binding.currentOffset(), 0);
}
function openLeft() { // fn#47615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:4049, owner: Swipeable.openLeft, offset: 0x011c6509, size: 57 bytes, params: 1, frame: 14
const leftWidth = env0_0.state.leftWidth;
const r4 = leftWidth === undefined ? 0 : leftWidth;
const binding = env0_0;
binding.animateRow(binding.currentOffset(), r4);
}
function openRight() { // fn#47616, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:4148, owner: Swipeable.openRight, offset: 0x011c6542, size: 86 bytes, params: 1, frame: 14
const rowWidth = env0_0.state.rowWidth;
const r3 = rowWidth === undefined ? 0 : rowWidth;
const rightOffset = env0_0.state.rightOffset;
const value3 = r3 - (rightOffset !== undefined ? rightOffset : r3);
const binding = env0_0;
binding.animateRow(binding.currentOffset(), -value3);
}
function SwipeableReset() { // fn#47617, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:4286, owner: Swipeable.reset, offset: 0x011c6598, size: 70 bytes, params: 1, frame: 13
const binding = env0_0;
const {dragX, rowTranslation} = binding.state;
dragX.setValue(0);
rowTranslation.setValue(0);
binding.setState({rowState: 0});
}
function value_47619OnLayout({nativeEvent}) { // fn#47620, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:5487, owner: value_47619.onLayout, offset: 0x011c6980, size: 47 bytes, params: 2, frame: 12
return env0_0.setState({leftWidth: nativeEvent.layout.x});
}
function value_47619OnLayout_47621({nativeEvent}) { // fn#47621, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:5732, owner: value_47619.onLayout, offset: 0x011c69af, size: 47 bytes, params: 2, frame: 12
return env0_0.setState({rightOffset: nativeEvent.layout.x});
}
function _fun47611(a0) { // fn#47611, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5572:2904, offset: 0x011c632b, size: 291 bytes, params: 2, frame: 13
var r3;
var value;
var props;
var binding;
if (a0.finished) {
if (require > 0) {
value = environment.__proto__;
props = env1_0.props;
if (props.onSwipeableLeftOpen != null) {
env1_0.props.onSwipeableLeftOpen();
}
props = env1_0.props;
if (props.onSwipeableOpen != null) {
binding = env1_0;
binding.props.onSwipeableOpen('left', binding);
}
} else if (require < 0) {
value = environment.__proto__;
props = env1_0.props;
if (props.onSwipeableRightOpen != null) {
env1_0.props.onSwipeableRightOpen();
}
props = env1_0.props;
if (props.onSwipeableOpen != null) {
binding = env1_0;
binding.props.onSwipeableOpen('right', binding);
}
} else {
value = 'right';
r3 = env0_0 > 0 ? 'left' : value;
value = environment.__proto__;
if (env1_0.props.onSwipeableClose != null) {
binding = env1_0;
binding.props.onSwipeableClose(r3, binding);
}
}
}
}