import { r as registerInstance, h } from './index-CV0Pyo1O.js';
import { f as filterParams, p as propsParams, c as clearParams } from './payouts-list-params-state-CiGfmyWW.js';
import { f as filterMenu, a as filterParam } from './parts-CPKMvyV_.js';
import { S as StyledHost } from './styled-host-D84RBv1W.js';
import './event-types-CZfYo5-1.js';
import { c as convertToUTC, a as convertToLocal } from './utils-C25uIOK0.js';
import './config-state-kKn89dp1.js';
import { P as PayoutStatusesSafeNames } from './Plaid-DxSkT8pY.js';
import './Pagination-CLHwhyvu.js';
import './Business-BcNb9bVO.js';
import './index-cDVGjRkU.js';
import './dinero-HXpYMWUU.js';

const JustifiPayoutsListFilters = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.setParamsOnChange = (name, value) => {
            filterParams[name] = value;
        };
        this.handleDateInput = (name, value) => {
            const utcDate = convertToUTC(value, { setEndOfDay: true });
            this.setParamsOnChange(name, utcDate);
        };
    }
    componentWillLoad() {
        const propsToSet = {
            status: this.status,
            created_after: this.createdAfter,
            created_before: this.createdBefore
        };
        Object.entries(propsToSet).forEach(([key, value]) => {
            if (value) {
                propsParams[key] = value;
            }
        });
    }
    get statusOptions() {
        return [
            { label: 'All', value: '' },
            { label: PayoutStatusesSafeNames.paid, value: 'paid' },
            { label: PayoutStatusesSafeNames.failed, value: 'failed' },
            { label: PayoutStatusesSafeNames.forwarded, value: 'forwarded' },
            { label: PayoutStatusesSafeNames.scheduled, value: 'scheduled' },
            { label: PayoutStatusesSafeNames.in_transit, value: 'in_transit' },
            { label: PayoutStatusesSafeNames.canceled, value: 'canceled' }
        ];
    }
    render() {
        const filterMenuParams = Object.assign({}, filterParams);
        return (h(StyledHost, { key: '4047a84518ef07a3e9d22f3d6866452dcdd7bab3' }, h("table-filters-menu", { key: 'a1db3d5c8c0bdc44ea7d9dc35f0c460b4b5930ab', params: filterMenuParams, clearParams: clearParams, part: filterMenu }, h("div", { key: '0d8e8244eb9516a97914942e1e0836dd8ab53639', class: "grid-cols-2 gap-3 p-1" }, h("div", { key: '47021850703e8ab104b287b4efa93693272c435b', class: "p-2" }, h("form-control-select", { key: 'f0312f36bc05c4fa6d4e7841624f8d977cdec6c1', name: "status", label: "Status", options: this.statusOptions, inputHandler: this.setParamsOnChange, defaultValue: this.status || filterParams.status || '', disabled: !!this.status, part: filterParam })), h("div", { key: '211ac119c8172aa4e626b7344b25a1df26019aa8', class: "p-2" }, h("form-control-date", { key: '168757bdc92bf54e076d4d5aff63f8a04de65464', name: "created_after", label: "Created After", inputHandler: this.handleDateInput, defaultValue: convertToLocal(this.createdAfter, { showInputDate: true }) ||
                convertToLocal(filterParams.created_after, { showInputDate: true }), disabled: !!this.createdAfter, part: filterParam })), h("div", { key: '43aa8054ba063b70eadfff7240908329f47d1c02', class: "p-2" }, h("form-control-date", { key: '16a86a41c301dd32a6d46067c32d1316c80ceb5d', name: "created_before", label: "Created Before", inputHandler: this.handleDateInput, defaultValue: convertToLocal(this.createdBefore, { showInputDate: true }) ||
                convertToLocal(filterParams.created_before, { showInputDate: true }), disabled: !!this.createdBefore, part: filterParam }))))));
    }
};

export { JustifiPayoutsListFilters as justifi_payouts_list_filters };
