export interface SegmentInfo { id: string; start: number; end: number; } export interface CreateDraftInput { width?: number; height?: number; userId?: string; } export interface CreateDraftOutput { draftId: string; filePath: string; } export interface DraftInfo { draftId: string; canvasWidth: number; canvasHeight: number; duration: number; fps: number; trackSummary: { id: string; type: string; segmentCount: number; }[]; materialSummary: { videos: number; audios: number; texts: number; stickers: number; effects: number; }; } export interface DraftListItem { draftId: string; filePath: string; name?: string; duration?: number; canvasWidth?: number; canvasHeight?: number; createdAt?: number; modifiedAt?: number; } export interface EasyCreateMaterialInput { draftId: string; audioUrl: string; imgUrl?: string; videoUrl?: string; text?: string; textColor?: string; fontSize?: number; textTransformY?: number; } export interface EasyCreateMaterialOutput { draftId: string; message: string; } export interface CaptionItem { text: string; start: number; end: number; keyword?: string; keywordColor?: string; fontSize?: number; keywordFontSize?: number; inAnimation?: string; outAnimation?: string; loopAnimation?: string; inAnimationDuration?: number; outAnimationDuration?: number; loopAnimationDuration?: number; } export interface AddCaptionsInput { draftId: string; captions: CaptionItem[] | string; font?: string; alignment?: number; alpha?: number; textColor?: string; fontSize?: number; underline?: boolean; bold?: boolean; italic?: boolean; textEffect?: string; letterSpacing?: number; lineSpacing?: number; borderColor?: string; styleText?: boolean; hasShadow?: boolean; shadowInfo?: { shadowColor?: string; shadowAlpha?: number; shadowDiffuse?: number; shadowDistance?: number; shadowAngle?: number; }; scaleX?: number; scaleY?: number; transformX?: number; transformY?: number; } export interface AddCaptionsOutput { draftId: string; trackId: string; textIds: string[]; segmentIds: string[]; segmentInfos: SegmentInfo[]; } export interface CaptionInfo { segmentId: string; trackId: string; text: string; start: number; duration: number; materialId: string; } export interface ImageItem { imageUrl: string; width: number; height: number; start: number; end: number; inAnimation?: string; outAnimation?: string; loopAnimation?: string; inAnimationDuration?: number; outAnimationDuration?: number; loopAnimationDuration?: number; transition?: string; transitionDuration?: number; } export interface AddImagesInput { draftId: string; imageInfos: ImageItem[] | string; alpha?: number; scaleX?: number; scaleY?: number; transformX?: number; transformY?: number; } export interface AddImagesOutput { draftId: string; trackId: string; imageIds: string[]; segmentIds: string[]; segmentInfos: SegmentInfo[]; } export interface ImageInfo { segmentId: string; trackId: string; materialUrl: string; width: number; height: number; start: number; duration: number; materialId: string; } export interface VideoItem { videoUrl: string; width: number; height: number; duration: number; start: number; end: number; mask?: string; transition?: string; transitionDuration?: number; volume?: number; } export interface SceneTimeline { start: number; end: number; curveSpeed?: string; } export interface AddVideosInput { draftId: string; videoInfos: VideoItem[] | string; alpha?: number; scaleX?: number; scaleY?: number; transformX?: number; transformY?: number; sceneTimelines?: SceneTimeline[]; } export interface AddVideosOutput { draftId: string; trackId: string; videoIds: string[]; segmentIds: string[]; } export interface VideoInfo { segmentId: string; trackId: string; materialUrl: string; width: number; height: number; start: number; duration: number; materialId: string; } export interface AudioItem { audioUrl: string; duration: number; start: number; end: number; audioEffect?: string; volume?: number; } export interface AddAudiosInput { draftId: string; audioInfos: AudioItem[] | string; } export interface AddAudiosOutput { draftId: string; trackId: string; audioIds: string[]; } export interface AudioInfo { segmentId: string; trackId: string; materialUrl: string; start: number; duration: number; volume: number; materialId: string; } export interface EffectItem { effectTitle: string; start: number; end: number; } export interface AddEffectsInput { draftId: string; effectInfos: EffectItem[] | string; } export interface AddEffectsOutput { draftId: string; trackId: string; effectIds: string[]; segmentIds: string[]; } export interface EffectInfo { segmentId: string; trackId: string; start: number; duration: number; materialId: string; } export interface AddStickerInput { draftId: string; stickerId: string; start: number; end: number; scale?: number; transformX?: number; transformY?: number; } export interface AddStickerOutput { draftId: string; } export interface StickerInfo { segmentId: string; trackId: string; start: number; duration: number; materialId: string; } export interface KeyframeItem { segmentId: string; property: string; offset: number; value: number; } export interface AddKeyframesInput { draftId: string; keyframes: KeyframeItem[] | string; } export interface AddKeyframesOutput { draftId: string; } export interface KeyframeInfo { property: string; timeOffset: number; value: number; } export interface AddMasksInput { draftId: string; segmentIds: string[]; name?: string; X?: number; Y?: number; feather?: number; height?: number; width?: number; invert?: boolean; rotation?: number; roundCorner?: number; } export interface AddMasksOutput { draftId: string; } export interface MaskInfo { id: string; name: string; resourceType: string; config: { centerX: number; centerY: number; width: number; height: number; feather: number; rotation: number; invert: boolean; roundCorner: number; }; } export interface AddTextStyleInput { text: string; keyword: string; keywordColor?: string; fontSize?: number; keywordFontSize?: number; } export interface AddTextStyleOutput { textStyle: string; } export interface SubmitVideoRenderTaskInput { draftUrl: string; apiToken?: string; } export interface SubmitVideoRenderTaskOutput { code?: number; message?: string; tip?: string; [key: string]: unknown; } export interface UploadDraftInput { draftId: string; draftPath?: string; zipPath?: string; apiToken?: string; keepZip?: boolean; } export interface UploadDraftOutput { message: string; draftId: string; draftPath: string; zipPath?: string; draftUploadId: string; downloadUrl: string; size: number; } export interface CloudRenderJob { id: string; status: string | number; draft_upload_id?: string; draft_download_url?: string; filename?: string; video_url?: string; videoUrl?: string; failure_reason?: string; created_at?: string; updated_at?: string; } export interface RenderDraftInput { draftId: string; draftPath?: string; zipPath?: string; apiToken?: string; keepZip?: boolean; wait?: boolean; pollIntervalMs?: number; timeoutMs?: number; onPoll?: (job: CloudRenderJob) => void; } export interface RenderDraftOutput { message: string; draftUploadId: string; downloadUrl: string; jobId: string; status: string | number; renderJob: CloudRenderJob; videoUrl?: string; failureReason?: string; resultCommand: string; timedOut?: boolean; } export interface GetAudioDurationInput { url: string; } export interface GetAudioDurationOutput { message: string; duration: number; } export interface GetImageAnimationsInput { mode?: number; type?: 'in' | 'out' | 'loop'; } export interface GetImageAnimationsOutput { effects: any[]; } export interface TextEffectInfo { title: string; effectId?: string; description?: string; isVip?: boolean; raw: any; } export interface GetTextEffectsInput { keyword?: string; limit?: number; } export interface GetTextEffectsOutput { effects: TextEffectInfo[]; } export interface GetTextEffectInput { name: string; } export interface GetTextEffectOutput { effect: TextEffectInfo | null; exact: boolean; } export type TimeValue = number | `${number}s` | `${number}ms` | `${number}us`; export interface DraftSpec { version: '1.0'; canvas?: CanvasSpec; duration?: TimeValue; assets?: Record; tracks: TrackSpec[]; styles?: Record; defaults?: DraftDefaults; } export interface CanvasSpec { width: number; height: number; fps?: number; } export type AssetSpec = { type: 'image'; src: string; width?: number; height?: number; } | { type: 'video'; src: string; width?: number; height?: number; duration?: TimeValue; } | { type: 'audio'; src: string; duration?: TimeValue; }; export interface DraftDefaults { image?: Partial; video?: Partial; audio?: Partial; caption?: Partial; } export interface ImageClipDefaults { width: number; height: number; fit: 'cover' | 'contain' | 'stretch'; } export interface VideoClipDefaults { width: number; height: number; volume: number; } export interface AudioClipDefaults { volume: number; } export interface CaptionClipDefaults { style: string | TextStyleSpec; position: CaptionPosition; } export type TrackTypeSpec = 'visual' | 'audio' | 'text' | 'effect' | 'sticker'; export interface TrackSpec { id?: string; type: TrackTypeSpec; clips: ClipSpec[]; } export type ClipSpec = ImageClipSpec | VideoClipSpec | AudioClipSpec | CaptionClipSpec | EffectClipSpec | StickerClipSpec; export interface BaseClipSpec { id?: string; start: TimeValue; end?: TimeValue; duration?: TimeValue; layer?: number; } export interface TransformSpec { scaleX?: number; scaleY?: number; x?: number; y?: number; alpha?: number; } export interface AnimationSpec { in?: string; out?: string; loop?: string; inDuration?: TimeValue; outDuration?: TimeValue; loopDuration?: TimeValue; } export interface TransitionSpec { name: string; duration?: TimeValue; } export interface ImageClipSpec extends BaseClipSpec { type: 'image'; asset?: string; src?: string; width?: number; height?: number; fit?: 'cover' | 'contain' | 'stretch'; transform?: TransformSpec; animation?: AnimationSpec; transition?: string | TransitionSpec; } export interface VideoClipSpec extends BaseClipSpec { type: 'video'; asset?: string; src?: string; width?: number; height?: number; sourceDuration?: TimeValue; volume?: number; mask?: string; transform?: TransformSpec; transition?: string | TransitionSpec; } export interface AudioClipSpec extends BaseClipSpec { type: 'audio'; asset?: string; src?: string; sourceDuration?: TimeValue; volume?: number; audioEffect?: string; } export type CaptionPosition = 'top' | 'center' | 'bottom' | PositionSpec; export interface PositionSpec { x?: number; y?: number; } export interface CaptionClipSpec extends BaseClipSpec { type: 'caption'; text: string; style?: string | TextStyleSpec; position?: CaptionPosition; animation?: AnimationSpec; keyword?: string; keywordColor?: string; fontSize?: number; keywordFontSize?: number; } export interface EffectClipSpec extends BaseClipSpec { type: 'effect'; effectTitle: string; } export interface StickerClipSpec extends BaseClipSpec { type: 'sticker'; stickerId: string; scale?: number; position?: PositionSpec; } export type StyleSpec = TextStyleSpec; export interface TextStyleSpec { font?: string; fontSize?: number; color?: string; bold?: boolean; italic?: boolean; underline?: boolean; alpha?: number; borderColor?: string; textEffect?: string; letterSpacing?: number; lineSpacing?: number; shadow?: boolean | ShadowSpec; } export interface ShadowSpec { color?: string; alpha?: number; diffuse?: number; distance?: number; angle?: number; } export interface DraftSpecValidationError { path: string; code: string; message: string; suggestion?: string; } export interface DraftSpecValidationResult { valid: boolean; errors: DraftSpecValidationError[]; warnings: DraftSpecValidationError[]; } export interface CreatedClipReference { clipId?: string; type: ClipSpec['type']; trackId?: string; segmentId?: string; materialId?: string; } export interface CreateDraftFromSpecOutput { draftId: string; actualPath?: string; filePath: string; displayName?: string; draftFolderName?: string; warnings: DraftSpecValidationError[]; clips: CreatedClipReference[]; } export interface CreateAndRenderDraftContext { draft: CreateDraftFromSpecOutput; clip(type: CreatedClipReference['type'], index?: number): CreatedClipReference; } export interface CreateAndRenderDraftInput { draft: DraftSpec; output?: { draftsDir?: string; name?: string; }; afterCreate?: (context: CreateAndRenderDraftContext) => Promise | void; render?: false | { cloud?: boolean; apiToken?: string; keepZip?: boolean; wait?: boolean; pollIntervalMs?: number; timeoutMs?: number; }; } export interface CreateAndRenderDraftOutput { draft: CreateDraftFromSpecOutput; render?: RenderDraftOutput; } //# sourceMappingURL=index.d.ts.map