import { REMOVE_TARGET as i } from "../actions/registry.js";
import { without as o } from "../utils/js_utils.js";
import { END_DRAG as c, DROP as d, HOVER as s, PUBLISH_DRAG_SOURCE as p, BEGIN_DRAG as a } from "../actions/dragDrop/types.js";
function f(e, t, r) {
  return t in e ? Object.defineProperty(e, t, {
    value: r,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = r, e;
}
function u(e) {
  for (var t = 1; t < arguments.length; t++) {
    var r = arguments[t] != null ? arguments[t] : {}, l = Object.keys(r);
    typeof Object.getOwnPropertySymbols == "function" && (l = l.concat(Object.getOwnPropertySymbols(r).filter(function(n) {
      return Object.getOwnPropertyDescriptor(r, n).enumerable;
    }))), l.forEach(function(n) {
      f(e, n, r[n]);
    });
  }
  return e;
}
const m = {
  itemType: null,
  item: null,
  sourceId: null,
  targetIds: [],
  dropResult: null,
  didDrop: !1,
  isSourcePublic: null
};
function O(e = m, t) {
  const { payload: r } = t;
  switch (t.type) {
    case a:
      return u({}, e, {
        itemType: r.itemType,
        item: r.item,
        sourceId: r.sourceId,
        isSourcePublic: r.isSourcePublic,
        dropResult: null,
        didDrop: !1
      });
    case p:
      return u({}, e, {
        isSourcePublic: !0
      });
    case s:
      return u({}, e, {
        targetIds: r.targetIds
      });
    case i:
      return e.targetIds.indexOf(r.targetId) === -1 ? e : u({}, e, {
        targetIds: o(e.targetIds, r.targetId)
      });
    case d:
      return u({}, e, {
        dropResult: r.dropResult,
        didDrop: !0,
        targetIds: []
      });
    case c:
      return u({}, e, {
        itemType: null,
        item: null,
        sourceId: null,
        dropResult: null,
        didDrop: !1,
        isSourcePublic: null,
        targetIds: []
      });
    default:
      return e;
  }
}
export {
  O as reduce
};
//# sourceMappingURL=dragOperation.js.map
