Files
discord-decomp/_bundle/Module1819.js
T
2026-11-01 12:12:55 +02:00

148 lines
6.5 KiB
JavaScript

// Metro module 1819 (f1820).
import { Platform } from "react-native";
import * as _Module1606 from "./Module1606";
import { Easing, useSharedValue, useAnimatedReaction } from "./Module1606";
import { useKeyboardHandler } from "./useResizeMode";
const IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS = Platform.Version >= 30 || false;
const TELEGRAM_ANDROID_TIMING_CONFIG = {
duration: 250,
easing: Easing.bezier(0.19919472913616398, 0.010644531250000006, 0.27920937042459737, 0.91025390625)
};
const __initData = {
code: "function pnpm_useSmoothKeyboardHandlerTs1(){const{IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS,persistedHeight,TELEGRAM_ANDROID_TIMING_CONFIG,target,animatedKeyboardHeight}=this.__closure;if(IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS){return;}if(persistedHeight.value===0){return;}const event={duration:TELEGRAM_ANDROID_TIMING_CONFIG.duration,target:target.value,height:animatedKeyboardHeight.value,progress:animatedKeyboardHeight.value/persistedHeight.value};return event;}"
};
const __initData2 = {
code: "function pnpm_useSmoothKeyboardHandlerTs2(evt){const{handler,height,persistedHeight}=this.__closure;var _handler$onMove,_handler;if(!evt){return;}(_handler$onMove=(_handler=handler).onMove)===null||_handler$onMove===void 0||_handler$onMove.call(_handler,evt);if(evt.height===height.value){var _handler$onEnd,_handler2;(_handler$onEnd=(_handler2=handler).onEnd)===null||_handler$onEnd===void 0||_handler$onEnd.call(_handler2,evt);persistedHeight.value=height.value;}}"
};
const __initData3 = {
code: "function pnpm_useSmoothKeyboardHandlerTs3(e){const{IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS,persistedHeight,handler,target,height,animatedKeyboardHeight,withTiming,TELEGRAM_ANDROID_TIMING_CONFIG}=this.__closure;var _handler$onStart2,_handler3;if(!IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS&&e.height===persistedHeight.value){var _handler$onStart,_handler,_handler$onEnd,_handler2;(_handler$onStart=(_handler=handler).onStart)===null||_handler$onStart===void 0||_handler$onStart.call(_handler,e);(_handler$onEnd=(_handler2=handler).onEnd)===null||_handler$onEnd===void 0||_handler$onEnd.call(_handler2,e);return;}target.value=e.target;height.value=e.height;if(e.height>0){persistedHeight.value=e.height;}if(!IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS){animatedKeyboardHeight.value=withTiming(e.height,TELEGRAM_ANDROID_TIMING_CONFIG);}(_handler$onStart2=(_handler3=handler).onStart)===null||_handler$onStart2===void 0||_handler$onStart2.call(_handler3,{...e,duration:IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS?e.duration:TELEGRAM_ANDROID_TIMING_CONFIG.duration});}"
};
const __initData4 = {
code: "function pnpm_useSmoothKeyboardHandlerTs4(e){const{IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS,handler}=this.__closure;if(IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS){var _handler$onMove,_handler;(_handler$onMove=(_handler=handler).onMove)===null||_handler$onMove===void 0||_handler$onMove.call(_handler,e);}}"
};
const __initData5 = {
code: "function pnpm_useSmoothKeyboardHandlerTs5(e){const{IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS,handler}=this.__closure;if(IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS){var _handler$onEnd,_handler;(_handler$onEnd=(_handler=handler).onEnd)===null||_handler$onEnd===void 0||_handler$onEnd.call(_handler,e);}}"
};
export const useSmoothKeyboardHandler = (a0, a1) => {
let c13246_0 = a0;
const sharedValue = useSharedValue(-1);
const sharedValue2 = useSharedValue(0);
const sharedValue3 = useSharedValue(0);
const sharedValue4 = useSharedValue(0);
const r6 = function() {
if (!IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS && sharedValue3.value !== 0) {
return {
duration: TELEGRAM_ANDROID_TIMING_CONFIG.duration,
target: sharedValue.value,
height: sharedValue4.value,
progress: sharedValue4.value / sharedValue3.value
};
}
};
r6.__closure = {
IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS,
persistedHeight: sharedValue3,
TELEGRAM_ANDROID_TIMING_CONFIG,
target: sharedValue,
animatedKeyboardHeight: sharedValue4
};
r6.__workletHash = 4217597553195;
r6.__initData = __initData;
const I = function I(a0) {
if (a0) {
const onMove = c13246_0.onMove;
if (onMove != null) {
onMove.call(c13246_0, a0);
}
if (a0.height === sharedValue2.value) {
const onEnd = c13246_0.onEnd;
if (onEnd != null) {
onEnd.call(c13246_0, a0);
}
sharedValue3.value = sharedValue2.value;
}
}
};
I.__closure = {
handler: a0,
height: sharedValue2,
persistedHeight: sharedValue3
};
I.__workletHash = 1186520959152;
I.__initData = __initData2;
useAnimatedReaction(r6, I, a1 ? [...a1] : a1);
const v = function v(a0) {
if (!IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS && a0.height === sharedValue3.value) {
const onStart = c13246_0.onStart;
if (onStart != null) {
onStart.call(c13246_0, a0);
}
const onEnd = c13246_0.onEnd;
if (onEnd != null) {
onEnd.call(c13246_0, a0);
}
return void 0;
}
sharedValue.value = a0.target;
sharedValue2.value = a0.height;
if (a0.height > 0) {
sharedValue3.value = a0.height;
}
if (!IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {
sharedValue4.value = _Module1606.withTiming(a0.height, TELEGRAM_ANDROID_TIMING_CONFIG);
}
const onStart2 = c13246_0.onStart;
if (onStart2 != null) {
onStart2.call(c13246_0, {
...a0,
duration: IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS ? a0.duration : TELEGRAM_ANDROID_TIMING_CONFIG.duration
});
}
};
v.__closure = {
IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS,
persistedHeight: sharedValue3,
handler: a0,
target: sharedValue,
height: sharedValue2,
animatedKeyboardHeight: sharedValue4,
withTiming: _Module1606.withTiming,
TELEGRAM_ANDROID_TIMING_CONFIG
};
v.__workletHash = 2049629670138;
v.__initData = __initData3;
const R = function R(a0) {
if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {
const onMove = c13246_0.onMove;
if (onMove != null) {
onMove.call(c13246_0, a0);
}
}
};
R.__closure = {
IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS,
handler: a0
};
R.__workletHash = 16381726355375;
R.__initData = __initData4;
const O = function O(a0) {
if (IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS) {
const onEnd = c13246_0.onEnd;
if (onEnd != null) {
onEnd.call(c13246_0, a0);
}
}
};
O.__closure = {
IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS,
handler: a0
};
O.__workletHash = 9348108811600;
O.__initData = __initData5;
useKeyboardHandler({
onStart: v,
onMove: R,
onEnd: O
}, a1);
};