'use strict';

// src/types/forex.ts
var FOREX_CAPITAL_SPLIT = {
  poolReserves: 0.5,
  tradingCapital: 0.5
};
function computePoolAllocations(amount) {
  const totalPoolReserves = amount * FOREX_CAPITAL_SPLIT.poolReserves;
  const tradingCapital = amount * FOREX_CAPITAL_SPLIT.tradingCapital;
  return {
    tradingCapital,
    totalPoolReserves,
    clearing: totalPoolReserves * 0.5,
    hedging: totalPoolReserves * 0.3,
    insurance: totalPoolReserves * 0.2
  };
}
var FOREX_CYCLE_OPTIONS = [
  { days: 30, feeRate: 0.1, commissionRate: 0.6, label: "30D" },
  { days: 60, feeRate: 0.08, commissionRate: 0.7, label: "60D" },
  { days: 90, feeRate: 0.07, commissionRate: 0.75, label: "90D" },
  { days: 180, feeRate: 0.05, commissionRate: 0.85, label: "180D" },
  { days: 360, feeRate: 0.03, commissionRate: 0.9, label: "360D" }
];
var FOREX_CURRENCY_PAIRS = [
  { id: "USDC_EURC", base: "USDC", quote: "EURC", symbol: "USDC/EURC", flag: "\u{1F1EA}\u{1F1FA}", name: "Euro", basePrice: 0.923, pipSize: 1e-4, spreadPips: 1.2 },
  { id: "USDC_GBPC", base: "USDC", quote: "GBPC", symbol: "USDC/GBPC", flag: "\u{1F1EC}\u{1F1E7}", name: "British Pound", basePrice: 0.789, pipSize: 1e-4, spreadPips: 1.5 },
  { id: "USDC_JPYC", base: "USDC", quote: "JPYC", symbol: "USDC/JPYC", flag: "\u{1F1EF}\u{1F1F5}", name: "Japanese Yen", basePrice: 154.5, pipSize: 0.01, spreadPips: 1 },
  { id: "USDC_AUDC", base: "USDC", quote: "AUDC", symbol: "USDC/AUDC", flag: "\u{1F1E6}\u{1F1FA}", name: "Australian Dollar", basePrice: 1.538, pipSize: 1e-4, spreadPips: 1.8 },
  { id: "USDC_CADC", base: "USDC", quote: "CADC", symbol: "USDC/CADC", flag: "\u{1F1E8}\u{1F1E6}", name: "Canadian Dollar", basePrice: 1.364, pipSize: 1e-4, spreadPips: 1.5 },
  { id: "USDC_CHFC", base: "USDC", quote: "CHFC", symbol: "USDC/CHFC", flag: "\u{1F1E8}\u{1F1ED}", name: "Swiss Franc", basePrice: 0.875, pipSize: 1e-4, spreadPips: 1.3 }
];
var FOREX_POOL_DEFAULTS = [
  { id: "clearing", nameKey: "forex.pool_clearing", descriptionKey: "forex.pool_clearing_desc", allocation: 0.5, totalSize: 125e5, utilization: 0.78, color: "#3B82F6", apy7d: 12.8, apy30d: 11.5, netFlow24h: 185e3, txCount24h: 42, txCountTotal: 12840, totalDeposits: 452e5, totalWithdrawals: 327e5, profitDistributed: 185e4, lastUpdated: Date.now() },
  { id: "hedging", nameKey: "forex.pool_hedging", descriptionKey: "forex.pool_hedging_desc", allocation: 0.3, totalSize: 75e5, utilization: 0.65, color: "#F59E0B", apy7d: 8.1, apy30d: 7.6, netFlow24h: 72e3, txCount24h: 24, txCountTotal: 7620, totalDeposits: 285e5, totalWithdrawals: 21e6, profitDistributed: 98e4, lastUpdated: Date.now() },
  { id: "insurance", nameKey: "forex.pool_insurance", descriptionKey: "forex.pool_insurance_desc", allocation: 0.2, totalSize: 5e6, utilization: 0.42, color: "#10B981", apy7d: 4.8, apy30d: 4.5, netFlow24h: 35e3, txCount24h: 14, txCountTotal: 4280, totalDeposits: 158e5, totalWithdrawals: 108e5, profitDistributed: 52e4, lastUpdated: Date.now() }
];
var FOREX_AGENT = {
  id: "stablefx-01",
  nameKey: "forex.agent_name",
  descriptionKey: "forex.agent_description",
  icon: "\u{1F4B1}",
  color: "#0EA5E9",
  supportedPairs: FOREX_CURRENCY_PAIRS.map((p) => p.id),
  dailyRoiMin: 2e-3,
  dailyRoiMax: 5e-3,
  totalManaged: 25e6,
  totalUsers: 3847,
  winRate: 72.5
};
function calculateForexNetProfit(grossProfit, cycleOption) {
  const feeAmount = grossProfit * cycleOption.feeRate;
  const postFeeProfit = grossProfit - feeAmount;
  const netProfit = postFeeProfit * cycleOption.commissionRate;
  return { feeAmount, postFeeProfit, netProfit };
}
function estimateForexProfit(amount, cycleDays, agent = FOREX_AGENT) {
  const cycleOption = FOREX_CYCLE_OPTIONS.find((c) => c.days === cycleDays) || FOREX_CYCLE_OPTIONS[0];
  const estimatedApy = (agent.dailyRoiMin + agent.dailyRoiMax) / 2 * 365 * 100;
  const dailyRate = estimatedApy / 100 / 365;
  const grossProfit = amount * dailyRate * cycleDays;
  const { feeAmount, netProfit } = calculateForexNetProfit(grossProfit, cycleOption);
  return { grossProfit, feeAmount, netProfit, dailyRate };
}

