'use strict';

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

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

const BceElementVideoTemplate = class {
    constructor(hostRef) {
        core.registerInstance(this, hostRef);
        this.location = '';
        this.autoplay = false;
        this.labelAutoplay = 'Autoplay';
        this.placeholderLocation = 'Video URL';
        this._link = inputLinker.linker(this, this.handleInput);
        this._location = this._link('location');
        this._autoplay = this._link('autoplay');
    }
    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 = {
            location: this.location,
            autoplay: this.autoplay
        };
        return Object.assign({}, current, part);
    }
    componentDidLoad() {
        this.value = this.updateValue();
        this.el.dispatchEvent(new Event('input', { bubbles: true }));
    }
    render() {
        const buttons = {
            labelUploadButton: this.labelUploadButton,
            labelDeleteButton: this.labelDeleteButton
        };
        return [
            core.h("bce-upload-input", Object.assign({}, this._location, buttons)),
            core.h("bce-input", Object.assign({ type: "switch" }, this._autoplay))
        ];
    }
    get el() { return core.getElement(this); }
};

exports.bce_element_video_template = BceElementVideoTemplate;
