{"version":3,"file":"get-box-style.cjs","names":[],"sources":["../../../../src/core/Box/get-box-style/get-box-style.ts"],"sourcesContent":["import type { MantineTheme } from '../../MantineProvider';\nimport type { CssVarsProp, MantineStyleProp } from '../Box.types';\n\ninterface GetBoxStyleOptions {\n  theme: MantineTheme;\n  styleProps: React.CSSProperties;\n  style?: MantineStyleProp;\n  vars?: CssVarsProp;\n}\n\nfunction mergeStyles(\n  styles: MantineStyleProp | CssVarsProp | undefined,\n  theme: MantineTheme\n): React.CSSProperties {\n  if (Array.isArray(styles)) {\n    return [...styles].reduce<Record<string, any>>(\n      (acc, item) => ({ ...acc, ...mergeStyles(item, theme) }),\n      {}\n    );\n  }\n\n  if (typeof styles === 'function') {\n    return styles(theme);\n  }\n\n  if (styles == null) {\n    return {};\n  }\n\n  return styles;\n}\n\nexport function getBoxStyle({\n  theme,\n  style,\n  vars,\n  styleProps,\n}: GetBoxStyleOptions): React.CSSProperties {\n  const _style = mergeStyles(style, theme);\n  const _vars = mergeStyles(vars, theme);\n  return { ..._style, ..._vars, ...styleProps };\n}\n"],"mappings":";;AAUA,SAAS,YACP,QACA,OACqB;CACrB,IAAI,MAAM,QAAQ,MAAM,GACtB,OAAO,CAAC,GAAG,MAAM,EAAE,QAChB,KAAK,UAAU;EAAE,GAAG;EAAK,GAAG,YAAY,MAAM,KAAK;CAAE,IACtD,CAAC,CACH;CAGF,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,KAAK;CAGrB,IAAI,UAAU,MACZ,OAAO,CAAC;CAGV,OAAO;AACT;AAEA,SAAgB,YAAY,EAC1B,OACA,OACA,MACA,cAC0C;CAC1C,MAAM,SAAS,YAAY,OAAO,KAAK;CACvC,MAAM,QAAQ,YAAY,MAAM,KAAK;CACrC,OAAO;EAAE,GAAG;EAAQ,GAAG;EAAO,GAAG;CAAW;AAC9C"}