// src/types/aiTrading.ts
var PENALTY_TIERS = [
  { minProgress: 0.75, maxProgress: 1, rate: 0.5, label: "50%" },
  { minProgress: 0.5, maxProgress: 0.75, rate: 0.6, label: "60%" },
  { minProgress: 0.25, maxProgress: 0.5, rate: 0.7, label: "70%" },
  { minProgress: 0, maxProgress: 0.25, rate: 0.8, label: "80%" }
];
function calculateEarlyWithdrawalPenalty(investedAmount, profit, lockProgress) {
  const totalValue = investedAmount + profit;
  const isEarlyWithdrawal = lockProgress < 1;
  let penaltyRate = 0;
  if (isEarlyWithdrawal) {
    if (lockProgress >= 0.75) penaltyRate = 0.5;
    else if (lockProgress >= 0.5) penaltyRate = 0.6;
    else if (lockProgress >= 0.25) penaltyRate = 0.7;
    else penaltyRate = 0.8;
  }
  const estimatedPenalty = totalValue * penaltyRate;
  const estimatedRedemption = totalValue - estimatedPenalty;
  return { completionRate: lockProgress, penaltyRate, estimatedPenalty, estimatedRedemption, isEarlyWithdrawal };
}
var STRATEGY_CATEGORIES = {
  conservative: { labelKey: "ai.category_conservative", color: "#10B981", icon: "\u{1F6E1}\uFE0F" },
  balanced: { labelKey: "ai.category_balanced", color: "#3B82F6", icon: "\u2696\uFE0F" },
  aggressive: { labelKey: "ai.category_aggressive", color: "#EF4444", icon: "\u{1F680}" },
  hedge: { labelKey: "ai.category_hedge", color: "#8B5CF6", icon: "\u{1F512}" },
  arbitrage: { labelKey: "ai.category_arbitrage", color: "#F59E0B", icon: "\u26A1" },
  trend: { labelKey: "ai.category_trend", color: "#EC4899", icon: "\u{1F4C8}" },
  grid: { labelKey: "ai.category_grid", color: "#6366F1", icon: "\u25A6" },
  dca: { labelKey: "ai.category_dca", color: "#14B8A6", icon: "\u{1F4CA}" }
};
var RISK_LEVELS = {
  1: { labelKey: "ai.risk_very_low", color: "#10B981", bgColor: "#D1FAE5" },
  2: { labelKey: "ai.risk_low", color: "#22C55E", bgColor: "#DCFCE7" },
  3: { labelKey: "ai.risk_medium", color: "#F59E0B", bgColor: "#FEF3C7" },
  4: { labelKey: "ai.risk_high", color: "#F97316", bgColor: "#FFEDD5" },
  5: { labelKey: "ai.risk_very_high", color: "#EF4444", bgColor: "#FEE2E2" }
};
var ORDER_STATUS_CONFIG = {
  pending: { labelKey: "ai.status_pending", color: "#F59E0B", bgColor: "#FEF3C7" },
  active: { labelKey: "ai.status_active", color: "#10B981", bgColor: "#D1FAE5" },
  paused: { labelKey: "ai.status_paused", color: "#6B7280", bgColor: "#F3F4F6" },
  completed: { labelKey: "ai.status_completed", color: "#3B82F6", bgColor: "#DBEAFE" },
  cancelled: { labelKey: "ai.status_cancelled", color: "#EF4444", bgColor: "#FEE2E2" },
  pending_redemption: { labelKey: "ai.status_pending_redemption", color: "#8B5CF6", bgColor: "#EDE9FE" },
  redeemed: { labelKey: "ai.status_redeemed", color: "#14B8A6", bgColor: "#CCFBF1" }
};

