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