"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Header = exports.HeaderBase = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const core_1 = require("../core");
const utils_1 = require("../utils");
const context_1 = require("./context");
const headerAccount_1 = __importDefault(require("./headerAccount"));
const headerAccountUserInfo_1 = __importDefault(require("./headerAccountUserInfo"));
const headerApplicationName_1 = __importDefault(require("./headerApplicationName"));
const headerContent_1 = __importDefault(require("./headerContent"));
const headerCreateAccount_1 = __importDefault(require("./headerCreateAccount"));
const headerDivider_1 = __importDefault(require("./headerDivider"));
const headerLinkItem_1 = __importDefault(require("./headerLinkItem"));
const headerLogo_1 = __importDefault(require("./headerLogo"));
const headerMainLinks_1 = __importDefault(require("./headerMainLinks"));
const headerMobileContent_1 = __importDefault(require("./headerMobileContent"));
const headerMobileToggle_1 = __importDefault(require("./headerMobileToggle"));
const headerNotifications_1 = __importDefault(require("./headerNotifications"));
const headerServices_1 = __importDefault(require("./headerServices"));
const headerServicesMessage_1 = __importDefault(require("./headerServicesMessage"));
const headerSignIn_1 = __importDefault(require("./headerSignIn"));
const headerSupport_1 = __importDefault(require("./headerSupport"));
/*@formatter:off*/
exports.HeaderBase = core_1.styled.headerBox `
  align-items: center;
  background-color: white;
  border-bottom: 1px solid darkBlue.main;
  display: flex;
  position: relative;
`;
/*@formatter:on*/
/** Branded Veracity Header with logo, links, services, account and other data. Controls max-width of the content. */
exports.Header = (0, core_1.vui)((props, ref) => {
    const { className, isSticky, size, variant } = props, rest = __rest(props, ["className", "isSticky", "size", "variant"]);
    const [isMobileOpen, setIsMobileOpen] = (0, react_1.useState)(false);
    const mobileContentRef = (0, react_1.useRef)(null);
    const mobileToggleRef = (0, react_1.useRef)(null);
    const styles = (0, core_1.useStyleConfig)('Header', props);
    const headerHeight = 72;
    const [links] = (0, core_1.useLinks)();
    (0, utils_1.useClickOutside)([mobileContentRef, mobileToggleRef], () => {
        setIsMobileOpen(false);
    });
    const isDesktop = (0, core_1.useUp)('lg');
    const isMobile = !isDesktop;
    const context = {
        headerHeight,
        isDesktop,
        isMobile,
        isMobileOpen,
        links,
        mobileContentRef,
        mobileToggleRef,
        setIsMobileOpen,
        size,
        variant,
    };
    return ((0, jsx_runtime_1.jsx)(context_1.HeaderProvider, { value: context, children: (0, jsx_runtime_1.jsx)(exports.HeaderBase, Object.assign({ className: (0, utils_1.cs)('vui-header', className), h: headerHeight, position: isSticky ? 'sticky' : 'static', px: { xs: 2, lg: 5 }, ref: ref, role: "banner", top: isSticky ? 0 : 'auto' }, styles.container, rest)) }));
});
exports.Header.Account = headerAccount_1.default;
exports.Header.AccountUserInfo = headerAccountUserInfo_1.default;
exports.Header.Support = headerSupport_1.default;
exports.Header.ApplicationName = headerApplicationName_1.default;
exports.Header.Content = headerContent_1.default;
exports.Header.CreateAccount = headerCreateAccount_1.default;
exports.Header.Divider = headerDivider_1.default;
exports.Header.LinkItem = headerLinkItem_1.default;
exports.Header.Logo = headerLogo_1.default;
exports.Header.MainLinks = headerMainLinks_1.default;
exports.Header.MobileContent = headerMobileContent_1.default;
exports.Header.MobileToggle = headerMobileToggle_1.default;
exports.Header.Notifications = headerNotifications_1.default;
exports.Header.Services = headerServices_1.default;
exports.Header.ServicesMessage = headerServicesMessage_1.default;
exports.Header.SignIn = headerSignIn_1.default;
exports.Header.displayName = 'Header';
exports.default = exports.Header;
//# sourceMappingURL=header.js.map