'use strict';

var index = require('./index-p7cvUYAE.js');
var paymentMethodOptionUtils = require('./payment-method-option-utils-WYHIHy-l.js');
var parts = require('./parts-BXshb_S-.js');
require('./dinero-BwNN_k7x.js');

const JustifiSavedPaymentMethod = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.paymentMethodOptionSelected = index.createEvent(this, "paymentMethodOptionSelected", 7);
        this.onPaymentMethodOptionClick = (e) => {
            e.preventDefault();
            this.paymentMethodOptionSelected.emit(this.paymentMethodOption);
        };
    }
    async resolvePaymentMethod(insuranceValidation) {
        var _a;
        if (!insuranceValidation.isValid) {
            return { validationError: true };
        }
        return { token: (_a = this.paymentMethodOption) === null || _a === void 0 ? void 0 : _a.id };
    }
    ;
    render() {
        var _a, _b, _c;
        return (index.h(index.Host, { key: '66b8725a684241fc105d182ee5982167b2007506', class: "payment-method" }, index.h("div", { key: 'd0370f70b880f6a83b18eaeeefce7b8fde342ce9', class: "radio-list-item p-3", part: parts.radioListItem, onClick: this.onPaymentMethodOptionClick }, index.h("form-control-radio", { key: '76ed425815f77082ba1145aa2df04beef6044e07', name: "paymentMethodType", value: (_a = this.paymentMethodOption) === null || _a === void 0 ? void 0 : _a.id, checked: this.isSelected, label: `${paymentMethodOptionUtils.CardBrandLabels[(_b = this.paymentMethodOption) === null || _b === void 0 ? void 0 : _b.brand] || ''} *${(_c = this.paymentMethodOption) === null || _c === void 0 ? void 0 : _c.acct_last_four}` }))));
    }
};

exports.justifi_saved_payment_method = JustifiSavedPaymentMethod;
