{"version":3,"file":"assign-aside-variables.cjs","names":["getResizedValue","isPrimitiveSize","rem","getBaseSize","isResponsiveSize","getBreakpointValue"],"sources":["../../../../../src/components/AppShell/AppShellMediaStyles/assign-aside-variables/assign-aside-variables.ts"],"sourcesContent":["import { getBreakpointValue, keys, MantineTheme, rem } from '../../../../core';\nimport type { AppShellProps } from '../../AppShell';\nimport { getBaseSize } from '../get-base-size/get-base-size';\nimport { getResizedValue } from '../get-resized-value/get-resized-value';\nimport type { CSSVariables, MediaQueryVariables } from '../get-variables/get-variables';\nimport { isPrimitiveSize } from '../is-primitive-size/is-primitive-size';\nimport { isResponsiveSize } from '../is-responsive-size/is-responsive-size';\n\ninterface AssignAsideVariablesInput {\n  baseStyles: CSSVariables;\n  minMediaStyles: MediaQueryVariables;\n  maxMediaStyles: MediaQueryVariables;\n  aside: AppShellProps['aside'] | undefined;\n  theme: MantineTheme;\n  mode: 'fixed' | 'static';\n  resizedSize?: number;\n  resizable?: boolean;\n}\n\nexport function assignAsideVariables({\n  baseStyles,\n  minMediaStyles,\n  maxMediaStyles,\n  aside,\n  theme,\n  mode,\n  resizedSize,\n  resizable,\n}: AssignAsideVariablesInput) {\n  const asideWidth = aside?.width;\n  const collapsedAsideTransform = 'translateX(var(--app-shell-aside-width))';\n  const collapsedAsideTransformRtl = 'translateX(calc(var(--app-shell-aside-width) * -1))';\n\n  if (aside?.breakpoint !== undefined && !aside?.collapsed?.mobile) {\n    maxMediaStyles[aside?.breakpoint] = maxMediaStyles[aside?.breakpoint] || {};\n    if (mode === 'fixed') {\n      maxMediaStyles[aside?.breakpoint]['--app-shell-aside-width'] = '100%';\n      maxMediaStyles[aside?.breakpoint]['--app-shell-aside-offset'] = '0px';\n    } else {\n      maxMediaStyles[aside?.breakpoint]['--app-shell-aside-width'] = '0px';\n      maxMediaStyles[aside?.breakpoint]['--app-shell-aside-offset'] = '0px';\n    }\n    if (resizable) {\n      maxMediaStyles[aside.breakpoint]['--app-shell-aside-resize-handle-display'] = 'none';\n    }\n  }\n\n  if (resizedSize !== undefined) {\n    const resizedValue = getResizedValue(resizedSize, 'horizontal');\n    baseStyles['--app-shell-aside-width'] = resizedValue;\n    baseStyles['--app-shell-aside-offset'] = resizedValue;\n    if (mode === 'static') {\n      baseStyles['--app-shell-aside-grid-width'] = resizedValue;\n    }\n  } else {\n    if (isPrimitiveSize(asideWidth)) {\n      const baseSize = rem(getBaseSize(asideWidth));\n      baseStyles['--app-shell-aside-width'] = baseSize;\n      baseStyles['--app-shell-aside-offset'] = baseSize;\n    }\n\n    if (isResponsiveSize(asideWidth)) {\n      if (typeof asideWidth.base !== 'undefined') {\n        baseStyles['--app-shell-aside-width'] = rem(asideWidth.base);\n        baseStyles['--app-shell-aside-offset'] = rem(asideWidth.base);\n      }\n\n      keys(asideWidth).forEach((key) => {\n        if (key !== 'base') {\n          minMediaStyles[key] = minMediaStyles[key] || {};\n          minMediaStyles[key]['--app-shell-aside-width'] = rem(asideWidth![key]);\n          minMediaStyles[key]['--app-shell-aside-offset'] = rem(asideWidth![key]);\n        }\n      });\n    }\n  }\n\n  if (aside?.breakpoint !== undefined && mode === 'static') {\n    minMediaStyles[aside.breakpoint] = minMediaStyles[aside.breakpoint] || {};\n    minMediaStyles[aside.breakpoint]['--app-shell-aside-position'] = 'sticky';\n    minMediaStyles[aside.breakpoint]['--app-shell-aside-grid-row'] = '2';\n    minMediaStyles[aside.breakpoint]['--app-shell-aside-grid-column'] = '3';\n    // Adjust main column end when aside is visible\n    minMediaStyles[aside.breakpoint]['--app-shell-main-column-end'] = '3';\n  }\n\n  if (aside?.collapsed?.desktop) {\n    const breakpointValue = aside!.breakpoint;\n    minMediaStyles[breakpointValue] = minMediaStyles[breakpointValue] || {};\n    minMediaStyles[breakpointValue]['--app-shell-aside-transform'] = collapsedAsideTransform;\n    minMediaStyles[breakpointValue]['--app-shell-aside-transform-rtl'] = collapsedAsideTransformRtl;\n    if (mode === 'fixed') {\n      minMediaStyles[breakpointValue]['--app-shell-aside-offset'] = '0px !important';\n    } else {\n      minMediaStyles[breakpointValue]['--app-shell-aside-width'] = '0px';\n      minMediaStyles[breakpointValue]['--app-shell-aside-display'] = 'none';\n      minMediaStyles[breakpointValue]['--app-shell-main-column-end'] = '-1';\n    }\n    minMediaStyles[breakpointValue]['--app-shell-aside-scroll-locked-visibility'] = 'hidden';\n    if (resizable) {\n      minMediaStyles[breakpointValue]['--app-shell-aside-resize-handle-display'] = 'none';\n    }\n  }\n\n  if (aside?.collapsed?.mobile) {\n    const breakpointValue = getBreakpointValue(aside!.breakpoint, theme.breakpoints) - 0.1;\n    maxMediaStyles[breakpointValue] = maxMediaStyles[breakpointValue] || {};\n    if (mode === 'fixed') {\n      maxMediaStyles[breakpointValue]['--app-shell-aside-width'] = '100%';\n      maxMediaStyles[breakpointValue]['--app-shell-aside-offset'] = '0px';\n    } else {\n      maxMediaStyles[breakpointValue]['--app-shell-aside-width'] = '0px';\n    }\n    maxMediaStyles[breakpointValue]['--app-shell-aside-transform'] = collapsedAsideTransform;\n    maxMediaStyles[breakpointValue]['--app-shell-aside-transform-rtl'] = collapsedAsideTransformRtl;\n    maxMediaStyles[breakpointValue]['--app-shell-aside-scroll-locked-visibility'] = 'hidden';\n    if (resizable) {\n      maxMediaStyles[breakpointValue]['--app-shell-aside-resize-handle-display'] = 'none';\n    }\n  }\n}\n"],"mappings":";;;;;;;;;AAmBA,SAAgB,qBAAqB,EACnC,YACA,gBACA,gBACA,OACA,OACA,MACA,aACA,aAC4B;CAC5B,MAAM,aAAa,OAAO;CAC1B,MAAM,0BAA0B;CAChC,MAAM,6BAA6B;CAEnC,IAAI,OAAO,eAAe,KAAA,KAAa,CAAC,OAAO,WAAW,QAAQ;EAChE,eAAe,OAAO,cAAc,eAAe,OAAO,eAAe,CAAC;EAC1E,IAAI,SAAS,SAAS;GACpB,eAAe,OAAO,WAAW,CAAC,6BAA6B;GAC/D,eAAe,OAAO,WAAW,CAAC,8BAA8B;EAClE,OAAO;GACL,eAAe,OAAO,WAA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