'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import React from 'react';
import { ArrayField } from '../../fields/Array/index.js';
import { BlocksField } from '../../fields/Blocks/index.js';
import { CheckboxField } from '../../fields/Checkbox/index.js';
import { CodeField } from '../../fields/Code/index.js';
import { CollapsibleField } from '../../fields/Collapsible/index.js';
import { DateTimeField } from '../../fields/DateTime/index.js';
import { EmailField } from '../../fields/Email/index.js';
import { GroupField } from '../../fields/Group/index.js';
import { HiddenField } from '../../fields/Hidden/index.js';
import { JoinField } from '../../fields/Join/index.js';
import { JSONField } from '../../fields/JSON/index.js';
import { NumberField } from '../../fields/Number/index.js';
import { PointField } from '../../fields/Point/index.js';
import { RadioGroupField } from '../../fields/RadioGroup/index.js';
import { RelationshipField } from '../../fields/Relationship/index.js';
import { RichTextField } from '../../fields/RichText/index.js';
import { RowField } from '../../fields/Row/index.js';
import { SelectField } from '../../fields/Select/index.js';
import { TabsField } from '../../fields/Tabs/index.js';
import { TextField } from '../../fields/Text/index.js';
import { TextareaField } from '../../fields/Textarea/index.js';
import { UIField } from '../../fields/UI/index.js';
import { UploadField } from '../../fields/Upload/index.js';
import { useFormFields } from '../../forms/Form/index.js';
export function RenderField({ clientFieldConfig, forceRender, indexPath, parentPath, parentSchemaPath, path, permissions, readOnly, schemaPath }) {
    const CustomField = useFormFields(([fields])=>fields && fields?.[path]?.customComponents?.Field);
    const baseFieldProps = {
        forceRender,
        permissions,
        readOnly,
        schemaPath
    };
    if (clientFieldConfig.admin?.hidden) {
        return /*#__PURE__*/ _jsxDEV(HiddenField, {
            ...baseFieldProps,
            path: path
        }, void 0, false, {
            fileName: "src/forms/RenderFields/RenderField.tsx",
            lineNumber: 67,
            columnNumber: 12
        }, this);
    }
    if (CustomField !== undefined) {
        return CustomField || null;
    }
    const iterableFieldProps = {
        ...baseFieldProps,
        indexPath,
        parentPath,
        parentSchemaPath
    };
    switch(clientFieldConfig.type){
        case 'array':
            return /*#__PURE__*/ _jsxDEV(ArrayField, {
                ...iterableFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 83,
                columnNumber: 14
            }, this);
        case 'blocks':
            return /*#__PURE__*/ _jsxDEV(BlocksField, {
                ...iterableFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 86,
                columnNumber: 14
            }, this);
        case 'checkbox':
            return /*#__PURE__*/ _jsxDEV(CheckboxField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 89,
                columnNumber: 14
            }, this);
        case 'code':
            return /*#__PURE__*/ _jsxDEV(CodeField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 92,
                columnNumber: 14
            }, this);
        case 'collapsible':
            return /*#__PURE__*/ _jsxDEV(CollapsibleField, {
                ...iterableFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 95,
                columnNumber: 14
            }, this);
        case 'date':
            return /*#__PURE__*/ _jsxDEV(DateTimeField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 98,
                columnNumber: 14
            }, this);
        case 'email':
            return /*#__PURE__*/ _jsxDEV(EmailField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 101,
                columnNumber: 14
            }, this);
        case 'group':
            return /*#__PURE__*/ _jsxDEV(GroupField, {
                ...iterableFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 104,
                columnNumber: 14
            }, this);
        case 'join':
            return /*#__PURE__*/ _jsxDEV(JoinField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 107,
                columnNumber: 14
            }, this);
        case 'json':
            return /*#__PURE__*/ _jsxDEV(JSONField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 110,
                columnNumber: 14
            }, this);
        case 'number':
            return /*#__PURE__*/ _jsxDEV(NumberField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 113,
                columnNumber: 14
            }, this);
        case 'point':
            return /*#__PURE__*/ _jsxDEV(PointField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 116,
                columnNumber: 14
            }, this);
        case 'radio':
            return /*#__PURE__*/ _jsxDEV(RadioGroupField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 119,
                columnNumber: 14
            }, this);
        case 'relationship':
            return /*#__PURE__*/ _jsxDEV(RelationshipField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 122,
                columnNumber: 14
            }, this);
        case 'richText':
            return /*#__PURE__*/ _jsxDEV(RichTextField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 125,
                columnNumber: 14
            }, this);
        case 'row':
            return /*#__PURE__*/ _jsxDEV(RowField, {
                ...iterableFieldProps,
                field: clientFieldConfig
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 128,
                columnNumber: 14
            }, this);
        case 'select':
            return /*#__PURE__*/ _jsxDEV(SelectField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 131,
                columnNumber: 14
            }, this);
        case 'tabs':
            return /*#__PURE__*/ _jsxDEV(TabsField, {
                ...iterableFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 134,
                columnNumber: 14
            }, this);
        case 'text':
            return /*#__PURE__*/ _jsxDEV(TextField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 137,
                columnNumber: 14
            }, this);
        case 'textarea':
            return /*#__PURE__*/ _jsxDEV(TextareaField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 140,
                columnNumber: 14
            }, this);
        case 'ui':
            return /*#__PURE__*/ _jsxDEV(UIField, {}, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 143,
                columnNumber: 14
            }, this);
        case 'upload':
            return /*#__PURE__*/ _jsxDEV(UploadField, {
                ...baseFieldProps,
                field: clientFieldConfig,
                path: path
            }, void 0, false, {
                fileName: "src/forms/RenderFields/RenderField.tsx",
                lineNumber: 146,
                columnNumber: 14
            }, this);
    }
}

//# sourceMappingURL=RenderField.js.map