'use strict';

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

const core = require('./core-0f211bec.js');
const inputLinker = require('./input-linker-dc14a9fc.js');

const BceElementLinkTemplate = class {
    constructor(hostRef) {
        core.registerInstance(this, hostRef);
        this.href = '';
        this.text = '';
        this.icon = '';
        this.labelHref = 'Reference';
        this.labelText = 'Text';
        this.labelIcon = 'Icon';
        this.placeholderHref = 'https://example.com';
        this.placeholderText = 'Example';
        this.placeholderIcon = 'globe';
        this._link = inputLinker.linker(this, this.handleInput);
        this._href = this._link('href');
        this._text = this._link('text');
        this._icon = this._link('icon');
    }
    handleInput(name, event) {
        const input = event.target;
        if (!input)
            return;
        event.cancelBubble = true;
        this[name] = input.value;
        this.value = this.updateValue({ [name]: input.value });
        this.el.dispatchEvent(new Event('input', { bubbles: true }));
    }
    updateValue(part = {}) {
        const current = {
            href: this.href,
            text: this.text,
            icon: this.icon
        };
        return Object.assign({}, current, part);
    }
    componentDidLoad() {
        this.value = this.updateValue();
        this.el.dispatchEvent(new Event('input', { bubbles: true }));
    }
    render() {
        return [
            core.h("bce-input", Object.assign({ type: "text" }, this._href)),
            core.h("bce-input", Object.assign({ type: "text" }, this._text)),
            core.h("bce-input", Object.assign({ type: "text" }, this._icon))
        ];
    }
    get el() { return core.getElement(this); }
};

exports.bce_element_link_template = BceElementLinkTemplate;
