import { jsx as n } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useCallback as E } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { TransactionDetailsModal as b } from "./TransactionDetailsModal.js";
import { TransactionsTable as x } from "../TransactionsTable/TransactionsTable.js";
import { sharedTransactionDetailsEventProperties as L } from "../../../TransactionDetails/constants.js";
import M from "../../../../../hooks/useModalDetails/useModalDetails.js";
import P from "../../../../../core/Context/analytics/preact/useAnalyticsContext.js";
const V = ({
  balanceAccount: t,
  currenciesLookupResult: l,
  dataCustomization: c,
  loadingBalanceAccounts: m,
  onContactSupport: s,
  onRecordSelection: d,
  showDetails: u,
  transactionsListResult: p
}) => {
  const a = P(), { sortedCurrencies: e } = l, { updateDetails: i, resetDetails: f, selectedDetail: h } = M({
    transaction: {
      showDetails: u ?? !0,
      callback: d
    }
  }), C = E(
    ({ id: o, category: r }) => {
      r && a.addEvent?.("Viewed transaction details", {
        ...L,
        transactionType: r
      }), i({
        selection: {
          data: o,
          type: "transaction",
          balanceAccount: t
        },
        modalSize: "small"
      }).callback({ id: o });
    },
    [t, i, a]
  ), {
    error: D,
    fetching: T,
    fields: g,
    records: v,
    updateLimit: k,
    hasCustomColumn: y,
    ...w
  } = p;
  return /* @__PURE__ */ n(
    b,
    {
      dataCustomization: c,
      onContactSupport: s,
      resetDetails: f,
      selectedDetail: h,
      children: /* @__PURE__ */ n(
        x,
        {
          activeBalanceAccount: t,
          availableCurrencies: e,
          error: D,
          hasMultipleCurrencies: e.length > 1,
          loading: m || T,
          onContactSupport: s,
          onLimitSelection: k,
          onRowClick: C,
          showPagination: !0,
          transactions: v,
          customColumns: g,
          ...w
        }
      )
    }
  );
};
export {
  V as default
};
