{"version":3,"file":"assign-footer-variables.cjs","names":["isPrimitiveSize","rem","getBaseSize","isResponsiveSize"],"sources":["../../../../../src/components/AppShell/AppShellMediaStyles/assign-footer-variables/assign-footer-variables.ts"],"sourcesContent":["import { keys, rem } from '../../../../core';\nimport type { AppShellProps } from '../../AppShell';\nimport { getBaseSize } from '../get-base-size/get-base-size';\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 AssignFooterVariablesInput {\n  baseStyles: CSSVariables;\n  minMediaStyles: MediaQueryVariables;\n  footer: AppShellProps['footer'] | undefined;\n  mode: 'fixed' | 'static';\n}\n\nexport function assignFooterVariables({\n  baseStyles,\n  minMediaStyles,\n  footer,\n  mode,\n}: AssignFooterVariablesInput) {\n  const footerHeight = footer?.height;\n  const collapsedFooterTransform = 'translateY(var(--app-shell-footer-height))';\n  const shouldOffset = mode === 'static' ? true : (footer?.offset ?? true);\n\n  if (mode === 'static' && footer) {\n    baseStyles['--app-shell-footer-position'] = 'sticky';\n    baseStyles['--app-shell-footer-grid-column'] = '1 / -1';\n    baseStyles['--app-shell-footer-grid-row'] = '3';\n  }\n\n  if (isPrimitiveSize(footerHeight)) {\n    const baseSize = rem(getBaseSize(footerHeight));\n    baseStyles['--app-shell-footer-height'] = baseSize;\n    if (shouldOffset) {\n      baseStyles['--app-shell-footer-offset'] = baseSize;\n    }\n  }\n\n  if (isResponsiveSize(footerHeight)) {\n    if (typeof footerHeight.base !== 'undefined') {\n      baseStyles['--app-shell-footer-height'] = rem(footerHeight.base);\n\n      if (shouldOffset) {\n        baseStyles['--app-shell-footer-offset'] = rem(footerHeight.base);\n      }\n    }\n\n    keys(footerHeight).forEach((key) => {\n      if (key !== 'base') {\n        minMediaStyles[key] = minMediaStyles[key] || {};\n        minMediaStyles[key]['--app-shell-footer-height'] = rem(footerHeight[key]);\n\n        if (shouldOffset) {\n          minMediaStyles[key]['--app-shell-footer-offset'] = rem(footerHeight[key]);\n        }\n      }\n    });\n  }\n\n  if (footer?.collapsed) {\n    baseStyles['--app-shell-footer-transform'] = collapsedFooterTransform;\n    if (mode === 'fixed') {\n      baseStyles['--app-shell-footer-offset'] = '0px !important';\n    }\n  }\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,sBAAsB,EACpC,YACA,gBACA,QACA,QAC6B;CAC7B,MAAM,eAAe,QAAQ;CAC7B,MAAM,2BAA2B;CACjC,MAAM,eAAe,SAAS,WAAW,OAAQ,QAAQ,UAAU;CAEnE,IAAI,SAAS,YAAY,QAAQ;EAC/B,WAAW,iCAAiC;EAC5C,WAAW,oCAAoC;EAC/C,WAAW,iCAAiC;CAC9C;CAEA,IAAIA,0BAAAA,gBAAgB,YAAY,GAAG;EACjC,MAAM,WAAWC,YAAAA,IAAIC,sBAAAA,YAAY,YAAY,CAAC;EAC9C,WAAW,+BAA+B;EAC1C,IAAI,cACF,WAAW,+BAA+B;CAE9C;CAEA,IAAIC,2BAAAA,iBAAiB,YAAY,GAAG;EAClC,IAAI,OAAO,aAAa,SAAS,aAAa;GAC5C,WAAW,+BAA+BF,YAAAA,IAAI,aAAa,IAAI;GAE/D,IAAI,cACF,WAAW,+BAA+BA,YAAAA,IAAI,aAAa,IAAI;EAEnE;EAEA,aAAA,KAAK,YAAY,EAAE,SAAS,QAAQ;GAClC,IAAI,QAAQ,QAAQ;IAClB,eAAe,OAAO,eAAe,QAAQ,CAAC;IAC9C,eAAe,KAAK,+BAA+BA,YAAAA,IAAI,aAAa,IAAI;IAExE,IAAI,cACF,eAAe,KAAK,+BAA+BA,YAAAA,IAAI,aAAa,IAAI;GAE5E;EACF,CAAC;CACH;CAEA,IAAI,QAAQ,WAAW;EACrB,WAAW,kCAAkC;EAC7C,IAAI,SAAS,SACX,WAAW,+BAA+B;CAE9C;AACF"}