'use strict';

var index = require('./index-BEF5cZxd.js');
var utils = require('./utils-NnC78QR3.js');
var sizes = require('./sizes-D5zsw2g5.js');
var template = require('./template-Cj6PcLmR.js');
var props = require('./props-CPENhBnM.js');
var accessibility = require('./accessibility-BQJmIVWV.js');
require('./gov.log-C5EH15b_.js');
require('./attribute-CH1-zDDl.js');

const LinkSizes = utils.pick(sizes.Sizes, ['_S', '_M', '_L']);
const LinkClass = {
    root: 'gov-link',
    external: 'gov-link--external',
};

const GovLink = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        /**
         * Element size.
         */
        this.size = 'm';
        /**
         * Element size.
         */
        this.external = false;
        /**
         * Cutting text to one line
         */
        this.truncate = false;
        this.inheritedAttributes = {};
        this.h = template.govHost(this.host);
    }
    validateSize(newValue) {
        props.validateProp(LinkSizes, newValue, LinkClass.root);
    }
    componentWillLoad() {
        this.validateSize(this.size);
        this.inheritedAttributes = accessibility.inheritAriaAttributes(this.host);
    }
    onAriaAttributeChange(attributeName, newValue) {
        this.host.removeAttribute(attributeName);
        this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attributeName]: newValue });
    }
    render() {
        return (index.h(index.Host, { key: '87da124a14ecd5515767b8583a98c8a24ea6b21b', class: this.h.classes(LinkClass.root), size: this.size, href: this.href, external: this.external, truncate: this.truncate }, index.h("a", Object.assign({ key: '7e9b80a7eb6527214cea32a1a6b2dfa7bdba56a9', class: "element", href: this.href, target: this.external ? '_blank' : this.target, rel: this.external ? "noreferrer" : null }, this.inheritedAttributes), index.h("slot", { key: '0620fa97529d8966460cd664ff4285719954ca26', name: "icon-start" }), index.h("span", { key: 'fc56fe240cda4ab1dde314deac56937fa9d53717' }, index.h("slot", { key: 'fdb01c25b213ee2c093136ff86a9f3d56a0b12ca' })), index.h("slot", { key: '1d077305b248a77e6b6730c32d5136ce4a9b2858', name: "icon-end" }), this.external && index.h("gov-icon", { key: 'c9d155610f0cbd4ddf1fd1945b8da78357ba2767', name: "box-arrow-up-right", type: "components", size: this.size, class: LinkClass.external }))));
    }
    get host() { return index.getElement(this); }
    static get watchers() { return {
        "size": ["validateSize"]
    }; }
};

exports.gov_link = GovLink;
//# sourceMappingURL=gov-link.entry.cjs.js.map

//# sourceMappingURL=gov-link.cjs.entry.js.map