import { h } from "@stencil/core";
export class BpSdkMessage {
    constructor() {
        this.message = undefined;
        this.useExternal = false;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-message');
        customElements.whenDefined('bp-sdk-external-message').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-message", { message: this.message });
    }
    renderInternal() {
        var _a;
        return h("aside", { role: "alert", "aria-live": "polite", class: "bp-sdk-message__container", innerHTML: (_a = this.message) === null || _a === void 0 ? void 0 : _a.target });
    }
    static get is() { return "bp-sdk-message"; }
    static get properties() {
        return {
            "message": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "IMessage",
                    "resolved": "IMessage",
                    "references": {
                        "IMessage": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::IMessage"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Message to display on application form"
                }
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
