import { TRANSITION_CONFIG } from "./config.js";
const noop = ()=>{
// do nothing
};
/**
 * This is a helper function for applying specific effects to the transition
 * callbacks when transitions might be disabled. This is probably an internal
 * only function, but might be useful externally as well. Here are a few
 * examples for it's usage internally:
 *
 * @example Autocomplete Behavior
 * ```tsx
 *   listboxProps={{
 *      ...getTransitionCallbacks({
 *        enter: true,
 *        onEnter,
 *        onEntered,
 *        onEnterOnce: () => {
 *          onOpen();
 *
 *          // when the listbox is opened, need to flag the entered state to show
 *          // that new `query` values should be accepted. Also store the initial
 *          // query.
 *          entered.current = true;
 *          initialQuery.current = query;
 *        },
 *        disableTransition,
 *      }),
 *    }}
 * ```
 *
 * @since 6.0.0
 */ export function getTransitionCallbacks(options) {
    const { disableTransition, enter, onEnter, onEntered, onEntering, onEnterOnce = noop, exit, onExit, onExited, onExiting, onExitOnce = noop } = options;
    const handleEnter = (callback = noop, skipped)=>(appearing)=>{
            callback(appearing);
            if (!skipped) {
                onEnterOnce(appearing);
            }
        };
    const handleExit = (callback = noop, skipped)=>()=>{
            callback();
            if (!skipped) {
                onExitOnce();
            }
        };
    return {
        onEnter: handleEnter(onEnter, !enter),
        onEntering: handleEnter(onEntering, enter),
        onEntered: handleEnter(onEntered, !disableTransition && !TRANSITION_CONFIG.disabled),
        onExit: handleExit(onExit, !exit),
        onExiting: handleExit(onExiting, exit),
        onExited: handleExit(onExited, !disableTransition && !TRANSITION_CONFIG.disabled)
    };
}

//# sourceMappingURL=getTransitionCallbacks.js.map