"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useEmbedVideoItem = void 0;
const sdk_1 = require("@cntrl-site/sdk");
const useKeyframeValue_1 = require("../../common/useKeyframeValue");
const useLayoutContext_1 = require("../useLayoutContext");
const useEmbedVideoItem = (item, sectionId) => {
    const layoutId = (0, useLayoutContext_1.useLayoutContext)();
    const radius = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.BorderRadius, (item, layoutId) => {
        if (!layoutId)
            return;
        const layoutParams = item.layoutParams[layoutId];
        return 'radius' in layoutParams ? layoutParams.radius : 0;
    }, (animator, scroll, value) => value !== undefined ? animator.getRadius({ radius: value }, scroll).radius : undefined, sectionId, [layoutId]);
    const blur = (0, useKeyframeValue_1.useKeyframeValue)(item, sdk_1.KeyframeType.Blur, (item, layoutId) => {
        if (!layoutId)
            return;
        const layoutParams = item.layoutParams[layoutId];
        return 'blur' in layoutParams ? layoutParams.blur : 0;
    }, (animator, scroll, value) => value !== undefined ? animator.getBlur({ blur: value }, scroll).blur : undefined, sectionId, [layoutId]);
    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 { radius, blur, opacity };
};
exports.useEmbedVideoItem = useEmbedVideoItem;