// src/types/console.ts
var AI_LOG_COLORS = {
  SCAN: "#06B6D4",
  // Cyan
  THINKING: "#A855F7",
  // Purple
  INDICATOR: "#3B82F6",
  // Blue
  ANALYSIS: "#6366F1",
  // Indigo
  SIGNAL: "#F59E0B",
  // Amber
  STRATEGY: "#D946EF",
  // Fuchsia
  DECISION: "#F97316",
  // Orange
  ORDER: "#EC4899",
  // Pink
  FILLED: "#10B981",
  // Green
  PNL: "#22C55E",
  // Emerald
  RISK: "#EF4444",
  // Red
  NEWS: "#14B8A6",
  // Teal
  SYSTEM: "#9CA3AF"
  // Gray
};
var FOREX_LOG_COLORS = {
  RFQ: "#06B6D4",
  // Cyan
  QUOTE: "#8B5CF6",
  // Purple
  MATCH: "#10B981",
  // Green
  SETTLE: "#F59E0B",
  // Amber
  PVP: "#3B82F6",
  // Blue
  HEDGE: "#EC4899",
  // Pink
  CLEAR: "#14B8A6",
  // Teal
  POSITION: "#6366F1",
  // Indigo
  PNL: "#22C55E",
  // Emerald
  SYSTEM: "#9CA3AF"
  // Gray
};
var RISK_LEVEL_COLORS = {
  low: { color: "#10B981", bgColor: "#D1FAE5" },
  medium: { color: "#F59E0B", bgColor: "#FEF3C7" },
  high: { color: "#F97316", bgColor: "#FFEDD5" },
  critical: { color: "#EF4444", bgColor: "#FEE2E2" }
};
var TRADING_STATUS_COLORS = {
  active: { color: "#10B981", bgColor: "#D1FAE5" },
  paused: { color: "#F59E0B", bgColor: "#FEF3C7" },
  stopped: { color: "#EF4444", bgColor: "#FEE2E2" },
  cooldown: { color: "#6366F1", bgColor: "#E0E7FF" }
};
var AGENT_STATUS_COLORS = {
  active: { color: "#10B981", bgColor: "#D1FAE5", label: "Active" },
  paused: { color: "#F59E0B", bgColor: "#FEF3C7", label: "Paused" },
  idle: { color: "#6B7280", bgColor: "#F3F4F6", label: "Idle" },
  error: { color: "#EF4444", bgColor: "#FEE2E2", label: "Error" },
  initializing: { color: "#3B82F6", bgColor: "#DBEAFE", label: "Starting" }
};
var DEFAULT_CONSOLE_OPTIONS = {
  simulation: true,
  pollInterval: 5e3,
  maxLogs: 500,
  autoStart: false
};
var DEFAULT_RISK_STATUS = {
  timestamp: Date.now(),
  totalExposure: 0,
  maxExposure: 1e5,
  exposurePercent: 0,
  dailyPnl: 0,
  dailyPnlLimit: 5e3,
  dailyPnlPercent: 0,
  dailyTradeCount: 0,
  dailyTradeLimit: 50,
  currentDrawdown: 0,
  maxDrawdown: 15,
  drawdownPercent: 0,
  openPositions: 0,
  maxPositions: 10,
  riskLevel: "low",
  tradingStatus: "active",
  warnings: []
};
var DEFAULT_CONSOLE_METRICS = {
  nav: 0,
  navChange24h: 0,
  navChangePercent24h: 0,
  totalPnl: 0,
  realizedPnl: 0,
  unrealizedPnl: 0,
  pnlToday: 0,
  pnl7d: 0,
  pnl30d: 0,
  totalTrades: 0,
  tradesToday: 0,
  winRate: 0,
  winCount: 0,
  lossCount: 0,
  avgWin: 0,
  avgLoss: 0,
  profitFactor: 0,
  openPositions: 0,
  totalExposure: 0,
  avgLeverage: 0
};
function calculateRiskLevel(exposurePercent, drawdownPercent, dailyPnlPercent) {
  const worstMetric = Math.max(exposurePercent, drawdownPercent, Math.abs(dailyPnlPercent));
  if (worstMetric >= 90) return "critical";
  if (worstMetric >= 70) return "high";
  if (worstMetric >= 40) return "medium";
  return "low";
}
function formatPnl(pnl) {
  const sign = pnl >= 0 ? "+" : "";
  if (Math.abs(pnl) >= 1e6) {
    return `${sign}$${(pnl / 1e6).toFixed(2)}M`;
  }
  if (Math.abs(pnl) >= 1e3) {
    return `${sign}$${(pnl / 1e3).toFixed(2)}K`;
  }
  return `${sign}$${pnl.toFixed(2)}`;
}
function formatPercent(value, showSign = true) {
  const sign = showSign && value >= 0 ? "+" : "";
  return `${sign}${value.toFixed(2)}%`;
}

