"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimelinePrimitiveFieldValue = exports.isTimelinePrimitiveFieldInfo = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const TimelineBooleanField_1 = require("./TimelineBooleanField");
const TimelineColorField_1 = require("./TimelineColorField");
const TimelineEnumField_1 = require("./TimelineEnumField");
const TimelineFontFamilyField_1 = require("./TimelineFontFamilyField");
const TimelineNumberField_1 = require("./TimelineNumberField");
const TimelineRotationField_1 = require("./TimelineRotationField");
const TimelineScaleField_1 = require("./TimelineScaleField");
const TimelineTextContentField_1 = require("./TimelineTextContentField");
const TimelineTransformOriginField_1 = require("./TimelineTransformOriginField");
const TimelineTranslateField_1 = require("./TimelineTranslateField");
const TimelineUvCoordinateField_1 = require("./TimelineUvCoordinateField");
const inlineWrapper = {
    fontSize: 12,
};
const isTimelinePrimitiveFieldInfo = (field) => {
    return (field.typeName !== 'array' &&
        field.typeName !== 'hidden' &&
        field.fieldSchema.type !== 'array');
};
exports.isTimelinePrimitiveFieldInfo = isTimelinePrimitiveFieldInfo;
const TimelinePrimitiveFieldValue = ({ field, onSave, onDragValueChange, onDragEnd, propStatus, effectiveValue, scaleLockNodePath, }) => {
    if (field.typeName === 'number') {
        return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineNumberField_1.TimelineNumberField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
    }
    if (field.typeName === 'rotation-css' ||
        field.typeName === 'rotation-degrees') {
        return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineRotationField_1.TimelineRotationField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
    }
    if (field.typeName === 'translate') {
        return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineTranslateField_1.TimelineTranslateField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
    }
    if (field.typeName === 'transform-origin') {
        return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineTransformOriginField_1.TimelineTransformOriginField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
    }
    if (field.typeName === 'scale') {
        if (scaleLockNodePath === null) {
            throw new Error('Expected scale lock node path for scale field');
        }
        return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineScaleField_1.TimelineScaleField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus, scaleLockNodePath: scaleLockNodePath }) }));
    }
    if (field.typeName === 'uv-coordinate') {
        return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineUvCoordinateField_1.TimelineUvCoordinateField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
    }
    if (field.typeName === 'boolean') {
        return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineBooleanField_1.TimelineBooleanField, { effectiveValue: effectiveValue, field: field, onSave: onSave, propStatus: propStatus }) }));
    }
    if (field.typeName === 'color') {
        return (jsx_runtime_1.jsx("span", { children: jsx_runtime_1.jsx(TimelineColorField_1.TimelineColorField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
    }
    if (field.typeName === 'enum') {
        return (jsx_runtime_1.jsx("span", { style: inlineWrapper, children: jsx_runtime_1.jsx(TimelineEnumField_1.TimelineEnumField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
    }
    if (field.typeName === 'text-content') {
        return (jsx_runtime_1.jsx(TimelineTextContentField_1.TimelineTextContentField, { effectiveValue: effectiveValue, field: field, nodePath: scaleLockNodePath, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }));
    }
    if (field.typeName === 'font-family') {
        return (jsx_runtime_1.jsx("span", { style: inlineWrapper, children: jsx_runtime_1.jsx(TimelineFontFamilyField_1.TimelineFontFamilyField, { effectiveValue: effectiveValue, field: field, onDragEnd: onDragEnd, onDragValueChange: onDragValueChange, onSave: onSave, propStatus: propStatus }) }));
    }
    throw new Error(`Unsupported field type: ${field.typeName}`);
};
exports.TimelinePrimitiveFieldValue = TimelinePrimitiveFieldValue;
