import { BundledLanguage, BundledTheme, CodeToHastOptions, DecorationItem, HighlighterGeneric, LanguageRegistration, ShikiTransformer, ThemeRegistrationResolved, ThemedToken } from "shiki";
import { ElementContent } from "hast";

//#region src/types.d.ts
interface FileContents {
  cacheKey?: string;
  name: string;
  contents: string;
  lang?: SupportedLanguages;
  header?: string;
}
type PJSThemeNames = BundledTheme | "pierre-dark" | "pierre-light" | (string & {});
type ThemesType = Record<"dark" | "light", PJSThemeNames>;
type PJSHighlighter = HighlighterGeneric<SupportedLanguages, PJSThemeNames>;
type ChangeTypes = "change" | "rename-pure" | "rename-changed" | "new" | "deleted";
interface ParsedPatch {
  patchMetadata?: string;
  files: FileDiffMetadata[];
}
interface ContextContent {
  type: "context";
  lines: string[];
  noEOFCR: boolean;
}
interface ChangeContent {
  type: "change";
  deletions: string[];
  additions: string[];
  noEOFCRDeletions: boolean;
  noEOFCRAdditions: boolean;
}
interface Hunk {
  collapsedBefore: number;
  splitLineStart: number;
  splitLineCount: number;
  unifiedLineStart: number;
  unifiedLineCount: number;
  additionCount: number;
  additionStart: number;
  additionLines: number;
  deletionCount: number;
  deletionStart: number;
  deletionLines: number;
  hunkContent: (ContextContent | ChangeContent)[];
  hunkContext: string | undefined;
  hunkSpecs: string | undefined;
}
interface FileDiffMetadata {
  name: string;
  prevName: string | undefined;
  lang?: SupportedLanguages;
  type: ChangeTypes;
  hunks: Hunk[];
  splitLineCount: number;
  unifiedLineCount: number;
  oldMode?: string;
  mode?: string;
  oldLines?: string[];
  newLines?: string[];
  cacheKey?: string;
}
type SupportedLanguages = BundledLanguage | "text";
type HunkLineType = "context" | "expanded" | "addition" | "deletion" | "metadata";
type ThemeTypes = "system" | "light" | "dark";
type HunkSeparators = "simple" | "metadata" | "line-info" | "custom";
type LineDiffTypes = "word-alt" | "word" | "char" | "none";
interface BaseCodeOptions {
  theme?: PJSThemeNames | ThemesType;
  disableLineNumbers?: boolean;
  overflow?: "scroll" | "wrap";
  themeType?: ThemeTypes;
  disableFileHeader?: boolean;
  useCSSClasses?: boolean;
  tokenizeMaxLineLength?: number;
  unsafeCSS?: string;
}
interface BaseDiffOptions extends BaseCodeOptions {
  diffStyle?: "unified" | "split";
  diffIndicators?: "classic" | "bars" | "none";
  disableBackground?: boolean;
  hunkSeparators?: HunkSeparators;
  expandUnchanged?: boolean;
  lineDiffType?: LineDiffTypes;
  maxLineDiffLength?: number;
  expansionLineCount?: number;
}
interface PrePropertiesConfig extends Required<Pick<BaseDiffOptions, "diffIndicators" | "disableBackground" | "disableLineNumbers" | "overflow" | "themeType">> {
  split: boolean;
  themeStyles: string;
  totalLines: number;
}
interface RenderHeaderMetadataProps {
  oldFile?: FileContents;
  newFile?: FileContents;
  fileDiff?: FileDiffMetadata;
}
type RenderHeaderMetadataCallback = (props: RenderHeaderMetadataProps) => Element | null | undefined | string | number;
type RenderFileMetadata = (file: FileContents) => Element | null | undefined | string | number;
type ExtensionFormatMap = Record<string, SupportedLanguages | undefined>;
type AnnotationSide = "deletions" | "additions";
type OptionalMetadata<T> = T extends undefined ? {
  metadata?: undefined;
} : {
  metadata: T;
};
type LineAnnotation<T = undefined> = {
  lineNumber: number;
} & OptionalMetadata<T>;
type DiffLineAnnotation<T = undefined> = {
  side: AnnotationSide;
  lineNumber: number;
} & OptionalMetadata<T>;
interface GapSpan {
  type: "gap";
  rows: number;
}
type LineSpans = GapSpan | AnnotationSpan;
type LineTypes = "change-deletion" | "change-addition" | "context" | "context-expanded";
interface LineInfo {
  type: LineTypes;
  lineNumber: number;
  altLineNumber?: number;
  lineIndex: number;
}
interface SharedRenderState {
  lineInfo: Record<number, LineInfo | undefined> | ((shikiLineNumber: number) => LineInfo);
}
interface AnnotationSpan {
  type: "annotation";
  hunkIndex: number;
  lineIndex: number;
  annotations: string[];
}
interface LineEventBaseProps {
  type: "line";
  lineNumber: number;
  lineElement: HTMLElement;
  numberElement: HTMLElement | undefined;
  numberColumn: boolean;
}
interface DiffLineEventBaseProps extends Omit<LineEventBaseProps, "type"> {
  type: "diff-line";
  annotationSide: AnnotationSide;
  lineType: LineTypes;
}
interface ObservedAnnotationNodes {
  type: "annotations";
  column1: {
    container: HTMLElement;
    child: HTMLElement;
    childHeight: number;
  };
  column2: {
    container: HTMLElement;
    child: HTMLElement;
    childHeight: number;
  };
  currentHeight: number | "auto";
}
interface ObservedGridNodes {
  type: "code";
  codeElement: HTMLElement;
  numberElement: HTMLElement | null;
  codeWidth: number | "auto";
  numberWidth: number;
}
interface HunkData {
  slotName: string;
  hunkIndex: number;
  lines: number;
  type: "additions" | "deletions" | "unified";
  expandable?: {
    chunked: boolean;
    up: boolean;
    down: boolean;
  };
}
interface ChangeHunk {
  diffGroupStartIndex: number;
  deletionStartIndex: number;
  additionStartIndex: number;
  deletionLines: string[];
  additionLines: string[];
}
type AnnotationLineMap<LAnnotation> = Record<number, DiffLineAnnotation<LAnnotation>[] | undefined>;
type ExpansionDirections = "up" | "down" | "both";
interface RenderDiffFilesResult {
  oldLines: ElementContent[];
  newLines: ElementContent[];
  hunks?: undefined;
}
interface RenderDiffHunksResult {
  hunks: RenderDiffFilesResult[];
  oldLines?: undefined;
  newLines?: undefined;
}
interface ThemedFileResult {
  code: ElementContent[];
  themeStyles: string;
  baseThemeType: "light" | "dark" | undefined;
}
interface ThemedDiffResult {
  code: RenderDiffFilesResult | RenderDiffHunksResult;
  themeStyles: string;
  baseThemeType: "light" | "dark" | undefined;
}
interface RenderFileOptions {
  theme: PJSThemeNames | Record<"dark" | "light", PJSThemeNames>;
  tokenizeMaxLineLength: number;
}
interface RenderDiffOptions {
  theme: PJSThemeNames | Record<"dark" | "light", PJSThemeNames>;
  tokenizeMaxLineLength: number;
  lineDiffType: LineDiffTypes;
}
interface RenderFileResult {
  result: ThemedFileResult;
  options: RenderFileOptions;
}
interface RenderDiffResult {
  result: ThemedDiffResult;
  options: RenderDiffOptions;
}
interface RenderedFileASTCache {
  file: FileContents;
  highlighted: boolean;
  options: RenderFileOptions;
  result: ThemedFileResult | undefined;
}
interface RenderedDiffASTCache {
  diff: FileDiffMetadata;
  highlighted: boolean;
  options: RenderDiffOptions;
  result: ThemedDiffResult | undefined;
}
//#endregion
export { AnnotationLineMap, AnnotationSide, AnnotationSpan, BaseCodeOptions, BaseDiffOptions, type BundledLanguage, ChangeContent, ChangeHunk, ChangeTypes, type CodeToHastOptions, ContextContent, type DecorationItem, DiffLineAnnotation, DiffLineEventBaseProps, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, GapSpan, Hunk, HunkData, HunkLineType, HunkSeparators, type LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, ObservedAnnotationNodes, ObservedGridNodes, PJSHighlighter, PJSThemeNames, ParsedPatch, PrePropertiesConfig, RenderDiffFilesResult, RenderDiffHunksResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderMetadataProps, RenderedDiffASTCache, RenderedFileASTCache, SharedRenderState, type ShikiTransformer, SupportedLanguages, type ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, type ThemedToken, ThemesType };
//# sourceMappingURL=types.d.ts.map