// Metro module 15465 (f15466).
import { memo, useEffect } from "react";
import { ActivityIndicator } from "react-native";
import SearchMessageStore from "../../../SearchMessageStore";
import SearchQueryStore from "../../stores/SearchQueryStore";
import { SEARCH_MESSAGE_TAB_SENTINEL } from "../../../SearchConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../../_bundle/defaultAreStatesEqual";
import { getSearchTabFetchId } from "../../../SearchUtils";
import * as _ReanimatedRexport from "../../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../../reanimated/ReanimatedRexport";
import { withTiming } from "../../../../../design/animation/reanimated/timing/timing";
import { MagnifyingGlassIcon } from "../../../../../design/components/Icon/native/redesign/generated/MagnifyingGlassIcon";
import { isAndroid } from "../../../../../utils/PlatformUtils";
const useStyles = createStyles({
spinnerColor: {
color: Module712.colors.INTERACTIVE_TEXT_DEFAULT
},
spinner: {
width: 18,
height: 18,
alignItems: "center",
justifyContent: "center",
position: "absolute"
},
icon: {
marginLeft: 12,
marginRight: 4
}
});
let c11001_12 = {
START: 0,
0: "START",
END: 1,
1: "END"
};
const ANIMATION_STATE_INPUT = [c11001_12.START, c11001_12.END];
const __initData = {
code: "function SearchBarActivityIconTsx1(){const{interpolate,fadeAnimationState,ANIMATION_STATE_INPUT}=this.__closure;return{opacity:interpolate(fadeAnimationState.get(),ANIMATION_STATE_INPUT,[0,0.5])};}"
};
const __initData2 = {
code: "function SearchBarActivityIconTsx2(){const{interpolate,fadeAnimationState,ANIMATION_STATE_INPUT}=this.__closure;return{opacity:interpolate(fadeAnimationState.get(),ANIMATION_STATE_INPUT,[1,0])};}"
};
const r54 = memo(function SearchBarActivityIcon(props) {
let sharedValue;
const searchContext = props.searchContext;
sharedValue = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([SearchQueryStore, SearchMessageStore], () => {
const isInitialFetchComplete = SearchMessageStore.getIsInitialFetchComplete(getSearchTabFetchId(searchContext, SEARCH_MESSAGE_TAB_SENTINEL, SearchQueryStore.getSearchResultsQuery(searchContext)));
let r18 = !isInitialFetchComplete;
const isInitialSearchQuery = SearchQueryStore.isInitialSearchQuery(searchContext);
const isAutocompleteVisible = SearchQueryStore.isAutocompleteVisible(searchContext);
if (!isInitialFetchComplete) {
r18 = !isInitialSearchQuery;
}
if (r18) {
r18 = !isAutocompleteVisible;
}
return r18;
}, [searchContext]);
sharedValue = useSharedValue(c11001_12.START);
useEffect(() => {
if (stateFromStores) {
sharedValue.set(withTiming(c11001_12.END));
} else {
sharedValue.set(withTiming(c11001_12.START));
}
}, [stateFromStores, sharedValue]);
const E = function E() {
return {
opacity: _ReanimatedRexport.interpolate(sharedValue.get(), ANIMATION_STATE_INPUT, [0, 0.5])
};
};
E.__closure = {
interpolate: _ReanimatedRexport.interpolate,
fadeAnimationState: sharedValue,
ANIMATION_STATE_INPUT
};
E.__workletHash = 12880513119188;
E.__initData = __initData;
const animatedStyle = useAnimatedStyle(E);
const v = function v() {
return {
opacity: _ReanimatedRexport.interpolate(sharedValue.get(), ANIMATION_STATE_INPUT, [1, 0])
};
};
v.__closure = {
interpolate: _ReanimatedRexport.interpolate,
fadeAnimationState: sharedValue,
ANIMATION_STATE_INPUT
};
v.__workletHash = 11061952032557;
v.__initData = __initData2;
return <>
{[
,
]}
>;
});
export default r54;