import { h } from "@stencil/core";
export class BpSdkSendToExchange {
    constructor() {
        this.sendToExchangeHandler = undefined;
        this.buttonDisabled = false;
        this.text = 'Send to Exchange';
        this.useExternal = false;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-send-to-exchange');
        customElements.whenDefined('bp-sdk-external-send-to-exchange').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return (h("bp-sdk-external-send-to-exchange", { buttonDisabled: this.buttonDisabled, sendToExchangeHandler: this.sendToExchangeHandler, text: this.text }));
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-send-to-exchange__container" }, h("bp-sdk-send-to-exchange-button", { text: this.text, buttonDisabled: this.buttonDisabled, onClick: this.sendToExchangeHandler })));
    }
    static get is() { return "bp-sdk-send-to-exchange"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-send-to-exchange.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-send-to-exchange.css"]
        };
    }
    static get properties() {
        return {
            "sendToExchangeHandler": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "() => void",
                    "resolved": "() => void",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "On send to exchange handler"
                }
            },
            "buttonDisabled": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Is button disabled"
                },
                "attribute": "button-disabled",
                "reflect": false,
                "defaultValue": "false"
            },
            "text": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Text to display"
                },
                "attribute": "text",
                "reflect": false,
                "defaultValue": "'Send to Exchange'"
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
