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_components__ from "@tachybase/components";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
const EnableLinkage = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].forwardRef((props, ref)=>{
    var _array_field;
    const array = __WEBPACK_EXTERNAL_MODULE__tachybase_components__.ArrayBase.useArray();
    const index = __WEBPACK_EXTERNAL_MODULE__tachybase_components__.ArrayBase.useIndex(props.index);
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Switch, {
        ...props,
        checkedChildren: t('On'),
        unCheckedChildren: t('Off'),
        checked: !(null == array ? void 0 : null === (_array_field = array.field) || void 0 === _array_field ? void 0 : _array_field.value[index].disabled),
        size: 'small',
        style: {
            transition: 'all 0.25s ease-in-out',
            color: 'rgba(0, 0, 0, 0.8)',
            fontSize: 16,
            marginLeft: 6,
            marginBottom: 3
        },
        onChange: (checked, e)=>{
            var _array_field;
            e.stopPropagation();
            array.field.value.splice(index, 1, {
                ...null == array ? void 0 : null === (_array_field = array.field) || void 0 === _array_field ? void 0 : _array_field.value[index],
                disabled: !checked
            });
        },
        onClick: (checked, e)=>{
            e.stopPropagation();
        }
    });
});
EnableLinkage.displayName = 'EnableLinkage';
export { EnableLinkage };
