import { h } from "@stencil/core";
export class BpSdkNotification {
    constructor() {
        this.notification = undefined;
        this.removeNotification = undefined;
        this.text = undefined;
        this.useExternal = false;
    }
    resetState() { }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-notification');
        customElements.whenDefined('bp-sdk-external-notification').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-notification", { notification: this.notification, text: this.text, removeNotification: this.removeNotification });
    }
    renderInternal() {
        var _a;
        return (h("div", { class: "bp-sdk-notification__container" }, h("div", { class: "bp-sdk-notification_button__container" }, h("button", { type: "button", onClick: () => this.removeNotification(this.notification) }, !!this.text ? this.text : 'Close')), h("div", { innerHTML: (_a = this.notification) === null || _a === void 0 ? void 0 : _a.notification })));
    }
    static get is() { return "bp-sdk-notification"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-notification.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-notification.css"]
        };
    }
    static get properties() {
        return {
            "notification": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "INotificationState",
                    "resolved": "INotificationState",
                    "references": {
                        "INotificationState": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::INotificationState"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                }
            },
            "removeNotification": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(notification: INotificationState) => void",
                    "resolved": "(notification: INotificationState) => void",
                    "references": {
                        "INotificationState": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::INotificationState"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                }
            },
            "text": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string | undefined",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "text",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
