"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const components_1 = require("@react-email/components");
const util_1 = require("@ocap/util");
const chain_1 = require("../_libs/chain");
const style_1 = require("../_libs/style");
function Token({ locale, data, }) {
    const showAddress = data.address.slice(0, 4) + '...' + data.address.slice(-4);
    const from = { zh: '来自', en: 'from' }[locale] || 'from';
    const title = { zh: '接收', en: 'Received' }[locale] || 'Received';
    const chainHost = (0, chain_1.getUrlHost)(data.chainHost) || (0, chain_1.getChainHost)(data.chainId);
    const url = `https://${chainHost}/explorer/tokens/${data.address}/tx`;
    const amountV = (0, util_1.fromUnitToToken)(data.amount, data.decimal);
    return ((0, jsx_runtime_1.jsxs)("a", { href: url, target: "_blank", style: Object.assign(Object.assign({}, style_1.assetStyle), { margin: '1em 0', textDecoration: 'none', color: 'initial', display: 'block' }), children: [(0, jsx_runtime_1.jsxs)(components_1.Row, { style: style_1.titleStyle, children: [(0, jsx_runtime_1.jsx)(components_1.Column, { children: title }), (0, jsx_runtime_1.jsxs)(components_1.Column, { align: "right", style: style_1.summaryStyle, children: ["+", amountV, " ", data.symbol] })] }), (0, jsx_runtime_1.jsxs)(components_1.Text, { style: style_1.remarkStyle, children: [from, " ", showAddress] })] }));
}
exports.default = Token;
