/*!
 * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
 *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */

import styled from "@emotion/styled";
import { memo } from "react";
import { useOdysseyDesignTokens } from "../../OdysseyDesignTokensContext.js";
import { useUiShellContext } from "../../ui-shell/UiShellProvider.js";
import { TOP_NAV_HEIGHT, UI_SHELL_BASE_Z_INDEX } from "../uiShellSharedConstants.js";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const StyledLeftSideContainer = styled("div")(() => ({
  flexGrow: 1
}));
const StyledRightSideContainer = styled("div")(() => ({
  flexShrink: 0
}));
const StyledTopNavContainer = styled("div", {
  shouldForwardProp: prop => prop !== "odysseyDesignTokens" && prop !== "topNavBackgroundColor"
})(({
  odysseyDesignTokens,
  topNavBackgroundColor
}) => ({
  alignItems: "center",
  backgroundColor: topNavBackgroundColor,
  display: "flex",
  gap: odysseyDesignTokens.Spacing4,
  height: "100%",
  justifyContent: "space-between",
  maxHeight: TOP_NAV_HEIGHT,
  minHeight: TOP_NAV_HEIGHT,
  paddingBlock: odysseyDesignTokens.Spacing2,
  paddingInline: odysseyDesignTokens.Spacing8,
  position: "relative",
  transition: `box-shadow ${odysseyDesignTokens.TransitionDurationMain} ${odysseyDesignTokens.TransitionTimingMain}`,
  zIndex: UI_SHELL_BASE_Z_INDEX,
  ...(topNavBackgroundColor === odysseyDesignTokens.HueNeutralWhite && {
    borderBottom: `${odysseyDesignTokens.BorderWidthMain} ${odysseyDesignTokens.BorderStyleMain} ${odysseyDesignTokens.HueNeutral100}`
  })
}));
const TopNav = ({
  leftSideComponent,
  rightSideComponent
}) => {
  const odysseyDesignTokens = useOdysseyDesignTokens();
  const uiShellContext = useUiShellContext();
  return _jsxs(StyledTopNavContainer, {
    odysseyDesignTokens: odysseyDesignTokens,
    topNavBackgroundColor: uiShellContext?.topNavBackgroundColor,
    children: [_jsx(StyledLeftSideContainer, {
      children: leftSideComponent ?? _jsx("div", {})
    }), _jsx(StyledRightSideContainer, {
      children: rightSideComponent ?? _jsx("div", {})
    })]
  });
};
const MemoizedTopNav = memo(TopNav);
MemoizedTopNav.displayName = "TopNav";
export { MemoizedTopNav as TopNav };
//# sourceMappingURL=TopNav.js.map