import { Fragment, h, Host, } from "@stencil/core";
import { FetchHelper } from "../../../globals/FetchHelper";
import { state as headerState, } from "../pn-marketweb-siteheader/pn-marketweb-siteheader-store";
import { PnMarketwebHeaderService, } from "./services/pn-marketweb-header.service";
import { defaultHeaderI18n } from "./utils/header-i18n";
import { prependHomeMenuItem } from "./utils/header-menu";
import { resolveHeaderMenuThemes, } from "./utils/header-theme";
import { extractToggleableMenuStructure, getToggleRootForMenuItems, getVisibleMenuGroupsForMode, } from "./utils/header-toggle-menu";
import { resolveInitialHeaderMenuMode, storeHeaderMenuMode, } from "./utils/header-toggle-menu.storage";
import { navigateToMenuItem } from "./utils/header-url";
/**
 * New marketweb header wrapper.
 *
 * Responsibilities:
 * - resolve runtime context
 * - fetch header data
 * - map backend data into a renderable view model
 * - render the layout using existing leaf/header components
 * - owns the active menu mode when a switchable menu structure exists
 */
export class PnMarketwebHeader {
    constructor() {
        this.initialActiveMenuMode = 0;
        this.menuThemes = undefined;
        this.market = null;
        this.language = null;
        this.environment = null;
        this.endpoint = null;
        this.siteid = null;
        this.pageId = '';
        this.userToken = '';
        this.userFullname = '';
        this.userLoggedin = false;
        this.hideSiteSelector = false;
        this.hideHomeMenuItem = false;
        this.hideLanguageSelector = false;
        this.hideSearch = false;
        this.hideLogin = false;
        this.showProfileSelection = false;
        this.showUnifiedLogin = false;
        this.siteDomainInUrls = false;
        this.autocompleteEndpoint = '';
        this.sessionForward = false;
        this.cache = false;
        this.searchPlaceholder = '';
        this.spaMode = false;
        this.checkUserLoggedInStateInterval = 0;
        this.useMarketwebLogin = false;
        this.navigateOnMenuToggle = true;
        this.vm = null;
        this.i18n = defaultHeaderI18n;
        this.status = 'loading';
        this.minimizeSearch = false;
        this.loggedIn = false;
        this.activeMenuMode = 0;
    }
    hostElement;
    /** Guard used to prevent watchers from reloading during initial setup. */
    isInitializing = false;
    /** Cached raw backend payload so UI-only prop changes can remap without refetching. */
    rawHeaderData = null;
    /** Main nav element reference used for overflow calculation. */
    mainNavEl;
    /** Emitted when the language changes. */
    changeLanguage;
    /** Emitted when the market changes. */
    changeMarket;
    /** Shared helper for backend requests. */
    fetchHelper = new FetchHelper('marketweb-header');
    /** Service for context resolution and header-data fetching. */
    headerService = new PnMarketwebHeaderService(this.fetchHelper);
    hasResolvedInitialMenuMode = false;
    async componentWillLoad() {
        await this.loadHeader();
    }
    onLanguageSelectorChange(e) {
        this.language = e.detail;
        window.dispatchEvent(new CustomEvent('marketweb-languagechange', { detail: this.language }));
    }
    async onLanguageChange() {
        if (this.isInitializing || !this.language) {
            return;
        }
        this.changeLanguage.emit(this.language);
        await this.loadHeader();
    }
    async onMarketChange() {
        if (this.isInitializing || !this.market) {
            return;
        }
        this.changeMarket.emit(this.market);
        await this.loadHeader();
    }
    async onEnvironmentChange() {
        if (this.isInitializing || !this.environment) {
            return;
        }
        await this.loadHeader();
    }
    async onEndpointChange() {
        if (this.isInitializing) {
            return;
        }
        await this.loadHeader();
    }
    async onPageIdChange() {
        if (this.isInitializing) {
            return;
        }
        await this.loadHeader();
    }
    onPresentationInputChange() {
        if (this.isInitializing) {
            return;
        }
        this.remapViewModel();
    }
    onLoginStateChange(e) {
        if (typeof e.detail?.loggedIn === 'boolean') {
            this.loggedIn = e.detail.loggedIn;
        }
        if (e.detail?.loggedIn && e.detail?.token && this.sessionForward) {
            try {
                // fetch('/api/userprofile/sync?token=' + e.detail.token);
            }
            catch {
                // ignored intentionally
            }
        }
    }
    handleResize() {
        requestAnimationFrame(() => {
            this.checkMenuOverflow();
        });
    }
    get menuThemeList() {
        return resolveHeaderMenuThemes(this.menuThemes, this.vm?.menuModeOptions);
    }
    get logoUrl() {
        return this.vm?.menuModeOptions?.[this.activeMenuMode]?.href ?? '/';
    }
    async loadHeader() {
        this.status = 'loading';
        this.isInitializing = true;
        try {
            const result = await this.headerService.loadHeaderState({
                market: this.market,
                language: this.language,
                environment: this.environment,
                endpoint: this.endpoint,
                pageId: this.pageId,
                cache: this.cache,
                hideHomeMenuItem: this.hideHomeMenuItem,
                siteDomainInUrls: this.siteDomainInUrls,
                autocompleteEndpoint: this.autocompleteEndpoint,
                searchPlaceholder: this.searchPlaceholder,
            });
            this.applyHeaderState(result);
            requestAnimationFrame(() => {
                this.checkMenuOverflow();
            });
        }
        catch (error) {
            console.error('[pn-marketweb-header] Failed to load header', error);
            this.rawHeaderData = null;
            this.vm = null;
            this.status = 'error';
        }
        finally {
            this.isInitializing = false;
        }
    }
    remapViewModel() {
        const context = {
            market: this.market,
            language: this.language,
            environment: this.environment,
            endpoint: this.endpoint,
            pageId: this.pageId ?? '',
        };
        const result = this.headerService.remapHeaderState({
            context,
            rawHeaderData: this.rawHeaderData,
            language: this.language,
            hideHomeMenuItem: this.hideHomeMenuItem,
            siteDomainInUrls: this.siteDomainInUrls,
            autocompleteEndpoint: this.autocompleteEndpoint,
            searchPlaceholder: this.searchPlaceholder,
            currentActiveMenuMode: this.activeMenuMode,
        });
        this.applyHeaderState(result);
        requestAnimationFrame(() => {
            this.checkMenuOverflow();
        });
    }
    applyHeaderState(result) {
        this.market = result.context.market;
        this.language = result.context.language;
        this.environment = result.context.environment;
        this.endpoint = result.context.endpoint;
        this.rawHeaderData = result.rawHeaderData;
        this.vm = result.vm;
        this.i18n = result.i18n;
        this.status = result.status;
        if (!result.vm?.hasMenuSwitching) {
            this.activeMenuMode = 0;
            this.hasResolvedInitialMenuMode = false;
        }
        else if (!this.hasResolvedInitialMenuMode) {
            this.activeMenuMode = resolveInitialHeaderMenuMode(true, this.initialActiveMenuMode);
            this.hasResolvedInitialMenuMode = true;
        }
        if (headerState.loginManager && result.vm?.siteDefinition?.url) {
            headerState.loginManager.setSiteUrl(result.vm.siteDefinition.url);
        }
    }
    checkMenuOverflow() {
        const mainNavEl = this.mainNavEl;
        if (!mainNavEl) {
            return;
        }
        const firstMenuLevel = mainNavEl.querySelector('pn-mainnav-level');
        if (!firstMenuLevel) {
            return;
        }
        const navContainer = firstMenuLevel.parentElement;
        if (!navContainer) {
            return;
        }
        const availableWidth = navContainer.clientWidth;
        const requiredWidth = firstMenuLevel.scrollWidth;
        this.minimizeSearch = requiredWidth > availableWidth;
    }
    isUserLoggedIn() {
        return this.loggedIn || this.userLoggedin;
    }
    adjustSiteSelectorUrl(href) {
        if (!this.isUserLoggedIn()) {
            return href;
        }
        const loginDomains = ['portal.postnord.com'];
        const matchedHref = loginDomains.some(domain => href.includes(domain));
        if (!matchedHref) {
            return href;
        }
        if (headerState.loginManager) {
            return headerState.loginManager.getLoginUrl(href);
        }
        return href;
    }
    onMenuToggleChange = (e) => {
        const nextMode = e.detail;
        if (nextMode === this.activeMenuMode) {
            return;
        }
        this.activeMenuMode = nextMode;
        storeHeaderMenuMode(nextMode);
        if (!this.navigateOnMenuToggle || !this.vm?.rawMenuItems.length) {
            return;
        }
        const targetRoot = getToggleRootForMenuItems(this.vm.rawMenuItems, nextMode);
        navigateToMenuItem(targetRoot);
    };
    getVisibleMenuGroups(vm) {
        if (!vm.rawMenuItems.length) {
            return {
                primaryItems: vm.menuItems,
                sharedItems: [],
            };
        }
        const structure = extractToggleableMenuStructure(vm.rawMenuItems);
        if (structure.modeRoots.length === 0) {
            return {
                primaryItems: vm.menuItems,
                sharedItems: [],
            };
        }
        const groups = getVisibleMenuGroupsForMode(vm.rawMenuItems, this.activeMenuMode);
        return {
            primaryItems: prependHomeMenuItem(groups.primaryItems, this.i18n, vm.siteDefinition?.url ?? '/', this.hideHomeMenuItem),
            sharedItems: groups.sharedItems,
        };
    }
    render() {
        const vm = this.vm;
        const i18n = this.i18n;
        const activeTheme = this.menuThemeList[this.activeMenuMode] ?? 'private';
        const logoUrl = this.logoUrl;
        const menuGroups = vm
            ? this.getVisibleMenuGroups(vm)
            : { primaryItems: [], sharedItems: [] };
        return (h(Host, { key: '77b50a06702c9c8aee59392c7ebcf392d0e93ace', language: this.language ?? undefined, market: this.market ?? undefined, environment: this.environment ?? undefined, "data-status": this.status, "data-mode": this.activeMenuMode, "data-theme": activeTheme }, h("header", { key: 'f17a9126e62264bcbc596802394d8a0eb64809d7' }, vm && (h(Fragment, { key: 'e4d0c6cbb175bd545c37011e8a26040e293b5078' }, h("pn-marketweb-header-top-row", { key: 'f20e51e813cd52f09a223d860e04759f9d277183', vm: vm, i18n: i18n, language: this.language ?? undefined, siteid: this.siteid ?? undefined, endpoint: this.endpoint ?? undefined, environment: this.environment ?? undefined, userToken: this.userToken, userFullname: this.userFullname, userLoggedin: this.userLoggedin, hideSiteSelector: this.hideSiteSelector, hideLanguageSelector: this.hideLanguageSelector, hideSearch: this.hideSearch, hideLogin: this.hideLogin, showProfileSelection: this.showProfileSelection, showUnifiedLogin: this.showUnifiedLogin, spaMode: this.spaMode, checkUserLoggedInStateInterval: this.checkUserLoggedInStateInterval, useMarketwebLogin: this.useMarketwebLogin, activeMenuMode: this.activeMenuMode, theme: activeTheme, navigateOnMenuToggle: this.navigateOnMenuToggle, menuToggleChangeHandler: this.onMenuToggleChange, adjustSiteSelectorUrl: (href) => this.adjustSiteSelectorUrl(href), logoUrl: logoUrl }, h("slot", { key: 'c0025425b08f233bc8ef6c9db59c516b1c2c8d05', name: "header-top-left", slot: "header-top-left" }), h("slot", { key: '822354a2c86ca56f4a7e6926492a5202e82d0d2e', name: "header-top-right-start", slot: "header-top-right-start" }), h("slot", { key: '68364a475418c6bb6baba867f9b78bc2f7cd3c92', name: "toprightend", slot: "toprightend" })), h("slot", { key: 'e49bc7c21f51abb86b05e6a986163f6b8848c425', name: "siteheader-menu-top-button" }), h("pn-marketweb-header-main-row", { key: 'a56827628a3f649546881449479df0d7721da5b2', vm: vm, i18n: i18n, market: this.market ?? undefined, language: this.language ?? undefined, siteid: this.siteid ?? undefined, hideSearch: this.hideSearch, hideLogin: this.hideLogin, hideLanguageSelector: this.hideLanguageSelector, hideSiteSelector: this.hideSiteSelector, minimizeSearch: this.minimizeSearch, activeMenuMode: this.activeMenuMode, theme: activeTheme, navigateOnMenuToggle: this.navigateOnMenuToggle, primaryItems: menuGroups.primaryItems, sharedItems: menuGroups.sharedItems, showMenuDivider: menuGroups.primaryItems.length > 0 && menuGroups.sharedItems.length > 0, userToken: this.userToken, userFullname: this.userFullname, userLoggedin: this.userLoggedin, endpoint: this.endpoint ?? undefined, environment: this.environment ?? undefined, showProfileSelection: this.showProfileSelection, showUnifiedLogin: this.showUnifiedLogin, checkUserLoggedInStateInterval: this.checkUserLoggedInStateInterval, useMarketwebLogin: this.useMarketwebLogin, spaMode: this.spaMode, menuToggleChangeHandler: this.onMenuToggleChange, mainNavRefHandler: (el) => {
                this.mainNavEl = el;
            }, adjustSiteSelectorUrl: (href) => this.adjustSiteSelectorUrl(href), logoUrl: logoUrl }, h("slot", { key: '673017970d5f273a2810acc09d47744cfdda19e6', name: "mobile-toprightend", slot: "mobile-toprightend" }), h("slot", { key: '86493520b39dd5c0fbe4a371e3503cfdcc51e8bf', name: "header-bottom-button", slot: "header-bottom-button" }), h("slot", { key: '1fa6a9440a1f2b4bcb081fbc5c7ce3bb31a6bb63', name: "menu-footer-cta", slot: "menu-footer-cta" })))))));
    }
    static get is() { return "pn-marketweb-header"; }
    static get originalStyleUrls() {
        return {
            "$": ["pn-marketweb-header.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["pn-marketweb-header.css"]
        };
    }
    static get properties() {
        return {
            "initialActiveMenuMode": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "HeaderMenuMode",
                    "resolved": "number",
                    "references": {
                        "HeaderMenuMode": {
                            "location": "import",
                            "path": "./types/pn-marketweb-header.types",
                            "id": "src/components/layout-components/pn-marketweb-header/types/pn-marketweb-header.types.ts::HeaderMenuMode"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "initial-active-menu-mode",
                "reflect": false,
                "defaultValue": "0"
            },
            "menuThemes": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Optional menu theme labels, e.g. ['Business', 'Private']. passed in as a sting via cms"
                },
                "attribute": "menu-themes",
                "reflect": false
            },
            "market": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "MarketName | null",
                    "resolved": "\"com\" | \"de\" | \"dk\" | \"fi\" | \"group\" | \"no\" | \"se\" | \"tpl\"",
                    "references": {
                        "MarketName": {
                            "location": "import",
                            "path": "../../../services/pn-refined-marketweb-context/pn-refined-marketweb-context.types",
                            "id": "src/services/pn-refined-marketweb-context/pn-refined-marketweb-context.types.ts::MarketName"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Market to use for the header. Falls back to refined context resolution when omitted."
                },
                "attribute": "market",
                "reflect": true,
                "defaultValue": "null"
            },
            "language": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "string | null",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Language to use for the header. Falls back to refined context resolution when omitted."
                },
                "attribute": "language",
                "reflect": true,
                "defaultValue": "null"
            },
            "environment": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "EnvironmentName | null",
                    "resolved": "\"integration\" | \"preproduction\" | \"production\"",
                    "references": {
                        "EnvironmentName": {
                            "location": "import",
                            "path": "../../../services/pn-refined-marketweb-context/pn-refined-marketweb-context.types",
                            "id": "src/services/pn-refined-marketweb-context/pn-refined-marketweb-context.types.ts::EnvironmentName"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Environment to use for the header. Falls back to refined context resolution when omitted."
                },
                "attribute": "environment",
                "reflect": true,
                "defaultValue": "null"
            },
            "endpoint": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string | null",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Explicit endpoint override. When omitted it is resolved from market + environment."
                },
                "attribute": "endpoint",
                "reflect": false,
                "defaultValue": "null"
            },
            "siteid": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string | null",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Current site id (guid), forwarded into the search component."
                },
                "attribute": "siteid",
                "reflect": false,
                "defaultValue": "null"
            },
            "pageId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Current page id forwarded to the header backend endpoint."
                },
                "attribute": "page-id",
                "reflect": false,
                "defaultValue": "''"
            },
            "userToken": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Access token passed from backend."
                },
                "attribute": "user-token",
                "reflect": false,
                "defaultValue": "''"
            },
            "userFullname": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "User full name from backend."
                },
                "attribute": "user-fullname",
                "reflect": false,
                "defaultValue": "''"
            },
            "userLoggedin": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "User logged in state from backend."
                },
                "attribute": "user-loggedin",
                "reflect": true,
                "defaultValue": "false"
            },
            "hideSiteSelector": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Hides the site selector when true."
                },
                "attribute": "hide-site-selector",
                "reflect": true,
                "defaultValue": "false"
            },
            "hideHomeMenuItem": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Hides the generated home menu item when true."
                },
                "attribute": "hide-home-menu-item",
                "reflect": true,
                "defaultValue": "false"
            },
            "hideLanguageSelector": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Hides the language selector when true."
                },
                "attribute": "hide-language-selector",
                "reflect": true,
                "defaultValue": "false"
            },
            "hideSearch": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Hides search when true."
                },
                "attribute": "hide-search",
                "reflect": true,
                "defaultValue": "false"
            },
            "hideLogin": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Hides login when true."
                },
                "attribute": "hide-login",
                "reflect": true,
                "defaultValue": "false"
            },
            "showProfileSelection": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Enables profile selection presentation in the login component."
                },
                "attribute": "show-profile-selection",
                "reflect": true,
                "defaultValue": "false"
            },
            "showUnifiedLogin": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Enables unified login presentation in the login component."
                },
                "attribute": "show-unified-login",
                "reflect": false,
                "defaultValue": "false"
            },
            "siteDomainInUrls": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Adjust relative URLs against the site domain when true."
                },
                "attribute": "site-domain-in-urls",
                "reflect": false,
                "defaultValue": "false"
            },
            "autocompleteEndpoint": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Autocomplete endpoint forwarded into the search view model."
                },
                "attribute": "autocomplete-endpoint",
                "reflect": false,
                "defaultValue": "''"
            },
            "sessionForward": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Whether session forwarding should be attempted after login state changes."
                },
                "attribute": "session-forward",
                "reflect": false,
                "defaultValue": "false"
            },
            "cache": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Enables cached requests in FetchHelper when true."
                },
                "attribute": "cache",
                "reflect": false,
                "defaultValue": "false"
            },
            "searchPlaceholder": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Optional override for translated search placeholder text."
                },
                "attribute": "search-placeholder",
                "reflect": false,
                "defaultValue": "''"
            },
            "spaMode": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "When true, language selector options should not navigate directly by URL."
                },
                "attribute": "spa-mode",
                "reflect": false,
                "defaultValue": "false"
            },
            "checkUserLoggedInStateInterval": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Interval forwarded to the login component for login state checks."
                },
                "attribute": "check-user-logged-in-state-interval",
                "reflect": false,
                "defaultValue": "0"
            },
            "useMarketwebLogin": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Enables marketweb login mode in the login component."
                },
                "attribute": "use-marketweb-login",
                "reflect": false,
                "defaultValue": "false"
            },
            "navigateOnMenuToggle": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "When true, changing menu mode navigates to the selected root href."
                },
                "attribute": "navigate-on-menu-toggle",
                "reflect": false,
                "defaultValue": "true"
            }
        };
    }
    static get states() {
        return {
            "vm": {},
            "i18n": {},
            "status": {},
            "minimizeSearch": {},
            "loggedIn": {},
            "activeMenuMode": {}
        };
    }
    static get events() {
        return [{
                "method": "changeLanguage",
                "name": "changeLanguage",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the language changes."
                },
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                }
            }, {
                "method": "changeMarket",
                "name": "changeMarket",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the market changes."
                },
                "complexType": {
                    "original": "MarketName",
                    "resolved": "\"com\" | \"de\" | \"dk\" | \"fi\" | \"group\" | \"no\" | \"se\" | \"tpl\"",
                    "references": {
                        "MarketName": {
                            "location": "import",
                            "path": "../../../services/pn-refined-marketweb-context/pn-refined-marketweb-context.types",
                            "id": "src/services/pn-refined-marketweb-context/pn-refined-marketweb-context.types.ts::MarketName"
                        }
                    }
                }
            }];
    }
    static get elementRef() { return "hostElement"; }
    static get watchers() {
        return [{
                "propName": "language",
                "methodName": "onLanguageChange"
            }, {
                "propName": "market",
                "methodName": "onMarketChange"
            }, {
                "propName": "environment",
                "methodName": "onEnvironmentChange"
            }, {
                "propName": "endpoint",
                "methodName": "onEndpointChange"
            }, {
                "propName": "pageId",
                "methodName": "onPageIdChange"
            }, {
                "propName": "hideHomeMenuItem",
                "methodName": "onPresentationInputChange"
            }, {
                "propName": "siteDomainInUrls",
                "methodName": "onPresentationInputChange"
            }, {
                "propName": "autocompleteEndpoint",
                "methodName": "onPresentationInputChange"
            }, {
                "propName": "searchPlaceholder",
                "methodName": "onPresentationInputChange"
            }];
    }
    static get listeners() {
        return [{
                "name": "setLanguage",
                "method": "onLanguageSelectorChange",
                "target": undefined,
                "capture": false,
                "passive": false
            }, {
                "name": "loginStateChange",
                "method": "onLoginStateChange",
                "target": undefined,
                "capture": false,
                "passive": false
            }, {
                "name": "resize",
                "method": "handleResize",
                "target": "window",
                "capture": false,
                "passive": true
            }];
    }
}
//# sourceMappingURL=pn-marketweb-header.js.map
