import React, { useMemo } from 'react';

// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
import { ThemeProvider } from '@emotion/react';
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
import { WidthConsumer } from '../WidthProvider';
export function mapBreakpointToLayoutMaxWidth(breakpoint) {
  switch (breakpoint) {
    case 'M':
    case 'L':
      return 760;
    default:
      return 680;
  }
}
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
export function BaseThemeWrapper(_ref) {
  var baseFontSize = _ref.baseFontSize,
    children = _ref.children;
  var memoizedTheme = useMemo(function () {
    return {
      baseFontSize: baseFontSize || 14,
      layoutMaxWidth: akEditorDefaultLayoutWidth
    };
  }, [baseFontSize]);
  return /*#__PURE__*/React.createElement(ThemeProvider, {
    theme: memoizedTheme
  }, children);
}
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
export function BaseTheme(_ref2) {
  var children = _ref2.children,
    baseFontSize = _ref2.baseFontSize;
  return /*#__PURE__*/React.createElement(WidthConsumer, null, function (_ref3) {
    var breakpoint = _ref3.breakpoint;
    return /*#__PURE__*/React.createElement(BaseThemeWrapper, {
      breakpoint: breakpoint,
      baseFontSize: baseFontSize
    }, /*#__PURE__*/React.createElement(React.Fragment, null, children));
  });
}