import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__VariableInput_hooks_useFormVariable_mjs__ from "../VariableInput/hooks/useFormVariable.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__VariableInput_hooks_useIterationVariable_mjs__ from "../VariableInput/hooks/useIterationVariable.mjs";
function _tagged_template_literal(strings, raw) {
    if (!raw) raw = strings.slice(0);
    return Object.freeze(Object.defineProperties(strings, {
        raw: {
            value: Object.freeze(raw)
        }
    }));
}
function _templateObject() {
    const data = _tagged_template_literal([
        "\n      min-width: 400px;\n      margin-right: 15;\n      .ant-input {\n        width: 100% !important;\n      }\n    "
    ]);
    _templateObject = function() {
        return data;
    };
    return data;
}
const useStyles = (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.createStyles)((param)=>{
    let { css } = param;
    return {
        variableInput: css(_templateObject())
    };
});
const ChildDynamicComponent = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)((props)=>{
    const { styles } = useStyles();
    const { rootCollection, onChange, value, collectionField } = props;
    const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
    const { currentFormSettings } = (0, __WEBPACK_EXTERNAL_MODULE__VariableInput_hooks_useFormVariable_mjs__.useCurrentFormVariable)({
        collectionName: rootCollection,
        collectionField
    });
    const { currentObjectSettings } = (0, __WEBPACK_EXTERNAL_MODULE__VariableInput_hooks_useIterationVariable_mjs__.useCurrentObjectVariable)({
        schema: null == collectionField ? void 0 : collectionField.uiSchema,
        collectionField
    });
    const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
    const result = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>[
            currentFormSettings,
            currentObjectSettings
        ].filter(Boolean), [
        currentFormSettings,
        currentObjectSettings
    ]);
    const scope = compile(result);
    (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
        onChange(fieldSchema.default);
    }, []);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.Variable.Input, {
        value: value,
        onChange: onChange,
        scope: scope,
        className: styles.variableInput
    });
}, {
    displayName: 'ChildDynamicComponent'
});
export { ChildDynamicComponent };
