"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useGroupItem = void 0;
const useKeyframeValue_1 = require("../../common/useKeyframeValue");
const sdk_1 = require("@cntrl-site/sdk");
const useLayoutContext_1 = require("../useLayoutContext");
function useGroupItem(item, sectionId) {
    const layoutId = (0, useLayoutContext_1.useLayoutContext)();
    const opacity = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Opacity, (item, layoutId) => {
        if (!layoutId)
            return;
        const layoutParams = item.layoutParams[layoutId];
        return 'opacity' in layoutParams ? layoutParams.opacity : 1;
    }, (animator, scroll, value) => value !== undefined ? animator.getOpacity({ opacity: value }, scroll).opacity : undefined, sectionId, [layoutId]);
    return { opacity };
}
exports.useGroupItem = useGroupItem;
