"use strict";

exports.__esModule = true;
exports.OuterElement = void 0;
exports.VirtualTableRepeater = VirtualTableRepeater;
var _react = _interopRequireWildcard(require("react"));
var _VirtualGridRepeaterBase = require("./VirtualGridRepeaterBase");
var _VirtualTableRow = require("./VirtualTableRow");
var _TableForceRenderIndexes = require("./TableForceRenderIndexes");
var _VirtualGridStateContext = require("./VirtualGridStateContext");
var _VirtualTableRowMutated = require("./VirtualTableRowMutated");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/VirtualGridRepeater/VirtualTableRepeater.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const OuterElementPropsContext = /*#__PURE__*/(0, _react.createContext)({});
function VirtualTableRepeater({
  children
}) {
  const gridState = (0, _VirtualGridStateContext.useVirtualGridStateContext)();
  const renderItem = (0, _react.useCallback)((index, {
    style,
    itemKey,
    index2d
  } = {}) => {
    return /*#__PURE__*/_react.default.createElement(_VirtualTableRowMutated.VirtualTableRowMutated, {
      index: index,
      style: style,
      itemKey: itemKey,
      rowIndex: index2d == null ? void 0 : index2d.rowIndex,
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 27,
        columnNumber: 9
      }
    }, children);
  }, [children]);
  return /*#__PURE__*/_react.default.createElement(_VirtualGridRepeaterBase.VirtualGridRepeaterBase, {
    innerElementType: _TableForceRenderIndexes.TableForceRenderIndexes,
    outerElementType: OuterElement,
    gridState: gridState,
    renderItem: renderItem,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 41,
      columnNumber: 5
    }
  }, _VirtualTableRow.VirtualTableRow);
}

// wrap with forwardRef to avoid warning in console about ref being passed to a function component without `forwardRef`.
// react-window passes the ref - https://github.com/bvaughn/react-window/blob/6ff5694ac810617515acf74401ba68fe2951133b/src/createGridComponent.js#L464
const OuterElement = exports.OuterElement = /*#__PURE__*/(0, _react.forwardRef)(({
  children,
  ...rest
}, _ref) => {
  return /*#__PURE__*/_react.default.createElement(OuterElementPropsContext.Provider, {
    value: rest,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 57,
      columnNumber: 7
    }
  }, children);
});
//# sourceMappingURL=VirtualTableRepeater.js.map