"use strict";
var __webpack_modules__ = {
    "../../application/hoc/withDynamicSchemaProps": function(module) {
        module.exports = require("../../application/hoc/withDynamicSchemaProps.js");
    },
    "../../block-provider": function(module) {
        module.exports = require("../../block-provider/index.js");
    },
    "../../collection-manager": function(module) {
        module.exports = require("../../collection-manager/index.js");
    },
    "../../data-source/collection-record/CollectionRecordProvider": function(module) {
        module.exports = require("../../data-source/collection-record/CollectionRecordProvider.js");
    },
    "../../record-provider": function(module) {
        module.exports = require("../../record-provider/index.js");
    },
    "../../schema-component/antd/filter/context": function(module) {
        module.exports = require("../../schema-component/antd/filter/context.js");
    },
    "../../schema-component": function(module) {
        module.exports = require("../../schema-component/index.js");
    },
    "../VariableInput/VariableInput": function(module) {
        module.exports = require("../VariableInput/VariableInput.js");
    },
    "./LinkageRuleActionGroup": function(module) {
        module.exports = require("./LinkageRuleActionGroup.js");
    },
    "./action-hooks": function(module) {
        module.exports = require("./action-hooks.js");
    },
    "./components/EnableLinkage": function(module) {
        module.exports = require("./components/EnableLinkage.js");
    },
    "./components/LinkageHeader": function(module) {
        module.exports = require("./components/LinkageHeader.js");
    },
    "./type": function(module) {
        module.exports = require("./type.js");
    },
    "@tachybase/schema": function(module) {
        module.exports = require("@tachybase/schema");
    },
    "antd-style": function(module) {
        module.exports = require("antd-style");
    },
    react: function(module) {
        module.exports = require("react");
    },
    "react/jsx-runtime": function(module) {
        module.exports = require("react/jsx-runtime");
    }
};
var __webpack_module_cache__ = {};
function __webpack_require__(moduleId) {
    var cachedModule = __webpack_module_cache__[moduleId];
    if (void 0 !== cachedModule) return cachedModule.exports;
    var module = __webpack_module_cache__[moduleId] = {
        exports: {}
    };
    __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
    return module.exports;
}
(()=>{
    __webpack_require__.n = (module)=>{
        var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
(()=>{
    __webpack_require__.r(__webpack_exports__);
    __webpack_require__.d(__webpack_exports__, {
        FormLinkageRules: ()=>FormLinkageRules
    });
    var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react/jsx-runtime");
    var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("react");
    var _tachybase_schema__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@tachybase/schema");
    var antd_style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("antd-style");
    var _application_hoc_withDynamicSchemaProps__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../../application/hoc/withDynamicSchemaProps");
    var _block_provider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("../../block-provider");
    var _collection_manager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("../../collection-manager");
    var _data_source_collection_record_CollectionRecordProvider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("../../data-source/collection-record/CollectionRecordProvider");
    var _record_provider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("../../record-provider");
    var _schema_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("../../schema-component");
    var _schema_component_antd_filter_context__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("../../schema-component/antd/filter/context");
    var _VariableInput_VariableInput__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("../VariableInput/VariableInput");
    var _components_EnableLinkage__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("./components/EnableLinkage");
    var _components_LinkageHeader__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("./components/LinkageHeader");
    var _LinkageRuleActionGroup__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("./LinkageRuleActionGroup");
    var _type__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("./type");
    var __WEBPACK_REEXPORT_OBJECT__ = {};
    for(var __WEBPACK_IMPORT_KEY__ in _type__WEBPACK_IMPORTED_MODULE_15__)if ([
        "FormLinkageRules",
        "default"
    ].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
        return _type__WEBPACK_IMPORTED_MODULE_15__[key];
    }).bind(0, __WEBPACK_IMPORT_KEY__);
    __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
    var _action_hooks__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("./action-hooks");
    var __WEBPACK_REEXPORT_OBJECT__ = {};
    for(var __WEBPACK_IMPORT_KEY__ in _action_hooks__WEBPACK_IMPORTED_MODULE_16__)if ([
        "FormLinkageRules",
        "default"
    ].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
        return _action_hooks__WEBPACK_IMPORTED_MODULE_16__[key];
    }).bind(0, __WEBPACK_IMPORT_KEY__);
    __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
    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      position: relative;\n      width: 100%;\n      margin-left: 10px;\n    "
        ]);
        _templateObject = function() {
            return data;
        };
        return data;
    }
    const useStyles = (0, antd_style__WEBPACK_IMPORTED_MODULE_3__.createStyles)((param)=>{
        let { css } = param;
        return {
            filter: css(_templateObject())
        };
    });
    const FormLinkageRules = (0, _application_hoc_withDynamicSchemaProps__WEBPACK_IMPORTED_MODULE_4__.withDynamicSchemaProps)((0, _tachybase_schema__WEBPACK_IMPORTED_MODULE_2__.observer)((props)=>{
        const { styles } = useStyles();
        const fieldSchema = (0, _tachybase_schema__WEBPACK_IMPORTED_MODULE_2__.useFieldSchema)();
        const { options, defaultValues, collectionName, form, formBlockType, variables, localVariables, record, dynamicComponent } = (0, _schema_component__WEBPACK_IMPORTED_MODULE_9__.useProps)(props);
        const { getAllCollectionsInheritChain } = (0, _collection_manager__WEBPACK_IMPORTED_MODULE_6__.useCollectionManager_deprecated)();
        const parentRecordData = (0, _data_source_collection_record_CollectionRecordProvider__WEBPACK_IMPORTED_MODULE_7__.useCollectionParentRecordData)();
        const components = (0, react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(()=>({
                ArrayCollapse: _components_LinkageHeader__WEBPACK_IMPORTED_MODULE_13__.ArrayCollapse
            }), []);
        const schema = (0, react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(()=>({
                type: 'object',
                properties: {
                    rules: {
                        type: 'array',
                        default: defaultValues,
                        'x-component': 'ArrayCollapse',
                        'x-decorator': 'FormItem',
                        'x-component-props': {
                            accordion: true
                        },
                        items: {
                            type: 'object',
                            'x-component': 'ArrayCollapse.CollapsePanel',
                            'x-component-props': {
                                extra: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_EnableLinkage__WEBPACK_IMPORTED_MODULE_12__.EnableLinkage, {})
                            },
                            properties: {
                                layout: {
                                    type: 'void',
                                    'x-component': 'FormLayout',
                                    'x-component-props': {
                                        labelStyle: {
                                            marginTop: '6px'
                                        },
                                        labelCol: 8,
                                        wrapperCol: 16
                                    },
                                    properties: {
                                        conditions: {
                                            'x-component': 'h4',
                                            'x-content': '{{ t("Condition") }}'
                                        },
                                        condition: {
                                            'x-component': 'Filter',
                                            'x-use-component-props': ()=>({
                                                    options,
                                                    className: styles.filter
                                                }),
                                            'x-component-props': {
                                                collectionName,
                                                dynamicComponent: (props)=>{
                                                    const { collectionField } = props;
                                                    return /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_VariableInput_VariableInput__WEBPACK_IMPORTED_MODULE_11__.VariableInput, {
                                                        ...props,
                                                        form: form,
                                                        record: record,
                                                        shouldChange: (0, _VariableInput_VariableInput__WEBPACK_IMPORTED_MODULE_11__.getShouldChange)({
                                                            collectionField,
                                                            variables,
                                                            localVariables,
                                                            getAllCollectionsInheritChain
                                                        })
                                                    });
                                                }
                                            }
                                        },
                                        actions: {
                                            'x-component': 'h4',
                                            'x-content': '{{ t("Properties") }}'
                                        },
                                        action: {
                                            type: 'void',
                                            'x-component': _LinkageRuleActionGroup__WEBPACK_IMPORTED_MODULE_14__.LinkageRuleActionGroup,
                                            'x-component-props': {
                                                ...props
                                            }
                                        }
                                    }
                                },
                                remove: {
                                    type: 'void',
                                    'x-component': 'ArrayCollapse.Remove'
                                },
                                moveUp: {
                                    type: 'void',
                                    'x-component': 'ArrayCollapse.MoveUp'
                                },
                                moveDown: {
                                    type: 'void',
                                    'x-component': 'ArrayCollapse.MoveDown'
                                },
                                copy: {
                                    type: 'void',
                                    'x-component': 'ArrayCollapse.Copy'
                                }
                            }
                        },
                        properties: {
                            add: {
                                type: 'void',
                                title: '{{ t("Add linkage rule") }}',
                                'x-component': 'ArrayCollapse.Addition',
                                'x-reactions': {
                                    dependencies: [
                                        'rules'
                                    ],
                                    fulfill: {
                                        state: {}
                                    }
                                }
                            }
                        }
                    }
                }
            }), [
            collectionName,
            defaultValues,
            form,
            localVariables,
            options,
            props,
            record,
            variables
        ]);
        const value = (0, react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(()=>({
                field: options,
                fieldSchema,
                dynamicComponent,
                options: options || []
            }), [
            dynamicComponent,
            fieldSchema,
            options
        ]);
        return /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_block_provider__WEBPACK_IMPORTED_MODULE_5__.FormBlockContext.Provider, {
            value: {
                form,
                type: formBlockType,
                collectionName
            },
            children: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_record_provider__WEBPACK_IMPORTED_MODULE_8__.RecordProvider, {
                record: record,
                parent: parentRecordData,
                children: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_schema_component_antd_filter_context__WEBPACK_IMPORTED_MODULE_10__.FilterContext.Provider, {
                    value: value,
                    children: /*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_schema_component__WEBPACK_IMPORTED_MODULE_9__.SchemaComponent, {
                        components: components,
                        schema: schema
                    })
                })
            })
        });
    }), {
        displayName: 'FormLinkageRules'
    });
})();
exports.FormLinkageRules = __webpack_exports__.FormLinkageRules;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
    "FormLinkageRules"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
    value: true
});
