import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__block_provider_index_mjs__ from "../../block-provider/index.mjs";
const useContextVariable = ()=>{
    var _field_data, _service_data;
    const { field, service, rowKey, collection: collectionName } = (0, __WEBPACK_EXTERNAL_MODULE__block_provider_index_mjs__.useTableBlockContext)();
    const contextData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
        var _service_data_data, _service_data;
        return null == service ? void 0 : null === (_service_data = service.data) || void 0 === _service_data ? void 0 : null === (_service_data_data = _service_data.data) || void 0 === _service_data_data ? void 0 : _service_data_data.filter((v)=>{
            var _this, _field_data;
            return null === (_this = (null == field ? void 0 : null === (_field_data = field.data) || void 0 === _field_data ? void 0 : _field_data.selectedRowKeys) || []) || void 0 === _this ? void 0 : _this.includes(v[rowKey]);
        });
    }, [
        null == field ? void 0 : null === (_field_data = field.data) || void 0 === _field_data ? void 0 : _field_data.selectedRowKeys,
        rowKey,
        null == service ? void 0 : null === (_service_data = service.data) || void 0 === _service_data ? void 0 : _service_data.data
    ]);
    return (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>({
            name: '$context',
            ctx: contextData,
            collectionName
        }), [
        collectionName,
        contextData
    ]);
};
const useContextVariable_rslib_entry_ = useContextVariable;
export { useContextVariable_rslib_entry_ as default };
