import { r as registerInstance, c as createEvent, h } from './index-77a9c9e7.js';

const bpSdkBackButtonCss = "";
const BpSdkBackButtonStyle0 = bpSdkBackButtonCss;

const BpSdkBackButton = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.navigateBack = createEvent(this, "navigateBack", 7);
        this.text = '';
        this.icon = 'chevron-left';
        this.buttonDisabled = false;
        this.cssClasses = undefined;
        this.useExternal = false;
    }
    resetState() { }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-back-button');
        customElements.whenDefined('bp-sdk-external-back-button').then(() => {
            this.useExternal = true;
        });
        this.isButtonDisabled(this.buttonDisabled);
    }
    isButtonDisabled(isDisabled) {
        this.buttonDisabled = isDisabled;
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return (h("bp-sdk-external-back-button", { buttonDisabled: this.buttonDisabled, cssClasses: this.cssClasses, icon: this.icon, text: this.text }));
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-back-button__container" }, h("bp-sdk-button", { onClick: () => !this.buttonDisabled && this.navigateBack.emit(), text: this.text, buttonDisabled: this.buttonDisabled, class: this.cssClasses }, h("bp-sdk-icon-container", { name: this.icon }))));
    }
    static get watchers() { return {
        "buttonDisabled": ["isButtonDisabled"]
    }; }
};
BpSdkBackButton.style = BpSdkBackButtonStyle0;

export { BpSdkBackButton as bp_sdk_back_button };
