'use strict';

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

const index = require('./index-9a9efa1c.js');

const translations = {
    sv: {
        sharelabel: 'Dela med',
    },
    en: {
        sharelabel: 'Share to',
    },
    da: {
        sharelabel: 'Del med',
    },
    no: {
        sharelabel: 'Dele med',
    },
    fi: {
        sharelabel: 'Jakaa',
    },
    zh: {
        sharelabel: 'Share to',
    },
    it: {
        sharelabel: 'Share to',
    },
    nl: {
        sharelabel: 'Share to',
    },
};

const pnShareCss = "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}}pn-share .pn-share__container{display:flex;flex-direction:column;gap:0.8rem}pn-share .pn-share__heading{font-size:1.6rem;font-weight:500}pn-share .pn-share__heading:after{content:\"\";display:block;height:0.2rem;background-color:#f3f2f2;margin-top:0.4rem;margin-bottom:0.8rem}pn-share .pn-share__items{display:flex;flex-direction:row;gap:0.8rem;align-items:center}";
const PnShareStyle0 = pnShareCss;

const SHARE_URLS = [
    { platform: 'linkedin', url: 'https://www.linkedin.com/sharing/share-offsite/?url=', text: 'LinkedIn' },
    { platform: 'twitter', url: 'https://twitter.com/intent/tweet?url=', text: 'Twitter' },
    { platform: 'facebook', url: 'https://www.facebook.com/sharer/sharer.php?u=', text: 'Facebook' },
];
const PnShare = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.link = null;
        this.language = 'sv';
        this.i18n = undefined;
    }
    get hostElement() { return index.getElement(this); }
    componentWillLoad() {
        this.setTranslations();
    }
    setTranslations() {
        if (this.language === 'nb') {
            this.language = 'no';
        }
        if (this.language && translations[this.language]) {
            this.i18n = translations[this.language];
        }
    }
    onLanguageChange() {
        this.setTranslations();
    }
    render() {
        return (index.h(index.Host, { key: '87c86e64bc6e31b8ecb1f172005dc1fa2b2a821a' }, index.h("div", { key: 'b0ae9877a73c5b2a67a6fc03e91cae21062df823', class: "pn-share__container" }, index.h("h3", { key: 'b410f35c7a3e20951b6795c886e755d4c9cc6337', class: "pn-share__heading" }, this.i18n.sharelabel, ":"), index.h("div", { key: 'e5b84fdc21fb4fcd5de996f55ef2b689d3385f80', class: "pn-share__items" }, SHARE_URLS.map(platform => {
            return (index.h("pn-share-item", { link: `${platform.url}${this.link}`, text: platform.text }, index.h("pn-icon", { slot: "icon", icon: platform.platform })));
        })))));
    }
    static get watchers() { return {
        "language": ["onLanguageChange"]
    }; }
};
PnShare.style = PnShareStyle0;

exports.pn_share = PnShare;

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