'use strict';

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

const index = require('./index-ceff47a0.js');
const index_esm_min = require('./index.esm.min-f57d151c.js');
const reduxStore_service = require('./redux-store.service-10b7725a.js');

const bpSdkFilterApplicationFormStateContainerCss = "";
const BpSdkFilterApplicationFormStateContainerStyle0 = bpSdkFilterApplicationFormStateContainerCss;

const BpSdkFilterApplicationFormStateContainer = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.handleSubscriptions = () => {
            this.storeUnsubscribe && this.storeUnsubscribe();
            this.storeUnsubscribe = reduxStore_service.store.mapStateToProps(this, this.mapStateToProps);
        };
        this.mapStateToProps = (state) => {
            return {
                state: index_esm_min.IL(state),
            };
        };
        this.targetState = undefined;
        this.state = undefined;
        this.useExternal = false;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
        this.handleSubscriptions();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-filter-application-form-state-container');
        customElements.whenDefined('bp-sdk-external-filter-application-form-state-container').then(() => {
            this.useExternal = true;
        });
        this.handleSubscriptions();
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return index.h("bp-sdk-external-filter-application-form-state-container", { targetState: this.targetState, state: this.state });
    }
    renderInternal() {
        return (this.state === this.targetState && (index.h("div", { class: "bp-sdk-filter-application-form-state-container__container" }, index.h("host", null))));
    }
};
BpSdkFilterApplicationFormStateContainer.style = BpSdkFilterApplicationFormStateContainerStyle0;

exports.bp_sdk_filter_application_form_state_container = BpSdkFilterApplicationFormStateContainer;
