// Metro module 1792 (f1793). import * as _Module1793 from "./Module1793"; import * as _createViewDescriptorPaper from "./createViewDescriptorPaper"; let computeEasingProgress, easing, computeProgress, maybeScheduleNextFrame; let c1514_2 = 400; const computeEasingProgress2 = function computeEasingProgress(a0, a1, a2) { return Math.abs(a1) < 1 ? 1 : a2 * ((_getAnimationTimestamp() - a0) / 1000) / a1; }; computeEasingProgress2.__closure = {}; computeEasingProgress2.__workletHash = 11092056948922; computeEasingProgress2.__initData = { 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;}" }; computeEasingProgress = computeEasingProgress2; const easing2 = function easing(a0) { return 1 - Math.pow(1 - a0, 5); }; easing2.__closure = {}; easing2.__workletHash = 4992389111746; easing2.__initData = { code: "function easing_Pnpm_swipeSimulatorTs2(x){return 1-Math.pow(1-x,5);}" }; easing = easing2; const computeProgress2 = function computeProgress({ screenDimensions: screenDimensions2 }, a1, a2) { const r19 = Math.max(Math.abs(a1.translationX / screenDimensions2.width), Math.abs(a1.translationY / screenDimensions2.height)); return a2 ? r19 / 2 : r19; }; computeProgress2.__closure = {}; computeProgress2.__workletHash = 3778680834909; computeProgress2.__initData = { 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;}" }; computeProgress = computeProgress2; const maybeScheduleNextFrame2 = function maybeScheduleNextFrame(a0, a1, a2, a3, a4) { if (a1) { const onFinishAnimation = a2.onFinishAnimation; if (onFinishAnimation != null) { onFinishAnimation.call(a2); } } else { const { stackTag, screenDimensions: screenDimensions2 } = a2; const r28 = Math.max(Math.abs(a3.translationX / screenDimensions2.width), Math.abs(a3.translationY / screenDimensions2.height)); _Module1793.RNScreensTurboModule.updateTransition(stackTag, a4 ? r28 / 2 : r28); requestAnimationFrame(a0); } }; maybeScheduleNextFrame2.__closure = { computeProgress, RNScreensTurboModule: _Module1793.RNScreensTurboModule }; maybeScheduleNextFrame2.__workletHash = 7657931427196; maybeScheduleNextFrame2.__initData = { 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);}}" }; maybeScheduleNextFrame = maybeScheduleNextFrame2; export function getSwipeSimulator(a0, a1, a2) { let computeFrame2, _computeFrame2; const screenDimensions = a1.screenDimensions; let c24678_4 = _getAnimationTimestamp(); const isTransitionCanceled = a1.isTransitionCanceled; const r21 = { x: a0.translationX, y: a0.translationY }; let c24678_6 = r21; const r24 = Math.sign(a0.translationX); let c24678_7 = r24; const r28 = Math.sign(a0.translationY); let c24678_8 = r28; const r31 = isTransitionCanceled ? { x: 0, y: 0 } : { x: r24 * screenDimensions.width, y: r28 * screenDimensions.height }; const r38 = { x: Math.abs(r31.x - r21.x), y: Math.abs(r31.y - r21.y) }; let c24678_9 = r38; let c24678_10 = { x: false, y: false }; const r47 = { x: c1514_2, y: c1514_2 }; let c24678_11 = r47; if (a2 === "x") { r47.y = 0; r47.x = r47.x + 400 * r38.x / screenDimensions.width; } else if (a2 === "y") { r47.x = 0; r47.y = r47.y + 500 * r38.y / screenDimensions.height; } else { const r66 = c1514_2 + 600 * Math.sqrt(r38.x ** 2 + r38.y ** 2) / Math.sqrt(screenDimensions.width ** 2 + screenDimensions.height ** 2); if (Math.abs(r21.x) > Math.abs(r21.y)) { r47.x = r66; r47.y = r66 * Math.abs(r21.y / r21.x); } else { r47.x = r66 * Math.abs(r21.x / r21.y); r47.y = r66; } } if (isTransitionCanceled) { computeFrame2 = () => { const r7 = c24678_9.x; const r13 = c24678_11.x; const r2 = Math.abs(r7) < 1 ? 1 : r13 * ((_getAnimationTimestamp() - c24678_4) / 1000) / r7; const r29 = c24678_9.y; const r30 = c24678_11.y; const r37 = Math.abs(r29) < 1 ? 1 : r30 * ((_getAnimationTimestamp() - c24678_4) / 1000) / r29; const r45 = c24678_6.x; a0.translationX = r45 - c24678_7 * c24678_9.x * (1 - Math.pow(1 - r2, 5)); const r60 = c24678_6.y; a0.translationY = r60 - c24678_8 * c24678_9.y * (1 - Math.pow(1 - r37, 5)); if (c24678_7 > 0) { if (a0.translationX <= 0) { c24678_10.x = true; a0.translationX = 0; } } else if (a0.translationX >= 0) { c24678_10.x = true; a0.translationX = 0; } if (c24678_8 > 0) { if (a0.translationY <= 0) { c24678_10.y = true; a0.translationY = 0; } } else if (a0.translationY >= 0) { c24678_10.y = true; a0.translationY = 0; } _createViewDescriptorPaper.applyStyle(a1, a0); const r97 = a2 === "x" ? c24678_10.x : (a2 === "y" || c24678_10.x) && c24678_10.y; if (r97) { a0.translationX = c24678_7 * screenDimensions.width; a0.translationY = c24678_8 * screenDimensions.height; _createViewDescriptorPaper.applyStyleForBelowTopScreen(a1, a0); } if (r97) { const onFinishAnimation = a1.onFinishAnimation; if (onFinishAnimation != null) { onFinishAnimation.call(a1); } } else { const { stackTag, screenDimensions: screenDimensions2 } = a1; const r133 = Math.max(Math.abs(a0.translationX / screenDimensions2.width), Math.abs(a0.translationY / screenDimensions2.height)); _Module1793.RNScreensTurboModule.updateTransition(stackTag, isTransitionCanceled ? r133 / 2 : r133); requestAnimationFrame(computeFrame2); } }; return computeFrame2; } _computeFrame2 = () => { const r7 = c24678_9.x; const r13 = c24678_11.x; const r2 = Math.abs(r7) < 1 ? 1 : r13 * ((_getAnimationTimestamp() - c24678_4) / 1000) / r7; const r29 = c24678_9.y; const r30 = c24678_11.y; const r37 = Math.abs(r29) < 1 ? 1 : r30 * ((_getAnimationTimestamp() - c24678_4) / 1000) / r29; const r45 = c24678_6.x; a0.translationX = r45 + c24678_7 * c24678_9.x * (1 - Math.pow(1 - r2, 5)); const r60 = c24678_6.y; a0.translationY = r60 + c24678_8 * c24678_9.y * (1 - Math.pow(1 - r37, 5)); if (c24678_7 > 0) { if (a0.translationX >= screenDimensions.width) { c24678_10.x = true; a0.translationX = screenDimensions.width; } } else if (a0.translationX <= -screenDimensions.width) { c24678_10.x = true; a0.translationX = -screenDimensions.width; } if (c24678_8 > 0) { if (a0.translationY >= screenDimensions.height) { c24678_10.y = true; a0.translationY = screenDimensions.height; } } else if (a0.translationY <= -screenDimensions.height) { c24678_10.y = true; a0.translationY = -screenDimensions.height; } _createViewDescriptorPaper.applyStyle(a1, a0); if (c24678_10.x || c24678_10.y) { const onFinishAnimation = a1.onFinishAnimation; if (onFinishAnimation != null) { onFinishAnimation.call(a1); } } else { const { stackTag, screenDimensions: screenDimensions2 } = a1; const r137 = Math.max(Math.abs(a0.translationX / screenDimensions2.width), Math.abs(a0.translationY / screenDimensions2.height)); _Module1793.RNScreensTurboModule.updateTransition(stackTag, isTransitionCanceled ? r137 / 2 : r137); requestAnimationFrame(_computeFrame2); } }; return _computeFrame2; } getSwipeSimulator.__closure = { BASE_VELOCITY: 400, ADDITIONAL_VELOCITY_FACTOR_X: 400, ADDITIONAL_VELOCITY_FACTOR_Y: 500, ADDITIONAL_VELOCITY_FACTOR_XY: 600, applyStyleForBelowTopScreen: _createViewDescriptorPaper.applyStyleForBelowTopScreen, computeEasingProgress, easing, applyStyle: _createViewDescriptorPaper.applyStyle, maybeScheduleNextFrame }; getSwipeSimulator.__workletHash = 11722244836970; getSwipeSimulator.__initData = { 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;}}" };