1export function getImageWrapperEventHandler(events, source) {
2    return {
3        onLoad: (event) => {
4            if (typeof window !== 'undefined') {
5                // this ensures the animation will run, since the starting class is applied at least 1 frame before the target class set in the onLoad event callback
6                window.requestAnimationFrame(() => {
7                    events?.onLoad?.forEach((e) => e?.(event));
8                });
9            }
10            else {
11                events?.onLoad?.forEach((e) => e?.(event));
12            }
13        },
14        onTransitionEnd: () => events?.onTransitionEnd?.forEach((e) => e?.()),
15        onError: () => events?.onError?.forEach((e) => e?.({ source: source || null })),
16    };
17}
18//# sourceMappingURL=getImageWrapperEventHandler.js.map