{"ast":null,"code":"import color from 'color';\nimport { black, white } from \"../../styles/themes/v2/colors\";\nexport const MIN_WIDTH = 112;\nexport const MAX_WIDTH = 280;\nconst getDisabledColor = theme => {\n  if (theme.isV3) {\n    return theme.colors.onSurfaceDisabled;\n  }\n  return color(theme.dark ? white : black).alpha(0.32).rgb().string();\n};\nconst getTitleColor = ({\n  theme,\n  disabled\n}) => {\n  if (disabled) {\n    return getDisabledColor(theme);\n  }\n  if (theme.isV3) {\n    return theme.colors.onSurface;\n  }\n  return color(theme.colors.text).alpha(0.87).rgb().string();\n};\nconst getIconColor = ({\n  theme,\n  disabled\n}) => {\n  if (disabled) {\n    return getDisabledColor(theme);\n  }\n  if (theme.isV3) {\n    return theme.colors.onSurfaceVariant;\n  }\n  return color(theme.colors.text).alpha(0.54).rgb().string();\n};\nconst getRippleColor = ({\n  theme,\n  customRippleColor\n}) => {\n  if (customRippleColor) {\n    return customRippleColor;\n  }\n  if (theme.isV3) {\n    return color(theme.colors.onSurfaceVariant).alpha(0.12).rgb().string();\n  }\n  return undefined;\n};\nexport const getMenuItemColor = ({\n  theme,\n  disabled,\n  customRippleColor\n}) => {\n  return {\n    titleColor: getTitleColor({\n      theme,\n      disabled\n    }),\n    iconColor: getIconColor({\n      theme,\n      disabled\n    }),\n    rippleColor: getRippleColor({\n      theme,\n      customRippleColor\n    })\n  };\n};\nexport const getContentMaxWidth = ({\n  isV3,\n  iconWidth,\n  leadingIcon,\n  trailingIcon\n}) => {\n  if (isV3) {\n    if (leadingIcon && trailingIcon) {\n      return MAX_WIDTH - (2 * iconWidth + 24);\n    }\n    if (leadingIcon || trailingIcon) {\n      return MAX_WIDTH - (iconWidth + 24);\n    }\n    return MAX_WIDTH - 12;\n  }\n  if (leadingIcon) {\n    return MAX_WIDTH - (iconWidth + 48);\n  }\n  return MAX_WIDTH - 16;\n};","map":{"version":3,"names":["color","black","white","MIN_WIDTH","MAX_WIDTH","getDisabledColor","theme","isV3","colors","onSurfaceDisabled","dark","alpha","rgb","string","getTitleColor","disabled","onSurface","text","getIconColor","onSurfaceVariant","getRippleColor","customRippleColor","undefined","getMenuItemColor","titleColor","iconColor","rippleColor","getContentMaxWidth","iconWidth","leadingIcon","trailingIcon"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/Menu/utils.ts"],"sourcesContent":["import type { ColorValue } from 'react-native';\n\nimport color from 'color';\n\nimport { black, white } from '../../styles/themes/v2/colors';\nimport type { InternalTheme } from '../../types';\nimport type { IconSource } from '../Icon';\n\nexport const MIN_WIDTH = 112;\nexport const MAX_WIDTH = 280;\n\ntype ContentProps = {\n  isV3: boolean;\n  iconWidth: number;\n  leadingIcon?: IconSource;\n  trailingIcon?: IconSource;\n};\n\ntype ColorProps = {\n  theme: InternalTheme;\n  disabled?: boolean;\n  customRippleColor?: ColorValue;\n};\n\nconst getDisabledColor = (theme: InternalTheme) => {\n  if (theme.isV3) {\n    return theme.colors.onSurfaceDisabled;\n  }\n\n  return color(theme.dark ? white : black)\n    .alpha(0.32)\n    .rgb()\n    .string();\n};\n\nconst getTitleColor = ({ theme, disabled }: ColorProps) => {\n  if (disabled) {\n    return getDisabledColor(theme);\n  }\n\n  if (theme.isV3) {\n    return theme.colors.onSurface;\n  }\n\n  return color(theme.colors.text).alpha(0.87).rgb().string();\n};\n\nconst getIconColor = ({ theme, disabled }: ColorProps) => {\n  if (disabled) {\n    return getDisabledColor(theme);\n  }\n\n  if (theme.isV3) {\n    return theme.colors.onSurfaceVariant;\n  }\n\n  return color(theme.colors.text).alpha(0.54).rgb().string();\n};\n\nconst getRippleColor = ({\n  theme,\n  customRippleColor,\n}: Omit<ColorProps, 'disabled'>) => {\n  if (customRippleColor) {\n    return customRippleColor;\n  }\n\n  if (theme.isV3) {\n    return color(theme.colors.onSurfaceVariant).alpha(0.12).rgb().string();\n  }\n\n  return undefined;\n};\n\nexport const getMenuItemColor = ({\n  theme,\n  disabled,\n  customRippleColor,\n}: ColorProps) => {\n  return {\n    titleColor: getTitleColor({ theme, disabled }),\n    iconColor: getIconColor({ theme, disabled }),\n    rippleColor: getRippleColor({ theme, customRippleColor }),\n  };\n};\n\nexport const getContentMaxWidth = ({\n  isV3,\n  iconWidth,\n  leadingIcon,\n  trailingIcon,\n}: ContentProps) => {\n  if (isV3) {\n    if (leadingIcon && trailingIcon) {\n      return MAX_WIDTH - (2 * iconWidth + 24);\n    }\n\n    if (leadingIcon || trailingIcon) {\n      return MAX_WIDTH - (iconWidth + 24);\n    }\n\n    return MAX_WIDTH - 12;\n  }\n\n  if (leadingIcon) {\n    return MAX_WIDTH - (iconWidth + 48);\n  }\n\n  return MAX_WIDTH - 16;\n};\n"],"mappings":"AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,EAAEC,KAAK;AAIrB,OAAO,MAAMC,SAAS,GAAG,GAAG;AAC5B,OAAO,MAAMC,SAAS,GAAG,GAAG;AAe5B,MAAMC,gBAAgB,GAAIC,KAAoB,IAAK;EACjD,IAAIA,KAAK,CAACC,IAAI,EAAE;IACd,OAAOD,KAAK,CAACE,MAAM,CAACC,iBAAiB;EACvC;EAEA,OAAOT,KAAK,CAACM,KAAK,CAACI,IAAI,GAAGR,KAAK,GAAGD,KAAK,CAAC,CACrCU,KAAK,CAAC,IAAI,CAAC,CACXC,GAAG,CAAC,CAAC,CACLC,MAAM,CAAC,CAAC;AACb,CAAC;AAED,MAAMC,aAAa,GAAGA,CAAC;EAAER,KAAK;EAAES;AAAqB,CAAC,KAAK;EACzD,IAAIA,QAAQ,EAAE;IACZ,OAAOV,gBAAgB,CAACC,KAAK,CAAC;EAChC;EAEA,IAAIA,KAAK,CAACC,IAAI,EAAE;IACd,OAAOD,KAAK,CAACE,MAAM,CAACQ,SAAS;EAC/B;EAEA,OAAOhB,KAAK,CAACM,KAAK,CAACE,MAAM,CAACS,IAAI,CAAC,CAACN,KAAK,CAAC,IAAI,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,MAAM,CA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