Files
discord-decomp/sources/by-id/module-01823-useSmoothKeyboardHandler.js
T
2026-07-28 01:06:53 +03:00

181 lines
11 KiB
JavaScript

/* Metro module 1823; source: unknown; dependencies: [65, 27, 1610, 1804] */
import Module00065 from './module-00065.js'; /* Metro dependency 65 */
import * as ReactNativeModule from './module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as moduleValue5 from './module-01610.js'; /* Metro dependency 1610 */
import * as moduleValue6 from './module-01804.js'; /* Metro dependency 1804 */
function _fun19890(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#19890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1950:6, offset: 0x00eb7319, size: 293 bytes, params: 8, frame: 21
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Platform = (ReactNativeModule).Platform;
const Version = Platform.Version;
const env0_3 = Version >= 30 || false;
object = {duration: 250};
const Easing = (moduleValue5).Easing;
object.easing = Easing.bezier(0.19919472913616398, 0.010644531250000006, 0.27920937042459737, 0.91025390625);
object = {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;}'};
object = {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;}}'};
object = {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});}'};
object = {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);}}'};
object = {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);}}'};
exports.useSmoothKeyboardHandler = useSmoothKeyboardHandler;
function useSmoothKeyboardHandler(a0, a1) { // fn#19891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1950:2880, offset: 0x00eb743e, size: 550 bytes, params: 3, frame: 28
const value = a1;
const env0_0 = a0;
const value3 = (moduleValue5).useSharedValue(-1);
const value4 = (moduleValue5).useSharedValue(0);
const env0_2 = value4;
const value5 = (moduleValue5).useSharedValue(0);
const env0_3 = value5;
const value6 = (moduleValue5).useSharedValue(0);
const env0_4 = value6;
const useAnimatedReaction = moduleValue5.useAnimatedReaction;
let closure = pnpm_useSmoothKeyboardHandlerTs1;
closure.__closure = {IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS: env0_3, persistedHeight: value5,
TELEGRAM_ANDROID_TIMING_CONFIG: env0_4, target: value3, animatedKeyboardHeight: value6};
closure.__workletHash = 4217597553195;
closure.__initData = env0_5;
const pnpm_useSmoothKeyboardHandlerTs22 = pnpm_useSmoothKeyboardHandlerTs2;
pnpm_useSmoothKeyboardHandlerTs22.__closure = {handler: a0, height: value4, persistedHeight: value5};
pnpm_useSmoothKeyboardHandlerTs22.__workletHash = 1186520959152;
pnpm_useSmoothKeyboardHandlerTs22.__initData = env0_6;
Reflect.apply(useAnimatedReaction, moduleValue5, [closure, pnpm_useSmoothKeyboardHandlerTs22,
value && env0_2(value)]);
const useKeyboardHandler = moduleValue6.useKeyboardHandler;
object = {};
closure = onStart_19894;
const object2 = {IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS: env0_3, persistedHeight: value5, handler: a0, target: value3,
height: value4, animatedKeyboardHeight: value6};
object2.withTiming = moduleValue5.withTiming;
object2.TELEGRAM_ANDROID_TIMING_CONFIG = env0_4;
closure.__closure = object2;
closure.__workletHash = 2049629670138;
closure.__initData = env0_7;
object.onStart = closure;
closure = onMove_19895;
closure.__closure = {IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS: env0_3, handler: a0};
closure.__workletHash = 16381726355375;
closure.__initData = env0_8;
object.onMove = closure;
closure = onEnd_19896;
closure.__closure = {IS_ANDROID_ELEVEN_OR_HIGHER_OR_IOS: env0_3, handler: a0};
closure.__workletHash = 9348108811600;
closure.__initData = env0_9;
object.onEnd = closure;
Reflect.apply(useKeyboardHandler, moduleValue6, [object, value]);
function pnpm_useSmoothKeyboardHandlerTs1() { // fn#19892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1950:3078, owner: useSmoothKeyboardHandler.pnpm_useSmoothKeyboardHandlerTs1, offset: 0x00eb7664, size: 99 bytes, params: 1, frame: 4
const value = environment.__proto__;
if (env1_3) {
return undefined;
}
if (env0_3.value === 0) {
return undefined;
}
const binding = env0_4;
return {duration: env1_4.duration, target: env0_1.value, height: binding.value,
progress: binding.value / env0_3.value};
}
function pnpm_useSmoothKeyboardHandlerTs2(a0) { // fn#19893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1950:3412, owner: useSmoothKeyboardHandler.pnpm_useSmoothKeyboardHandlerTs2, offset: 0x00eb76c7, size: 110 bytes, params: 2, frame: 13
if (a0) {
if (env0_0.onMove != null) {
env0_0.onMove(a0);
}
if (a0.height === env0_2.value) {
if (env0_0.onEnd != null) {
env0_0.onEnd(a0);
}
env0_3.value = env0_2.value;
}
}
}
function useSmoothKeyboardHandlerOnStart(a0) { // fn#19894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1950:3702, owner: useSmoothKeyboardHandler.onStart, offset: 0x00eb7735, size: 306 bytes, params: 2, frame: 18
var height;
var onStart;
var binding;
var moduleValue;
var Object;
if (env1_3) {
binding = env0_1;
binding.value = a0.target;
binding = env0_2;
height = a0.height;
binding.value = height;
height = a0.height;
if (height > 0) {
env0_3.value = a0.height;
}
if (!env1_3) {
binding = env0_4;
moduleValue = require(1610) /* metro dependency 1610 */;
binding.value = moduleValue.withTiming(a0.height, env1_4);
}
onStart = env0_0.onStart;
if (onStart != null) {
binding = env0_0;
onStart = binding.onStart;
Object = global.Object;
Reflect.apply(onStart, binding, [Object.assign({}, a0,
{duration: env1_3 ? a0.duration : env1_4.duration})]);
}
} else {
height = a0.height;
if (height !== env0_3.value) {
binding = env0_1;
binding.value = a0.target;
binding = env0_2;
height = a0.height;
binding.value = height;
height = a0.height;
if (height > 0) {
env0_3.value = a0.height;
}
if (!env1_3) {
binding = env0_4;
moduleValue = require(1610) /* metro dependency 1610 */;
binding.value = moduleValue.withTiming(a0.height, env1_4);
}
onStart = env0_0.onStart;
if (onStart != null) {
binding = env0_0;
onStart = binding.onStart;
Object = global.Object;
Reflect.apply(onStart, binding, [Object.assign({}, a0,
{duration: env1_3 ? a0.duration : env1_4.duration})]);
}
return undefined;
}
onStart = env0_0.onStart;
if (onStart != null) {
env0_0.onStart(a0);
}
if (env0_0.onEnd != null) {
env0_0.onEnd(a0);
}
}
}
function useSmoothKeyboardHandlerOnMove(a0) { // fn#19895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1950:4278, owner: useSmoothKeyboardHandler.onMove, offset: 0x00eb7867, size: 51 bytes, params: 2, frame: 11
if (env1_3) {
if (env0_0.onMove != null) {
env0_0.onMove(a0);
}
}
}
function useSmoothKeyboardHandlerOnEnd(a0) { // fn#19896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1950:4475, owner: useSmoothKeyboardHandler.onEnd, offset: 0x00eb789a, size: 51 bytes, params: 2, frame: 11
if (env1_3) {
if (env0_0.onEnd != null) {
env0_0.onEnd(a0);
}
}
}
}
}
global.__d(_fun19890, 1823, [65, 27, 1610, 1804]) /* metro module 1823, dependencies: [65, 27, 1610, 1804] */;