'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-9a9efa1c.js');
const pnSidenavStore = require('./pn-sidenav-store-41848c2e.js');
require('./index-a8de2b09.js');

const translations = {
    sv: {
        open: 'Öppna',
        close: 'Stäng',
        navLabel: 'Undernavigering',
    },
    en: {
        open: 'Open',
        close: 'Close',
        navLabel: 'Sub navigation',
    },
    da: {
        open: 'Åbne',
        close: 'Stæng',
        navLabel: 'Undernavigation',
    },
    no: {
        open: 'Åpne',
        close: 'Stäng',
        navLabel: 'Undernavigering',
    },
    fi: {
        open: 'Avaa',
        close: 'Sulje',
        navLabel: 'Ali navigointi',
    },
    de: {
        open: 'Offen',
        close: 'Schließen',
        navLabel: 'Unternavigation',
    },
    zh: {
        open: 'Open',
        close: 'Close',
        navLabel: 'Sub navigation',
    },
    it: {
        open: 'Open',
        close: 'Close',
        navLabel: 'Sub navigation',
    },
    nl: {
        open: 'Open',
        close: 'Close',
        navLabel: 'Sub navigation',
    },
};

const pnSidenavCss = "pn-button-dropdown .pn-button-dropdown>pn-button>.pn-button{min-height:initial}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}@media screen and (max-width: 767px){.sr-only-mobile{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}}body[data-siteheader-sidemenuopen=true]{max-height:100vh;overflow:hidden}@media screen and (min-width: 60em){body[data-siteheader-sidemenuopen=true]{max-height:initial;overflow:initial}}pn-sidenav{display:block;height:auto;width:100vw;padding:0 1.6rem;background-color:#ffffff;z-index:6;transform:translateX(-100vw);transition:transform 0.2s 0s;transition-property:transform, visibility;flex-flow:column;visibility:hidden;position:fixed;overflow:auto;top:10.2rem;bottom:0;left:0}pn-sidenav[open=true]{visibility:visible;transform:none}@media screen and (min-width: 48em){pn-sidenav{top:15.3rem}}@media screen and (min-width: 64em){pn-sidenav{position:relative;transform:none;visibility:visible;top:0;z-index:inherit;width:100%;padding:0;height:auto;bottom:auto;left:auto}}";
const PnSidenavStyle0 = pnSidenavCss;

const PnSidenav = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.language = 'sv';
        this.navLabel = '';
        this.i18n = { open: '', close: '', navLabel: '' };
    }
    get hostElement() { return index.getElement(this); }
    componentWillLoad() {
        this.init();
    }
    async init() {
        this.setLanguage();
        if (window.matchMedia('screen and (min-width:64em)').matches === false) {
            pnSidenavStore.state.openMenu = false;
        }
    }
    setLanguage() {
        if (translations[this.language]) {
            pnSidenavStore.state.i18n = translations[this.language];
            if (!this.navLabel) {
                this.navLabel = pnSidenavStore.state.i18n.navLabel;
            }
        }
    }
    onOpenSubMenuLevelChange(event) {
        pnSidenavStore.state.openLevel = event.detail;
    }
    render() {
        return (index.h(index.Host, { key: '030371f4286ce6ad8e5b75d579362c113e53fa36', open: (pnSidenavStore.state.openMenu == true) + '' }, index.h("slot", { key: 'f701a5ce9c4cc237144ad9f8ae5a29d2ee50d547', name: "above" }), index.h("nav", { key: '79df4c5b53bd1184ab6737f5433e143efb035b74', class: "sidenav", "aria-label": this.navLabel }, index.h("slot", { key: '26afb12367f000520a8d5fecc197de1194cdd5a9' }))));
    }
};
PnSidenav.style = PnSidenavStyle0;

exports.pn_sidenav = PnSidenav;

//# sourceMappingURL=pn-sidenav.cjs.entry.js.map