tweakcc 1.6.0 → 2.0.1

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.
Files changed (3) hide show
  1. package/README.md +35 -7
  2. package/dist/index.js +196 -20
  3. package/package.json +5 -1
package/README.md CHANGED
@@ -4,33 +4,39 @@
4
4
  [![Mentioned in Awesome Claude Code](https://awesome.re/mentioned-badge.svg)](https://github.com/hesreallyhim/awesome-claude-code)
5
5
  [![ClaudeLog - A comprehensive knowledge base for Claude.](https://claudelog.com/img/claude_log_badge.svg)](https://claudelog.com/)
6
6
 
7
- `tweakcc` is a lightweight, interactive CLI tool that lets you personalize your Claude Code interface.
7
+ `tweakcc` is a lightweight, interactive CLI tool that lets you personalize your Claude Code experience.
8
8
 
9
+ > [!important]
10
+ > **NEW in 2.0.0:** tweakcc can now customize all of Claude Code's system prompts!
11
+
12
+ <!--
9
13
  > [!note]
10
14
  > ⭐ **If you find tweakcc useful, please consider [starring the repository](https://github.com/Piebald-AI/tweakcc) to show your support!** ⭐
15
+ -->
11
16
 
12
17
  <img src="./assets/demo.gif" alt="Animated GIF demonstrating running `npx tweakcc`, creating a new theme, changing all of Claude Code's UI colors to purple, changing the thinking format from '<verb>ing...' to 'Claude is <verb>ing', changing the generating spinner style to a 50m glow animation, applying the changes, running Claude, and using '/config' to switch to the new theme, and sending a message to see the new thinking verb format." width="800">
13
18
 
14
19
  With tweakcc, you can
15
20
 
21
+ - Customize all of Claude Code's **system prompts**
16
22
  - Create **custom themes** with a graphical HSL/RGB color picker
17
23
  - Add custom **thinking verbs** that will show while Claude's working
18
24
  - Create custom **thinking spinner animations** with different speeds and phases
19
25
  - Change the "CLAUDE CODE" banner text to your own text with your own [figlet](http://www.figlet.org/) fonts
20
- - Supports Claude Code installed on **Windows, macOS, and Linux**, using npm, yarn, pnpm, bun, Homebrew, nvm, fnm, n, volta, nvs, and nodenv, or a custom location
21
26
  - Style the **user messages in the chat history** beyond the default plain gray text
22
27
  - Remove the **ASCII border** from the input box
23
28
 
24
29
  tweakcc also
25
- - Restores the **token counter** and **elapsed time metric** that were shown during generation before Claude Code 1.0.83
26
30
  - Fixes a bug where the **spinner animation** is frozen if you have the `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` environment variable set ([#46](https://github.com/Piebald-AI/tweakcc/issues/46))
27
- - Allows you to **change the context limit** used with models from custom Anthropic-compatible APIs with a new environment variable, `CLAUDE_CODE_CONTEXT_LIMIT`
31
+ - Allows you to **change the context limit** (default: 200k tokens) used with models from custom Anthropic-compatible APIs with a new environment variable, `CLAUDE_CODE_CONTEXT_LIMIT`
28
32
 
29
33
  Additionally, we're working on features that will allow you to
30
34
  - Pick from over **70+ spinning/thinking animations** from [`cli-spinners`](https://github.com/sindresorhus/cli-spinners)
31
35
  - Apply **custom styling** to the markdown elements in Claude's responses like code, bold, headers, etc
32
36
  - Customize the **shimmering effect** on the thinking verb: disable it; change its speed, width, and colors
33
37
 
38
+ tweakcc supports Claude Code installed on **Windows, macOS, and Linux**, using npm, yarn, pnpm, bun, Homebrew, nvm, fnm, n, volta, nvs, and nodenv, or a custom location. (Note: it does **not** support native installations yet; see [#29](https://github.com/Piebald-AI/tweakcc/issues/29).)
39
+
34
40
  Run without installation:
35
41
 
36
42
  ```bash
@@ -42,13 +48,21 @@ $ pnpm dlx tweakcc
42
48
 
43
49
  ## How it works
44
50
 
45
- `tweakcc` works by patching the Claude Code's minified `cli.js` file. When you update your Claude Code installation, your customizations will be overwritten, but they're remembered in your `~/.tweakcc/config.js` configuration file, so they can be reapplied by just rerunning the tool.
51
+ `tweakcc` works by patching the Claude Code's minified `cli.js` file. When you update your Claude Code installation, your customizations will be overwritten, but they're remembered in your configuration file, so they can be reapplied by just re-running the tool.
52
+
53
+ ### Configuration directory
54
+
55
+ `tweakcc` stores its configuration files in one of the following locations, in order of priority:
46
56
 
47
- `tweakcc` is verified to work with Claude Code **1.0.128.**
57
+ 1. **`~/.tweakcc/`** - If this directory already exists, it will always be used for backward compatibility; or if `XDG_CONFIG_HOME` is not set
58
+ 2. **`$XDG_CONFIG_HOME/tweakcc`** - If `~/.tweakcc/` doesn't exist and `$XDG_CONFIG_HOME` is set
59
+
60
+
61
+ `tweakcc` is verified to work with Claude Code **2.0.25.**
48
62
 
49
63
  ## Running
50
64
 
51
- Run with installing it with `npx tweakcc`. Or build and run it locally:
65
+ You can use tweakcc by running `npx tweakcc`, or `npm install -g tweakcc` and then `tweakcc`. Or build and run it locally:
52
66
 
53
67
  ```bash
54
68
  git clone https://github.com/Piebald-AI/tweakcc.git
@@ -65,8 +79,22 @@ node dist/index.js
65
79
  - [**CCometixLine**](https://github.com/Haleclipse/CCometixLine) - A high-performance Claude Code statusline tool written in Rust with Git integration, usage tracking, interactive TUI configuration, and Claude Code enhancement utilities.
66
80
  - [**cc-statuslines**](https://github.com/chongdashu/cc-statusline) - Transform your Claude Code experience with a beautiful, informative statusline. One command. Three questions. Custom statusline.
67
81
 
82
+ ## Troubleshooting
83
+
84
+ tweakcc stores a backup of your Claude Code `cli.js` file for when you want to revert your customimzations, and also to reapply patches. Before it applies your customizations, it restores the original `cli.js` so that it can start from a clean slate. Sometimes things can get confused and your `cli.js` can be corrupted. In particular, you may run into a situation where you have a modified `cli.js`, and then tweakcc takes makes a backup of that modified `cli.js`. If you then try to reinstall Claude Code and apply your customizations, tweakcc will restore its backup of the old _modified_ `cli.js`.
85
+
86
+ To break out of this loop you can install a different version of Claude Code, which will cause tweakcc to make a new backup of the new `cli.js` file. Or you can simply delete tweakcc's backup file (located at `~/.tweakcc/cli.backup.js` or `$XDG_CONFIG_HOME/tweakcc/cli.backup.js`). If you do delete `cli.backup.js`, make sure you reinstall Claude Code before you run tweakcc again, or else if `cli.js` is the modified version it, will again get into the loop described above.
87
+
88
+ ### System prompts
89
+
90
+ tweakcc tracks changes to your system prompt markdown files in its config directory (see [Configuration directory](#configuration-directory) above). It stores tracking data in `systemPromptAppliedHashes.json` and caches the hashes of the original system prompt text in `systemPromptOriginalHashes.json`. If you'd like to reset your system prompt markdown files to their original values, you can delete those JSON files and the `system-prompts` directory in your config directory. Running `npx tweakcc` will then generate new markdown files.
91
+
68
92
  ## FAQ
69
93
 
94
+ #### How can I customize my Claude Code system prompts?
95
+
96
+ Run `npx tweakcc` first, and then navigate to the `system-prompts` directory in your config directory (see [Configuration directory](#configuration-directory)), which will have just been created, in your file browser. Each markdown file contains parts of prompts, such as the main system prompt, built-in tool descriptions, and various agent and utility prompts. Modify any of them, and then run `tweakcc --apply` or the tweakcc UI to apply your changes.
97
+
70
98
  #### How can I customize my Claude Code theme?
71
99
 
72
100
  Run `npx tweakcc`, go to `Themes`, and modify existing themes or create a new one. Then go back to the main menu and choose `Apply customizations to cli.js`.
package/dist/index.js CHANGED
@@ -1,8 +1,182 @@
1
1
  #!/usr/bin/env node
2
- import{Box as d,Text as i,render as ir,useInput as ae,useStdout as sr}from"ink";import{Command as lr}from"commander";import $e,{Fragment as be,createContext as ar,useCallback as Je,useContext as ge,useEffect as ie,useState as M}from"react";import cr from"ink-link";import{Fragment as se,jsx as o,jsxs as a}from"react/jsx-runtime";import*as fe from"node:path";import Ge from"node:path";import*as me from"node:os";import{globbySync as dr}from"globby";import gr from"node:process";import*as Ce from"node:fs";import*as Se from"node:fs/promises";import he from"node:fs/promises";import*as Ne from"node:child_process";import*as hr from"node:crypto";import De from"figlet";import ur from"chalk";function mr({items:e,selectedIndex:t,onSelect:r,onSubmit:n}){return ae((s,l)=>{l.upArrow?r(t>0?t-1:e.length-1):l.downArrow?r(t<e.length-1?t+1:0):l.return&&n(e[t].name)}),o(d,{flexDirection:"column",children:e.map((s,l)=>o(d,{children:a(i,{children:[a(i,{bold:l===t,color:l===t?"cyan":void 0,...l===t?s.selectedStyles??{}:s.styles??{},children:[l===t?"❯ ":" ",s.name]}),s.desc&&l===t&&a(i,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",s.desc]})]})},l))})}let z=function(e){return e.THEMES="Themes",e.LAUNCH_TEXT="Launch text",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.INPUT_BOX="Input box",e.APPLY_CHANGES="*Apply customizations to cli.js",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",e.OPEN_CONFIG="Open tweakcc.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const J={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}}],launchText:{method:"figlet",figletText:"Claude Code",figletFont:"ANSI Shadow",customText:""},thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:{}.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1}},Le=fe.join(me.homedir(),".tweakcc"),le=fe.join(Le,"config.json"),pe=fe.join(Le,"cli.js.backup"),fr=()=>{const e=[],t=process.platform=="win32"?me.homedir().replace(/\\/g,"/"):me.homedir(),r="node_modules/@anthropic-ai/claude-code",n=(s,l=!1)=>{if(l){const c=dr(s,{onlyFiles:!1});e.push({pattern:s,isGlob:!0,expandedPaths:c})}else e.push({pattern:s,isGlob:!1,expandedPaths:[s]})};return n(`${me.homedir()}/.claude/local/${r}`),{}.NPM_PREFIX&&n(`${{}.NPM_PREFIX}/lib/${r}`),{}.N_PREFIX&&n(`${{}.N_PREFIX}/lib/${r}`),{}.VOLTA_HOME&&n(`${{}.VOLTA_HOME}/lib/${r}`),{}.FNM_DIR&&n(`${{}.FNM_DIR}/lib/${r}`),{}.NVM_DIR&&n(`${{}.NVM_DIR}/lib/${r}`),{}.NODENV_ROOT&&n(`${{}.NODENV_ROOT}/versions/*/lib/${r}`,!0),{}.NVS_HOME&&n(`${{}.NVS_HOME}/node/*/*/lib/${r}`,!0),{}.ASDF_DATA_DIR&&n(`${{}.ASDF_DATA_DIR}/installs/nodejs/*/lib/${r}`,!0),process.platform=="win32"?(n(`${t}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${r}`),n(`${t}/AppData/Roaming/npm/${r}`),n(`${t}/AppData/Roaming/nvm/*/${r}`,!0),n(`${t}/AppData/Local/Yarn/config/global/${r}`),n(`${t}/AppData/Local/pnpm/global/*/${r}`,!0),n(`${t}/n/versions/node/*/lib/${r}`,!0),n(`${t}/AppData/Roaming/Yarn/config/global/${r}`),n(`${t}/AppData/Roaming/pnpm-global/${r}`),n(`${t}/AppData/Roaming/pnpm-global/*/${r}`,!0),n(`${t}/.bun/install/global/${r}`),n(`${t}/AppData/Local/fnm_multishells/*/node_modules/${r}`,!0)):(process.platform=="darwin"&&(n(`${t}/Library/${r}`),n(`/opt/local/lib/${r}`)),n(`${t}/.local/lib/${r}`),n(`${t}/.local/share/${r}`),n(`${t}/.npm-global/lib/${r}`),n(`${t}/.npm-packages/lib/${r}`),n(`${t}/.npm/lib/${r}`),n(`${t}/npm/lib/${r}`),n(`/etc/${r}`),n(`/lib/${r}`),n(`/opt/node/lib/${r}`),n(`/usr/lib/${r}`),n(`/usr/local/lib/${r}`),n(`/usr/share/${r}`),n(`/var/lib/${r}`),n(`/opt/homebrew/lib/${r}`),n(`${t}/.config/yarn/global/${r}`),n(`${t}/.yarn/global/${r}`),n(`${t}/.bun/install/global/${r}`),n(`${t}/.pnpm-global/${r}`),n(`${t}/.pnpm-global/*/${r}`,!0),n(`${t}/pnpm-global/${r}`),n(`${t}/pnpm-global/*/${r}`,!0),n(`${t}/.local/share/pnpm/global/${r}`),n(`${t}/.local/share/pnpm/global/*/${r}`,!0),n(`${t}/.bun/install/global/${r}`),n(`/usr/local/n/versions/node/*/lib/${r}`,!0),n(`${t}/n/versions/node/*/lib/${r}`,!0),n(`${t}/n/lib/${r}`),n(`${t}/.volta/tools/image/node/*/lib/${r}`,!0),n(`${t}/.fnm/node-versions/*/installation/lib/${r}`,!0),n(`/usr/local/nvm/versions/node/*/lib/${r}`,!0),n(`${t}/.nvm/versions/node/*/lib/${r}`,!0),n(`${t}/.nodenv/versions/*/lib/${r}`,!0),n(`${t}/.nvs/*/lib/${r}`,!0),n(`${t}/.asdf/installs/nodejs/*/lib/${r}`,!0)),process.platform=="win32"&&e.forEach(s=>{s.pattern=s.pattern.replace(/\//g,"\\"),s.expandedPaths=s.expandedPaths.map(l=>l.replace(/\//g,"\\"))}),e},Re=fr(),je=Re.flatMap(e=>e.expandedPaths),br=({children:e,...t})=>a(i,{bold:!0,backgroundColor:"#ffd500",color:"#000",...t,children:[" ",e," "]});var de=br;const pr=[{name:z.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:z.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:z.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:z.THINKING_STYLE,desc:"Choose custom spinners"},{name:z.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:z.INPUT_BOX,desc:"Customize the input box appearance (e.g., remove border)"}],wr=[{name:z.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:z.OPEN_CONFIG,desc:`Opens your tweakcc config file (${le})`},{name:z.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:z.EXIT,desc:"Bye!"}];function xr({onSubmit:e,notification:t}){const r=[...ge(ce).changesApplied?[]:[{name:z.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...pr,...wr],[n,s]=M(0);return a(d,{flexDirection:"column",children:[o(d,{marginBottom:1,children:o(de,{children:"Tweak Claude Code"})}),o(d,{marginBottom:1,children:a(i,{color:"gray",children:[o(i,{bold:!0,children:"Customize your Claude Code installation."})," ",o(i,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),o(d,{marginBottom:1,children:a(i,{color:"yellow",children:["⭐ ",o(i,{bold:!0,children:"Star the repo at "}),o(cr,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:o(i,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),o(i,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),t&&o(d,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:"bold",borderColor:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",paddingLeft:1,flexDirection:"column",children:o(i,{color:t?.type==="success"?"green":t?.type==="error"?"red":t?.type==="info"?"blue":"yellow",children:t?.message})}),o(mr,{items:r,selectedIndex:n,onSelect:s,onSubmit:l=>e(l)})]})}const Xe=async()=>{await he.mkdir(Le,{recursive:!0})};let Ie={settings:J,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const Pe=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:J};try{oe()&&console.log(`Reading config at ${le}`);const t=await he.readFile(le,"utf8"),r={...e,...JSON.parse(t)},n=r?.settings?.thinkingVerbs;n?.punctuation&&(n.format="{}"+n.punctuation,delete n.punctuation),r.settings.inputBox||(r.settings.inputBox=J.inputBox);for(const s of J.themes){const l=r?.settings?.themes.find(c=>c.id===s.id||c.name===s.name);if(l){for(const[c,h]of Object.entries(s))c!=="colors"&&!Object.hasOwn(l,c)&&(l[c]=h);l.colors||(l.colors={});for(const[c,h]of Object.entries(s.colors))Object.hasOwn(l.colors,c)||(l.colors[c]=h)}}for(const s of r?.settings?.themes||[]){if(J.themes.some(h=>h.id===s.id||h.name===s.name))continue;const c=J.themes[0];s.colors||(s.colors={});for(const[h,u]of Object.entries(c.colors))Object.hasOwn(s.colors,h)||(s.colors[h]=u)}return r?.settings?.userMessageDisplay||(r.settings=r.settings||J,r.settings.userMessageDisplay=J.userMessageDisplay),Ie=r,r}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return e;throw t}},ve=async e=>(oe()&&console.log(`Updating config at ${le}`),e(Ie),Ie.lastModified=new Date().toISOString(),await _r(Ie),Ie),_r=async e=>{try{e.lastModified=new Date().toISOString(),await Xe(),await he.writeFile(le,JSON.stringify(e,null,2))}catch(t){throw console.error("Error saving config:",t),t}},Ke=async e=>{oe()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const t=await he.readFile(pe);return await nr(e.cliPath,t,"restore"),await ve(r=>{r.changesApplied=!1}),!0},Sr=async e=>{e.ccInstallationDir&&je.unshift(e.ccInstallationDir);for(const t of je)try{oe()&&console.log(`Searching for Claude Code cli.js file at ${t}`);const r=Ge.join(t,"cli.js");if(!await Ze(r))continue;oe()&&(console.log(`Found Claude Code cli.js file at ${t}; checking hash...`),console.log(`SHA256 hash: ${await hn(r)}`));const n=Ge.join(t,"package.json");let s;try{s=JSON.parse(await he.readFile(n,"utf8"))}catch(l){if(!(l instanceof Error&&"code"in l&&l.code==="ENOENT"))throw l}return{cliPath:r,packageJsonPath:n,version:s?.version}}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")continue;throw r}return null},Ye=async e=>{await Xe(),oe()&&console.log(`Backing up cli.js to ${pe}`),await he.copyFile(e.cliPath,pe),await ve(t=>{t.changesApplied=!1,t.ccVersion=e.version})};async function Ze(e){try{return await he.stat(e),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}}async function We(){const e=await Pe(),t=await Sr(e);if(!t)return null;const r=t.version,n=e.ccVersion;let s=!1;return await Ze(pe)||(oe()&&console.log(`startupCheck: ${pe} not found; backing up cli.js`),await Ye(t),s=!0),r!==n?(s||(oe()&&console.log(`startupCheck: real version (${r}) != backed up version (${n}); backing up cli.js`),await he.unlink(pe),await Ye(t)),{wasUpdated:!0,oldVersion:n,newVersion:r,ccInstInfo:t}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}}const Ir=e=>{const t=[],r=/visibleOptionCount:[\w$]+=(\d+)/g;let n;for(;(n=r.exec(e))!==null;){const s=n.index+n[0].indexOf("=")+1;t.push({startIndex:s,endIndex:s+n[1].length})}return t},yr=(e,t)=>{const r=Ir(e);if(r.length===0)return null;const n=r.sort((l,c)=>c.startIndex-l.startIndex);let s=e;for(const l of n){const c=t.toString(),h=s.slice(0,l.startIndex)+c+s.slice(l.endIndex);q(s,h,c,l.startIndex,l.endIndex),s=h}return s};function Cr(e){const t=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,r=e.match(t);if(!r||r.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const n=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,s=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,l=e.match(n),c=e.match(s);return!l||l.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!c||c.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1].trim()]},objArr:{startIndex:l.index,endIndex:l.index+l[0].length},obj:{startIndex:c.index,endIndex:c.index+c[0].length}}}const vr=(e,t)=>{const r=Cr(e);if(!r)return null;if(t.length===0)return e;let n=e;const s="return"+JSON.stringify(Object.fromEntries(t.map(h=>[h.id,h.name])));n=n.slice(0,r.obj.startIndex)+s+n.slice(r.obj.endIndex),q(e,n,s,r.obj.startIndex,r.obj.endIndex),e=n;const l=JSON.stringify(t.map(h=>({label:h.name,value:h.id})));n=n.slice(0,r.objArr.startIndex)+l+n.slice(r.objArr.endIndex),q(e,n,l,r.objArr.startIndex,r.objArr.endIndex),e=n;let c=`switch(${r.switchStatement.identifiers?.[0]}){
3
- `;return t.forEach(h=>{c+=`case"${h.id}":return${JSON.stringify(h.colors)};
4
- `}),c+=`default:return${JSON.stringify(t[0].colors)};
5
- }`,n=n.slice(0,r.switchStatement.startIndex)+c+n.slice(r.switchStatement.endIndex),q(e,n,c,r.switchStatement.startIndex,r.switchStatement.endIndex),n},Br=e=>{const t=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,r=e.match(t);return!r||r.index===void 0?(console.error("patch: context limit: failed to find match"),null):r.index+r[0].indexOf("{")+1},Mr=e=>{const t=Br(e);if(!t)return null;const r="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",n=e.slice(0,t)+r+e.slice(t);return q(e,n,r,t,t),n},Tr=e=>{const t=e.indexOf('bash:"bashBorder"');if(t===-1)return console.error("patch: input border: failed to find bash pattern"),null;const r=e.slice(t,t+500),n=/borderStyle:"[^"]*"/,s=r.match(n);return!s||s.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:t+s.index,endIndex:t+s.index+s[0].length}},$r=(e,t)=>{const r=Tr(e);if(!r)return null;if(t){const n="borderColor:undefined",s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s}else return e};function Nr(e){const t=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
2
+ import{Box as u,Text as l,render as Mn,useInput as ge,useStdout as Nn}from"ink";import{Command as Bn}from"commander";import Pe,{Fragment as Se,createContext as kn,useCallback as cn,useContext as be,useEffect as ae,useState as O}from"react";import On from"ink-link";import{Fragment as ce,jsx as o,jsxs as g}from"react/jsx-runtime";import*as se from"node:path";import Ze from"node:path";import*as xe from"node:os";import*as Me from"node:fs";import{globbySync as Tn}from"globby";import En from"node:process";import*as re from"node:fs/promises";import ue from"node:fs/promises";import*as ye from"node:child_process";import*as dn from"node:crypto";import He from"figlet";import ke from"gray-matter";import te from"chalk";function An({items:e,selectedIndex:r,onSelect:n,onSubmit:t}){return ge((i,s)=>{s.upArrow?n(r>0?r-1:e.length-1):s.downArrow?n(r<e.length-1?r+1:0):s.return&&t(e[r].name)}),o(u,{flexDirection:"column",children:e.map((i,s)=>o(u,{children:g(l,{children:[g(l,{bold:s===r,color:s===r?"cyan":void 0,...s===r?i.selectedStyles??{}:i.styles??{},children:[s===r?"❯ ":" ",i.name]}),i.desc&&s===r&&g(l,{dimColor:!0,bold:!1,children:[" \x1B[0;2m","- ",i.desc]})]})},s))})}let J=function(e){return e.APPLY_CHANGES="*Apply customizations to cli.js",e.THEMES="Themes",e.LAUNCH_TEXT="Launch text",e.THINKING_VERBS="Thinking verbs",e.THINKING_STYLE="Thinking style",e.USER_MESSAGE_DISPLAY="User message display",e.INPUT_BOX="Input box",e.VIEW_SYSTEM_PROMPTS="View system prompts",e.RESTORE_ORIGINAL="Restore original Claude Code (preserves tweakcc.json)",e.OPEN_CONFIG="Open tweakcc.json",e.OPEN_CLI="Open Claude Code's cli.js",e.EXIT="Exit",e}({});const K={themes:[{name:"Dark mode",id:"dark",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(253,93,177)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(235,159,127)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(147,165,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(177,195,255)",permission:"rgb(177,185,249)",permissionShimmer:"rgb(207,215,255)",planMode:"rgb(72,150,140)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(177,185,249)",remember:"rgb(177,185,249)",background:"rgb(0,204,204)",success:"rgb(78,186,101)",error:"rgb(255,107,128)",warning:"rgb(255,193,7)",warningShimmer:"rgb(255,223,57)",diffAdded:"rgb(34,92,43)",diffRemoved:"rgb(122,41,54)",diffAddedDimmed:"rgb(71,88,74)",diffRemovedDimmed:"rgb(105,72,77)",diffAddedWord:"rgb(56,166,96)",diffRemovedWord:"rgb(179,89,107)",diffAddedWordDimmed:"rgb(46,107,58)",diffRemovedWordDimmed:"rgb(139,57,69)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(177,185,249)",rate_limit_empty:"rgb(80,83,112)"}},{name:"Light mode",id:"light",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(255,0,135)",claude:"rgb(215,119,87)",claudeShimmer:"rgb(245,149,117)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(87,105,247)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(117,135,255)",permission:"rgb(87,105,247)",permissionShimmer:"rgb(137,155,255)",planMode:"rgb(0,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(87,105,247)",remember:"rgb(0,0,255)",background:"rgb(0,153,153)",success:"rgb(44,122,57)",error:"rgb(171,43,63)",warning:"rgb(150,108,30)",warningShimmer:"rgb(200,158,80)",diffAdded:"rgb(105,219,124)",diffRemoved:"rgb(255,168,180)",diffAddedDimmed:"rgb(199,225,203)",diffRemovedDimmed:"rgb(253,210,216)",diffAddedWord:"rgb(47,157,68)",diffRemovedWord:"rgb(209,69,75)",diffAddedWordDimmed:"rgb(144,194,156)",diffRemovedWordDimmed:"rgb(232,165,173)",red_FOR_SUBAGENTS_ONLY:"rgb(220,38,38)",blue_FOR_SUBAGENTS_ONLY:"rgb(37,99,235)",green_FOR_SUBAGENTS_ONLY:"rgb(22,163,74)",yellow_FOR_SUBAGENTS_ONLY:"rgb(202,138,4)",purple_FOR_SUBAGENTS_ONLY:"rgb(147,51,234)",orange_FOR_SUBAGENTS_ONLY:"rgb(234,88,12)",pink_FOR_SUBAGENTS_ONLY:"rgb(219,39,119)",cyan_FOR_SUBAGENTS_ONLY:"rgb(8,145,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(240, 240, 240)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(87,105,247)",rate_limit_empty:"rgb(39,47,111)"}},{name:"Light mode (ANSI colors only)",id:"light-ansi",colors:{autoAccept:"ansi:magenta",bashBorder:"ansi:magenta",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blue",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blue",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyan",ide:"ansi:blueBright",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:black",inverseText:"ansi:white",inactive:"ansi:blackBright",subtle:"ansi:blackBright",suggestion:"ansi:blue",remember:"ansi:blue",background:"ansi:cyan",success:"ansi:green",error:"ansi:red",warning:"ansi:yellow",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:red",blue_FOR_SUBAGENTS_ONLY:"ansi:blue",green_FOR_SUBAGENTS_ONLY:"ansi:green",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellow",purple_FOR_SUBAGENTS_ONLY:"ansi:magenta",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyan",professionalBlue:"ansi:blueBright",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:white",bashMessageBackgroundColor:"ansi:whiteBright",memoryBackgroundColor:"ansi:white",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:black"}},{name:"Dark mode (ANSI colors only)",id:"dark-ansi",colors:{autoAccept:"ansi:magentaBright",bashBorder:"ansi:magentaBright",claude:"ansi:redBright",claudeShimmer:"ansi:yellowBright",claudeBlue_FOR_SYSTEM_SPINNER:"ansi:blueBright",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"ansi:blueBright",permission:"ansi:blueBright",permissionShimmer:"ansi:blueBright",planMode:"ansi:cyanBright",ide:"ansi:blue",promptBorder:"ansi:white",promptBorderShimmer:"ansi:whiteBright",text:"ansi:whiteBright",inverseText:"ansi:black",inactive:"ansi:white",subtle:"ansi:white",suggestion:"ansi:blueBright",remember:"ansi:blueBright",background:"ansi:cyanBright",success:"ansi:greenBright",error:"ansi:redBright",warning:"ansi:yellowBright",warningShimmer:"ansi:yellowBright",diffAdded:"ansi:green",diffRemoved:"ansi:red",diffAddedDimmed:"ansi:green",diffRemovedDimmed:"ansi:red",diffAddedWord:"ansi:greenBright",diffRemovedWord:"ansi:redBright",diffAddedWordDimmed:"ansi:green",diffRemovedWordDimmed:"ansi:red",red_FOR_SUBAGENTS_ONLY:"ansi:redBright",blue_FOR_SUBAGENTS_ONLY:"ansi:blueBright",green_FOR_SUBAGENTS_ONLY:"ansi:greenBright",yellow_FOR_SUBAGENTS_ONLY:"ansi:yellowBright",purple_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",orange_FOR_SUBAGENTS_ONLY:"ansi:redBright",pink_FOR_SUBAGENTS_ONLY:"ansi:magentaBright",cyan_FOR_SUBAGENTS_ONLY:"ansi:cyanBright",professionalBlue:"rgb(106,155,204)",rainbow_red:"ansi:red",rainbow_orange:"ansi:redBright",rainbow_yellow:"ansi:yellow",rainbow_green:"ansi:green",rainbow_blue:"ansi:cyan",rainbow_indigo:"ansi:blue",rainbow_violet:"ansi:magenta",rainbow_red_shimmer:"ansi:redBright",rainbow_orange_shimmer:"ansi:yellow",rainbow_yellow_shimmer:"ansi:yellowBright",rainbow_green_shimmer:"ansi:greenBright",rainbow_blue_shimmer:"ansi:cyanBright",rainbow_indigo_shimmer:"ansi:blueBright",rainbow_violet_shimmer:"ansi:magentaBright",clawd_body:"ansi:redBright",clawd_background:"ansi:black",userMessageBackground:"ansi:blackBright",bashMessageBackgroundColor:"ansi:black",memoryBackgroundColor:"ansi:blackBright",rate_limit_fill:"ansi:yellow",rate_limit_empty:"ansi:white"}},{name:"Light mode (colorblind-friendly)",id:"light-daltonized",colors:{autoAccept:"rgb(135,0,255)",bashBorder:"rgb(0,102,204)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(51,102,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(101,152,255)",permission:"rgb(51,102,255)",permissionShimmer:"rgb(101,152,255)",planMode:"rgb(51,102,102)",ide:"rgb(71,130,200)",promptBorder:"rgb(153,153,153)",promptBorderShimmer:"rgb(183,183,183)",text:"rgb(0,0,0)",inverseText:"rgb(255,255,255)",inactive:"rgb(102,102,102)",subtle:"rgb(175,175,175)",suggestion:"rgb(51,102,255)",remember:"rgb(51,102,255)",background:"rgb(0,153,153)",success:"rgb(0,102,153)",error:"rgb(204,0,0)",warning:"rgb(255,153,0)",warningShimmer:"rgb(255,183,50)",diffAdded:"rgb(153,204,255)",diffRemoved:"rgb(255,204,204)",diffAddedDimmed:"rgb(209,231,253)",diffRemovedDimmed:"rgb(255,233,233)",diffAddedWord:"rgb(51,102,204)",diffRemovedWord:"rgb(153,51,51)",diffAddedWordDimmed:"rgb(102,153,204)",diffRemovedWordDimmed:"rgb(204,153,153)",red_FOR_SUBAGENTS_ONLY:"rgb(204,0,0)",blue_FOR_SUBAGENTS_ONLY:"rgb(0,102,204)",green_FOR_SUBAGENTS_ONLY:"rgb(0,204,0)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,204,0)",purple_FOR_SUBAGENTS_ONLY:"rgb(128,0,128)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,128,0)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,102,178)",cyan_FOR_SUBAGENTS_ONLY:"rgb(0,178,178)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(220, 220, 220)",bashMessageBackgroundColor:"rgb(250, 245, 250)",memoryBackgroundColor:"rgb(230, 245, 250)",rate_limit_fill:"rgb(51,102,255)",rate_limit_empty:"rgb(23,46,114)"}},{name:"Dark mode (colorblind-friendly)",id:"dark-daltonized",colors:{autoAccept:"rgb(175,135,255)",bashBorder:"rgb(51,153,255)",claude:"rgb(255,153,51)",claudeShimmer:"rgb(255,183,101)",claudeBlue_FOR_SYSTEM_SPINNER:"rgb(153,204,255)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"rgb(183,224,255)",permission:"rgb(153,204,255)",permissionShimmer:"rgb(183,224,255)",planMode:"rgb(102,153,153)",ide:"rgb(71,130,200)",promptBorder:"rgb(136,136,136)",promptBorderShimmer:"rgb(166,166,166)",text:"rgb(255,255,255)",inverseText:"rgb(0,0,0)",inactive:"rgb(153,153,153)",subtle:"rgb(80,80,80)",suggestion:"rgb(153,204,255)",remember:"rgb(153,204,255)",background:"rgb(0,204,204)",success:"rgb(51,153,255)",error:"rgb(255,102,102)",warning:"rgb(255,204,0)",warningShimmer:"rgb(255,234,50)",diffAdded:"rgb(0,68,102)",diffRemoved:"rgb(102,0,0)",diffAddedDimmed:"rgb(62,81,91)",diffRemovedDimmed:"rgb(62,44,44)",diffAddedWord:"rgb(0,119,179)",diffRemovedWord:"rgb(179,0,0)",diffAddedWordDimmed:"rgb(26,99,128)",diffRemovedWordDimmed:"rgb(128,21,21)",red_FOR_SUBAGENTS_ONLY:"rgb(255,102,102)",blue_FOR_SUBAGENTS_ONLY:"rgb(102,178,255)",green_FOR_SUBAGENTS_ONLY:"rgb(102,255,102)",yellow_FOR_SUBAGENTS_ONLY:"rgb(255,255,102)",purple_FOR_SUBAGENTS_ONLY:"rgb(178,102,255)",orange_FOR_SUBAGENTS_ONLY:"rgb(255,178,102)",pink_FOR_SUBAGENTS_ONLY:"rgb(255,153,204)",cyan_FOR_SUBAGENTS_ONLY:"rgb(102,204,204)",professionalBlue:"rgb(106,155,204)",rainbow_red:"rgb(235,95,87)",rainbow_orange:"rgb(245,139,87)",rainbow_yellow:"rgb(250,195,95)",rainbow_green:"rgb(145,200,130)",rainbow_blue:"rgb(130,170,220)",rainbow_indigo:"rgb(155,130,200)",rainbow_violet:"rgb(200,130,180)",rainbow_red_shimmer:"rgb(250,155,147)",rainbow_orange_shimmer:"rgb(255,185,137)",rainbow_yellow_shimmer:"rgb(255,225,155)",rainbow_green_shimmer:"rgb(185,230,180)",rainbow_blue_shimmer:"rgb(180,205,240)",rainbow_indigo_shimmer:"rgb(195,180,230)",rainbow_violet_shimmer:"rgb(230,180,210)",clawd_body:"rgb(215,119,87)",clawd_background:"rgb(0,0,0)",userMessageBackground:"rgb(55, 55, 55)",bashMessageBackgroundColor:"rgb(65, 60, 65)",memoryBackgroundColor:"rgb(55, 65, 70)",rate_limit_fill:"rgb(153,204,255)",rate_limit_empty:"rgb(69,92,115)"}}],launchText:{method:"figlet",figletText:"Claude Code",figletFont:"ANSI Shadow",customText:""},thinkingVerbs:{format:"{}… ",verbs:["Accomplishing","Actioning","Actualizing","Baking","Booping","Brewing","Calculating","Cerebrating","Channelling","Churning","Clauding","Coalescing","Cogitating","Combobulating","Computing","Concocting","Conjuring","Considering","Contemplating","Cooking","Crafting","Creating","Crunching","Deciphering","Deliberating","Determining","Discombobulating","Divining","Doing","Effecting","Elucidating","Enchanting","Envisioning","Finagling","Flibbertigibbeting","Forging","Forming","Frolicking","Generating","Germinating","Hatching","Herding","Honking","Ideating","Imagining","Incubating","Inferring","Manifesting","Marinating","Meandering","Moseying","Mulling","Musing","Mustering","Noodling","Percolating","Perusing","Philosophising","Pondering","Pontificating","Processing","Puttering","Puzzling","Reticulating","Ruminating","Scheming","Schlepping","Shimmying","Simmering","Smooshing","Spelunking","Spinning","Stewing","Sussing","Synthesizing","Thinking","Tinkering","Transmuting","Unfurling","Unravelling","Vibing","Wandering","Whirring","Wibbling","Wizarding","Working","Wrangling","Alchemizing","Animating","Architecting","Bamboozling","Beaming","Befuddling","Bewitching","Billowing","Bippity-bopping","Blanching","Boogieing","Boondoggling","Bootstrapping","Burrowing","Caching","Canoodling","Caramelizing","Cascading","Catapulting","Channeling","Choreographing","Compiling","Composing","Crystallizing","Cultivating","Deploying","Dilly-dallying","Discombobulating","Distilling","Doodling","Drizzling","Ebbing","Embellishing","Ensorcelling","Evaporating","Fermenting","Fiddle-faddling","Finagling","Flambéing","Flowing","Flummoxing","Fluttering","Frosting","Gallivanting","Galloping","Garnishing","Germinating","Gitifying","Grooving","Gusting","Harmonizing","Hashing","Hexing","Hibernating","Higgledy-piggleding","Hornswoggling","Hullaballooing","Hyperspacing","Illustrating","Improvising","Incanting","Indexing","Infusing","Ionizing","Jazzercising","Jiggery-pokerying","Jitterbugging","Julienning","Kerfuffling","Kneading","Leavening","Levitating","Linting","Lollygagging","Malarkeying","Metamorphosing","Migrating","Minifying","Misting","Moonwalking","Mystifying","Nebulizing","Nesting","Nucleating","Optimizing","Orbiting","Orchestrating","Osmosing","Parsing","Perambulating","Photosynthesizing","Pipelining","Poaching","Pollinating","Pouncing","Precipitating","Prestidigitating","Proofing","Propagating","Prowling","Quantumizing","Querying","Razzle-dazzling","Razzmatazzing","Recombobulating","Reducing","Refactoring","Rippling","Roosting","Sautéing","Scampering","Scurrying","Seasoning","Serializing","Shenaniganing","Skedaddling","Sketching","Skullduggering","Slithering","Sock-hopping","Spellbinding","Sprouting","Storyboarding","Sublimating","Swirling","Swooping","Symbioting","Syncopating","Teleporting","Tempering","Thaumaturging","Thundering","Tomfoolering","Topsy-turvying","Transfiguring","Transpiling","Twisting","Undulating","Validating","Vaporizing","Waddling","Warping","Whatchamacalliting","Whirlpooling","Whisking","Willy-nillying","Zesting","Zigzagging"]},thinkingStyle:{updateInterval:120,phases:process.env.TERM==="xterm-ghostty"?["·","✢","✳","✶","✻","*"]:process.platform==="darwin"?["·","✢","✳","✶","✻","✽"]:["·","✢","*","✶","✻","✽"],reverseMirror:!0},userMessageDisplay:{prefix:{format:">",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"},message:{format:"{}",styling:[],foreground_color:"rgb(0,0,0)",background_color:"rgb(0,0,0)"}},inputBox:{removeBorder:!1}},Dn=()=>{const e=se.join(xe.homedir(),".tweakcc"),r=process.env.XDG_CONFIG_HOME;try{if(Me.existsSync(e))return e}catch{}return r?se.join(r,"tweakcc"):e},pe=Dn(),de=se.join(pe,"config.json"),_e=se.join(pe,"cli.js.backup"),me=se.join(pe,"system-prompts"),Ln=()=>{const e=[],r=process.platform=="win32"?xe.homedir().replace(/\\/g,"/"):xe.homedir(),n="node_modules/@anthropic-ai/claude-code",t=(i,s=!1)=>{if(s){const a=Tn(i,{onlyFiles:!1});e.push({pattern:i,isGlob:!0,expandedPaths:a})}else e.push({pattern:i,isGlob:!1,expandedPaths:[i]})};return t(`${xe.homedir()}/.claude/local/${n}`),process.env.NPM_PREFIX&&t(`${process.env.NPM_PREFIX}/lib/${n}`),process.env.N_PREFIX&&t(`${process.env.N_PREFIX}/lib/${n}`),process.env.VOLTA_HOME&&t(`${process.env.VOLTA_HOME}/lib/${n}`),process.env.FNM_DIR&&t(`${process.env.FNM_DIR}/lib/${n}`),process.env.NVM_DIR&&t(`${process.env.NVM_DIR}/lib/${n}`),process.env.NODENV_ROOT&&t(`${process.env.NODENV_ROOT}/versions/*/lib/${n}`,!0),process.env.NVS_HOME&&t(`${process.env.NVS_HOME}/node/*/*/lib/${n}`,!0),process.env.ASDF_DATA_DIR&&t(`${process.env.ASDF_DATA_DIR}/installs/nodejs/*/lib/${n}`,!0),process.platform=="win32"?(t(`${r}/AppData/Local/Volta/tools/image/packages/@anthropic-ai/claude-code/${n}`),t(`${r}/AppData/Roaming/npm/${n}`),t(`${r}/AppData/Roaming/nvm/*/${n}`,!0),t(`${r}/AppData/Local/Yarn/config/global/${n}`),t(`${r}/AppData/Local/pnpm/global/*/${n}`,!0),t(`C:/nvm4w/nodejs/${n}`),t(`${r}/n/versions/node/*/lib/${n}`,!0),t(`${r}/AppData/Roaming/Yarn/config/global/${n}`),t(`${r}/AppData/Roaming/pnpm-global/${n}`),t(`${r}/AppData/Roaming/pnpm-global/*/${n}`,!0),t(`${r}/.bun/install/global/${n}`),t(`${r}/AppData/Local/fnm_multishells/*/node_modules/${n}`,!0)):(process.platform=="darwin"&&(t(`${r}/Library/${n}`),t(`/opt/local/lib/${n}`)),t(`${r}/.local/lib/${n}`),t(`${r}/.local/share/${n}`),t(`${r}/.npm-global/lib/${n}`),t(`${r}/.npm-packages/lib/${n}`),t(`${r}/.npm/lib/${n}`),t(`${r}/npm/lib/${n}`),t(`/etc/${n}`),t(`/lib/${n}`),t(`/opt/node/lib/${n}`),t(`/usr/lib/${n}`),t(`/usr/local/lib/${n}`),t(`/usr/share/${n}`),t(`/var/lib/${n}`),t(`/opt/homebrew/lib/${n}`),t(`${r}/.config/yarn/global/${n}`),t(`${r}/.yarn/global/${n}`),t(`${r}/.bun/install/global/${n}`),t(`${r}/.pnpm-global/${n}`),t(`${r}/.pnpm-global/*/${n}`,!0),t(`${r}/pnpm-global/${n}`),t(`${r}/pnpm-global/*/${n}`,!0),t(`${r}/.local/share/pnpm/global/${n}`),t(`${r}/.local/share/pnpm/global/*/${n}`,!0),t(`${r}/.bun/install/global/${n}`),t(`/usr/local/n/versions/node/*/lib/${n}`,!0),t(`${r}/n/versions/node/*/lib/${n}`,!0),t(`${r}/n/lib/${n}`),t(`${r}/.volta/tools/image/node/*/lib/${n}`,!0),t(`${r}/.fnm/node-versions/*/installation/lib/${n}`,!0),t(`/usr/local/nvm/versions/node/*/lib/${n}`,!0),t(`${r}/.nvm/versions/node/*/lib/${n}`,!0),t(`${r}/.nodenv/versions/*/lib/${n}`,!0),t(`${r}/.nvs/*/lib/${n}`,!0),t(`${r}/.asdf/installs/nodejs/*/lib/${n}`,!0)),process.platform=="win32"&&e.forEach(i=>{i.pattern=i.pattern.replace(/\//g,"\\"),i.expandedPaths=i.expandedPaths.map(s=>s.replace(/\//g,"\\"))}),e},Ge=Ln(),Qe=Ge.flatMap(e=>e.expandedPaths),Pn=({children:e,...r})=>g(l,{bold:!0,backgroundColor:"#ffd500",color:"#000",...r,children:[" ",e," "]});var fe=Pn;const Rn=[{name:J.THEMES,desc:"Modify Claude Code's built-in themes or create your own"},{name:J.LAUNCH_TEXT,desc:`Change the "CLAUDE CODE" banner text that's shown when you sign in to Claude Code`},{name:J.THINKING_VERBS,desc:"Customize the list of verbs that Claude Code uses when it's working"},{name:J.THINKING_STYLE,desc:"Choose custom spinners"},{name:J.USER_MESSAGE_DISPLAY,desc:"Customize how user messages are displayed"},{name:J.INPUT_BOX,desc:"Customize the input box appearance (e.g., remove border)"},{name:J.VIEW_SYSTEM_PROMPTS,desc:"Opens the system prompts directory where you can customize Claude Code's system prompts"}],Fn=[{name:J.RESTORE_ORIGINAL,desc:"Reverts your Claude Code install to its original state (your customizations are remembered and can be reapplied)"},{name:J.OPEN_CONFIG,desc:`Opens your tweakcc config file (${de})`},{name:J.OPEN_CLI,desc:"Opens Claude Code's cli.js file"},{name:J.EXIT,desc:"Bye!"}];function Vn({onSubmit:e,notification:r}){const n=[...be(he).changesApplied?[]:[{name:J.APPLY_CHANGES,desc:"Required: Updates Claude Code's cli.js in-place with your changes",selectedStyles:{color:"green"}}],...Rn,...Fn],[t,i]=O(0);return g(u,{flexDirection:"column",children:[o(u,{marginBottom:1,children:o(fe,{children:"Tweak Claude Code"})}),o(u,{marginBottom:1,children:g(l,{color:"gray",children:[o(l,{bold:!0,children:"Customize your Claude Code installation."})," ",o(l,{dimColor:!0,children:"Settings will be saved to a JSON file."})]})}),o(u,{marginBottom:1,children:g(l,{color:"yellow",children:["⭐ ",o(l,{bold:!0,children:"Star the repo at "}),o(On,{url:"https://github.com/Piebald-AI/tweakcc",fallback:!1,children:o(l,{bold:!0,color:"cyan",children:"https://github.com/Piebald-AI/tweakcc"})}),o(l,{bold:!0,children:" if you find this useful!"})," ⭐"]})}),r&&o(u,{marginBottom:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:"bold",borderColor:r?.type==="success"?"green":r?.type==="error"?"red":r?.type==="info"?"blue":"yellow",paddingLeft:1,flexDirection:"column",children:o(l,{color:r?.type==="success"?"green":r?.type==="error"?"red":r?.type==="info"?"blue":"yellow",children:r?.message})}),o(An,{items:n,selectedIndex:t,onSelect:i,onSubmit:s=>e(s)})]})}async function We(e){const r=`https://raw.githubusercontent.com/Piebald-AI/tweakcc/refs/heads/main/data/prompts/prompts-${e}.json`;try{const n=await fetch(r);if(!n.ok)throw new Error(`Failed to download strings file: ${n.status} ${n.statusText}`);return await n.json()}catch(n){throw n instanceof Error?new Error(`Error downloading strings file for version ${e}: ${n.message}`):n}}const jn="modulepreload",Un=function(e){return"/"+e},en={},Hn=function(r,n,t){let i=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(f=>Promise.resolve(f).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};const a=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");i=c(n.map(m=>{if(m=Un(m,t),m in en)return;en[m]=!0;const f=m.endsWith(".css"),S=f?'[rel="stylesheet"]':"";if(!!t)for(let $=a.length-1;$>=0;$--){const M=a[$];if(M.href===m&&(!f||M.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${S}`))return;const C=document.createElement("link");if(C.rel=f?"stylesheet":jn,f||(C.as="script"),C.crossOrigin="",C.href=m,h&&C.setAttribute("nonce",h),document.head.appendChild(C),f)return new Promise(($,M)=>{C.addEventListener("load",$),C.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${m}`)))})}))}function s(a){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=a,window.dispatchEvent(d),!d.defaultPrevented)throw a}return i.then(a=>{for(const d of a||[])d.status==="rejected"&&s(d.reason);return r().catch(s)})},gn=se.join(pe,"systemPromptOriginalHashes.json"),hn=se.join(pe,"systemPromptAppliedHashes.json"),un=(e,r)=>`${e}-${r}`,Te=e=>dn.createHash("md5").update(e.trim(),"utf8").digest("hex"),mn=async()=>{try{const e=await re.readFile(gn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},Gn=async e=>{await re.mkdir(pe,{recursive:!0});const r={},n=Object.keys(e).sort();for(const t of n)r[t]=e[t];await re.writeFile(gn,JSON.stringify(r,null,2),"utf8")},Yn=async e=>{const r=await mn();let n=0;for(const t of e.prompts){const i=un(t.id,t.version);if(!r[i]){const s=Oe(t.pieces,t.identifiers,t.identifierMap),a=Te(s);r[i]=a,n++}}return await Gn(r),n},Wn=async(e,r)=>{const n=await mn(),t=un(e,r);return n[t]},ze=async()=>{try{const e=await re.readFile(hn,"utf8");return JSON.parse(e)}catch(e){if(e instanceof Error&&"code"in e&&e.code==="ENOENT")return{};throw e}},fn=async e=>{await re.mkdir(pe,{recursive:!0});const r={},n=Object.keys(e).sort();for(const t of n)r[t]=e[t];await re.writeFile(hn,JSON.stringify(r,null,2),"utf8")},zn=async(e,r)=>{const n=await ze();n[e]=r,await fn(n)},Jn=async()=>{const e=await ze(),r={};for(const n of Object.keys(e))r[n]=null;await fn(r)},Xn=async e=>{try{const r=await ze();if(Object.keys(r).length===0)return!1;const t=(await re.readdir(e)).filter(i=>i.endsWith(".md"));for(const i of t){const s=i.replace(".md",""),a=r[s];if(a===void 0||a===null)continue;const d=se.join(e,i),h=await re.readFile(d,"utf8"),m=(await Hn(()=>import("gray-matter"),[])).default(h,{delimiters:["<!--","-->"]});if(Te(m.content)!==a)return!0}return!1}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")return!1;throw r}},bn=e=>{const r=ke(e,{delimiters:["<!--","-->"]}),{name:n,description:t,ccVersion:i,variables:s}=r.data;return{name:n||"",description:t||"",ccVersion:i||"",variables:s||[],content:r.content.trim()}},nn=(e,r)=>{const n=r||Oe(e.pieces,e.identifiers,e.identifierMap),t=Object.keys(e.identifierMap).length>0?[...new Set(Object.values(e.identifierMap))]:void 0,i={name:e.name,description:e.description,ccVersion:e.version};return t&&t.length>0&&(i.variables=t),ke.stringify(n,i,{delimiters:["<!--","-->"]})},Oe=(e,r,n)=>{let t="";for(let i=0;i<e.length;i++)if(t+=e[i],i<r.length){const s=r[i],a=n[String(s)]||`UNKNOWN_${s}`;t+=a}return t},Kn=(e,r)=>{const n=e.split(".").map(Number),t=r.split(".").map(Number);for(let i=0;i<Math.max(n.length,t.length);i++){const s=n[i]||0,a=t[i]||0;if(s<a)return-1;if(s>a)return 1}return 0},Ne=e=>se.join(me,`${e}.md`),qn=async e=>{try{return await re.access(Ne(e)),!0}catch{return!1}},Zn=async e=>{const r=Ne(e),n=await re.readFile(r,"utf-8");return bn(n)},Ye=async(e,r)=>{const n=Ne(e);await re.writeFile(n,r,"utf-8")},Qn=async(e,r)=>{const n=Ne(e),t=await re.readFile(n,"utf-8"),i=ke(t,{delimiters:["<!--","-->"]}),s=Object.keys(r).length>0?[...new Set(Object.values(r))]:void 0,a={name:i.data.name,description:i.data.description,ccVersion:i.data.ccVersion};s&&s.length>0&&(a.variables=s);const d=ke.stringify(i.content,a,{delimiters:["<!--","-->"]});await Ye(e,d)},er=(e,r)=>{const n=$=>$.split(/(\s+)/),t=n(e),i=n(r),s=t.length,a=i.length,d=Array(s+1).fill(0).map(()=>Array(a+1).fill(0));for(let $=1;$<=s;$++)for(let M=1;M<=a;M++)t[$-1]===i[M-1]?d[$][M]=d[$-1][M-1]+1:d[$][M]=Math.max(d[$-1][M],d[$][M-1]);const h=Array(s).fill(!1),c=Array(a).fill(!1);let m=s,f=a;for(;m>0||f>0;)m>0&&f>0&&t[m-1]===i[f-1]?(m--,f--):f>0&&(m===0||d[m][f-1]>=d[m-1][f])?(c[f-1]=!0,f--):m>0&&(h[m-1]=!0,m--);const S=$=>$.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");let I="";for(let $=0;$<t.length;$++){const M=S(t[$]);I+=h[$]?`<mark>${M}</mark>`:M}let C="";for(let $=0;$<i.length;$++){const M=S(i[$]);C+=c[$]?`<mark>${M}</mark>`:M}return{oldHtml:I,newHtml:C}},rn=(e,r)=>{const n=e.length,t=r.length,i=Array(n+1).fill(0).map(()=>Array(t+1).fill(0));for(let c=1;c<=n;c++)for(let m=1;m<=t;m++)e[c-1]===r[m-1]?i[c][m]=i[c-1][m-1]+1:i[c][m]=Math.max(i[c-1][m],i[c][m-1]);const s=[];let a=n,d=t;const h=[];for(;a>0||d>0;)a>0&&d>0&&e[a-1]===r[d-1]?(h.unshift({type:"unchanged",line:e[a-1],oldLineNo:a,newLineNo:d}),a--,d--):d>0&&(a===0||i[a][d-1]>=i[a-1][d])?(h.unshift({type:"added",line:r[d-1],newLineNo:d}),d--):a>0&&(h.unshift({type:"removed",line:e[a-1],oldLineNo:a}),a--);for(let c=0;c<h.length;c++){const m=h[c],f=h[c+1];if(m.type==="removed"&&f?.type==="added"){const S=er(m.line,f.line);s.push({type:"modified",line:m.line,oldLineNo:m.oldLineNo,newLineNo:f.newLineNo,oldHtml:S.oldHtml,newHtml:S.newHtml}),c++}else s.push(m)}return s},nr=async(e,r,n,t,i,s,a,d)=>{const h=n.split(`
3
+ `),c=t.split(`
4
+ `),m=i.split(`
5
+ `),f=B=>B.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"),S=rn(h,c),I=rn(h,m);let C="";for(const B of S){const Y=f(B.line);if(B.type==="modified"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${B.oldHtml}</div>
6
+ `,C+=`<div class="line added"><span class="line-num">${V}</span><span class="prefix">+ </span>${B.newHtml}</div>
7
+ `}else if(B.type==="removed"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ";C+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${Y}</div>
8
+ `}else if(B.type==="added"){const j=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line added"><span class="line-num">${j}</span><span class="prefix">+ </span>${Y}</div>
9
+ `}else{const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";C+=`<div class="line unchanged"><span class="line-num">${j} ${V}</span><span class="prefix"> </span>${Y}</div>
10
+ `}}let $="";for(const B of I){const Y=f(B.line);if(B.type==="modified"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${B.oldHtml}</div>
11
+ `,$+=`<div class="line added"><span class="line-num">${V}</span><span class="prefix">+ </span>${B.newHtml}</div>
12
+ `}else if(B.type==="removed"){const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ";$+=`<div class="line removed"><span class="line-num">${j}</span><span class="prefix">- </span>${Y}</div>
13
+ `}else if(B.type==="added"){const j=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line added"><span class="line-num">${j}</span><span class="prefix">+ </span>${Y}</div>
14
+ `}else{const j=B.oldLineNo?String(B.oldLineNo).padStart(4," "):" ",V=B.newLineNo?String(B.newLineNo).padStart(4," "):" ";$+=`<div class="line unchanged"><span class="line-num">${j} ${V}</span><span class="prefix"> </span>${Y}</div>
15
+ `}}const M=`<!DOCTYPE html>
16
+ <html>
17
+ <head>
18
+ <meta charset="UTF-8">
19
+ <title>Diff: ${f(r)} (${f(e)})</title>
20
+ <style>
21
+ body {
22
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
23
+ margin: 0;
24
+ padding: 20px;
25
+ background: #f5f5f5;
26
+ }
27
+ .header {
28
+ background: white;
29
+ padding: 20px;
30
+ border-radius: 8px;
31
+ margin-bottom: 20px;
32
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
33
+ }
34
+ h1 {
35
+ margin: 0 0 10px 0;
36
+ color: #333;
37
+ }
38
+ .version-info {
39
+ color: #666;
40
+ font-size: 14px;
41
+ }
42
+ .warning {
43
+ background: #fff3cd;
44
+ border-left: 4px solid #ffc107;
45
+ padding: 15px;
46
+ margin-bottom: 20px;
47
+ border-radius: 4px;
48
+ }
49
+ .warning code {
50
+ background: rgba(0,0,0,0.1);
51
+ padding: 2px 6px;
52
+ border-radius: 3px;
53
+ font-family: 'Consolas', 'Monaco', monospace;
54
+ font-size: 13px;
55
+ }
56
+ .diff-panels {
57
+ display: grid;
58
+ grid-template-columns: 1fr 1fr;
59
+ gap: 20px;
60
+ margin-bottom: 20px;
61
+ }
62
+ .diff-container {
63
+ background: white;
64
+ border-radius: 8px;
65
+ overflow: hidden;
66
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
67
+ }
68
+ .diff-header {
69
+ background: #f8f9fa;
70
+ padding: 12px 15px;
71
+ font-weight: bold;
72
+ border-bottom: 2px solid #dee2e6;
73
+ font-family: 'Consolas', 'Monaco', monospace;
74
+ font-size: 14px;
75
+ }
76
+ .diff-content {
77
+ padding: 0;
78
+ font-family: 'Consolas', 'Monaco', monospace;
79
+ font-size: 13px;
80
+ line-height: 1.5;
81
+ overflow-x: auto;
82
+ max-height: 600px;
83
+ overflow-y: auto;
84
+ }
85
+ .line {
86
+ padding: 2px 10px;
87
+ white-space: pre-wrap;
88
+ word-wrap: break-word;
89
+ }
90
+ .line .line-num {
91
+ display: inline-block;
92
+ min-width: 50px;
93
+ margin-right: 10px;
94
+ color: #6a737d;
95
+ text-align: right;
96
+ user-select: none;
97
+ font-size: 12px;
98
+ }
99
+ .line .prefix {
100
+ display: inline-block;
101
+ width: 20px;
102
+ font-weight: bold;
103
+ user-select: none;
104
+ }
105
+ .removed {
106
+ background: #ffebe9;
107
+ color: #24292e;
108
+ }
109
+ .removed .prefix {
110
+ color: #d73a49;
111
+ }
112
+ .added {
113
+ background: #e6ffed;
114
+ color: #24292e;
115
+ }
116
+ .added .prefix {
117
+ color: #22863a;
118
+ }
119
+ .unchanged {
120
+ background: #ffffff;
121
+ color: #24292e;
122
+ }
123
+ .unchanged .prefix {
124
+ color: #6a737d;
125
+ }
126
+ mark {
127
+ background: rgba(255, 200, 0, 0.4);
128
+ padding: 0;
129
+ border-radius: 2px;
130
+ }
131
+ .removed mark {
132
+ background: rgba(215, 58, 73, 0.3);
133
+ }
134
+ .added mark {
135
+ background: rgba(34, 134, 58, 0.3);
136
+ }
137
+ @media (max-width: 1200px) {
138
+ .diff-panels {
139
+ grid-template-columns: 1fr;
140
+ }
141
+ }
142
+ </style>
143
+ </head>
144
+ <body>
145
+ <div class="header">
146
+ <h1>${f(r)}</h1>
147
+ <div class="version-info">
148
+ <strong>Old Version:</strong> ${f(s)} →
149
+ <strong>New Version:</strong> ${f(a)}
150
+ </div>
151
+ </div>
152
+
153
+ <div class="warning">
154
+ <strong>⚠️ Version Mismatch Warning</strong><br>
155
+ Your customized prompt file is based on version ${f(s)},
156
+ but Claude Code is now using version ${f(a)}.
157
+ Review the differences below to understand both your customizations and the upstream changes.<br><br>
158
+ <strong>File:</strong> <code>${f(d)}</code><br><br>
159
+ When you're done reviewing, update the <code>ccVersion</code> in the file to <strong>${f(a)}</strong>.
160
+ </div>
161
+
162
+ <div class="diff-panels">
163
+ <div class="diff-container">
164
+ <div class="diff-header">Your Customizations (v${f(s)} → User)</div>
165
+ <div class="diff-content">
166
+ ${C} </div>
167
+ </div>
168
+
169
+ <div class="diff-container">
170
+ <div class="diff-header">Upstream Changes (v${f(s)} → v${f(a)})</div>
171
+ <div class="diff-content">
172
+ ${$} </div>
173
+ </div>
174
+ </div>
175
+ </body>
176
+ </html>`,F=se.join(me,`${e}.diff.html`);return await re.writeFile(F,M,"utf-8"),F},rr=async e=>{const r={id:e.id,name:e.name,description:e.description,action:"skipped",newVersion:e.version};if(!await qn(e.id)){const i=nn(e);return await Ye(e.id,i),r.action="created",r}const t=await Zn(e.id);if(r.oldVersion=t.ccVersion,await Qn(e.id,e.identifierMap),t.ccVersion&&e.version){const i=Kn(t.ccVersion,e.version);if(i===0)return r.action="skipped",r;if(i!=0){const s=await Wn(e.id,t.ccVersion),a=Te(t.content);if(!s||s!==a){r.action="conflict";const c=(await We(t.ccVersion)).prompts.find(C=>C.id===e.id),m=c?Oe(c.pieces,c.identifiers,c.identifierMap):t.content,f=Oe(e.pieces,e.identifiers,e.identifierMap),S=Ne(e.id),I=await nr(e.id,e.name,m,t.content,f,t.ccVersion,e.version,S);r.diffHtmlPath=I}else{const h=nn(e);await Ye(e.id,h),r.action="updated"}}}return r},tr=async e=>{const r={ccVersion:e,results:[]},n=await We(e);await Yn(n),await re.mkdir(me,{recursive:!0});for(const t of n.prompts)try{const i=await rr(t);r.results.push(i)}catch(i){throw console.log(te.red(`Failed to sync prompt ${t.id}:`)),i}return r};let Re=null,tn=null;const or=async e=>{if(Re&&tn===e)return Re;const r=await We(e);return Re=r,tn=e,r},ir=(e,r)=>{let n="";for(let t=0;t<e.length;t++){const s=e[t].replace(/<<CCVERSION>>/g,r).replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n+=s,t<e.length-1&&(n+="([\\w$]+)")}return n},sr=(e,r,n,t,i)=>{const s={};for(let h=0;h<t.length;h++){const c=t[h],m=String(r[h]),f=n[m];f&&(s[f]=c)}let a=e;const d=Object.entries(s).sort((h,c)=>c[0].length-h[0].length);for(const[h,c]of d){const m=new RegExp(`\\b${h}\\b`,"g");a=a.replace(m,c)}return a=a.replace(/<<CCVERSION>>/g,i),a},lr=async e=>{const r=await or(e),n=[];for(const t of r.prompts){const i=ir(t.pieces,e),s=se.join(me,`${t.id}.md`);let a;try{a=await re.readFile(s,"utf8")}catch(c){console.error(`Failed to read markdown file ${s}:`,c);continue}const d=bn(a),h=c=>{const m=c.slice(1);return sr(d.content,t.identifiers,t.identifierMap,m,e)};n.push({promptId:t.id,prompt:d,regex:i,getInterpolatedContent:h})}return n},ar=e=>{const r=e.results.filter(s=>s.action==="created"),n=e.results.filter(s=>s.action==="updated"),t=e.results.filter(s=>s.action==="conflict"),i=e.results.filter(s=>s.action==="skipped");if((r.length>0||n.length>0||t.length>0)&&i.length>0&&(console.log(te.dim(`Skipped ${i.length} up-to-date file(s)`)),console.log()),r.length>0){console.log(te.bold.green(`Created ${r.length} new prompt file(s):`));for(const s of r)console.log(te.green(` ${me}/${s.id}.md`)),console.log(te.green.dim(` ${s.description}`));console.log()}if(n.length>0){console.log(te.bold.blue(`Updated ${n.length} system prompt file(s):`));for(const s of n)s.oldVersion?console.log(te.blue(` ${s.id}.md (${s.oldVersion} → ${s.newVersion})`)):console.log(te.blue(` ${s.id}.md (→ ${s.newVersion})`));console.log()}if(t.length>0){console.log(te.bold.yellow(`WARNING: Conflicts detected for ${t.length} system prompt file(s)`));for(const s of t)console.log(te.yellow(` ${s.id}.md (${s.oldVersion} → ${s.newVersion})`)),console.log(te.yellow(` Open the diff in your browser: ${s.diffHtmlPath}`));console.log()}if(r.length>0&&(console.log(te.green.bold("New prompt files have been created; either more are now supported by tweakcc or Anthropic has added new ones.")),console.log(te.green(`You can now customize the markdown files at ${me} in a text editor.`)),console.log(te.green('Then run tweakcc and select "apply" or use tweakcc --apply to update your system prompts')),console.log()),t.length>0){console.log(),console.log("Review conflicts:"),console.log(" 1. Open the diff HTML files in your browser"),console.log(" 2. Verify your customizations are still appropriate"),console.log(" 3. Update your markdown files if needed"),console.log(te.bold.cyan(" 4. Important: Update the ccVersion in your markdown files to the latest version of each prompt:"));for(const s of t)console.log(te.yellow(` ${s.id}.md → `)+te.bold.magenta(s.newVersion));console.log(" 5. Delete the diff HTML files"),console.log()}},pn=async()=>{await ue.mkdir(pe,{recursive:!0}),await ue.mkdir(me,{recursive:!0})};let $e={settings:K,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null};const Je=async()=>{const e={ccVersion:"",ccInstallationDir:null,lastModified:new Date().toISOString(),changesApplied:!0,settings:K};try{oe()&&console.log(`Reading config at ${de}`);const r=await ue.readFile(de,"utf8"),n={...e,...JSON.parse(r)},t=n?.settings?.thinkingVerbs;t?.punctuation&&(t.format="{}"+t.punctuation,delete t.punctuation),n.settings.inputBox||(n.settings.inputBox=K.inputBox);for(const s of K.themes){const a=n?.settings?.themes.find(d=>d.id===s.id||d.name===s.name);if(a){for(const[d,h]of Object.entries(s))d!=="colors"&&!Object.hasOwn(a,d)&&(a[d]=h);a.colors||(a.colors={});for(const[d,h]of Object.entries(s.colors))Object.hasOwn(a.colors,d)||(a.colors[d]=h)}}for(const s of n?.settings?.themes||[]){if(K.themes.some(h=>h.id===s.id||h.name===s.name))continue;const d=K.themes[0];s.colors||(s.colors={});for(const[h,c]of Object.entries(d.colors))Object.hasOwn(s.colors,h)||(s.colors[h]=c)}return n?.settings?.userMessageDisplay||(n.settings=n.settings||K,n.settings.userMessageDisplay=K.userMessageDisplay),await Xn(me)&&(n.changesApplied=!1),$e=n,n}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")return e;throw r}},Ee=async e=>(oe()&&console.log(`Updating config at ${de}`),e($e),$e.lastModified=new Date().toISOString(),await cr($e),$e),cr=async e=>{try{e.lastModified=new Date().toISOString(),await pn(),await ue.writeFile(de,JSON.stringify(e,null,2))}catch(r){throw console.error("Error saving config:",r),r}},wn=async e=>{oe()&&console.log(`Restoring cli.js from backup to ${e.cliPath}`);const r=await ue.readFile(_e);return await In(e.cliPath,r,"restore"),await Jn(),await Ee(n=>{n.changesApplied=!1}),!0},dr=async e=>{e.ccInstallationDir&&Qe.unshift(e.ccInstallationDir);for(const r of Qe)try{oe()&&console.log(`Searching for Claude Code cli.js file at ${r}`);const n=Ze.join(r,"cli.js");if(!await xn(n))continue;oe()&&(console.log(`Found Claude Code cli.js file at ${r}; checking hash...`),console.log(`SHA256 hash: ${await et(n)}`));const t=Ze.join(r,"package.json");let i;try{i=JSON.parse(await ue.readFile(t,"utf8"))}catch(s){if(!(s instanceof Error&&"code"in s&&s.code==="ENOENT"))throw s}return{cliPath:n,packageJsonPath:t,version:i?.version}}catch(n){if(n instanceof Error&&"code"in n&&n.code==="ENOENT")continue;throw n}return null},on=async e=>{await pn(),oe()&&console.log(`Backing up cli.js to ${_e}`),await ue.copyFile(e.cliPath,_e),await Ee(r=>{r.changesApplied=!1,r.ccVersion=e.version})};async function xn(e){try{return await ue.stat(e),!0}catch(r){if(r instanceof Error&&"code"in r&&r.code==="ENOENT")return!1;throw r}}async function sn(){const e=await Je(),r=await dr(e);if(!r)return null;if(r.version){const s=await tr(r.version);ar(s)}const n=r.version,t=e.ccVersion;let i=!1;return await xn(_e)||(oe()&&console.log(`startupCheck: ${_e} not found; backing up cli.js`),await on(r),i=!0),n!==t?(i||(oe()&&console.log(`startupCheck: real version (${n}) != backed up version (${t}); backing up cli.js`),await ue.unlink(_e),await on(r)),{wasUpdated:!0,oldVersion:t,newVersion:n,ccInstInfo:r}):{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:r}}const gr=e=>{const r=[],n=/visibleOptionCount:[\w$]+=(\d+)/g;let t;for(;(t=n.exec(e))!==null;){const i=t.index+t[0].indexOf("=")+1;r.push({startIndex:i,endIndex:i+t[1].length})}return r},hr=(e,r)=>{const n=gr(e);if(n.length===0)return null;const t=n.sort((s,a)=>a.startIndex-s.startIndex);let i=e;for(const s of t){const a=r.toString(),d=i.slice(0,s.startIndex)+a+i.slice(s.endIndex);Z(i,d,a,s.startIndex,s.endIndex),i=d}return i};function ur(e){const r=/switch\s*\(([^)]+)\)\s*\{[^}]*case\s*["']light["'][^}]+\}/s,n=e.match(r);if(!n||n.index==null)return console.error("patch: themes: failed to find switchMatch"),null;const t=/\[(?:\{label:"(?:Dark|Light).+?",value:".+?"\},?)+\]/,i=/return\{(?:[$\w]+?:"(?:Dark|Light).+?",?)+\}/,s=e.match(t),a=e.match(i);return!s||s.index==null?(console.error("patch: themes: failed to find objArrMatch"),null):!a||a.index==null?(console.error("patch: themes: failed to find objMatch"),null):{switchStatement:{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1].trim()]},objArr:{startIndex:s.index,endIndex:s.index+s[0].length},obj:{startIndex:a.index,endIndex:a.index+a[0].length}}}const mr=(e,r)=>{const n=ur(e);if(!n)return null;if(r.length===0)return e;let t=e;const i="return"+JSON.stringify(Object.fromEntries(r.map(d=>[d.id,d.name])));t=t.slice(0,n.obj.startIndex)+i+t.slice(n.obj.endIndex),Z(e,t,i,n.obj.startIndex,n.obj.endIndex),e=t;const s=JSON.stringify(r.map(d=>({label:d.name,value:d.id})));t=t.slice(0,n.objArr.startIndex)+s+t.slice(n.objArr.endIndex),Z(e,t,s,n.objArr.startIndex,n.objArr.endIndex),e=t;let a=`switch(${n.switchStatement.identifiers?.[0]}){
177
+ `;return r.forEach(d=>{a+=`case"${d.id}":return${JSON.stringify(d.colors)};
178
+ `}),a+=`default:return${JSON.stringify(r[0].colors)};
179
+ }`,t=t.slice(0,n.switchStatement.startIndex)+a+t.slice(n.switchStatement.endIndex),Z(e,t,a,n.switchStatement.startIndex,n.switchStatement.endIndex),t},fr=e=>{const r=/function ([$\w]+)\(([$\w]*)\)\{((?:if\([$\w]+\.includes\("\[1m\]"\)\)return 1e6;)?return 200000)\}/,n=e.match(r);return!n||n.index===void 0?(console.error("patch: context limit: failed to find match"),null):n.index+n[0].indexOf("{")+1},br=e=>{const r=fr(e);if(!r)return null;const n="if(process.env.CLAUDE_CODE_CONTEXT_LIMIT)return Number(process.env.CLAUDE_CODE_CONTEXT_LIMIT);",t=e.slice(0,r)+n+e.slice(r);return Z(e,t,n,r,r),t},pr=e=>{const r=e.indexOf('bash:"bashBorder"');if(r===-1)return console.error("patch: input border: failed to find bash pattern"),null;const n=e.slice(r,r+500),t=/borderStyle:"[^"]*"/,i=n.match(t);return!i||i.index===void 0?(console.error("patch: input border: failed to find border style pattern"),null):{startIndex:r+i.index,endIndex:r+i.index+i[0].length}},wr=(e,r)=>{const n=pr(e);if(!n)return null;if(r){const t="borderColor:undefined",i=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return Z(e,i,t,n.startIndex,n.endIndex),i}else return e};function xr(e){const r=` ██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
6
180
  ██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝
7
181
  ██║ ██║ ███████║██║ ██║██║ ██║█████╗
8
182
  ██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
@@ -13,28 +187,30 @@ import{Box as d,Text as i,render as ir,useInput as ae,useStdout as sr}from"ink";
13
187
  ██║ ██║ ██║██║ ██║█████╗
14
188
  ██║ ██║ ██║██║ ██║██╔══╝
15
189
  ╚██████╗╚██████╔╝██████╔╝███████╗
16
- ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,r=e.indexOf(t);return r!==-1?{startIndex:r-1,endIndex:r+t.length+1}:null}function Or(e,t){const r=Nr(e);if(!r)return e;const n=JSON.stringify(t),s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s}const Ar=e=>{const t=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,r=e.match(t);if(!r||r.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const n=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,s=r[0].match(n);if(!s||s.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const l=r.index+s.index,c=l+s[0].length;return{startIndex:l,endIndex:c}},kr=e=>{const t=Ar(e);if(!t)return null;const r=e.slice(0,t.startIndex)+e.slice(t.endIndex);return q(e,r,"",t.startIndex,t.endIndex),r},Er=e=>{const t=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,r=e.match(t);if(!r||r.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const n=e.slice(r.index,r.index+600),s=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,l=n.match(s);return!l||l.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:r.index+l.index+l[1].length,endIndex:r.index+l.index+l[1].length+l[2].length,identifiers:[l[3]]}},Dr=(e,t)=>{const r=Er(e);if(!r)return null;const n=r,s=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),l=n.identifiers?.[0],h=`=${"`"+s.replace(/\{\}/g,"${"+l+"}")+"`"}`,u=e.slice(0,n.startIndex)+h+e.slice(n.endIndex);return q(e,u,h,n.startIndex,n.endIndex),u},Rr=e=>{const t=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,r=e.match(t);return!r||r.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Lr=(e,t)=>{const r=Rr(e);if(!r)return null;const n=r.identifiers?.[0],s=t?`=[...${n},...[...${n}].reverse()]`:`=[...${n}]`,l=e.slice(0,r.startIndex)+s+e.slice(r.endIndex);return q(e,l,s,r.startIndex,r.endIndex),l},Pr=e=>{const t=[],r=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let n;for(;(n=r.exec(e))!==null;)t.push({startIndex:n.index,endIndex:n.index+n[0].length});return t},Fr=(e,t)=>{const r=Pr(e);if(r.length===0)return null;const n=JSON.stringify(t),s=r.sort((c,h)=>h.startIndex-c.startIndex);let l=e;for(let c=0;c<s.length;c++){const h=l.slice(0,s[c].startIndex)+n+l.slice(s[c].endIndex);q(l,h,n,s[c].startIndex,s[c].endIndex),l=h}return l},Ur=e=>{const t=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,r=e.match(t);if(!r||r.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const n=r[0],s=r[1],l=n.lastIndexOf(s),c=r.index+l,h=c+s.length;return{startIndex:c,endIndex:h}},Vr=(e,t)=>{const r=Ur(e);if(!r)return null;const n=JSON.stringify(t),s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s},Gr=e=>{const t=/\{flexWrap:"wrap",height:1,width:2\}/,r=e.match(t);return!r||r.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length}},jr=(e,t)=>{const r=Gr(e);if(!r)return null;const n=`{flexWrap:"wrap",height:1,width:${t}}`,s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s},Yr=e=>{const t=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,r=e.match(t);return!r||r.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:r.index+1,endIndex:r.index+r[0].length,identifiers:[r[1]]}},Wr=e=>{const t=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,r=e.match(t);return!r||r.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:r.index,endIndex:r.index+r[0].length,identifiers:[r[1]]}},zr=(e,t)=>{const r=Yr(e);if(!r)return null;const n=r,s=n.identifiers?.[0],l=`${s}=${JSON.stringify({words:t})}`,c=e.slice(0,n.startIndex)+l+e.slice(n.endIndex);q(e,c,l,n.startIndex,n.endIndex);const h=Wr(c);if(!h)return null;const u=h,_=`function ${u.identifiers?.[0]}(){return ${s}.words}`,I=c.slice(0,u.startIndex)+_+c.slice(u.endIndex);return q(c,I,_,u.startIndex,u.endIndex),I},Hr=e=>{const t=e.indexOf("No content found in user prompt message")-700;if(t===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const r=Math.min(e.length,t+700),n=e.slice(t,r),s=/("> "),([$\w]+)/,l=n.match(s);if(!l)return{prefixLocation:null,messageLocation:null};const c=t+n.indexOf(l[1]),h=c+l[1].length,u=h+1,g=u+l[2].length;return{prefixLocation:{startIndex:c,endIndex:h},messageLocation:{startIndex:u,endIndex:g}}},Jr=(e,t,r,n,s=!1,l=!1,c=!1,h=!1,u=!1,g,_,I=!1,y=!1,v=!1,N=!1,L=!1)=>{const A=Hr(e);if(!A)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!A.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!A.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const P=qe(e);if(!P)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const W=[],X=r==="rgb(0,0,0)"&&n==="rgb(0,0,0)",F=!X||(s||l||c||h||u),re=g==="rgb(0,0,0)"&&_==="rgb(0,0,0)",Z=!re||(I||y||v||N||L);if(F){const C=He(P,X?null:r.match(/\d+/g)?.join(",")||null,X?null:n.match(/\d+/g)?.join(",")||null,s,l,c,h,u);W.push({startIndex:A.prefixLocation.startIndex,endIndex:A.prefixLocation.endIndex,newContent:`${C}("${t}")+" "`})}if(Z){const C=He(P,re?null:g.match(/\d+/g)?.join(",")||null,re?null:_.match(/\d+/g)?.join(",")||null,I,y,v,N,L);W.push({startIndex:A.messageLocation.startIndex,endIndex:A.messageLocation.endIndex,newContent:e.slice(A.messageLocation.startIndex,A.messageLocation.endIndex).replace(/([$\w]+)/,`${C}($1)`)})}W.sort((C,S)=>S.startIndex-C.startIndex);let O=e;for(const C of W){const S=O;O=O.slice(0,C.startIndex)+C.newContent+O.slice(C.endIndex),q(S,O,C.newContent,C.startIndex,C.endIndex)}return O},Xr=e=>{const t=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,r=e.match(t);if(!r||r.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const n=r[0],s=/verbose:[^,}]+/,l=n.match(s);if(!l||l.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const c=r.index+l.index,h=c+l[0].length;return{startIndex:c,endIndex:h}},Kr=e=>{const t=Xr(e);if(!t)return null;const r="verbose:true",n=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return q(e,n,r,t.startIndex,t.endIndex),n};function Zr(e){const t=/" Welcome to ",[$\w]+\.createElement\([^,]+,\{bold:!0\},"Claude Code"\),"!"/,r=e.match(t);if(r&&r.index!==void 0){const n=r[0].indexOf('"Claude Code"');if(n!==-1)return{startIndex:r.index+n,endIndex:r.index+n+13}}return null}function qr(e,t){const r=Zr(e);if(!r)return console.error("patch: welcome message: failed to find location"),null;const n=`"${t}"`,s=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return q(e,s,n,r.startIndex,r.endIndex),s}const Qr=e=>{const r=e.indexOf("subscription, no need to monitor cost");if(r===-1)return console.error("patch: ignoreMaxSubscription: phrase not found"),null;const n=Math.max(0,r-60),s=r,l=e.slice(n,s),c=/if\(([$\w]+)\(\)\)/g;let h=null;for(const _ of l.matchAll(c))h=_;if(!h||h.index===void 0)return console.error("patch: ignoreMaxSubscription: could not match if(<id>()) nearby"),null;const u=n+h.index,g=u+h[0].length;return{startIndex:u,endIndex:g}},en=e=>{const t=Qr(e);if(!t)return null;const r="if(!1)",n=e.slice(0,t.startIndex)+r+e.slice(t.endIndex);return q(e,n,r,t.startIndex,t.endIndex),n},rn=e=>{const t=/\}\.VERSION\} \(Claude Code\)/,r=e.match(t);if(!r||r.index===void 0)return null;const n=/,([$\w]+)\.createElement\(([$\w]+),null,\1\.createElement\(([$\w]+),\{dimColor:!0\}," L "\),\1\.createElement\(\3,null,"Session ID: ",[$\w]+\(\)\)\)/,s=e.match(n);if(!s||s.index===void 0)return null;const l=s.index+s[0].length;return{versionLocation:{startIndex:r.index,endIndex:r.index+r[0].length},sessionIdLocation:{startIndex:l,endIndex:l,identifiers:[s[1],s[2],s[3]]}}},nn=(e,t)=>{const r=rn(e);if(!r)return null;const{versionLocation:n,sessionIdLocation:s}=r,c=`${e.slice(n.startIndex,n.endIndex)}\\n${t} (tweakcc)`,h=e.slice(0,n.startIndex)+c+e.slice(n.endIndex);q(e,h,c,n.startIndex,n.endIndex);const[u,g,_]=s.identifiers,I=qe(e);if(!I)return console.error("patch: versionOutput: failed to find chalk variable"),null;const y=`,${u}.createElement(${g},null,${u}.createElement(${_},{dimColor:!0}," L "),${u}.createElement(${_},null,${I}.rgb(235, 109, 13).bold("tweakcc: v${t}")))`,v=e.slice(0,s.startIndex)+y+e.slice(s.endIndex);return q(e,v,y,s.startIndex,s.endIndex),v},q=(e,t,r,n,s)=>{const l=Math.max(0,n-20),c=Math.min(e.length,s+20),h=Math.min(t.length,n+r.length+20),u=e.slice(l,n),g=e.slice(n,s),_=e.slice(s,c),I=t.slice(l,n),y=t.slice(n,n+r.length),v=t.slice(n+r.length,h);oe()&&g!==y&&(console.log(`
17
- --- Diff ---`),console.log("OLD:",u+`\x1B[31m${g}\x1B[0m`+_),console.log("NEW:",I+`\x1B[32m${y}\x1B[0m`+v),console.log(`--- End Diff ---
18
- `))},qe=e=>{const t=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,r=Array.from(e.matchAll(t)),n={};for(const c of r){const h=c[1];n[h]=(n[h]||0)+1}let s,l=0;for(const[c,h]of Object.entries(n))h>l&&(l=h,s=c);return s},Qe=async(e,t)=>{await Ke(t);let r=await Se.readFile(t.cliPath,{encoding:"utf8"}),n=null;if(e.settings.themes&&e.settings.themes.length>0&&(n=vr(r,e.settings.themes))&&(r=n),e.settings.launchText){const s=e.settings.launchText;let l="";s.method==="custom"&&s.customText?l=s.customText:s.method==="figlet"&&s.figletText&&(l=await new Promise(h=>De.text(s.figletText.replace(`
19
- `," "),s.figletFont,(u,g)=>{u?(console.error("patch: figlet: failed to generate text",u),h("")):h(g||"")}))),(n=Or(r,l))&&(r=n);const c=s.method==="custom"?s.customText:s.figletText;c&&(n=qr(r,c))&&(r=n)}return e.settings.thinkingVerbs&&((n=zr(r,e.settings.thinkingVerbs.verbs))&&(r=n),(n=Dr(r,e.settings.thinkingVerbs.format))&&(r=n)),(n=Fr(r,e.settings.thinkingStyle.phases))&&(r=n),(n=Vr(r,e.settings.thinkingStyle.updateInterval))&&(r=n),(n=jr(r,Math.max(...e.settings.thinkingStyle.phases.map(s=>s.length))+1))&&(r=n),(n=Lr(r,e.settings.thinkingStyle.reverseMirror))&&(r=n),e.settings.userMessageDisplay&&(n=Jr(r,e.settings.userMessageDisplay.prefix.format,e.settings.userMessageDisplay.prefix.foreground_color,e.settings.userMessageDisplay.prefix.background_color,e.settings.userMessageDisplay.prefix.styling.includes("bold"),e.settings.userMessageDisplay.prefix.styling.includes("italic"),e.settings.userMessageDisplay.prefix.styling.includes("underline"),e.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),e.settings.userMessageDisplay.prefix.styling.includes("inverse"),e.settings.userMessageDisplay.message.foreground_color,e.settings.userMessageDisplay.message.background_color,e.settings.userMessageDisplay.message.styling.includes("bold"),e.settings.userMessageDisplay.message.styling.includes("italic"),e.settings.userMessageDisplay.message.styling.includes("underline"),e.settings.userMessageDisplay.message.styling.includes("strikethrough"),e.settings.userMessageDisplay.message.styling.includes("inverse")))&&(r=n),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(n=$r(r,e.settings.inputBox.removeBorder))&&(r=n),(n=Kr(r))&&(r=n),(n=kr(r))&&(r=n),(n=Mr(r))&&(r=n),(n=an(r))&&(r=n),(n=yr(r,25))&&(r=n),(n=en(r))&&(r=n),(n=nn(r,"1.6.0"))&&(r=n),await nr(t.cliPath,r,"patch"),await ve(s=>{s.changesApplied=!0})},Be=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],tn=e=>{const t=e.indexOf("Switch between Claude models");if(t===-1)return null;const r=Math.max(0,t-600),n=t,l=e.slice(r,n).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!l||l.index===void 0)return null;let h=r+l.index;for(;h<e.length&&e[h]!==";";)h++;if(h>=e.length)return null;const u=h+1,g=l[1];return{insertionIndex:u,optionsVar:g}},on=e=>{const t=tn(e);if(!t)return null;const{insertionIndex:r,optionsVar:n}=t,s=Be.map(c=>{const h=JSON.stringify(c.label),u=JSON.stringify(c.slug);return`${n}.push({value:${u},label:${h}});`}).join(""),l=e.slice(0,r)+s+e.slice(r);return q(e,l,s,r,r),l},sn=e=>{const t=e.match(/"sonnet\[1m\]"/);if(!t||t.index===void 0)return null;let n=t.index;for(;n>=0&&e[n]!=="[";)n--;if(n<0)return null;let s=n-1;for(;s>=0&&/\s/.test(e[s]);)s--;if(s<0||e[s]!=="=")return null;let l=n,c=0,h=-1;for(;l<e.length;){const N=e[l];if(N==="["&&c++,N==="]"&&(c--,c===0)){h=l;break}l++}if(h===-1)return null;const u=e.slice(n,h+1);let g;try{g=JSON.parse(u)}catch{return null}const _=Be.map(N=>N.slug),I=new Set(g);for(const N of _)I.add(N);const y=JSON.stringify(Array.from(I)),v=e.slice(0,n)+y+e.slice(h+1);return q(e,v,y,n,h+1),v},ln=e=>{const r=e.indexOf('case"sonnet[1m]"');if(r===-1)return null;let n=r;for(;n>=0&&e[n]!=="{";)n--;if(n<0)return null;let s=r;for(;s<e.length&&e[s]!=="}";)s++;if(s>=e.length)return null;const l=e.slice(n,s+1),c=Be.map(y=>`case${JSON.stringify(y.slug)}:return${JSON.stringify(y.internal)};`).join(""),h=l.slice(0,-1),g=(/;\s*$/.test(h)?"":";")+c,_=h+g+"}",I=e.slice(0,n)+_+e.slice(s+1);return q(e,I,c,n+l.length-1,n+l.length-1),I},an=e=>{let t=e;const r=sn(t);r&&(t=r);const n=ln(t);n&&(t=n);const s=on(t);return s&&(t=s),t===e?null:t};let er=!1;const oe=()=>er,cn=()=>{er=!0};function Me(){try{const e=fe.join(me.homedir(),".claude.json");return JSON.parse(Ce.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function dn(){try{const e=fe.join(me.homedir(),".claude",".credentials.json");switch(JSON.parse(Ce.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function gn(){try{const e=fe.join(me.homedir(),".claude","settings.json"),r=JSON.parse(Ce.readFileSync(e,"utf8"))?.model||"default";if(r==="opus")return"Opus 4.1";const n=Be.find(s=>s.slug===r);if(n)return n.label}catch{}return"Sonnet 4.5"}function ze(e){if(process.platform==="win32")Ne.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")Ne.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const t=fe.dirname(e);Ne.spawn("xdg-open",[t],{detached:!0,stdio:"ignore"}).unref()}}function Fe(e){if(!e||typeof e!="string")return!1;const t=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(t))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(t)){const r=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const[,n,s,l]=r;return parseInt(n)<=255&&parseInt(s)<=255&&parseInt(l)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(t)){const r=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const[,n,s,l]=r;return parseInt(n)<=360&&parseInt(s)<=100&&parseInt(l)<=100}}return!1}function rr(e){if(!Fe(e))return e;const t=e.trim();if(t.startsWith("rgb("))return t;if(t.startsWith("#")){let r=t.slice(1);r.length===3&&(r=r.split("").map(c=>c+c).join(""));const n=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),l=parseInt(r.slice(4,6),16);return`rgb(${n},${s},${l})`}if(t.startsWith("hsl(")){const r=t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r){const n=parseInt(r[1])/360,s=parseInt(r[2])/100,l=parseInt(r[3])/100,c=(y,v,N)=>(N<0&&(N+=1),N>1&&(N-=1),N<1/6?y+(v-y)*6*N:N<1/2?v:N<2/3?y+(v-y)*(2/3-N)*6:y),h=l<.5?l*(1+s):l+s-l*s,u=2*l-h,g=Math.round(c(u,h,n+1/3)*255),_=Math.round(c(u,h,n)*255),I=Math.round(c(u,h,n-1/3)*255);return`rgb(${g},${_},${I})`}}return e}async function hn(e,t="sha256",r=64*1024){return new Promise((n,s)=>{const l=hr.createHash(t),c=Ce.createReadStream(e,{highWaterMark:r});c.on("data",h=>{l.update(h)}),c.on("end",()=>{n(l.digest("hex"))}),c.on("error",h=>{s(h)})})}const He=(e,t,r,n,s,l,c,h)=>{let u=e;return t&&(u+=`.rgb(${t})`),r&&r!=="transparent"&&(u+=`.bgRgb(${r})`),n&&(u+=".bold"),s&&(u+=".italic"),l&&(u+=".underline"),c&&(u+=".strikethrough"),h&&(u+=".inverse"),u};async function nr(e,t,r="replace"){let n=493;try{n=(await Se.stat(e)).mode,oe()&&console.log(`[${r}] Original file mode for ${e}: ${(n&parseInt("777",8)).toString(8)}`)}catch(s){oe()&&console.log(`[${r}] Could not stat ${e} (error: ${s}), using default mode 755`)}try{await Se.unlink(e),oe()&&console.log(`[${r}] Unlinked ${e} to break hard links`)}catch(s){oe()&&console.log(`[${r}] Could not unlink ${e}: ${s}`)}await Se.writeFile(e,t),await Se.chmod(e,n),oe()&&console.log(`[${r}] Restored permissions to ${(n&parseInt("777",8)).toString(8)}`)}function R({color:e,backgroundColor:t,bold:r,dimColor:n,children:s}){const l=e?.startsWith("ansi:"),c=t?.startsWith("ansi:");if(l||c){if($e.Children.toArray(s).some(I=>$e.isValidElement(I)))return o(i,{children:s});let u=ur;if(l){const I=e.slice(5);u=u[I]||u}if(c){const I=t.slice(5),y=I.startsWith("bg")?I:`bg${I.charAt(0).toUpperCase()}${I.slice(1)}`;u=u[y]||u}r&&(u=u.bold),n&&(u=u.dim);const _=$e.Children.toArray(s).map(I=>typeof I=="string"||typeof I=="number"?String(I):"").join("");return o(i,{children:u(_)})}return o(i,{color:e,backgroundColor:t,bold:r,dimColor:n,children:s})}function un({text:e,nonShimmerColors:t,shimmerColors:r,shimmerWidth:n=3,updateDuration:s=50,restartPoint:l=10}){const[c,h]=M(0);return ie(()=>{const u=setInterval(()=>{h(g=>{const _=g+1;return _>=e.length+l?-n:_})},s);return()=>clearInterval(u)},[e.length,l,s]),t.length!==r.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),o(i,{children:e})):o(i,{children:e.split("").map((u,g)=>{const _=g>=c&&g<c+n&&c<e.length,I=g%t.length,y=_?r[I]:t[I];return o(i,{color:y,children:u},g)})})}const mn=gr.cwd();function tr({theme:e}){const{ccVersion:t}=ge(ce);return a(d,{flexDirection:"column",paddingLeft:1,children:[o(d,{marginBottom:1,children:a(i,{bold:!0,children:["Preview: ",e.name]})}),o(d,{borderStyle:"single",borderColor:"gray",paddingX:1,children:a(d,{flexDirection:"column",children:[a(d,{flexDirection:"column",children:[a(i,{children:[o(R,{color:e.colors.clawd_body,children:" ▐"}),o(i,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),a(i,{children:[o(R,{color:e.colors.clawd_body,children:"▌ "})," ",o(i,{bold:!0,children:"Claude Code"})," ",t?`v${t}`:"v2.0.14"]})]}),a(i,{children:[o(R,{color:e.colors.clawd_body,children:"▝▜"}),o(i,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),o(R,{color:e.colors.clawd_body,children:"▛▘"})," ",gn()," · ",dn()]}),a(R,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",mn]}),a(i,{children:[a(R,{color:e.colors.success,children:["Login successful. Press"," "]}),o(R,{bold:!0,color:e.colors.success,children:"Enter"}),a(R,{color:e.colors.success,children:[" ","to continue…"]})]})]}),o(i,{children:"╭─────────────────────────────────────────────╮"}),a(i,{children:["│ 1 function greet() ","{"," ","│"]}),a(i,{children:["│ 2"," ",o(R,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),o(R,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),o(R,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),a(i,{children:["│ 2"," ",o(R,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),o(R,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),o(R,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),o(R,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),a(R,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),a(i,{children:[o(R,{color:e.colors.warning,children:"│ "}),o(i,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),a(R,{color:e.colors.warning,children:[" ","│"]})]}),o(R,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),a(i,{children:[o(R,{color:e.colors.bashBorder,children:"!"}),o(i,{children:" ls"})]}),o(R,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),o(i,{children:a(i,{children:["> list the dir"," ",o(un,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),o(R,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),a(i,{children:[o(R,{color:e.colors.planMode,children:"│ "}),a(R,{color:e.colors.permission,children:["Ready to code?"," "]}),o(i,{children:"Here is Claude's plan:"}),a(R,{color:e.colors.planMode,children:[" ","│"]})]}),o(R,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),a(i,{children:[o(R,{color:e.colors.permission,children:"│ "}),o(i,{bold:!0,children:"Permissions:"})," ",a(R,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",o(R,{color:e.colors.permission,children:"│"})]}),o(i,{children:"> list the dir"}),a(i,{children:[o(R,{color:e.colors.error,children:"●"}),o(i,{children:" Update(__init__.py)"})]}),a(i,{children:[o(i,{children:" ⎿ "}),o(R,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),a(i,{children:[" ","1"," ",a(R,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),o(R,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),a(i,{children:[" ","2"," ",a(R,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),o(R,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),a(i,{children:[o(R,{color:e.colors.success,children:"●"}),o(i,{children:" List(.)"})]}),a(i,{children:[o(i,{children:"●"}),o(i,{children:" The directory "}),o(R,{color:e.colors.permission,children:"C:\\Users\\user"}),a(i,{children:[" ","contains ",o(i,{bold:!0,children:"123"})," files."]})]}),a(i,{children:[o(R,{color:e.colors.claude,children:"✻ Th"}),o(R,{color:e.colors.claudeShimmer,children:"ink"}),o(R,{color:e.colors.claude,children:"ing… "}),o(i,{children:"(esc to interrupt)"})]}),o(i,{children:o(R,{color:e.colors.autoAccept,children:"⏵⏵ auto-accept edits on (shift+tab to cycle)"})}),o(i,{children:o(R,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),o(i,{children:o(R,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Oe({colorKey:e,theme:t,bold:r=!1}){const n=t.colors[e];return e==="inverseText"?o(R,{color:n,backgroundColor:t.colors.permission,bold:r,children:e}):e.startsWith("diff")?o(R,{backgroundColor:n,bold:r,color:t.colors.text,children:e}):o(R,{color:n,bold:r,children:e})}function or({initialValue:e,onColorChange:t,onExit:r,colorKey:n,theme:s}){const l=ke(e)||{h:0,s:50,l:50},c=Ae(e)||{r:128,g:128,b:128},[h,u]=M(l),[g,_]=M(c),[I,y]=M("hsl"),[v,N]=M("h"),[L,A]=M(!1),[P,W]=M(!1);ie(()=>{const p=ke(e),b=Ae(e);p&&b&&(A(!0),u(p),_(b),A(!1))},[e]),ie(()=>{if(!L&&P){const p=`rgb(${g.r},${g.g},${g.b})`;t(p)}},[h,g,L,P]),ie(()=>{W(!0)},[]);const X=p=>{if(Fe(p)){const b=rr(p),f=ke(b),B=Ae(b);f&&B&&(A(!0),u(f),_(B),A(!1))}};ae((p,b)=>{if(p.length>1&&!b.ctrl&&!b.meta){X(p);return}if(b.return)r();else if(b.escape)r();else if(b.ctrl&&p==="a")y(f=>f==="hsl"?"rgb":"hsl"),N(f=>I==="hsl"?f==="h"?"r":f==="s"?"g":"b":f==="r"?"h":f==="g"?"s":"l");else if(b.upArrow)N(I==="hsl"?f=>f==="h"?"l":f==="s"?"h":"s":f=>f==="r"?"b":f==="g"?"r":"g");else if(b.downArrow||b.tab)N(I==="hsl"?f=>f==="h"?"s":f==="s"?"l":"h":f=>f==="r"?"g":f==="g"?"b":"r");else if(b.leftArrow){const f=b.shift||b.ctrl||b.meta?-10:-1;K(f)}else if(b.rightArrow){const f=b.shift||b.ctrl||b.meta?10:1;K(f)}});const K=p=>{A(!0),I==="hsl"?u(b=>{const f={...b};v==="h"?f.h=Math.max(0,Math.min(359,b.h+p)):v==="s"?f.s=Math.max(0,Math.min(100,b.s+p)):v==="l"&&(f.l=Math.max(0,Math.min(100,b.l+p)));const[B,m,w]=re(f.h,f.s,f.l);return _({r:B,g:m,b:w}),f}):_(b=>{const f={...b};v==="r"?f.r=Math.max(0,Math.min(255,b.r+p)):v==="g"?f.g=Math.max(0,Math.min(255,b.g+p)):v==="b"&&(f.b=Math.max(0,Math.min(255,b.b+p)));const B=F(f.r,f.g,f.b);return u(B),f}),A(!1)},F=(p,b,f)=>{const B=p/255,m=b/255,w=f/255,T=Math.max(B,m,w),x=Math.min(B,m,w),E=T-x,ee=(T+x)/2;let te=0;E!==0&&(te=ee>.5?E/(2-T-x):E/(T+x));let ne=0;return E!==0&&(T===B?ne=((m-w)/E+(m<w?6:0))/6:T===m?ne=((w-B)/E+2)/6:ne=((B-m)/E+4)/6),{h:Math.round(ne*360),s:Math.round(te*100),l:Math.round(ee*100)}},re=(p,b,f)=>{p/=360,b/=100,f/=100;const B=(1-Math.abs(2*f-1))*b,m=B*(1-Math.abs(p*6%2-1)),w=f-B/2;let T=0,x=0,E=0;return 0<=p&&p<1/6?(T=B,x=m,E=0):1/6<=p&&p<2/6?(T=m,x=B,E=0):2/6<=p&&p<3/6?(T=0,x=B,E=m):3/6<=p&&p<4/6?(T=0,x=m,E=B):4/6<=p&&p<5/6?(T=m,x=0,E=B):5/6<=p&&p<1&&(T=B,x=0,E=m),[Math.round((T+w)*255),Math.round((x+w)*255),Math.round((E+w)*255)]},Y=()=>{const p=[],b=[[255,0,0],[255,127,0],[255,255,0],[127,255,0],[0,255,0],[0,255,127],[0,255,255],[0,127,255],[0,0,255],[127,0,255],[255,0,255],[255,0,127],[255,0,0]];for(let f=0;f<40;f++){const m=f/39*(b.length-1),w=Math.floor(m),T=Math.ceil(m),x=m-w,[E,ee,te]=b[w],[ne,D,$]=b[T],k=Math.round(E+(ne-E)*x),H=Math.round(ee+(D-ee)*x),j=Math.round(te+($-te)*x);p.push(o(i,{backgroundColor:`rgb(${k},${H},${j})`,children:" "},f))}return p},Z=()=>{const p=[];for(let b=0;b<40;b++){const f=b/39*100,[B,m,w]=re(h.h,f,h.l);p.push(o(i,{backgroundColor:`rgb(${B},${m},${w})`,children:" "},b))}return p},O=()=>{const p=[];for(let b=0;b<40;b++){const f=b/39*100,[B,m,w]=re(h.h,h.s,f);p.push(o(i,{backgroundColor:`rgb(${B},${m},${w})`,children:" "},b))}return p},C=()=>{const[p,b,f]=re(h.h,h.s,h.l);return`rgb(${p},${b},${f})`},S=(p,b,f)=>{const B=m=>m.toString(16).padStart(2,"0");return`#${B(p)}${B(b)}${B(f)}`},U=()=>{const p=[];for(let b=0;b<40;b++){const f=Math.round(b/39*255);p.push(o(i,{backgroundColor:`rgb(${f},${g.g},${g.b})`,children:" "},b))}return p},V=()=>{const p=[];for(let b=0;b<40;b++){const f=Math.round(b/39*255);p.push(o(i,{backgroundColor:`rgb(${g.r},${f},${g.b})`,children:" "},b))}return p},Q=()=>{const p=[];for(let b=0;b<40;b++){const f=Math.round(b/39*255);p.push(o(i,{backgroundColor:`rgb(${g.r},${g.g},${f})`,children:" "},b))}return p},G=(p,b)=>Math.round(p/b*39);return a(d,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[a(d,{flexDirection:"column",children:[o(i,{bold:!0,children:"Color Picker"}),a(d,{marginBottom:1,flexDirection:"column",children:[o(i,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),o(i,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),o(i,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),o(i,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),o(i,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),o(i,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),I==="hsl"?a(se,{children:[a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="h"?"yellow":"white",children:[v==="h"?"❯ ":" ","Hue (",h.h,"°):"]})}),o(d,{children:Y().map((p,b)=>o(be,{children:b===G(h.h,360)?o(i,{children:"|"}):p},b))})]}),a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="s"?"yellow":"white",children:[v==="s"?"❯ ":" ","Saturation (",h.s,"%):"]})}),o(d,{children:Z().map((p,b)=>o(be,{children:b===G(h.s,100)?o(i,{children:"|"}):p},b))})]}),a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="l"?"yellow":"white",children:[v==="l"?"❯ ":" ","Lightness (",h.l,"%):"]})}),o(d,{children:O().map((p,b)=>o(be,{children:b===G(h.l,100)?o(i,{children:"|"}):p},b))})]})]}):a(se,{children:[a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="r"?"yellow":"white",children:[v==="r"?"❯ ":" ","Red (",g.r,"):"]})}),o(d,{children:U().map((p,b)=>o(be,{children:b===G(g.r,255)?o(i,{children:"|"}):p},b))})]}),a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="g"?"yellow":"white",children:[v==="g"?"❯ ":" ","Green (",g.g,"):"]})}),o(d,{children:V().map((p,b)=>o(be,{children:b===G(g.g,255)?o(i,{children:"|"}):p},b))})]}),a(d,{marginBottom:1,children:[o(d,{width:25,children:a(i,{color:v==="b"?"yellow":"white",children:[v==="b"?"❯ ":" ","Blue (",g.b,"):"]})}),o(d,{children:Q().map((p,b)=>o(be,{children:b===G(g.b,255)?o(i,{children:"|"}):p},b))})]})]}),a(d,{marginBottom:1,children:[o(i,{children:"Current: "}),o(i,{backgroundColor:C(),children:" "})]}),a(d,{flexDirection:"row",justifyContent:"space-between",children:[a(d,{flexDirection:"column",children:[o(i,{dimColor:!0,children:"Hex "}),n?.startsWith("diff")?o(i,{backgroundColor:C(),color:s?.colors?.text||"white",bold:!0,children:S(g.r,g.g,g.b)}):n==="inverseText"?o(i,{color:C(),backgroundColor:s?.colors?.permission,bold:!0,children:S(g.r,g.g,g.b)}):o(i,{color:C(),bold:!0,children:S(g.r,g.g,g.b)})]}),a(d,{flexDirection:"column",children:[o(i,{dimColor:!0,children:"RGB "}),n?.startsWith("diff")?o(i,{backgroundColor:C(),color:s?.colors?.text||"white",bold:!0,children:`rgb(${g.r}, ${g.g}, ${g.b})`}):n==="inverseText"?o(i,{color:C(),backgroundColor:s?.colors?.permission,bold:!0,children:`rgb(${g.r}, ${g.g}, ${g.b})`}):o(i,{color:C(),bold:!0,children:`rgb(${g.r}, ${g.g}, ${g.b})`})]}),a(d,{flexDirection:"column",children:[o(i,{dimColor:!0,children:"HSL "}),n?.startsWith("diff")?o(i,{backgroundColor:C(),color:s?.colors?.text||"white",bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`}):n==="inverseText"?o(i,{color:C(),backgroundColor:s?.colors?.permission,bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`}):o(i,{color:C(),bold:!0,children:`hsl(${h.h}, ${h.s}%, ${h.l}%)`})]})]})]})}function Ae(e){const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};const r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){const n=r[1];return{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16)}}return null}function ke(e){const t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r){const s=parseInt(r[1])/255,l=parseInt(r[2])/255,c=parseInt(r[3])/255,h=Math.max(s,l,c),u=Math.min(s,l,c),g=h-u,_=(h+u)/2;let I=0;g!==0&&(I=_>.5?g/(2-h-u):g/(h+u));let y=0;return g!==0&&(h===s?y=((l-c)/g+(l<c?6:0))/6:h===l?y=((c-s)/g+2)/6:y=((s-l)/g+4)/6),{h:Math.round(y*360),s:Math.round(I*100),l:Math.round(_*100)}}const n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const s=n[1],l=parseInt(s.substr(0,2),16)/255,c=parseInt(s.substr(2,2),16)/255,h=parseInt(s.substr(4,2),16)/255,u=Math.max(l,c,h),g=Math.min(l,c,h),_=u-g,I=(u+g)/2;let y=0;_!==0&&(y=I>.5?_/(2-u-g):_/(u+g));let v=0;return _!==0&&(u===l?v=((c-h)/_+(c<h?6:0))/6:u===c?v=((h-l)/_+2)/6:v=((l-c)/_+4)/6),{h:Math.round(v*360),s:Math.round(y*100),l:Math.round(I*100)}}return{h:0,s:50,l:50}}function fn({onBack:e,themeId:t}){const{settings:{themes:r},updateSettings:n}=ge(ce),[s,l]=M(t),c=r.find(O=>O.id===s)||r[0],[h,u]=M("rgb"),[g,_]=M(0),[I,y]=M(null),[v,N]=M(null),[L,A]=M(""),[P,W]=M(""),X=Je(O=>{n(C=>{const S=C.themes.findIndex(U=>U.id===s);S!==-1&&O(C.themes[S])})},[s,n]),K=O=>{if(g>=2&&Fe(O)){const C=rr(O),S=g-2,U=F[S];X(V=>{V.colors[U]=C})}};ae((O,C)=>{if(I===null&&v===null){if(O.length>1&&!C.ctrl&&!C.meta){K(O);return}if(C.escape)e();else if(C.ctrl&&O==="a")u(S=>S==="rgb"?"hex":S==="hex"?"hsl":"rgb");else if(C.upArrow)_(S=>Math.max(0,S-1));else if(C.downArrow)_(S=>Math.min(F.length+1,S+1));else if(C.return)if(g===0)N("name"),A(c.name),W(c.name);else if(g===1)N("id"),A(c.id),W(c.id);else{const S=g-2,U=F[S],V=c.colors[U];y(S),A(V),W(V)}}else if(I!==null)C.ctrl&&O==="a"&&u(S=>S==="rgb"?"hex":S==="hex"?"hsl":"rgb");else if(v!==null)if(C.return){if(v==="id"){const S=s;l(L),n(U=>{const V=U.themes.findIndex(Q=>Q.id===S);V!==-1&&(U.themes[V].id=L)})}else X(S=>{S.name=L});N(null),A(""),W("")}else C.escape?(N(null),A(""),W("")):C.backspace||C.delete?A(S=>S.slice(0,-1)):O&&A(S=>S+O)});const F=Object.keys(c.colors),re=(O,C)=>{const S=O.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!S)return O;const U=parseInt(S[1]),V=parseInt(S[2]),Q=parseInt(S[3]);switch(C){case"hex":{const G=p=>p.toString(16).padStart(2,"0");return`#${G(U)}${G(V)}${G(Q)}`}case"hsl":{const G=U/255,p=V/255,b=Q/255,f=Math.max(G,p,b),B=Math.min(G,p,b),m=f-B,w=(f+B)/2;let T=0;m!==0&&(T=w>.5?m/(2-f-B):m/(f+B));let x=0;return m!==0&&(f===G?x=((p-b)/m+(p<b?6:0))/6:f===p?x=((b-G)/m+2)/6:x=((G-p)/m+4)/6),`hsl(${Math.round(x*360)}, ${Math.round(T*100)}%, ${Math.round(w*100)}%)`}case"rgb":default:return O}},Y=O=>({autoAccept:"Auto-accept mode indicator",bashBorder:"Bash command border",claude:"Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.",claudeShimmer:"Color used for the shimmering effect on the thinking verb.",claudeBlue_FOR_SYSTEM_SPINNER:"System spinner color (blue variant)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"System spinner shimmer color (blue variant)",permission:"Permission prompt color",permissionShimmer:"Permission prompt shimmer color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",promptBorder:"Input prompt border color",promptBorderShimmer:"Input prompt border shimmer color",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",inactive:"Inactive/dimmed text. Used for line numbers and less prominent text.",subtle:"Subtle text. Used for help text and secondary information.",suggestion:"Suggestion text color. Used for suggestions for theme names and various other things.",remember:"Remember/note color. Used for various text relating to memories.",background:"Background color for certain UI elements",success:"Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).",error:"Error indicator",warning:"Warning indicator",warningShimmer:"Warning shimmer color",diffAdded:"Added diff background",diffRemoved:"Removed diff background",diffAddedDimmed:"Added diff background (dimmed)",diffRemovedDimmed:"Removed diff background (dimmed)",diffAddedWord:"Added word highlight",diffRemovedWord:"Removed word highlight",diffAddedWordDimmed:"Added word highlight (dimmed)",diffRemovedWordDimmed:"Removed word highlight (dimmed)",red_FOR_SUBAGENTS_ONLY:"Red color for sub agents",blue_FOR_SUBAGENTS_ONLY:"Blue color for sub agents",green_FOR_SUBAGENTS_ONLY:"Green color for sub agents",yellow_FOR_SUBAGENTS_ONLY:"Yellow color for sub agents",purple_FOR_SUBAGENTS_ONLY:"Purple color for sub agents",orange_FOR_SUBAGENTS_ONLY:"Orange color for sub agents",pink_FOR_SUBAGENTS_ONLY:"Pink color for sub agents",cyan_FOR_SUBAGENTS_ONLY:"Cyan color for sub agents",professionalBlue:"Professional blue color for business contexts?",rainbow_red:'"ultrathink" rainbow - red',rainbow_orange:'"ultrathink" rainbow - orange',rainbow_yellow:'"ultrathink" rainbow - yellow',rainbow_green:'"ultrathink" rainbow - green',rainbow_blue:'"ultrathink" rainbow - blue',rainbow_indigo:'"ultrathink" rainbow - indigo',rainbow_violet:'"ultrathink" rainbow - violet',rainbow_red_shimmer:'"ultrathink" rainbow (shimmer) - red',rainbow_orange_shimmer:'"ultrathink" rainbow (shimmer) - orange',rainbow_yellow_shimmer:'"ultrathink" rainbow (shimmer) - yellow',rainbow_green_shimmer:'"ultrathink" rainbow (shimmer) - green',rainbow_blue_shimmer:'"ultrathink" rainbow (shimmer) - blue',rainbow_indigo_shimmer:'"ultrathink" rainbow (shimmer) - indigo',rainbow_violet_shimmer:'"ultrathink" rainbow (shimmer) - violet',clawd_body:'"Clawd" character body color',clawd_background:'"Clawd" character background color',userMessageBackground:"Background color for user messages",bashMessageBackgroundColor:"Background color for bash command output",memoryBackgroundColor:"Background color for memory/context information",rate_limit_fill:"Rate limit indicator fill color",rate_limit_empty:"Rate limit indicator empty/background color"})[O]||"",Z=Math.max(...F.map(O=>O.length));return a(d,{children:[a(d,{flexDirection:"column",width:"50%",children:[o(d,{children:a(de,{children:["Editing theme “",c.name,"” (",c.id,")"]})}),I===null&&v===null?a(se,{children:[a(d,{marginBottom:1,flexDirection:"column",children:[o(i,{dimColor:!0,children:"enter to edit theme name, id, or color"}),o(i,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),o(i,{dimColor:!0,children:"paste color from clipboard (when on color)"}),o(i,{dimColor:!0,children:"esc to go back"})]}),g<2?a(d,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[o(i,{bold:!0,children:g===0?"Theme Name":"Theme ID"}),o(i,{children:g===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):a(d,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:c.colors[F[g-2]],flexDirection:"column",paddingLeft:1,children:[o(Oe,{colorKey:F[g-2],theme:c,bold:!0}),o(i,{children:Y(F[g-2])})]}),a(d,{flexDirection:"column",children:[a(d,{children:[o(i,{color:g===0?"yellow":"white",children:g===0?"❯ ":" "}),o(i,{bold:!0,children:"Name: "}),o(i,{children:c.name})]}),a(d,{marginBottom:1,children:[o(i,{color:g===1?"yellow":"white",children:g===1?"❯ ":" "}),o(i,{bold:!0,children:"ID: "}),o(i,{children:c.id})]}),(()=>{if(g<2){const G=F.slice(0,20);return a(se,{children:[G.map((p,b)=>{const f=b+2;return a(d,{children:[o(i,{color:g===f?"yellow":"white",children:g===f?"❯ ":" "}),o(d,{width:Z+2,children:o(i,{children:o(Oe,{colorKey:p,theme:c,bold:!0})})}),o(R,{color:c.colors[p],children:re(c.colors[p],h)})]},p)}),F.length>20&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",F.length-20," more below"]})]})}const C=g-2,S=Math.max(0,C-Math.floor(20/2)),U=Math.min(F.length,S+20),V=Math.max(0,U-20),Q=F.slice(V,U);return a(se,{children:[V>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",V," more above"]}),Q.map((G,p)=>{const f=V+p+2;return a(d,{children:[o(i,{color:g===f?"yellow":"white",children:g===f?"❯ ":" "}),o(d,{width:Z+2,children:o(i,{children:o(Oe,{colorKey:G,theme:c,bold:!0})})}),o(R,{color:c.colors[G],children:re(c.colors[G],h)})]},G)}),U<F.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",F.length-U," more below"]})]})})()]})]}):v?a(d,{flexDirection:"column",marginTop:1,children:[a(i,{children:["Editing ",v==="name"?"theme name":"theme ID",":"]}),o(d,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:o(i,{children:L})}),o(i,{dimColor:!0,children:"enter to save, esc to cancel"})]}):o(or,{initialValue:P,colorKey:F[I],theme:c,onColorChange:O=>{A(O),X(C=>{C.colors[F[I]]=O})},onExit:()=>{X(O=>{O.colors[F[I]]=L}),y(null),A(""),W("")}})]}),o(d,{width:"50%",children:o(tr,{theme:c})})]})}function bn(e){return e.map(t=>`${t.name} (${t.id})`)}function pn({onBack:e}){const{settings:{themes:t},updateSettings:r}=ge(ce),[n,s]=M(0),[l,c]=M(null),[h,u]=M(!0),g=()=>{const L={colors:{...(t[0]||J.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};r(A=>{A.themes.push(L)}),c(L.id),u(!1)},_=N=>{t.length<=1||(r(L=>{L.themes=L.themes.filter(A=>A.id!==N)}),n>=t.length-1&&s(Math.max(0,t.length-2)))},I=()=>{r(N=>{N.themes=[...J.themes]}),s(0)};if(ae((N,L)=>{if(L.escape)e();else if(L.upArrow)s(A=>Math.max(0,A-1));else if(L.downArrow)s(A=>Math.min(t.length-1,A+1));else if(L.return){const A=t[n];A&&(c(A.id),u(!1))}else if(N==="n")g();else if(N==="d"){const A=t[n];A&&_(A.id)}else L.ctrl&&N==="r"&&I()},{isActive:h}),l)return o(fn,{themeId:l,onBack:()=>{c(null),u(!0)}});const y=bn(t),v=t.find(N=>y[n]?.includes(`(${N.id})`))||t[0];return t.length===0?o(d,{children:a(d,{flexDirection:"column",width:"100%",children:[o(de,{children:"Themes"}),a(d,{marginBottom:1,flexDirection:"column",children:[o(i,{dimColor:!0,children:"n to create a new theme"}),o(i,{dimColor:!0,children:"esc to go back"})]}),o(i,{children:"No themes available!"})]})}):a(d,{children:[a(d,{flexDirection:"column",width:"50%",children:[o(de,{children:"Themes"}),a(d,{marginBottom:1,flexDirection:"column",children:[o(i,{dimColor:!0,children:"n to create a new theme"}),o(i,{dimColor:!0,children:"d to delete a theme"}),o(i,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),o(i,{dimColor:!0,children:"enter to edit theme"}),o(i,{dimColor:!0,children:"esc to go back"})]}),o(d,{flexDirection:"column",children:y.map((N,L)=>a(i,{color:n===L?"yellow":void 0,children:[n===L?"❯ ":" ",N]},L))})]}),o(d,{width:"50%",children:o(tr,{theme:v})})]})}let Ee=["ANSI Shadow"];function wn({onBack:e}){const{stdout:t}=sr(),r=t?.columns||120,{settings:{launchText:{method:n,figletText:s,figletFont:l,customText:c},themes:h},updateSettings:u}=ge(ce),g=n==="figlet"?["method","text","font"]:["method","text"],[_,I]=M(0),y=g[_],[v,N]=M(n==="figlet"?0:1),[L,A]=M(Ee),[P,W]=M(Ee),[X,K]=M(""),[F,re]=M(!1),[Y,Z]=M(0),[O,C]=M(""),[S,U]=M(50),[V,Q]=M(!1),[G,p]=M(n==="figlet"?s:c),b=Me(),B=(h.find(w=>w.id===b)||h.find(w=>w.id==="dark"))?.colors.claude||"rgb(215,119,87)";ie(()=>{De.fonts((w,T)=>{if(!w&&T){const x=T.sort();A(x),W(x),Ee=x;const E=x.indexOf(l);Z(E>=0?E:x.indexOf("ANSI Shadow")||0)}})},[]),ie(()=>{m()},[n,s,l,c,G,V]);const m=()=>{if(n==="figlet")try{const w=V?G:s,T=De.textSync(w.replace(`
20
- `," "),{font:l}),x=Math.floor(r*.7),ee=T.split(`
21
- `).map($=>$.length>x?$.substring(0,x-3)+"…":$),te=ee.join(`
22
- `);C(te);const ne=Math.max(...ee.map($=>$.length)),D=Math.min(75,Math.max(50,Math.ceil(ne/r*100)));U(D+5)}catch{C("Error generating figlet text"),U(50)}else{const w=Math.floor(r*.6),E=(V?G:c).split(`
23
- `).map(D=>D.length>w?D.substring(0,w-3)+"...":D),ee=E.join(`
24
- `);C(ee);const te=Math.max(...E.map(D=>D.length)),ne=Math.min(75,Math.max(50,Math.ceil(te/r*100)));U(ne+5)}};return ie(()=>{if(X){const w=L.filter(T=>T.toLowerCase().includes(X.toLowerCase()));W(w),Z(0)}else{W(L);const w=L.indexOf(l);Z(w>=0?w:0)}},[X,L]),ie(()=>{if(!F){const w=P.indexOf(l);w>=0&&Z(w)}},[l,P,F]),ae((w,T)=>{if(V){T.return?(u(n==="figlet"?x=>{x.launchText.figletText=G}:x=>{x.launchText.customText=G}),Q(!1)):T.escape?(p(n==="figlet"?s:c),Q(!1)):T.backspace||T.delete?p(x=>x.slice(0,-1)):w&&p(x=>x+w);return}if(F){if(T.return)P.length>0&&u(x=>{x.launchText.figletFont=P[Y]}),re(!1),K("");else if(T.escape)re(!1),K("");else if(T.backspace||T.delete)K(x=>x.slice(0,-1));else if(T.upArrow){const x=Y>0?Y-1:P.length-1;Z(x),P.length>0&&u(E=>{E.launchText.figletFont=P[x]})}else if(T.downArrow){const x=Y<P.length-1?Y+1:0;Z(x),P.length>0&&u(E=>{E.launchText.figletFont=P[x]})}else w&&w.match(/^[a-zA-Z0-9\s\-_]$/)&&K(x=>x+w);return}if(T.escape)e();else if(T.return)y==="text"&&(p(n==="figlet"?s:c),Q(!0));else if(T.tab)T.shift?I(x=>x===0?g.length-1:x-1):I(x=>x===g.length-1?0:x+1);else if(T.upArrow){if(y==="method"){const x=v>0?v-1:1;N(x),u(E=>{E.launchText.method=x===0?"figlet":"custom"})}else if(y==="font"&&n==="figlet"){const x=Y>0?Y-1:P.length-1;Z(x),u(E=>{E.launchText.figletFont=P[x]})}}else if(T.downArrow){if(y==="method"){const x=v<1?v+1:0;N(x),u(E=>{E.launchText.method=x===0?"figlet":"custom"})}else if(y==="font"&&n==="figlet"){const x=Y<P.length-1?Y+1:0;Z(x),u(E=>{E.launchText.figletFont=P[x]})}}else w&&y==="font"&&n==="figlet"&&w.match(/^[a-zA-Z0-9]$/)&&(re(!0),K(w))}),a(d,{children:[a(d,{flexDirection:"column",width:`${100-S}%`,children:[a(d,{marginBottom:1,flexDirection:"column",children:[o(de,{children:"Setup banner"}),a(d,{flexDirection:"column",children:[a(i,{dimColor:!0,children:["enter to ",y==="text"?"edit text":"save"]}),o(i,{dimColor:!0,children:"esc to go back"}),o(i,{dimColor:!0,children:"tab to switch sections"})]})]}),o(d,{children:a(i,{children:[o(i,{color:y==="method"?"yellow":void 0,children:y==="method"?"❯ ":" "}),o(i,{bold:!0,color:y==="method"?"yellow":void 0,children:"Method"})]})}),y==="method"&&a(i,{dimColor:!0,children:[" ","select one of ",P.length," Figlet fonts or enter your own text"]}),o(d,{marginLeft:2,marginBottom:1,children:a(d,{flexDirection:"column",children:[a(i,{color:v===0?"cyan":"white",children:[v===0?"❯ ":" ","Figlet"]}),a(i,{color:v===1?"cyan":"white",children:[v===1?"❯ ":" ","Custom"]})]})}),a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:y==="text"?"yellow":void 0,children:y==="text"?"❯ ":" "}),o(i,{bold:!0,color:y==="text"?"yellow":void 0,children:"Text"})]}),y==="text"&&(V?a(i,{dimColor:!0,children:[" ","esc to save"]}):a(i,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{borderStyle:"round",borderColor:V?"yellow":"gray",children:o(i,{children:V?G:n==="figlet"?s:c})})}),n==="figlet"&&a(se,{children:[o(d,{children:a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:y==="font"?"yellow":void 0,children:y==="font"?"❯ ":" "}),o(i,{bold:!0,color:y==="font"?"yellow":void 0,children:"Font"})]}),y==="font"&&a(i,{dimColor:!0,children:[" ","type to filter"]}),o(i,{children:F&&a(i,{color:"gray",dimColor:!0,children:[" ","(filtering: “",X,"”)"]})})]})}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{flexDirection:"column",children:(()=>{const T=Math.max(0,Y-Math.floor(4)),x=Math.min(P.length,T+8),E=Math.max(0,x-8),ee=P.slice(E,x);return a(se,{children:[E>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",E," more above"]}),ee.map((te,ne)=>{const D=E+ne;return a(i,{color:Y===D?"cyan":void 0,children:[Y===D?"❯ ":" ",te]},te)}),x<P.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",P.length-x," more below"]})]})})()})})]})]}),a(d,{width:`${S}%`,flexDirection:"column",children:[o(d,{marginBottom:1,children:o(i,{bold:!0,children:"Preview"})}),a(d,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:[a(d,{flexDirection:"column",marginBottom:1,children:[o(i,{color:B,children:"╭──────────────────────────╮"}),a(i,{children:[o(i,{color:B,children:"│ ✻"})," Welcome to Claude Code"," ",o(i,{color:B,children:"│"})]}),o(i,{color:B,children:"╰──────────────────────────╯"})]}),O.split(`
25
- `).map((w,T)=>o(i,{color:B,children:w},T)),o(d,{marginTop:1,children:o(i,{wrap:"truncate-end",children:"Claude Code can now be used with your Claude subscription or billed based on API usage through your Console account."})})]})]})]})}function xn({onBack:e}){const{settings:{thinkingVerbs:{format:t,verbs:r},themes:n},updateSettings:s}=ge(ce),l=["format","verbs"],[c,h]=M(0),u=l[c],[g,_]=M(0),[I,y]=M(!1),[v,N]=M(""),[L,A]=M(!1),[P,W]=M(!1),[X,K]=M(t),F=Me(),Y=(n.find(O=>O.id===F)||n.find(O=>O.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae((O,C)=>{if(P){C.return?(s(S=>{S.thinkingVerbs.format=X}),W(!1)):C.escape?(K(t),W(!1)):C.backspace||C.delete?K(S=>S.slice(0,-1)):O&&K(S=>S+O);return}if(I||L){C.return&&v.trim()?(L?(s(S=>{S.thinkingVerbs.verbs.push(v.trim())}),A(!1)):(s(S=>{S.thinkingVerbs.verbs[g]=v.trim()}),y(!1)),N("")):C.escape?(N(""),y(!1),A(!1)):C.backspace||C.delete?N(S=>S.slice(0,-1)):O&&N(S=>S+O);return}C.escape?e():C.return?u==="format"&&(K(t),W(!0)):C.tab?C.shift?h(S=>S===0?l.length-1:S-1):h(S=>S===l.length-1?0:S+1):C.upArrow?u==="verbs"&&r.length>0&&_(S=>S>0?S-1:r.length-1):C.downArrow?u==="verbs"&&r.length>0&&_(S=>S<r.length-1?S+1:0):O==="e"&&u==="verbs"?r.length>0&&(N(r[g]),y(!0)):O==="d"&&u==="verbs"?r.length>1&&(s(S=>{S.thinkingVerbs.verbs=S.thinkingVerbs.verbs.filter((U,V)=>V!==g)}),g>=r.length-1&&_(Math.max(0,r.length-2))):O==="n"&&u==="verbs"?(A(!0),N("")):C.ctrl&&O==="r"&&u==="verbs"&&(s(S=>{S.thinkingVerbs.verbs=[...J.thinkingVerbs.verbs]}),_(0))});const Z=50;return a(d,{children:[a(d,{flexDirection:"column",width:`${100-Z}%`,children:[a(d,{marginBottom:1,flexDirection:"column",children:[o(de,{children:"Thinking Verbs"}),a(d,{flexDirection:"column",children:[o(i,{dimColor:!0,children:u==="format"?"enter to edit format":"changes auto-saved"}),o(i,{dimColor:!0,children:"esc to go back"}),o(i,{dimColor:!0,children:"tab to switch sections"})]})]}),o(d,{marginBottom:1,children:o(i,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:u==="format"?"yellow":void 0,children:u==="format"?"❯ ":" "}),o(i,{bold:!0,color:u==="format"?"yellow":void 0,children:"Format"})]}),u==="format"&&(P?a(i,{dimColor:!0,children:[" ","enter to save"]}):a(i,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{borderStyle:"round",borderColor:P?"yellow":"gray",children:o(i,{children:P?X:t})})}),o(d,{children:a(i,{children:[o(i,{color:u==="verbs"?"yellow":void 0,children:u==="verbs"?"❯ ":" "}),o(i,{bold:!0,color:u==="verbs"?"yellow":void 0,children:"Verbs"})]})}),u==="verbs"&&o(d,{flexDirection:"column",children:a(i,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),o(d,{marginLeft:2,marginBottom:1,children:a(d,{flexDirection:"column",children:[(()=>{const C=Math.max(0,g-Math.floor(4)),S=Math.min(r.length,C+8),U=Math.max(0,S-8),V=r.slice(U,S);return a(se,{children:[U>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),V.map((Q,G)=>{const p=U+G;return a(i,{color:u==="verbs"&&p===g?"cyan":void 0,children:[u==="verbs"&&p===g?"❯ ":" ",Q]},p)}),S<r.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",r.length-S," more below"]})]})})(),L&&a(d,{alignItems:"center",children:[o(i,{color:"yellow",children:"❯ "}),o(d,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:v})})]}),I&&a(d,{marginTop:1,alignItems:"center",children:[o(i,{children:"Editing: "}),o(d,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:v})})]})]})})]}),a(d,{width:`${Z}%`,flexDirection:"column",children:[o(d,{marginBottom:1,children:o(i,{bold:!0,children:"Preview"})}),o(d,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:a(i,{children:[a(i,{color:Y,children:["✻ ",t.replace(/\{\}/g,r[g])," "]}),o(i,{children:"(esc to interrupt)"})]})})]})]})}const ue=[{name:"Default",phases:J.thinkingStyle.phases,reverseMirror:J.thinkingStyle.reverseMirror},{name:"Basic",phases:["|","/","-","\\"],reverseMirror:!1},{name:"Braille",phases:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],reverseMirror:!1},{name:"Circle",phases:["◐","◓","◑","◒"],reverseMirror:!1},{name:"Wave",phases:["▁","▃","▄","▅","▆","▇","█"],reverseMirror:!0},{name:"Glow",phases:["░","▒","▓","█"],reverseMirror:!0},{name:"Partial block",phases:["▏","▎","▍","▌","▋","▊","▉","█"],reverseMirror:!0},{name:"Clock",phases:["🕛","🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚"],reverseMirror:!1},{name:"Globe",phases:["🌍","🌎","🌏"],reverseMirror:!1},{name:"Arc",phases:["◜","◠","◝","◞","◡","◟"],reverseMirror:!1},{name:"Triangle",phases:["◤","◥","◢","◣"],reverseMirror:!1},{name:"Bouncing",phases:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"],reverseMirror:!1},{name:"Dots",phases:[".","..","..."],reverseMirror:!1},{name:"Colors",phases:["🔴","🟠","🟡","🟢","🔵","🟣"],reverseMirror:!1}];function _n({onBack:e}){const{settings:{thinkingStyle:{phases:t,updateInterval:r,reverseMirror:n},themes:s},updateSettings:l}=ge(ce),c=["reverseMirror","updateInterval","phases","presets"],[h,u]=M(0),g=c[h],[_,I]=M(0),[y,v]=M(0),[N,L]=M(!1),[A,P]=M(""),[W,X]=M(!1),[K,F]=M(!1),[re,Y]=M(r.toString()),[Z,O]=M(0),C=Me(),U=(s.find(f=>f.id===C)||s.find(f=>f.id==="dark"))?.colors.claude||"rgb(215,119,87)";ie(()=>{if(t.length>0){const f=n?[...t,...[...t].reverse().slice(1,-1)]:t,B=setInterval(()=>{O(m=>(m+1)%f.length)},r);return()=>clearInterval(B)}},[t,r,n]),ae((f,B)=>{if(K){if(B.return){const m=parseInt(re);!isNaN(m)&&m>0&&l(w=>{w.thinkingStyle.updateInterval=m}),F(!1)}else B.escape?(Y(r.toString()),F(!1)):B.backspace||B.delete?Y(m=>m.slice(0,-1)):f&&f.match(/^[0-9]$/)&&Y(m=>m+f);return}if(N||W){if(B.return&&A.length){const m=W?[...t,A]:t.map((w,T)=>T===_?A:w);l(w=>{w.thinkingStyle.phases=m}),L(!1),P("")}else B.escape?(P(""),L(!1),X(!1)):B.backspace||B.delete?P(m=>m.slice(0,-1)):f&&P(m=>m+f);return}if(B.escape)e();else if(B.return)if(g==="updateInterval")Y(r.toString()),F(!0);else if(g==="presets"){const m=ue[y];l(w=>{w.thinkingStyle.phases=[...m.phases],w.thinkingStyle.reverseMirror=m.reverseMirror})}else g==="reverseMirror"&&l(m=>{m.thinkingStyle.reverseMirror=!m.thinkingStyle.reverseMirror});else if(B.tab)B.shift?u(m=>m===0?c.length-1:m-1):u(m=>m===c.length-1?0:m+1);else if(B.upArrow)g==="phases"&&t.length>0?I(m=>m>0?m-1:t.length-1):g==="presets"&&v(m=>m>0?m-1:ue.length-1);else if(B.downArrow)g==="phases"&&t.length>0?I(m=>m<t.length-1?m+1:0):g==="presets"&&v(m=>m<ue.length-1?m+1:0);else if(f===" ")g==="reverseMirror"&&l(m=>{m.thinkingStyle.reverseMirror=!m.thinkingStyle.reverseMirror});else if(f==="e"&&g==="phases")t.length>0&&(P(t[_]),L(!0));else if(f==="a"&&g==="phases")X(!0),P("");else if(f==="d"&&g==="phases")t.length>1&&(l(m=>{m.thinkingStyle.phases=t.filter((w,T)=>T!==_)}),_>=t.length&&I(Math.max(0,t.length-1)));else if(f==="w"&&g==="phases"){if(_>0){const m=[...t];[m[_-1],m[_]]=[m[_],m[_-1]],l(w=>{w.thinkingStyle.phases=m}),I(w=>w-1)}}else if(f==="s"&&g==="phases"){if(_<t.length-1){const m=[...t];[m[_],m[_+1]]=[m[_+1],m[_]],l(w=>{w.thinkingStyle.phases=m}),I(w=>w+1)}}else B.ctrl&&f==="r"&&(l(m=>{m.thinkingStyle=J.thinkingStyle}),I(0),v(0))});const V=n?"●":"○",Q=50,p=n?[...t,...[...t].reverse().slice(1,-1)]:t,b=p.length>0?p[Z]:"·";return o(d,{children:a(d,{flexDirection:"column",width:"100%",children:[a(d,{flexDirection:"row",width:"100%",children:[a(d,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[o(de,{children:"Thinking style"}),a(d,{flexDirection:"column",children:[a(i,{dimColor:!0,children:["enter to"," ",g==="updateInterval"?"edit interval":g==="presets"?"apply preset":"save"]}),o(i,{dimColor:!0,children:"esc to go back"}),o(i,{dimColor:!0,children:"tab to switch sections"})]})]}),a(d,{width:`${Q}%`,flexDirection:"column",children:[o(d,{children:o(i,{bold:!0,children:"Preview"})}),a(d,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[o(d,{width:(b?.length??0)+1,children:o(i,{color:U,children:b})}),a(i,{children:[o(i,{color:U,children:"Thinking… "}),o(i,{children:"(esc to interrupt)"})]})]})]})]}),a(d,{flexDirection:"row",gap:4,children:[a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:g==="reverseMirror"?"yellow":void 0,children:g==="reverseMirror"?"❯ ":" "}),o(i,{bold:!0,color:g==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),g==="reverseMirror"&&a(i,{dimColor:!0,children:[" ","space to toggle"]}),o(d,{marginLeft:2,marginBottom:1,children:a(i,{children:[V," ",n?"Enabled":"Disabled"]})})]}),a(d,{flexDirection:"column",children:[a(i,{children:[o(i,{color:g==="updateInterval"?"yellow":void 0,children:g==="updateInterval"?"❯ ":" "}),o(i,{bold:!0,color:g==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),g==="updateInterval"&&(K?a(i,{dimColor:!0,children:[" ","enter to save"]}):a(i,{dimColor:!0,children:[" ","enter to edit"]})),o(d,{marginLeft:2,marginBottom:1,children:o(d,{borderStyle:"round",borderColor:K?"yellow":"gray",children:o(i,{children:K?re:r})})})]})]}),o(d,{children:a(i,{children:[o(i,{color:g==="phases"?"yellow":void 0,children:g==="phases"?"❯ ":" "}),o(i,{bold:!0,color:g==="phases"?"yellow":void 0,children:"Phases"})]})}),g==="phases"&&o(d,{marginBottom:1,flexDirection:"column",children:a(i,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),o(d,{marginLeft:2,marginBottom:1,children:a(d,{flexDirection:"column",children:[(()=>{const B=Math.max(0,_-Math.floor(4)),m=Math.min(t.length,B+8),w=Math.max(0,m-8),T=t.slice(w,m);return a(se,{children:[w>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),T.map((x,E)=>{const ee=w+E;return a(i,{color:g==="phases"&&ee===_?"cyan":void 0,children:[g==="phases"&&ee===_?"❯ ":" ",x]},ee)}),m<t.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",t.length-m," more below"]})]})})(),W&&a(d,{children:[o(i,{color:"yellow",children:"❯ "}),o(d,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:A})})]}),N&&a(d,{marginTop:1,children:[o(i,{children:"Editing: "}),o(d,{borderStyle:"round",borderColor:"yellow",children:o(i,{children:A})})]})]})}),o(d,{children:a(i,{children:[o(i,{color:g==="presets"?"yellow":void 0,children:g==="presets"?"❯ ":" "}),o(i,{bold:!0,color:g==="presets"?"yellow":void 0,children:"Presets"})]})}),g==="presets"&&a(i,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{flexDirection:"column",children:(()=>{const B=Math.max(0,y-Math.floor(4)),m=Math.min(ue.length,B+8),w=Math.max(0,m-8),T=ue.slice(w,m);return a(se,{children:[w>0&&a(i,{color:"gray",dimColor:!0,children:[" ","↑ ",w," more above"]}),T.map((x,E)=>{const ee=w+E;return a(i,{color:g==="presets"&&ee===y?"cyan":void 0,children:[g==="presets"&&ee===y?"❯ ":" ",x.name," ",x.phases.join("")]},ee)}),m<ue.length&&a(i,{color:"gray",dimColor:!0,children:[" ","↓ ",ue.length-m," more below"]})]})})()})}),o(d,{marginTop:1,children:o(i,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const _e=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function Sn({onBack:e}){const{settings:t,updateSettings:r}=ge(ce),[n,s]=M("prefix"),[l,c]=M(0),[h,u]=M(!1),[g,_]=M(()=>t.userMessageDisplay.prefix.format),[I,y]=M(0),[v,N]=M(()=>[...t.userMessageDisplay.prefix.styling]),[L,A]=M(()=>t.userMessageDisplay.prefix.foreground_color),[P,W]=M(()=>t.userMessageDisplay.prefix.background_color),[X,K]=M(0),[F,re]=M(0),[Y,Z]=M(()=>[...t.userMessageDisplay.message.styling]),[O,C]=M(()=>t.userMessageDisplay.message.foreground_color),[S,U]=M(()=>t.userMessageDisplay.message.background_color),[V,Q]=M(null),[G,p]=M(""),b=Me(),f=t.themes?.find(D=>D.id===b)||t.themes?.[0],B=["format","styling","foreground","background"],m=["styling","foreground","background"],w=B[l],T=m[X],x=(D,$)=>{r(k=>{const H=D==="prefix"?k.userMessageDisplay.prefix:k.userMessageDisplay.message;$(H)})},E=D=>{r($=>{D==="prefix"?$.userMessageDisplay.prefix={...J.userMessageDisplay.prefix}:$.userMessageDisplay.message={...J.userMessageDisplay.message}}),D==="prefix"?(_(J.userMessageDisplay.prefix.format),N([...J.userMessageDisplay.prefix.styling]),A(J.userMessageDisplay.prefix.foreground_color),W(J.userMessageDisplay.prefix.background_color)):(Z([...J.userMessageDisplay.message.styling]),C(J.userMessageDisplay.message.foreground_color),U(J.userMessageDisplay.message.background_color))};ie(()=>{const D=t.userMessageDisplay.prefix;_(D.format),N([...D.styling]),A(D.foreground_color),W(D.background_color);const $=t.userMessageDisplay.message;Z([...$.styling]),C($.foreground_color),U($.background_color)},[]),ae((D,$)=>{if(h){if($.return)x("prefix",k=>{k.format=g}),u(!1);else if($.escape){const k=t.userMessageDisplay.prefix;_(k.format),u(!1)}else $.backspace||$.delete?_(k=>k.slice(0,-1)):D&&_(k=>k+D);return}if(V===null){if($.escape)e();else if($.ctrl&&D==="r")E(n);else if($.leftArrow||$.rightArrow)s(k=>k==="prefix"?"message":"prefix");else if($.tab)n==="prefix"?$.shift?c(k=>k===0?B.length-1:k-1):c(k=>k===B.length-1?0:k+1):$.shift?K(k=>k===0?m.length-1:k-1):K(k=>k===m.length-1?0:k+1);else if($.return)n==="prefix"?w==="format"?u(!0):w==="foreground"?(p(L),Q({column:"prefix",type:"foreground"})):w==="background"&&(p(P),Q({column:"prefix",type:"background"})):T==="foreground"?(p(O),Q({column:"message",type:"foreground"})):T==="background"&&(p(S),Q({column:"message",type:"background"}));else if($.upArrow)n==="prefix"&&w==="styling"?y(k=>Math.max(0,k-1)):n==="message"&&T==="styling"&&re(k=>Math.max(0,k-1));else if($.downArrow)n==="prefix"&&w==="styling"?y(k=>Math.min(_e.length-1,k+1)):n==="message"&&T==="styling"&&re(k=>Math.min(_e.length-1,k+1));else if(D===" "){if(n==="prefix"&&w==="styling"){const k=_e[I].value,H=v.indexOf(k)>=0?v.filter(j=>j!==k):[...v,k];N(H),x("prefix",j=>{j.styling=[...H]})}else if(n==="message"&&T==="styling"){const k=_e[F].value,H=Y.indexOf(k)>=0?Y.filter(j=>j!==k):[...Y,k];Z(H),x("message",j=>{j.styling=[...H]})}}}});const ee=(D,$,k=!0)=>{const H=k?$==="prefix"?v:Y:[],j=k?$==="prefix"?L:O:"rgb(255,255,255)",we=k?$==="prefix"?P:S:"rgb(0,0,0)",xe=j==="rgb(0,0,0)"&&we==="rgb(0,0,0)",ye=H.length>0;return xe&&!ye?o(i,{children:D}):o(i,{bold:H.includes("bold"),italic:H.includes("italic"),underline:H.includes("underline"),strikethrough:H.includes("strikethrough"),inverse:H.includes("inverse"),color:xe?void 0:j,backgroundColor:xe?void 0:we,children:D})},te=(D=!0)=>a(i,{children:[g&&a(se,{children:[ee(g,"prefix",D)," "]}),ee("list the dir","message",D)]}),ne=D=>{const $=n===D,j=(D==="prefix"?B:m)[D==="prefix"?l:X],we=D==="prefix"?I:F,xe=D==="prefix"?v:Y,ye=D==="prefix"?L:O,Ue=D==="prefix"?P:S;return a(d,{flexDirection:"column",width:"45%",borderStyle:$?"round":"single",borderColor:$?"yellow":"gray",padding:1,children:[o(d,{marginBottom:1,children:a(i,{bold:!0,color:$?"yellow":void 0,children:[D.charAt(0).toUpperCase()+D.slice(1)," ","Configuration"]})}),D==="prefix"&&a(se,{children:[o(d,{children:a(i,{color:$&&j==="format"?"yellow":void 0,bold:$&&j==="format",children:[$&&j==="format"?"❯ ":" ","Prefix Text"]})}),$&&j==="format"&&o(d,{marginLeft:2,children:o(i,{dimColor:!0,children:h?"enter to save":"enter to edit (appears before message)"})}),o(d,{marginLeft:2,marginBottom:1,children:o(d,{borderStyle:"round",borderColor:h?"yellow":"gray",children:o(i,{children:g})})})]}),o(d,{children:a(i,{color:$&&j==="styling"?"yellow":void 0,bold:$&&j==="styling",children:[$&&j==="styling"?"❯ ":" ","Styling"]})}),$&&j==="styling"&&o(d,{marginLeft:2,children:o(i,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),o(d,{marginLeft:2,marginBottom:1,flexDirection:"column",children:_e.map((Te,Ve)=>o(d,{children:a(i,{color:$&&j==="styling"&&we===Ve?"cyan":void 0,children:[$&&j==="styling"&&we===Ve?"❯ ":" ",xe.includes(Te.value)?"●":"○"," ",Te.label]})},Te.value))}),o(d,{children:a(i,{color:$&&j==="foreground"?"yellow":void 0,bold:$&&j==="foreground",children:[$&&j==="foreground"?"❯ ":" ","Foreground color"]})}),$&&j==="foreground"&&o(d,{marginLeft:2,children:o(i,{dimColor:!0,children:"enter to open color picker"})}),o(d,{marginLeft:2,marginBottom:1,children:o(i,{color:ye,children:ye})}),o(d,{children:a(i,{color:$&&j==="background"?"yellow":void 0,bold:$&&j==="background",children:[$&&j==="background"?"❯ ":" ","Background color"]})}),$&&j==="background"&&o(d,{marginLeft:2,children:o(i,{dimColor:!0,children:"enter to open color picker"})}),o(d,{marginLeft:2,children:o(i,{backgroundColor:Ue,children:Ue})})]})};if(V){const{column:D,type:$}=V;return o(or,{initialValue:G,theme:f,onColorChange:k=>{D==="prefix"?$==="foreground"?(A(k),x("prefix",H=>{H.foreground_color=k})):(W(k),x("prefix",H=>{H.background_color=k})):$==="foreground"?(C(k),x("message",H=>{H.foreground_color=k})):(U(k),x("message",H=>{H.background_color=k}))},onExit:()=>{Q(null),p("")}})}return a(d,{flexDirection:"column",children:[o(de,{children:"Customize how user messages are displayed"}),a(d,{flexDirection:"column",marginBottom:1,children:[o(i,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),o(i,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),a(d,{flexDirection:"row",gap:1,children:[ne("prefix"),ne("message")]}),o(d,{borderStyle:"round",padding:1,marginTop:1,children:a(d,{flexDirection:"column",children:[o(d,{marginBottom:1,children:o(i,{bold:!0,children:"Preview"})}),a(d,{flexDirection:"row",gap:2,children:[a(d,{flexDirection:"column",width:"50%",children:[o(d,{marginBottom:1,children:o(i,{underline:!0,children:"Before (Claude Code default):"})}),o(d,{marginLeft:1,marginTop:1,children:a(i,{children:[o(i,{color:f?.colors?.inactive||"#888888",children:"●"}),o(i,{children:" The directory "}),o(i,{color:f?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(i,{children:" contains "}),o(i,{bold:!0,children:"123"}),o(i,{children:" files."})]})})]}),a(d,{flexDirection:"column",width:"50%",children:[o(d,{marginBottom:1,children:o(i,{underline:!0,children:"After (Your customization):"})}),o(d,{marginLeft:1,children:te(!0)}),o(d,{marginLeft:1,marginTop:1,children:a(i,{children:[o(i,{color:f?.colors?.inactive||"#888888",children:"●"}),o(i,{children:" The directory "}),o(i,{color:f?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(i,{children:" contains "}),o(i,{bold:!0,children:"123"}),o(i,{children:" files."})]})})]})]})]})})]})}function In({onSubmit:e}){const{settings:t,updateSettings:r}=ge(ce),[n,s]=M(0),l=()=>{r(h=>{h.inputBox||(h.inputBox={removeBorder:!1}),h.inputBox.removeBorder=!h.inputBox.removeBorder})};ae((h,u)=>{u.return||u.escape?e():h===" "&&n===0&&l()});const c=t.inputBox?.removeBorder?"☑":"☐";return a(d,{flexDirection:"column",children:[o(d,{marginBottom:1,children:o(de,{children:"Input Box Settings"})}),o(d,{marginBottom:1,children:a(i,{color:"gray",children:[o(i,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",o(i,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),o(d,{children:a(i,{children:[o(i,{color:n===0?"cyan":void 0,children:n===0?"❯ ":" "}),o(i,{bold:!0,color:n===0?"cyan":void 0,children:"Remove border"})]})}),n===0&&o(d,{marginBottom:1,flexDirection:"column",children:a(i,{dimColor:!0,children:[" ","space to toggle"]})}),o(d,{marginLeft:2,marginBottom:1,children:a(i,{children:[c," ",t.inputBox?.removeBorder?"Enabled":"Disabled"]})}),o(d,{marginBottom:1,children:o(i,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const ce=ar({settings:J,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function yn({startupCheckInfo:e}){const[t,r]=M({settings:J,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});ie(()=>{(async()=>{r(await Pe())})()},[]);const n=Je(_=>{const I=JSON.parse(JSON.stringify(t.settings));_(I),r(y=>({...y,settings:I,changesApplied:!1})),ve(y=>{y.settings=I,y.changesApplied=!1})},[t.settings]),[s,l]=M(null),[c,h]=M(null);ie(()=>{e.wasUpdated&&e.oldVersion&&(h({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
26
- (However, your customization are still remembered in ${le}.)
27
- Please reapply your changes below.`,type:"warning"}),n(()=>{}))},[]),ae((_,I)=>{(I.ctrl&&_==="c"||(_==="q"||I.escape)&&!s)&&process.exit(0)},{isActive:!s});const u=_=>{switch(h(null),_){case z.THEMES:case z.LAUNCH_TEXT:case z.THINKING_VERBS:case z.THINKING_STYLE:case z.USER_MESSAGE_DISPLAY:case z.INPUT_BOX:l(_);break;case z.APPLY_CHANGES:e.ccInstInfo&&(h({message:"Applying patches...",type:"info"}),Qe(t,e.ccInstInfo).then(I=>{r(I),h({message:"Customization patches applied successfully!",type:"success"})}));break;case z.RESTORE_ORIGINAL:e.ccInstInfo&&Ke(e.ccInstInfo).then(()=>{h({message:"Original Claude Code restored successfully!",type:"success"}),n(()=>{})});break;case z.OPEN_CONFIG:ze(le);break;case z.OPEN_CLI:e.ccInstInfo&&ze(e.ccInstInfo.cliPath);break;case z.EXIT:process.exit(0)}},g=()=>{l(null)};return o(ce.Provider,{value:{settings:t.settings,updateSettings:n,changesApplied:t.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:o(d,{flexDirection:"column",children:s===null?o(xr,{onSubmit:u,notification:c}):s===z.THEMES?o(pn,{onBack:g}):s===z.LAUNCH_TEXT?o(wn,{onBack:g}):s===z.THINKING_VERBS?o(xn,{onBack:g}):s===z.THINKING_STYLE?o(_n,{onBack:g}):s===z.USER_MESSAGE_DISPLAY?o(Sn,{onBack:g}):s===z.INPUT_BOX?o(In,{onSubmit:g}):null})})}const Cn=async()=>{const e=new lr;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("1.6.0").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const t=e.opts();if(t.debug&&cn(),t.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${le}`);try{const n=await Pe();(!n.settings||Object.keys(n.settings).length===0)&&(console.error("No saved customizations found in "+le),process.exit(1));const s=await We();(!s||!s.ccInstInfo)&&(console.error("Cannot find Claude Code's cli.js"),console.error("Searched at the following locations:"),Re.forEach(l=>{l.isGlob?l.expandedPaths.length===0?console.error(` - ${l.pattern} (no matches)`):(console.error(` - ${l.pattern}`),l.expandedPaths.forEach(c=>{console.error(` - ${c}`)})):console.error(` - ${l.pattern}`)}),process.exit(1)),console.log(`Found Claude Code at: ${s.ccInstInfo.cliPath}`),console.log(`Version: ${s.ccInstInfo.version}`),console.log("Applying customizations..."),await Qe(n,s.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}catch(n){console.error("Unexpected error:"),console.error(n instanceof Error?n.message:String(n)),process.exit(1)}}const r=await We();r?ir(o(yn,{startupCheckInfo:r})):(console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
190
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝`,n=e.indexOf(r);return n!==-1?{startIndex:n-1,endIndex:n+r.length+1}:null}function Sr(e,r){const n=xr(e);if(!n)return e;const t=JSON.stringify(r),i=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return Z(e,i,t,n.startIndex,n.endIndex),i}const yr=e=>{const r=/\b[$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},\d+\)/,n=e.match(r);if(!n||n.index===void 0)return console.error("patch: spinner no-freeze: failed to find wholeMatch"),null;const t=/if\(![$\w]+\)\{[$\w]+\(\d+\);return\}/,i=n[0].match(t);if(!i||i.index===void 0)return console.error("patch: spinner no-freeze: failed to find freeze condition"),null;const s=n.index+i.index,a=s+i[0].length;return{startIndex:s,endIndex:a}},_r=e=>{const r=yr(e);if(!r)return null;const n=e.slice(0,r.startIndex)+e.slice(r.endIndex);return Z(e,n,"",r.startIndex,r.endIndex),n},vr=e=>{const r=/spinnerTip:[$\w]+,(?:[$\w]+:[$\w]+,)*overrideMessage:[$\w]+,.{300}/,n=e.match(r);if(!n||n.index==null)return console.error("patch: thinker format: failed to find approxAreaMatch"),null;const t=e.slice(n.index,n.index+600),i=/([$\w]+)(=\(([^;]{1,200}?)\)\+"…")/,s=t.match(i);return!s||s.index==null?(console.error("patch: thinker format: failed to find formatMatch"),null):{startIndex:n.index+s.index+s[1].length,endIndex:n.index+s.index+s[1].length+s[2].length,identifiers:[s[3]]}},Ir=(e,r)=>{const n=vr(e);if(!n)return null;const t=n,i=r.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),s=t.identifiers?.[0],d=`=${"`"+i.replace(/\{\}/g,"${"+s+"}")+"`"}`,h=e.slice(0,t.startIndex)+d+e.slice(t.endIndex);return Z(e,h,d,t.startIndex,t.endIndex),h},Cr=e=>{const r=/=\s*\[\.\.\.([$\w]+),\s*\.\.\.?\[\.\.\.\1\]\.reverse\(\)\]/,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker symbol mirror option: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},$r=(e,r)=>{const n=Cr(e);if(!n)return null;const t=n.identifiers?.[0],i=r?`=[...${t},...[...${t}].reverse()]`:`=[...${t}]`,s=e.slice(0,n.startIndex)+i+e.slice(n.endIndex);return Z(e,s,i,n.startIndex,n.endIndex),s},Mr=e=>{const r=[],n=/\["[·✢*✳✶✻✽]",\s*(?:"[·✢*✳✶✻✽]",?\s*)+\]/g;let t;for(;(t=n.exec(e))!==null;)r.push({startIndex:t.index,endIndex:t.index+t[0].length});return r},Nr=(e,r)=>{const n=Mr(e);if(n.length===0)return null;const t=JSON.stringify(r),i=n.sort((a,d)=>d.startIndex-a.startIndex);let s=e;for(let a=0;a<i.length;a++){const d=s.slice(0,i[a].startIndex)+t+s.slice(i[a].endIndex);Z(s,d,t,i[a].startIndex,i[a].endIndex),s=d}return s},Br=e=>{const r=/[, ][$\w]+\(\(\)=>\{if\(![$\w]+\)\{[$\w]+\(\d+\);return\}[$\w]+\(\([^)]+\)=>[^)]+\+1\)\},(\d+)\)/,n=e.match(r);if(!n||n.index==null)return console.error("patch: thinker symbol speed: failed to find match"),null;const t=n[0],i=n[1],s=t.lastIndexOf(i),a=n.index+s,d=a+i.length;return{startIndex:a,endIndex:d}},kr=(e,r)=>{const n=Br(e);if(!n)return null;const t=JSON.stringify(r),i=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return Z(e,i,t,n.startIndex,n.endIndex),i},Or=e=>{const r=/\{flexWrap:"wrap",height:1,width:2\}/,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker symbol width: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length}},Tr=(e,r)=>{const n=Or(e);if(!n)return null;const t=`{flexWrap:"wrap",height:1,width:${r}}`,i=e.slice(0,n.startIndex)+t+e.slice(n.endIndex);return Z(e,i,t,n.startIndex,n.endIndex),i},Er=e=>{const r=/[, ]([$\w]+)=\{words:\[(?:"[^"{}()]+ing",)+"[^"{}()]+ing"\]\}/s,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find verbsMatch"),null):{startIndex:n.index+1,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Ar=e=>{const r=/function ([$\w]+)\(\)\{return [$\w]+\("tengu_spinner_words",[$\w]+\)\.words\}/,n=e.match(r);return!n||n.index==null?(console.error("patch: thinker verbs: failed to find match"),null):{startIndex:n.index,endIndex:n.index+n[0].length,identifiers:[n[1]]}},Dr=(e,r)=>{const n=Er(e);if(!n)return null;const t=n,i=t.identifiers?.[0],s=`${i}=${JSON.stringify({words:r})}`,a=e.slice(0,t.startIndex)+s+e.slice(t.endIndex);Z(e,a,s,t.startIndex,t.endIndex);const d=Ar(a);if(!d)return null;const h=d,m=`function ${h.identifiers?.[0]}(){return ${i}.words}`,f=a.slice(0,h.startIndex)+m+a.slice(h.endIndex);return Z(a,f,m,h.startIndex,h.endIndex),f},Lr=e=>{const r=e.indexOf("No content found in user prompt message")-700;if(r===-1)return console.error("patch: userMessageDisplay: failed to find error message"),null;const n=Math.min(e.length,r+700),t=e.slice(r,n),i=/("> "),([$\w]+)/,s=t.match(i);if(!s)return{prefixLocation:null,messageLocation:null};const a=r+t.indexOf(s[1]),d=a+s[1].length,h=d+1,c=h+s[2].length;return{prefixLocation:{startIndex:a,endIndex:d},messageLocation:{startIndex:h,endIndex:c}}},Pr=(e,r,n,t,i=!1,s=!1,a=!1,d=!1,h=!1,c,m,f=!1,S=!1,I=!1,C=!1,$=!1)=>{const M=Lr(e);if(!M)return console.error("patch: userMessageDisplay: getUserMessageDisplayLocation returned null"),null;if(!M.prefixLocation)return console.error("patch: userMessageDisplay: failed to find prefix location"),null;if(!M.messageLocation)return console.error("patch: userMessageDisplay: failed to find message location"),null;const F=Sn(e);if(!F)return console.error("patch: userMessageDisplay: failed to find chalk variable"),null;const B=[],Y=n==="rgb(0,0,0)"&&t==="rgb(0,0,0)",V=!Y||(i||s||a||d||h),ne=c==="rgb(0,0,0)"&&m==="rgb(0,0,0)",q=!ne||(f||S||I||C||$);if(V){const N=an(F,Y?null:n.match(/\d+/g)?.join(",")||null,Y?null:t.match(/\d+/g)?.join(",")||null,i,s,a,d,h);B.push({startIndex:M.prefixLocation.startIndex,endIndex:M.prefixLocation.endIndex,newContent:`${N}("${r}")+" "`})}if(q){const N=an(F,ne?null:c.match(/\d+/g)?.join(",")||null,ne?null:m.match(/\d+/g)?.join(",")||null,f,S,I,C,$);B.push({startIndex:M.messageLocation.startIndex,endIndex:M.messageLocation.endIndex,newContent:e.slice(M.messageLocation.startIndex,M.messageLocation.endIndex).replace(/([$\w]+)/,`${N}($1)`)})}B.sort((N,v)=>v.startIndex-N.startIndex);let A=e;for(const N of B){const v=A;A=A.slice(0,N.startIndex)+N.newContent+A.slice(N.endIndex),Z(v,A,N.newContent,N.startIndex,N.endIndex)}return A},Rr=e=>{const r=/createElement\([$\w]+,\{[^}]+spinnerTip[^}]+overrideMessage[^}]+\}/,n=e.match(r);if(!n||n.index===void 0)return console.error("patch: verbose: failed to find createElement with spinnerTip and overrideMessage"),null;const t=n[0],i=/verbose:[^,}]+/,s=t.match(i);if(!s||s.index===void 0)return console.error("patch: verbose: failed to find verbose property"),null;const a=n.index+s.index,d=a+s[0].length;return{startIndex:a,endIndex:d}},Fr=e=>{const r=Rr(e);if(!r)return null;const n="verbose:true",t=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return Z(e,t,n,r.startIndex,r.endIndex),t},Vr=e=>{const n=e.indexOf("subscription, no need to monitor cost");if(n===-1)return console.error("patch: ignoreMaxSubscription: phrase not found"),null;const t=Math.max(0,n-60),i=n,s=e.slice(t,i),a=/if\(([$\w]+)\(\)\)/g;let d=null;for(const m of s.matchAll(a))d=m;if(!d||d.index===void 0)return console.error("patch: ignoreMaxSubscription: could not match if(<id>()) nearby"),null;const h=t+d.index,c=h+d[0].length;return{startIndex:h,endIndex:c}},jr=e=>{const r=Vr(e);if(!r)return null;const n="if(!1)",t=e.slice(0,r.startIndex)+n+e.slice(r.endIndex);return Z(e,t,n,r.startIndex,r.endIndex),t},Ur=e=>{const r=/\}\.VERSION\} \(Claude Code\)/,n=e.match(r);if(!n||n.index===void 0)return null;const t=/,([$\w]+)\.createElement\(([$\w]+),null,\1\.createElement\(([$\w]+),\{dimColor:!0\}," L "\),\1\.createElement\(\3,null,"Session ID: ",[$\w]+\(\)\)\)/,i=e.match(t);if(!i||i.index===void 0)return null;const s=i.index+i[0].length;return{versionLocation:{startIndex:n.index,endIndex:n.index+n[0].length},sessionIdLocation:{startIndex:s,endIndex:s,identifiers:[i[1],i[2],i[3]]}}},Hr=(e,r)=>{const n=Ur(e);if(!n)return null;const{versionLocation:t,sessionIdLocation:i}=n,a=`${e.slice(t.startIndex,t.endIndex)}\\n${r} (tweakcc)`,d=e.slice(0,t.startIndex)+a+e.slice(t.endIndex);Z(e,d,a,t.startIndex,t.endIndex);const[h,c,m]=i.identifiers,f=Sn(e);if(!f)return console.error("patch: versionOutput: failed to find chalk variable"),null;const S=`,${h}.createElement(${c},null,${h}.createElement(${m},{dimColor:!0}," L "),${h}.createElement(${m},null,${f}.rgb(235, 109, 13).bold("tweakcc: v${r}")))`,I=e.slice(0,i.startIndex)+S+e.slice(i.endIndex);return Z(e,I,S,i.startIndex,i.endIndex),I},Gr=async(e,r)=>{const n=await lr(r);oe()&&console.log(`Loaded ${n.length} system prompts with regexes`);for(const{promptId:t,prompt:i,regex:s,getInterpolatedContent:a}of n){const d=new RegExp(s,"s"),h=e.match(d);if(h&&h.index!==void 0){const c=a(h);oe()&&(console.log(`
191
+ Found match for prompt: ${i.name}`),console.log(` Match location: index ${h.index}, length ${h[0].length}`),console.log(` Original content (first 100 chars): ${h[0].substring(0,100)}...`),console.log(` Replacement content (first 100 chars): ${c.substring(0,100)}...`),console.log(` Captured variables: ${h.slice(1).join(", ")}`),console.log(` Content identical: ${h[0]===c}`));const m=e,f=h.index,S=h[0].length;e=e.replace(d,c);const I=Te(i.content);await zn(t,I),oe()&&Z(m,e,c,f,f+S)}else if(console.log(te.yellow(`Could not find system prompt "${i.name}" in cli.js (using regex /${s}/)`)),oe()){console.log(`
192
+ Debug info for ${i.name}:`),console.log(` Regex pattern (first 200 chars): ${s.substring(0,200)}...`),console.log(" Trying to match pattern in cli.js...");const c=e.match(new RegExp(s.substring(0,100)));console.log(` Partial match result: ${c?"found partial":"no match"}`)}}return e},Z=(e,r,n,t,i)=>{const s=Math.max(0,t-20),a=Math.min(e.length,i+20),d=Math.min(r.length,t+n.length+20),h=e.slice(s,t),c=e.slice(t,i),m=e.slice(i,a),f=r.slice(s,t),S=r.slice(t,t+n.length),I=r.slice(t+n.length,d);oe()&&c!==S&&(console.log(`
193
+ --- Diff ---`),console.log("OLD:",h+`\x1B[31m${c}\x1B[0m`+m),console.log("NEW:",f+`\x1B[32m${S}\x1B[0m`+I),console.log(`--- End Diff ---
194
+ `))},Sn=e=>{const r=/\b([$\w]+)(?:\.(?:cyan|gray|green|red|yellow|ansi256|bgAnsi256|bgHex|bgRgb|hex|rgb|bold|dim|inverse|italic|strikethrough|underline)\b)+\(/g,n=Array.from(e.matchAll(r)),t={};for(const a of n){const d=a[1];t[d]=(t[d]||0)+1}let i,s=0;for(const[a,d]of Object.entries(t))d>s&&(s=d,i=a);return i},yn=async(e,r)=>{await wn(r);let n=await re.readFile(r.cliPath,{encoding:"utf8"});n=await Gr(n,r.version);let t=null;if(e.settings.themes&&e.settings.themes.length>0&&(t=mr(n,e.settings.themes))&&(n=t),e.settings.launchText){const i=e.settings.launchText;let s="";i.method==="custom"&&i.customText?s=i.customText:i.method==="figlet"&&i.figletText&&(s=await new Promise(a=>He.text(i.figletText.replace(`
195
+ `," "),i.figletFont,(d,h)=>{d?(console.error("patch: figlet: failed to generate text",d),a("")):a(h||"")}))),(t=Sr(n,s))&&(n=t)}return e.settings.thinkingVerbs&&((t=Dr(n,e.settings.thinkingVerbs.verbs))&&(n=t),(t=Ir(n,e.settings.thinkingVerbs.format))&&(n=t)),(t=Nr(n,e.settings.thinkingStyle.phases))&&(n=t),(t=kr(n,e.settings.thinkingStyle.updateInterval))&&(n=t),(t=Tr(n,Math.max(...e.settings.thinkingStyle.phases.map(i=>i.length))+1))&&(n=t),(t=$r(n,e.settings.thinkingStyle.reverseMirror))&&(n=t),e.settings.userMessageDisplay&&(t=Pr(n,e.settings.userMessageDisplay.prefix.format,e.settings.userMessageDisplay.prefix.foreground_color,e.settings.userMessageDisplay.prefix.background_color,e.settings.userMessageDisplay.prefix.styling.includes("bold"),e.settings.userMessageDisplay.prefix.styling.includes("italic"),e.settings.userMessageDisplay.prefix.styling.includes("underline"),e.settings.userMessageDisplay.prefix.styling.includes("strikethrough"),e.settings.userMessageDisplay.prefix.styling.includes("inverse"),e.settings.userMessageDisplay.message.foreground_color,e.settings.userMessageDisplay.message.background_color,e.settings.userMessageDisplay.message.styling.includes("bold"),e.settings.userMessageDisplay.message.styling.includes("italic"),e.settings.userMessageDisplay.message.styling.includes("underline"),e.settings.userMessageDisplay.message.styling.includes("strikethrough"),e.settings.userMessageDisplay.message.styling.includes("inverse")))&&(n=t),e.settings.inputBox&&typeof e.settings.inputBox.removeBorder=="boolean"&&(t=wr(n,e.settings.inputBox.removeBorder))&&(n=t),(t=Fr(n))&&(n=t),(t=_r(n))&&(n=t),(t=br(n))&&(n=t),(t=Xr(n))&&(n=t),(t=hr(n,25))&&(n=t),(t=jr(n))&&(n=t),(t=Hr(n,"2.0.1"))&&(n=t),await In(r.cliPath,n,"patch"),await Ee(i=>{i.changesApplied=!0})},Ae=[{label:"Opus 4.1",slug:"opus-4.1",internal:"claude-opus-4-1-20250805"},{label:"Opus 4",slug:"opus-4",internal:"claude-opus-4-20250514"},{label:"Sonnet 4",slug:"sonnet-4",internal:"claude-sonnet-4-20250514"},{label:"Sonnet 3.7",slug:"sonnet-3.7",internal:"claude-3-7-sonnet-20250219"},{label:"Sonnet 3.5 (October)",slug:"sonnet-3.5-october",internal:"claude-3-5-sonnet-20241022"},{label:"Sonnet 3.5 (June)",slug:"sonnet-3.5-june",internal:"claude-3-5-sonnet-20240620"},{label:"Haiku 3.5",slug:"haiku-3.5",internal:"claude-3-5-haiku-20241022"},{label:"Haiku 3",slug:"haiku-3",internal:"claude-3-haiku-20240307"},{label:"Opus 3",slug:"opus-3",internal:"claude-3-opus-20240229"}],Yr=e=>{const r=e.indexOf("Switch between Claude models");if(r===-1)return null;const n=Math.max(0,r-600),t=r,s=e.slice(n,t).match(/\[[$\w]+,\s*[$\w]+\]\s*=\s*[$\w]+\.useState\([^)]*\)\s*,\s*([$\w]+)=/);if(!s||s.index===void 0)return null;let d=n+s.index;for(;d<e.length&&e[d]!==";";)d++;if(d>=e.length)return null;const h=d+1,c=s[1];return{insertionIndex:h,optionsVar:c}},Wr=e=>{const r=Yr(e);if(!r)return null;const{insertionIndex:n,optionsVar:t}=r,i=Ae.map(a=>{const d=JSON.stringify(a.label),h=JSON.stringify(a.slug);return`${t}.push({value:${h},label:${d}});`}).join(""),s=e.slice(0,n)+i+e.slice(n);return Z(e,s,i,n,n),s},zr=e=>{const r=e.match(/"sonnet\[1m\]"/);if(!r||r.index===void 0)return null;let t=r.index;for(;t>=0&&e[t]!=="[";)t--;if(t<0)return null;let i=t-1;for(;i>=0&&/\s/.test(e[i]);)i--;if(i<0||e[i]!=="=")return null;let s=t,a=0,d=-1;for(;s<e.length;){const C=e[s];if(C==="["&&a++,C==="]"&&(a--,a===0)){d=s;break}s++}if(d===-1)return null;const h=e.slice(t,d+1);let c;try{c=JSON.parse(h)}catch{return null}const m=Ae.map(C=>C.slug),f=new Set(c);for(const C of m)f.add(C);const S=JSON.stringify(Array.from(f)),I=e.slice(0,t)+S+e.slice(d+1);return Z(e,I,S,t,d+1),I},Jr=e=>{const n=e.indexOf('case"sonnet[1m]"');if(n===-1)return null;let t=n;for(;t>=0&&e[t]!=="{";)t--;if(t<0)return null;let i=n;for(;i<e.length&&e[i]!=="}";)i++;if(i>=e.length)return null;const s=e.slice(t,i+1),a=Ae.map(S=>`case${JSON.stringify(S.slug)}:return${JSON.stringify(S.internal)};`).join(""),d=s.slice(0,-1),c=(/;\s*$/.test(d)?"":";")+a,m=d+c+"}",f=e.slice(0,t)+m+e.slice(i+1);return Z(e,f,a,t+s.length-1,t+s.length-1),f},Xr=e=>{let r=e;const n=zr(r);n&&(r=n);const t=Jr(r);t&&(r=t);const i=Wr(r);return i&&(r=i),r===e?null:r};let _n=!1;const oe=()=>_n,Kr=()=>{_n=!0};function De(){try{const e=se.join(xe.homedir(),".claude.json");return JSON.parse(Me.readFileSync(e,"utf8")).theme||"dark"}catch{}return"dark"}function qr(){try{const e=se.join(xe.homedir(),".claude",".credentials.json");switch(JSON.parse(Me.readFileSync(e,"utf8"))?.claudeAiOauth?.subscriptionType||"unknown"){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro"}}catch{}return"Claude API"}function Zr(){try{const e=se.join(xe.homedir(),".claude","settings.json"),n=JSON.parse(Me.readFileSync(e,"utf8"))?.model||"default";if(n==="opus")return"Opus 4.1";const t=Ae.find(i=>i.slug===n);if(t)return t.label}catch{}return"Sonnet 4.5"}function Qr(e){process.platform==="win32"?ye.spawn("explorer",[e],{detached:!0,stdio:"ignore"}).unref():process.platform==="darwin"?ye.spawn("open",[e],{detached:!0,stdio:"ignore"}).unref():ye.spawn("xdg-open",[e],{detached:!0,stdio:"ignore"}).unref()}function ln(e){if(process.platform==="win32")ye.spawn("explorer",["/select,",e],{detached:!0,stdio:"ignore"}).unref();else if(process.platform==="darwin")ye.spawn("open",["-R",e],{detached:!0,stdio:"ignore"}).unref();else{const r=se.dirname(e);ye.spawn("xdg-open",[r],{detached:!0,stdio:"ignore"}).unref()}}function Xe(e){if(!e||typeof e!="string")return!1;const r=e.trim();if(/^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/.test(r))return!0;if(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(r)){const n=r.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const[,t,i,s]=n;return parseInt(t)<=255&&parseInt(i)<=255&&parseInt(s)<=255}}if(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(r)){const n=r.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const[,t,i,s]=n;return parseInt(t)<=360&&parseInt(i)<=100&&parseInt(s)<=100}}return!1}function vn(e){if(!Xe(e))return e;const r=e.trim();if(r.startsWith("rgb("))return r;if(r.startsWith("#")){let n=r.slice(1);n.length===3&&(n=n.split("").map(a=>a+a).join(""));const t=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),s=parseInt(n.slice(4,6),16);return`rgb(${t},${i},${s})`}if(r.startsWith("hsl(")){const n=r.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(n){const t=parseInt(n[1])/360,i=parseInt(n[2])/100,s=parseInt(n[3])/100,a=(S,I,C)=>(C<0&&(C+=1),C>1&&(C-=1),C<1/6?S+(I-S)*6*C:C<1/2?I:C<2/3?S+(I-S)*(2/3-C)*6:S),d=s<.5?s*(1+i):s+i-s*i,h=2*s-d,c=Math.round(a(h,d,t+1/3)*255),m=Math.round(a(h,d,t)*255),f=Math.round(a(h,d,t-1/3)*255);return`rgb(${c},${m},${f})`}}return e}async function et(e,r="sha256",n=64*1024){return new Promise((t,i)=>{const s=dn.createHash(r),a=Me.createReadStream(e,{highWaterMark:n});a.on("data",d=>{s.update(d)}),a.on("end",()=>{t(s.digest("hex"))}),a.on("error",d=>{i(d)})})}const an=(e,r,n,t,i,s,a,d)=>{let h=e;return r&&(h+=`.rgb(${r})`),n&&n!=="transparent"&&(h+=`.bgRgb(${n})`),t&&(h+=".bold"),i&&(h+=".italic"),s&&(h+=".underline"),a&&(h+=".strikethrough"),d&&(h+=".inverse"),h};async function In(e,r,n="replace"){let t=493;try{t=(await re.stat(e)).mode,oe()&&console.log(`[${n}] Original file mode for ${e}: ${(t&parseInt("777",8)).toString(8)}`)}catch(i){oe()&&console.log(`[${n}] Could not stat ${e} (error: ${i}), using default mode 755`)}try{await re.unlink(e),oe()&&console.log(`[${n}] Unlinked ${e} to break hard links`)}catch(i){oe()&&console.log(`[${n}] Could not unlink ${e}: ${i}`)}await re.writeFile(e,r),await re.chmod(e,t),oe()&&console.log(`[${n}] Restored permissions to ${(t&parseInt("777",8)).toString(8)}`)}function R({color:e,backgroundColor:r,bold:n,dimColor:t,children:i}){const s=e?.startsWith("ansi:"),a=r?.startsWith("ansi:");if(s||a){if(Pe.Children.toArray(i).some(f=>Pe.isValidElement(f)))return o(l,{children:i});let h=te;if(s){const f=e.slice(5);h=h[f]||h}if(a){const f=r.slice(5),S=f.startsWith("bg")?f:`bg${f.charAt(0).toUpperCase()}${f.slice(1)}`;h=h[S]||h}n&&(h=h.bold),t&&(h=h.dim);const m=Pe.Children.toArray(i).map(f=>typeof f=="string"||typeof f=="number"?String(f):"").join("");return o(l,{children:h(m)})}return o(l,{color:e,backgroundColor:r,bold:n,dimColor:t,children:i})}function nt({text:e,nonShimmerColors:r,shimmerColors:n,shimmerWidth:t=3,updateDuration:i=50,restartPoint:s=10}){const[a,d]=O(0);return ae(()=>{const h=setInterval(()=>{d(c=>{const m=c+1;return m>=e.length+s?-t:m})},i);return()=>clearInterval(h)},[e.length,s,i]),r.length!==n.length?(console.error("UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length"),o(l,{children:e})):o(l,{children:e.split("").map((h,c)=>{const m=c>=a&&c<a+t&&a<e.length,f=c%r.length,S=m?n[f]:r[f];return o(l,{color:S,children:h},c)})})}const rt=En.cwd();function Cn({theme:e}){const{ccVersion:r}=be(he);return g(u,{flexDirection:"column",paddingLeft:1,children:[o(u,{marginBottom:1,children:g(l,{bold:!0,children:["Preview: ",e.name]})}),o(u,{borderStyle:"single",borderColor:"gray",paddingX:1,children:g(u,{flexDirection:"column",children:[g(u,{flexDirection:"column",children:[g(l,{children:[o(R,{color:e.colors.clawd_body,children:" ▐"}),o(l,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"▛███▜"}),g(l,{children:[o(R,{color:e.colors.clawd_body,children:"▌ "})," ",o(l,{bold:!0,children:"Claude Code"})," ",r?`v${r}`:"v2.0.14"]})]}),g(l,{children:[o(R,{color:e.colors.clawd_body,children:"▝▜"}),o(l,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:"█████"}),o(R,{color:e.colors.clawd_body,children:"▛▘"})," ",Zr()," · ",qr()]}),g(R,{color:e.colors.clawd_body,children:[" ","▘▘ ▝▝"," ",rt]}),g(l,{children:[g(R,{color:e.colors.success,children:["Login successful. Press"," "]}),o(R,{bold:!0,color:e.colors.success,children:"Enter"}),g(R,{color:e.colors.success,children:[" ","to continue…"]})]})]}),o(l,{children:"╭─────────────────────────────────────────────╮"}),g(l,{children:["│ 1 function greet() ","{"," ","│"]}),g(l,{children:["│ 2"," ",o(R,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:'- console.log("'}),o(R,{backgroundColor:e.colors.diffRemovedWord,children:"Hello, World!"}),o(R,{backgroundColor:e.colors.diffRemoved,children:'");'})," ","│"]}),g(l,{children:["│ 2"," ",o(R,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:'+ console.log("'}),o(R,{backgroundColor:e.colors.diffAddedWord,children:"Hello, Claude!"}),o(R,{backgroundColor:e.colors.diffAdded,children:'");'})," ","│"]}),o(R,{color:e.colors.warning,children:"╭─────────────────────────────────────────────╮"}),g(R,{color:e.colors.warning,children:["│ Do you trust the files in this folder?"," ","│"]}),g(l,{children:[o(R,{color:e.colors.warning,children:"│ "}),o(l,{dimColor:!0,children:"Enter to confirm · Esc to exit"}),g(R,{color:e.colors.warning,children:[" ","│"]})]}),o(R,{color:e.colors.bashBorder,children:"───────────────────────────────────────────────"}),g(l,{children:[o(R,{color:e.colors.bashBorder,children:"!"}),o(l,{children:" ls"})]}),o(R,{color:e.colors.promptBorder,children:"───────────────────────────────────────────────"}),o(l,{children:g(l,{children:["> list the dir"," ",o(nt,{text:"ultrathink",nonShimmerColors:[e.colors.rainbow_red,e.colors.rainbow_orange,e.colors.rainbow_yellow,e.colors.rainbow_green,e.colors.rainbow_blue,e.colors.rainbow_indigo,e.colors.rainbow_violet],shimmerColors:[e.colors.rainbow_red_shimmer,e.colors.rainbow_orange_shimmer,e.colors.rainbow_yellow_shimmer,e.colors.rainbow_green_shimmer,e.colors.rainbow_blue_shimmer,e.colors.rainbow_indigo_shimmer,e.colors.rainbow_violet_shimmer],shimmerWidth:3,updateDuration:50,restartPoint:10})]})}),o(R,{color:e.colors.planMode,children:"╭─────────────────────────────────────────────╮"}),g(l,{children:[o(R,{color:e.colors.planMode,children:"│ "}),g(R,{color:e.colors.permission,children:["Ready to code?"," "]}),o(l,{children:"Here is Claude's plan:"}),g(R,{color:e.colors.planMode,children:[" ","│"]})]}),o(R,{color:e.colors.permission,children:"╭─────────────────────────────────────────────╮"}),g(l,{children:[o(R,{color:e.colors.permission,children:"│ "}),o(l,{bold:!0,children:"Permissions:"})," ",g(R,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[" ","Allow"," "]})," ","Deny"," ","Workspace"," ",o(R,{color:e.colors.permission,children:"│"})]}),o(l,{children:"> list the dir"}),g(l,{children:[o(R,{color:e.colors.error,children:"●"}),o(l,{children:" Update(__init__.py)"})]}),g(l,{children:[o(l,{children:" ⎿ "}),o(R,{color:e.colors.error,children:"User rejected update to __init__.py"})]}),g(l,{children:[" ","1"," ",g(R,{backgroundColor:e.colors.diffRemovedDimmed,children:["- import"," "]}),o(R,{backgroundColor:e.colors.diffRemovedWordDimmed,children:"os"})]}),g(l,{children:[" ","2"," ",g(R,{backgroundColor:e.colors.diffAddedDimmed,children:["+ import"," "]}),o(R,{backgroundColor:e.colors.diffAddedWordDimmed,children:"random"})]}),g(l,{children:[o(R,{color:e.colors.success,children:"●"}),o(l,{children:" List(.)"})]}),g(l,{children:[o(l,{children:"●"}),o(l,{children:" The directory "}),o(R,{color:e.colors.permission,children:"C:\\Users\\user"}),g(l,{children:[" ","contains ",o(l,{bold:!0,children:"123"})," files."]})]}),g(l,{children:[o(R,{color:e.colors.claude,children:"✻ Th"}),o(R,{color:e.colors.claudeShimmer,children:"ink"}),o(R,{color:e.colors.claude,children:"ing… "}),o(l,{children:"(esc to interrupt)"})]}),o(l,{children:o(R,{color:e.colors.autoAccept,children:"⏵⏵ auto-accept edits on (shift+tab to cycle)"})}),o(l,{children:o(R,{color:e.colors.planMode,children:"⏸ plan mode on (shift+tab to cycle)"})}),o(l,{children:o(R,{color:e.colors.ide,children:"◯ IDE connected ⧉ 44 lines selected"})})]})})]})}function Fe({colorKey:e,theme:r,bold:n=!1}){const t=r.colors[e];return e==="inverseText"?o(R,{color:t,backgroundColor:r.colors.permission,bold:n,children:e}):e.startsWith("diff")?o(R,{backgroundColor:t,bold:n,color:r.colors.text,children:e}):o(R,{color:t,bold:n,children:e})}function $n({initialValue:e,onColorChange:r,onExit:n,colorKey:t,theme:i}){const s=je(e)||{h:0,s:50,l:50},a=Ve(e)||{r:128,g:128,b:128},[d,h]=O(s),[c,m]=O(a),[f,S]=O("hsl"),[I,C]=O("h"),[$,M]=O(!1),[F,B]=O(!1);ae(()=>{const x=je(e),w=Ve(e);x&&w&&(M(!0),h(x),m(w),M(!1))},[e]),ae(()=>{if(!$&&F){const x=`rgb(${c.r},${c.g},${c.b})`;r(x)}},[d,c,$,F]),ae(()=>{B(!0)},[]);const Y=x=>{if(Xe(x)){const w=vn(x),p=je(w),k=Ve(w);p&&k&&(M(!0),h(p),m(k),M(!1))}};ge((x,w)=>{if(x.length>1&&!w.ctrl&&!w.meta){Y(x);return}if(w.return)n();else if(w.escape)n();else if(w.ctrl&&x==="a")S(p=>p==="hsl"?"rgb":"hsl"),C(p=>f==="hsl"?p==="h"?"r":p==="s"?"g":"b":p==="r"?"h":p==="g"?"s":"l");else if(w.upArrow)C(f==="hsl"?p=>p==="h"?"l":p==="s"?"h":"s":p=>p==="r"?"b":p==="g"?"r":"g");else if(w.downArrow||w.tab)C(f==="hsl"?p=>p==="h"?"s":p==="s"?"l":"h":p=>p==="r"?"g":p==="g"?"b":"r");else if(w.leftArrow){const p=w.shift||w.ctrl||w.meta?-10:-1;j(p)}else if(w.rightArrow){const p=w.shift||w.ctrl||w.meta?10:1;j(p)}});const j=x=>{M(!0),f==="hsl"?h(w=>{const p={...w};I==="h"?p.h=Math.max(0,Math.min(359,w.h+x)):I==="s"?p.s=Math.max(0,Math.min(100,w.s+x)):I==="l"&&(p.l=Math.max(0,Math.min(100,w.l+x)));const[k,b,y]=ne(p.h,p.s,p.l);return m({r:k,g:b,b:y}),p}):m(w=>{const p={...w};I==="r"?p.r=Math.max(0,Math.min(255,w.r+x)):I==="g"?p.g=Math.max(0,Math.min(255,w.g+x)):I==="b"&&(p.b=Math.max(0,Math.min(255,w.b+x)));const k=V(p.r,p.g,p.b);return h(k),p}),M(!1)},V=(x,w,p)=>{const k=x/255,b=w/255,y=p/255,T=Math.max(k,b,y),_=Math.min(k,b,y),L=T-_,ee=(T+_)/2;let le=0;L!==0&&(le=ee>.5?L/(2-T-_):L/(T+_));let ie=0;return L!==0&&(T===k?ie=((b-y)/L+(b<y?6:0))/6:T===b?ie=((y-k)/L+2)/6:ie=((k-b)/L+4)/6),{h:Math.round(ie*360),s:Math.round(le*100),l:Math.round(ee*100)}},ne=(x,w,p)=>{x/=360,w/=100,p/=100;const k=(1-Math.abs(2*p-1))*w,b=k*(1-Math.abs(x*6%2-1)),y=p-k/2;let T=0,_=0,L=0;return 0<=x&&x<1/6?(T=k,_=b,L=0):1/6<=x&&x<2/6?(T=b,_=k,L=0):2/6<=x&&x<3/6?(T=0,_=k,L=b):3/6<=x&&x<4/6?(T=0,_=b,L=k):4/6<=x&&x<5/6?(T=b,_=0,L=k):5/6<=x&&x<1&&(T=k,_=0,L=b),[Math.round((T+y)*255),Math.round((_+y)*255),Math.round((L+y)*255)]},z=()=>{const x=[],w=[[255,0,0],[255,127,0],[255,255,0],[127,255,0],[0,255,0],[0,255,127],[0,255,255],[0,127,255],[0,0,255],[127,0,255],[255,0,255],[255,0,127],[255,0,0]];for(let p=0;p<40;p++){const b=p/39*(w.length-1),y=Math.floor(b),T=Math.ceil(b),_=b-y,[L,ee,le]=w[y],[ie,P,E]=w[T],D=Math.round(L+(ie-L)*_),X=Math.round(ee+(P-ee)*_),W=Math.round(le+(E-le)*_);x.push(o(l,{backgroundColor:`rgb(${D},${X},${W})`,children:" "},p))}return x},q=()=>{const x=[];for(let w=0;w<40;w++){const p=w/39*100,[k,b,y]=ne(d.h,p,d.l);x.push(o(l,{backgroundColor:`rgb(${k},${b},${y})`,children:" "},w))}return x},A=()=>{const x=[];for(let w=0;w<40;w++){const p=w/39*100,[k,b,y]=ne(d.h,d.s,p);x.push(o(l,{backgroundColor:`rgb(${k},${b},${y})`,children:" "},w))}return x},N=()=>{const[x,w,p]=ne(d.h,d.s,d.l);return`rgb(${x},${w},${p})`},v=(x,w,p)=>{const k=b=>b.toString(16).padStart(2,"0");return`#${k(x)}${k(w)}${k(p)}`},U=()=>{const x=[];for(let w=0;w<40;w++){const p=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${p},${c.g},${c.b})`,children:" "},w))}return x},H=()=>{const x=[];for(let w=0;w<40;w++){const p=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${c.r},${p},${c.b})`,children:" "},w))}return x},Q=()=>{const x=[];for(let w=0;w<40;w++){const p=Math.round(w/39*255);x.push(o(l,{backgroundColor:`rgb(${c.r},${c.g},${p})`,children:" "},w))}return x},G=(x,w)=>Math.round(x/w*39);return g(u,{flexDirection:"column",borderStyle:"single",borderColor:"white",padding:1,children:[g(u,{flexDirection:"column",children:[o(l,{bold:!0,children:"Color Picker"}),g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{color:"gray",dimColor:!0,children:"←→ to adjust (shift/ctrl/cmd +10)"}),o(l,{color:"gray",dimColor:!0,children:"↑↓ to change bar"}),o(l,{color:"gray",dimColor:!0,children:"ctrl+a to switch rgb/hsl"}),o(l,{color:"gray",dimColor:!0,children:"paste color from clipboard"}),o(l,{color:"gray",dimColor:!0,children:"enter to exit (auto-saved)"}),o(l,{color:"gray",dimColor:!0,children:"esc to save and exit"})]})]}),f==="hsl"?g(ce,{children:[g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="h"?"yellow":"white",children:[I==="h"?"❯ ":" ","Hue (",d.h,"°):"]})}),o(u,{children:z().map((x,w)=>o(Se,{children:w===G(d.h,360)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="s"?"yellow":"white",children:[I==="s"?"❯ ":" ","Saturation (",d.s,"%):"]})}),o(u,{children:q().map((x,w)=>o(Se,{children:w===G(d.s,100)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="l"?"yellow":"white",children:[I==="l"?"❯ ":" ","Lightness (",d.l,"%):"]})}),o(u,{children:A().map((x,w)=>o(Se,{children:w===G(d.l,100)?o(l,{children:"|"}):x},w))})]})]}):g(ce,{children:[g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="r"?"yellow":"white",children:[I==="r"?"❯ ":" ","Red (",c.r,"):"]})}),o(u,{children:U().map((x,w)=>o(Se,{children:w===G(c.r,255)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="g"?"yellow":"white",children:[I==="g"?"❯ ":" ","Green (",c.g,"):"]})}),o(u,{children:H().map((x,w)=>o(Se,{children:w===G(c.g,255)?o(l,{children:"|"}):x},w))})]}),g(u,{marginBottom:1,children:[o(u,{width:25,children:g(l,{color:I==="b"?"yellow":"white",children:[I==="b"?"❯ ":" ","Blue (",c.b,"):"]})}),o(u,{children:Q().map((x,w)=>o(Se,{children:w===G(c.b,255)?o(l,{children:"|"}):x},w))})]})]}),g(u,{marginBottom:1,children:[o(l,{children:"Current: "}),o(l,{backgroundColor:N(),children:" "})]}),g(u,{flexDirection:"row",justifyContent:"space-between",children:[g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"Hex "}),t?.startsWith("diff")?o(l,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:v(c.r,c.g,c.b)}):t==="inverseText"?o(l,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:v(c.r,c.g,c.b)}):o(l,{color:N(),bold:!0,children:v(c.r,c.g,c.b)})]}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"RGB "}),t?.startsWith("diff")?o(l,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:`rgb(${c.r}, ${c.g}, ${c.b})`}):t==="inverseText"?o(l,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:`rgb(${c.r}, ${c.g}, ${c.b})`}):o(l,{color:N(),bold:!0,children:`rgb(${c.r}, ${c.g}, ${c.b})`})]}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:"HSL "}),t?.startsWith("diff")?o(l,{backgroundColor:N(),color:i?.colors?.text||"white",bold:!0,children:`hsl(${d.h}, ${d.s}%, ${d.l}%)`}):t==="inverseText"?o(l,{color:N(),backgroundColor:i?.colors?.permission,bold:!0,children:`hsl(${d.h}, ${d.s}%, ${d.l}%)`}):o(l,{color:N(),bold:!0,children:`hsl(${d.h}, ${d.s}%, ${d.l}%)`})]})]})]})}function Ve(e){const r=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(r)return{r:parseInt(r[1]),g:parseInt(r[2]),b:parseInt(r[3])};const n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){const t=n[1];return{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16)}}return null}function je(e){const r=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(r)return{h:parseInt(r[1]),s:parseInt(r[2]),l:parseInt(r[3])};const n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){const i=parseInt(n[1])/255,s=parseInt(n[2])/255,a=parseInt(n[3])/255,d=Math.max(i,s,a),h=Math.min(i,s,a),c=d-h,m=(d+h)/2;let f=0;c!==0&&(f=m>.5?c/(2-d-h):c/(d+h));let S=0;return c!==0&&(d===i?S=((s-a)/c+(s<a?6:0))/6:d===s?S=((a-i)/c+2)/6:S=((i-s)/c+4)/6),{h:Math.round(S*360),s:Math.round(f*100),l:Math.round(m*100)}}const t=e.match(/^#([a-fA-F0-9]{6})$/);if(t){const i=t[1],s=parseInt(i.substr(0,2),16)/255,a=parseInt(i.substr(2,2),16)/255,d=parseInt(i.substr(4,2),16)/255,h=Math.max(s,a,d),c=Math.min(s,a,d),m=h-c,f=(h+c)/2;let S=0;m!==0&&(S=f>.5?m/(2-h-c):m/(h+c));let I=0;return m!==0&&(h===s?I=((a-d)/m+(a<d?6:0))/6:h===a?I=((d-s)/m+2)/6:I=((s-a)/m+4)/6),{h:Math.round(I*360),s:Math.round(S*100),l:Math.round(f*100)}}return{h:0,s:50,l:50}}function tt({onBack:e,themeId:r}){const{settings:{themes:n},updateSettings:t}=be(he),[i,s]=O(r),a=n.find(A=>A.id===i)||n[0],[d,h]=O("rgb"),[c,m]=O(0),[f,S]=O(null),[I,C]=O(null),[$,M]=O(""),[F,B]=O(""),Y=cn(A=>{t(N=>{const v=N.themes.findIndex(U=>U.id===i);v!==-1&&A(N.themes[v])})},[i,t]),j=A=>{if(c>=2&&Xe(A)){const N=vn(A),v=c-2,U=V[v];Y(H=>{H.colors[U]=N})}};ge((A,N)=>{if(f===null&&I===null){if(A.length>1&&!N.ctrl&&!N.meta){j(A);return}if(N.escape)e();else if(N.ctrl&&A==="a")h(v=>v==="rgb"?"hex":v==="hex"?"hsl":"rgb");else if(N.upArrow)m(v=>Math.max(0,v-1));else if(N.downArrow)m(v=>Math.min(V.length+1,v+1));else if(N.return)if(c===0)C("name"),M(a.name),B(a.name);else if(c===1)C("id"),M(a.id),B(a.id);else{const v=c-2,U=V[v],H=a.colors[U];S(v),M(H),B(H)}}else if(f!==null)N.ctrl&&A==="a"&&h(v=>v==="rgb"?"hex":v==="hex"?"hsl":"rgb");else if(I!==null)if(N.return){if(I==="id"){const v=i;s($),t(U=>{const H=U.themes.findIndex(Q=>Q.id===v);H!==-1&&(U.themes[H].id=$)})}else Y(v=>{v.name=$});C(null),M(""),B("")}else N.escape?(C(null),M(""),B("")):N.backspace||N.delete?M(v=>v.slice(0,-1)):A&&M(v=>v+A)});const V=Object.keys(a.colors),ne=(A,N)=>{const v=A.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!v)return A;const U=parseInt(v[1]),H=parseInt(v[2]),Q=parseInt(v[3]);switch(N){case"hex":{const G=x=>x.toString(16).padStart(2,"0");return`#${G(U)}${G(H)}${G(Q)}`}case"hsl":{const G=U/255,x=H/255,w=Q/255,p=Math.max(G,x,w),k=Math.min(G,x,w),b=p-k,y=(p+k)/2;let T=0;b!==0&&(T=y>.5?b/(2-p-k):b/(p+k));let _=0;return b!==0&&(p===G?_=((x-w)/b+(x<w?6:0))/6:p===x?_=((w-G)/b+2)/6:_=((G-x)/b+4)/6),`hsl(${Math.round(_*360)}, ${Math.round(T*100)}%, ${Math.round(y*100)}%)`}case"rgb":default:return A}},z=A=>({autoAccept:"Auto-accept mode indicator",bashBorder:"Bash command border",claude:"Claude branding color. Used for the Claude logo, the welcome message, and the thinking text.",claudeShimmer:"Color used for the shimmering effect on the thinking verb.",claudeBlue_FOR_SYSTEM_SPINNER:"System spinner color (blue variant)",claudeBlueShimmer_FOR_SYSTEM_SPINNER:"System spinner shimmer color (blue variant)",permission:"Permission prompt color",permissionShimmer:"Permission prompt shimmer color",planMode:"Plan mode indicator",ide:"Color used for IDE-related messages.",promptBorder:"Input prompt border color",promptBorderShimmer:"Input prompt border shimmer color",text:"Code color. Used in diffs.",inverseText:"Inverse text color. Used for the text of tabs, where the background is filled in.",inactive:"Inactive/dimmed text. Used for line numbers and less prominent text.",subtle:"Subtle text. Used for help text and secondary information.",suggestion:"Suggestion text color. Used for suggestions for theme names and various other things.",remember:"Remember/note color. Used for various text relating to memories.",background:"Background color for certain UI elements",success:"Success indicator. Used for the bullet on successful tool calls, and various success messages (such as sign in successful).",error:"Error indicator",warning:"Warning indicator",warningShimmer:"Warning shimmer color",diffAdded:"Added diff background",diffRemoved:"Removed diff background",diffAddedDimmed:"Added diff background (dimmed)",diffRemovedDimmed:"Removed diff background (dimmed)",diffAddedWord:"Added word highlight",diffRemovedWord:"Removed word highlight",diffAddedWordDimmed:"Added word highlight (dimmed)",diffRemovedWordDimmed:"Removed word highlight (dimmed)",red_FOR_SUBAGENTS_ONLY:"Red color for sub agents",blue_FOR_SUBAGENTS_ONLY:"Blue color for sub agents",green_FOR_SUBAGENTS_ONLY:"Green color for sub agents",yellow_FOR_SUBAGENTS_ONLY:"Yellow color for sub agents",purple_FOR_SUBAGENTS_ONLY:"Purple color for sub agents",orange_FOR_SUBAGENTS_ONLY:"Orange color for sub agents",pink_FOR_SUBAGENTS_ONLY:"Pink color for sub agents",cyan_FOR_SUBAGENTS_ONLY:"Cyan color for sub agents",professionalBlue:"Professional blue color for business contexts?",rainbow_red:'"ultrathink" rainbow - red',rainbow_orange:'"ultrathink" rainbow - orange',rainbow_yellow:'"ultrathink" rainbow - yellow',rainbow_green:'"ultrathink" rainbow - green',rainbow_blue:'"ultrathink" rainbow - blue',rainbow_indigo:'"ultrathink" rainbow - indigo',rainbow_violet:'"ultrathink" rainbow - violet',rainbow_red_shimmer:'"ultrathink" rainbow (shimmer) - red',rainbow_orange_shimmer:'"ultrathink" rainbow (shimmer) - orange',rainbow_yellow_shimmer:'"ultrathink" rainbow (shimmer) - yellow',rainbow_green_shimmer:'"ultrathink" rainbow (shimmer) - green',rainbow_blue_shimmer:'"ultrathink" rainbow (shimmer) - blue',rainbow_indigo_shimmer:'"ultrathink" rainbow (shimmer) - indigo',rainbow_violet_shimmer:'"ultrathink" rainbow (shimmer) - violet',clawd_body:'"Clawd" character body color',clawd_background:'"Clawd" character background color',userMessageBackground:"Background color for user messages",bashMessageBackgroundColor:"Background color for bash command output",memoryBackgroundColor:"Background color for memory/context information",rate_limit_fill:"Rate limit indicator fill color",rate_limit_empty:"Rate limit indicator empty/background color"})[A]||"",q=Math.max(...V.map(A=>A.length));return g(u,{children:[g(u,{flexDirection:"column",width:"50%",children:[o(u,{children:g(fe,{children:["Editing theme “",a.name,"” (",a.id,")"]})}),f===null&&I===null?g(ce,{children:[g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{dimColor:!0,children:"enter to edit theme name, id, or color"}),o(l,{dimColor:!0,children:"ctrl+a to toggle rgb, hex, hsl"}),o(l,{dimColor:!0,children:"paste color from clipboard (when on color)"}),o(l,{dimColor:!0,children:"esc to go back"})]}),c<2?g(u,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:"yellow",flexDirection:"column",paddingLeft:1,children:[o(l,{bold:!0,children:c===0?"Theme Name":"Theme ID"}),o(l,{children:c===0?"The display name for this theme":"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):g(u,{marginBottom:1,borderStyle:"single",borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:a.colors[V[c-2]],flexDirection:"column",paddingLeft:1,children:[o(Fe,{colorKey:V[c-2],theme:a,bold:!0}),o(l,{children:z(V[c-2])})]}),g(u,{flexDirection:"column",children:[g(u,{children:[o(l,{color:c===0?"yellow":"white",children:c===0?"❯ ":" "}),o(l,{bold:!0,children:"Name: "}),o(l,{children:a.name})]}),g(u,{marginBottom:1,children:[o(l,{color:c===1?"yellow":"white",children:c===1?"❯ ":" "}),o(l,{bold:!0,children:"ID: "}),o(l,{children:a.id})]}),(()=>{if(c<2){const G=V.slice(0,20);return g(ce,{children:[G.map((x,w)=>{const p=w+2;return g(u,{children:[o(l,{color:c===p?"yellow":"white",children:c===p?"❯ ":" "}),o(u,{width:q+2,children:o(l,{children:o(Fe,{colorKey:x,theme:a,bold:!0})})}),o(R,{color:a.colors[x],children:ne(a.colors[x],d)})]},x)}),V.length>20&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",V.length-20," more below"]})]})}const N=c-2,v=Math.max(0,N-Math.floor(20/2)),U=Math.min(V.length,v+20),H=Math.max(0,U-20),Q=V.slice(H,U);return g(ce,{children:[H>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",H," more above"]}),Q.map((G,x)=>{const p=H+x+2;return g(u,{children:[o(l,{color:c===p?"yellow":"white",children:c===p?"❯ ":" "}),o(u,{width:q+2,children:o(l,{children:o(Fe,{colorKey:G,theme:a,bold:!0})})}),o(R,{color:a.colors[G],children:ne(a.colors[G],d)})]},G)}),U<V.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",V.length-U," more below"]})]})})()]})]}):I?g(u,{flexDirection:"column",marginTop:1,children:[g(l,{children:["Editing ",I==="name"?"theme name":"theme ID",":"]}),o(u,{borderStyle:"round",borderColor:"yellow",paddingX:1,children:o(l,{children:$})}),o(l,{dimColor:!0,children:"enter to save, esc to cancel"})]}):o($n,{initialValue:F,colorKey:V[f],theme:a,onColorChange:A=>{M(A),Y(N=>{N.colors[V[f]]=A})},onExit:()=>{Y(A=>{A.colors[V[f]]=$}),S(null),M(""),B("")}})]}),o(u,{width:"50%",children:o(Cn,{theme:a})})]})}function ot(e){return e.map(r=>`${r.name} (${r.id})`)}function it({onBack:e}){const{settings:{themes:r},updateSettings:n}=be(he),[t,i]=O(0),[s,a]=O(null),[d,h]=O(!0),c=()=>{const $={colors:{...(r[0]||K.themes[0]).colors},name:"New Custom Theme",id:`custom-${Date.now()}`};n(M=>{M.themes.push($)}),a($.id),h(!1)},m=C=>{r.length<=1||(n($=>{$.themes=$.themes.filter(M=>M.id!==C)}),t>=r.length-1&&i(Math.max(0,r.length-2)))},f=()=>{n(C=>{C.themes=[...K.themes]}),i(0)};if(ge((C,$)=>{if($.escape)e();else if($.upArrow)i(M=>Math.max(0,M-1));else if($.downArrow)i(M=>Math.min(r.length-1,M+1));else if($.return){const M=r[t];M&&(a(M.id),h(!1))}else if(C==="n")c();else if(C==="d"){const M=r[t];M&&m(M.id)}else $.ctrl&&C==="r"&&f()},{isActive:d}),s)return o(tt,{themeId:s,onBack:()=>{a(null),h(!0)}});const S=ot(r),I=r.find(C=>S[t]?.includes(`(${C.id})`))||r[0];return r.length===0?o(u,{children:g(u,{flexDirection:"column",width:"100%",children:[o(fe,{children:"Themes"}),g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{dimColor:!0,children:"n to create a new theme"}),o(l,{dimColor:!0,children:"esc to go back"})]}),o(l,{children:"No themes available!"})]})}):g(u,{children:[g(u,{flexDirection:"column",width:"50%",children:[o(fe,{children:"Themes"}),g(u,{marginBottom:1,flexDirection:"column",children:[o(l,{dimColor:!0,children:"n to create a new theme"}),o(l,{dimColor:!0,children:"d to delete a theme"}),o(l,{dimColor:!0,children:"ctrl+r to delete all themes and restore built-in"}),o(l,{dimColor:!0,children:"enter to edit theme"}),o(l,{dimColor:!0,children:"esc to go back"})]}),o(u,{flexDirection:"column",children:S.map((C,$)=>g(l,{color:t===$?"yellow":void 0,children:[t===$?"❯ ":" ",C]},$))})]}),o(u,{width:"50%",children:o(Cn,{theme:I})})]})}let Ue=["ANSI Shadow"];function st({onBack:e}){const{stdout:r}=Nn(),n=r?.columns||120,{settings:{launchText:{method:t,figletText:i,figletFont:s,customText:a},themes:d},updateSettings:h}=be(he),c=t==="figlet"?["method","text","font"]:["method","text"],[m,f]=O(0),S=c[m],[I,C]=O(t==="figlet"?0:1),[$,M]=O(Ue),[F,B]=O(Ue),[Y,j]=O(""),[V,ne]=O(!1),[z,q]=O(0),[A,N]=O(""),[v,U]=O(50),[H,Q]=O(!1),[G,x]=O(t==="figlet"?i:a),w=De(),k=(d.find(y=>y.id===w)||d.find(y=>y.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae(()=>{He.fonts((y,T)=>{if(!y&&T){const _=T.sort();M(_),B(_),Ue=_;const L=_.indexOf(s);q(L>=0?L:_.indexOf("ANSI Shadow")||0)}})},[]),ae(()=>{b()},[t,i,s,a,G,H]);const b=()=>{if(t==="figlet")try{const y=H?G:i,T=He.textSync(y.replace(`
196
+ `," "),{font:s}),_=Math.floor(n*.7),ee=T.split(`
197
+ `).map(E=>E.length>_?E.substring(0,_-3)+"":E),le=ee.join(`
198
+ `);N(le);const ie=Math.max(...ee.map(E=>E.length)),P=Math.min(75,Math.max(50,Math.ceil(ie/n*100)));U(P+5)}catch{N("Error generating figlet text"),U(50)}else{const y=Math.floor(n*.6),L=(H?G:a).split(`
199
+ `).map(P=>P.length>y?P.substring(0,y-3)+"...":P),ee=L.join(`
200
+ `);N(ee);const le=Math.max(...L.map(P=>P.length)),ie=Math.min(75,Math.max(50,Math.ceil(le/n*100)));U(ie+5)}};return ae(()=>{if(Y){const y=$.filter(T=>T.toLowerCase().includes(Y.toLowerCase()));B(y),q(0)}else{B($);const y=$.indexOf(s);q(y>=0?y:0)}},[Y,$]),ae(()=>{if(!V){const y=F.indexOf(s);y>=0&&q(y)}},[s,F,V]),ge((y,T)=>{if(H){T.return?(h(t==="figlet"?_=>{_.launchText.figletText=G}:_=>{_.launchText.customText=G}),Q(!1)):T.escape?(x(t==="figlet"?i:a),Q(!1)):T.backspace||T.delete?x(_=>_.slice(0,-1)):y&&x(_=>_+y);return}if(V){if(T.return)F.length>0&&h(_=>{_.launchText.figletFont=F[z]}),ne(!1),j("");else if(T.escape)ne(!1),j("");else if(T.backspace||T.delete)j(_=>_.slice(0,-1));else if(T.upArrow){const _=z>0?z-1:F.length-1;q(_),F.length>0&&h(L=>{L.launchText.figletFont=F[_]})}else if(T.downArrow){const _=z<F.length-1?z+1:0;q(_),F.length>0&&h(L=>{L.launchText.figletFont=F[_]})}else y&&y.match(/^[a-zA-Z0-9\s\-_]$/)&&j(_=>_+y);return}if(T.escape)e();else if(T.return)S==="text"&&(x(t==="figlet"?i:a),Q(!0));else if(T.tab)T.shift?f(_=>_===0?c.length-1:_-1):f(_=>_===c.length-1?0:_+1);else if(T.upArrow){if(S==="method"){const _=I>0?I-1:1;C(_),h(L=>{L.launchText.method=_===0?"figlet":"custom"})}else if(S==="font"&&t==="figlet"){const _=z>0?z-1:F.length-1;q(_),h(L=>{L.launchText.figletFont=F[_]})}}else if(T.downArrow){if(S==="method"){const _=I<1?I+1:0;C(_),h(L=>{L.launchText.method=_===0?"figlet":"custom"})}else if(S==="font"&&t==="figlet"){const _=z<F.length-1?z+1:0;q(_),h(L=>{L.launchText.figletFont=F[_]})}}else y&&S==="font"&&t==="figlet"&&y.match(/^[a-zA-Z0-9]$/)&&(ne(!0),j(y))}),g(u,{children:[g(u,{flexDirection:"column",width:`${100-v}%`,children:[g(u,{marginBottom:1,flexDirection:"column",children:[o(fe,{children:"Setup banner"}),g(u,{flexDirection:"column",children:[g(l,{dimColor:!0,children:["enter to ",S==="text"?"edit text":"save"]}),o(l,{dimColor:!0,children:"esc to go back"}),o(l,{dimColor:!0,children:"tab to switch sections"})]})]}),o(u,{children:g(l,{children:[o(l,{color:S==="method"?"yellow":void 0,children:S==="method"?"❯ ":" "}),o(l,{bold:!0,color:S==="method"?"yellow":void 0,children:"Method"})]})}),S==="method"&&g(l,{dimColor:!0,children:[" ","select one of ",F.length," Figlet fonts or enter your own text"]}),o(u,{marginLeft:2,marginBottom:1,children:g(u,{flexDirection:"column",children:[g(l,{color:I===0?"cyan":"white",children:[I===0?"❯ ":" ","Figlet"]}),g(l,{color:I===1?"cyan":"white",children:[I===1?"❯ ":" ","Custom"]})]})}),g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:S==="text"?"yellow":void 0,children:S==="text"?"❯ ":" "}),o(l,{bold:!0,color:S==="text"?"yellow":void 0,children:"Text"})]}),S==="text"&&(H?g(l,{dimColor:!0,children:[" ","esc to save"]}):g(l,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:H?"yellow":"gray",children:o(l,{children:H?G:t==="figlet"?i:a})})}),t==="figlet"&&g(ce,{children:[o(u,{children:g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:S==="font"?"yellow":void 0,children:S==="font"?"❯ ":" "}),o(l,{bold:!0,color:S==="font"?"yellow":void 0,children:"Font"})]}),S==="font"&&g(l,{dimColor:!0,children:[" ","type to filter"]}),o(l,{children:V&&g(l,{color:"gray",dimColor:!0,children:[" ","(filtering: “",Y,"”)"]})})]})}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{flexDirection:"column",children:(()=>{const T=Math.max(0,z-Math.floor(4)),_=Math.min(F.length,T+8),L=Math.max(0,_-8),ee=F.slice(L,_);return g(ce,{children:[L>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",L," more above"]}),ee.map((le,ie)=>{const P=L+ie;return g(l,{color:z===P?"cyan":void 0,children:[z===P?"❯ ":" ",le]},le)}),_<F.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",F.length-_," more below"]})]})})()})})]})]}),g(u,{width:`${v}%`,flexDirection:"column",children:[o(u,{marginBottom:1,children:o(l,{bold:!0,children:"Preview"})}),g(u,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:[g(u,{flexDirection:"column",marginBottom:1,children:[o(l,{color:k,children:"╭──────────────────────────╮"}),g(l,{children:[o(l,{color:k,children:"│ ✻"})," Welcome to Claude Code"," ",o(l,{color:k,children:"│"})]}),o(l,{color:k,children:"╰──────────────────────────╯"})]}),A.split(`
201
+ `).map((y,T)=>o(l,{color:k,children:y},T)),o(u,{marginTop:1,children:o(l,{wrap:"truncate-end",children:"Claude Code can now be used with your Claude subscription or billed based on API usage through your Console account."})})]})]})]})}function lt({onBack:e}){const{settings:{thinkingVerbs:{format:r,verbs:n},themes:t},updateSettings:i}=be(he),s=["format","verbs"],[a,d]=O(0),h=s[a],[c,m]=O(0),[f,S]=O(!1),[I,C]=O(""),[$,M]=O(!1),[F,B]=O(!1),[Y,j]=O(r),V=De(),z=(t.find(A=>A.id===V)||t.find(A=>A.id==="dark"))?.colors.claude||"rgb(215,119,87)";ge((A,N)=>{if(F){N.return?(i(v=>{v.thinkingVerbs.format=Y}),B(!1)):N.escape?(j(r),B(!1)):N.backspace||N.delete?j(v=>v.slice(0,-1)):A&&j(v=>v+A);return}if(f||$){N.return&&I.trim()?($?(i(v=>{v.thinkingVerbs.verbs.push(I.trim())}),M(!1)):(i(v=>{v.thinkingVerbs.verbs[c]=I.trim()}),S(!1)),C("")):N.escape?(C(""),S(!1),M(!1)):N.backspace||N.delete?C(v=>v.slice(0,-1)):A&&C(v=>v+A);return}N.escape?e():N.return?h==="format"&&(j(r),B(!0)):N.tab?N.shift?d(v=>v===0?s.length-1:v-1):d(v=>v===s.length-1?0:v+1):N.upArrow?h==="verbs"&&n.length>0&&m(v=>v>0?v-1:n.length-1):N.downArrow?h==="verbs"&&n.length>0&&m(v=>v<n.length-1?v+1:0):A==="e"&&h==="verbs"?n.length>0&&(C(n[c]),S(!0)):A==="d"&&h==="verbs"?n.length>1&&(i(v=>{v.thinkingVerbs.verbs=v.thinkingVerbs.verbs.filter((U,H)=>H!==c)}),c>=n.length-1&&m(Math.max(0,n.length-2))):A==="n"&&h==="verbs"?(M(!0),C("")):N.ctrl&&A==="r"&&h==="verbs"&&(i(v=>{v.thinkingVerbs.verbs=[...K.thinkingVerbs.verbs]}),m(0))});const q=50;return g(u,{children:[g(u,{flexDirection:"column",width:`${100-q}%`,children:[g(u,{marginBottom:1,flexDirection:"column",children:[o(fe,{children:"Thinking Verbs"}),g(u,{flexDirection:"column",children:[o(l,{dimColor:!0,children:h==="format"?"enter to edit format":"changes auto-saved"}),o(l,{dimColor:!0,children:"esc to go back"}),o(l,{dimColor:!0,children:"tab to switch sections"})]})]}),o(u,{marginBottom:1,children:o(l,{dimColor:!0,children:"Customize the verbs shown during generation and their format."})}),g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:h==="format"?"yellow":void 0,children:h==="format"?"❯ ":" "}),o(l,{bold:!0,color:h==="format"?"yellow":void 0,children:"Format"})]}),h==="format"&&(F?g(l,{dimColor:!0,children:[" ","enter to save"]}):g(l,{dimColor:!0,children:[" ","enter to edit"]}))]}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:F?"yellow":"gray",children:o(l,{children:F?Y:r})})}),o(u,{children:g(l,{children:[o(l,{color:h==="verbs"?"yellow":void 0,children:h==="verbs"?"❯ ":" "}),o(l,{bold:!0,color:h==="verbs"?"yellow":void 0,children:"Verbs"})]})}),h==="verbs"&&o(u,{flexDirection:"column",children:g(l,{dimColor:!0,children:[" ","e to edit · d to delete · n to add new · ctrl+r to reset"]})}),o(u,{marginLeft:2,marginBottom:1,children:g(u,{flexDirection:"column",children:[(()=>{const N=Math.max(0,c-Math.floor(4)),v=Math.min(n.length,N+8),U=Math.max(0,v-8),H=n.slice(U,v);return g(ce,{children:[U>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",U," more above"]}),H.map((Q,G)=>{const x=U+G;return g(l,{color:h==="verbs"&&x===c?"cyan":void 0,children:[h==="verbs"&&x===c?"❯ ":" ",Q]},x)}),v<n.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",n.length-v," more below"]})]})})(),$&&g(u,{alignItems:"center",children:[o(l,{color:"yellow",children:"❯ "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:I})})]}),f&&g(u,{marginTop:1,alignItems:"center",children:[o(l,{children:"Editing: "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:I})})]})]})})]}),g(u,{width:`${q}%`,flexDirection:"column",children:[o(u,{marginBottom:1,children:o(l,{bold:!0,children:"Preview"})}),o(u,{borderStyle:"single",borderColor:"gray",padding:1,flexDirection:"column",children:g(l,{children:[g(l,{color:z,children:["✻ ",r.replace(/\{\}/g,n[c])," "]}),o(l,{children:"(esc to interrupt)"})]})})]})]})}const we=[{name:"Default",phases:K.thinkingStyle.phases,reverseMirror:K.thinkingStyle.reverseMirror},{name:"Basic",phases:["|","/","-","\\"],reverseMirror:!1},{name:"Braille",phases:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],reverseMirror:!1},{name:"Circle",phases:["◐","◓","◑","◒"],reverseMirror:!1},{name:"Wave",phases:["▁","▃","▄","▅","▆","▇","█"],reverseMirror:!0},{name:"Glow",phases:["░","▒","▓","█"],reverseMirror:!0},{name:"Partial block",phases:["▏","▎","▍","▌","▋","▊","▉","█"],reverseMirror:!0},{name:"Clock",phases:["🕛","🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚"],reverseMirror:!1},{name:"Globe",phases:["🌍","🌎","🌏"],reverseMirror:!1},{name:"Arc",phases:["◜","◠","◝","◞","◡","◟"],reverseMirror:!1},{name:"Triangle",phases:["◤","◥","◢","◣"],reverseMirror:!1},{name:"Bouncing",phases:["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"],reverseMirror:!1},{name:"Dots",phases:[".","..","..."],reverseMirror:!1},{name:"Colors",phases:["🔴","🟠","🟡","🟢","🔵","🟣"],reverseMirror:!1}];function at({onBack:e}){const{settings:{thinkingStyle:{phases:r,updateInterval:n,reverseMirror:t},themes:i},updateSettings:s}=be(he),a=["reverseMirror","updateInterval","phases","presets"],[d,h]=O(0),c=a[d],[m,f]=O(0),[S,I]=O(0),[C,$]=O(!1),[M,F]=O(""),[B,Y]=O(!1),[j,V]=O(!1),[ne,z]=O(n.toString()),[q,A]=O(0),N=De(),U=(i.find(p=>p.id===N)||i.find(p=>p.id==="dark"))?.colors.claude||"rgb(215,119,87)";ae(()=>{if(r.length>0){const p=t?[...r,...[...r].reverse().slice(1,-1)]:r,k=setInterval(()=>{A(b=>(b+1)%p.length)},n);return()=>clearInterval(k)}},[r,n,t]),ge((p,k)=>{if(j){if(k.return){const b=parseInt(ne);!isNaN(b)&&b>0&&s(y=>{y.thinkingStyle.updateInterval=b}),V(!1)}else k.escape?(z(n.toString()),V(!1)):k.backspace||k.delete?z(b=>b.slice(0,-1)):p&&p.match(/^[0-9]$/)&&z(b=>b+p);return}if(C||B){if(k.return&&M.length){const b=B?[...r,M]:r.map((y,T)=>T===m?M:y);s(y=>{y.thinkingStyle.phases=b}),$(!1),F("")}else k.escape?(F(""),$(!1),Y(!1)):k.backspace||k.delete?F(b=>b.slice(0,-1)):p&&F(b=>b+p);return}if(k.escape)e();else if(k.return)if(c==="updateInterval")z(n.toString()),V(!0);else if(c==="presets"){const b=we[S];s(y=>{y.thinkingStyle.phases=[...b.phases],y.thinkingStyle.reverseMirror=b.reverseMirror})}else c==="reverseMirror"&&s(b=>{b.thinkingStyle.reverseMirror=!b.thinkingStyle.reverseMirror});else if(k.tab)k.shift?h(b=>b===0?a.length-1:b-1):h(b=>b===a.length-1?0:b+1);else if(k.upArrow)c==="phases"&&r.length>0?f(b=>b>0?b-1:r.length-1):c==="presets"&&I(b=>b>0?b-1:we.length-1);else if(k.downArrow)c==="phases"&&r.length>0?f(b=>b<r.length-1?b+1:0):c==="presets"&&I(b=>b<we.length-1?b+1:0);else if(p===" ")c==="reverseMirror"&&s(b=>{b.thinkingStyle.reverseMirror=!b.thinkingStyle.reverseMirror});else if(p==="e"&&c==="phases")r.length>0&&(F(r[m]),$(!0));else if(p==="a"&&c==="phases")Y(!0),F("");else if(p==="d"&&c==="phases")r.length>1&&(s(b=>{b.thinkingStyle.phases=r.filter((y,T)=>T!==m)}),m>=r.length&&f(Math.max(0,r.length-1)));else if(p==="w"&&c==="phases"){if(m>0){const b=[...r];[b[m-1],b[m]]=[b[m],b[m-1]],s(y=>{y.thinkingStyle.phases=b}),f(y=>y-1)}}else if(p==="s"&&c==="phases"){if(m<r.length-1){const b=[...r];[b[m],b[m+1]]=[b[m+1],b[m]],s(y=>{y.thinkingStyle.phases=b}),f(y=>y+1)}}else k.ctrl&&p==="r"&&(s(b=>{b.thinkingStyle=K.thinkingStyle}),f(0),I(0))});const H=t?"●":"○",Q=50,x=t?[...r,...[...r].reverse().slice(1,-1)]:r,w=x.length>0?x[q]:"·";return o(u,{children:g(u,{flexDirection:"column",width:"100%",children:[g(u,{flexDirection:"row",width:"100%",children:[g(u,{marginBottom:1,flexDirection:"column",width:`${100-Q}%`,children:[o(fe,{children:"Thinking style"}),g(u,{flexDirection:"column",children:[g(l,{dimColor:!0,children:["enter to"," ",c==="updateInterval"?"edit interval":c==="presets"?"apply preset":"save"]}),o(l,{dimColor:!0,children:"esc to go back"}),o(l,{dimColor:!0,children:"tab to switch sections"})]})]}),g(u,{width:`${Q}%`,flexDirection:"column",children:[o(u,{children:o(l,{bold:!0,children:"Preview"})}),g(u,{borderStyle:"single",borderColor:"gray",paddingX:1,flexDirection:"row",children:[o(u,{width:(w?.length??0)+1,children:o(l,{color:U,children:w})}),g(l,{children:[o(l,{color:U,children:"Thinking… "}),o(l,{children:"(esc to interrupt)"})]})]})]})]}),g(u,{flexDirection:"row",gap:4,children:[g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:c==="reverseMirror"?"yellow":void 0,children:c==="reverseMirror"?"❯ ":" "}),o(l,{bold:!0,color:c==="reverseMirror"?"yellow":void 0,children:"Reverse-mirror phases"})]}),c==="reverseMirror"&&g(l,{dimColor:!0,children:[" ","space to toggle"]}),o(u,{marginLeft:2,marginBottom:1,children:g(l,{children:[H," ",t?"Enabled":"Disabled"]})})]}),g(u,{flexDirection:"column",children:[g(l,{children:[o(l,{color:c==="updateInterval"?"yellow":void 0,children:c==="updateInterval"?"❯ ":" "}),o(l,{bold:!0,color:c==="updateInterval"?"yellow":void 0,children:"Update interval (ms)"})]}),c==="updateInterval"&&(j?g(l,{dimColor:!0,children:[" ","enter to save"]}):g(l,{dimColor:!0,children:[" ","enter to edit"]})),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:j?"yellow":"gray",children:o(l,{children:j?ne:n})})})]})]}),o(u,{children:g(l,{children:[o(l,{color:c==="phases"?"yellow":void 0,children:c==="phases"?"❯ ":" "}),o(l,{bold:!0,color:c==="phases"?"yellow":void 0,children:"Phases"})]})}),c==="phases"&&o(u,{marginBottom:1,flexDirection:"column",children:g(l,{dimColor:!0,children:[" ","[e]dit"," ","[a]dd"," ","[d]elete"," ","[w]move up"," ","[s]move down"]})}),o(u,{marginLeft:2,marginBottom:1,children:g(u,{flexDirection:"column",children:[(()=>{const k=Math.max(0,m-Math.floor(4)),b=Math.min(r.length,k+8),y=Math.max(0,b-8),T=r.slice(y,b);return g(ce,{children:[y>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",y," more above"]}),T.map((_,L)=>{const ee=y+L;return g(l,{color:c==="phases"&&ee===m?"cyan":void 0,children:[c==="phases"&&ee===m?"❯ ":" ",_]},ee)}),b<r.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",r.length-b," more below"]})]})})(),B&&g(u,{children:[o(l,{color:"yellow",children:"❯ "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:M})})]}),C&&g(u,{marginTop:1,children:[o(l,{children:"Editing: "}),o(u,{borderStyle:"round",borderColor:"yellow",children:o(l,{children:M})})]})]})}),o(u,{children:g(l,{children:[o(l,{color:c==="presets"?"yellow":void 0,children:c==="presets"?"❯ ":" "}),o(l,{bold:!0,color:c==="presets"?"yellow":void 0,children:"Presets"})]})}),c==="presets"&&g(l,{dimColor:!0,children:[" ","Selecting one will overwrite your choice of phases"]}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{flexDirection:"column",children:(()=>{const k=Math.max(0,S-Math.floor(4)),b=Math.min(we.length,k+8),y=Math.max(0,b-8),T=we.slice(y,b);return g(ce,{children:[y>0&&g(l,{color:"gray",dimColor:!0,children:[" ","↑ ",y," more above"]}),T.map((_,L)=>{const ee=y+L;return g(l,{color:c==="presets"&&ee===S?"cyan":void 0,children:[c==="presets"&&ee===S?"❯ ":" ",_.name," ",_.phases.join("")]},ee)}),b<we.length&&g(l,{color:"gray",dimColor:!0,children:[" ","↓ ",we.length-b," more below"]})]})})()})}),o(u,{marginTop:1,children:o(l,{dimColor:!0,children:"ctrl+r to reset all settings to default"})})]})})}const Ce=[{label:"bold",value:"bold"},{label:"italic",value:"italic"},{label:"underline",value:"underline"},{label:"strikethrough",value:"strikethrough"},{label:"inverse",value:"inverse"}];function ct({onBack:e}){const{settings:r,updateSettings:n}=be(he),[t,i]=O("prefix"),[s,a]=O(0),[d,h]=O(!1),[c,m]=O(()=>r.userMessageDisplay.prefix.format),[f,S]=O(0),[I,C]=O(()=>[...r.userMessageDisplay.prefix.styling]),[$,M]=O(()=>r.userMessageDisplay.prefix.foreground_color),[F,B]=O(()=>r.userMessageDisplay.prefix.background_color),[Y,j]=O(0),[V,ne]=O(0),[z,q]=O(()=>[...r.userMessageDisplay.message.styling]),[A,N]=O(()=>r.userMessageDisplay.message.foreground_color),[v,U]=O(()=>r.userMessageDisplay.message.background_color),[H,Q]=O(null),[G,x]=O(""),w=De(),p=r.themes?.find(P=>P.id===w)||r.themes?.[0],k=["format","styling","foreground","background"],b=["styling","foreground","background"],y=k[s],T=b[Y],_=(P,E)=>{n(D=>{const X=P==="prefix"?D.userMessageDisplay.prefix:D.userMessageDisplay.message;E(X)})},L=P=>{n(E=>{P==="prefix"?E.userMessageDisplay.prefix={...K.userMessageDisplay.prefix}:E.userMessageDisplay.message={...K.userMessageDisplay.message}}),P==="prefix"?(m(K.userMessageDisplay.prefix.format),C([...K.userMessageDisplay.prefix.styling]),M(K.userMessageDisplay.prefix.foreground_color),B(K.userMessageDisplay.prefix.background_color)):(q([...K.userMessageDisplay.message.styling]),N(K.userMessageDisplay.message.foreground_color),U(K.userMessageDisplay.message.background_color))};ae(()=>{const P=r.userMessageDisplay.prefix;m(P.format),C([...P.styling]),M(P.foreground_color),B(P.background_color);const E=r.userMessageDisplay.message;q([...E.styling]),N(E.foreground_color),U(E.background_color)},[]),ge((P,E)=>{if(d){if(E.return)_("prefix",D=>{D.format=c}),h(!1);else if(E.escape){const D=r.userMessageDisplay.prefix;m(D.format),h(!1)}else E.backspace||E.delete?m(D=>D.slice(0,-1)):P&&m(D=>D+P);return}if(H===null){if(E.escape)e();else if(E.ctrl&&P==="r")L(t);else if(E.leftArrow||E.rightArrow)i(D=>D==="prefix"?"message":"prefix");else if(E.tab)t==="prefix"?E.shift?a(D=>D===0?k.length-1:D-1):a(D=>D===k.length-1?0:D+1):E.shift?j(D=>D===0?b.length-1:D-1):j(D=>D===b.length-1?0:D+1);else if(E.return)t==="prefix"?y==="format"?h(!0):y==="foreground"?(x($),Q({column:"prefix",type:"foreground"})):y==="background"&&(x(F),Q({column:"prefix",type:"background"})):T==="foreground"?(x(A),Q({column:"message",type:"foreground"})):T==="background"&&(x(v),Q({column:"message",type:"background"}));else if(E.upArrow)t==="prefix"&&y==="styling"?S(D=>Math.max(0,D-1)):t==="message"&&T==="styling"&&ne(D=>Math.max(0,D-1));else if(E.downArrow)t==="prefix"&&y==="styling"?S(D=>Math.min(Ce.length-1,D+1)):t==="message"&&T==="styling"&&ne(D=>Math.min(Ce.length-1,D+1));else if(P===" "){if(t==="prefix"&&y==="styling"){const D=Ce[f].value,X=I.indexOf(D)>=0?I.filter(W=>W!==D):[...I,D];C(X),_("prefix",W=>{W.styling=[...X]})}else if(t==="message"&&T==="styling"){const D=Ce[V].value,X=z.indexOf(D)>=0?z.filter(W=>W!==D):[...z,D];q(X),_("message",W=>{W.styling=[...X]})}}}});const ee=(P,E,D=!0)=>{const X=D?E==="prefix"?I:z:[],W=D?E==="prefix"?$:A:"rgb(255,255,255)",ve=D?E==="prefix"?F:v:"rgb(0,0,0)",Ie=W==="rgb(0,0,0)"&&ve==="rgb(0,0,0)",Be=X.length>0;return Ie&&!Be?o(l,{children:P}):o(l,{bold:X.includes("bold"),italic:X.includes("italic"),underline:X.includes("underline"),strikethrough:X.includes("strikethrough"),inverse:X.includes("inverse"),color:Ie?void 0:W,backgroundColor:Ie?void 0:ve,children:P})},le=(P=!0)=>g(l,{children:[c&&g(ce,{children:[ee(c,"prefix",P)," "]}),ee("list the dir","message",P)]}),ie=P=>{const E=t===P,W=(P==="prefix"?k:b)[P==="prefix"?s:Y],ve=P==="prefix"?f:V,Ie=P==="prefix"?I:z,Be=P==="prefix"?$:A,Ke=P==="prefix"?F:v;return g(u,{flexDirection:"column",width:"45%",borderStyle:E?"round":"single",borderColor:E?"yellow":"gray",padding:1,children:[o(u,{marginBottom:1,children:g(l,{bold:!0,color:E?"yellow":void 0,children:[P.charAt(0).toUpperCase()+P.slice(1)," ","Configuration"]})}),P==="prefix"&&g(ce,{children:[o(u,{children:g(l,{color:E&&W==="format"?"yellow":void 0,bold:E&&W==="format",children:[E&&W==="format"?"❯ ":" ","Prefix Text"]})}),E&&W==="format"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:d?"enter to save":"enter to edit (appears before message)"})}),o(u,{marginLeft:2,marginBottom:1,children:o(u,{borderStyle:"round",borderColor:d?"yellow":"gray",children:o(l,{children:c})})})]}),o(u,{children:g(l,{color:E&&W==="styling"?"yellow":void 0,bold:E&&W==="styling",children:[E&&W==="styling"?"❯ ":" ","Styling"]})}),E&&W==="styling"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:"up/down to navigate · space to toggle"})}),o(u,{marginLeft:2,marginBottom:1,flexDirection:"column",children:Ce.map((Le,qe)=>o(u,{children:g(l,{color:E&&W==="styling"&&ve===qe?"cyan":void 0,children:[E&&W==="styling"&&ve===qe?"❯ ":" ",Ie.includes(Le.value)?"●":"○"," ",Le.label]})},Le.value))}),o(u,{children:g(l,{color:E&&W==="foreground"?"yellow":void 0,bold:E&&W==="foreground",children:[E&&W==="foreground"?"❯ ":" ","Foreground color"]})}),E&&W==="foreground"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:"enter to open color picker"})}),o(u,{marginLeft:2,marginBottom:1,children:o(l,{color:Be,children:Be})}),o(u,{children:g(l,{color:E&&W==="background"?"yellow":void 0,bold:E&&W==="background",children:[E&&W==="background"?"❯ ":" ","Background color"]})}),E&&W==="background"&&o(u,{marginLeft:2,children:o(l,{dimColor:!0,children:"enter to open color picker"})}),o(u,{marginLeft:2,children:o(l,{backgroundColor:Ke,children:Ke})})]})};if(H){const{column:P,type:E}=H;return o($n,{initialValue:G,theme:p,onColorChange:D=>{P==="prefix"?E==="foreground"?(M(D),_("prefix",X=>{X.foreground_color=D})):(B(D),_("prefix",X=>{X.background_color=D})):E==="foreground"?(N(D),_("message",X=>{X.foreground_color=D})):(U(D),_("message",X=>{X.background_color=D}))},onExit:()=>{Q(null),x("")}})}return g(u,{flexDirection:"column",children:[o(fe,{children:"Customize how user messages are displayed"}),g(u,{flexDirection:"column",marginBottom:1,children:[o(l,{dimColor:!0,children:"left/right arrows to switch columns · tab to navigate options"}),o(l,{dimColor:!0,children:"enter to edit · ctrl+r to reset active column · esc to go back"})]}),g(u,{flexDirection:"row",gap:1,children:[ie("prefix"),ie("message")]}),o(u,{borderStyle:"round",padding:1,marginTop:1,children:g(u,{flexDirection:"column",children:[o(u,{marginBottom:1,children:o(l,{bold:!0,children:"Preview"})}),g(u,{flexDirection:"row",gap:2,children:[g(u,{flexDirection:"column",width:"50%",children:[o(u,{marginBottom:1,children:o(l,{underline:!0,children:"Before (Claude Code default):"})}),o(u,{marginLeft:1,marginTop:1,children:g(l,{children:[o(l,{color:p?.colors?.inactive||"#888888",children:"●"}),o(l,{children:" The directory "}),o(l,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(l,{children:" contains "}),o(l,{bold:!0,children:"123"}),o(l,{children:" files."})]})})]}),g(u,{flexDirection:"column",width:"50%",children:[o(u,{marginBottom:1,children:o(l,{underline:!0,children:"After (Your customization):"})}),o(u,{marginLeft:1,children:le(!0)}),o(u,{marginLeft:1,marginTop:1,children:g(l,{children:[o(l,{color:p?.colors?.inactive||"#888888",children:"●"}),o(l,{children:" The directory "}),o(l,{color:p?.colors?.permission||"#00ff00",children:"C:\\Users\\user"}),o(l,{children:" contains "}),o(l,{bold:!0,children:"123"}),o(l,{children:" files."})]})})]})]})]})})]})}function dt({onSubmit:e}){const{settings:r,updateSettings:n}=be(he),[t,i]=O(0),s=()=>{n(d=>{d.inputBox||(d.inputBox={removeBorder:!1}),d.inputBox.removeBorder=!d.inputBox.removeBorder})};ge((d,h)=>{h.return||h.escape?e():d===" "&&t===0&&s()});const a=r.inputBox?.removeBorder?"☑":"☐";return g(u,{flexDirection:"column",children:[o(u,{marginBottom:1,children:o(fe,{children:"Input Box Settings"})}),o(u,{marginBottom:1,children:g(l,{color:"gray",children:[o(l,{bold:!0,children:"Customize the appearance of the Claude Code input box."})," ",o(l,{dimColor:!0,children:"Press space to toggle settings, enter to go back."})]})}),o(u,{children:g(l,{children:[o(l,{color:t===0?"cyan":void 0,children:t===0?"❯ ":" "}),o(l,{bold:!0,color:t===0?"cyan":void 0,children:"Remove border"})]})}),t===0&&o(u,{marginBottom:1,flexDirection:"column",children:g(l,{dimColor:!0,children:[" ","space to toggle"]})}),o(u,{marginLeft:2,marginBottom:1,children:g(l,{children:[a," ",r.inputBox?.removeBorder?"Enabled":"Disabled"]})}),o(u,{marginBottom:1,children:o(l,{color:"gray",dimColor:!0,children:"When enabled, removes the rounded border around the input box for a cleaner look."})})]})}const he=kn({settings:K,updateSettings:e=>{},changesApplied:!1,ccVersion:""});function gt({startupCheckInfo:e}){const[r,n]=O({settings:K,changesApplied:!1,ccVersion:"",lastModified:"",ccInstallationDir:null});ae(()=>{(async()=>{n(await Je())})()},[]);const t=cn(m=>{const f=JSON.parse(JSON.stringify(r.settings));m(f),n(S=>({...S,settings:f,changesApplied:!1})),Ee(S=>{S.settings=f,S.changesApplied=!1})},[r.settings]),[i,s]=O(null),[a,d]=O(null);ae(()=>{e.wasUpdated&&e.oldVersion&&(d({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
202
+ (However, your customization are still remembered in ${de}.)
203
+ Please reapply your changes below.`,type:"warning"}),t(()=>{}))},[]),ge((m,f)=>{(f.ctrl&&m==="c"||(m==="q"||f.escape)&&!i)&&process.exit(0)},{isActive:!i});const h=m=>{switch(d(null),m){case J.APPLY_CHANGES:e.ccInstInfo&&(d({message:"Applying patches...",type:"info"}),yn(r,e.ccInstInfo).then(f=>{n(f),d({message:"Customization patches applied successfully!",type:"success"})}));break;case J.THEMES:case J.LAUNCH_TEXT:case J.THINKING_VERBS:case J.THINKING_STYLE:case J.USER_MESSAGE_DISPLAY:case J.INPUT_BOX:s(m);break;case J.VIEW_SYSTEM_PROMPTS:Qr(me);break;case J.RESTORE_ORIGINAL:e.ccInstInfo&&wn(e.ccInstInfo).then(()=>{d({message:"Original Claude Code restored successfully!",type:"success"}),t(()=>{})});break;case J.OPEN_CONFIG:ln(de);break;case J.OPEN_CLI:e.ccInstInfo&&ln(e.ccInstInfo.cliPath);break;case J.EXIT:process.exit(0)}},c=()=>{s(null)};return o(he.Provider,{value:{settings:r.settings,updateSettings:t,changesApplied:r.changesApplied,ccVersion:e.ccInstInfo?.version||""},children:o(u,{flexDirection:"column",children:i===null?o(Vn,{onSubmit:h,notification:a}):i===J.THEMES?o(it,{onBack:c}):i===J.LAUNCH_TEXT?o(st,{onBack:c}):i===J.THINKING_VERBS?o(lt,{onBack:c}):i===J.THINKING_STYLE?o(at,{onBack:c}):i===J.USER_MESSAGE_DISPLAY?o(ct,{onBack:c}):i===J.INPUT_BOX?o(dt,{onSubmit:c}):null})})}const ht=async()=>{const e=new Bn;e.name("tweakcc").description("Command-line tool to customize your Claude Code theme colors, thinking verbs and more.").version("2.0.1").option("-d, --debug","enable debug mode").option("-a, --apply","apply saved customizations without interactive UI"),e.parse();const r=e.opts();if(r.debug&&Kr(),r.apply){console.log("Applying saved customizations to Claude Code..."),console.log(`Configuration saved at: ${de}`);const t=await Je();(!t.settings||Object.keys(t.settings).length===0)&&(console.error("No saved customizations found in "+de),process.exit(1));const i=await sn();(!i||!i.ccInstInfo)&&(console.error("Cannot find Claude Code's cli.js"),console.error("Searched at the following locations:"),Ge.forEach(s=>{s.isGlob?s.expandedPaths.length===0?console.error(` - ${s.pattern} (no matches)`):(console.error(` - ${s.pattern}`),s.expandedPaths.forEach(a=>{console.error(` - ${a}`)})):console.error(` - ${s.pattern}`)}),process.exit(1)),console.log(`Found Claude Code at: ${i.ccInstInfo.cliPath}`),console.log(`Version: ${i.ccInstInfo.version}`),console.log("Applying customizations..."),await yn(t,i.ccInstInfo),console.log("Customizations applied successfully!"),process.exit(0)}const n=await sn();n?Mn(o(gt,{startupCheckInfo:n})):(console.error(`Cannot find Claude Code's cli.js -- do you have Claude Code installed?
28
204
 
29
205
  Searched at the following locations:
30
- ${Re.map(s=>{if(s.isGlob){if(s.expandedPaths.length===0)return`- ${s.pattern} (no matches)`;{const l=[`- ${s.pattern}`];return s.expandedPaths.forEach(c=>{l.push(` - ${c}`)}),l.join(`
31
- `)}}else return`- ${s.pattern}`}).join(`
206
+ ${Ge.map(i=>{if(i.isGlob){if(i.expandedPaths.length===0)return`- ${i.pattern} (no matches)`;{const s=[`- ${i.pattern}`];return i.expandedPaths.forEach(a=>{s.push(` - ${a}`)}),s.join(`
207
+ `)}}else return`- ${i.pattern}`}).join(`
32
208
  `)}
33
209
 
34
210
  If you have it installed but it's in a location not listed above, please open an issue at
35
211
  https://github.com/piebald-ai/tweakcc/issues and tell us where you have it--we'll add that location
36
212
  to our search list and release an update today! And in the meantime, you can get tweakcc working
37
- by manually specifying that location in ${le} with the "ccInstallationDir" property:
213
+ by manually specifying that location in ${de} with the "ccInstallationDir" property:
38
214
 
39
215
  {
40
216
  "ccInstallationDir": "${process.platform=="win32"?"C:\\\\absolute\\\\path\\\\to\\\\node_modules\\\\@anthropic-ai\\\\claude-code":"/absolute/path/to/node_modules/@anthropic-ai/claude-code"}"
@@ -45,4 +221,4 @@ Notes:
45
221
  - Don't specify the path to your Claude Code executable's directory. It needs to be the path
46
222
  to the folder that contains **cli.js**.
47
223
  - Please also open an issue so that we can add your path to the search list for all users!
48
- `),process.exit(1))};Cn();
224
+ `),process.exit(1))};ht();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tweakcc",
3
- "version": "1.6.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "description": "Command-line tool to customize your Claude Code theme colors, thinking verbs and more.",
6
6
  "main": "dist/index.js",
@@ -48,13 +48,17 @@
48
48
  "vitest": "^3.2.4"
49
49
  },
50
50
  "dependencies": {
51
+ "@babel/parser": "^7.28.4",
51
52
  "@types/figlet": "^1.7.0",
52
53
  "chalk": "^5.5.0",
53
54
  "commander": "^14.0.0",
54
55
  "figlet": "^1.8.2",
55
56
  "globby": "^14.1.0",
57
+ "gray-matter": "^4.0.3",
56
58
  "ink": "^6.1.0",
57
59
  "ink-link": "^4.1.0",
60
+ "ollama": "^0.6.0",
61
+ "openai": "^6.3.0",
58
62
  "react": "^19.1.1"
59
63
  },
60
64
  "scripts": {