'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-ceff47a0.js');

const bpSdkBackButtonCss = "";
const BpSdkBackButtonStyle0 = bpSdkBackButtonCss;

const BpSdkBackButton = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.navigateBack = index.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 (index.h("bp-sdk-external-back-button", { buttonDisabled: this.buttonDisabled, cssClasses: this.cssClasses, icon: this.icon, text: this.text }));
    }
    renderInternal() {
        return (index.h("div", { class: "bp-sdk-back-button__container" }, index.h("bp-sdk-button", { onClick: () => !this.buttonDisabled && this.navigateBack.emit(), text: this.text, buttonDisabled: this.buttonDisabled, class: this.cssClasses }, index.h("bp-sdk-icon-container", { name: this.icon }))));
    }
    static get watchers() { return {
        "buttonDisabled": ["isButtonDisabled"]
    }; }
};
BpSdkBackButton.style = BpSdkBackButtonStyle0;

exports.bp_sdk_back_button = BpSdkBackButton;
