import { type CaptionEmphasis, type CaptionWordTiming } from './caption-words-rederive'; import { type CaptionRun, type CaptionRunStyle } from './caption-runs'; import { type TextstyleCatalog } from './caption-style-preset'; export declare const CAPTION_ZONES: readonly ["top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right"]; export type CaptionZone = typeof CAPTION_ZONES[number]; export type CaptionBackgroundMode = 'per-line' | 'block'; export type CaptionBackgroundFit = 'text' | 'frame'; export type CaptionAlign = 'left' | 'center' | 'right'; export type CaptionVerticalAlign = 'top' | 'middle' | 'bottom'; export type CaptionTextTransform = 'upper' | 'uppercase' | 'lower' | 'lowercase' | 'title' | 'capitalize' | 'none'; export type CaptionTextAnchor = 'tl' | 'tc' | 'tr' | 'ml' | 'mc' | 'mr' | 'bl' | 'bc' | 'br'; export type CaptionStrokeMethod = 'webkit-outline'; export interface CaptionAnimationSlot { id: string; durationSec?: number; ease?: string; amp?: number; } export interface CaptionAnimation { in?: CaptionAnimationSlot; loop?: CaptionAnimationSlot; out?: CaptionAnimationSlot; } export interface CaptionShadow { color: string; opacity?: number; blurPx?: number; distancePx?: number; angleDeg?: number; } export interface CaptionGlow { color: string; density?: number; spread?: number; offsetX?: number; offsetY?: number; } export interface CaptionPosition { x?: number; y?: number; } export interface CaptionLayout { mode: 'reference-pixel'; referenceWidthPx: number; referenceHeightPx: number; leftPx: number; widthPx: number; bottomPx: number; textAlign: 'center'; maxLines: 1; } export interface CaptionTextStyle { karaoke?: { doneColor?: string; fill?: 'char' | 'word' | 'smooth'; startIndex?: number; }; color?: string; sizePx?: number; /** zone 方式の px 系フィールドの基準出力高さ(issue #40 §2)。integer ≥ 1。layout と排他。 */ referenceHeightPx?: number; fontFamily?: string; fontWeight?: number; weight?: number; italic?: boolean; underline?: boolean; strikethrough?: boolean; list?: 'bullet' | null; opacity?: number; letterSpacingEm?: number; lineHeight?: number; align?: CaptionAlign; verticalAlign?: CaptionVerticalAlign; vertical?: boolean; textTransform?: CaptionTextTransform; maxWidthPct?: number; wrapWidthPct?: number; maxCharacters?: number; textAnchor?: CaptionTextAnchor; position?: CaptionPosition; shadow?: CaptionShadow; glow?: CaptionGlow; animation?: CaptionAnimation; stroke?: { method?: CaptionStrokeMethod; color?: string; widthPx?: number; }; strokes?: Array<{ color: string; width_px: number; offset_x?: number; offset_y?: number; }>; strokeInner?: { color?: string; widthPx?: number; }; fillGradient?: { colors: string[]; angleDeg: number; }; fill?: { type: 'solid'; color: string; } | { type: 'gradient'; stops: Array<{ at: number; color: string; }>; angle_deg: number; } | { type: 'pattern'; pattern: { id: string; scale: number; fg: string; bg: string | { stops: Array<{ at: number; color: string; }>; angle_deg: number; }; }; }; extrude?: { depthPx: number; color: string; colorEnd?: string; angleDeg: number; }; background?: { color?: string; opacity?: number; radiusPx?: number; paddingPx?: number; widthPct?: number; heightPct?: number; offsetX?: number; offsetY?: number; mode?: CaptionBackgroundMode; fit?: CaptionBackgroundFit; }; zone?: CaptionZone; layout?: CaptionLayout; } export interface CaptionTextStylePatch { karaoke?: CaptionTextStyle['karaoke'] | null; color?: string | null; sizePx?: number | null; wrapWidthPct?: number | null; fontWeight?: number | null; weight?: number | null; lineHeight?: number | null; letterSpacingEm?: number | null; fontFamily?: string | null; shadow?: CaptionShadow | null; glow?: CaptionGlow | null; stroke?: { color?: string | null; widthPx?: number | null; }; strokeInner?: { color?: string; widthPx?: number; } | null; fillGradient?: { colors: string[]; angleDeg: number; } | null; extrude?: { depthPx: number; color: string; colorEnd?: string; angleDeg: number; } | null; background?: { color?: string | null; opacity?: number | null; radiusPx?: number | null; paddingPx?: number | null; mode?: CaptionBackgroundMode | null; fit?: CaptionBackgroundFit | null; }; animation?: { in?: { id: string; durationSec?: number; ease?: string | null; amp?: number | null; } | null; loop?: { id: string; durationSec?: number; ease?: string | null; amp?: number | null; } | null; out?: { id: string; durationSec?: number; ease?: string | null; amp?: number | null; } | null; } | null; zone?: CaptionZone | null; } export interface CaptionRecord { id: string; start: number; end: number; text: string; speaker: string | null; sourceRef: { segment: number; } | null; edited: boolean; src?: string; words?: CaptionWordTiming[]; unrecognized?: { start: number; end: number; }[]; style?: 'plain' | 'karaoke' | 'pop' | 'reveal' | 'reveal-word'; displayText?: string; displayFragments?: string[]; stylePreset?: string; /** 省略時は source。output は edit.json の出力時間軸を直接参照する。 */ timeDomain?: 'source' | 'output'; textStyle?: CaptionTextStyle; styleSources?: Record; extra?: Record; runs?: CaptionRun[]; } export interface WordBookCaptionChange { id: string; text: string; words?: CaptionWordTiming[]; display_text?: string; display_fragments?: string[]; } export declare function parseCaptions(source: string, options?: { catalog?: TextstyleCatalog; }): { captions: CaptionRecord[]; defaultTextStyle?: CaptionTextStyle; warnings: string[]; }; export declare function mergeCaptionTextStyles(defaultStyle: CaptionTextStyle | undefined, captionStyle: CaptionTextStyle | undefined): CaptionTextStyle | undefined; export declare function shiftCaptionLine(source: string, captionId: string, deltaStart: number, deltaEnd: number): string; /** 字幕の時刻と domain を絶対値で更新する。undo は元値をそのまま渡して完全復元できる。 */ export declare function setCaptionTimingLine(source: string, captionId: string, start: number, end: number, timeDomain: 'source' | 'output' | null | undefined, edited: boolean): string; export declare function updateCaptionFieldsInSource(source: string, captionId: string, updates: { text?: string; speaker?: string | null; unrecognized?: ReadonlyArray<{ start: number; end: number; }> | null; style?: string | null; displayTiming?: 'full' | 'speech-tight' | null; }): string; export declare function updateCaptionFieldsInSourceWithReport(source: string, captionId: string, updates: { text?: string; speaker?: string | null; unrecognized?: ReadonlyArray<{ start: number; end: number; }> | null; style?: string | null; displayTiming?: 'full' | 'speech-tight' | null; }): { source: string; removedRuns: CaptionRun[]; removedEmphasis: CaptionEmphasis[]; }; export type CaptionRunEdit = { kind: 'style'; from: number; to: number; style: CaptionRunStyle; } | { kind: 'role'; from: number; to: number; role: string; } | { kind: 'remove'; index: number; } | { kind: 'insert'; index: number; run: CaptionRun; }; /** Change only the target caption's runs property; retain unrelated source bytes. */ export declare function updateCaptionRunsInSource(source: string, captionId: string, edit: CaptionRunEdit): string; export declare function captionEmphasisRemovedNotice(removed: readonly CaptionEmphasis[]): string | undefined; export declare function captionEditNotices(result: { removedRuns: readonly CaptionRun[]; removedEmphasis: readonly CaptionEmphasis[]; }, oldDisplayText: string): string[]; export declare function applyWordBookToCaptionsInSource(source: string, changes: WordBookCaptionChange[]): string; export declare function applyWordBookToCaptionsInSourceWithNotices(source: string, changes: WordBookCaptionChange[]): { source: string; notices: string[]; }; export declare function updateCaptionTextStyleInSource(source: string, captionId: string, updates: CaptionTextStylePatch, options?: { catalog?: TextstyleCatalog; } | TextstyleCatalog): string; export declare function updateCaptionStylePresetInSource(source: string, captionIds: readonly string[], presetId: string | null, options?: { catalog?: TextstyleCatalog; output?: { width: number; height: number; }; }): { source: string; changed: number; }; export declare function insertCaptionLine(source: string, caption: CaptionRecord): string; export declare function removeCaptionLine(source: string, captionId: string): string; export declare function splitCaptionLine(source: string, captionId: string, wordIndex: number, newCaptionId: string): string; export declare function mergeCaptionLines(source: string, captionIds: readonly string[]): string;