const s = (e = 250) => {
  let n;
  const t = (o, ...E) => {
    r(), n = setTimeout(() => o(...E), e);
  }, r = () => {
    clearTimeout(n);
  };
  return {
    delayTime: e,
    timer: n,
    delay: t,
    cancel: r
  };
}, i = (e, n) => {
  if (!e || !e.currentPointer)
    return {
      map: n
    };
  const t = e.currentPointer.viewportX, r = e.currentPointer.viewportY;
  return {
    viewportX: t,
    viewportY: r,
    map: n,
    calculateGeoCoords: () => n.screenToGeo(t, r)
  };
}, T = (e, n) => (t) => e(t, i(t, n)), l = (e, n, t) => {
  if (!n)
    return;
  const r = {};
  Object.keys(n).forEach((o) => {
    const E = T(n[o], t);
    e.addEventListener(o, E), r[o] = E;
  }), e.rioMapRemoveEvents = () => (Object.keys(r).forEach((o) => {
    e.removeEventListener(o, r[o]);
  }), delete e.rioMapRemoveEvents, t);
}, N = (e) => {
  if (e.rioMapRemoveEvents)
    return e.rioMapRemoveEvents();
}, u = (e, n = 300) => {
  const t = { ...e };
  if (!e[c.TAP] || !e[c.DBL_TAP])
    return t;
  const r = s(n);
  return t[c.TAP] = (...o) => {
    r.delay(e[c.TAP], ...o);
  }, t[c.DBL_TAP] = (...o) => {
    r.cancel(), e[c.DBL_TAP](...o);
  }, t;
}, a = (e) => e.originalEvent.button, _ = (e) => a(e) === c.MOUSE_BUTTONS.RIGHT, c = {
  MOUSE_BUTTONS: {
    LEFT: 0,
    MIDDLE: 1,
    RIGHT: 2
  },
  POINTER_DOWN: "pointerdown",
  POINTER_UP: "pointerup",
  POINTER_MOVE: "pointermove",
  POINTER_ENTER: "pointerenter",
  POINTER_LEAVE: "pointerleave",
  POINTER_CANCEL: "pointercancel",
  DRAG_START: "dragstart",
  DRAG: "drag",
  DRAG_END: "dragend",
  TAP: "tap",
  DBL_TAP: "dbltap",
  LONGPRESS: "longpress",
  CONTEXTMENU: "contextmenu",
  CONTEXTMENU_CLOSE: "contextmenuclose",
  MAP_VIEW_CHANGE_START: "mapviewchangestart",
  MAP_VIEW_CHANGE: "mapviewchange",
  MAP_VIEW_CHANGE_END: "mapviewchangeend",
  BASE_LAYER_CHANGE: "baselayerchange",
  ENGINE_CHANGE: "enginechange",
  createTapOnDblTapPreventer: u,
  getMouseButton: a,
  isRightClick: _
};
export {
  c as EventUtils,
  l as addEventListenerMap,
  T as createEnhancedListener,
  i as createEnhancedMapEvent,
  u as createTapOnDblTapPreventer,
  c as default,
  a as getMouseButton,
  _ as isRightClick,
  N as removeEventListenerMap
};
//# sourceMappingURL=eventHandling.js.map
