272 lines
16 KiB
React
272 lines
16 KiB
React
/* Metro module 1796; source: unknown; dependencies: [1797, 1795] */
|
|
function _fun19709(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#19709, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:6, offset: 0x00eb1c3b, size: 202 bytes, params: 8, frame: 16
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
object = {code: 'function computeEasingProgress_Pnpm_swipeSimulatorTs1(startingTimestamp,distance,velocity){if(Math.abs(distance)<1){return 1;}const elapsedTime=(_getAnimationTimestamp()-startingTimestamp)/1000;const currentPosition=velocity*elapsedTime;const progress=currentPosition/distance;return progress;}'};
|
|
const env0_3 = _fun19710();
|
|
object = {code: 'function easing_Pnpm_swipeSimulatorTs2(x){return 1-Math.pow(1-x,5);}'};
|
|
const env0_5 = _fun19712();
|
|
object = {code: 'function computeProgress_Pnpm_swipeSimulatorTs3(screenTransitionConfig,event,isTransitionCanceled){const screenDimensions=screenTransitionConfig.screenDimensions;const progressX=Math.abs(event.translationX/screenDimensions.width);const progressY=Math.abs(event.translationY/screenDimensions.height);const maxProgress=Math.max(progressX,progressY);const progress=isTransitionCanceled?maxProgress/2:maxProgress;return progress;}'};
|
|
const env0_7 = _fun19714();
|
|
object = {code: 'function maybeScheduleNextFrame_Pnpm_swipeSimulatorTs4(step,didScreenReachDestination,screenTransitionConfig,event,isTransitionCanceled){const{computeProgress,RNScreensTurboModule}=this.__closure;if(!didScreenReachDestination){const stackTag=screenTransitionConfig.stackTag;const progress=computeProgress(screenTransitionConfig,event,isTransitionCanceled);RNScreensTurboModule.updateTransition(stackTag,progress);requestAnimationFrame(step);}else{var _screenTransitionConf;(_screenTransitionConf=screenTransitionConfig.onFinishAnimation)===null||_screenTransitionConf===void 0||_screenTransitionConf.call(screenTransitionConfig);}}'};
|
|
const env0_9 = _fun19716();
|
|
object = {code: "function getSwipeSimulator_Pnpm_swipeSimulatorTs5(event,screenTransitionConfig,lockAxis){const{BASE_VELOCITY,ADDITIONAL_VELOCITY_FACTOR_X,ADDITIONAL_VELOCITY_FACTOR_Y,ADDITIONAL_VELOCITY_FACTOR_XY,applyStyleForBelowTopScreen,computeEasingProgress,easing,applyStyle,maybeScheduleNextFrame}=this.__closure;const screenDimensions=screenTransitionConfig.screenDimensions;const startTimestamp=_getAnimationTimestamp();const{isTransitionCanceled:isTransitionCanceled}=screenTransitionConfig;const startingPosition={x:event.translationX,y:event.translationY};const direction={x:Math.sign(event.translationX),y:Math.sign(event.translationY)};const finalPosition=isTransitionCanceled?{x:0,y:0}:{x:direction.x*screenDimensions.width,y:direction.y*screenDimensions.height};const distance={x:Math.abs(finalPosition.x-startingPosition.x),y:Math.abs(finalPosition.y-startingPosition.y)};const didScreenReachDestination={x:false,y:false};const velocity={x:BASE_VELOCITY,y:BASE_VELOCITY};if(lockAxis==='x'){velocity.y=0;velocity.x+=ADDITIONAL_VELOCITY_FACTOR_X*distance.x/screenDimensions.width;}else if(lockAxis==='y'){velocity.x=0;velocity.y+=ADDITIONAL_VELOCITY_FACTOR_Y*distance.y/screenDimensions.height;}else{const euclideanDistance=Math.sqrt(distance.x**2+distance.y**2);const screenDiagonal=Math.sqrt(screenDimensions.width**2+screenDimensions.height**2);const velocityVectorLength=BASE_VELOCITY+ADDITIONAL_VELOCITY_FACTOR_XY*euclideanDistance/screenDiagonal;if(Math.abs(startingPosition.x)>Math.abs(startingPosition.y)){velocity.x=velocityVectorLength;velocity.y=velocityVectorLength*Math.abs(startingPosition.y/startingPosition.x);}else{velocity.x=velocityVectorLength*Math.abs(startingPosition.x/startingPosition.y);velocity.y=velocityVectorLength;}}if(isTransitionCanceled){function didScreenReachDestinationCheck(){if(lockAxis==='x'){return didScreenReachDestination.x;}else if(lockAxis==='y'){return didScreenReachDestination.y;}else{return didScreenReachDestination.x&&didScreenReachDestination.y;}}function restoreOriginalStyleForBelowTopScreen(){event.translationX=direction.x*screenDimensions.width;event.translationY=direction.y*screenDimensions.height;applyStyleForBelowTopScreen(screenTransitionConfig,event);}const computeFrame=function(){const progress={x:computeEasingProgress(startTimestamp,distance.x,velocity.x),y:computeEasingProgress(startTimestamp,distance.y,velocity.y)};event.translationX=startingPosition.x-direction.x*distance.x*easing(progress.x);event.translationY=startingPosition.y-direction.y*distance.y*easing(progress.y);if(direction.x>0){if(event.translationX<=0){didScreenReachDestination.x=true;event.translationX=0;}}else{if(event.translationX>=0){didScreenReachDestination.x=true;event.translationX=0;}}if(direction.y>0){if(event.translationY<=0){didScreenReachDestination.y=true;event.translationY=0;}}else{if(event.translationY>=0){didScreenReachDestination.y=true;event.translationY=0;}}applyStyle(screenTransitionConfig,event);const finished=didScreenReachDestinationCheck();if(finished){restoreOriginalStyleForBelowTopScreen();}maybeScheduleNextFrame(computeFrame,finished,screenTransitionConfig,event,isTransitionCanceled);};return computeFrame;}else{const computeFrame=function(){const progress={x:computeEasingProgress(startTimestamp,distance.x,velocity.x),y:computeEasingProgress(startTimestamp,distance.y,velocity.y)};event.translationX=startingPosition.x+direction.x*distance.x*easing(progress.x);event.translationY=startingPosition.y+direction.y*distance.y*easing(progress.y);if(direction.x>0){if(event.translationX>=screenDimensions.width){didScreenReachDestination.x=true;event.translationX=screenDimensions.width;}}else{if(event.translationX<=-screenDimensions.width){didScreenReachDestination.x=true;event.translationX=-screenDimensions.width;}}if(direction.y>0){if(event.translationY>=screenDimensions.height){didScreenReachDestination.y=true;event.translationY=screenDimensions.height;}}else{if(event.translationY<=-screenDimensions.height){didScreenReachDestination.y=true;event.translationY=-screenDimensions.height;}}applyStyle(screenTransitionConfig,event);maybeScheduleNextFrame(computeFrame,didScreenReachDestination.x||didScreenReachDestination.y,screenTransitionConfig,event,isTransitionCanceled);};return computeFrame;}}"};
|
|
exports.getSwipeSimulator = _fun19718();
|
|
}
|
|
|
|
function _fun19710() { // fn#19710, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:410, offset: 0x00eb1d05, size: 46 bytes, params: 1, frame: 2
|
|
const closure = function(a0, a1, a2) {
|
|
var r0;
|
|
var Math = global.Math;
|
|
var value = Math.abs(a1);
|
|
var value2 = 1;
|
|
if (value < value2) {
|
|
r0 = value2;
|
|
} else {
|
|
value = (0, global._getAnimationTimestamp)();
|
|
value = a2 * ((value - a0) / 1000) / a1;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
closure.__closure = {};
|
|
closure.__workletHash = 11092056948922;
|
|
closure.__initData = env0_2;
|
|
return closure;
|
|
}
|
|
|
|
function _fun19712() { // fn#19712, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:682, offset: 0x00eb1d7d, size: 46 bytes, params: 1, frame: 2
|
|
const closure = function(a0) {
|
|
var Math = global.Math;
|
|
return 1 - Math.pow(1 - a0, 5);
|
|
};
|
|
closure.__closure = {};
|
|
closure.__workletHash = 4992389111746;
|
|
closure.__initData = env0_4;
|
|
return closure;
|
|
}
|
|
|
|
function _fun19714() { // fn#19714, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:1256, offset: 0x00eb1dd2, size: 46 bytes, params: 1, frame: 2
|
|
const closure = function(a0, a1, a2) {
|
|
var r0;
|
|
var property = a0.screenDimensions;
|
|
var Math = global.Math;
|
|
var value = Math.abs(a1.translationX / property.width);
|
|
var Math2 = global.Math;
|
|
value = global.Math.max(value, Math2.abs(a1.translationY / property.height));
|
|
if (a2) {
|
|
value /= 2;
|
|
r0 = value;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
closure.__closure = {};
|
|
closure.__workletHash = 3778680834909;
|
|
closure.__initData = env0_6;
|
|
return closure;
|
|
}
|
|
|
|
function _fun19716() { // fn#19716, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:2150, offset: 0x00eb1e71, size: 89 bytes, params: 1, frame: 14
|
|
const closure = maybeScheduleNextFrame;
|
|
const object2 = {};
|
|
object2.computeProgress = env0_7;
|
|
const RNScreensTurboModule = (require(1797) /* metro dependency 1797 */).RNScreensTurboModule;
|
|
object2.RNScreensTurboModule = RNScreensTurboModule;
|
|
closure.__closure = object2;
|
|
closure.__workletHash = 7657931427196;
|
|
closure.__initData = env0_8;
|
|
return closure;
|
|
}
|
|
|
|
function _fun19718() { // fn#19718, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:6805, offset: 0x00eb1f40, size: 142 bytes, params: 1, frame: 16
|
|
const closure = getSwipeSimulator;
|
|
const object2 = {'BASE_VELOCITY': 400, 'ADDITIONAL_VELOCITY_FACTOR_X': 400, 'ADDITIONAL_VELOCITY_FACTOR_Y': 500,
|
|
'ADDITIONAL_VELOCITY_FACTOR_XY': 600};
|
|
object2.applyStyleForBelowTopScreen = (require(1795) /* metro dependency 1795 */).applyStyleForBelowTopScreen;
|
|
object2.computeEasingProgress = env0_3;
|
|
object2.easing = env0_5;
|
|
object2.applyStyle = (require(1795) /* metro dependency 1795 */).applyStyle;
|
|
object2.maybeScheduleNextFrame = env0_9;
|
|
closure.__closure = object2;
|
|
closure.__workletHash = 11722244836970;
|
|
closure.__initData = env0_10;
|
|
return closure;
|
|
}
|
|
|
|
function maybeScheduleNextFrame(a0, a1, a2, a3, a4) { // fn#19717, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:2167, offset: 0x00eb1eca, size: 118 bytes, params: 6, frame: 17
|
|
var stackTag;
|
|
var value;
|
|
if (a1) {
|
|
if (a2.onFinishAnimation != null) {
|
|
a2.onFinishAnimation();
|
|
}
|
|
} else {
|
|
stackTag = a2.stackTag;
|
|
value = environment.__proto__;
|
|
(require(1797) /* metro dependency 1797 */).RNScreensTurboModule.updateTransition(stackTag, env1_7(a2, a3, a4));
|
|
global.requestAnimationFrame(a0);
|
|
}
|
|
}
|
|
|
|
function getSwipeSimulator(a0, a1, a2) { // fn#19719, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:6822, offset: 0x00eb1fce, size: 684 bytes, params: 4, frame: 23
|
|
var sqrt;
|
|
var value5;
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const env0_2 = a2;
|
|
const screenDimensions = a1.screenDimensions;
|
|
const env0_4 = global._getAnimationTimestamp();
|
|
const isTransitionCanceled = a1.isTransitionCanceled;
|
|
const object2 = {};
|
|
object2.x = a0.translationX;
|
|
object2.y = a0.translationY;
|
|
let Math = global.Math;
|
|
let value = Math.sign(a0.translationX);
|
|
Math = global.Math;
|
|
const r3 = isTransitionCanceled ? {'x': 0, 'y': 0} : {x: value * screenDimensions.width,
|
|
y: Math.sign(a0.translationY) * screenDimensions.height};
|
|
const object3 = {};
|
|
Math = global.Math;
|
|
let abs = Math.abs;
|
|
let x = r3.x;
|
|
object3.x = Reflect.apply(abs, Math, [x - object2.x]);
|
|
Math = global.Math;
|
|
abs = Math.abs;
|
|
let y = r3.y;
|
|
object3.y = Reflect.apply(abs, Math, [y - object2.y]);
|
|
const env0_10 = {'x': false, 'y': false};
|
|
const object6 = {'x': 400, 'y': 400};
|
|
if (a2 === 'x') {
|
|
object6.y = 0;
|
|
object6.x = object6.x + 400 * object3.x / screenDimensions.width;
|
|
} else if (a2 === 'y') {
|
|
object6.x = 0;
|
|
object6.y = object6.y + 500 * object3.y / screenDimensions.height;
|
|
} else {
|
|
Math = global.Math;
|
|
sqrt = Math.sqrt;
|
|
x = object3.x;
|
|
value = exponentiationOperator(x, 2, 2);
|
|
y = object3.y;
|
|
value = Reflect.apply(sqrt, Math, [value + exponentiationOperator(y, 2, 2)]);
|
|
Math = global.Math;
|
|
sqrt = Math.sqrt;
|
|
value = 400 + 600 * value / Reflect.apply(sqrt, Math, [exponentiationOperator(screenDimensions.width, 2, 2) + exponentiationOperator(screenDimensions.height, 2, 2)]);
|
|
Math = global.Math;
|
|
abs = Math.abs;
|
|
x = object2.x;
|
|
value5 = Reflect.apply(abs, Math, [x]);
|
|
Math = global.Math;
|
|
abs = Math.abs;
|
|
y = object2.y;
|
|
if (value5 > Reflect.apply(abs, Math, [y])) {
|
|
object6.x = value;
|
|
Math = global.Math;
|
|
object6.y = value * Math.abs(object2.y / object2.x);
|
|
} else {
|
|
Math = global.Math;
|
|
object6.x = value * Math.abs(object2.x / object2.y);
|
|
object6.y = value;
|
|
}
|
|
}
|
|
if (isTransitionCanceled) {
|
|
return getSwipeSimulatorComputeFrame;
|
|
}
|
|
return getSwipeSimulatorComputeFrame_19721;
|
|
}
|
|
|
|
function getSwipeSimulatorComputeFrame() { // fn#19720, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:7408, owner: getSwipeSimulator.computeFrame, offset: 0x00eb227a, size: 554 bytes, params: 1, frame: 23
|
|
var r6;
|
|
var binding7;
|
|
var screenDimensionsBinding;
|
|
const object2 = {};
|
|
let binding = env2_3;
|
|
const binding2 = env0_4;
|
|
let x = env0_9.x;
|
|
object2.x = binding(binding2, x, env0_11.x);
|
|
object2.y = binding(binding2, env0_9.y, env0_11.y);
|
|
binding = env0_0;
|
|
const binding3 = env0_6;
|
|
x = binding3.x;
|
|
const binding4 = env0_7;
|
|
const value3 = binding4 * env0_9.x;
|
|
const binding5 = env2_5;
|
|
binding.translationX = x - value3 * binding5(object2.x);
|
|
binding.translationY = binding3.y - env0_8 * env0_9.y * binding5(object2.y);
|
|
if (binding4 > 0) {
|
|
if (env0_0.translationX <= 0) {
|
|
env0_10.x = true;
|
|
env0_0.translationX = 0;
|
|
}
|
|
} else if (env0_0.translationX >= 0) {
|
|
env0_10.x = true;
|
|
env0_0.translationX = 0;
|
|
}
|
|
if (env0_8 > 0) {
|
|
if (env0_0.translationY <= 0) {
|
|
env0_10.y = true;
|
|
env0_0.translationY = 0;
|
|
}
|
|
} else if (env0_0.translationY >= 0) {
|
|
env0_10.y = true;
|
|
env0_0.translationY = 0;
|
|
}
|
|
(require(1795) /* metro dependency 1795 */).applyStyle(require, env0_0);
|
|
if (importDefault === 'x') {
|
|
r6 = env0_10.x;
|
|
} else {
|
|
r6 = importDefault === 'y' || env0_10.x;
|
|
r6 = r6 && env0_10.y;
|
|
}
|
|
if (r6) {
|
|
binding = env0_0;
|
|
binding7 = env0_7;
|
|
screenDimensionsBinding = screenDimensions;
|
|
binding.translationX = binding7 * screenDimensionsBinding.width;
|
|
binding.translationY = env0_8 * screenDimensionsBinding.height;
|
|
(require(1795) /* metro dependency 1795 */).applyStyleForBelowTopScreen(require, binding);
|
|
}
|
|
env2_9(getSwipeSimulatorComputeFrame, r6, require, env0_0, isTransitionCanceled);
|
|
}
|
|
|
|
function getSwipeSimulatorComputeFrame_19721() { // fn#19721, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1923:7910, owner: getSwipeSimulator.computeFrame, offset: 0x00eb24a4, size: 521 bytes, params: 1, frame: 23
|
|
const object2 = {};
|
|
let binding = env2_3;
|
|
const binding2 = env0_4;
|
|
let x = env0_9.x;
|
|
object2.x = binding(binding2, x, env0_11.x);
|
|
object2.y = binding(binding2, env0_9.y, env0_11.y);
|
|
binding = env0_0;
|
|
const binding3 = env0_6;
|
|
x = binding3.x;
|
|
const binding4 = env0_7;
|
|
const value3 = binding4 * env0_9.x;
|
|
const binding5 = env2_5;
|
|
binding.translationX = x + value3 * binding5(object2.x);
|
|
binding.translationY = binding3.y + env0_8 * env0_9.y * binding5(object2.y);
|
|
if (binding4 > 0) {
|
|
if (env0_0.translationX >= screenDimensions.width) {
|
|
env0_10.x = true;
|
|
env0_0.translationX = screenDimensions.width;
|
|
}
|
|
} else if (env0_0.translationX <= -screenDimensions.width) {
|
|
env0_10.x = true;
|
|
env0_0.translationX = -screenDimensions.width;
|
|
}
|
|
if (env0_8 > 0) {
|
|
if (env0_0.translationY >= screenDimensions.height) {
|
|
env0_10.y = true;
|
|
env0_0.translationY = screenDimensions.height;
|
|
}
|
|
} else if (env0_0.translationY <= -screenDimensions.height) {
|
|
env0_10.y = true;
|
|
env0_0.translationY = -screenDimensions.height;
|
|
}
|
|
(require(1795) /* metro dependency 1795 */).applyStyle(require, env0_0);
|
|
env2_9(getSwipeSimulatorComputeFrame_19721, env0_10.x || env0_10.y, require, env0_0, isTransitionCanceled);
|
|
}
|
|
|