import { u as E, a as p, b as x } from "./hooks-QNj6PdUo.js";
import { u as d, A as b, b as S, K as _, M as R, e as y, g as T, h as K, P as U, T as C, i as L, j as O, d as h, k as j, f as v, l as k, m as A, n as w, o as H, q as N, r as P, s as Z, t as I, p as Y, v as B, w as F, x as q, y as z } from "./Text-2MISZsc5.js";
import { j as G } from "./jsx-runtime-tc70JA_2.js";
import { useState as $, useEffect as J, useRef as f, useCallback as g } from "react";
import { T as Q } from "./Editable-C17ILP50.js";
import { xy as i, box as l } from "@synnaxlabs/x";
import "./types-CGRCBVD4.js";
const V = (e) => {
  const { listen: a } = d(), [c, n] = $([]);
  return J(
    () => a(({ next: [s] }) => n(s ?? [])),
    [a, n]
  ), /* @__PURE__ */ G.jsx(Q, { ...e, children: c.join(" ") });
}, W = ({
  onDrag: e,
  triggers: a = [["MouseLeft"], ["MouseRight"]],
  bound: c,
  loose: n = !1
}) => {
  const s = f(null), u = f(i.ZERO), m = g(
    (t) => {
      const r = i.construct(t);
      if (s.current === null) return;
      const { triggers: o } = s.current;
      e({
        box: l.construct(u.current, r),
        cursor: r,
        triggers: o,
        stage: "during"
      });
    },
    [e]
  ), M = g(
    (t) => {
      const { stage: r, cursor: o } = t;
      r === "start" ? (e({ box: l.construct(o), ...t }), window.addEventListener("mousemove", m), s.current = t, u.current = o) : r === "end" && s.current != null && (e({ box: l.construct(u.current, o), ...t }), window.removeEventListener("mousemove", m), s.current = null, u.current = i.ZERO);
    },
    [e]
  );
  E({ triggers: a, callback: M, region: c, loose: n });
}, ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  ALPHANUMERIC_KEYS: b,
  ALPHANUMERIC_KEYS_SET: S,
  KEYS: _,
  MOUSE_KEYS: R,
  MOUSE_LEFT_NUMBER: y,
  MOUSE_MIDDLE_NUMBER: T,
  MOUSE_RIGHT_NUMBER: K,
  Provider: U,
  Status: V,
  Text: C,
  compareModeConfigs: L,
  determineMode: O,
  diff: h,
  eventKey: j,
  filter: v,
  flattenConfig: k,
  isAlphanumericKey: A,
  keyZ: w,
  keyboardKey: H,
  match: N,
  matchCallback: P,
  mouseKey: Z,
  mouseKeyZ: I,
  purge: Y,
  purgeMouse: B,
  toSymbols: F,
  triggerZ: q,
  use: E,
  useContext: d,
  useDrag: W,
  useFlattenedMemoConfig: z,
  useHeld: p,
  useHeldRef: x
}, Symbol.toStringTag, { value: "Module" }));
export {
  ae as e,
  W as u
};