exports.AGENT_STATUS_COLORS = AGENT_STATUS_COLORS;
exports.AI_LOG_COLORS = AI_LOG_COLORS;
exports.DEFAULT_CONSOLE_METRICS = DEFAULT_CONSOLE_METRICS;
exports.DEFAULT_CONSOLE_OPTIONS = DEFAULT_CONSOLE_OPTIONS;
exports.DEFAULT_RISK_STATUS = DEFAULT_RISK_STATUS;
exports.FOREX_AGENT = FOREX_AGENT;
exports.FOREX_CAPITAL_SPLIT = FOREX_CAPITAL_SPLIT;
exports.FOREX_CURRENCY_PAIRS = FOREX_CURRENCY_PAIRS;
exports.FOREX_CYCLE_OPTIONS = FOREX_CYCLE_OPTIONS;
exports.FOREX_LOG_COLORS = FOREX_LOG_COLORS;
exports.FOREX_POOL_DEFAULTS = FOREX_POOL_DEFAULTS;
exports.ORDER_STATUS_CONFIG = ORDER_STATUS_CONFIG;
exports.PENALTY_TIERS = PENALTY_TIERS;
exports.RISK_LEVELS = RISK_LEVELS;
exports.RISK_LEVEL_COLORS = RISK_LEVEL_COLORS;
exports.STRATEGY_CATEGORIES = STRATEGY_CATEGORIES;
exports.TRADING_STATUS_COLORS = TRADING_STATUS_COLORS;
exports.calculateEarlyWithdrawalPenalty = calculateEarlyWithdrawalPenalty;
exports.calculateForexNetProfit = calculateForexNetProfit;
exports.calculateRiskLevel = calculateRiskLevel;
exports.computePoolAllocations = computePoolAllocations;
exports.estimateForexProfit = estimateForexProfit;
exports.formatPercent = formatPercent;
exports.formatPnl = formatPnl;
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map