{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nimport color from 'color';\nimport { black, white } from \"../../styles/themes/v2/colors\";\nexport var getCardCoverStyle = function getCardCoverStyle(_ref) {\n  var theme = _ref.theme,\n    index = _ref.index,\n    total = _ref.total,\n    borderRadiusStyles = _ref.borderRadiusStyles;\n  var isV3 = theme.isV3,\n    roundness = theme.roundness;\n  if (Object.keys(borderRadiusStyles).length > 0) {\n    return _objectSpread({\n      borderRadius: 3 * roundness\n    }, borderRadiusStyles);\n  }\n  if (isV3) {\n    return {\n      borderRadius: 3 * roundness\n    };\n  }\n  if (index === 0) {\n    if (total === 1) {\n      return {\n        borderRadius: roundness\n      };\n    }\n    return {\n      borderTopLeftRadius: roundness,\n      borderTopRightRadius: roundness\n    };\n  }\n  if (typeof total === 'number' && index === total - 1) {\n    return {\n      borderBottomLeftRadius: roundness\n    };\n  }\n  return undefined;\n};\nvar getBorderColor = function getBorderColor(_ref2) {\n  var theme = _ref2.theme;\n  if (theme.isV3) {\n    return theme.colors.outline;\n  }\n  if (theme.dark) {\n    return color(white).alpha(0.12).rgb().string();\n  }\n  return color(black).alpha(0.12).rgb().string();\n};\nvar getBackgroundColor = function getBackgroundColor(_ref3) {\n  var theme = _ref3.theme,\n    isMode = _ref3.isMode;\n  if (theme.isV3) {\n    if (isMode('contained')) {\n      return theme.colors.surfaceVariant;\n    }\n    if (isMode('outlined')) {\n      return theme.colors.surface;\n    }\n  }\n  return undefined;\n};\nexport var getCardColors = function getCardColors(_ref4) {\n  var theme = _ref4.theme,\n    mode = _ref4.mode;\n  var isMode = function isMode(modeToCompare) {\n    return mode === modeToCompare;\n  };\n  return {\n    backgroundColor: getBackgroundColor({\n      theme: theme,\n      isMode: isMode\n    }),\n    borderColor: getBorderColor({\n      theme: theme\n    })\n  };\n};","map":{"version":3,"names":["color","black","white","getCardCoverStyle","_ref","theme","index","total","borderRadiusStyles","isV3","roundness","Object","keys","length","_objectSpread","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","undefined","getBorderColor","_ref2","colors","outline","dark","alpha","rgb","string","getBackgroundColor","_ref3","isMode","surfaceVariant","surface","getCardColors","_ref4","mode","modeToCompare","backgroundColor","borderColor"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/Card/utils.tsx"],"sourcesContent":["import type { StyleProp, 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 CardMode = 'elevated' | 'outlined' | 'contained';\n\ntype BorderRadiusStyles = Pick<\n  ViewStyle,\n  Extract<keyof ViewStyle, `border${string}Radius`>\n>;\n\nexport type CardActionChildProps = {\n  compact?: boolean;\n  mode?: string;\n  style?: StyleProp<ViewStyle>;\n};\n\nexport const getCardCoverStyle = ({\n  theme,\n  index,\n  total,\n  borderRadiusStyles,\n}: {\n  theme: InternalTheme;\n  borderRadiusStyles: BorderRadiusStyles;\n  index?: number;\n  total?: number;\n}) => {\n  const { isV3, roundness } = theme;\n\n  if (Object.keys(borderRadiusStyles).length > 0) {\n    return {\n      borderRadius: 3 * roundness,\n      ...borderRadiusStyles,\n    };\n  }\n\n  if (isV3) {\n    return {\n      borderRadius: 3 * roundness,\n    };\n  }\n\n  if (index === 0) {\n    if (total === 1) {\n      return {\n        borderRadius: roundness,\n      };\n    }\n\n    return {\n      borderTopLeftRadius: roundness,\n      borderTopRightRadius: roundness,\n    };\n  }\n\n  if (typeof total === 'number' && index === total - 1) {\n    return {\n      borderBottomLeftRadius: roundness,\n    };\n  }\n\n  return undefined;\n};\n\nconst getBorderColor = ({ theme }: { theme: InternalTheme }) => {\n  if (theme.isV3) {\n    return theme.colors.outline;\n  }\n\n  if (theme.dark) {\n    return color(white).alpha(0.12).rgb().string();\n  }\n  return color(black).alpha(0.12).rgb().string();\n};\n\nconst getBackgroundColor = ({\n  theme,\n  isMode,\n}: {\n  theme: InternalTheme;\n  isMode: (mode: CardMode) => boolean;\n}) => {\n  if (theme.isV3) {\n    if (isMode('contained')) {\n      return theme.colors.surfaceVariant;\n    }\n    if (isMode('outlined')) {\n      return theme.colors.surface;\n    }\n  }\n  return undefined;\n};\n\nexport const getCardColors = ({\n  theme,\n  mode,\n}: {\n  theme: InternalTheme;\n  mode: CardMode;\n}) => {\n  const isMode = (modeToCompare: CardMode) => {\n    return mode === modeToCompare;\n  };\n\n  return {\n    backgroundColor: getBackgroundColor({\n      theme,\n      isMode,\n    }),\n    borderColor: getBorderColor({ theme }),\n  };\n};\n"],"mappings":";;;AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,EAAEC,KAAK;AAgBrB,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAUxB;EAAA,IATJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,kBAAA,GAAAJ,IAAA,CAAAI,kBAAA;EAOA,IAAQC,IAAI,GAAgBJ,KAAK,CAAzBI,IAAI;IAAEC,SAAA,GAAcL,KAAK,CAAnBK,SAAA;EAEd,IAAIC,MAAM,CAACC,IAAI,CAACJ,kBAAkB,CAAC,CAACK,MAA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