"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.UiShellLogo = void 0;
var _styled = _interopRequireDefault(require("@emotion/styled"));
var _react = require("react");
var _OktaLogo = require("./SideNav/OktaLogo.cjs");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/*!
 * Copyright (c) 2024-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.
 */

const StyledLogoContainer = (0, _styled.default)("div", {
  shouldForwardProp: prop => prop !== "isLogoInteractive"
})(({
  isLogoInteractive
}) => ({
  alignItems: "center",
  display: "flex",
  height: "100%",
  ...(isLogoInteractive && {
    cursor: "pointer"
  })
}));
const StyledLogoLink = (0, _styled.default)("a")(() => ({
  alignItems: "center",
  display: "flex",
  height: "100%"
}));
const UiShellLogo = ({
  imageAltText,
  imageUrl,
  logoComponent,
  ...optionalProps
}) => {
  const logo = (0, _react.useMemo)(() => {
    if (logoComponent) {
      return logoComponent;
    }
    if (imageAltText && imageUrl) {
      return (0, _jsxRuntime.jsx)("img", {
        alt: imageAltText,
        src: imageUrl
      });
    }
    return (0, _jsxRuntime.jsx)(_OktaLogo.OktaLogo, {});
  }, [imageAltText, logoComponent, imageUrl]);
  return "href" in optionalProps && "ariaLabel" in optionalProps ? (0, _jsxRuntime.jsx)(StyledLogoLink, {
    "aria-label": optionalProps.ariaLabel,
    "data-se": "sidenav-header-logo",
    href: optionalProps.href,
    onClick: optionalProps.onClick,
    children: logo
  }) : (0, _jsxRuntime.jsx)(StyledLogoContainer, {
    "aria-label": optionalProps.ariaLabel,
    "data-se": "sidenav-header-logo",
    isLogoInteractive: Boolean(optionalProps.onClick) || optionalProps.href,
    onClick: optionalProps.onClick,
    role: "presentation",
    children: logo
  });
};
const MemoizedUiShellLogo = exports.UiShellLogo = (0, _react.memo)(UiShellLogo);
MemoizedUiShellLogo.displayName = "UiShellLogo";
//# sourceMappingURL=UiShellLogo.cjs.map