import { r as registerInstance, h } from './index-b13326fc.js';

var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, privateMap) {
    if (!privateMap.has(receiver)) {
        throw new TypeError("attempted to get private field on non-instance");
    }
    return privateMap.get(receiver);
};
var _server;
const BceElementVideo = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        // @State()
        // private youtube = false;
        _server.set(this, window.BCE.file);
    }
    // private createYouTubeURL(id: string) {
    //   const url = this.template && new URL(this.template.location);
    //   const path = 'https://www.youtube.com/embed/' + id;
    //   const start = (url && url.searchParams.get('t')) || 0;
    //   const autoplay = this.template && this.template.autoplay;
    //   return `${path}?start=${start}&autoplay=${autoplay}`;
    // }
    // renderYouTube() {
    //   return [
    //     <img src="http://placehold.it/16x9" />,
    //     <iframe src={this.url} frameborder="0" allowFullScreen />
    //   ];
    // }
    render() {
        if (!this.template)
            return;
        const { autoplay } = this.template;
        return this.template.location.map(id => {
            const file = __classPrivateFieldGet(this, _server).get(id);
            return (file && (h("video", { key: id, autoplay: autoplay, muted: autoplay, playsInline: autoplay, controls: true }, h("source", { src: file.url, type: file.type }))));
        });
    }
    static get style() { return ":host{position:relative;display:block;margin:1rem auto;max-width:1200px;text-align:center}:host img,:host video{width:100%;height:auto}:host img{opacity:0}:host iframe{position:absolute;top:0;left:0;width:100%;height:100%}\@media screen and (min-width: 1024px){:host{text-align:left;width:auto}}"; }
};
_server = new WeakMap();

export { BceElementVideo as bce_element_video };
