import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
import * as __WEBPACK_EXTERNAL_MODULE__data_source_collection_field_CollectionFieldProvider_mjs__ from "../../../data-source/collection-field/CollectionFieldProvider.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__input_EllipsisWithTooltip_mjs__ from "../input/EllipsisWithTooltip.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__utils_mjs__ from "./utils.mjs";
const ReadPretty = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)((props)=>{
    var _field_value;
    const fieldNames = {
        ...__WEBPACK_EXTERNAL_MODULE__utils_mjs__.defaultFieldNames,
        ...props.fieldNames
    };
    const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
    if (!(0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.isValid)(props.value)) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {});
    if ((0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.isArrayField)(field) && (null == field ? void 0 : null === (_field_value = field.value) || void 0 === _field_value ? void 0 : _field_value.length) === 0) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {});
    const collectionField = (0, __WEBPACK_EXTERNAL_MODULE__data_source_collection_field_CollectionFieldProvider_mjs__.useCollectionField)();
    const dataSource = field.dataSource || props.options || (null == collectionField ? void 0 : collectionField.uiSchema.enum) || [];
    const currentOptions = (0, __WEBPACK_EXTERNAL_MODULE__utils_mjs__.getCurrentOptions)(field.value, dataSource, fieldNames);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__input_EllipsisWithTooltip_mjs__.EllipsisWithTooltip, {
            ellipsis: props.ellipsis,
            children: currentOptions.map((option, key)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Tag, {
                    color: option[fieldNames.color],
                    icon: option.icon,
                    children: option[fieldNames.label]
                }, key))
        })
    });
}, {
    displayName: 'ReadPretty'
});
export { ReadPretty };
