/// <reference types="vite/client" />

declare module 'd3-cloud';

declare module 'd3-cloud' {
  interface Word {
    text: string;
    size: number;
    value?: number;
    x?: number;
    y?: number;
    rotate?: number;
    [key: string]: any;
  }

  interface Cloud {
    size: (size: [number, number]) => Cloud;
    words: (words: Word[]) => Cloud;
    padding: (padding: number) => Cloud;
    rotate: (rotate: (d: Word) => number) => Cloud;
    fontSize: (fontSize: (d: Word) => number) => Cloud;
    random: (random: () => number) => Cloud;
    spiral: (spiral: string) => Cloud;
    on: (type: string, callback: (words: Word[]) => void) => Cloud;
    start: () => void;
  }

  export default function (): Cloud;
}

declare module 'd3-scale' {
  interface ScaleOrdinal<Range> {
    (value: string | number): Range;
    domain: (domain: Array<string | number>) => ScaleOrdinal<Range>;
    range: (range: Range[]) => ScaleOrdinal<Range>;
  }

  export function scaleOrdinal<Range = string>(): ScaleOrdinal<Range>;
}

declare module 'd3-scale-chromatic' {
  // 定义所有颜色方案
  export const schemeCategory10: string[];
  export const schemeAccent: string[];
  export const schemeDark2: string[];
  export const schemePaired: string[];
  export const schemePastel1: string[];
  export const schemePastel2: string[];
  export const schemeSet1: string[];
  export const schemeSet2: string[];
  export const schemeSet3: string[];
  export const schemeTableau10: string[];

  // 其他颜色方案函数
  export function interpolateBlues(t: number): string;
  export function interpolateGreens(t: number): string;
  export function interpolateGreys(t: number): string;
  export function interpolateOranges(t: number): string;
  export function interpolatePurples(t: number): string;
  export function interpolateReds(t: number): string;
}
