import { Y as p, f as y, U as d, e as g, Z as b, _ as h, $ as C, a0 as j, a1 as T, a2 as K, a3 as R, a4 as _, a5 as k, a6 as L, a7 as v, a8 as A, a9 as O, aa as Z, ab as U, ac as Y, ad as w, ae as H, af as P, ag as N, ah as z, ai as F, aj as I, z as $ } from "./Toggle-3WohopP9.js";
import { j as r } from "./jsx-runtime-B6kdoens.js";
import { useState as q, useEffect as X, useRef as x, useCallback as M } from "react";
import "./aggregator-BpQMir30.js";
import { q as l, T as f } from "./css-CiSR0WsA.js";
import "./Pack-l3j3YWpE.js";
import { K as B } from "./Keyboard-BpXlLck_.js";
const G = (e) => {
  const { listen: t } = p(), [n, c] = q([]);
  return X(
    () => t(({ next: [s] }) => c(s ?? [])),
    [t, c]
  ), /* @__PURE__ */ r.jsx(y, { ...e, children: n.join(" ") });
}, J = {
  Control: () => /* @__PURE__ */ r.jsx(d.Meta, {}, "control"),
  Alt: () => /* @__PURE__ */ r.jsx(d.Alt, {}, "alt"),
  Shift: () => /* @__PURE__ */ r.jsx(g.Keyboard.Shift, {}, "shift"),
  MouseLeft: "Left Click",
  MouseRight: "Right Click",
  MouseMiddle: "Middle Click",
  Enter: () => /* @__PURE__ */ r.jsx(g.Keyboard.Return, {}, "enter")
}, E = (e) => {
  const t = J[e];
  return t != null ? typeof t == "function" ? t() : t : e;
}, Q = (e) => e.map((t) => E(t)), V = ({
  className: e,
  style: t,
  trigger: n,
  children: c,
  ...s
}) => /* @__PURE__ */ r.jsx(r.Fragment, { children: n.map((a) => (
  // @ts-expect-error - issues with generic element types
  /* @__PURE__ */ r.jsx(B, { ...s, children: E(a) }, a)
)) }), W = ({
  onDrag: e,
  triggers: t = [["MouseLeft"], ["MouseRight"]],
  bound: n,
  loose: c = !1
}) => {
  const s = x(null), a = x(l.ZERO), m = M(
    (o) => {
      const u = l.construct(o);
      if (s.current === null) return;
      const { triggers: i } = s.current;
      e({
        box: f.construct(a.current, u),
        cursor: u,
        triggers: i,
        stage: "during"
      });
    },
    [e]
  ), S = M(
    (o) => {
      const { stage: u, cursor: i } = o;
      u === "start" ? (e({ box: f.construct(i), ...o }), window.addEventListener("mousemove", m), s.current = o, a.current = i) : u === "end" && s.current != null && (e({ box: f.construct(a.current, i), ...o }), window.removeEventListener("mousemove", m), s.current = null, a.current = l.ZERO);
    },
    [e]
  );
  b({ triggers: t, callback: S, region: n, loose: c });
}, ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  ALPHANUMERIC_KEYS: h,
  ALPHANUMERIC_KEYS_SET: C,
  KEYS: j,
  MOUSE_KEYS: T,
  Provider: K,
  Status: G,
  Text: V,
  compareModeConfigs: R,
  determineMode: _,
  diff: k,
  eventKey: L,
  filter: v,
  flattenConfig: A,
  keyZ: O,
  keyboardKey: Z,
  match: U,
  matchCallback: Y,
  mouseKey: w,
  mouseKeyZ: H,
  purge: P,
  purgeMouse: N,
  toSymbols: Q,
  triggerZ: z,
  use: b,
  useContext: p,
  useDrag: W,
  useFlattenedMemoConfig: F,
  useHeld: I,
  useHeldRef: $
}, Symbol.toStringTag, { value: "Module" }));
export {
  V as T,
  ne as e,
  W as u
};
