import { getStyleOptions } from './StyleOptionsState';
import { Stylesheet } from './Stylesheet';
import { serializeRuleEntries } from './styleToClassName';
/**
 * Registers keyframe definitions.
 *
 * @public
 */
export function keyframes(timeline) {
    var stylesheet = Stylesheet.getInstance();
    var rulesArray = [];
    for (var prop in timeline) {
        if (timeline.hasOwnProperty(prop)) {
            rulesArray.push(prop, '{', serializeRuleEntries(getStyleOptions(), timeline[prop]), '}');
        }
    }
    var rules = rulesArray.join('');
    var className = stylesheet.classNameFromKey(rules);
    if (className) {
        return className;
    }
    var name = stylesheet.getClassName();
    stylesheet.insertRule("@keyframes " + name + "{" + rules + "}", true);
    stylesheet.cacheClassName(name, rules, [], ['keyframes', rules]);
    return name;
}
//# sourceMappingURL=keyframes.js.map