var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { LitElement, html, property, } from 'lit-element';
export default class ArenaEmbed extends LitElement {
    createRenderRoot() {
        return this;
    }
    handleToggle({ detail }) {
        this.fireChangeAttribute({
            border: detail,
        });
    }
    handleForm({ detail }) {
        this.fireChangeAttribute(detail);
    }
    fireChangeAttribute(attrs) {
        const event = new CustomEvent('arena-change-attribute', {
            bubbles: true,
            detail: {
                attrs,
                target: this,
            },
        });
        this.dispatchEvent(event);
    }
    render() {
        if (this.type === 'youtube' && this.href) {
            return html `
        <arena-embed-youtube
          ?border=${this.border}
          @toggle=${this.handleToggle}
          href="${this.href}"
        ></arena-embed-youtube>`;
        }
        if (this.type && this.href) {
            return html `
        <arena-embed-simple
          type="${this.type}"
          href="${this.href}"
          postid="${this.postid || ''}"
        ></arena-embed-simple>`;
        }
        return html `<arena-embed-form @change="${this.handleForm}"></arena-embed-form>`;
    }
}
__decorate([
    property({
        type: String,
    }),
    __metadata("design:type", Object)
], ArenaEmbed.prototype, "type", void 0);
__decorate([
    property({
        type: String,
    }),
    __metadata("design:type", Object)
], ArenaEmbed.prototype, "href", void 0);
__decorate([
    property({
        type: String,
    }),
    __metadata("design:type", Object)
], ArenaEmbed.prototype, "postid", void 0);
__decorate([
    property({
        type: Boolean,
    }),
    __metadata("design:type", Object)
], ArenaEmbed.prototype, "border", void 0);
//# sourceMappingURL=ArenaEmbed.js.map