import { r as registerInstance, h, H as Host, e as getElement } from './index-dd1fc9a4.js';
var wistiaVideoCss = ".sc-wistia-video-h{display:block}.sc-wistia-video-h .wistia_embed.sc-wistia-video{margin:auto}";
var WistiaVideo = /** @class */ (function () {
    function WistiaVideo(hostRef) {
        registerInstance(this, hostRef);
        this.width = 720;
        this.height = 520;
    }
    WistiaVideo.prototype.handleWindowResize = function () {
        var _this = this;
        window.requestAnimationFrame(function () { return _this.resizeVideo(); });
    };
    WistiaVideo.prototype.componentDidLoad = function () {
        var _this = this;
        window.requestAnimationFrame(function () { return _this.resizeVideo(); });
    };
    WistiaVideo.prototype.resizeVideo = function () {
        if (this.el) {
            var parent = this.el.parentElement;
            var width = parent === null || parent === void 0 ? void 0 : parent.offsetWidth;
            if (!width) {
                return;
            }
            this.width = width;
            this.height = width * (10 / 16);
        }
    };
    WistiaVideo.prototype.render = function () {
        var videoId = this.videoId;
        if (!videoId) {
            return null;
        }
        return (h(Host, null, h("script", { src: "//fast.wistia.com/assets/external/E-v1.js", async: true }), h("div", { class: "wistia_embed wistia_async_" + videoId, style: {
                width: this.width + "px",
                height: this.height + "px",
            } }, "\u00A0")));
    };
    Object.defineProperty(WistiaVideo.prototype, "el", {
        get: function () { return getElement(this); },
        enumerable: false,
        configurable: true
    });
    return WistiaVideo;
}());
WistiaVideo.style = wistiaVideoCss;
export { WistiaVideo as wistia_video };
