'use strict';

var index = require('./index-p7cvUYAE.js');
var checkPkgVersion = require('./check-pkg-version-B9EoYyZR.js');
var Analytics = require('./Analytics-C6KBHEIP.js');
var configState = require('./config-state-BIgGhhe9.js');
var styledHost = require('./styled-host-Ch0-dxF-.js');
require('./event-types-YOY5TKUN.js');
require('./package-YyJzVqrh.js');
require('./Api-D9vOcUw4.js');
require('./utils-CYONRFR6.js');
require('./dinero-BwNN_k7x.js');
require('./Plaid-CPESyiiV.js');
require('./Pagination-Dediz133.js');
require('./Business-oBifyXkW.js');
require('./index-W-zoNiyM.js');

const JustifiBankAccountForm = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
    }
    async componentWillLoad() {
        await configState.waitForConfig();
        checkPkgVersion.checkPkgVersion();
        this.analytics = new Analytics.JustifiAnalytics(this);
    }
    disconnectedCallback() {
        var _a;
        (_a = this.analytics) === null || _a === void 0 ? void 0 : _a.cleanup();
    }
    async validate() {
        if (!this.bankAccountFormElement) {
            return false;
        }
        return this.bankAccountFormElement.validate();
    }
    async tokenize({ clientId, paymentMethodMetadata, account }) {
        if (!this.bankAccountFormElement) {
            return {
                error: {
                    message: 'Bank account form is not available.',
                },
            };
        }
        return this.bankAccountFormElement.tokenize({ clientId, paymentMethodMetadata, account });
    }
    render() {
        return (index.h(styledHost.StyledHost, { key: '3c8a48f6060f14433ae94399fc48097cb138e301' }, index.h("bank-account-form", { key: '30cd40b60629f5c7f874194dd7641ee3737e8b69', ref: (el) => (this.bankAccountFormElement = el) })));
    }
};

exports.justifi_bank_account_form = JustifiBankAccountForm;
