"use strict";

exports.__esModule = true;
exports.KanbanDragAndDropContext = void 0;
var _react = _interopRequireWildcard(require("react"));
var _core = require("@wix/wix-style-react-incubator/dnd-kit/core");
var _modifiers = require("@wix/wix-style-react-incubator/dnd-kit/modifiers");
var _mobxReactLite = require("mobx-react-lite");
var _react2 = require("@wix/bex-core/react");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/KanbanDragAndDropDndKit/KanbanDragAndDropContext.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); }
function _KanbanDragAndDropContext(props) {
  const {
    state: kanbanState,
    children
  } = props;
  const {
    modalsContainerRef
  } = (0, _react2.usePageContext)();
  const dragAndDropState = kanbanState.dragAndDropState;
  const pointerSensor = (0, _core.useSensor)(_core.PointerSensor, {
    activationConstraint: {
      distance: 3
    }
  });
  const keyboardSensor = (0, _core.useSensor)(_core.KeyboardSensor, {
    keyboardCodes: kanbanState.dragAndDropState.keyboardCodes,
    coordinateGetter: () => ({
      x: 0,
      y: 25
    })
  });
  const sensors = (0, _core.useSensors)(...(process.env.NODE_ENV === 'test' ? [] : [pointerSensor, keyboardSensor]));
  (0, _react.useEffect)(() => dragAndDropState.init(), [dragAndDropState]);
  const handleDragStart = event => {
    dragAndDropState.handleDragStart(event);
  };
  const handleDragOver = () => {};
  const handleDragEnd = event => {
    dragAndDropState.handleDragEnd(event);
  };
  const handleDragCancel = () => {
    dragAndDropState.handleDragCancel();
  };
  return /*#__PURE__*/_react.default.createElement(_core.DndContext, {
    sensors: sensors,
    autoScroll: {
      activator: _core.AutoScrollActivator.DraggableRect,
      acceleration: 1,
      interval: 10,
      threshold: {
        y: 0.15,
        x: 0.15
      }
    },
    accessibility: {
      container: modalsContainerRef.current,
      announcements: {
        onDragStart: () => 'Item picked up for dragging',
        onDragOver: () => 'Item moved over droppable area',
        onDragEnd: () => 'Item dropped',
        onDragCancel: () => 'Dragging cancelled'
      },
      screenReaderInstructions: {
        draggable: 'To pick up a draggable item, press the space bar.'
      },
      restoreFocus: false
    },
    collisionDetection: _core.closestCenter,
    modifiers: [_modifiers.restrictToWindowEdges],
    onDragStart: handleDragStart,
    onDragOver: handleDragOver,
    onDragEnd: handleDragEnd,
    onDragCancel: handleDragCancel,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 67,
      columnNumber: 5
    }
  }, children);
}
const KanbanDragAndDropContext = exports.KanbanDragAndDropContext = (0, _mobxReactLite.observer)(_KanbanDragAndDropContext);
//# sourceMappingURL=KanbanDragAndDropContext.js.map