zen-code 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,651 @@
1
+ import { b as Y, a as m, p as Z, n as G, c as J, F as X, R as y, T as D, j as b, u as k, B as O } from "./use-input-CQELhJxU.mjs";
2
+ import T from "chalk";
3
+ import { g as ee } from "./_commonjsHelpers-ByX85dGu.mjs";
4
+ import ne from "openai";
5
+ import re from "@anthropic-ai/sdk";
6
+ const se = (n, r = {}) => {
7
+ const { stdin: c, setRawMode: t, internal_exitOnCtrlC: s, internal_eventEmitter: u } = Y();
8
+ m.useEffect(() => {
9
+ if (r.isActive !== !1)
10
+ return t(!0), () => {
11
+ t(!1);
12
+ };
13
+ }, [r.isActive, t]), m.useEffect(() => {
14
+ if (r.isActive === !1)
15
+ return;
16
+ const h = (I) => {
17
+ const a = Z(I), p = {
18
+ upArrow: a.name === "up",
19
+ downArrow: a.name === "down",
20
+ leftArrow: a.name === "left",
21
+ rightArrow: a.name === "right",
22
+ pageDown: a.name === "pagedown",
23
+ pageUp: a.name === "pageup",
24
+ home: a.name === "home",
25
+ end: a.name === "end",
26
+ return: a.name === "return",
27
+ escape: a.name === "escape",
28
+ ctrl: a.ctrl,
29
+ shift: a.shift,
30
+ tab: a.name === "tab",
31
+ backspace: a.name === "backspace",
32
+ delete: a.name === "delete",
33
+ // `parseKeypress` parses \u001B\u001B[A (meta + up arrow) as meta = false
34
+ // but with option = true, so we need to take this into account here
35
+ // to avoid breaking changes in Ink.
36
+ // TODO(vadimdemedes): consider removing this in the next major version.
37
+ meta: a.meta || a.name === "escape" || a.option
38
+ };
39
+ let v = a.ctrl ? a.name : a.sequence;
40
+ G.includes(a.name) && (v = ""), v.startsWith("\x1B") && (v = v.slice(1)), v.length === 1 && typeof v[0] == "string" && /[A-Z]/.test(v[0]) && (p.shift = !0), (!(v === "c" && p.ctrl) || !s) && J.batchedUpdates(() => {
41
+ n(v, p);
42
+ });
43
+ };
44
+ return u?.on("input", h), () => {
45
+ u?.removeListener("input", h);
46
+ };
47
+ }, [r.isActive, c, s, n]);
48
+ }, Q = ({ isActive: n = !0, autoFocus: r = !1, id: c } = {}) => {
49
+ const { isRawModeSupported: t, setRawMode: s } = Y(), { activeId: u, add: h, remove: I, activate: a, deactivate: p, focus: v } = m.useContext(X), w = m.useMemo(() => c ?? Math.random().toString().slice(2, 7), [c]);
50
+ return m.useEffect(() => (h(w, { autoFocus: r }), () => {
51
+ I(w);
52
+ }), [w, r]), m.useEffect(() => {
53
+ n ? a(w) : p(w);
54
+ }, [n, w]), m.useEffect(() => {
55
+ if (!(!t || !n))
56
+ return s(!0), () => {
57
+ s(!1);
58
+ };
59
+ }, [n]), {
60
+ isFocused: !!w && u === w,
61
+ focus: v
62
+ };
63
+ }, te = { interval: 80, frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] }, ie = { interval: 80, frames: ["⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"] }, oe = { interval: 80, frames: ["⠋", "⠙", "⠚", "⠞", "⠖", "⠦", "⠴", "⠲", "⠳", "⠓"] }, le = { interval: 80, frames: ["⠄", "⠆", "⠇", "⠋", "⠙", "⠸", "⠰", "⠠", "⠰", "⠸", "⠙", "⠋", "⠇", "⠆"] }, ce = { interval: 80, frames: ["⠋", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋"] }, ae = { interval: 80, frames: ["⠁", "⠉", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠤", "⠄", "⠄", "⠤", "⠴", "⠲", "⠒", "⠂", "⠂", "⠒", "⠚", "⠙", "⠉", "⠁"] }, ue = { interval: 80, frames: ["⠈", "⠉", "⠋", "⠓", "⠒", "⠐", "⠐", "⠒", "⠖", "⠦", "⠤", "⠠", "⠠", "⠤", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋", "⠉", "⠈"] }, _e = { interval: 80, frames: ["⠁", "⠁", "⠉", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠤", "⠄", "⠄", "⠤", "⠠", "⠠", "⠤", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋", "⠉", "⠈", "⠈"] }, fe = { interval: 80, frames: ["⢹", "⢺", "⢼", "⣸", "⣇", "⡧", "⡗", "⡏"] }, me = { interval: 80, frames: ["⢄", "⢂", "⢁", "⡁", "⡈", "⡐", "⡠"] }, de = { interval: 100, frames: ["⠁", "⠂", "⠄", "⡀", "⢀", "⠠", "⠐", "⠈"] }, ve = { interval: 80, frames: ["⢀⠀", "⡀⠀", "⠄⠀", "⢂⠀", "⡂⠀", "⠅⠀", "⢃⠀", "⡃⠀", "⠍⠀", "⢋⠀", "⡋⠀", "⠍⠁", "⢋⠁", "⡋⠁", "⠍⠉", "⠋⠉", "⠋⠉", "⠉⠙", "⠉⠙", "⠉⠩", "⠈⢙", "⠈⡙", "⢈⠩", "⡀⢙", "⠄⡙", "⢂⠩", "⡂⢘", "⠅⡘", "⢃⠨", "⡃⢐", "⠍⡐", "⢋⠠", "⡋⢀", "⠍⡁", "⢋⠁", "⡋⠁", "⠍⠉", "⠋⠉", "⠋⠉", "⠉⠙", "⠉⠙", "⠉⠩", "⠈⢙", "⠈⡙", "⠈⠩", "⠀⢙", "⠀⡙", "⠀⠩", "⠀⢘", "⠀⡘", "⠀⠨", "⠀⢐", "⠀⡐", "⠀⠠", "⠀⢀", "⠀⡀"] }, Le = { interval: 80, frames: ["⣼", "⣹", "⢻", "⠿", "⡟", "⣏", "⣧", "⣶"] }, he = { interval: 80, frames: ["⠀", "⠁", "⠂", "⠃", "⠄", "⠅", "⠆", "⠇", "⡀", "⡁", "⡂", "⡃", "⡄", "⡅", "⡆", "⡇", "⠈", "⠉", "⠊", "⠋", "⠌", "⠍", "⠎", "⠏", "⡈", "⡉", "⡊", "⡋", "⡌", "⡍", "⡎", "⡏", "⠐", "⠑", "⠒", "⠓", "⠔", "⠕", "⠖", "⠗", "⡐", "⡑", "⡒", "⡓", "⡔", "⡕", "⡖", "⡗", "⠘", "⠙", "⠚", "⠛", "⠜", "⠝", "⠞", "⠟", "⡘", "⡙", "⡚", "⡛", "⡜", "⡝", "⡞", "⡟", "⠠", "⠡", "⠢", "⠣", "⠤", "⠥", "⠦", "⠧", "⡠", "⡡", "⡢", "⡣", "⡤", "⡥", "⡦", "⡧", "⠨", "⠩", "⠪", "⠫", "⠬", "⠭", "⠮", "⠯", "⡨", "⡩", "⡪", "⡫", "⡬", "⡭", "⡮", "⡯", "⠰", "⠱", "⠲", "⠳", "⠴", "⠵", "⠶", "⠷", "⡰", "⡱", "⡲", "⡳", "⡴", "⡵", "⡶", "⡷", "⠸", "⠹", "⠺", "⠻", "⠼", "⠽", "⠾", "⠿", "⡸", "⡹", "⡺", "⡻", "⡼", "⡽", "⡾", "⡿", "⢀", "⢁", "⢂", "⢃", "⢄", "⢅", "⢆", "⢇", "⣀", "⣁", "⣂", "⣃", "⣄", "⣅", "⣆", "⣇", "⢈", "⢉", "⢊", "⢋", "⢌", "⢍", "⢎", "⢏", "⣈", "⣉", "⣊", "⣋", "⣌", "⣍", "⣎", "⣏", "⢐", "⢑", "⢒", "⢓", "⢔", "⢕", "⢖", "⢗", "⣐", "⣑", "⣒", "⣓", "⣔", "⣕", "⣖", "⣗", "⢘", "⢙", "⢚", "⢛", "⢜", "⢝", "⢞", "⢟", "⣘", "⣙", "⣚", "⣛", "⣜", "⣝", "⣞", "⣟", "⢠", "⢡", "⢢", "⢣", "⢤", "⢥", "⢦", "⢧", "⣠", "⣡", "⣢", "⣣", "⣤", "⣥", "⣦", "⣧", "⢨", "⢩", "⢪", "⢫", "⢬", "⢭", "⢮", "⢯", "⣨", "⣩", "⣪", "⣫", "⣬", "⣭", "⣮", "⣯", "⢰", "⢱", "⢲", "⢳", "⢴", "⢵", "⢶", "⢷", "⣰", "⣱", "⣲", "⣳", "⣴", "⣵", "⣶", "⣷", "⢸", "⢹", "⢺", "⢻", "⢼", "⢽", "⢾", "⢿", "⣸", "⣹", "⣺", "⣻", "⣼", "⣽", "⣾", "⣿"] }, ge = { interval: 80, frames: ["⠁", "⠂", "⠄", "⡀", "⡈", "⡐", "⡠", "⣀", "⣁", "⣂", "⣄", "⣌", "⣔", "⣤", "⣥", "⣦", "⣮", "⣶", "⣷", "⣿", "⡿", "⠿", "⢟", "⠟", "⡛", "⠛", "⠫", "⢋", "⠋", "⠍", "⡉", "⠉", "⠑", "⠡", "⢁"] }, pe = { interval: 130, frames: ["-", "\\", "|", "/"] }, we = { interval: 100, frames: ["⠂", "-", "–", "—", "–", "-"] }, Ce = { interval: 100, frames: ["┤", "┘", "┴", "└", "├", "┌", "┬", "┐"] }, be = { interval: 400, frames: [". ", ".. ", "...", " "] }, xe = { interval: 200, frames: [". ", ".. ", "...", " ..", " .", " "] }, Me = { interval: 70, frames: ["✶", "✸", "✹", "✺", "✹", "✷"] }, Ie = { interval: 80, frames: ["+", "x", "*"] }, je = { interval: 70, frames: ["_", "_", "_", "-", "`", "`", "'", "´", "-", "_", "_", "_"] }, Ae = { interval: 100, frames: ["☱", "☲", "☴"] }, Ee = { interval: 120, frames: ["▁", "▃", "▄", "▅", "▆", "▇", "▆", "▅", "▄", "▃"] }, Ve = { interval: 120, frames: ["▏", "▎", "▍", "▌", "▋", "▊", "▉", "▊", "▋", "▌", "▍", "▎"] }, Se = { interval: 140, frames: [" ", ".", "o", "O", "@", "*", " "] }, Fe = { interval: 120, frames: [".", "o", "O", "°", "O", "o", "."] }, Re = { interval: 100, frames: ["▓", "▒", "░"] }, Be = { interval: 120, frames: ["⠁", "⠂", "⠄", "⠂"] }, De = { interval: 120, frames: ["▖", "▘", "▝", "▗"] }, Oe = { interval: 100, frames: ["▌", "▀", "▐", "▄"] }, Pe = { interval: 50, frames: ["◢", "◣", "◤", "◥"] }, qe = { interval: 80, frames: ["010010", "001100", "100101", "111010", "111101", "010111", "101011", "111000", "110011", "110101"] }, Ne = { interval: 100, frames: ["◜", "◠", "◝", "◞", "◡", "◟"] }, Te = { interval: 120, frames: ["◡", "⊙", "◠"] }, He = { interval: 180, frames: ["◰", "◳", "◲", "◱"] }, Ue = { interval: 120, frames: ["◴", "◷", "◶", "◵"] }, We = { interval: 50, frames: ["◐", "◓", "◑", "◒"] }, $e = { interval: 100, frames: ["╫", "╪"] }, Ke = { interval: 250, frames: ["⊶", "⊷"] }, ze = { interval: 80, frames: ["▫", "▪"] }, Ye = { interval: 120, frames: ["□", "■"] }, Qe = { interval: 100, frames: ["■", "□", "▪", "▫"] }, Ze = { interval: 100, frames: ["▮", "▯"] }, Ge = { interval: 300, frames: ["ဝ", "၀"] }, Je = { interval: 80, frames: ["⦾", "⦿"] }, Xe = { interval: 100, frames: ["◍", "◌"] }, ye = { interval: 100, frames: ["◉", "◎"] }, ke = { interval: 100, frames: ["㊂", "㊀", "㊁"] }, en = { interval: 50, frames: ["⧇", "⧆"] }, nn = { interval: 120, frames: ["☗", "☖"] }, rn = { interval: 80, frames: ["=", "*", "-"] }, sn = { interval: 100, frames: ["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"] }, tn = { interval: 80, frames: ["⬆️ ", "↗️ ", "➡️ ", "↘️ ", "⬇️ ", "↙️ ", "⬅️ ", "↖️ "] }, on = { interval: 120, frames: ["▹▹▹▹▹", "▸▹▹▹▹", "▹▸▹▹▹", "▹▹▸▹▹", "▹▹▹▸▹", "▹▹▹▹▸"] }, ln = { interval: 80, frames: ["[ ]", "[= ]", "[== ]", "[=== ]", "[====]", "[ ===]", "[ ==]", "[ =]", "[ ]", "[ =]", "[ ==]", "[ ===]", "[====]", "[=== ]", "[== ]", "[= ]"] }, cn = { interval: 80, frames: ["( ● )", "( ● )", "( ● )", "( ● )", "( ●)", "( ● )", "( ● )", "( ● )", "( ● )", "(● )"] }, an = { interval: 200, frames: ["😄 ", "😝 "] }, un = { interval: 300, frames: ["🙈 ", "🙈 ", "🙉 ", "🙊 "] }, _n = { interval: 100, frames: ["💛 ", "💙 ", "💜 ", "💚 ", "❤️ "] }, fn = { interval: 100, frames: ["🕛 ", "🕐 ", "🕑 ", "🕒 ", "🕓 ", "🕔 ", "🕕 ", "🕖 ", "🕗 ", "🕘 ", "🕙 ", "🕚 "] }, mn = { interval: 180, frames: ["🌍 ", "🌎 ", "🌏 "] }, dn = { interval: 17, frames: ["█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "███████▁▁▁▁▁▁▁▁▁▁▁▁▁", "████████▁▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "██████████▁▁▁▁▁▁▁▁▁▁", "███████████▁▁▁▁▁▁▁▁▁", "█████████████▁▁▁▁▁▁▁", "██████████████▁▁▁▁▁▁", "██████████████▁▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁▁██████████████▁▁▁▁", "▁▁▁██████████████▁▁▁", "▁▁▁▁█████████████▁▁▁", "▁▁▁▁██████████████▁▁", "▁▁▁▁██████████████▁▁", "▁▁▁▁▁██████████████▁", "▁▁▁▁▁██████████████▁", "▁▁▁▁▁██████████████▁", "▁▁▁▁▁▁██████████████", "▁▁▁▁▁▁██████████████", "▁▁▁▁▁▁▁█████████████", "▁▁▁▁▁▁▁█████████████", "▁▁▁▁▁▁▁▁████████████", "▁▁▁▁▁▁▁▁████████████", "▁▁▁▁▁▁▁▁▁███████████", "▁▁▁▁▁▁▁▁▁███████████", "▁▁▁▁▁▁▁▁▁▁██████████", "▁▁▁▁▁▁▁▁▁▁██████████", "▁▁▁▁▁▁▁▁▁▁▁▁████████", "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", "█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "██████▁▁▁▁▁▁▁▁▁▁▁▁▁█", "████████▁▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "█████████▁▁▁▁▁▁▁▁▁▁▁", "███████████▁▁▁▁▁▁▁▁▁", "████████████▁▁▁▁▁▁▁▁", "████████████▁▁▁▁▁▁▁▁", "██████████████▁▁▁▁▁▁", "██████████████▁▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁██████████████▁▁▁▁▁", "▁▁▁█████████████▁▁▁▁", "▁▁▁▁▁████████████▁▁▁", "▁▁▁▁▁████████████▁▁▁", "▁▁▁▁▁▁███████████▁▁▁", "▁▁▁▁▁▁▁▁█████████▁▁▁", "▁▁▁▁▁▁▁▁█████████▁▁▁", "▁▁▁▁▁▁▁▁▁█████████▁▁", "▁▁▁▁▁▁▁▁▁█████████▁▁", "▁▁▁▁▁▁▁▁▁▁█████████▁", "▁▁▁▁▁▁▁▁▁▁▁████████▁", "▁▁▁▁▁▁▁▁▁▁▁████████▁", "▁▁▁▁▁▁▁▁▁▁▁▁███████▁", "▁▁▁▁▁▁▁▁▁▁▁▁███████▁", "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", "▁▁▁▁▁▁▁▁▁▁▁▁▁███████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁", "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"] }, vn = { interval: 80, frames: ["🌑 ", "🌒 ", "🌓 ", "🌔 ", "🌕 ", "🌖 ", "🌗 ", "🌘 "] }, Ln = { interval: 140, frames: ["🚶 ", "🏃 "] }, hn = { interval: 80, frames: ["▐⠂ ▌", "▐⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂▌", "▐ ⠠▌", "▐ ⡀▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐ ⠠ ▌", "▐ ⠂ ▌", "▐ ⠈ ▌", "▐ ⠂ ▌", "▐ ⠠ ▌", "▐ ⡀ ▌", "▐⠠ ▌"] }, gn = { interval: 120, frames: ["▐|\\____________▌", "▐_|\\___________▌", "▐__|\\__________▌", "▐___|\\_________▌", "▐____|\\________▌", "▐_____|\\_______▌", "▐______|\\______▌", "▐_______|\\_____▌", "▐________|\\____▌", "▐_________|\\___▌", "▐__________|\\__▌", "▐___________|\\_▌", "▐____________|\\▌", "▐____________/|▌", "▐___________/|_▌", "▐__________/|__▌", "▐_________/|___▌", "▐________/|____▌", "▐_______/|_____▌", "▐______/|______▌", "▐_____/|_______▌", "▐____/|________▌", "▐___/|_________▌", "▐__/|__________▌", "▐_/|___________▌", "▐/|____________▌"] }, pn = { interval: 100, frames: ["d", "q", "p", "b"] }, wn = { interval: 100, frames: ["☀️ ", "☀️ ", "☀️ ", "🌤 ", "⛅️ ", "🌥 ", "☁️ ", "🌧 ", "🌨 ", "🌧 ", "🌨 ", "🌧 ", "🌨 ", "⛈ ", "🌨 ", "🌧 ", "🌨 ", "☁️ ", "🌥 ", "⛅️ ", "🌤 ", "☀️ ", "☀️ "] }, Cn = { interval: 400, frames: ["🌲", "🎄"] }, bn = { interval: 80, frames: ["، ", "′ ", " ´ ", " ‾ ", " ⸌", " ⸊", " |", " ⁎", " ⁕", " ෴ ", " ⁓", " ", " ", " "] }, xn = { interval: 125, frames: ["∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"] }, Mn = { interval: 150, frames: ["-", "=", "≡"] }, In = { interval: 80, frames: ["ρββββββ", "βρβββββ", "ββρββββ", "βββρβββ", "ββββρββ", "βββββρβ", "ββββββρ"] }, jn = { interval: 160, frames: ["🤘 ", "🤟 ", "🖖 ", "✋ ", "🤚 ", "👆 "] }, An = { interval: 80, frames: ["🤜    🤛 ", "🤜    🤛 ", "🤜    🤛 ", " 🤜  🤛  ", "  🤜🤛   ", " 🤜✨🤛   ", "🤜 ✨ 🤛  "] }, En = { interval: 80, frames: [" 🧑⚽️ 🧑 ", "🧑 ⚽️ 🧑 ", "🧑 ⚽️ 🧑 ", "🧑 ⚽️ 🧑 ", "🧑 ⚽️ 🧑 ", "🧑 ⚽️ 🧑 ", "🧑 ⚽️🧑 ", "🧑 ⚽️ 🧑 ", "🧑 ⚽️ 🧑 ", "🧑 ⚽️ 🧑 ", "🧑 ⚽️ 🧑 ", "🧑 ⚽️ 🧑 "] }, Vn = { interval: 160, frames: ["😐 ", "😐 ", "😮 ", "😮 ", "😦 ", "😦 ", "😧 ", "😧 ", "🤯 ", "💥 ", "✨ ", "  ", "  ", "  "] }, Sn = { interval: 160, frames: ["🔈 ", "🔉 ", "🔊 ", "🔉 "] }, Fn = { interval: 100, frames: ["🔸 ", "🔶 ", "🟠 ", "🟠 ", "🔶 "] }, Rn = { interval: 100, frames: ["🔹 ", "🔷 ", "🔵 ", "🔵 ", "🔷 "] }, Bn = { interval: 100, frames: ["🔸 ", "🔶 ", "🟠 ", "🟠 ", "🔶 ", "🔹 ", "🔷 ", "🔵 ", "🔵 ", "🔷 "] }, Dn = { interval: 100, frames: ["🕛 ", "🕚 ", "🕙 ", "🕘 ", "🕗 ", "🕖 ", "🕕 ", "🕔 ", "🕓 ", "🕒 ", "🕑 ", "🕐 "] }, On = { interval: 80, frames: ["▰▱▱▱▱▱▱", "▰▰▱▱▱▱▱", "▰▰▰▱▱▱▱", "▰▰▰▰▱▱▱", "▰▰▰▰▰▱▱", "▰▰▰▰▰▰▱", "▰▰▰▰▰▰▰", "▰▱▱▱▱▱▱"] }, Pn = { interval: 80, frames: [" ██████£££ ", "☺██████£££ ", "☺██████£££ ", "☺▓█████£££ ", "☺▓█████£££ ", "☺▒█████£££ ", "☺▒█████£££ ", "☺░█████£££ ", "☺░█████£££ ", "☺ █████£££ ", " ☺█████£££ ", " ☺█████£££ ", " ☺▓████£££ ", " ☺▓████£££ ", " ☺▒████£££ ", " ☺▒████£££ ", " ☺░████£££ ", " ☺░████£££ ", " ☺ ████£££ ", " ☺████£££ ", " ☺████£££ ", " ☺▓███£££ ", " ☺▓███£££ ", " ☺▒███£££ ", " ☺▒███£££ ", " ☺░███£££ ", " ☺░███£££ ", " ☺ ███£££ ", " ☺███£££ ", " ☺███£££ ", " ☺▓██£££ ", " ☺▓██£££ ", " ☺▒██£££ ", " ☺▒██£££ ", " ☺░██£££ ", " ☺░██£££ ", " ☺ ██£££ ", " ☺██£££ ", " ☺██£££ ", " ☺▓█£££ ", " ☺▓█£££ ", " ☺▒█£££ ", " ☺▒█£££ ", " ☺░█£££ ", " ☺░█£££ ", " ☺ █£££ ", " ☺█£££ ", " ☺█£££ ", " ☺▓£££ ", " ☺▓£££ ", " ☺▒£££ ", " ☺▒£££ ", " ☺░£££ ", " ☺░£££ ", " ☺ £££ ", " ☺£££ ", " ☺£££ ", " ☺▓££ ", " ☺▓££ ", " ☺▒££ ", " ☺▒££ ", " ☺░££ ", " ☺░££ ", " ☺ ££ ", " ☺££ ", " ☺££ ", " ☺▓£ ", " ☺▓£ ", " ☺▒£ ", " ☺▒£ ", " ☺░£ ", " ☺░£ ", " ☺ £ ", " ☺£ ", " ☺£ ", " ☺▓ ", " ☺▓ ", " ☺▒ ", " ☺▒ ", " ☺░ ", " ☺░ ", " ☺ ", " ☺ &", " ☺ ☼&", " ☺ ☼ &", " ☺☼ &", " ☺☼ & ", " ‼ & ", " ☺ & ", " ‼ & ", " ☺ & ", " ‼ & ", " ☺ & ", "‼ & ", " & ", " & ", " & ░ ", " & ▒ ", " & ▓ ", " & £ ", " & ░£ ", " & ▒£ ", " & ▓£ ", " & ££ ", " & ░££ ", " & ▒££ ", "& ▓££ ", "& £££ ", " ░£££ ", " ▒£££ ", " ▓£££ ", " █£££ ", " ░█£££ ", " ▒█£££ ", " ▓█£££ ", " ██£££ ", " ░██£££ ", " ▒██£££ ", " ▓██£££ ", " ███£££ ", " ░███£££ ", " ▒███£££ ", " ▓███£££ ", " ████£££ ", " ░████£££ ", " ▒████£££ ", " ▓████£££ ", " █████£££ ", " ░█████£££ ", " ▒█████£££ ", " ▓█████£££ ", " ██████£££ ", " ██████£££ "] }, qn = {
64
+ dots: te,
65
+ dots2: ie,
66
+ dots3: oe,
67
+ dots4: le,
68
+ dots5: ce,
69
+ dots6: ae,
70
+ dots7: ue,
71
+ dots8: _e,
72
+ dots9: fe,
73
+ dots10: me,
74
+ dots11: de,
75
+ dots12: ve,
76
+ dots13: Le,
77
+ dots8Bit: he,
78
+ sand: ge,
79
+ line: pe,
80
+ line2: we,
81
+ pipe: Ce,
82
+ simpleDots: be,
83
+ simpleDotsScrolling: xe,
84
+ star: Me,
85
+ star2: Ie,
86
+ flip: je,
87
+ hamburger: Ae,
88
+ growVertical: Ee,
89
+ growHorizontal: Ve,
90
+ balloon: Se,
91
+ balloon2: Fe,
92
+ noise: Re,
93
+ bounce: Be,
94
+ boxBounce: De,
95
+ boxBounce2: Oe,
96
+ triangle: Pe,
97
+ binary: qe,
98
+ arc: Ne,
99
+ circle: Te,
100
+ squareCorners: He,
101
+ circleQuarters: Ue,
102
+ circleHalves: We,
103
+ squish: $e,
104
+ toggle: Ke,
105
+ toggle2: ze,
106
+ toggle3: Ye,
107
+ toggle4: Qe,
108
+ toggle5: Ze,
109
+ toggle6: Ge,
110
+ toggle7: Je,
111
+ toggle8: Xe,
112
+ toggle9: ye,
113
+ toggle10: ke,
114
+ toggle11: en,
115
+ toggle12: nn,
116
+ toggle13: rn,
117
+ arrow: sn,
118
+ arrow2: tn,
119
+ arrow3: on,
120
+ bouncingBar: ln,
121
+ bouncingBall: cn,
122
+ smiley: an,
123
+ monkey: un,
124
+ hearts: _n,
125
+ clock: fn,
126
+ earth: mn,
127
+ material: dn,
128
+ moon: vn,
129
+ runner: Ln,
130
+ pong: hn,
131
+ shark: gn,
132
+ dqpb: pn,
133
+ weather: wn,
134
+ christmas: Cn,
135
+ grenade: bn,
136
+ point: xn,
137
+ layer: Mn,
138
+ betaWave: In,
139
+ fingerDance: jn,
140
+ fistBump: An,
141
+ soccerHeader: En,
142
+ mindblown: Vn,
143
+ speaker: Sn,
144
+ orangePulse: Fn,
145
+ bluePulse: Rn,
146
+ orangeBluePulse: Bn,
147
+ timeTravel: Dn,
148
+ aesthetic: On,
149
+ dwarfFortress: Pn
150
+ };
151
+ var W, z;
152
+ function Nn() {
153
+ if (z) return W;
154
+ z = 1;
155
+ const n = Object.assign({}, qn), r = Object.keys(n);
156
+ return Object.defineProperty(n, "random", {
157
+ get() {
158
+ const c = Math.floor(Math.random() * r.length), t = r[c];
159
+ return n[t];
160
+ }
161
+ }), W = n, W;
162
+ }
163
+ var Tn = Nn();
164
+ const Hn = /* @__PURE__ */ ee(Tn);
165
+ function er({ type: n = "dots" }) {
166
+ const [r, c] = m.useState(0), t = Hn[n];
167
+ return m.useEffect(() => {
168
+ const s = setInterval(() => {
169
+ c((u) => u === t.frames.length - 1 ? 0 : u + 1);
170
+ }, t.interval);
171
+ return () => {
172
+ clearInterval(s);
173
+ };
174
+ }, [t]), y.createElement(D, null, t.frames[r]);
175
+ }
176
+ const Un = async () => {
177
+ if (!process.env.ANTHROPIC_API_KEY) return [];
178
+ let n = [];
179
+ for await (const r of new re().beta.models.list())
180
+ n.push({
181
+ id: r.id,
182
+ name: r.display_name,
183
+ provider: "anthropic"
184
+ });
185
+ return n;
186
+ }, Wn = async () => process.env.OPENAI_API_KEY ? new ne().models.list().then(
187
+ (n) => n.data.map((r) => ({
188
+ id: r.id,
189
+ name: r.id,
190
+ provider: "openai"
191
+ })).sort((r, c) => r.id.localeCompare(c.id))
192
+ ) : [], nr = async () => Promise.all([
193
+ Un().catch((n) => (console.log(n), [])),
194
+ Wn().catch((n) => (console.log(n), []))
195
+ ]).then((n) => n.flat());
196
+ function $(n) {
197
+ if (n.length === 0)
198
+ return [""];
199
+ const r = n.replace(/\r\n/g, `
200
+ `).replace(/\r/g, `
201
+ `), c = r.split(`
202
+ `);
203
+ return r.endsWith(`
204
+ `) && c.push(""), c;
205
+ }
206
+ function B(n) {
207
+ return n.join(`
208
+ `);
209
+ }
210
+ function $n(n, r, c) {
211
+ const t = Math.max(0, r), s = Math.min(n, t + c);
212
+ return { start: t, end: s };
213
+ }
214
+ function N(n, r, c, t) {
215
+ if (n < r)
216
+ return n;
217
+ const s = r + c - 1;
218
+ return n > s ? Math.max(0, n - c + 1) : r;
219
+ }
220
+ function K(n, r, c) {
221
+ const t = Math.max(0, Math.min(r, n.length - 1)), s = Math.max(
222
+ 0,
223
+ Math.min(c, n[t].length)
224
+ );
225
+ return {
226
+ line: t,
227
+ column: s
228
+ };
229
+ }
230
+ function U(n, r, c) {
231
+ const t = n.length;
232
+ if (c === -1) {
233
+ if (r === 0) return 0;
234
+ let s = r - 1;
235
+ for (; s > 0 && /\s/.test(n[s]); )
236
+ s--;
237
+ for (; s > 0 && !/\s/.test(n[s]); )
238
+ s--;
239
+ return s > 0 || s === 0 && !/\s/.test(n[0]) ? s : 0;
240
+ } else {
241
+ if (r >= t) return t;
242
+ let s = r;
243
+ for (; s < t && !/\s/.test(n[s]); )
244
+ s++;
245
+ for (; s < t && /\s/.test(n[s]); )
246
+ s++;
247
+ return s;
248
+ }
249
+ }
250
+ const Kn = m.memo(function({
251
+ content: r,
252
+ lineNumber: c,
253
+ showCursor: t,
254
+ cursorColumn: s,
255
+ isFocused: u
256
+ }) {
257
+ const h = m.useMemo(() => {
258
+ if (!t || !u)
259
+ return r;
260
+ const I = Array.from(r);
261
+ let a = "", p = 0;
262
+ for (const v of I)
263
+ p === s ? a += T.inverse(v || " ") : a += v, p++;
264
+ return s >= I.length && (a += T.inverse(" ")), a;
265
+ }, [r, t, s, u]);
266
+ return /* @__PURE__ */ b.jsx(D, { children: h });
267
+ });
268
+ function rr({
269
+ id: n,
270
+ placeholder: r = "",
271
+ autoFocus: c = !0,
272
+ showCursor: t = !0,
273
+ value: s,
274
+ onChange: u,
275
+ onSubmit: h,
276
+ onHotKey: I,
277
+ disabled: a = !1,
278
+ maxVisibleLines: p,
279
+ enableVirtualScroll: v = !0
280
+ }) {
281
+ const { isFocused: w } = Q({ autoFocus: c, id: n }), j = m.useRef(!1), x = m.useRef(s), [e, g] = m.useState(() => {
282
+ const _ = $(s);
283
+ return {
284
+ lines: _,
285
+ cursorLine: _.length - 1,
286
+ cursorColumn: _[_.length - 1].length,
287
+ firstVisibleLine: 0
288
+ };
289
+ });
290
+ m.useEffect(() => {
291
+ if (j.current) {
292
+ j.current = !1, x.current = s;
293
+ return;
294
+ }
295
+ s !== x.current && (g((_) => {
296
+ const l = $(s), o = B(l), f = B(_.lines);
297
+ if (o === f)
298
+ return _;
299
+ const i = K(l, _.cursorLine, _.cursorColumn);
300
+ return {
301
+ ..._,
302
+ lines: l,
303
+ ...i
304
+ };
305
+ }), x.current = s);
306
+ }, [s]);
307
+ const E = m.useMemo(() => p || Math.min(10, e.lines.length), [p, e.lines.length]), { start: P, end: H } = m.useMemo(
308
+ () => $n(e.lines.length, e.firstVisibleLine, E),
309
+ [e.lines.length, e.firstVisibleLine, E]
310
+ ), A = m.useCallback(
311
+ (_, l) => {
312
+ const o = K(e.lines, _, l), f = N(
313
+ o.line,
314
+ e.firstVisibleLine,
315
+ E,
316
+ e.lines.length
317
+ );
318
+ g({
319
+ ...e,
320
+ cursorLine: o.line,
321
+ cursorColumn: o.column,
322
+ firstVisibleLine: f
323
+ });
324
+ },
325
+ [e, E]
326
+ ), d = m.useCallback(
327
+ (_) => {
328
+ const l = B(_);
329
+ j.current = !0, u?.(l);
330
+ },
331
+ [u]
332
+ );
333
+ k((_, l) => {
334
+ if (!(a || !w) && !(I && !I(_, l)) && !(l.ctrl && _ === "c" || l.tab || l.shift && l.tab)) {
335
+ if (l.return) {
336
+ if (!l.ctrl && !l.alt) {
337
+ h?.(B(e.lines));
338
+ return;
339
+ }
340
+ const o = e.lines[e.cursorLine], f = o.slice(0, e.cursorColumn), i = o.slice(e.cursorColumn), L = [...e.lines];
341
+ L[e.cursorLine] = f, L.splice(e.cursorLine + 1, 0, i), g({
342
+ lines: L,
343
+ cursorLine: e.cursorLine + 1,
344
+ cursorColumn: 0,
345
+ firstVisibleLine: N(
346
+ e.cursorLine + 1,
347
+ e.firstVisibleLine,
348
+ E,
349
+ L.length
350
+ )
351
+ }), d(L);
352
+ return;
353
+ }
354
+ if (l.leftArrow) {
355
+ if (!t) return;
356
+ if (l.ctrl || l.alt) {
357
+ const o = e.lines[e.cursorLine], f = U(o, e.cursorColumn, -1);
358
+ A(e.cursorLine, f);
359
+ } else if (e.cursorColumn > 0)
360
+ A(e.cursorLine, e.cursorColumn - 1);
361
+ else if (e.cursorLine > 0) {
362
+ const o = e.lines[e.cursorLine - 1].length;
363
+ A(e.cursorLine - 1, o);
364
+ }
365
+ return;
366
+ }
367
+ if (l.rightArrow) {
368
+ if (!t) return;
369
+ if (l.ctrl || l.alt) {
370
+ const o = e.lines[e.cursorLine], f = U(o, e.cursorColumn, 1);
371
+ A(e.cursorLine, f);
372
+ } else e.cursorColumn < e.lines[e.cursorLine].length ? A(e.cursorLine, e.cursorColumn + 1) : e.cursorLine < e.lines.length - 1 && A(e.cursorLine + 1, 0);
373
+ return;
374
+ }
375
+ if (l.upArrow) {
376
+ if (!t) return;
377
+ l.alt || l.ctrl ? A(e.cursorLine, 0) : A(e.cursorLine - 1, e.cursorColumn);
378
+ return;
379
+ }
380
+ if (l.downArrow) {
381
+ if (!t) return;
382
+ l.alt || l.ctrl ? A(e.cursorLine, e.lines[e.cursorLine].length) : A(e.cursorLine + 1, e.cursorColumn);
383
+ return;
384
+ }
385
+ if (l.ctrl && _ === "a" || l.alt && l.leftArrow) {
386
+ if (!t) return;
387
+ A(e.cursorLine, 0);
388
+ return;
389
+ }
390
+ if (l.ctrl && _ === "e" || l.alt && l.rightArrow) {
391
+ if (!t) return;
392
+ A(e.cursorLine, e.lines[e.cursorLine].length);
393
+ return;
394
+ }
395
+ if (l.backspace) {
396
+ const o = K(e.lines, e.cursorLine, e.cursorColumn), f = o.column !== e.cursorColumn || o.line !== e.cursorLine, i = o.line, L = o.column;
397
+ if (l.ctrl || l.alt) {
398
+ const M = e.lines[i];
399
+ if (L > 0) {
400
+ const S = U(M, L, -1);
401
+ if (S < L) {
402
+ const C = M.slice(0, S) + M.slice(L), F = [...e.lines];
403
+ F[i] = C;
404
+ const q = B(F);
405
+ g({
406
+ ...e,
407
+ lines: F,
408
+ cursorLine: f ? i : e.cursorLine,
409
+ cursorColumn: S
410
+ }), j.current = !0, u?.(q);
411
+ }
412
+ } else if (i > 0) {
413
+ const S = e.lines[i - 1], C = [...e.lines];
414
+ C[i - 1] = S + M, C.splice(i, 1);
415
+ const F = B(C);
416
+ g({
417
+ lines: C,
418
+ cursorLine: i - 1,
419
+ cursorColumn: S.length,
420
+ firstVisibleLine: N(
421
+ i - 1,
422
+ e.firstVisibleLine,
423
+ E,
424
+ C.length
425
+ )
426
+ }), j.current = !0, u?.(F);
427
+ }
428
+ } else if (L > 0) {
429
+ const M = e.lines[i], S = M.slice(0, L - 1) + M.slice(L), C = [...e.lines];
430
+ C[i] = S;
431
+ const F = B(C);
432
+ g({
433
+ ...e,
434
+ lines: C,
435
+ cursorLine: f ? i : e.cursorLine,
436
+ cursorColumn: L - 1
437
+ }), j.current = !0, u?.(F);
438
+ } else if (i > 0) {
439
+ const M = e.lines[i - 1], S = e.lines[i], C = [...e.lines];
440
+ C[i - 1] = M + S, C.splice(i, 1);
441
+ const F = N(
442
+ i - 1,
443
+ e.firstVisibleLine,
444
+ E,
445
+ C.length
446
+ ), q = B(C);
447
+ g({
448
+ lines: C,
449
+ cursorLine: i - 1,
450
+ cursorColumn: M.length,
451
+ firstVisibleLine: F
452
+ }), j.current = !0, u?.(q);
453
+ }
454
+ return;
455
+ }
456
+ if (l.delete) {
457
+ const o = e.lines[e.cursorLine];
458
+ if (l.ctrl || l.alt) {
459
+ if (e.cursorColumn < o.length) {
460
+ const f = U(o, e.cursorColumn, 1);
461
+ if (f > e.cursorColumn) {
462
+ const i = o.slice(0, e.cursorColumn) + o.slice(f), L = [...e.lines];
463
+ L[e.cursorLine] = i, g({
464
+ ...e,
465
+ lines: L
466
+ }), d(L);
467
+ }
468
+ } else if (e.cursorLine < e.lines.length - 1) {
469
+ const f = e.lines[e.cursorLine + 1], i = [...e.lines];
470
+ i[e.cursorLine] = o + f, i.splice(e.cursorLine + 1, 1), g({
471
+ ...e,
472
+ lines: i
473
+ }), d(i);
474
+ }
475
+ } else if (e.cursorColumn < o.length) {
476
+ const f = o.slice(0, e.cursorColumn) + o.slice(e.cursorColumn + 1), i = [...e.lines];
477
+ i[e.cursorLine] = f, g({
478
+ ...e,
479
+ lines: i
480
+ }), d(i);
481
+ } else if (e.cursorLine < e.lines.length - 1) {
482
+ const f = e.lines[e.cursorLine + 1], i = [...e.lines];
483
+ i[e.cursorLine] = o + f, i.splice(e.cursorLine + 1, 1), g({
484
+ ...e,
485
+ lines: i
486
+ }), d(i);
487
+ }
488
+ return;
489
+ }
490
+ if (_)
491
+ if (_.includes(`
492
+ `)) {
493
+ const o = $(_);
494
+ if (o.length === 1) {
495
+ const f = e.lines[e.cursorLine], i = f.slice(0, e.cursorColumn) + _ + f.slice(e.cursorColumn), L = [...e.lines];
496
+ L[e.cursorLine] = i, g({
497
+ ...e,
498
+ lines: L,
499
+ cursorColumn: e.cursorColumn + _.length
500
+ }), d(L);
501
+ } else {
502
+ const f = e.lines[e.cursorLine], i = f.slice(0, e.cursorColumn), L = f.slice(e.cursorColumn), M = [...e.lines];
503
+ M[e.cursorLine] = i + o[0];
504
+ const S = o.slice(1, -1);
505
+ M.splice(e.cursorLine + 1, 0, ...S);
506
+ const C = o[o.length - 1] + L;
507
+ M.splice(e.cursorLine + S.length + 1, 0, C);
508
+ const F = e.cursorLine + o.length - 1, q = o[o.length - 1].length;
509
+ g({
510
+ lines: M,
511
+ cursorLine: F,
512
+ cursorColumn: q,
513
+ firstVisibleLine: N(
514
+ F,
515
+ e.firstVisibleLine,
516
+ E,
517
+ M.length
518
+ )
519
+ }), d(M);
520
+ }
521
+ } else {
522
+ const o = e.lines[e.cursorLine], f = o.slice(0, e.cursorColumn) + _ + o.slice(e.cursorColumn), i = [...e.lines];
523
+ i[e.cursorLine] = f, g({
524
+ ...e,
525
+ lines: i,
526
+ cursorColumn: e.cursorColumn + _.length
527
+ }), d(i);
528
+ }
529
+ }
530
+ });
531
+ const V = m.useMemo(() => e.lines.slice(P, H), [e.lines, P, H]);
532
+ return e.lines.length === 0 || e.lines.every((_) => _.length === 0) ? !w || !t ? /* @__PURE__ */ b.jsx(D, { children: T.grey(r) }) : /* @__PURE__ */ b.jsx(D, { children: T.inverse(r[0] || " ") + T.grey(r.slice(1)) }) : /* @__PURE__ */ b.jsx(O, { flexDirection: "column", children: V.map((_, l) => {
533
+ const o = P + l;
534
+ return /* @__PURE__ */ b.jsx(
535
+ Kn,
536
+ {
537
+ content: _,
538
+ lineNumber: o,
539
+ showCursor: t && o === e.cursorLine,
540
+ cursorColumn: e.cursorColumn,
541
+ isFocused: w
542
+ },
543
+ o
544
+ );
545
+ }) });
546
+ }
547
+ const zn = (n, r, c) => {
548
+ const t = parseInt(n.slice(1, 3), 16), s = parseInt(n.slice(3, 5), 16), u = parseInt(n.slice(5, 7), 16), h = parseInt(r.slice(1, 3), 16), I = parseInt(r.slice(3, 5), 16), a = parseInt(r.slice(5, 7), 16), p = Math.round(t + c * (h - t)), v = Math.round(s + c * (I - s)), w = Math.round(u + c * (a - u));
549
+ return `#${((1 << 24) + (p << 16) + (v << 8) + w).toString(16).slice(1).toUpperCase()}`;
550
+ }, sr = ({
551
+ text: n,
552
+ highlightColor: r = "#00FFFF",
553
+ // Cyan
554
+ baseColor: c = "#003333",
555
+ // Dark Cyan
556
+ interval: t = 20,
557
+ spread: s = 32,
558
+ globalIndex: u
559
+ }) => {
560
+ const [h, I] = m.useState(0), a = u !== void 0 ? u : h;
561
+ return m.useEffect(() => {
562
+ if (u !== void 0) return;
563
+ const p = setInterval(() => {
564
+ I((v) => (v + 1) % (n.length + s * 2));
565
+ }, t);
566
+ return () => clearInterval(p);
567
+ }, [n.length, s, t, u]), /* @__PURE__ */ b.jsx(D, { children: n.split("").map((p, v) => {
568
+ const w = a - s, j = Math.abs(v - w);
569
+ let x = c, e = !1;
570
+ if (j < s) {
571
+ const g = Math.cos(j / s * (Math.PI / 2)), E = Math.pow(g, 2);
572
+ x = zn(c, r, E), e = j < 1;
573
+ }
574
+ return /* @__PURE__ */ b.jsx(D, { color: x, bold: e, children: p }, v);
575
+ }) });
576
+ }, Yn = ({ option: n, isSelected: r, isHighlighted: c, isFocused: t, isComponentDisabled: s }) => {
577
+ const u = !t || s;
578
+ let h = "white";
579
+ return n.disabled ? h = "gray" : r ? h = t ? "green" : "gray" : c && t ? h = "cyan" : u && (h = "gray"), /* @__PURE__ */ b.jsx(O, { children: /* @__PURE__ */ b.jsxs(D, { color: h, children: [
580
+ r ? "◉ " : "○ ",
581
+ n.label
582
+ ] }) });
583
+ }, Qn = ({ isSelected: n }) => /* @__PURE__ */ b.jsx(D, { color: n ? "green" : "gray", children: n ? "◉" : "○" }), Zn = ({ values: n }) => /* @__PURE__ */ b.jsx(b.Fragment, {}), tr = ({
584
+ options: n,
585
+ values: r,
586
+ defaultValues: c = [],
587
+ onChange: t,
588
+ onSubmit: s,
589
+ disabled: u = !1,
590
+ highlightText: h,
591
+ itemComponent: I = Yn,
592
+ indicatorComponent: a = Qn,
593
+ statusComponent: p = Zn,
594
+ autoFocus: v = !0,
595
+ singleSelect: w = !1
596
+ }) => {
597
+ const { isFocused: j } = Q({ autoFocus: v }), [x, e] = m.useState(r || c), [g, E] = m.useState(0);
598
+ m.useEffect(() => {
599
+ r !== void 0 && e(r);
600
+ }, [r]);
601
+ const P = m.useCallback(
602
+ (d) => {
603
+ if (u || n[d].disabled) return;
604
+ const V = n[d];
605
+ let R;
606
+ w ? R = x.includes(V.value) ? [] : [V.value] : R = x.includes(V.value) ? x.filter((_) => _ !== V.value) : [...x, V.value], e(R), t?.(R);
607
+ },
608
+ [x, n, u, t, w]
609
+ ), H = m.useCallback(() => {
610
+ if (!u) {
611
+ if (x.length === 0 && n.length > 0) {
612
+ const d = n[g];
613
+ if (d && !d.disabled) {
614
+ t?.([d.value]), s?.([d.value]);
615
+ return;
616
+ }
617
+ }
618
+ s?.(x);
619
+ }
620
+ }, [x, u, s, n, g]);
621
+ se((d, V) => {
622
+ !j || u || (V.upArrow ? E((R) => Math.max(0, R - 1)) : V.downArrow ? E((R) => Math.min(n.length - 1, R + 1)) : V.return ? H() : d === " " && P(g));
623
+ });
624
+ const A = h ? n.filter(
625
+ (d) => d.label.toLowerCase().includes(h.toLowerCase()) || d.value.toLowerCase().includes(h.toLowerCase())
626
+ ) : n;
627
+ return /* @__PURE__ */ b.jsxs(O, { flexDirection: "column", children: [
628
+ /* @__PURE__ */ b.jsx(O, { marginBottom: 1, children: /* @__PURE__ */ b.jsx(p, { values: x }) }),
629
+ /* @__PURE__ */ b.jsx(O, { flexDirection: "column", children: A.map((d, V) => {
630
+ const R = x.includes(d.value), _ = V === g;
631
+ return /* @__PURE__ */ b.jsx(O, { children: /* @__PURE__ */ b.jsx(
632
+ I,
633
+ {
634
+ option: d,
635
+ isSelected: R,
636
+ isHighlighted: _,
637
+ isFocused: j,
638
+ isComponentDisabled: u
639
+ }
640
+ ) }, d.value);
641
+ }) })
642
+ ] });
643
+ };
644
+ export {
645
+ tr as M,
646
+ sr as S,
647
+ rr as a,
648
+ er as b,
649
+ nr as g,
650
+ se as u
651
+ };