// Module ID: 11475 // Function ID: 11476 // Name: getChatInputMaxHeight // Dependencies: [32, 19, 1496, 11453, 1895, 5549, 4309, 1627, 1494, 11476, 11477, 11478, 4446, 4449, 4185, 2] // Exports: default, getChatInputHeightAnimationTiming, getChatInputHeightAnimationTimingWorklet, getChatInputMinHeight // Module 11475 (getChatInputMaxHeight) import useWindowDimensions from "useWindowDimensions" /* 1494 */; import KeyboardTypes from "KeyboardTypes" /* 1627 */; import useSystemKeyboardHeight from "useSystemKeyboardHeight" /* 1895 */; import useKeyboardType from "useKeyboardType" /* 4309 */; import useCustomKeyboardHeight from "useCustomKeyboardHeight" /* 5549 */; import mutable from "mutable" /* 11476 */; import mutable2 from "mutable" /* 11477 */; import closure_3 from "_slicedToArray" /* 32 */; import closure_4 from "noop" /* 19 */; import closure_5 from "subscribeToKeyboardUIStore" /* 1496 */; import { CHAT_INPUT_PILL_CONTENT_SIZE } from "TextAreaCta" /* 11453 */; require = arg1; function getChatInputMaxHeight() { let systemKeyboardHeight = useSystemKeyboardHeight.getSystemKeyboardHeight(); const obj = useSystemKeyboardHeight; const tmp = require; const customKeyboardHeight = useCustomKeyboardHeight.getCustomKeyboardHeight(); const obj2 = useCustomKeyboardHeight; const keyboardType = useKeyboardType.getKeyboardType(); if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) { systemKeyboardHeight = customKeyboardHeight; } const obj3 = useKeyboardType; return Math.min(c6, Math.max(2 * CHAT_INPUT_PILL_CONTENT_SIZE, useWindowDimensions.getWindowDimensions({ ignoreKeyboard: true }).height - systemKeyboardHeight - c6)); } let c6 = 200; function getChatInputMaxHeightWorklet() { const keyboardStateWorklet = mutable.getKeyboardStateWorklet(); ({ keyboardHeight, customKeyboardHeight, keyboardType } = keyboardStateWorklet); if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) { keyboardHeight = customKeyboardHeight; } const obj = mutable; const tmp = require; return Math.min(c6, Math.max(2 * CHAT_INPUT_PILL_CONTENT_SIZE, mutable2.getWindowDimensionsWorklet({ ignoreKeyboard: true }).height - keyboardHeight - c6)); } let obj = { getKeyboardStateWorklet: require("mutable").getKeyboardStateWorklet, KeyboardTypes: require("KeyboardTypes").KeyboardTypes, getWindowDimensionsWorklet: require("mutable").getWindowDimensionsWorklet, MAX_HEIGHT: 200, MIN_HEIGHT: CHAT_INPUT_PILL_CONTENT_SIZE }; getChatInputMaxHeightWorklet.__closure = obj; getChatInputMaxHeightWorklet.__workletHash = 13025947543230; getChatInputMaxHeightWorklet.__initData = { code: "function getChatInputMaxHeightWorklet_useChatInputMaxHeightTsx1(){const{getKeyboardStateWorklet,KeyboardTypes,getWindowDimensionsWorklet,MAX_HEIGHT,MIN_HEIGHT}=this.__closure;const{keyboardHeight:keyboardHeightSystem,customKeyboardHeight:customKeyboardHeight,keyboardType:keyboardType}=getKeyboardStateWorklet();const keyboardHeight=keyboardType!==KeyboardTypes.SYSTEM?customKeyboardHeight:keyboardHeightSystem;const window=getWindowDimensionsWorklet({ignoreKeyboard:true});const windowHeightNoKeyboard=window.height-keyboardHeight;return Math.min(MAX_HEIGHT,Math.max(MIN_HEIGHT*2,windowHeightNoKeyboard-MAX_HEIGHT));}" }; function getChatInputHeightAnimationTimingWorklet(height, textFieldMinHeight) { const bound = Math.max(height, textFieldMinHeight); if (typeof getChatInputMaxHeightWorklet !== "function") { HermesBuiltin.throwTypeError(); } let obj = mutable; const keyboardStateWorklet = obj.getKeyboardStateWorklet(); ({ keyboardHeight, customKeyboardHeight, keyboardType } = keyboardStateWorklet); if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) { keyboardHeight = customKeyboardHeight; } let tmp2Result = tmp2(11477); const bound1 = Math.min(bound, Math.min(c6, Math.max(2 * CHAT_INPUT_PILL_CONTENT_SIZE, tmp2Result.getWindowDimensionsWorklet({ ignoreKeyboard: true }).height - keyboardHeight - c6))); tmp2Result = tmp2(4446); obj = { duration: tmp2(4449).timingFastDuration, easing: tmp2(4185).Easing.linear }; return tmp2Result.withTiming(bound1, obj); } obj = { getChatInputMaxHeightWorklet, withTiming: require("CONFIG_NEVER_ANIMATE_TIMING").withTiming, timingFastDuration: require("timingNone").timingFastDuration, Easing: require("module_4185").Easing }; getChatInputHeightAnimationTimingWorklet.__closure = obj; getChatInputHeightAnimationTimingWorklet.__workletHash = 17042993287975; getChatInputHeightAnimationTimingWorklet.__initData = { code: "function getChatInputHeightAnimationTimingWorklet_useChatInputMaxHeightTsx2(contentSize,minHeight){const{getChatInputMaxHeightWorklet,withTiming,timingFastDuration,Easing}=this.__closure;const value=Math.min(Math.max(contentSize,minHeight),getChatInputMaxHeightWorklet());return withTiming(value,{duration:timingFastDuration,easing:Easing.linear});}" }; const result = require("set").fileFinishedImporting("modules/chat_input/native/useChatInputMaxHeight.tsx"); export default function useChatInputMaxHeight(arg0) { closure_0 = arg0; let tmp = callback(React.useState(getChatInputMaxHeight), 2); closure_1 = tmp[1]; const items = [arg0]; const effect = React.useEffect(() => { function maybeUpdateMaxHeight() { callback2((arg0) => { let systemKeyboardHeight = closure_1_0(closure_1_2[4]).getSystemKeyboardHeight(); const obj = closure_1_0(closure_1_2[4]); const tmp = closure_1_0; const tmp2 = closure_1_2; const customKeyboardHeight = closure_1_0(closure_1_2[5]).getCustomKeyboardHeight(); const obj2 = closure_1_0(closure_1_2[5]); const keyboardType = closure_1_0(closure_1_2[6]).getKeyboardType(); if (keyboardType !== closure_1_0(closure_1_2[7]).KeyboardTypes.SYSTEM) { systemKeyboardHeight = customKeyboardHeight; } let tmp6 = arg0; const obj3 = closure_1_0(closure_1_2[6]); const bound = Math.min(closure_1_6, Math.max(2 * closure_1_7, tmp(tmp2[8]).getWindowDimensions({ ignoreKeyboard: true }).height - systemKeyboardHeight - closure_1_6)); if (arg0 !== bound) { tmp6 = bound; if (callback != null) { callback(); tmp6 = bound; } } return tmp6; }); } closure_0 = callback(closure_1_2[11])(maybeUpdateMaxHeight); callback = closure_1_5(maybeUpdateMaxHeight); return () => { callback(); callback2(); }; }, items); return tmp[0]; }; export function getChatInputMinHeight() { return CHAT_INPUT_PILL_CONTENT_SIZE; } export { getChatInputMaxHeight }; export { getChatInputMaxHeightWorklet }; export const getChatInputHeightAnimationTiming = function getChatInputHeightAnimationTiming(height, closure_8) { const bound = Math.max(height, closure_8); let obj = useSystemKeyboardHeight; let systemKeyboardHeight = obj.getSystemKeyboardHeight(); const customKeyboardHeight = useCustomKeyboardHeight.getCustomKeyboardHeight(); const obj2 = useCustomKeyboardHeight; const keyboardType = useKeyboardType.getKeyboardType(); if (keyboardType !== KeyboardTypes.KeyboardTypes.SYSTEM) { systemKeyboardHeight = customKeyboardHeight; } let tmp2Result = tmp2(1494); const bound1 = Math.min(bound, Math.min(c6, Math.max(2 * CHAT_INPUT_PILL_CONTENT_SIZE, tmp2Result.getWindowDimensions({ ignoreKeyboard: true }).height - systemKeyboardHeight - c6))); tmp2Result = tmp2(4446); obj = { duration: tmp2(4449).timingFastDuration, easing: tmp2(4185).Easing.linear }; return tmp2Result.withTiming(bound1, obj); }; export { getChatInputHeightAnimationTimingWorklet };