import { IAnimationOptions, isScrollBehaviorSupported } from "./common.js";
import { elementScrollPolyfill } from "./Element.scroll.js";
import { elementScrollByPolyfill } from "./Element.scrollBy.js";
import { elementScrollIntoViewPolyfill } from "./Element.scrollIntoView.js";
import { elementScrollToPolyfill } from "./Element.scrollTo.js";
import { windowScrollPolyfill } from "./Window.scroll.js";
import { windowScrollByPolyfill } from "./Window.scrollBy.js";
import { windowScrollToPolyfill } from "./Window.scrollTo.js";

export const polyfill = (options?: IAnimationOptions): void => {
    if (isScrollBehaviorSupported()) {
        return;
    }

    windowScrollPolyfill(options);
    windowScrollToPolyfill(options);
    windowScrollByPolyfill(options);

    elementScrollPolyfill(options);
    elementScrollToPolyfill(options);
    elementScrollByPolyfill(options);
    elementScrollIntoViewPolyfill(options);
};

export { elementScroll, elementScrollPolyfill } from "./Element.scroll.js";
export { elementScrollBy, elementScrollByPolyfill } from "./Element.scrollBy.js";
export { elementScrollIntoView, elementScrollIntoViewPolyfill } from "./Element.scrollIntoView.js";
export { elementScrollTo, elementScrollToPolyfill } from "./Element.scrollTo.js";
export { windowScroll, windowScrollPolyfill } from "./Window.scroll.js";
export { windowScrollBy, windowScrollByPolyfill } from "./Window.scrollBy.js";
export { windowScrollTo, windowScrollToPolyfill } from "./Window.scrollTo.js";
export { polyfill as seamless };
