/**
 * @file SpineImporter.ts
 * @description Spine 2D Skeletal Animation Importer
 * PRO-1.3: Scene Format Interoperability
 *
 * Spine is a professional 2D skeletal animation tool.
 * Supports both JSON and binary formats.
 *
 * File Types:
 * - .json - Spine skeleton data (JSON)
 * - .skel - Spine skeleton data (binary)
 * - .atlas - Texture atlas
 */
import { SceneImporter, ImportOptions, ImportResult, ParsedScene, ImportError } from './SceneImporter';
/** Spine Skeleton Data */
export interface SpineSkeletonData {
    skeleton: SpineSkeletonInfo;
    bones: SpineBone[];
    slots: SpineSlot[];
    ik?: SpineIKConstraint[];
    transform?: SpineTransformConstraint[];
    path?: SpinePathConstraint[];
    skins: SpineSkin[];
    events?: Record<string, SpineEvent>;
    animations: Record<string, SpineAnimation>;
}
/** Spine Skeleton Info */
export interface SpineSkeletonInfo {
    hash?: string;
    spine: string;
    x?: number;
    y?: number;
    width?: number;
    height?: number;
    fps?: number;
    images?: string;
    audio?: string;
}
/** Spine Bone */
export interface SpineBone {
    name: string;
    parent?: string;
    length?: number;
    transform?: 'normal' | 'onlyTranslation' | 'noRotationOrReflection' | 'noScale' | 'noScaleOrReflection';
    skin?: boolean;
    x?: number;
    y?: number;
    rotation?: number;
    scaleX?: number;
    scaleY?: number;
    shearX?: number;
    shearY?: number;
    color?: string;
}
/** Spine Slot */
export interface SpineSlot {
    name: string;
    bone: string;
    color?: string;
    dark?: string;
    attachment?: string;
    blend?: 'normal' | 'additive' | 'multiply' | 'screen';
}
/** Spine IK Constraint */
export interface SpineIKConstraint {
    name: string;
    order?: number;
    skin?: boolean;
    bones: string[];
    target: string;
    mix?: number;
    softness?: number;
    bendPositive?: boolean;
    compress?: boolean;
    stretch?: boolean;
    uniform?: boolean;
}
/** Spine Transform Constraint */
export interface SpineTransformConstraint {
    name: string;
    order?: number;
    skin?: boolean;
    bones: string[];
    target: string;
    rotation?: number;
    x?: number;
    y?: number;
    scaleX?: number;
    scaleY?: number;
    shearY?: number;
    rotateMix?: number;
    translateMix?: number;
    scaleMix?: number;
    shearMix?: number;
    local?: boolean;
    relative?: boolean;
}
/** Spine Path Constraint */
export interface SpinePathConstraint {
    name: string;
    order?: number;
    skin?: boolean;
    bones: string[];
    target: string;
    positionMode?: 'fixed' | 'percent';
    spacingMode?: 'length' | 'fixed' | 'percent' | 'proportional';
    rotateMode?: 'tangent' | 'chain' | 'chainScale';
    rotation?: number;
    position?: number;
    spacing?: number;
    rotateMix?: number;
    translateMix?: number;
}
/** Spine Skin */
export interface SpineSkin {
    name: string;
    bones?: Record<string, SpineSkinBone>;
    ik?: Record<string, SpineSkinIK>;
    transform?: Record<string, SpineSkinTransform>;
    path?: Record<string, SpineSkinPath>;
    attachments: Record<string, Record<string, SpineAttachment>>;
}
export interface SpineSkinBone {
    x?: number;
    y?: number;
    rotation?: number;
    scaleX?: number;
    scaleY?: number;
}
export interface SpineSkinIK {
    bendPositive?: boolean;
    compress?: boolean;
    stretch?: boolean;
    uniform?: boolean;
    mix?: number;
    softness?: number;
}
export interface SpineSkinTransform {
    rotation?: number;
    x?: number;
    y?: number;
    scaleX?: number;
    scaleY?: number;
    shearY?: number;
    rotateMix?: number;
    translateMix?: number;
    scaleMix?: number;
    shearMix?: number;
}
export interface SpineSkinPath {
    position?: number;
    spacing?: number;
    rotateMix?: number;
    translateMix?: number;
}
/** Spine Attachment Types */
export type SpineAttachment = SpineRegionAttachment | SpineMeshAttachment | SpineBoundingBoxAttachment | SpinePointAttachment | SpinePathAttachment | SpineClippingAttachment;
export interface SpineAttachmentBase {
    type?: string;
    name?: string;
}
export interface SpineRegionAttachment extends SpineAttachmentBase {
    type?: 'region';
    path?: string;
    x?: number;
    y?: number;
    scaleX?: number;
    scaleY?: number;
    rotation?: number;
    width: number;
    height: number;
    color?: string;
}
export interface SpineMeshAttachment extends SpineAttachmentBase {
    type: 'mesh' | 'linkedmesh';
    path?: string;
    color?: string;
    width?: number;
    height?: number;
    uvs?: number[];
    triangles?: number[];
    vertices?: number[];
    hull?: number;
    edges?: number[];
    skin?: string;
    parent?: string;
    deform?: boolean;
}
export interface SpineBoundingBoxAttachment extends SpineAttachmentBase {
    type: 'boundingbox';
    vertexCount: number;
    vertices: number[];
    color?: string;
}
export interface SpinePointAttachment extends SpineAttachmentBase {
    type: 'point';
    x?: number;
    y?: number;
    rotation?: number;
    color?: string;
}
export interface SpinePathAttachment extends SpineAttachmentBase {
    type: 'path';
    closed?: boolean;
    constantSpeed?: boolean;
    vertexCount: number;
    vertices?: number[];
    lengths?: number[];
    color?: string;
}
export interface SpineClippingAttachment extends SpineAttachmentBase {
    type: 'clipping';
    end: string;
    vertexCount: number;
    vertices: number[];
    color?: string;
}
/** Spine Event */
export interface SpineEvent {
    int?: number;
    float?: number;
    string?: string;
    audio?: string;
    volume?: number;
    balance?: number;
}
/** Spine Animation */
export interface SpineAnimation {
    bones?: Record<string, SpineBoneTimeline>;
    slots?: Record<string, SpineSlotTimeline>;
    ik?: Record<string, SpineIKTimeline[]>;
    transform?: Record<string, SpineTransformTimeline[]>;
    path?: Record<string, SpinePathTimeline[]>;
    deform?: Record<string, Record<string, Record<string, SpineDeformTimeline[]>>>;
    drawOrder?: SpineDrawOrderTimeline[];
    events?: SpineEventTimeline[];
}
export interface SpineBoneTimeline {
    rotate?: SpineRotateKeyframe[];
    translate?: SpineTranslateKeyframe[];
    scale?: SpineScaleKeyframe[];
    shear?: SpineShearKeyframe[];
}
export interface SpineSlotTimeline {
    attachment?: SpineAttachmentKeyframe[];
    color?: SpineColorKeyframe[];
    twoColor?: SpineTwoColorKeyframe[];
}
export interface SpineKeyframeBase {
    time: number;
    curve?: 'linear' | 'stepped' | number[];
}
export interface SpineRotateKeyframe extends SpineKeyframeBase {
    angle?: number;
}
export interface SpineTranslateKeyframe extends SpineKeyframeBase {
    x?: number;
    y?: number;
}
export interface SpineScaleKeyframe extends SpineKeyframeBase {
    x?: number;
    y?: number;
}
export interface SpineShearKeyframe extends SpineKeyframeBase {
    x?: number;
    y?: number;
}
export interface SpineAttachmentKeyframe {
    time: number;
    name: string | null;
}
export interface SpineColorKeyframe extends SpineKeyframeBase {
    color: string;
}
export interface SpineTwoColorKeyframe extends SpineKeyframeBase {
    light: string;
    dark: string;
}
export interface SpineIKTimeline extends SpineKeyframeBase {
    mix?: number;
    softness?: number;
    bendPositive?: boolean;
    compress?: boolean;
    stretch?: boolean;
}
export interface SpineTransformTimeline extends SpineKeyframeBase {
    rotateMix?: number;
    translateMix?: number;
    scaleMix?: number;
    shearMix?: number;
}
export interface SpinePathTimeline extends SpineKeyframeBase {
    position?: number;
    spacing?: number;
    rotateMix?: number;
    translateMix?: number;
}
export interface SpineDeformTimeline extends SpineKeyframeBase {
    offset?: number;
    vertices?: number[];
}
export interface SpineDrawOrderTimeline {
    time: number;
    offsets?: Array<{
        slot: string;
        offset: number;
    }>;
}
export interface SpineEventTimeline {
    time: number;
    name: string;
    int?: number;
    float?: number;
    string?: string;
    volume?: number;
    balance?: number;
}
/** Spine Atlas */
export interface SpineAtlas {
    pages: SpineAtlasPage[];
}
export interface SpineAtlasPage {
    name: string;
    size: {
        width: number;
        height: number;
    };
    format: string;
    filter: {
        min: string;
        mag: string;
    };
    repeat: string;
    pma?: boolean;
    regions: SpineAtlasRegion[];
}
export interface SpineAtlasRegion {
    name: string;
    bounds: {
        x: number;
        y: number;
        width: number;
        height: number;
    };
    offsets?: {
        x: number;
        y: number;
        width: number;
        height: number;
    };
    rotate?: boolean | number;
    index?: number;
}
export declare class SpineImporter extends SceneImporter {
    private atlas;
    constructor();
    canHandle(filePath: string): boolean;
    import(options: ImportOptions): Promise<ImportResult>;
    parseFile(content: string | ArrayBuffer, filePath: string): Promise<ParsedScene | null>;
    validate(sourcePath: string): Promise<ImportError[]>;
    private convertSkeletonToScene;
    private convertSkeletonToParsed;
    private createBoneHierarchy;
    private addSlotToEntity;
    private findBoneEntity;
    private convertAnimation;
    private calculateAnimationDuration;
    private parseAtlas;
    private readFile;
    private extractFileName;
}
export declare function createSpineImporter(): SpineImporter;
