{"ast":null,"code":"\"use strict\";\n\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nconst _excluded = [\"children\", \"style\", \"visible\", \"size\"],\n  _excluded2 = [\"backgroundColor\"];\nimport { useTheme } from '@react-navigation/native';\nimport color from 'color';\nimport * as React from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport Platform from \"react-native-web/dist/exports/Platform\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useNativeDriver = Platform.OS !== 'web';\nexport function Badge(_ref) {\n  let {\n      children,\n      style,\n      visible = true,\n      size = 18\n    } = _ref,\n    rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n  const [opacity] = React.useState(() => new Animated.Value(visible ? 1 : 0));\n  const [rendered, setRendered] = React.useState(visible);\n  const {\n    colors,\n    fonts\n  } = useTheme();\n  React.useEffect(() => {\n    if (!rendered) {\n      return;\n    }\n    Animated.timing(opacity, {\n      toValue: visible ? 1 : 0,\n      duration: 150,\n      useNativeDriver\n    }).start(({\n      finished\n    }) => {\n      if (finished && !visible) {\n        setRendered(false);\n      }\n    });\n    return () => opacity.stopAnimation();\n  }, [opacity, rendered, visible]);\n  if (!rendered) {\n    if (visible) {\n      setRendered(true);\n    } else {\n      return null;\n    }\n  }\n  const _ref2 = StyleSheet.flatten(style) || {},\n    {\n      backgroundColor = colors.notification\n    } = _ref2,\n    restStyle = _objectWithoutPropertiesLoose(_ref2, _excluded2);\n  const textColor = color(backgroundColor).isLight() ? 'black' : 'white';\n  const borderRadius = size / 2;\n  const fontSize = Math.floor(size * 3 / 4);\n  return _jsx(Animated.Text, Object.assign({\n    numberOfLines: 1,\n    style: [{\n      transform: [{\n        scale: opacity.interpolate({\n          inputRange: [0, 1],\n          outputRange: [0.5, 1]\n        })\n      }],\n      color: textColor,\n      lineHeight: size - 1,\n      height: size,\n      minWidth: size,\n      opacity,\n      backgroundColor,\n      fontSize,\n      borderRadius\n    }, fonts.regular, styles.container, restStyle]\n  }, rest, {\n    children: children\n  }));\n}\nconst styles = StyleSheet.create({\n  container: {\n    alignSelf: 'flex-end',\n    textAlign: 'center',\n    paddingHorizontal: 4,\n    overflow: 'hidden'\n  }\n});","map":{"version":3,"names":["useTheme","color","React","Animated","Platform","StyleSheet","jsx","_jsx","useNativeDriver","OS","Badge","_ref","children","style","visible","size","rest","_objectWithoutPropertiesLoose","_excluded","opacity","useState","Value","rendered","setRendered","colors","fonts","useEffect","timing","toValue","duration","start","finished","stopAnimation","_ref2","flatten","backgroundColor","notification","restStyle","_excluded2","textColor","isLight","borderRadius","fontSize","Math","floor","Text","Object","assign","numberOfLines","transform","scale","interpolate","inputRange","outputRange","lineHeight","height","minWidth","regular","styles","container","create","alignSelf","textAlign","paddingHorizontal","overflow"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/@react-navigation/bottom-tabs/src/views/Badge.tsx"],"sourcesContent":["import { useTheme } from '@react-navigation/native';\nimport color from 'color';\nimport * as React from 'react';\nimport {\n  Animated,\n  Platform,\n  type StyleProp,\n  StyleSheet,\n  type TextProps,\n  type TextStyle,\n} from 'react-native';\n\ntype Props = TextProps & {\n  /**\n   * Whether the badge is visible\n   */\n  visible: boolean;\n  /**\n   * Content of the `Badge`.\n   */\n  children?: string | number;\n  /**\n   * Size of the `Badge`.\n   */\n  size?: number;\n  /**\n   * Style object for the tab bar container.\n   */\n  style?: Animated.WithAnimatedValue<StyleProp<TextStyle>>;\n};\n\nconst useNativeDriver = Platform.OS !== 'web';\n\nexport function Badge({\n  children,\n  style,\n  visible = true,\n  size = 18,\n  ...rest\n}: Props) {\n  const [opacity] = React.useState(() => new Animated.Value(visible ? 1 : 0));\n  const [rendered, setRendered] = React.useState(visible);\n\n  const { colors, fonts } = useTheme();\n\n  React.useEffect(() => {\n    if (!rendered) {\n      return;\n    }\n\n    Animated.timing(opacity, {\n      toValue: visible ? 1 : 0,\n      duration: 150,\n      useNativeDriver,\n    }).start(({ finished }) => {\n      if (finished && !visible) {\n        setRendered(false);\n      }\n    });\n\n    return () => opacity.stopAnimation();\n  }, [opacity, rendered, visible]);\n\n  if (!rendered) {\n    if (visible) {\n      setRendered(true);\n    } else {\n      return null;\n    }\n  }\n\n  // @ts-expect-error: backgroundColor definitely exists\n  const { backgroundColor = colors.notification, ...restStyle } =\n    StyleSheet.flatten(style) || {};\n  const textColor = color(backgroundColor).isLight() ? 'black' : 'white';\n\n  const borderRadius = size / 2;\n  const fontSize = Math.floor((size * 3) / 4);\n\n  return (\n    <Animated.Text\n      numberOfLines={1}\n      style={[\n        {\n          transform: [\n            {\n              scale: opacity.interpolate({\n                inputRange: [0, 1],\n                outputRange: [0.5, 1],\n              }),\n            },\n          ],\n          color: textColor,\n          lineHeight: size - 1,\n          height: size,\n          minWidth: size,\n          opacity,\n          backgroundColor,\n          fontSize,\n          borderRadius,\n        },\n        fonts.regular,\n        styles.container,\n        restStyle,\n      ]}\n      {...rest}\n    >\n      {children}\n    </Animated.Text>\n  );\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    alignSelf: 'flex-end',\n    textAlign: 'center',\n    paddingHorizontal: 4,\n    overflow: 'hidden',\n  },\n});\n"],"mappings":";;;;;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAAA,OAAAC,QAAA;AAAA,OAAAC,QAAA;AAAA,OAAAC,UAAA;AAQR,SAAAC,GAAA,IAAAC,IAAA;AAqBtB,MAAMC,eAAe,GAAGJ,QAAQ,CAACK,EAAE,KAAK,KAAK;AAE7C,OAAO,SAASC,KAAKA,CAAAC,IAAA,EAMX;EAAA,IANY;MACpBC,QAAQ;MACRC,KAAK;MACLC,OAAO,GAAG,IAAI;MACdC,IAAI,GAAG;IAEF,CAAC,GAAAJ,IAAA;IADHK,IAAA,GAAAC,6BAAA,CAAAN,IAAA,EAA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