import * as v from "react";
import { composeEventHandlers as b } from "../../../../../@radix-ui_primitive@1.1.0/node_modules/@radix-ui/primitive/dist/index.js";
import { createContextScope as M } from "../../../../../@radix-ui_react-context@1.1.0_@types_react@18.3.3_react@18.3.0-canary-3d9b20132-20240124/node_modules/@radix-ui/react-context/dist/index.js";
import { createRovingFocusGroupScope as x, Root as N, Item as P } from "../../../../../@radix-ui_react-roving-focus@1.1.0_@types_react-dom@18.3.6_@types_react@18.3.3__@types__089b118f90c2a8e34e48dd885dbeaf66/node_modules/@radix-ui/react-roving-focus/dist/index.js";
import { Presence as F } from "../../../../../@radix-ui_react-presence@1.1.0_@types_react-dom@18.3.6_@types_react@18.3.3__@types_reac_4a916339a724b4591202705df11dd5fc/node_modules/@radix-ui/react-presence/dist/index.js";
import { Primitive as p } from "../../../../../@radix-ui_react-primitive@2.0.0_@types_react-dom@18.3.6_@types_react@18.3.3__@types_rea_bdcf182289a3a76356f07e550726e479/node_modules/@radix-ui/react-primitive/dist/index.js";
import { useDirection as w } from "../../../../../@radix-ui_react-direction@1.1.0_@types_react@18.3.3_react@18.3.0-canary-3d9b20132-20240124/node_modules/@radix-ui/react-direction/dist/index.js";
import { useControllableState as D } from "../../../../../@radix-ui_react-use-controllable-state@1.1.0_@types_react@18.3.3_react@18.3.0-canary-3d9b20132-20240124/node_modules/@radix-ui/react-use-controllable-state/dist/index.js";
import { useId as V } from "../../../../../@radix-ui_react-id@1.1.0_@types_react@18.3.3_react@18.3.0-canary-3d9b20132-20240124/node_modules/@radix-ui/react-id/dist/index.js";
import { j as u } from "../../../../../../../_virtual/jsx-runtime.js";
var g = "Tabs", [G, Q] = M(g, [
  x
]), C = x(), [L, T] = G(g), h = v.forwardRef(
  (e, r) => {
    const {
      __scopeTabs: s,
      value: t,
      onValueChange: n,
      defaultValue: c,
      orientation: o = "horizontal",
      dir: d,
      activationMode: f = "automatic",
      ...m
    } = e, i = w(d), [a, l] = D({
      prop: t,
      onChange: n,
      defaultProp: c
    });
    return /* @__PURE__ */ u.jsx(
      L,
      {
        scope: s,
        baseId: V(),
        value: a,
        onValueChange: l,
        orientation: o,
        dir: i,
        activationMode: f,
        children: /* @__PURE__ */ u.jsx(
          p.div,
          {
            dir: i,
            "data-orientation": o,
            ...m,
            ref: r
          }
        )
      }
    );
  }
);
h.displayName = g;
var I = "TabsList", R = v.forwardRef(
  (e, r) => {
    const { __scopeTabs: s, loop: t = !0, ...n } = e, c = T(I, s), o = C(s);
    return /* @__PURE__ */ u.jsx(
      N,
      {
        asChild: !0,
        ...o,
        orientation: c.orientation,
        dir: c.dir,
        loop: t,
        children: /* @__PURE__ */ u.jsx(
          p.div,
          {
            role: "tablist",
            "aria-orientation": c.orientation,
            ...n,
            ref: r
          }
        )
      }
    );
  }
);
R.displayName = I;
var _ = "TabsTrigger", y = v.forwardRef(
  (e, r) => {
    const { __scopeTabs: s, value: t, disabled: n = !1, ...c } = e, o = T(_, s), d = C(s), f = j(o.baseId, t), m = E(o.baseId, t), i = t === o.value;
    return /* @__PURE__ */ u.jsx(
      P,
      {
        asChild: !0,
        ...d,
        focusable: !n,
        active: i,
        children: /* @__PURE__ */ u.jsx(
          p.button,
          {
            type: "button",
            role: "tab",
            "aria-selected": i,
            "aria-controls": m,
            "data-state": i ? "active" : "inactive",
            "data-disabled": n ? "" : void 0,
            disabled: n,
            id: f,
            ...c,
            ref: r,
            onMouseDown: b(e.onMouseDown, (a) => {
              !n && a.button === 0 && a.ctrlKey === !1 ? o.onValueChange(t) : a.preventDefault();
            }),
            onKeyDown: b(e.onKeyDown, (a) => {
              [" ", "Enter"].includes(a.key) && o.onValueChange(t);
            }),
            onFocus: b(e.onFocus, () => {
              const a = o.activationMode !== "manual";
              !i && !n && a && o.onValueChange(t);
            })
          }
        )
      }
    );
  }
);
y.displayName = _;
var A = "TabsContent", S = v.forwardRef(
  (e, r) => {
    const { __scopeTabs: s, value: t, forceMount: n, children: c, ...o } = e, d = T(A, s), f = j(d.baseId, t), m = E(d.baseId, t), i = t === d.value, a = v.useRef(i);
    return v.useEffect(() => {
      const l = requestAnimationFrame(() => a.current = !1);
      return () => cancelAnimationFrame(l);
    }, []), /* @__PURE__ */ u.jsx(F, { present: n || i, children: ({ present: l }) => /* @__PURE__ */ u.jsx(
      p.div,
      {
        "data-state": i ? "active" : "inactive",
        "data-orientation": d.orientation,
        role: "tabpanel",
        "aria-labelledby": f,
        hidden: !l,
        id: m,
        tabIndex: 0,
        ...o,
        ref: r,
        style: {
          ...e.style,
          animationDuration: a.current ? "0s" : void 0
        },
        children: l && c
      }
    ) });
  }
);
S.displayName = A;
function j(e, r) {
  return `${e}-trigger-${r}`;
}
function E(e, r) {
  return `${e}-content-${r}`;
}
var U = h, W = R, X = y, Y = S;
export {
  Y as Content,
  W as List,
  U as Root,
  h as Tabs,
  S as TabsContent,
  R as TabsList,
  y as TabsTrigger,
  X as Trigger,
  Q as createTabsScope
};
//# sourceMappingURL=index.js.map
