import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { n as rOnLoad } from './helpers.js';
import { i as inheritAttributes } from './attributes.js';
import { B as BEM } from './bem.js';

const StageImage = /*@__PURE__*/ proxyCustomElement(class StageImage extends HTMLElement {
    constructor(registerHost) {
        super();
        if (registerHost !== false) {
            this.__registerHost();
        }
        this.imageInheritAttributes = {};
        this.isOnLoadEventDone = false;
    }
    componentDidLoad() {
        rOnLoad(() => {
            this.isOnLoadEventDone = true;
        });
    }
    componentWillLoad() {
        this.imageInheritAttributes = inheritAttributes(this.el, ['alt']);
    }
    render() {
        const block = BEM.block('stage-image');
        const imageSrc = this.fallback ? this.fallback : this.srcSet.split(',')[0];
        return (h(Host, { key: 'a328489d91f055d488a89e4e2f4297db63d2eec1', class: Object.assign({}, block.class()) }, this.isOnLoadEventDone ? (h("img", Object.assign({ src: imageSrc, srcset: this.srcSet, sizes: "100vw" }, this.imageInheritAttributes))) : ('')));
    }
    get el() { return this; }
}, [256, "bal-stage-image", {
        "srcSet": [1, "src-set"],
        "fallback": [1],
        "isOnLoadEventDone": [32]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["bal-stage-image"];
    components.forEach(tagName => { switch (tagName) {
        case "bal-stage-image":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, StageImage);
            }
            break;
    } });
}

const BalStageImage = StageImage;
const defineCustomElement = defineCustomElement$1;

export { BalStageImage, defineCustomElement };
