export class AnimationInspector {
    snapshot(mixer, skeleton) {
        const snapshot = {
            mixer: mixer.snapshot()
        };
        if (skeleton) {
            return {
                ...snapshot,
                skeleton: {
                    boneCount: skeleton.bones.length,
                    boneNames: skeleton.bones.map((bone) => bone.name),
                    paletteMatrixCount: skeleton.matrixPalette().length
                }
            };
        }
        return snapshot;
    }
    visualEvidence(mixer, skeleton) {
        const snapshot = mixer.snapshot();
        const sampledTargets = Object.keys(snapshot.values).sort();
        const palette = skeleton?.matrixPalette();
        const evidenceWithoutHash = {
            actionCount: snapshot.actionCount,
            playingActionCount: snapshot.actions.filter((action) => action.playing).length,
            sampledTargetCount: sampledTargets.length,
            sampledTargets,
            skeletonBoneCount: skeleton?.bones.length ?? 0,
            paletteMatrixCount: palette?.length ?? 0,
            ...(palette ? { paletteHash: stableHash(palette.map((matrix) => matrix.map((value) => Number(value.toFixed(6))))) } : {})
        };
        return {
            ...evidenceWithoutHash,
            stableHash: stableHash(evidenceWithoutHash)
        };
    }
}
function stableHash(value) {
    const input = JSON.stringify(value);
    let hash = 2166136261;
    for (let index = 0; index < input.length; index += 1) {
        hash ^= input.charCodeAt(index);
        hash = Math.imul(hash, 16777619);
    }
    return (hash >>> 0).toString(16).padStart(8, "0");
}
//# sourceMappingURL=AnimationInspector.js.map