import { h, } from "@stencil/core";
import { detectFramework } from "../../../shared/utils/framework-detection";
import { trackComponent } from "../../../shared/utils/tracking";
const ACTIVE = "active";
const ACTIVE_SECTION = "active-section";
const SIDEBAR_ITEM = ".sidebar__nav-item";
export class Sidebar {
    el;
    applicationName = "";
    initialCollapse = true;
    showFooter = true;
    showHeader = true;
    termsOfUse = "#";
    imprint = "#";
    privacyPolicy = "#";
    target = "_blank";
    currentYear = new Date().getFullYear();
    copyrightText = "© 1999 - " + this.currentYear + " Infineon Technologies AG";
    internalTermsofUse = "";
    internalImprint = "";
    internalPrivacyPolicy = "";
    internalShowFooter = true;
    activeItem = null;
    collapsible = false;
    collapsed = false; // New property for initial collapsed state
    hideMenuLabel = "Hide Menu"; // New property for hide menu label
    isCollapsed = false;
    ifxSidebarCollapseChange;
    expandActiveItems() {
        const expandRecursively = async (parent) => {
            if ((await parent.isItemExpandable()) !== true) {
                if (parent.active)
                    return 1;
                return 0;
            }
            let currRes = 0;
            const children = this.getSidebarMenuItems(parent);
            for (let i = 0; i < children.length; i++) {
                currRes = Math.max(currRes, await expandRecursively(children[i]));
            }
            if (currRes > 0) {
                if (currRes == 1) {
                    parent.expandMenu(false);
                }
                else {
                    parent.expandMenu(true);
                }
            }
            return currRes ? currRes + 1 : 0;
        };
        const topLevelItems = this.getSidebarMenuItems(this.el);
        for (let i = 0; i < topLevelItems.length; i++) {
            expandRecursively(topLevelItems[i]);
        }
    }
    adjustTopBorder() {
        const children = this.el.children;
        if (!children.length)
            return;
        if (children[0].tagName === "IFX-SIDEBAR-TITLE") {
            children[0].shadowRoot
                .querySelector(".sidebar__title")
                .classList.add("no-top-border");
        }
        if (children[0].tagName === "IFX-SIDEBAR-ITEM" &&
            children[0].shadowRoot
                .querySelector("div > a")
                .classList.contains("header__section")) {
            children[0].shadowRoot
                .querySelector("div > a")
                .classList.add("no-top-border");
        }
        const allIfxTitles = this.el.querySelectorAll("ifx-sidebar-title");
        allIfxTitles.forEach((element) => {
            const nextSibling = element.nextElementSibling;
            if (nextSibling &&
                nextSibling.tagName === "IFX-SIDEBAR-ITEM" &&
                nextSibling.shadowRoot
                    .querySelector("div > a")
                    .classList.contains("header__section")) {
                nextSibling.shadowRoot
                    .querySelector("div > a")
                    .classList.add("no-top-border");
            }
        });
    }
    async addPaddingToTheLastItem(sidebarItem) {
        const sidebarChildItems = this.getSidebarMenuItems(sidebarItem);
        for (let i = 0; i < sidebarChildItems.length; i++) {
            const childItem = sidebarChildItems[i];
            const childNavItem = this.getNavItem(childItem.shadowRoot);
            const isChildItemExpandable = await childItem.isItemExpandable();
            if (isChildItemExpandable) {
                this.addPaddingToTheLastItem(childItem);
            }
            if (i === sidebarChildItems.length - 1) {
                this.handleClassList(childNavItem, "add", "extra-padding__bottom");
            }
        }
    }
    async adjustItemsPadding() {
        const sidebarItems = this.el.children;
        if (sidebarItems.length === 0)
            return;
        // Processing first item
        if (sidebarItems[0].tagName.toUpperCase() === "IFX-SIDEBAR-ITEM") {
            const firstItem = sidebarItems[0];
            if (this.isSidebarItem(firstItem)) {
                const isFirstSidebarItemExpandable = await firstItem.isItemExpandable();
                if (isFirstSidebarItemExpandable) {
                    this.addPaddingToTheLastItem(firstItem);
                }
            }
        }
        // Processing remaining items
        for (let i = 1; i < sidebarItems.length; i++) {
            const sidebarItem = sidebarItems[i];
            const previousSidebarItem = sidebarItems[i - 1];
            const previousSidebarNavItem = this.getNavItem(previousSidebarItem.shadowRoot);
            if (sidebarItem.tagName.toUpperCase() === "IFX-SIDEBAR-TITLE") {
                if (previousSidebarItem.tagName.toUpperCase() === "IFX-SIDEBAR-ITEM" &&
                    previousSidebarNavItem &&
                    !this.handleClassList(previousSidebarNavItem, "contains", "header__section")) {
                    this.handleClassList(previousSidebarNavItem, "add", "extra-padding__bottom");
                }
            }
            else if (sidebarItem.tagName.toUpperCase() === "IFX-SIDEBAR-ITEM") {
                const sidebarNavItem = this.getNavItem(sidebarItem.shadowRoot);
                if (previousSidebarItem.tagName.toUpperCase() === "IFX-SIDEBAR-ITEM" &&
                    previousSidebarNavItem &&
                    !this.handleClassList(previousSidebarNavItem, "contains", "header__section") &&
                    this.handleClassList(sidebarNavItem, "contains", "header__section")) {
                    this.handleClassList(previousSidebarNavItem, "add", "extra-padding__bottom");
                }
                if (this.isSidebarItem(sidebarItem)) {
                    const isSidebarItemExpandable = await sidebarItem.isItemExpandable();
                    if (isSidebarItemExpandable) {
                        this.addPaddingToTheLastItem(sidebarItem);
                    }
                }
            }
        }
    }
    isSidebarItem(element) {
        return typeof element.isItemExpandable === "function";
    }
    async componentDidLoad() {
        const framework = detectFramework();
        trackComponent("ifx-sidebar", await framework);
        this.adjustTopBorder();
        this.setInitialActiveItem();
        if (!this.initialCollapse) {
            this.expandActiveItems();
        }
        this.adjustItemsPadding();
        this.applyActiveSectionToParent(this.el);
        if (this.isCollapsed) {
            this.updateCollapsedState();
        }
    }
    getSidebarMenuItems(el = this.el) {
        const sidebarItems = el.querySelectorAll("ifx-sidebar-item");
        if (sidebarItems.length === 0) {
            return el.shadowRoot?.querySelectorAll("ifx-sidebar-item");
        }
        return sidebarItems;
    }
    setInitialActiveItem() {
        const handleItem = (parent) => {
            const children = this.getSidebarMenuItems(parent);
            let firstActiveFoundInGroup = false;
            children?.forEach((item) => {
                // If the item is active and it's the first active one in its group
                if (this.isActive(item) && !firstActiveFoundInGroup) {
                    firstActiveFoundInGroup = true;
                    this.handleBorderIndicatorDisplacement(item);
                }
                // If the item is active but it's not the first one in its group
                else if (this.isActive(item) && firstActiveFoundInGroup) {
                    item.setAttribute("active", "false"); // Set the 'active' attribute to 'false'
                }
                // If the clicked item is a menu and doesn't have any active children
                if (this.hasChildren(item.shadowRoot) &&
                    !this.hasActiveChild(item.shadowRoot)) {
                    const clickedItemSection = this.getActiveItemSection(item);
                    this.handleClassList(clickedItemSection, "remove", "active-section");
                }
                // If clickedItem is an opened menu and it contains another menu with 'active-section'
                if (this.hasChildren(item.shadowRoot) &&
                    this.isOpen(item.shadowRoot) &&
                    this.containsActiveSection(item)) {
                    const clickedItemSection = this.getActiveItemSection(item);
                    this.handleClassList(clickedItemSection, "remove", "active-section");
                }
                // Recursive call for child items
                if (this.hasChildren(item.shadowRoot)) {
                    handleItem(item.shadowRoot);
                }
            });
        };
        // Start with the top-level items
        const topLevelItems = this.getSidebarMenuItems(this.el);
        topLevelItems.forEach(handleItem);
    }
    handleClassList(el, type, className) {
        el.classList[type](className);
        if (type === "contains") {
            return el.classList.contains(className);
        }
    }
    getActiveItemSection(item) {
        return this.getNavItem(item.shadowRoot);
    }
    getNavItem(el) {
        return el?.querySelector(".sidebar__nav-item");
    }
    hasChildren(el) {
        return el?.querySelector(".item__arrow-wrapper") !== null ? true : false;
    }
    handleBorderIndicatorDisplacement(clickedItem) {
        // Recursive function to handle each item
        const handleItem = (item) => {
            // Check if current item is active or the one that was clicked
            const isActive = this.isActive(item) || item === clickedItem;
            if (isActive) {
                const activeMenuItemSection = this.getActiveItemSection(item);
                const isMenu = this.hasChildren(activeMenuItemSection);
                if (isMenu) {
                    this.handleClassList(activeMenuItemSection, "add", "active-section");
                }
            }
            // Recursive call for child items
            const children = this.getSidebarMenuItems(item);
            children.forEach(handleItem);
        };
        // Start with the top-level items
        const topLevelItems = this.getSidebarMenuItems(this.el);
        topLevelItems.forEach(handleItem);
    }
    removeActiveClassesRecursively() {
        const removeClasses = (root) => {
            const children = this.querySidebarItems(root);
            children.forEach((child) => {
                const sidebarItem = child.shadowRoot.querySelector(SIDEBAR_ITEM);
                sidebarItem.classList.remove(ACTIVE_SECTION);
                sidebarItem.classList.remove(ACTIVE);
                if (child.getAttribute("active")) {
                    child.setAttribute("active", "false");
                }
                removeClasses(child.shadowRoot);
            });
        };
        removeClasses(this.el);
        if (this.activeItem) {
            this.activeItem.setAttribute("active", "false");
        }
        this.activeItem = null;
    }
    hasActiveChild(menuItem) {
        const children = this.getSidebarMenuItems(menuItem);
        if (children) {
            for (let i = 0; i < children.length; i++) {
                const child = children[i];
                // If the child item is active
                if (this.isActive(child)) {
                    return true;
                }
                // If the child item has children, recurse into them
                else if (this.hasChildren(child.shadowRoot)) {
                    if (this.hasActiveChild(child.shadowRoot)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
    handleSidebarItemInteraction(event) {
        // This method can be used to handle the ifxSidebarMenu event
        // Get the element that triggered the event
        const clickedItem = event.detail;
        // If the clicked item is not a menu OR is a menu that has an active child
        if (!this.hasChildren(clickedItem.shadowRoot) ||
            this.hasActiveChild(clickedItem.shadowRoot)) {
            this.handleBorderIndicatorDisplacement(clickedItem);
        }
        // If the clicked item is a menu and doesn't have any active children
        if (this.hasChildren(clickedItem.shadowRoot) &&
            !this.hasActiveChild(clickedItem.shadowRoot)) {
            const clickedItemSection = this.getActiveItemSection(clickedItem);
            this.handleClassList(clickedItemSection, "remove", "active-section");
        }
        // If clickedItem is an opened menu and it contains another menu with 'active-section'
        if (this.hasChildren(clickedItem.shadowRoot) &&
            this.isOpen(clickedItem.shadowRoot) &&
            this.containsActiveSection(clickedItem)) {
            const clickedItemSection = this.getActiveItemSection(clickedItem);
            this.handleClassList(clickedItemSection, "remove", "active-section");
        }
    }
    isOpen(menuItem) {
        return this.getNavItem(menuItem).classList.contains("open") ? true : false;
    }
    containsActiveSection(menuItem) {
        const children = this.getSidebarMenuItems(menuItem);
        for (let i = 0; i < children.length; i++) {
            const child = children[i];
            if (this.getNavItem(child.shadowRoot).classList.contains("active-section") ||
                (this.hasChildren(child.shadowRoot) &&
                    this.containsActiveSection(child.shadowRoot))) {
                this.handleClassList(child, "add", "active-section");
                return true;
            }
        }
        return false;
    }
    applyActiveSectionToParent(el) {
        // Get all submenus of the given element
        const subMenus = this.getSidebarMenuItems(el);
        subMenus?.forEach((menu) => {
            // If this submenu has an active child, add active-section class to it
            if (this.hasActiveChild(menu.shadowRoot)) {
                const menuItemSection = this.getActiveItemSection(menu);
                this.handleClassList(menuItemSection, "add", "active-section");
            }
            // Apply to submenu's children
            this.applyActiveSectionToParent(menu.shadowRoot);
        });
    }
    querySidebarItems(el) {
        return el.querySelectorAll("ifx-sidebar-item");
    }
    isActive(iteratedComponent) {
        const activeAttributeValue = iteratedComponent.getAttribute("active");
        const isActive = activeAttributeValue === "true";
        return isActive;
    }
    handleSidebarItemActivated(event) {
        this.removeActiveClassesRecursively();
        this.activeItem = event.detail;
        this.activeItem.setAttribute("active", "true");
        // Get the parent element of the activated item
        const parent = this.getNavItem(event.detail.parentElement.parentElement.parentElement);
        if (parent) {
            this.handleClassList(parent, "add", "active-section");
        }
    }
    componentWillLoad() {
        this.internalTermsofUse = this.termsOfUse.trim();
        this.internalPrivacyPolicy = this.privacyPolicy.trim();
        this.internalImprint = this.imprint.trim();
        this.internalShowFooter = this.showFooter;
        if (this.internalShowFooter &&
            !this.internalImprint &&
            !this.internalPrivacyPolicy &&
            !this.internalTermsofUse &&
            !this.copyrightText) {
            this.internalShowFooter = false;
        }
        // Set initial collapsed state from prop - independent of collapsible
        this.isCollapsed = Boolean(this.collapsed);
    }
    handleCollapsibleChange(_newValue) {
        // Force re-render when collapsible changes
        this.forceUpdate();
    }
    forceUpdate() {
        // Trigger a re-render
        this.el.forceUpdate?.() ||
            this.el.setAttribute("data-force-update", Date.now().toString());
    }
    async toggleCollapse() {
        this.isCollapsed = !this.isCollapsed;
        this.updateCollapsedState();
        // Emit event after state change
        this.ifxSidebarCollapseChange.emit({ collapsed: this.isCollapsed });
    }
    async collapse() {
        this.isCollapsed = true;
        this.updateCollapsedState();
        // Emit event after state change
        this.ifxSidebarCollapseChange.emit({ collapsed: this.isCollapsed });
    }
    async expand() {
        this.isCollapsed = false;
        this.updateCollapsedState();
        // Emit event after state change
        this.ifxSidebarCollapseChange.emit({ collapsed: this.isCollapsed });
    }
    handleCollapsedPropChange(newValue) {
        this.isCollapsed = newValue;
        this.updateCollapsedState();
        // Emit event when prop changes
        this.ifxSidebarCollapseChange.emit({ collapsed: this.isCollapsed });
    }
    updateCollapsedState() {
        // Set CSS custom properties to handle Shadow DOM components
        if (this.isCollapsed) {
            this.el.style.setProperty("--ifx-sidebar-item-text-display", "none");
            this.el.style.setProperty("--ifx-sidebar-item-without-icon-display", "none");
            this.el.style.setProperty("--ifx-sidebar-title-display", "none");
            this.el.style.setProperty("--ifx-sidebar-title-show-in-collapsed-display", "block");
            this.el.style.setProperty("--ifx-sidebar-title-label-display", "none");
            this.el.style.setProperty("--ifx-sidebar-title-padding", "0");
            this.el.style.setProperty("--ifx-sidebar-item-flex-direction", "column");
            // Set attributes on all sidebar items
            this.setSidebarItemAttributes(true);
        }
        else {
            this.el.style.removeProperty("--ifx-sidebar-item-text-display");
            this.el.style.removeProperty("--ifx-sidebar-item-without-icon-display");
            this.el.style.removeProperty("--ifx-sidebar-title-display");
            this.el.style.removeProperty("--ifx-sidebar-title-show-in-collapsed-display");
            this.el.style.removeProperty("--ifx-sidebar-title-label-display");
            this.el.style.removeProperty("--ifx-sidebar-title-padding");
            this.el.style.removeProperty("--ifx-sidebar-item-flex-direction");
            // Remove attributes from all sidebar items
            this.setSidebarItemAttributes(false);
        }
    }
    setSidebarItemAttributes(collapsed) {
        const allSidebarItems = this.el.querySelectorAll("ifx-sidebar-item");
        allSidebarItems.forEach((item) => {
            if (collapsed) {
                item.setAttribute("data-sidebar-collapsed", "true");
                if (!item.icon) {
                    item.setAttribute("data-hide-in-collapsed", "true");
                }
            }
            else {
                item.removeAttribute("data-sidebar-collapsed");
                item.removeAttribute("data-hide-in-collapsed");
            }
        });
    }
    handleHideMenuClick = () => {
        this.toggleCollapse();
    };
    handleHideMenuKeyDown = (event) => {
        if (event.key === "Enter" || event.key === " ") {
            event.preventDefault();
            this.toggleCollapse();
        }
    };
    render() {
        return (h("div", { key: 'b59a931cdec9dfaf5af0b44569cea6d8e4cbb22c', "aria-label": "a navigation sidebar", "aria-value": this.applicationName, class: `sidebar__container ${this.isCollapsed ? "sidebar__container--collapsed" : ""}` }, h("div", { key: 'ff45cbfc5c098abc3e4aa3914857a51bd828ae62', class: "sidebar__top-container" }, this.showHeader && (h("div", { key: 'ae60931b5594f641d1246253db322742df8f3bfc', class: "sidebar__nav-bar" }, h("div", { key: '9b8c017e8f700ffe3f9fea4814cc893f03d54eda', class: "sidebar__nav-bar-logo" }, h("div", { key: '2d6e1bb3212d7921c19611ddff54232c8f292a95', class: "sidebar__nav-bar-logo-img" }, h("svg", { key: '51d1f378f7e6fa984c46e99ce7fb7b8a5175c198', width: "91", height: "40", viewBox: "0 0 91 40", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: 'a637f19604d4127b22bdcc718313918f3e69cab9', "clip-path": "url(#clip0_2396_2480)" }, h("path", { key: '5016da23de231c6fbcd7ddacc1a2d0bfe9f45846', d: "M67.691 26.7766C71.0884 26.7766 72.1461 23.1841 72.1461 19.8802C72.1461 15.4536 70.2871 13.1441 67.691 13.1441C64.4219 13.1441 63.2681 16.7367 63.3001 19.9443C63.3322 23.1199 64.2296 26.7766 67.691 26.7766ZM66.0244 19.8481C66.0244 18.533 66.0244 15.4536 67.691 15.4536C69.4859 15.4536 69.4218 18.5009 69.4218 19.9123C69.4218 21.2595 69.4218 24.5313 67.7551 24.5313C65.9603 24.4992 66.0244 21.2274 66.0244 19.8481ZM57.8195 26.7766C59.1976 26.7766 60.3835 26.2313 61.5053 25.0445L60.5117 23.1841C59.7425 24.018 58.9733 24.4671 58.0438 24.4671C57.2746 24.4671 56.6336 24.018 56.249 23.2482C55.9285 22.5746 55.8644 21.8048 55.8644 20.9708V20.7142H61.6335V20.1368C61.6335 17.282 61.2809 15.7102 60.3835 14.5234C59.7104 13.6253 58.7169 13.1441 57.499 13.1441C56.2169 13.1441 55.1593 13.7215 54.39 14.8442C53.5567 16.0631 53.2042 17.699 53.2042 19.9443C53.1721 24.2426 54.8708 26.7766 57.8195 26.7766ZM57.531 15.2612C58.172 15.2612 58.5566 15.614 58.813 16.1914C59.0053 16.7046 59.1015 17.5707 59.1015 18.5971H55.8644C55.8964 16.3197 56.3772 15.2612 57.531 15.2612ZM74.2614 26.4559H76.7614V16.8329C77.3703 16.0952 78.0754 15.6782 78.5882 15.6782C78.9087 15.6782 79.2292 15.7423 79.4215 15.9989C79.6138 16.2876 79.71 16.7046 79.71 17.699V26.4559H82.21V16.5442C82.21 15.6782 82.1138 14.8121 81.601 14.1706C81.1523 13.5932 80.4472 13.2404 79.5497 13.2404C78.3959 13.2404 77.2101 13.914 76.569 14.6838C76.537 14.0102 76.3126 13.3687 76.2485 13.1441L73.9089 13.7536C74.0371 14.4593 74.2294 15.3253 74.2294 16.8971V26.4559H74.2614ZM45.2236 14.6838C45.1915 14.0102 44.9672 13.3687 44.9031 13.1441L42.5634 13.7536C42.6916 14.4593 42.8839 15.3253 42.8839 16.8971V26.4238H45.3838V16.8008C45.9928 16.0631 46.6979 15.6461 47.2107 15.6461C47.5312 15.6461 47.8517 15.7102 48.044 15.9669C48.2363 16.2555 48.3325 16.6725 48.3325 17.6669V26.4238H50.8324V16.5442C50.8324 15.6782 50.7363 14.8121 50.2235 14.1706C49.7748 13.5932 49.0696 13.2404 48.1722 13.2404C47.0505 13.2404 45.8646 13.914 45.2236 14.6838ZM14.6473 9.07042C16.1216 9.07042 17.3075 7.88359 17.3075 6.40807C17.3075 4.93256 16.1216 3.74573 14.6473 3.74573C13.173 3.74573 11.9871 4.93256 11.9871 6.40807C11.9871 7.88359 13.173 9.07042 14.6473 9.07042ZM26.9227 26.4559V16.5442C26.9227 15.6782 26.8265 14.8121 26.3137 14.1706C25.865 13.5932 25.1599 13.2404 24.2625 13.2404C23.1087 13.2404 21.9228 13.914 21.2818 14.6838C21.2497 14.0102 21.0254 13.3687 20.9613 13.1441L18.6536 13.7857C18.7818 14.4913 18.9741 15.3574 18.9741 16.9291V26.4559H21.4741V16.8329C22.0831 16.0952 22.7882 15.6782 23.301 15.6782C23.6215 15.6782 23.942 15.7423 24.1343 15.9989C24.3266 16.2876 24.4227 16.7046 24.4227 17.699V26.4559H26.9227ZM38.4289 8.36474C37.4994 8.36474 36.7622 9.10249 36.7622 10.0327C36.7622 10.9629 37.4994 11.7007 38.3968 11.7007C39.3263 11.7007 40.0634 10.9629 40.0634 10.0327C40.0634 9.10249 39.3263 8.36474 38.4289 8.36474ZM13.4614 26.4559H15.9614V10.8346L13.4614 11.1554V26.4559ZM33.8777 9.90441C34.3264 9.90441 34.7751 10.0648 35.0635 10.2893L35.7687 8.33266C35.0956 7.85151 34.3584 7.62698 33.429 7.62698C32.788 7.62698 32.1149 7.78736 31.5059 8.26851C30.897 8.78173 30.256 9.80818 30.256 11.7328C30.256 12.5667 30.288 13.4328 30.288 13.4328H29.4226V15.6461H30.288V26.4238H32.8521V15.6782H34.743L35.2238 13.4649H32.8841V11.4762C32.8841 10.5139 33.2687 9.90441 33.8777 9.90441ZM37.1468 26.4559H39.6788V13.2404L37.1468 13.5611V26.4559Z", fill: "#005DA9" }), h("path", { key: '0af5b868f41fe15012cf90fd4df1efac3307ac44', d: "M77.0816 33.5126C68.6203 36.0146 58.3321 37.1052 48.2682 37.1052C22.7239 37.1052 6.24986 29.5993 5.09604 19.6877C4.67938 15.9668 7.59599 12.3422 12.4677 9.26285C11.6023 8.62132 11.0575 7.59488 11.0254 6.44012C3.97427 10.161 0 15.0366 0 19.9764C0 30.9145 19.5188 40.1525 48.5246 39.7676C58.6205 39.6393 67.0498 38.1958 74.6778 35.6939C83.7482 32.7428 89.4532 28.5087 90.8313 26.6483C89.1968 28.1238 85.3186 31.0748 77.0816 33.5126ZM23.2687 4.38723C24.9674 3.80985 27.3712 3.0721 27.3712 3.0721C34.1339 1.21166 41.6017 0.121063 48.5566 0.185215C40.544 -0.295931 33.2365 0.185215 26.8584 1.33997C26.8584 1.33997 24.743 1.69281 22.4675 2.27018C22.4675 2.27018 21.3777 2.55887 20.7047 2.75133C20.0316 2.94379 19.1021 3.2004 19.1021 3.2004C18.4611 3.39286 17.8201 3.6174 17.1791 3.84193C17.8201 4.48346 18.2047 5.31745 18.2368 6.27974C19.3586 5.76652 21.5059 4.99668 23.2687 4.38723Z", fill: "#E30034" })), h("defs", { key: 'b042532fc27061f8f7f410e4e6f38edfd26322ca' }, h("clipPath", { key: '260d19abdd68e34be057300cb347996de72b67bb', id: "clip0_2396_2480" }, h("rect", { key: 'cdc925fb8fea0667b5c688e9f935376b286b1c0a', width: "91", height: "40", fill: "white" })))), " "), h("div", { key: '1405f200f41e5dfdc58ffb4201a6bea3e1fa078f', class: "sidebar__nav-bar-logo-text" }, this.applicationName)))), this.collapsible && (h("div", { key: 'b7545f31e738be164a06a8dc36025e2cadd62b16', class: "sidebar__hide-menu", onClick: this.handleHideMenuClick, onKeyDown: this.handleHideMenuKeyDown, tabIndex: 0, role: "button", "aria-label": this.isCollapsed ? "Expand sidebar" : "Collapse sidebar" }, h("div", { key: '44dabc56808635312da9c6270ddebe0dcf89be53', class: "sidebar__hide-menu-icon" }, h("ifx-icon", { key: '8272403a5ff615f4e78030eaa4eec79b0fe93d40', icon: "menu-16" })), h("div", { key: 'baa5df48e737032c2d7e16ce4842a1cf65ee35a1', class: "sidebar__hide-menu-text" }, this.hideMenuLabel))), h("div", { key: 'f3e9a2a803975d00aaa1e45d0c383f13bf321452', class: "sidebar__nav-container" }, h("slot", { key: '35a477e6be5b8479a47a9e076acd4d7407066e4b' }))), this.internalShowFooter && (h("div", { key: '9671e1029e3b3bd2bd68b4b87dbfa83278907a99', class: "sidebar__footer-container" }, h("div", { key: '2758da26b864f5adae3d778e6927a8f3e7968da8', class: "sidebar__footer-wrapper" }, (this.internalTermsofUse ||
            this.internalImprint ||
            this.internalPrivacyPolicy) && (h("div", { key: '61375a66dc18da0a775c63dfa876e5c73d0ffd0b', class: "sidebar__footer-wrapper-top-links" }, this.internalTermsofUse !== "" && (h("a", { key: 'ebbd1c98c8104525e4e2606be973219ffd1111ac', target: this.target, href: this.internalTermsofUse }, "Terms of use")), this.internalImprint !== "" && (h("a", { key: '3b67c8a7141c54069b33caa95c804605c988a14c', target: this.target, href: this.internalImprint }, "Imprint")), this.internalPrivacyPolicy !== "" && (h("a", { key: '16548333483485107c2eefc4df10272d1656985d', target: this.target, href: this.internalPrivacyPolicy }, "Privacy policy")))), this.copyrightText && (h("div", { key: '5a19958dbdbbc36361414cce42e51506e33862e5', class: "sidebar__footer-wrapper-bottom-links" }, h("span", { key: 'bfafb390c1491ef4e2682d8d332fe1dcc7317f51' }, this.copyrightText))))))));
    }
    static get is() { return "ifx-sidebar"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["sidebar.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["sidebar.css"]
        };
    }
    static get properties() {
        return {
            "applicationName": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "application-name",
                "defaultValue": "\"\""
            },
            "initialCollapse": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "initial-collapse",
                "defaultValue": "true"
            },
            "showFooter": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "show-footer",
                "defaultValue": "true"
            },
            "showHeader": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "show-header",
                "defaultValue": "true"
            },
            "termsOfUse": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "terms-of-use",
                "defaultValue": "\"#\""
            },
            "imprint": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "imprint",
                "defaultValue": "\"#\""
            },
            "privacyPolicy": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "privacy-policy",
                "defaultValue": "\"#\""
            },
            "target": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "target",
                "defaultValue": "\"_blank\""
            },
            "copyrightText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "copyright-text",
                "defaultValue": "\"\u00A9 1999 - \" + this.currentYear + \" Infineon Technologies AG\""
            },
            "collapsible": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "collapsible",
                "defaultValue": "false"
            },
            "collapsed": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "collapsed",
                "defaultValue": "false"
            },
            "hideMenuLabel": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "hide-menu-label",
                "defaultValue": "\"Hide Menu\""
            }
        };
    }
    static get states() {
        return {
            "currentYear": {},
            "internalTermsofUse": {},
            "internalImprint": {},
            "internalPrivacyPolicy": {},
            "internalShowFooter": {},
            "activeItem": {},
            "isCollapsed": {}
        };
    }
    static get events() {
        return [{
                "method": "ifxSidebarCollapseChange",
                "name": "ifxSidebarCollapseChange",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "{ collapsed: boolean }",
                    "resolved": "{ collapsed: boolean; }",
                    "references": {}
                }
            }];
    }
    static get methods() {
        return {
            "toggleCollapse": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "collapse": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "expand": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "collapsible",
                "methodName": "handleCollapsibleChange"
            }, {
                "propName": "collapsed",
                "methodName": "handleCollapsedPropChange"
            }];
    }
    static get listeners() {
        return [{
                "name": "ifxSidebarMenu",
                "method": "handleSidebarItemInteraction",
                "target": undefined,
                "capture": false,
                "passive": false
            }, {
                "name": "ifxSidebarNavigationItem",
                "method": "handleSidebarItemActivated",
                "target": undefined,
                "capture": false,
                "passive": false
            }];
    }
}
//# sourceMappingURL=sidebar.js.map
