{"ast":null,"code":"import StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport color from 'color';\nimport { black, white } from \"../../styles/themes/v2/colors\";\nconst DEFAULT_PADDING = 9;\nexport const getSegmentedButtonDensityPadding = ({\n  density\n}) => {\n  let padding = DEFAULT_PADDING;\n  switch (density) {\n    case 'small':\n      return padding - 2;\n    case 'medium':\n      return padding - 4;\n    case 'high':\n      return padding - 8;\n    default:\n      return padding;\n  }\n};\nexport const getDisabledSegmentedButtonStyle = ({\n  theme,\n  index,\n  buttons\n}) => {\n  var _buttons$index, _buttons;\n  const width = getSegmentedButtonBorderWidth({\n    theme\n  });\n  const isDisabled = (_buttons$index = buttons[index]) === null || _buttons$index === void 0 ? void 0 : _buttons$index.disabled;\n  const isNextDisabled = (_buttons = buttons[index + 1]) === null || _buttons === void 0 ? void 0 : _buttons.disabled;\n  if (!isDisabled && isNextDisabled) {\n    return {\n      borderRightWidth: width\n    };\n  }\n  return {};\n};\nexport const getSegmentedButtonBorderRadius = ({\n  segment,\n  theme\n}) => {\n  if (segment === 'first') {\n    return Object.assign({\n      borderTopRightRadius: 0,\n      borderBottomRightRadius: 0\n    }, theme.isV3 && {\n      borderEndWidth: 0\n    });\n  } else if (segment === 'last') {\n    return {\n      borderTopLeftRadius: 0,\n      borderBottomLeftRadius: 0\n    };\n  } else {\n    return Object.assign({\n      borderRadius: 0\n    }, theme.isV3 && {\n      borderEndWidth: 0\n    });\n  }\n};\nconst getSegmentedButtonBackgroundColor = ({\n  checked,\n  theme\n}) => {\n  if (checked) {\n    if (theme.isV3) {\n      return theme.colors.secondaryContainer;\n    } else {\n      return color(theme.colors.primary).alpha(0.12).rgb().string();\n    }\n  }\n  return 'transparent';\n};\nconst getSegmentedButtonBorderColor = ({\n  theme,\n  disabled,\n  checked\n}) => {\n  if (theme.isV3) {\n    if (disabled) {\n      return theme.colors.surfaceDisabled;\n    }\n    return theme.colors.outline;\n  }\n  if (checked) {\n    return theme.colors.primary;\n  }\n  return color(theme.dark ? white : black).alpha(0.29).rgb().string();\n};\nconst getSegmentedButtonBorderWidth = ({\n  theme\n}) => {\n  if (theme.isV3) {\n    return 1;\n  }\n  return StyleSheet.hairlineWidth;\n};\nconst getSegmentedButtonTextColor = ({\n  theme,\n  disabled,\n  checked,\n  checkedColor,\n  uncheckedColor\n}) => {\n  if (theme.isV3) {\n    if (disabled) {\n      return theme.colors.onSurfaceDisabled;\n    }\n    if (checked) {\n      return checkedColor ?? theme.colors.onSecondaryContainer;\n    }\n    return uncheckedColor ?? theme.colors.onSurface;\n  }\n  if (disabled) {\n    return theme.colors.disabled;\n  }\n  return theme.colors.primary;\n};\nexport const getSegmentedButtonColors = ({\n  theme,\n  disabled,\n  checked,\n  checkedColor,\n  uncheckedColor\n}) => {\n  const backgroundColor = getSegmentedButtonBackgroundColor({\n    theme,\n    checked\n  });\n  const borderColor = getSegmentedButtonBorderColor({\n    theme,\n    disabled,\n    checked\n  });\n  const textColor = getSegmentedButtonTextColor({\n    theme,\n    disabled,\n    checked,\n    checkedColor,\n    uncheckedColor\n  });\n  const borderWidth = getSegmentedButtonBorderWidth({\n    theme\n  });\n  return {\n    backgroundColor,\n    borderColor,\n    textColor,\n    borderWidth\n  };\n};","map":{"version":3,"names":["color","black","white","DEFAULT_PADDING","getSegmentedButtonDensityPadding","density","padding","getDisabledSegmentedButtonStyle","theme","index","buttons","_buttons$index","_buttons","width","getSegmentedButtonBorderWidth","isDisabled","disabled","isNextDisabled","borderRightWidth","getSegmentedButtonBorderRadius","segment","Object","assign","borderTopRightRadius","borderBottomRightRadius","isV3","borderEndWidth","borderTopLeftRadius","borderBottomLeftRadius","borderRadius","getSegmentedButtonBackgroundColor","checked","colors","secondaryContainer","primary","alpha","rgb","string","getSegmentedButtonBorderColor","surfaceDisabled","outline","dark","StyleSheet","hairlineWidth","getSegmentedButtonTextColor","checkedColor","uncheckedColor","onSurfaceDisabled","onSecondaryContainer","onSurface","getSegmentedButtonColors","backgroundColor","borderColor","textColor","borderWidth"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/SegmentedButtons/utils.ts"],"sourcesContent":["import { StyleSheet, ViewStyle } from 'react-native';\n\nimport color from 'color';\n\nimport { black, white } from '../../styles/themes/v2/colors';\nimport type { InternalTheme } from '../../types';\n\ntype BaseProps = {\n  theme: InternalTheme;\n  disabled?: boolean;\n  checked: boolean;\n};\n\ntype SegmentedButtonProps = {\n  checkedColor?: string;\n  uncheckedColor?: string;\n} & BaseProps;\n\nconst DEFAULT_PADDING = 9;\n\nexport const getSegmentedButtonDensityPadding = ({\n  density,\n}: {\n  density?: 'regular' | 'small' | 'medium' | 'high';\n}) => {\n  let padding = DEFAULT_PADDING;\n\n  switch (density) {\n    case 'small':\n      return padding - 2;\n    case 'medium':\n      return padding - 4;\n    case 'high':\n      return padding - 8;\n    default:\n      return padding;\n  }\n};\n\nexport const getDisabledSegmentedButtonStyle = ({\n  theme,\n  index,\n  buttons,\n}: {\n  theme: InternalTheme;\n  buttons: { disabled?: boolean }[];\n  index: number;\n}): ViewStyle => {\n  const width = getSegmentedButtonBorderWidth({ theme });\n  const isDisabled = buttons[index]?.disabled;\n  const isNextDisabled = buttons[index + 1]?.disabled;\n\n  if (!isDisabled && isNextDisabled) {\n    return {\n      borderRightWidth: width,\n    };\n  }\n  return {};\n};\n\nexport const getSegmentedButtonBorderRadius = ({\n  segment,\n  theme,\n}: {\n  theme: InternalTheme;\n  segment?: 'first' | 'last';\n}): ViewStyle => {\n  if (segment === 'first') {\n    return {\n      borderTopRightRadius: 0,\n      borderBottomRightRadius: 0,\n      ...(theme.isV3 && { borderEndWidth: 0 }),\n    };\n  } else if (segment === 'last') {\n    return {\n      borderTopLeftRadius: 0,\n      borderBottomLeftRadius: 0,\n    };\n  } else {\n    return {\n      borderRadius: 0,\n      ...(theme.isV3 && { borderEndWidth: 0 }),\n    };\n  }\n};\n\nconst getSegmentedButtonBackgroundColor = ({ checked, theme }: BaseProps) => {\n  if (checked) {\n    if (theme.isV3) {\n      return theme.colors.secondaryContainer;\n    } else {\n      return color(theme.colors.primary).alpha(0.12).rgb().string();\n    }\n  }\n  return 'transparent';\n};\n\nconst getSegmentedButtonBorderColor = ({\n  theme,\n  disabled,\n  checked,\n}: BaseProps) => {\n  if (theme.isV3) {\n    if (disabled) {\n      return theme.colors.surfaceDisabled;\n    }\n    return theme.colors.outline;\n  }\n  if (checked) {\n    return theme.colors.primary;\n  }\n\n  return color(theme.dark ? white : black)\n    .alpha(0.29)\n    .rgb()\n    .string();\n};\n\nconst getSegmentedButtonBorderWidth = ({\n  theme,\n}: Omit<BaseProps, 'disabled' | 'checked'>) => {\n  if (theme.isV3) {\n    return 1;\n  }\n\n  return StyleSheet.hairlineWidth;\n};\n\nconst getSegmentedButtonTextColor = ({\n  theme,\n  disabled,\n  checked,\n  checkedColor,\n  uncheckedColor,\n}: SegmentedButtonProps) => {\n  if (theme.isV3) {\n    if (disabled) {\n      return theme.colors.onSurfaceDisabled;\n    }\n    if (checked) {\n      return checkedColor ?? theme.colors.onSecondaryContainer;\n    }\n    return uncheckedColor ?? theme.colors.onSurface;\n  }\n\n  if (disabled) {\n    return theme.colors.disabled;\n  }\n  // Primary color is used for checked state too.\n  return theme.colors.primary;\n};\n\nexport const getSegmentedButtonColors = ({\n  theme,\n  disabled,\n  checked,\n  checkedColor,\n  uncheckedColor,\n}: SegmentedButtonProps) => {\n  const backgroundColor = getSegmentedButtonBackgroundColor({\n    theme,\n    checked,\n  });\n  const borderColor = getSegmentedButtonBorderColor({\n    theme,\n    disabled,\n    checked,\n  });\n  const textColor = getSegmentedButtonTextColor({\n    theme,\n    disabled,\n    checked,\n    checkedColor,\n    uncheckedColor,\n  });\n  const borderWidth = getSegmentedButtonBorderWidth({ theme });\n\n  return { backgroundColor, borderColor, textColor, borderWidth };\n};\n"],"mappings":";AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,EAAEC,KAAK;AAcrB,MAAMC,eAAe,GA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