import h from "../../../@babel/runtime/helpers/esm/extends.mjs";
import C from "../../../@babel/runtime/helpers/esm/objectWithoutProperties.mjs";
import * as n from "react";
import R from "./Handle.mjs";
import { getIndex as x } from "../util.mjs";
var y = ["prefixCls", "style", "onStartMove", "onOffsetChange", "values", "handleRender", "draggingIndex"], I = /* @__PURE__ */ n.forwardRef(function(e, o) {
  var u = e.prefixCls, s = e.style, d = e.onStartMove, i = e.onOffsetChange, c = e.values, g = e.handleRender, v = e.draggingIndex, m = C(e, y), a = n.useRef({});
  return n.useImperativeHandle(o, function() {
    return {
      focus: function(r) {
        var t;
        (t = a.current[r]) === null || t === void 0 || t.focus();
      }
    };
  }), /* @__PURE__ */ n.createElement(n.Fragment, null, c.map(function(f, r) {
    return /* @__PURE__ */ n.createElement(R, h({
      ref: function(l) {
        l ? a.current[r] = l : delete a.current[r];
      },
      dragging: v === r,
      prefixCls: u,
      style: x(s, r),
      key: r,
      value: f,
      valueIndex: r,
      onStartMove: d,
      onOffsetChange: i,
      render: g
    }, m));
  }));
});
process.env.NODE_ENV !== "production" && (I.displayName = "Handles");
export {
  I as default
};
