tweakcc 4.0.11 → 4.0.13

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.
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import{A as e,C as t,D as n,F as r,G as i,H as a,I as o,J as s,K as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,T as g,U as _,V as v,W as y,X as b,Y as x,_ as S,a as C,c as w,f as T,g as E,h as D,i as O,j as k,k as A,l as j,m as M,n as ee,o as te,p as N,q as ne,r as P,t as re,u as F,v as ie,w as I,y as ae}from"./config-ChxM7yMT.mjs";import{a as oe,c as se,d as ce,l as L,n as R,o as le,s as z,t as ue,u as de}from"./content-DgJsD7od.mjs";import{Box as B,Text as V,render as fe,useInput as H}from"ink";import{Command as pe}from"commander";import U from"chalk";import me,{Fragment as he,createContext as ge,useCallback as _e,useContext as W,useEffect as G,useMemo as ve,useRef as ye,useState as K}from"react";import*as be from"node:os";import xe from"ink-link";import*as Se from"node:fs/promises";import Ce from"node:fs/promises";import{structuredPatch as we}from"diff";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import Te from"process";import Ee from"cli-spinners";import*as De from"node:readline";import{execSync as Oe,spawn as ke}from"node:child_process";var X=({children:e,...t})=>Y(V,{bold:!0,backgroundColor:`#ffd500`,color:`#000`,...t,children:[` `,e,` `]});const Ae=[`\x1B[?25l\x1B[0m \x1B[38;2;0;0;0m \x1B[38;2;252;130;0m▂\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▇\x1B[38;2;254;131;0m\x1B[48;2;252;130;0m▇\x1B[48;2;252;130;0m▇▇\x1B[48;2;252;130;0m▇\x1B[0m\x1B[38;2;252;130;0m▇\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▂ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;254;131;0m▗\x1B[38;2;254;131;0m▆\x1B[48;2;254;131;0m \x1B[38;2;254;132;0m╶ \x1B[0m\x1B[38;2;254;131;0m▆\x1B[38;2;254;131;0m▖ \x1B[0m`,` \x1B[7m\x1B[38;2;254;131;0m▘\x1B[0m\x1B[38;2;11;6;0m\x1B[48;2;254;131;0m \x1B[38;2;254;216;182m\x1B[48;2;254;136;12m▃\x1B[38;2;254;249;246m\x1B[48;2;254;143;29m▅\x1B[38;2;254;253;253m\x1B[48;2;254;143;40m▆\x1B[38;2;254;254;253m\x1B[48;2;254;152;68m▆▆▆\x1B[38;2;254;253;252m\x1B[48;2;254;141;34m▆\x1B[38;2;254;247;242m\x1B[48;2;254;140;24m▅\x1B[38;2;254;224;199m\x1B[48;2;254;140;20m▖\x1B[48;2;254;131;0m \x1B[0m\x1B[7m\x1B[38;2;254;131;0m▝\x1B[0m \x1B[0m`,`\x1B[7m\x1B[38;2;251;127;0m▌\x1B[0m\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[38;2;252;128;0m\x1B[48;2;254;131;0m▃\x1B[38;2;252;129;0m▂\x1B[38;2;253;130;0m▁\x1B[38;2;249;135;16m\x1B[48;2;253;226;202m▋\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┈\x1B[48;2;246;246;245m┈\x1B[38;2;47;47;47m\x1B[48;2;244;244;243m▂\x1B[38;2;112;112;112m\x1B[48;2;251;251;251m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m▁╌▝\x1B[38;2;254;254;253m\x1B[48;2;254;254;254m▋\x1B[38;2;254;254;254m\x1B[48;2;254;253;252m┈\x1B[38;2;252;209;168m\x1B[48;2;251;129;0m▍\x1B[38;2;253;129;0m\x1B[48;2;254;131;0m▂\x1B[38;2;252;128;0m▃\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[0m\x1B[38;2;251;127;0m▌\x1B[0m`,`\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▏\x1B[38;2;245;118;0m\x1B[48;2;248;122;0m▄\x1B[38;2;247;121;0m\x1B[48;2;247;122;0m┈\x1B[38;2;106;68;38m\x1B[48;2;245;123;2m▃\x1B[38;2;39;33;28m\x1B[48;2;211;109;6m▅\x1B[38;2;27;20;12m\x1B[48;2;237;237;237m▌\x1B[48;2;254;254;253m \x1B[38;2;90;90;89m\x1B[48;2;231;230;230m▝\x1B[38;2;215;215;214m\x1B[48;2;48;48;48m▁\x1B[38;2;203;203;202m\x1B[48;2;42;42;42m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┇╴\x1B[38;2;253;252;252m▂\x1B[38;2;251;250;250m\x1B[48;2;253;253;253m▃\x1B[38;2;249;249;248m\x1B[48;2;252;252;251m▄\x1B[38;2;249;248;248m\x1B[48;2;237;118;0m▍\x1B[38;2;246;121;0m\x1B[48;2;250;125;0m▄\x1B[38;2;246;119;0m\x1B[48;2;249;124;0m▄\x1B[38;2;245;118;0m\x1B[48;2;248;123;0m▄\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▉\x1B[0m`,`\x1B[38;2;238;108;0m\x1B[48;2;237;109;0m▏\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;233;109;2m\x1B[48;2;125;73;29m▇\x1B[38;2;225;104;1m\x1B[48;2;50;32;18m▄\x1B[38;2;62;29;2m\x1B[48;2;239;237;237m▌\x1B[38;2;254;253;253m\x1B[48;2;254;254;254m┻\x1B[38;2;254;254;253m▊\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;253;253;252m▂\x1B[38;2;251;251;251m\x1B[48;2;254;253;253m▃\x1B[38;2;249;249;249m\x1B[48;2;252;252;252m▄\x1B[38;2;247;247;247m\x1B[48;2;250;250;250m▄\x1B[38;2;245;245;244m\x1B[48;2;248;248;248m▄\x1B[38;2;243;243;242m\x1B[48;2;246;246;245m▄\x1B[38;2;243;242;242m\x1B[48;2;230;109;0m▍\x1B[38;2;239;111;0m\x1B[48;2;243;116;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;237;108;0m\x1B[48;2;238;108;0m▉\x1B[0m`,`\x1B[7m\x1B[38;2;231;98;0m▌\x1B[0m\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[38;2;231;99;0m\x1B[48;2;235;105;0m▄\x1B[38;2;232;100;0m\x1B[48;2;236;105;0m▄\x1B[38;2;232;101;0m\x1B[48;2;236;106;0m▄\x1B[38;2;223;99;0m\x1B[48;2;247;238;235m▌\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;252;252;251m▃\x1B[38;2;250;250;250m\x1B[48;2;253;253;252m▄\x1B[38;2;248;248;247m\x1B[48;2;251;251;250m▄\x1B[38;2;246;245;245m\x1B[48;2;249;248;248m▄\x1B[38;2;243;243;243m\x1B[48;2;246;246;246m▄\x1B[38;2;241;241;241m\x1B[48;2;244;244;244m▄\x1B[38;2;239;239;238m\x1B[48;2;242;242;242m▄\x1B[38;2;237;237;236m\x1B[48;2;240;240;239m▄\x1B[38;2;237;236;236m\x1B[48;2;223;99;0m▍\x1B[38;2;232;100;0m\x1B[48;2;236;106;0m▄\x1B[38;2;231;100;0m\x1B[48;2;235;105;0m▄\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[0m\x1B[38;2;231;98;0m▌\x1B[0m`,` \x1B[7m\x1B[38;2;224;89;0m▖\x1B[0m\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[38;2;225;90;0m\x1B[48;2;228;95;0m▄\x1B[38;2;225;91;0m\x1B[48;2;229;96;0m▄\x1B[38;2;217;90;1m\x1B[48;2;97;77;70m▌\x1B[38;2;70;70;70m\x1B[48;2;207;207;207m▆\x1B[38;2;66;65;65m\x1B[48;2;228;228;227m▄\x1B[38;2;66;66;66m\x1B[48;2;233;232;232m▂\x1B[38;2;169;169;169m\x1B[48;2;243;243;243m▁\x1B[38;2;240;239;239m\x1B[48;2;243;242;242m▄\x1B[38;2;238;237;237m\x1B[48;2;241;240;240m▄\x1B[38;2;235;235;235m\x1B[48;2;238;238;238m▄\x1B[38;2;233;233;233m\x1B[48;2;236;236;236m▄\x1B[38;2;231;231;230m\x1B[48;2;234;234;233m▄\x1B[38;2;231;230;230m\x1B[48;2;216;89;0m▍\x1B[38;2;225;90;0m\x1B[48;2;229;95;0m▄\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[0m\x1B[7m\x1B[38;2;224;89;0m▗\x1B[0m \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;217;80;0m▝\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m\x1B[48;2;221;86;0m▄\x1B[38;2;197;78;9m\x1B[48;2;66;66;65m▋\x1B[38;2;65;65;64m\x1B[48;2;60;60;60m▘\x1B[38;2;52;52;51m\x1B[48;2;56;56;56m▗\x1B[38;2;45;45;45m\x1B[48;2;50;50;49m▗\x1B[38;2;42;42;42m\x1B[48;2;46;46;46m┈\x1B[38;2;41;41;41m\x1B[48;2;203;202;202m▆\x1B[38;2;38;38;38m\x1B[48;2;218;218;218m▄\x1B[38;2;45;45;45m\x1B[48;2;221;221;221m▂\x1B[38;2;229;229;229m┊\x1B[38;2;225;225;225m\x1B[48;2;228;228;227m▄\x1B[38;2;225;224;224m\x1B[48;2;209;79;0m▍\x1B[0m\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m▘ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[7m\x1B[38;2;191;73;0m▆\x1B[38;2;191;73;0m▄\x1B[38;2;56;55;55m▃\x1B[38;2;46;46;46m▁\x1B[0m\x1B[38;2;20;20;20m\x1B[48;2;42;42;42m▁\x1B[38;2;36;36;36m\x1B[48;2;35;34;34m╴\x1B[38;2;23;23;23m\x1B[48;2;29;29;28m▁\x1B[38;2;10;10;10m\x1B[48;2;22;22;22m▁\x1B[0m\x1B[7m\x1B[38;2;15;15;15m▁\x1B[38;2;22;22;21m▃\x1B[38;2;154;154;154m▅\x1B[38;2;175;116;83m▇\x1B[0m\x1B[38;2;17;15;14m \x1B[0m`,`\x1B[?25h\x1B[0m`];var je=()=>Y(B,{flexDirection:`row`,height:10,alignItems:`center`,borderStyle:`bold`,borderBottom:!1,borderTop:!1,borderRight:!1,borderColor:`#ff8400`,marginBottom:1,children:[Y(B,{marginBottom:1,paddingLeft:1,flexDirection:`column`,flexGrow:1,children:[J(V,{bold:!0,color:`#ff8400`,children:`Piebald is released!`}),J(V,{children:` `}),Y(V,{children:[`We've released `,J(V,{bold:!0,children:`Piebald`}),`, the ultimate agentic AI developer experience.`]}),Y(V,{children:[`Download it and try it out for free!`,` `,J(xe,{url:`https://piebald.ai/`,fallback:!1,children:J(V,{color:`#ff8400`,children:`https://piebald.ai/`})})]}),J(V,{children:` `}),J(V,{dimColor:!0,color:`gray`,children:`press 'h' to hide`})]}),J(B,{width:22,flexShrink:0,flexDirection:`column`,alignItems:`center`,children:Ae.map((e,t)=>J(V,{children:e},t))})]});let Z=function(e){return e.THEMES=`Themes`,e.THINKING_VERBS=`Thinking verbs`,e.THINKING_STYLE=`Thinking style`,e.USER_MESSAGE_DISPLAY=`User message display`,e.INPUT_PATTERN_HIGHLIGHTERS=`Input pattern highlighters`,e.MISC=`Misc`,e.TOOLSETS=`Toolsets`,e.SUBAGENT_MODELS=`Subagent models`,e.CLAUDE_MD_ALT_NAMES=`CLAUDE.md alternative names`,e.VIEW_SYSTEM_PROMPTS=`View system prompts`,e.RESTORE_ORIGINAL=`Restore original Claude Code (preserves config.json)`,e.OPEN_CONFIG=`Open config.json`,e.OPEN_CLI=`Open Claude Code's cli.js`,e.EXIT=`Exit`,e}({});function Me({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return H((i,a)=>{a.upArrow?n(t>0?t-1:e.length-1):a.downArrow?n(t<e.length-1?t+1:0):a.return&&r(e[t].name)}),J(B,{flexDirection:`column`,children:e.map((e,n)=>J(B,{children:Y(V,{children:[Y(V,{bold:n===t,color:n===t?`cyan`:void 0,...n===t?e.selectedStyles??{}:e.styles??{},children:[n===t?`❯ `:` `,e.name]}),e.desc&&n===t&&Y(V,{dimColor:!0,bold:!1,children:[` \x1B[0;2m`,`- `,e.desc]})]})},n))})}const Ne=[{name:Z.THEMES,desc:`Modify Claude Code's built-in themes or create your own`},{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_PATTERN_HIGHLIGHTERS,desc:`Create custom highlighters for patterns in your input`},{name:Z.MISC,desc:`Miscellaneous settings (input box border, etc.)`},{name:Z.TOOLSETS,desc:`Manage toolsets to control which tools are available`},{name:Z.SUBAGENT_MODELS,desc:`Configure which Claude model each subagent uses (Plan, Explore, etc.)`},{name:Z.CLAUDE_MD_ALT_NAMES,desc:`Configure alternative filenames for CLAUDE.md (e.g., AGENTS.md)`},{name:Z.VIEW_SYSTEM_PROMPTS,desc:`Opens the system prompts directory where you can customize Claude Code's system prompts`}],Pe=[{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 (${P})`},{name:Z.OPEN_CLI,desc:`Opens Claude Code's cli.js file`},{name:Z.EXIT,desc:`Bye!`}];var Fe=({onSubmit:e})=>{let t=[...Ne,...Pe],[n,r]=K(0);return J(Me,{items:t,selectedIndex:n,onSelect:r,onSubmit:t=>e(t)})};const Ie=()=>Y(B,{flexDirection:`row`,children:[J(X,{children:`tweakcc`}),J(V,{children:` (by `}),J(xe,{url:`https://piebald.ai`,fallback:!1,children:J(V,{color:`#ff8400`,bold:!0,children:`Piebald`})}),J(V,{children:`)`})]}),Le=()=>J(B,{children:Y(V,{color:`yellow`,children:[`⭐ `,J(V,{bold:!0,children:`Star the repo at `}),J(xe,{url:`https://github.com/Piebald-AI/tweakcc`,fallback:!1,children:J(V,{bold:!0,color:`cyan`,children:`https://github.com/Piebald-AI/tweakcc`})}),J(V,{bold:!0,children:` if you find this useful!`}),` ⭐`]})}),Re=({notification:e})=>J(B,{borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`bold`,borderColor:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,paddingLeft:1,flexDirection:`column`,children:J(V,{color:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,children:e.message})}),ze=({onSubmit:e,notification:t,configMigrated:n,showPiebaldAnnouncement:r,changesApplied:i,invocationCommand:a})=>Y(B,{flexDirection:`column`,gap:1,children:[n&&J(B,{children:J(V,{color:`blue`,bold:!0,children:"Note that in tweakcc v3.2.0+, `ccInstallationDir` config is deprecated. You are now migrated to `ccInstallationPath` which supports npm and native installs."})}),J(Ie,{}),J(B,{children:Y(V,{children:[J(V,{bold:!0,children:`Customize your Claude Code installation.`}),` `,Y(V,{dimColor:!0,children:[`Settings will be saved to `,ee.replace(be.homedir(),`~`),`/config.json.`]})]})}),J(r?je:Le,{}),t&&J(Re,{notification:t}),!i&&!t&&J(Re,{notification:{message:`Your changes are configured but not applied.\nRun \`${a} --apply\` to apply your customizations!`,type:`info`}}),J(Fe,{onSubmit:e})]});function Q({color:e,backgroundColor:t,bold:n,dimColor:r,children:i}){let a=e?.startsWith(`ansi:`),o=t?.startsWith(`ansi:`);if(a||o){if(me.Children.toArray(i).some(e=>me.isValidElement(e)))return J(V,{children:i});let s=U;if(a){let t=e.slice(5);s=s[t]||s}if(o){let e=t.slice(5),n=e.startsWith(`bg`)?e:`bg${e.charAt(0).toUpperCase()}${e.slice(1)}`;s=s[n]||s}n&&(s=s.bold),r&&(s=s.dim);let c=me.Children.toArray(i).map(e=>typeof e==`string`||typeof e==`number`?String(e):``).join(``);return J(V,{children:s(c)})}return J(V,{color:e,backgroundColor:t,bold:n,dimColor:r,children:i})}function Be({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:i=50,restartPoint:a=10}){let[o,s]=K(0);return G(()=>{let t=setInterval(()=>{s(t=>{let n=t+1;return n>=e.length+a?-r:n})},i);return()=>clearInterval(t)},[e.length,a,i]),t.length===n.length?J(V,{children:e.split(``).map((i,a)=>{let s=a>=o&&a<o+r&&o<e.length,c=a%t.length;return J(V,{color:s?n[c]:t[c],children:i},a)})}):(console.error(`UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length`),J(V,{children:e}))}const Ve=Te.cwd();function He({theme:e}){let{ccVersion:t}=W($);return Y(B,{flexDirection:`column`,paddingLeft:1,children:[J(B,{marginBottom:1,children:Y(V,{bold:!0,children:[`Preview: `,e.name]})}),J(B,{borderStyle:`single`,borderColor:`gray`,paddingX:1,children:Y(B,{flexDirection:`column`,children:[Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:` ▐`}),J(V,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`▛███▜`}),Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:`▌ `}),` `,J(V,{bold:!0,children:`Claude Code`}),` `,t?`v${t}`:`v2.0.14`]})]}),Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:`▝▜`}),J(V,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`█████`}),J(Q,{color:e.colors.clawd_body,children:`▛▘`}),` `,ae(),` · `,S()]}),Y(Q,{color:e.colors.clawd_body,children:[` `,`▘▘ ▝▝`,` `,Ve]}),Y(V,{children:[Y(Q,{color:e.colors.success,children:[`Login successful. Press`,` `]}),J(Q,{bold:!0,color:e.colors.success,children:`Enter`}),Y(Q,{color:e.colors.success,children:[` `,`to continue…`]})]})]}),J(V,{children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[`│ 1 function greet() `,`{`,` `,`│`]}),Y(V,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:`- console.log("`}),J(Q,{backgroundColor:e.colors.diffRemovedWord,children:`Hello, World!`}),J(Q,{backgroundColor:e.colors.diffRemoved,children:`");`}),` `,`│`]}),Y(V,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:`+ console.log("`}),J(Q,{backgroundColor:e.colors.diffAddedWord,children:`Hello, Claude!`}),J(Q,{backgroundColor:e.colors.diffAdded,children:`");`}),` `,`│`]}),J(Q,{color:e.colors.warning,children:`╭─────────────────────────────────────────────╮`}),Y(Q,{color:e.colors.warning,children:[`│ Do you trust the files in this folder?`,` `,`│`]}),Y(V,{children:[J(Q,{color:e.colors.warning,children:`│ `}),J(V,{dimColor:!0,children:`Enter to confirm · Esc to exit`}),Y(Q,{color:e.colors.warning,children:[` `,`│`]})]}),J(Q,{color:e.colors.bashBorder,children:`───────────────────────────────────────────────`}),Y(V,{children:[J(Q,{color:e.colors.bashBorder,children:`!`}),J(V,{children:` ls`})]}),J(Q,{color:e.colors.promptBorder,children:`───────────────────────────────────────────────`}),J(V,{children:Y(V,{children:[`> list the dir`,` `,J(Be,{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})]})}),J(Q,{color:e.colors.planMode,children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[J(Q,{color:e.colors.planMode,children:`│ `}),Y(Q,{color:e.colors.permission,children:[`Ready to code?`,` `]}),J(V,{children:`Here is Claude's plan:`}),Y(Q,{color:e.colors.planMode,children:[` `,`│`]})]}),J(Q,{color:e.colors.permission,children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[J(Q,{color:e.colors.permission,children:`│ `}),J(V,{bold:!0,children:`Permissions:`}),` `,Y(Q,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[` `,`Allow`,` `]}),` `,`Deny`,` `,`Workspace`,` `,J(Q,{color:e.colors.permission,children:`│`})]}),J(V,{children:`> list the dir`}),Y(V,{children:[J(Q,{color:e.colors.error,children:`●`}),J(V,{children:` Update(__init__.py)`})]}),Y(V,{children:[J(V,{children:` ⎿ `}),J(Q,{color:e.colors.error,children:`User rejected update to __init__.py`})]}),Y(V,{children:[` `,`1`,` `,Y(Q,{backgroundColor:e.colors.diffRemovedDimmed,children:[`- import`,` `]}),J(Q,{backgroundColor:e.colors.diffRemovedWordDimmed,children:`os`})]}),Y(V,{children:[` `,`2`,` `,Y(Q,{backgroundColor:e.colors.diffAddedDimmed,children:[`+ import`,` `]}),J(Q,{backgroundColor:e.colors.diffAddedWordDimmed,children:`random`})]}),Y(V,{children:[J(Q,{color:e.colors.success,children:`●`}),J(V,{children:` List(.)`})]}),Y(V,{children:[J(V,{children:`●`}),J(V,{children:` The directory `}),J(Q,{color:e.colors.permission,children:`C:\\Users\\user`}),Y(V,{children:[` `,`contains `,J(V,{bold:!0,children:`123`}),` files.`]})]}),Y(V,{children:[J(Q,{color:e.colors.claude,children:`✻ Th`}),J(Q,{color:e.colors.claudeShimmer,children:`ink`}),J(Q,{color:e.colors.claude,children:`ing… `}),J(V,{children:`(esc to interrupt)`})]}),J(V,{children:J(Q,{color:e.colors.autoAccept,children:`⏵⏵ accept edits on (shift+tab to cycle)`})}),J(V,{children:J(Q,{color:e.colors.planMode,children:`⏸ plan mode on (shift+tab to cycle)`})}),J(V,{children:J(Q,{color:e.colors.ide,children:`◯ IDE connected ⧉ 44 lines selected`})})]})})]})}function Ue({colorKey:e,theme:t,bold:n=!1}){let r=t.colors[e];return e===`inverseText`?J(Q,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith(`diff`)?J(Q,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):J(Q,{color:r,bold:n,children:e})}function We({initialValue:e,onColorChange:n,onExit:r,colorKey:i,theme:a}){let o=Ke(e)||{h:0,s:50,l:50},s=Ge(e)||{r:128,g:128,b:128},[c,l]=K(o),[u,d]=K(s),[f,p]=K(`hsl`),[m,h]=K(`h`),[g,_]=K(!1),[v,y]=K(!1);G(()=>{let t=Ke(e),n=Ge(e);t&&n&&(_(!0),l(t),d(n),_(!1))},[e]),G(()=>{!g&&v&&n(`rgb(${u.r},${u.g},${u.b})`)},[c,u,g,v]),G(()=>{y(!0)},[]);let b=e=>{if(t(e)){let t=I(e),n=Ke(t),r=Ge(t);n&&r&&(_(!0),l(n),d(r),_(!1))}};H((e,t)=>{if(e.length>1&&!t.ctrl&&!t.meta){b(e);return}t.return||t.escape?r():t.ctrl&&e===`a`?(p(e=>e===`hsl`?`rgb`:`hsl`),h(e=>f===`hsl`?e===`h`?`r`:e===`s`?`g`:`b`:e===`r`?`h`:e===`g`?`s`:`l`)):t.upArrow?h(f===`hsl`?e=>e===`h`?`l`:e===`s`?`h`:`s`:e=>e===`r`?`b`:e===`g`?`r`:`g`):t.downArrow||t.tab?h(f===`hsl`?e=>e===`h`?`s`:e===`s`?`l`:`h`:e=>e===`r`?`g`:e===`g`?`b`:`r`):t.leftArrow?x(t.shift||t.ctrl||t.meta?-10:-1):t.rightArrow&&x(t.shift||t.ctrl||t.meta?10:1)});let x=e=>{_(!0),f===`hsl`?l(t=>{let n={...t};m===`h`?n.h=Math.max(0,Math.min(359,t.h+e)):m===`s`?n.s=Math.max(0,Math.min(100,t.s+e)):m===`l`&&(n.l=Math.max(0,Math.min(100,t.l+e)));let[r,i,a]=C(n.h,n.s,n.l);return d({r,g:i,b:a}),n}):d(t=>{let n={...t};return m===`r`?n.r=Math.max(0,Math.min(255,t.r+e)):m===`g`?n.g=Math.max(0,Math.min(255,t.g+e)):m===`b`&&(n.b=Math.max(0,Math.min(255,t.b+e))),l(S(n.r,n.g,n.b)),n}),_(!1)},S=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===r?((i-a)/c+(i<a?6:0))/6:o===i?((a-r)/c+2)/6:((r-i)/c+4)/6),{h:Math.round(d*360),s:Math.round(u*100),l:Math.round(l*100)}},C=(e,t,n)=>{e/=360,t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e*6%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<1/6?(o=r,s=i,c=0):1/6<=e&&e<2/6?(o=i,s=r,c=0):2/6<=e&&e<3/6?(o=0,s=r,c=i):3/6<=e&&e<4/6?(o=0,s=i,c=r):4/6<=e&&e<5/6?(o=i,s=0,c=r):5/6<=e&&e<1&&(o=r,s=0,c=i),[Math.round((o+a)*255),Math.round((s+a)*255),Math.round((c+a)*255)]},w=()=>{let e=[],t=[[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 n=0;n<40;n++){let r=n/39*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=r-i,[s,c,l]=t[i],[u,d,f]=t[a],p=Math.round(s+(u-s)*o),m=Math.round(c+(d-c)*o),h=Math.round(l+(f-l)*o);e.push(J(V,{backgroundColor:`rgb(${p},${m},${h})`,children:` `},n))}return e},T=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=C(c.h,n,c.l);e.push(J(V,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},E=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=C(c.h,c.s,n);e.push(J(V,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},D=()=>{let[e,t,n]=C(c.h,c.s,c.l);return`rgb(${e},${t},${n})`},O=(e,t,n)=>{let r=e=>e.toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},k=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${n},${u.g},${u.b})`,children:` `},t))}return e},A=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${u.r},${n},${u.b})`,children:` `},t))}return e},j=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${u.r},${u.g},${n})`,children:` `},t))}return e},M=(e,t)=>Math.round(e/t*39);return Y(B,{flexDirection:`column`,borderStyle:`single`,borderColor:`white`,padding:1,children:[Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Color Picker`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{color:`gray`,dimColor:!0,children:`←→ to adjust (shift/ctrl/cmd +10)`}),J(V,{color:`gray`,dimColor:!0,children:`↑↓ to change bar`}),J(V,{color:`gray`,dimColor:!0,children:`ctrl+a to switch rgb/hsl`}),J(V,{color:`gray`,dimColor:!0,children:`paste color from clipboard`}),J(V,{color:`gray`,dimColor:!0,children:`enter to exit (auto-saved)`}),J(V,{color:`gray`,dimColor:!0,children:`esc to save and exit`})]})]}),f===`hsl`?Y(q,{children:[Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`h`?`yellow`:`white`,children:[m===`h`?`❯ `:` `,`Hue (`,c.h,`°):`]})}),J(B,{children:w().map((e,t)=>J(he,{children:t===M(c.h,360)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`s`?`yellow`:`white`,children:[m===`s`?`❯ `:` `,`Saturation (`,c.s,`%):`]})}),J(B,{children:T().map((e,t)=>J(he,{children:t===M(c.s,100)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`l`?`yellow`:`white`,children:[m===`l`?`❯ `:` `,`Lightness (`,c.l,`%):`]})}),J(B,{children:E().map((e,t)=>J(he,{children:t===M(c.l,100)?J(V,{children:`|`}):e},t))})]})]}):Y(q,{children:[Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`r`?`yellow`:`white`,children:[m===`r`?`❯ `:` `,`Red (`,u.r,`):`]})}),J(B,{children:k().map((e,t)=>J(he,{children:t===M(u.r,255)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`g`?`yellow`:`white`,children:[m===`g`?`❯ `:` `,`Green (`,u.g,`):`]})}),J(B,{children:A().map((e,t)=>J(he,{children:t===M(u.g,255)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:m===`b`?`yellow`:`white`,children:[m===`b`?`❯ `:` `,`Blue (`,u.b,`):`]})}),J(B,{children:j().map((e,t)=>J(he,{children:t===M(u.b,255)?J(V,{children:`|`}):e},t))})]})]}),Y(B,{marginBottom:1,children:[J(V,{children:`Current: `}),J(V,{backgroundColor:D(),children:` `})]}),Y(B,{flexDirection:`row`,justifyContent:`space-between`,children:[Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`Hex `}),i?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:a?.colors?.text||`white`,bold:!0,children:O(u.r,u.g,u.b)}):i===`inverseText`?J(V,{color:D(),backgroundColor:a?.colors?.permission,bold:!0,children:O(u.r,u.g,u.b)}):J(V,{color:D(),bold:!0,children:O(u.r,u.g,u.b)})]}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`RGB `}),i?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:a?.colors?.text||`white`,bold:!0,children:`rgb(${u.r}, ${u.g}, ${u.b})`}):i===`inverseText`?J(V,{color:D(),backgroundColor:a?.colors?.permission,bold:!0,children:`rgb(${u.r}, ${u.g}, ${u.b})`}):J(V,{color:D(),bold:!0,children:`rgb(${u.r}, ${u.g}, ${u.b})`})]}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`HSL `}),i?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:a?.colors?.text||`white`,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):i===`inverseText`?J(V,{color:D(),backgroundColor:a?.colors?.permission,bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`}):J(V,{color:D(),bold:!0,children:`hsl(${c.h}, ${c.s}%, ${c.l}%)`})]})]})]})}function Ge(e){let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};let n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){let e=n[1];return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)}}return null}function Ke(e){let t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){let e=parseInt(n[1])/255,t=parseInt(n[2])/255,r=parseInt(n[3])/255,i=Math.max(e,t,r),a=Math.min(e,t,r),o=i-a,s=(i+a)/2,c=0;o!==0&&(c=s>.5?o/(2-i-a):o/(i+a));let l=0;return o!==0&&(l=i===e?((t-r)/o+(t<r?6:0))/6:i===t?((r-e)/o+2)/6:((e-t)/o+4)/6),{h:Math.round(l*360),s:Math.round(c*100),l:Math.round(s*100)}}let r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){let e=r[1],t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,i=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,i),o=Math.min(t,n,i),s=a-o,c=(a+o)/2,l=0;s!==0&&(l=c>.5?s/(2-a-o):s/(a+o));let u=0;return s!==0&&(u=a===t?((n-i)/s+(n<i?6:0))/6:a===n?((i-t)/s+2)/6:((t-n)/s+4)/6),{h:Math.round(u*360),s:Math.round(l*100),l:Math.round(c*100)}}return{h:0,s:50,l:50}}function qe({onBack:e,themeId:n}){let{settings:{themes:r},updateSettings:i}=W($),[a,o]=K(n),s=r.find(e=>e.id===a)||r[0],[c,l]=K(`rgb`),[u,d]=K(0),[p,m]=K(null),[h,g]=K(null),[_,v]=K(``),[y,b]=K(``),[x,S]=K(!1),[C,w]=K(0),T=_e(e=>{i(t=>{let n=t.themes.findIndex(e=>e.id===a);n!==-1&&e(t.themes[n])})},[a,i]),E=e=>{if(u>=2&&t(e)){let t=I(e),n=D[u-2];T(e=>{e.colors[n]=t})}};H((t,n)=>{if(x){if(n.escape){S(!1),e();return}return}if(p===null&&h===null){if(t.length>1&&!n.ctrl&&!n.meta){E(t);return}if(n.escape)S(!0),w(0);else if(n.ctrl&&t===`a`)l(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(n.upArrow)d(e=>Math.max(0,e-1));else if(n.downArrow)d(e=>Math.min(D.length+1,e+1));else if(n.return)if(u===0)g(`name`),v(s.name),b(s.name);else if(u===1)g(`id`),v(s.id),b(s.id);else{let e=u-2,t=D[e],n=s.colors[t];m(e),v(n),b(n)}}else if(p!==null)n.ctrl&&t===`a`&&l(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(h!==null)if(n.return){if(h===`id`){let e=a;o(_),i(t=>{let n=t.themes.findIndex(t=>t.id===e);n!==-1&&(t.themes[n].id=_)})}else T(e=>{e.name=_});g(null),v(``),b(``)}else n.escape?(g(null),v(``),b(``)):n.backspace||n.delete?v(e=>e.slice(0,-1)):t&&v(e=>e+t)});let D=Object.keys(s.colors),O=(e,t)=>{let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!n)return e;let r=parseInt(n[1]),i=parseInt(n[2]),a=parseInt(n[3]);switch(t){case`hex`:{let e=e=>e.toString(16).padStart(2,`0`);return`#${e(r)}${e(i)}${e(a)}`}case`hsl`:{let e=r/255,t=i/255,n=a/255,o=Math.max(e,t,n),s=Math.min(e,t,n),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===e?((t-n)/c+(t<n?6:0))/6:o===t?((n-e)/c+2)/6:((e-t)/c+4)/6),`hsl(${Math.round(d*360)}, ${Math.round(u*100)}%, ${Math.round(l*100)}%)`}case`rgb`:default:return e}},k=e=>({autoAccept:`Auto-accept edits 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`})[e]||``,A=Math.max(...D.map(e=>e.length));return Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(X,{children:[`Editing theme “`,s.name,`” (`,s.id,`)`]})}),x?Y(B,{flexDirection:`column`,marginTop:1,children:[J(B,{marginBottom:1,children:Y(V,{bold:!0,children:[`Would you like to make “`,s.name,`” your current Claude Code theme?`]})}),J(Me,{items:[{name:`Yes`,desc:`Set ${s.id} as active theme`},{name:`No`,desc:`Go back without changing theme`}],selectedIndex:C,onSelect:w,onSubmit:()=>{C===0&&f(s.id),S(!1),e()}}),J(V,{dimColor:!0,children:`enter to select, esc to cancel`})]}):p===null&&h===null?Y(q,{children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`enter to edit theme name, id, or color`}),J(V,{dimColor:!0,children:`ctrl+a to toggle rgb, hex, hsl`}),J(V,{dimColor:!0,children:`paste color from clipboard (when on color)`}),J(V,{dimColor:!0,children:`esc to go back`})]}),u<2?Y(B,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:`yellow`,flexDirection:`column`,paddingLeft:1,children:[J(V,{bold:!0,children:u===0?`Theme Name`:`Theme ID`}),J(V,{children:u===0?`The display name for this theme`:"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):Y(B,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:s.colors[D[u-2]],flexDirection:`column`,paddingLeft:1,children:[J(Ue,{colorKey:D[u-2],theme:s,bold:!0}),J(V,{children:k(D[u-2])})]}),Y(B,{flexDirection:`column`,children:[Y(B,{children:[J(V,{color:u===0?`yellow`:`white`,children:u===0?`❯ `:` `}),J(V,{bold:!0,children:`Name: `}),J(V,{children:s.name})]}),Y(B,{marginBottom:1,children:[J(V,{color:u===1?`yellow`:`white`,children:u===1?`❯ `:` `}),J(V,{bold:!0,children:`ID: `}),J(V,{children:s.id})]}),(()=>{if(u<2)return Y(q,{children:[D.slice(0,20).map((e,t)=>{let n=t+2;return Y(B,{children:[J(V,{color:u===n?`yellow`:`white`,children:u===n?`❯ `:` `}),J(B,{width:A+2,children:J(V,{children:J(Ue,{colorKey:e,theme:s,bold:!0})})}),J(Q,{color:s.colors[e],children:O(s.colors[e],c)})]},e)}),D.length>20&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-20,` more below`]})]});let e=u-2,t=Math.max(0,e-10),n=Math.min(D.length,t+20),r=Math.max(0,n-20),i=D.slice(r,n);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t+2;return Y(B,{children:[J(V,{color:u===n?`yellow`:`white`,children:u===n?`❯ `:` `}),J(B,{width:A+2,children:J(V,{children:J(Ue,{colorKey:e,theme:s,bold:!0})})}),J(Q,{color:s.colors[e],children:O(s.colors[e],c)})]},e)}),n<D.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,D.length-n,` more below`]})]})})()]})]}):h?Y(B,{flexDirection:`column`,marginTop:1,children:[Y(V,{children:[`Editing `,h===`name`?`theme name`:`theme ID`,`:`]}),J(B,{borderStyle:`round`,borderColor:`yellow`,paddingX:1,children:J(V,{children:_})}),J(V,{dimColor:!0,children:`enter to save, esc to cancel`})]}):J(We,{initialValue:y,colorKey:D[p],theme:s,onColorChange:e=>{v(e),T(t=>{t.colors[D[p]]=e})},onExit:()=>{T(e=>{e.colors[D[p]]=_}),m(null),v(``),b(``)}})]}),J(B,{width:`50%`,children:J(He,{theme:s})})]})}function Je(e){return e.map(e=>`${e.name} (${e.id})`)}function Ye({onBack:e}){let{settings:{themes:t},updateSettings:n}=W($),[r,i]=K(0),[a,o]=K(null),[s,c]=K(!0),l=()=>{let e={colors:{...(t[0]||b.themes[0]).colors},name:`New Custom Theme`,id:`custom-${Date.now()}`};n(t=>{t.themes.push(e)}),o(e.id),c(!1)},u=e=>{t.length<=1||(n(t=>{t.themes=t.themes.filter(t=>t.id!==e)}),r>=t.length-1&&i(Math.max(0,t.length-2)))},d=()=>{n(e=>{e.themes=[...b.themes]}),i(0)};if(H((n,a)=>{if(a.escape)e();else if(a.upArrow)i(e=>Math.max(0,e-1));else if(a.downArrow)i(e=>Math.min(t.length-1,e+1));else if(a.return){let e=t[r];e&&(o(e.id),c(!1))}else if(n===`n`)l();else if(n===`d`){let e=t[r];e&&u(e.id)}else a.ctrl&&n===`r`&&d()},{isActive:s}),a)return J(qe,{themeId:a,onBack:()=>{o(null),c(!0)}});let f=Je(t),p=t.find(e=>f[r]?.includes(`(${e.id})`))||t[0];return t.length===0?J(B,{children:Y(B,{flexDirection:`column`,width:`100%`,children:[J(X,{children:`Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),J(V,{children:`No themes available!`})]})}):Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new theme`}),J(V,{dimColor:!0,children:`d to delete a theme`}),J(V,{dimColor:!0,children:`ctrl+r to delete all themes and restore built-in`}),J(V,{dimColor:!0,children:`enter to edit theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),J(B,{flexDirection:`column`,children:f.map((e,t)=>Y(V,{color:r===t?`yellow`:void 0,children:[r===t?`❯ `:` `,e]},t))})]}),J(B,{width:`50%`,children:J(He,{theme:p})})]})}function Xe({onBack:e}){let{settings:{thinkingVerbs:{format:t,verbs:n},themes:r},updateSettings:i}=W($),a=[`format`,`verbs`],[o,s]=K(0),c=a[o],[l,u]=K(0),[d,f]=K(!1),[p,m]=K(``),[h,g]=K(!1),[_,v]=K(!1),[y,x]=K(t),S=ie(),C=(r.find(e=>e.id===S)||r.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;return H((r,o)=>{if(_){o.return?(i(e=>{e.thinkingVerbs.format=y}),v(!1)):o.escape?(x(t),v(!1)):o.backspace||o.delete?x(e=>e.slice(0,-1)):r&&x(e=>e+r);return}if(d||h){o.return&&p.trim()?(h?(i(e=>{e.thinkingVerbs.verbs.push(p.trim())}),g(!1)):(i(e=>{e.thinkingVerbs.verbs[l]=p.trim()}),f(!1)),m(``)):o.escape?(m(``),f(!1),g(!1)):o.backspace||o.delete?m(e=>e.slice(0,-1)):r&&m(e=>e+r);return}o.escape?e():o.return?c===`format`&&(x(t),v(!0)):o.tab?o.shift?s(e=>e===0?a.length-1:e-1):s(e=>e===a.length-1?0:e+1):o.upArrow?c===`verbs`&&n.length>0&&u(e=>e>0?e-1:n.length-1):o.downArrow?c===`verbs`&&n.length>0&&u(e=>e<n.length-1?e+1:0):r===`e`&&c===`verbs`?n.length>0&&(m(n[l]),f(!0)):r===`d`&&c===`verbs`?n.length>1&&(i(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==l)}),l>=n.length-1&&u(Math.max(0,n.length-2))):r===`n`&&c===`verbs`?(g(!0),m(``)):o.ctrl&&r===`r`&&c===`verbs`&&(i(e=>{e.thinkingVerbs.verbs=[...b.thinkingVerbs.verbs]}),u(0))}),Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`Thinking Verbs`}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:c===`format`?`enter to edit format`:`changes auto-saved`}),J(V,{dimColor:!0,children:`esc to go back`}),J(V,{dimColor:!0,children:`tab to switch sections`})]})]}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Customize the verbs shown during generation and their format.`})}),Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:c===`format`?`yellow`:void 0,children:c===`format`?`❯ `:` `}),J(V,{bold:!0,color:c===`format`?`yellow`:void 0,children:`Format`})]}),c===`format`&&(_?Y(V,{dimColor:!0,children:[` `,`enter to save`]}):Y(V,{dimColor:!0,children:[` `,`enter to edit`]}))]}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:_?`yellow`:`gray`,children:J(V,{children:_?y:t})})}),J(B,{children:Y(V,{children:[J(V,{color:c===`verbs`?`yellow`:void 0,children:c===`verbs`?`❯ `:` `}),J(V,{bold:!0,color:c===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),c===`verbs`&&J(B,{flexDirection:`column`,children:Y(V,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),J(B,{marginLeft:2,marginBottom:1,children:Y(B,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,l-4),t=Math.min(n.length,e+8),r=Math.max(0,t-8),i=n.slice(r,t);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t;return Y(V,{color:c===`verbs`&&n===l?`cyan`:void 0,children:[c===`verbs`&&n===l?`❯ `:` `,e]},n)}),t<n.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,n.length-t,` more below`]})]})})(),h&&Y(B,{alignItems:`center`,children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:p})})]}),d&&Y(B,{marginTop:1,alignItems:`center`,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:p})})]})]})})]}),Y(B,{width:`50%`,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Preview`})}),J(B,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:Y(V,{children:[Y(V,{color:C,children:[`✻ `,t.replace(/\{\}/g,n[l]),` `]}),J(V,{children:`(esc to interrupt)`})]})})]})]})}const Ze=e=>e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/(\d+)/g,` $1 `).replace(/\s+/g,` `).trim().replace(/^./,e=>e.toUpperCase()),Qe=e=>{let t=Math.max(...e.map(e=>e.length));return e.map(e=>e.padEnd(t))},$e=Object.entries(Ee).map(([e,t])=>({name:Ze(e),phases:t.frames.map(e=>e.trimEnd()),reverseMirror:!1,updateInterval:t.interval})),et=[{name:`Default`,phases:b.thinkingStyle.phases,reverseMirror:b.thinkingStyle.reverseMirror},{name:`Wave`,phases:[`▁`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],reverseMirror:!0},{name:`Glow`,phases:[`░`,`▒`,`▓`,`█`],reverseMirror:!0},{name:`Partial block`,phases:[`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`,`█`],reverseMirror:!0},{name:`Colors`,phases:[`🔴`,`🟠`,`🟡`,`🟢`,`🔵`,`🟣`],reverseMirror:!1},...$e];function tt({onBack:e}){let{settings:{thinkingStyle:{phases:t,updateInterval:n,reverseMirror:r},themes:i},updateSettings:a}=W($),o=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[s,c]=K(0),l=o[s],[u,d]=K(0),[f,p]=K(0),[m,h]=K(!1),[g,_]=K(``),[v,y]=K(!1),[x,S]=K(!1),[C,w]=K(n.toString()),[T,E]=K(0),D=ie(),O=(i.find(e=>e.id===D)||i.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;G(()=>{if(t.length>0){let e=r?[...t,...[...t].reverse().slice(1,-1)]:t,i=setInterval(()=>{E(t=>(t+1)%e.length)},n);return()=>clearInterval(i)}},[t,n,r]),H((r,i)=>{if(x){if(i.return){let e=parseInt(C);!isNaN(e)&&e>0&&a(t=>{t.thinkingStyle.updateInterval=e}),S(!1)}else i.escape?(w(n.toString()),S(!1)):i.backspace||i.delete?w(e=>e.slice(0,-1)):r&&r.match(/^[0-9]$/)&&w(e=>e+r);return}if(m||v){if(i.return&&g.length){let e=v?[...t,g]:t.map((e,t)=>t===u?g:e);a(t=>{t.thinkingStyle.phases=Qe(e)}),h(!1),_(``)}else i.escape?(_(``),h(!1),y(!1)):i.backspace||i.delete?_(e=>e.slice(0,-1)):r&&_(e=>e+r);return}if(i.escape)e();else if(i.return)if(l===`updateInterval`)w(n.toString()),S(!0);else if(l===`presets`){let e=et[f];a(t=>{t.thinkingStyle.phases=Qe([...e.phases]),t.thinkingStyle.reverseMirror=e.reverseMirror,e.updateInterval!==void 0&&(t.thinkingStyle.updateInterval=e.updateInterval)})}else l===`reverseMirror`&&a(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(i.tab)i.shift?c(e=>e===0?o.length-1:e-1):c(e=>e===o.length-1?0:e+1);else if(i.upArrow)l===`phases`&&t.length>0?d(e=>e>0?e-1:t.length-1):l===`presets`&&p(e=>e>0?e-1:et.length-1);else if(i.downArrow)l===`phases`&&t.length>0?d(e=>e<t.length-1?e+1:0):l===`presets`&&p(e=>e<et.length-1?e+1:0);else if(r===` `)l===`reverseMirror`&&a(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(r===`e`&&l===`phases`)t.length>0&&(_(t[u]),h(!0));else if(r===`a`&&l===`phases`)y(!0),_(``);else if(r===`d`&&l===`phases`)t.length>1&&(a(e=>{e.thinkingStyle.phases=Qe(t.filter((e,t)=>t!==u))}),u>=t.length&&d(Math.max(0,t.length-1)));else if(r===`w`&&l===`phases`){if(u>0){let e=[...t];[e[u-1],e[u]]=[e[u],e[u-1]],a(t=>{t.thinkingStyle.phases=e}),d(e=>e-1)}}else if(r===`s`&&l===`phases`){if(u<t.length-1){let e=[...t];[e[u],e[u+1]]=[e[u+1],e[u]],a(t=>{t.thinkingStyle.phases=e}),d(e=>e+1)}}else i.ctrl&&r===`r`&&(a(e=>{e.thinkingStyle=b.thinkingStyle}),d(0),p(0))});let k=r?`●`:`○`,A=(()=>r?[...t,...[...t].reverse().slice(1,-1)]:t)(),j=A.length>0?A[T]:`·`;return J(B,{children:Y(B,{flexDirection:`column`,width:`100%`,children:[Y(B,{flexDirection:`row`,width:`100%`,children:[Y(B,{marginBottom:1,flexDirection:`column`,width:`50%`,children:[J(X,{children:`Thinking style`}),Y(B,{flexDirection:`column`,children:[Y(V,{dimColor:!0,children:[`enter to`,` `,l===`updateInterval`?`edit interval`:l===`presets`?`apply preset`:`save`]}),J(V,{dimColor:!0,children:`esc to go back`}),J(V,{dimColor:!0,children:`tab to switch sections`})]})]}),Y(B,{width:`50%`,flexDirection:`column`,children:[J(B,{children:J(V,{bold:!0,children:`Preview`})}),Y(B,{borderStyle:`single`,borderColor:`gray`,paddingX:1,flexDirection:`row`,children:[J(B,{width:(j?.length??0)+1,children:J(V,{color:O,children:j})}),Y(V,{children:[J(V,{color:O,children:`Thinking… `}),J(V,{children:`(esc to interrupt)`})]})]})]})]}),Y(B,{flexDirection:`row`,gap:4,children:[Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:l===`reverseMirror`?`yellow`:void 0,children:l===`reverseMirror`?`❯ `:` `}),J(V,{bold:!0,color:l===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]}),l===`reverseMirror`&&Y(V,{dimColor:!0,children:[` `,`space to toggle`]}),J(B,{marginLeft:2,marginBottom:1,children:Y(V,{children:[k,` `,r?`Enabled`:`Disabled`]})})]}),Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:l===`updateInterval`?`yellow`:void 0,children:l===`updateInterval`?`❯ `:` `}),J(V,{bold:!0,color:l===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),l===`updateInterval`&&(x?Y(V,{dimColor:!0,children:[` `,`enter to save`]}):Y(V,{dimColor:!0,children:[` `,`enter to edit`]})),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:x?`yellow`:`gray`,children:J(V,{children:x?C:n})})})]})]}),J(B,{children:Y(V,{children:[J(V,{color:l===`phases`?`yellow`:void 0,children:l===`phases`?`❯ `:` `}),J(V,{bold:!0,color:l===`phases`?`yellow`:void 0,children:`Phases`})]})}),l===`phases`&&J(B,{marginBottom:1,flexDirection:`column`,children:Y(V,{dimColor:!0,children:[` `,`[e]dit`,` `,`[a]dd`,` `,`[d]elete`,` `,`[w]move up`,` `,`[s]move down`]})}),J(B,{marginLeft:2,marginBottom:1,children:Y(B,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,u-4),n=Math.min(t.length,e+8),r=Math.max(0,n-8),i=t.slice(r,n);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t;return Y(V,{color:l===`phases`&&n===u?`cyan`:void 0,children:[l===`phases`&&n===u?`❯ `:` `,e]},n)}),n<t.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,t.length-n,` more below`]})]})})(),v&&Y(B,{children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:g})})]}),m&&Y(B,{marginTop:1,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:g})})]})]})}),J(B,{children:Y(V,{children:[J(V,{color:l===`presets`?`yellow`:void 0,children:l===`presets`?`❯ `:` `}),J(V,{bold:!0,color:l===`presets`?`yellow`:void 0,children:`Presets`})]})}),l===`presets`&&Y(V,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases and interval`]}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{flexDirection:`column`,children:(()=>{let e=Math.max(0,f-6),t=Math.min(et.length,e+12),n=Math.max(0,t-12),r=et.slice(n,t),i=e=>{let t=e.phases.join(``);return t.length>30?t.slice(0,27)+`…`:t};return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),r.map((e,t)=>{let r=n+t,a=l===`presets`&&r===f;return Y(V,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,e.name,` `,i(e)]},r)}),t<et.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,et.length-t,` more below`]})]})})()})}),J(B,{marginTop:1,children:J(V,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]})})}function nt(e,t){let n=ye(!0);G(()=>{if(n.current){n.current=!1;return}return e()},t)}const rt=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],it=[{label:`none`,value:`none`},{label:`single`,value:`single`},{label:`double`,value:`double`},{label:`round`,value:`round`},{label:`bold`,value:`bold`},{label:`singleDouble`,value:`singleDouble`},{label:`doubleSingle`,value:`doubleSingle`},{label:`classic`,value:`classic`},{label:`topBottomSingle`,value:`topBottomSingle`},{label:`topBottomDouble`,value:`topBottomDouble`},{label:`topBottomBold`,value:`topBottomBold`}];function at({onBack:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(!1),[a,o]=K(!1),[s,c]=K(!1),[l,u]=K(()=>t.userMessageDisplay.format),[d,f]=K(()=>String(t.userMessageDisplay.paddingX)),[p,m]=K(()=>String(t.userMessageDisplay.paddingY)),[h,g]=K(t.userMessageDisplay.fitBoxToContent),[_,v]=K(0),[y,x]=K(()=>[...t.userMessageDisplay.styling]),[S,C]=K(()=>t.userMessageDisplay.foregroundColor===`default`?`default`:`custom`),[w,T]=K(()=>t.userMessageDisplay.foregroundColor===`default`?`rgb(255,255,255)`:t.userMessageDisplay.foregroundColor),[E,D]=K(()=>{let e=t.userMessageDisplay.backgroundColor;return e===null?`none`:e===`default`?`default`:`custom`}),[O,k]=K(()=>{let e=t.userMessageDisplay.backgroundColor;return e===null||e===`default`?`rgb(0,0,0)`:e}),[A,j]=K(()=>it.findIndex(e=>e.value===t.userMessageDisplay.borderStyle)),[M,ee]=K(()=>t.userMessageDisplay.borderColor),[te,N]=K(null),[ne,P]=K(``),re=ie(),F=t.themes?.find(e=>e.id===re)||t.themes?.[0],[I,ae]=K(`text`),oe=[`format`,`styling`,`foreground`,`background`],se=[`borderStyle`,`borderColor`,`paddingX`,`paddingY`,`fitBoxToContent`],[ce,L]=K(0),[R,le]=K(0),z=I===`text`?oe[ce]:se[R],ue=()=>{n(e=>{e.userMessageDisplay.format=l,e.userMessageDisplay.styling=[...y],e.userMessageDisplay.foregroundColor=S===`default`?`default`:w,e.userMessageDisplay.backgroundColor=E===`none`?null:E===`default`?`default`:O,e.userMessageDisplay.borderStyle=it[A].value,e.userMessageDisplay.borderColor=M,e.userMessageDisplay.paddingX=parseInt(d)||0,e.userMessageDisplay.paddingY=parseInt(p)||0,e.userMessageDisplay.fitBoxToContent=h})},de=()=>{u(b.userMessageDisplay.format),x([...b.userMessageDisplay.styling]),C(`default`),T(`rgb(255,255,255)`),D(`none`),k(`rgb(0,0,0)`),j(it.findIndex(e=>e.value===b.userMessageDisplay.borderStyle)),ee(b.userMessageDisplay.borderColor),f(String(b.userMessageDisplay.paddingX)),m(String(b.userMessageDisplay.paddingY)),g(b.userMessageDisplay.fitBoxToContent),n(e=>{e.userMessageDisplay={...b.userMessageDisplay}})};nt(()=>{ue()},[l,y,S,w,E,O,A,M,d,p,h]),H((n,l)=>{if(r){l.return?i(!1):l.escape?(u(t.userMessageDisplay.format),i(!1)):l.backspace||l.delete?u(e=>e.slice(0,-1)):n&&u(e=>e+n);return}if(a){l.return?o(!1):l.escape?(f(String(t.userMessageDisplay.paddingX)),o(!1)):l.backspace||l.delete?f(e=>e.slice(0,-1)):n&&/^\d$/.test(n)&&f(e=>e+n);return}if(s){l.return?c(!1):l.escape?(m(String(t.userMessageDisplay.paddingY)),c(!1)):l.backspace||l.delete?m(e=>e.slice(0,-1)):n&&/^\d$/.test(n)&&m(e=>e+n);return}if(te===null){if(l.escape)e();else if(l.ctrl&&n===`r`)de();else if(l.leftArrow||l.rightArrow)ae(e=>e===`text`?`border`:`text`);else if(l.tab)I===`text`?l.shift?L(e=>e===0?oe.length-1:e-1):L(e=>e===oe.length-1?0:e+1):l.shift?le(e=>e===0?se.length-1:e-1):le(e=>e===se.length-1?0:e+1);else if(l.return)z===`format`?i(!0):z===`paddingX`?o(!0):z===`paddingY`?c(!0):z===`foreground`?S===`custom`&&(P(w),N(`foreground`)):z===`background`?E===`custom`&&(P(O),N(`background`)):z===`borderColor`&&(P(M),N(`border`));else if(l.upArrow)z===`styling`?v(e=>Math.max(0,e-1)):z===`borderStyle`?j(e=>e===0?it.length-1:e-1):z===`foreground`?C(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!w||w===``)&&T(`rgb(255,255,255)`),t}):z===`background`&&D(e=>{let t=e===`default`?`custom`:e===`custom`?`none`:`default`;return t===`custom`&&(!O||O===``)&&k(`rgb(0,0,0)`),t});else if(l.downArrow)z===`styling`?v(e=>Math.min(rt.length-1,e+1)):z===`borderStyle`?j(e=>e===it.length-1?0:e+1):z===`foreground`?C(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!w||w===``)&&T(`rgb(255,255,255)`),t}):z===`background`&&D(e=>{let t=e===`default`?`none`:e===`none`?`custom`:`default`;return t===`custom`&&(!O||O===``)&&k(`rgb(0,0,0)`),t});else if(n===` `)if(z===`styling`){let e=rt[_].value;x(y.indexOf(e)>=0?y.filter(t=>t!==e):[...y,e])}else z===`fitBoxToContent`&&g(e=>!e)}});let fe=e=>{let t=S===`default`?F?.colors?.text:w,n=E===`none`?void 0:E===`default`?F?.colors?.userMessageBackground:O,r=it[A].value,i=parseInt(d)||0,a=parseInt(p)||0,o=J(V,{bold:y.includes(`bold`),italic:y.includes(`italic`),underline:y.includes(`underline`),strikethrough:y.includes(`strikethrough`),inverse:y.includes(`inverse`),color:t,backgroundColor:n,children:e});if(r===`topBottomSingle`||r===`topBottomDouble`||r===`topBottomBold`){let t=r===`topBottomSingle`?`─`:r===`topBottomDouble`?`═`:`━`,n=e.length+i*2,s=t.repeat(n);return Y(B,{flexDirection:`column`,children:[J(V,{color:M,children:s}),a>0&&J(B,{height:a}),J(B,{paddingX:i,children:o}),a>0&&J(B,{height:a}),J(V,{color:M,children:s})]})}else if(r!==`none`||i>0||a>0||h){let e=i>0||a>0?J(B,{paddingX:i,paddingY:a,children:o}):o,t={};return r!==`none`&&(t.borderStyle=r,t.borderColor=M),h?t.alignSelf=`flex-start`:t.flexGrow=1,r===`none`?e:J(B,{...t,children:e})}else return o};return te?J(We,{initialValue:ne,theme:F,onColorChange:e=>{te===`foreground`?T(e):te===`background`?k(e):te===`border`&&ee(e)},onExit:()=>{N(null),P(``)}}):Y(B,{flexDirection:`column`,children:[J(X,{children:`Customize how user messages are displayed`}),Y(B,{flexDirection:`column`,marginBottom:1,children:[J(V,{dimColor:!0,children:`left/right arrows to switch columns · tab to navigate options`}),J(V,{dimColor:!0,children:`enter to edit · ctrl+r to reset · esc to go back`})]}),Y(B,{flexDirection:`row`,gap:1,children:[Y(B,{flexDirection:`column`,width:`50%`,borderStyle:I===`text`?`round`:`single`,borderColor:I===`text`?`yellow`:`gray`,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:I===`text`?`yellow`:void 0,children:`Text & Styling`})}),J(B,{children:Y(V,{color:z===`format`?`yellow`:void 0,bold:z===`format`,children:[z===`format`?`❯ `:` `,`Format String`]})}),z===`format`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:r?`enter to save · esc to cancel`:`enter to edit · use {} as message placeholder`})}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:r?`yellow`:`gray`,children:J(V,{children:l})})}),J(B,{children:Y(V,{color:z===`styling`?`yellow`:void 0,bold:z===`styling`,children:[z===`styling`?`❯ `:` `,`Styling`]})}),z===`styling`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`up/down to navigate · space to toggle`})}),J(B,{marginLeft:2,marginBottom:1,flexDirection:`column`,children:rt.map((e,t)=>J(B,{children:Y(V,{color:z===`styling`&&_===t?`cyan`:void 0,children:[z===`styling`&&_===t?`❯ `:` `,y.includes(e.value)?`●`:`○`,` `,e.label]})},e.value))}),Y(B,{flexDirection:`row`,gap:1,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(V,{color:z===`foreground`?`yellow`:void 0,bold:z===`foreground`,children:[z===`foreground`?`❯ `:` `,`Foreground`]})}),z===`foreground`&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`up/down · `,S===`custom`?`enter`:``]})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[S===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[S===`custom`?`● `:`○ `,`Custom`,S===`custom`&&`: `,S===`custom`&&J(V,{color:w,children:w})]})})]})]}),Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(V,{color:z===`background`?`yellow`:void 0,bold:z===`background`,children:[z===`background`?`❯ `:` `,`Background`]})}),z===`background`&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`up/down · `,E===`custom`?`enter`:``]})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[E===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[E===`none`?`● `:`○ `,`None`]})}),J(B,{children:Y(V,{children:[E===`custom`?`● `:`○ `,`Custom`,E===`custom`&&`: `,E===`custom`&&J(V,{backgroundColor:O,children:O})]})})]})]})]})]}),Y(B,{flexDirection:`column`,width:`50%`,borderStyle:I===`border`?`round`:`single`,borderColor:I===`border`?`yellow`:`gray`,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:I===`border`?`yellow`:void 0,children:`Border & Padding`})}),J(B,{children:Y(V,{color:z===`borderStyle`?`yellow`:void 0,bold:z===`borderStyle`,children:[z===`borderStyle`?`❯ `:` `,`Border Style`]})}),z===`borderStyle`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`up/down to navigate`})}),Y(B,{marginLeft:2,marginBottom:1,flexDirection:`row`,children:[J(B,{flexDirection:`column`,width:`50%`,children:it.slice(0,6).map((e,t)=>J(B,{children:Y(V,{color:z===`borderStyle`&&A===t?`cyan`:void 0,children:[z===`borderStyle`&&A===t?`❯ `:` `,A===t?`● `:`○ `,e.label]})},e.value))}),J(B,{flexDirection:`column`,width:`50%`,children:it.slice(6).map((e,t)=>{let n=t+6;return J(B,{children:Y(V,{color:z===`borderStyle`&&A===n?`cyan`:void 0,children:[z===`borderStyle`&&A===n?`❯ `:` `,A===n?`● `:`○ `,e.label]})},e.value)})})]}),J(B,{children:Y(V,{color:z===`borderColor`?`yellow`:void 0,bold:z===`borderColor`,children:[z===`borderColor`?`❯ `:` `,`Border Color`]})}),z===`borderColor`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`enter to pick color`})}),J(B,{marginLeft:2,marginBottom:1,children:J(V,{color:M,children:M})}),Y(B,{flexDirection:`row`,gap:1,children:[Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`paddingX`?`yellow`:void 0,bold:z===`paddingX`,children:[z===`paddingX`?`❯ `:` `,`Padding X`]})}),z===`paddingX`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:a?`enter/esc`:`enter`})}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:a?`yellow`:`gray`,children:J(V,{children:d})})})]}),Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`paddingY`?`yellow`:void 0,bold:z===`paddingY`,children:[z===`paddingY`?`❯ `:` `,`Padding Y`]})}),z===`paddingY`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:s?`enter/esc`:`enter`})}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:s?`yellow`:`gray`,children:J(V,{children:p})})})]}),Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`fitBoxToContent`?`yellow`:void 0,bold:z===`fitBoxToContent`,children:[z===`fitBoxToContent`?`❯ `:` `,h?`●`:`○`,` Fit box to content`]})}),z===`fitBoxToContent`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`space`})})]})]})]})]}),Y(B,{flexDirection:`column`,marginTop:1,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Preview`})}),Y(B,{flexDirection:`row`,gap:2,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{marginBottom:1,children:J(V,{underline:!0,children:`Before (Claude Code default):`})}),J(B,{marginLeft:1,children:Y(V,{backgroundColor:F?.colors?.userMessageBackground,color:F?.colors?.text,children:[` `,`> list the dir`,` `]})}),J(B,{marginLeft:1,marginTop:1,children:Y(V,{children:[J(V,{color:F?.colors?.inactive||`#888888`,children:`●`}),J(V,{children:` The directory `}),J(V,{color:F?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(V,{children:` contains `}),J(V,{bold:!0,children:`123`}),J(V,{children:` files.`})]})})]}),Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{marginBottom:1,children:J(V,{underline:!0,children:`After (Your customization):`})}),J(B,{marginLeft:1,flexDirection:`row`,children:(()=>fe(l.replace(/\{\}/g,`list the dir`)))()}),J(B,{marginLeft:1,marginTop:1,children:Y(V,{children:[J(V,{color:F?.colors?.inactive||`#888888`,children:`●`}),J(V,{children:` The directory `}),J(V,{color:F?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(V,{children:` contains `}),J(V,{bold:!0,children:`123`}),J(V,{children:` files.`})]})})]})]})]})]})}const ot=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],st=[[`name`,`regex`,`regexFlags`],[`format`,`styling`],[`foreground`,`background`],[`enabled`],[`testText`]];function ct({testText:e,regex:t,regexFlags:n,format:r,styling:i,foregroundColor:a,backgroundColor:o}){let s=[];try{let c=n.includes(`g`)?n:n+`g`,l=new RegExp(t,c),u=[...e.matchAll(l)];if(u.length===0)return J(V,{children:e});let d=0;return u.forEach((t,n)=>{let c=t.index,l=c+t[0].length;c>d&&s.push(J(V,{children:e.slice(d,c)},`plain-${n}`));let u=r.replace(/\{MATCH\}/g,t[0]);s.push(J(V,{bold:i.includes(`bold`),italic:i.includes(`italic`),underline:i.includes(`underline`),strikethrough:i.includes(`strikethrough`),inverse:i.includes(`inverse`),color:a,backgroundColor:o,children:u},`match-${n}`)),d=l}),d<e.length&&s.push(J(V,{children:e.slice(d)},`plain-end`)),J(q,{children:s})}catch{return J(V,{children:e})}}function lt({highlighterIndex:e,onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.inputPatternHighlighters[e],a=ie(),o=n.themes?.find(e=>e.id===a)||n.themes?.[0],[s,c]=K(i?.name||`New Highlighter`),[l,u]=K(i?.regex||``),[d,f]=K(i?.regexFlags||`g`),[p,m]=K(i?.format||`{MATCH}`),[h,g]=K(i?.styling||[]),[_,v]=K(i?.foregroundColor===null?`none`:`custom`),[y,b]=K(i?.foregroundColor||`rgb(255,0,255)`),[x,S]=K(i?.backgroundColor?`custom`:`none`),[C,w]=K(i?.backgroundColor||`rgb(0,0,0)`),[T,E]=K(i?.enabled??!0),[D,O]=K(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),[k,A]=K(`name`),[j,M]=K(!1),[ee,te]=K(0),[N,ne]=K(null),[P,re]=K(``),[F,I]=K(null),[ae,oe]=K(0),[se,ce]=K(0);if(G(()=>{let e=st[ae];A(e[Math.min(se,e.length-1)])},[ae,se]),G(()=>{if(!l){I(null);return}try{new RegExp(l,d),I(null)}catch(e){I(e.message)}},[l,d]),G(()=>{e>=0&&r(t=>{t.inputPatternHighlighters[e]&&(t.inputPatternHighlighters[e]={name:s,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:null,backgroundColor:x===`custom`?C:null,enabled:T})})},[e,s,l,d,p,h,_,y,x,C,T]),G(()=>{r(e=>{e.inputPatternHighlightersTestText=D})},[D]),H((e,r)=>{if(j){r.return?M(!1):r.escape?(k===`name`&&c(i?.name||``),k===`regex`&&u(i?.regex||``),k===`regexFlags`&&f(i?.regexFlags||`g`),k===`format`&&m(i?.format||`{MATCH}`),k===`testText`&&O(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),M(!1)):r.backspace||r.delete?(k===`name`&&c(e=>e.slice(0,-1)),k===`regex`&&u(e=>e.slice(0,-1)),k===`regexFlags`&&f(e=>e.slice(0,-1)),k===`format`&&m(e=>e.slice(0,-1)),k===`testText`&&O(e=>e.slice(0,-1))):e&&e.length===1&&(k===`name`&&c(t=>t+e),k===`regex`&&u(t=>t+e),k===`regexFlags`&&f(t=>t+e),k===`format`&&m(t=>t+e),k===`testText`&&O(t=>t+e));return}if(N===null){if(r.escape)t();else if(r.upArrow)k===`styling`&&ee>0?te(e=>e-1):oe(e=>Math.max(0,e-1));else if(r.downArrow)k===`styling`&&ee<ot.length-1?te(e=>e+1):oe(e=>Math.min(st.length-1,e+1));else if(r.leftArrow)k===`foreground`?v(e=>e===`none`?`custom`:`none`):k===`background`?S(e=>e===`none`?`custom`:`none`):ce(e=>Math.max(0,e-1));else if(r.rightArrow)if(k===`foreground`)v(e=>e===`none`?`custom`:`none`);else if(k===`background`)S(e=>e===`none`?`custom`:`none`);else{let e=st[ae].length-1;ce(t=>Math.min(e,t+1))}else if(r.tab){let e=st.flat(),t=e.indexOf(k);if(r.shift){if(t>0){let n=e[t-1];for(let e=0;e<st.length;e++){let t=st[e].indexOf(n);if(t>=0){oe(e),ce(t);break}}}}else if(t<e.length-1){let n=e[t+1];for(let e=0;e<st.length;e++){let t=st[e].indexOf(n);if(t>=0){oe(e),ce(t);break}}}}else if(r.return)k===`name`||k===`regex`||k===`regexFlags`||k===`format`||k===`testText`?M(!0):k===`foreground`&&_===`custom`?(re(y),ne(`foreground`)):k===`background`&&x===`custom`&&(re(C),ne(`background`));else if(e===` `)if(k===`styling`){let e=ot[ee].value;h.includes(e)?g(h.filter(t=>t!==e)):g([...h,e])}else k===`enabled`&&E(!T)}}),!i)return J(B,{flexDirection:`column`,children:J(V,{color:`red`,children:`Highlighter not found`})});if(N)return J(We,{initialValue:P,theme:o,onColorChange:e=>{N===`foreground`?b(e):N===`background`&&w(e)},onExit:()=>{ne(null),re(``)}});let L=e=>k===e,R=e=>({color:L(e)?`yellow`:void 0,bold:L(e)});return Y(B,{flexDirection:`column`,children:[J(X,{children:`Edit Highlighter`}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`arrows to navigate · enter to edit · space to toggle · esc to go back`})}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`30%`,children:[Y(V,{...R(`name`),children:[L(`name`)?`❯ `:` `,`Name`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`name`)?j?`green`:`yellow`:`gray`,children:J(V,{children:s||`(empty)`})})})]}),Y(B,{flexDirection:`column`,width:`45%`,children:[Y(V,{...R(`regex`),children:[L(`regex`)?`❯ `:` `,`Regex Pattern`]}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{borderStyle:`round`,borderColor:L(`regex`)?j?`green`:`yellow`:F?`red`:`gray`,children:J(V,{children:l||`(empty)`})}),F&&J(V,{color:`red`,children:F})]})]}),Y(B,{flexDirection:`column`,width:`20%`,children:[Y(V,{...R(`regexFlags`),children:[L(`regexFlags`)?`❯ `:` `,`Flags`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`regexFlags`)?j?`green`:`yellow`:`gray`,children:J(V,{children:d||`g`})})})]})]}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[Y(V,{...R(`format`),children:[L(`format`)?`❯ `:` `,`Format String`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`format`)?j?`green`:`yellow`:`gray`,children:J(V,{children:p||`{MATCH}`})})}),L(`format`)&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`use `,`{MATCH}`,` as placeholder`]})})]}),Y(B,{flexDirection:`column`,width:`45%`,children:[Y(V,{...R(`styling`),children:[L(`styling`)?`❯ `:` `,`Styling`]}),J(B,{marginLeft:2,flexDirection:`column`,children:ot.map((e,t)=>{let n=h.includes(e.value),r=L(`styling`)&&ee===t;return Y(V,{color:r?`cyan`:void 0,children:[r?`❯ `:` `,n?`●`:`○`,` `,e.label]},e.value)})})]})]}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`48%`,children:[Y(V,{...R(`foreground`),children:[L(`foreground`)?`❯ `:` `,`Foreground Color`]}),Y(B,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(V,{color:L(`foreground`)?`yellow`:void 0,children:[`[`,_===`none`?`●`:`○`,`] none`,` `,`[`,_===`custom`?`●`:`○`,`] custom`]}),_===`custom`&&J(B,{borderStyle:`round`,borderColor:L(`foreground`)?`yellow`:`gray`,children:J(V,{color:y,children:` ████ `})})]})]}),Y(B,{flexDirection:`column`,width:`48%`,children:[Y(V,{...R(`background`),children:[L(`background`)?`❯ `:` `,`Background Color`]}),Y(B,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(V,{color:L(`background`)?`yellow`:void 0,children:[`[`,x===`none`?`●`:`○`,`] none`,` `,`[`,x===`custom`?`●`:`○`,`] custom`]}),x===`custom`&&J(B,{borderStyle:`round`,borderColor:L(`background`)?`yellow`:`gray`,children:Y(V,{backgroundColor:C,children:[` `,` `,` `]})})]})]})]}),J(B,{marginBottom:1,children:Y(V,{...R(`enabled`),children:[L(`enabled`)?`❯ `:` `,`Enabled:`,` `,J(V,{color:T?`green`:`red`,children:T?`● Yes`:`○ No`})]})}),Y(B,{flexDirection:`column`,marginBottom:1,children:[Y(V,{...R(`testText`),children:[L(`testText`)?`❯ `:` `,`Test Text`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`testText`)?j?`green`:`yellow`:`gray`,children:J(V,{children:D||`(empty)`})})})]}),J(B,{borderStyle:`round`,padding:1,children:Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Live Preview:`}),l?J(B,{marginTop:1,children:J(ct,{testText:D,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:void 0,backgroundColor:x===`custom`?C:void 0})}):J(V,{dimColor:!0,children:`Enter a regex pattern to see the preview`})]})})]})}function ut({onBack:e}){let{settings:{inputPatternHighlighters:t,themes:n},updateSettings:r}=W($),i=ie(),a=n.find(e=>e.id===i)||n[0],o=b.themes[0],s=a?.colors.success||o.colors.success,c=a?.colors.error||o.colors.error,[l,u]=K(0),[d,f]=K(null),[p,m]=K(!0),h=()=>{let e={name:`New Highlighter`,regex:``,regexFlags:`g`,format:`{MATCH}`,styling:[],foregroundColor:`rgb(255,0,255)`,backgroundColor:null,enabled:!0};r(t=>{t.inputPatternHighlighters.push(e)}),f(t.length),m(!1)},g=e=>{r(t=>{t.inputPatternHighlighters.splice(e,1)}),l>=t.length-1&&u(Math.max(0,t.length-2))},_=e=>{r(t=>{t.inputPatternHighlighters[e].enabled=!t.inputPatternHighlighters[e].enabled})},v=e=>{e<=0||(r(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e-1,0,n)}),u(e-1))},y=e=>{e>=t.length-1||(r(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e+1,0,n)}),u(e+1))};return H((n,r)=>{r.escape?e():r.upArrow?u(e=>Math.max(0,e-1)):r.downArrow&&t.length>0?u(e=>Math.min(t.length-1,e+1)):r.return&&t.length>0?(f(l),m(!1)):n===`n`?h():n===`x`&&t.length>0?g(l):n===` `&&t.length>0?_(l):n===`u`&&t.length>0&&l>0?v(l):n===`d`&&t.length>0&&l<t.length-1&&y(l)},{isActive:p}),d===null?Y(B,{flexDirection:`column`,children:[J(X,{children:`Input Pattern Highlighters`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`Create custom highlighters for patterns in your input prompt.`}),J(V,{dimColor:!0,children:`Matched text will be styled and optionally reformatted.`})]}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new highlighter`}),t.length>0&&J(V,{dimColor:!0,children:`space to toggle enabled/disabled`}),t.length>0&&J(V,{dimColor:!0,children:`u/d to move highlighter up/down`}),t.length>0&&J(V,{dimColor:!0,children:`x to delete a highlighter`}),t.length>0&&J(V,{dimColor:!0,children:`enter to edit highlighter`}),J(V,{dimColor:!0,children:`esc to go back`})]}),t.length===0?J(V,{children:`No highlighters created yet. Press n to create one.`}):J(B,{flexDirection:`column`,children:t.map((e,t)=>{let n=l===t,r;return n&&(r=`yellow`),Y(B,{flexDirection:`row`,children:[Y(V,{color:r,children:[n?`❯ `:` `,e.enabled?`● `:`○ `,e.name,` `]}),J(V,{dimColor:!0,children:`(`}),e.regex?Y(V,{dimColor:!0,children:[`/`,e.regex,`/`,e.regexFlags]}):J(V,{dimColor:!0,children:`(no regex)`}),e.styling.length>0&&J(q,{children:Y(V,{color:r,dimColor:!e.enabled,children:[` `,`· `,e.styling.join(`, `)]})}),J(V,{dimColor:!0,children:`)`}),e.enabled?J(V,{color:s,children:` enabled`}):J(V,{color:c,children:` disabled`})]},t)})})]}):J(lt,{highlighterIndex:d,onBack:()=>{f(null),m(!0)}})}const dt=[null,1,5,10,25,50,100,200,250,500,1e3],ft=1e3;function pt({onSubmit:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(0),[a,o]=K(!1),s={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEdit:!1,hideStartupClawd:!1,increaseFileReadLimit:!1,suppressLineNumbers:!1,suppressRateLimitOptions:!1,mcpConnectionNonBlocking:!0,mcpServerBatchSize:null,statuslineThrottleMs:null,statuslineUseFixedInterval:!1,tableFormat:`default`,enableSwarmMode:!0,enableSessionMemory:!0,enableRememberSkill:!1,tokenCountRounding:null,autoAcceptPlanMode:!1,allowBypassPermissionsInSudo:!1,suppressNativeInstallerWarning:!1,filterScrollEscapeSequences:!1,enableWorktreeMode:!0,enableContextLimitOverride:!1,enableModelCustomizations:!0},c=()=>{t.misc||={...s}},l=e=>{let t=[`default`,`ascii`,`clean`,`clean-top-bottom`];return t[(t.indexOf(e)+1)%t.length]},u=e=>{switch(e){case`ascii`:return`ASCII (| and -)`;case`clean`:return`Clean (no row separators)`;case`clean-top-bottom`:return`Clean with top/bottom`;case`default`:default:return`Default (box-drawing)`}},d=e=>e===null?`Default (3)`:e<=3?`${e} (conservative)`:e<=8?`${e} (recommended)`:`${e} (aggressive)`,f=e=>e===null?`Disabled`:e===0?`0ms (instant)`:`${e}ms`,p=e=>e===null?`Off (exact counts)`:`Round to ${e}`,m=(e,t)=>{let n=dt.indexOf(e);if(n===-1)return dt[0];let r;return r=t===`next`?(n+1)%dt.length:(n-1+dt.length)%dt.length,dt[r]},h=ve(()=>[{id:`removeBorder`,title:`Remove input box border`,description:`Removes the rounded border around the input box for a cleaner look.`,getValue:()=>t.inputBox?.removeBorder??!1,toggle:()=>{n(e=>{e.inputBox||={removeBorder:!1},e.inputBox.removeBorder=!e.inputBox.removeBorder})}},{id:`showVersion`,title:`Show tweakcc version at startup`,description:`Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.`,getValue:()=>t.misc?.showTweakccVersion??!0,toggle:()=>{n(e=>{c(),e.misc.showTweakccVersion=!e.misc.showTweakccVersion})}},{id:`showPatches`,title:`Show patches applied indicator at startup`,description:`Shows the green "tweakcc patches are applied" indicator when starting Claude Code.`,getValue:()=>t.misc?.showPatchesApplied??!0,toggle:()=>{n(e=>{c(),e.misc.showPatchesApplied=!e.misc.showPatchesApplied})}},{id:`expandThinking`,title:`Expand thinking blocks`,description:`Makes thinking blocks always expanded by default instead of collapsed.`,getValue:()=>t.misc?.expandThinkingBlocks??!0,toggle:()=>{n(e=>{c(),e.misc.expandThinkingBlocks=!e.misc.expandThinkingBlocks})}},{id:`conversationTitle`,title:`Allow renaming sessions via /title`,description:`Enables /title and /rename commands for manually naming conversations.`,getValue:()=>t.misc?.enableConversationTitle??!0,toggle:()=>{n(e=>{c(),e.misc.enableConversationTitle=!e.misc.enableConversationTitle})}},{id:`enableModelCustomizations`,title:`Enable model customizations (/model shows all models)`,description:`Show all Claude models in /model menu, not just the latest 3. Disable to use Claude Code default model list.`,getValue:()=>t.misc?.enableModelCustomizations??!0,toggle:()=>{n(e=>{c(),e.misc.enableModelCustomizations=!e.misc.enableModelCustomizations})}},{id:`hideStartupBanner`,title:`Hide startup banner`,description:`Hides the startup banner message displayed before first prompt.`,getValue:()=>t.misc?.hideStartupBanner??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupBanner=!e.misc.hideStartupBanner})}},{id:`hideCtrlG`,title:`Hide ctrl-g to edit prompt hint`,description:`Hides the "ctrl-g to edit prompt" hint shown during streaming.`,getValue:()=>t.misc?.hideCtrlGToEdit??!1,toggle:()=>{n(e=>{c(),e.misc.hideCtrlGToEdit=!e.misc.hideCtrlGToEdit})}},{id:`hideClawd`,title:`Hide startup Clawd ASCII art`,description:`Hides the Clawd ASCII art character shown at startup.`,getValue:()=>t.misc?.hideStartupClawd??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupClawd=!e.misc.hideStartupClawd})}},{id:`increaseFileReadLimit`,title:`Increase file read token limit`,description:`Increases the maximum file read limit from 25,000 to 1,000,000 tokens.`,getValue:()=>t.misc?.increaseFileReadLimit??!1,toggle:()=>{n(e=>{c(),e.misc.increaseFileReadLimit=!e.misc.increaseFileReadLimit})}},{id:`suppressLineNumbers`,title:`Suppress line numbers in file reads/edits`,description:`Removes line number prefixes from file content to reduce token usage.`,getValue:()=>t.misc?.suppressLineNumbers??!1,toggle:()=>{n(e=>{c(),e.misc.suppressLineNumbers=!e.misc.suppressLineNumbers})}},{id:`suppressRateLimitOptions`,title:`Suppress rate limit options popup`,description:`Prevents the automatic /rate-limit-options command from being triggered when hitting rate limits.`,getValue:()=>t.misc?.suppressRateLimitOptions??!1,toggle:()=>{n(e=>{c(),e.misc.suppressRateLimitOptions=!e.misc.suppressRateLimitOptions})}},{id:`mcpNonBlocking`,title:`Non-blocking MCP startup`,description:`Start immediately while MCP servers connect in background. Reduces startup time ~50% with multiple MCPs.`,getValue:()=>t.misc?.mcpConnectionNonBlocking??!0,toggle:()=>{n(e=>{c(),e.misc.mcpConnectionNonBlocking=!e.misc.mcpConnectionNonBlocking})}},{id:`mcpBatchSize`,title:`MCP server batch size`,description:`Parallel MCP connections (1-20). Use ←/→ to adjust. Higher = faster startup, more resources.`,getValue:()=>t.misc?.mcpServerBatchSize??null,getDisplayValue:()=>d(t.misc?.mcpServerBatchSize??null),toggle:()=>{n(e=>{c(),e.misc.mcpServerBatchSize=null})},increment:()=>{n(e=>{c();let t=e.misc.mcpServerBatchSize??3;e.misc.mcpServerBatchSize=Math.min(20,t+1)})},decrement:()=>{n(e=>{c();let t=(e.misc.mcpServerBatchSize??3)-1;e.misc.mcpServerBatchSize=t<1?null:t})}},{id:`tableFormat`,title:`Table output format`,description:`Controls how Claude formats tables. Default: full borders. ASCII: | and -. Clean: no top/bottom/row separators. Clean+top/bottom: borders but no row separators.`,getValue:()=>t.misc?.tableFormat??`default`,isMultiValue:!0,getDisplayValue:()=>u(t.misc?.tableFormat??`default`),toggle:()=>{n(e=>{c(),e.misc.tableFormat=l(e.misc.tableFormat??`default`)})}},{id:`enableWorktreeMode`,title:`Enable worktree mode (EnterWorktree tool)`,description:`Force-enable the EnterWorktree tool for isolated git worktree sessions by bypassing the tengu_worktree_mode feature flag.`,getValue:()=>t.misc?.enableWorktreeMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableWorktreeMode=!e.misc.enableWorktreeMode})}},{id:`enableContextLimitOverride`,title:`Override context limit`,description:`Replaces the default model context limit with CLAUDE_CODE_CONTEXT_LIMIT env var. Must be exported manually before launching CC, or falls back to 200K.`,getValue:()=>t.misc?.enableContextLimitOverride??!1,toggle:()=>{n(e=>{c(),e.misc.enableContextLimitOverride=!e.misc.enableContextLimitOverride})}},{id:`statuslineThrottle`,title:`Statusline throttle`,description:`Throttle statusline updates (0-${ft}ms). Use ←/→ to adjust by 50ms. Space to disable. 0 = instant updates.`,getValue:()=>t.misc?.statuslineThrottleMs??null,getDisplayValue:()=>f(t.misc?.statuslineThrottleMs??null),toggle:()=>{n(e=>{c(),e.misc.statuslineThrottleMs=e.misc.statuslineThrottleMs===null?300:null})},increment:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.min(ft,t+50)})},decrement:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.max(0,t-50)})}},{id:`statuslineFixedInterval`,title:`Statusline fixed interval mode`,description:`Use setInterval instead of throttle. Updates happen on a fixed schedule rather than on-demand.`,getValue:()=>t.misc?.statuslineUseFixedInterval??!1,toggle:()=>{n(e=>{c(),e.misc.statuslineUseFixedInterval=!e.misc.statuslineUseFixedInterval})}},{id:`enableSessionMemory`,title:`Enable session memory`,description:`Force-enable session memory (auto-extraction + past session search) by bypassing the tengu_session_memory and tengu_coral_fern statsig flags.`,getValue:()=>t.misc?.enableSessionMemory??!0,toggle:()=>{n(e=>{c(),e.misc.enableSessionMemory=!e.misc.enableSessionMemory})}},{id:`enableRememberSkill`,title:`Enable remember skill`,description:`Register a "remember" skill to review session memories and update CLAUDE.local.md with learnings from past sessions.`,getValue:()=>t.misc?.enableRememberSkill??!1,toggle:()=>{n(e=>{c(),e.misc.enableRememberSkill=!e.misc.enableRememberSkill})}},{id:`tokenCountRounding`,title:`Token count rounding`,description:`Round displayed token counts to nearest multiple. Use ←/→ to cycle: Off, 1, 5, 10, 25, 50, 100, 200, 250, 500, 1000.`,getValue:()=>t.misc?.tokenCountRounding??null,getDisplayValue:()=>p(t.misc?.tokenCountRounding??null),toggle:()=>{n(e=>{c(),e.misc.tokenCountRounding=null})},increment:()=>{n(e=>{c(),e.misc.tokenCountRounding=m(e.misc.tokenCountRounding??null,`next`)})},decrement:()=>{n(e=>{c(),e.misc.tokenCountRounding=m(e.misc.tokenCountRounding??null,`prev`)})}},{id:`autoAcceptPlanMode`,title:`Auto-accept plan mode`,description:`Automatically accept plans without the "Ready to code?" confirmation prompt.`,getValue:()=>t.misc?.autoAcceptPlanMode??!1,toggle:()=>{n(e=>{c(),e.misc.autoAcceptPlanMode=!e.misc.autoAcceptPlanMode})}},{id:`allowBypassPermissionsInSudo`,title:`Allow bypassing permissions in sudo`,description:`⚠️ WARNING: Disables a security check. When enabled, Claude can perform system-level operations without prompts. Use extreme caution.`,getValue:()=>t.misc?.allowBypassPermissionsInSudo??!1,toggle:()=>{t.misc?.allowBypassPermissionsInSudo??!1?n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!1}):o(!0)}},{id:`suppressNativeInstallerWarning`,title:`Suppress native installer warning`,description:`Suppress the native installer warning message at startup.`,getValue:()=>t.misc?.suppressNativeInstallerWarning??!1,toggle:()=>{n(e=>{c(),e.misc.suppressNativeInstallerWarning=!e.misc.suppressNativeInstallerWarning})}},{id:`filterScrollEscapeSequences`,title:`Filter scroll escape sequences`,description:`Filter out terminal escape sequences that cause unwanted scrolling.`,getValue:()=>t.misc?.filterScrollEscapeSequences??!1,toggle:()=>{n(e=>{c(),e.misc.filterScrollEscapeSequences=!e.misc.filterScrollEscapeSequences})}}],[t,n]),g=h.length,_=g-1,v=ve(()=>r<4?0:Math.min(r-4+1,g-4),[r,g]),y=h.slice(v,v+4),b=v>0,x=v+4<g;return H((t,s)=>{a?s.return?(n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!0}),o(!1)):s.escape&&o(!1):s.return||s.escape?e():s.upArrow?i(e=>Math.max(0,e-1)):s.downArrow?i(e=>Math.min(_,e+1)):t===` `?h[r]?.toggle():s.rightArrow?h[r]?.increment?.():s.leftArrow&&h[r]?.decrement?.()}),J(B,{flexDirection:`column`,children:a?J(B,{flexDirection:`column`,paddingX:2,children:Y(B,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:`yellow`,children:`SECURITY WARNING`})}),J(B,{marginBottom:1,children:J(V,{children:`You are about to enable a feature that allows Claude Code to bypass permission checks when running with sudo privileges.`})}),J(B,{marginBottom:1,children:J(V,{color:`red`,children:`This means Claude can perform system-level operations without any prompts or confirmation.`})}),J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Use with extreme caution.`})}),J(B,{children:Y(V,{children:[`Press `,J(V,{color:`red`,children:`Enter`}),` to enable,`,` `,J(V,{color:`green`,children:`Escape`}),` to cancel`]})})]})}):Y(q,{children:[J(B,{marginBottom:1,children:J(X,{children:`Miscellaneous Settings`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Use ↑/↓ to navigate, space to toggle, ←/→ to adjust numbers, enter to go back.`})}),b&&J(B,{children:Y(V,{dimColor:!0,children:[` ↑ `,v,` more above`]})}),y.map((e,t)=>{let n=v+t===r,i=e.getValue(),a=!!e.getDisplayValue,o=!!e.increment,s;s=o?`◆`:a?`◉`:i?`☑`:`☐`;let c;c=a?e.getDisplayValue():typeof i==`boolean`?i?`Enabled`:`Disabled`:String(i??`Default`);let l=n&&o?` ← → `:``;return Y(B,{flexDirection:`column`,children:[J(B,{children:Y(V,{children:[J(V,{color:n?`cyan`:void 0,children:n?`❯ `:` `}),J(V,{bold:!0,color:n?`cyan`:void 0,children:e.title})]})}),J(B,{children:Y(V,{dimColor:!0,children:[` `,e.description]})}),J(B,{marginLeft:4,marginBottom:1,children:Y(V,{children:[s,` `,c,J(V,{dimColor:!0,children:l})]})})]},e.id)}),x&&J(B,{children:Y(V,{dimColor:!0,children:[` `,`↓ `,g-v-4,` more below`]})}),J(B,{marginTop:1,children:Y(V,{dimColor:!0,children:[`Item `,r+1,` of `,g]})})]})})}const mt=`AgentOutputTool.AskUserQuestion.Bash.BashOutputTool.Edit.EnterPlanMode.ExitPlanMode.Glob.Grep.KillShell.ListMcpResourcesTool.LSP.NotebookEdit.Read.ReadMcpResourceTool.Skill.Task.TaskCreate.TaskGet.TaskList.TaskOutput.TaskStop.TaskUpdate.Teammate.TodoWrite.ToolSearch.WebFetch.WebSearch.Write`.split(`.`);function ht({toolsetIndex:e,onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.toolsets[e],[a,o]=K(i?.name||`New Toolset`),[s,c]=K(i?.allowedTools||[]),[l,u]=K(!1),[d,f]=K(0);G(()=>{i&&r(t=>{let n=t.toolsets[e].name;t.toolsets[e].name=a,t.toolsets[e].allowedTools=s,n!==a&&(t.defaultToolset===n&&(t.defaultToolset=a),t.planModeToolset===n&&(t.planModeToolset=a))})},[a,s]);let p=e=>s===`*`?!0:s.includes(e),m=e=>{e===`All`?c(`*`):e===`None`?c([]):s===`*`?c(mt.filter(t=>t!==e)):s.includes(e)?c(s.filter(t=>t!==e)):c([...s,e])};if(H((e,n)=>{if(l){n.return?u(!1):n.escape?(o(i?.name||`New Toolset`),u(!1)):n.backspace||n.delete?o(e=>e.slice(0,-1)):e&&e.length===1&&o(t=>t+e);return}if(n.escape)t();else if(n.upArrow)f(e=>Math.max(0,e-1));else if(n.downArrow)f(e=>Math.min(mt.length+1,e+1));else if(e===` `||n.return)if(d===0)m(`All`);else if(d===1)m(`None`);else{let e=mt[d-2];e&&m(e)}else e===`n`&&u(!0)}),!i)return J(B,{flexDirection:`column`,children:J(V,{color:`red`,children:`Toolset not found`})});let h=s===`*`,g=Array.isArray(s)&&s.length===0;return Y(B,{flexDirection:`column`,children:[J(X,{children:`Edit Toolset`}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`n to edit name · space/enter to toggle · esc to go back`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{bold:!0,children:`Name:`}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:l?`yellow`:`gray`,children:J(V,{children:a})})}),l&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`enter to save · esc to cancel`})})]}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{bold:!0,children:`Allowed Tools:`}),J(B,{marginLeft:2,children:Y(V,{color:d===0?`cyan`:void 0,children:[d===0?`❯ `:` `,h?`●`:`○`,` All`]})}),J(B,{marginLeft:2,children:Y(V,{color:d===1?`cyan`:void 0,children:[d===1?`❯ `:` `,g?`●`:`○`,` None`]})}),mt.map((e,t)=>{let n=t+2;return J(B,{marginLeft:2,children:Y(V,{color:d===n?`cyan`:void 0,children:[d===n?`❯ `:` `,p(e)?`◉`:`○`,` `,e]})},e)})]}),J(B,{borderStyle:`round`,padding:1,marginTop:1,children:Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Summary:`}),Y(V,{children:[`Name: `,J(V,{color:`cyan`,children:a})]}),Y(V,{children:[`Tools:`,` `,s===`*`?J(V,{color:`green`,children:`All tools (*)`}):s.length===0?J(V,{color:`red`,children:`No tools ([])`}):Y(V,{color:`yellow`,children:[s.length,` selected`]})]})]})})]})}function gt({onBack:e}){let{settings:{toolsets:t,defaultToolset:n,planModeToolset:r,themes:i},updateSettings:a}=W($),o=ie(),s=i.find(e=>e.id===o)||i[0],c=b.themes[0],l=s?.colors.planMode||c.colors.planMode,u=s?.colors.autoAccept||c.colors.autoAccept,[d,f]=K(0),[p,m]=K(null),[h,g]=K(!0),_=()=>{let e={name:`New Toolset`,allowedTools:[]};a(t=>{t.toolsets.push(e)}),m(t.length),g(!1)},v=e=>{let n=t[e];a(t=>{t.toolsets.splice(e,1),t.defaultToolset===n.name&&(t.defaultToolset=null),t.planModeToolset===n.name&&(t.planModeToolset=null)}),d>=t.length-1&&f(Math.max(0,t.length-2))},y=e=>{let n=t[e];a(e=>{e.defaultToolset=n.name})},x=e=>{let n=t[e];a(e=>{e.planModeToolset=n.name})};if(H((n,r)=>{r.escape?e():r.upArrow?f(e=>Math.max(0,e-1)):r.downArrow?f(e=>Math.min(t.length-1,e+1)):r.return&&t.length>0?(m(d),g(!1)):n===`n`?_():n===`x`&&t.length>0?v(d):n===`d`&&t.length>0?y(d):n===`p`&&t.length>0&&x(d)},{isActive:h}),p!==null)return J(ht,{toolsetIndex:p,onBack:()=>{m(null),g(!0)}});let S=e=>e.allowedTools===`*`?`All tools`:e.allowedTools.length===0?`No tools`:`${e.allowedTools.length} tool${e.allowedTools.length===1?``:`s`}`;return Y(B,{flexDirection:`column`,children:[J(X,{children:`Toolsets`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new toolset`}),t.length>0&&J(V,{dimColor:!0,children:`d to set as default toolset`}),t.length>0&&J(V,{dimColor:!0,children:`p to set as plan mode toolset`}),t.length>0&&J(V,{dimColor:!0,children:`x to delete a toolset`}),t.length>0&&J(V,{dimColor:!0,children:`enter to edit toolset`}),J(V,{dimColor:!0,children:`esc to go back`})]}),t.length===0?J(V,{children:`No toolsets created yet. Press n to create one.`}):J(B,{flexDirection:`column`,children:t.map((e,t)=>{let i=e.name===n,a=e.name===r,o=d===t,s;return o&&(s=`yellow`),Y(B,{flexDirection:`row`,children:[Y(V,{color:s,children:[o?`❯ `:` `,e.name,` `]}),Y(V,{color:s,children:[`(`,S(e),`)`]}),i&&J(V,{color:u,children:` ⏵⏵ accept edits`}),a&&J(V,{color:l,children:` ⏸ plan mode`})]},t)})})]})}function _t({onBack:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(`plan`),[a,o]=K(!1),[s,c]=K(0),l=t.subagentModels||{plan:null,explore:null,generalPurpose:null},u=[{id:`plan`,title:`Plan Agent`,description:`The agent responsible for creating implementation plans.`},{id:`explore`,title:`Explore Agent`,description:`The agent specialized for exploring codebases.`},{id:`generalPurpose`,title:`General-purpose Agent`,description:`The agent used for general multi-step tasks.`}],d=[{label:`Default (Inherited)`,value:null},{label:`sonnet`,value:`sonnet`},{label:`haiku`,value:`haiku`},{label:`opus`,value:`opus`},{label:`sonnet[1m]`,value:`sonnet[1m]`}];return H((t,f)=>{if(a){if(f.escape)o(!1);else if(f.upArrow)c(e=>e>0?e-1:d.length-1);else if(f.downArrow)c(e=>e<d.length-1?e+1:0);else if(f.return){let e=d[s].value;n(t=>{t.subagentModels||={plan:null,explore:null,generalPurpose:null},t.subagentModels[r]=e}),o(!1)}}else if(f.escape)e();else if(f.upArrow){let e=u.findIndex(e=>e.id===r);i(u[e>0?e-1:u.length-1].id)}else if(f.downArrow){let e=u.findIndex(e=>e.id===r);i(u[e<u.length-1?e+1:0].id)}else if(t===` `||f.return){let e=l[r],t=d.findIndex(t=>t.value===e);c(t>=0?t:0),o(!0)}}),a?Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:Y(X,{children:[`Select Model for`,` `,u.find(e=>e.id===r)?.title]})}),d.map((e,t)=>{let n=t===s;return J(B,{children:Y(V,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,e.label,e.value?Y(V,{dimColor:!0,children:[` (`,e.value,`)`]}):null]})},t)})]}):Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(X,{children:`Subagent Model Settings`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Configure which Claude model each subagent uses. Use arrow keys to navigate, enter or space to change a model, and escape to go back.`})}),u.map(e=>{let t=e.id===r,n=l[e.id],i=d.find(e=>e.value===n)?.label||n||`Default`;return Y(B,{flexDirection:`column`,marginBottom:1,children:[J(B,{children:Y(V,{color:t?`cyan`:void 0,children:[t?`❯ `:` `,J(V,{bold:!0,children:e.title})]})}),J(B,{marginLeft:4,children:J(V,{dimColor:!0,children:e.description})}),J(B,{marginLeft:4,children:Y(V,{children:[`Current: `,J(V,{color:`green`,children:i})]})})]},e.id)})]})}function vt({onBack:e}){let{settings:t,updateSettings:n}=W($),r=t.claudeMdAltNames??[],[i,a]=K(0),[o,s]=K(!1),[c,l]=K(``),[u,d]=K(!1);return H((t,f)=>{if(o||u){f.return&&c.trim()?(u?(n(e=>{e.claudeMdAltNames||=[],e.claudeMdAltNames.push(c.trim())}),d(!1)):(n(e=>{e.claudeMdAltNames&&(e.claudeMdAltNames[i]=c.trim())}),s(!1)),l(``)):f.escape?(l(``),s(!1),d(!1)):f.backspace||f.delete?l(e=>e.slice(0,-1)):t&&l(e=>e+t);return}f.escape?e():f.upArrow?r.length>0&&a(e=>e>0?e-1:r.length-1):f.downArrow?r.length>0&&a(e=>e<r.length-1?e+1:0):t===`e`?r.length>0&&(l(r[i]),s(!0)):t===`d`?r.length>0&&(n(e=>{e.claudeMdAltNames&&=e.claudeMdAltNames.filter((e,t)=>t!==i)}),i>=r.length-1&&a(Math.max(0,r.length-2))):t===`n`?(d(!0),l(``)):f.ctrl&&t===`r`?(n(e=>{e.claudeMdAltNames=[...b.claudeMdAltNames??[]]}),a(0)):t===`u`||f.shift&&f.upArrow?r.length>1&&i>0&&(n(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[i-1],t[i]]=[t[i],t[i-1]]}),a(e=>e-1)):(t===`j`||f.shift&&f.downArrow)&&r.length>1&&i<r.length-1&&(n(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[i],t[i+1]]=[t[i+1],t[i]]}),a(e=>e+1))}),Y(B,{flexDirection:`column`,children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`CLAUDE.md Alternative Names`}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`changes auto-saved`}),J(V,{dimColor:!0,children:`esc to go back`})]})]}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`When Claude Code looks for CLAUDE.md and doesn't find it, it will try these alternative filenames in order. This lets you use AGENTS.md (and other file names).`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`e to edit · d to delete · n to add new · u/j to move up/down · ctrl+r to reset`})}),Y(B,{flexDirection:`column`,children:[r.length===0?J(V,{children:`No alternative names configured. Press n to add one.`}):J(q,{children:(()=>{let e=Math.max(0,i-6),t=Math.min(r.length,e+12),n=Math.max(0,t-12),a=r.slice(n,t);return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),a.map((e,t)=>{let r=n+t,a=r===i;return Y(V,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,e]},r)}),t<r.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,r.length-t,` more below`]})]})})()}),u&&Y(B,{alignItems:`center`,children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:c})})]}),o&&Y(B,{marginTop:1,alignItems:`center`,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:c})})]})]})]})}const $=ge({settings:b,updateSettings:e=>{},changesApplied:!1,ccVersion:``});function yt({startupCheckInfo:e,configMigrated:t,invocationCommand:r,initialConfig:i}){let[a,o]=K(i),[s,c]=K(!i.hidePiebaldAnnouncement),l=_e(e=>{let t=JSON.parse(JSON.stringify(a.settings));e(t),o(e=>({...e,settings:t,changesApplied:!1})),j(e=>{e.settings=t,e.changesApplied=!1})},[a.settings]),[u,d]=K(null),[f,p]=K(null);G(()=>{e.wasUpdated&&e.oldVersion&&(p({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
3
- (However, your customization are still remembered in ${P}.)
2
+ import{A as e,C as t,E as n,F as r,G as i,H as a,I as o,J as s,K as c,L as l,M as u,N as d,O as f,P as p,Q as m,R as h,T as g,U as _,W as v,X as y,Y as b,Z as x,_ as S,a as C,b as w,c as T,f as E,g as D,h as O,i as k,j as A,k as j,l as M,m as ee,n as te,o as ne,p as re,q as ie,r as N,t as P,u as F,v as ae,w as I,y as oe,z as se}from"./config-DDE1Qxwn.mjs";import{a as ce,c as L,d as R,l as le,n as z,o as ue,s as de,t as fe,u as pe}from"./content-D0J68msM.mjs";import{Box as B,Text as V,render as me,useInput as H}from"ink";import{Command as he}from"commander";import U from"chalk";import ge,{Fragment as _e,createContext as ve,useCallback as ye,useContext as W,useEffect as G,useMemo as be,useRef as xe,useState as K}from"react";import*as Se from"node:os";import Ce from"ink-link";import*as we from"node:fs/promises";import Te from"node:fs/promises";import{structuredPatch as Ee}from"diff";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import De from"process";import Oe from"cli-spinners";import*as ke from"node:readline";import{execSync as Ae,spawn as je}from"node:child_process";var X=({children:e,...t})=>Y(V,{bold:!0,backgroundColor:`#ffd500`,color:`#000`,...t,children:[` `,e,` `]});const Me=[`\x1B[?25l\x1B[0m \x1B[38;2;0;0;0m \x1B[38;2;252;130;0m▂\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▇\x1B[38;2;254;131;0m\x1B[48;2;252;130;0m▇\x1B[48;2;252;130;0m▇▇\x1B[48;2;252;130;0m▇\x1B[0m\x1B[38;2;252;130;0m▇\x1B[38;2;252;130;0m▅\x1B[38;2;252;130;0m▄\x1B[38;2;252;130;0m▂ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;254;131;0m▗\x1B[38;2;254;131;0m▆\x1B[48;2;254;131;0m \x1B[38;2;254;132;0m╶ \x1B[0m\x1B[38;2;254;131;0m▆\x1B[38;2;254;131;0m▖ \x1B[0m`,` \x1B[7m\x1B[38;2;254;131;0m▘\x1B[0m\x1B[38;2;11;6;0m\x1B[48;2;254;131;0m \x1B[38;2;254;216;182m\x1B[48;2;254;136;12m▃\x1B[38;2;254;249;246m\x1B[48;2;254;143;29m▅\x1B[38;2;254;253;253m\x1B[48;2;254;143;40m▆\x1B[38;2;254;254;253m\x1B[48;2;254;152;68m▆▆▆\x1B[38;2;254;253;252m\x1B[48;2;254;141;34m▆\x1B[38;2;254;247;242m\x1B[48;2;254;140;24m▅\x1B[38;2;254;224;199m\x1B[48;2;254;140;20m▖\x1B[48;2;254;131;0m \x1B[0m\x1B[7m\x1B[38;2;254;131;0m▝\x1B[0m \x1B[0m`,`\x1B[7m\x1B[38;2;251;127;0m▌\x1B[0m\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[38;2;252;128;0m\x1B[48;2;254;131;0m▃\x1B[38;2;252;129;0m▂\x1B[38;2;253;130;0m▁\x1B[38;2;249;135;16m\x1B[48;2;253;226;202m▋\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┈\x1B[48;2;246;246;245m┈\x1B[38;2;47;47;47m\x1B[48;2;244;244;243m▂\x1B[38;2;112;112;112m\x1B[48;2;251;251;251m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m▁╌▝\x1B[38;2;254;254;253m\x1B[48;2;254;254;254m▋\x1B[38;2;254;254;254m\x1B[48;2;254;253;252m┈\x1B[38;2;252;209;168m\x1B[48;2;251;129;0m▍\x1B[38;2;253;129;0m\x1B[48;2;254;131;0m▂\x1B[38;2;252;128;0m▃\x1B[38;2;251;127;0m\x1B[48;2;253;130;0m▃\x1B[0m\x1B[38;2;251;127;0m▌\x1B[0m`,`\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▏\x1B[38;2;245;118;0m\x1B[48;2;248;122;0m▄\x1B[38;2;247;121;0m\x1B[48;2;247;122;0m┈\x1B[38;2;106;68;38m\x1B[48;2;245;123;2m▃\x1B[38;2;39;33;28m\x1B[48;2;211;109;6m▅\x1B[38;2;27;20;12m\x1B[48;2;237;237;237m▌\x1B[48;2;254;254;253m \x1B[38;2;90;90;89m\x1B[48;2;231;230;230m▝\x1B[38;2;215;215;214m\x1B[48;2;48;48;48m▁\x1B[38;2;203;203;202m\x1B[48;2;42;42;42m▂\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┇╴\x1B[38;2;253;252;252m▂\x1B[38;2;251;250;250m\x1B[48;2;253;253;253m▃\x1B[38;2;249;249;248m\x1B[48;2;252;252;251m▄\x1B[38;2;249;248;248m\x1B[48;2;237;118;0m▍\x1B[38;2;246;121;0m\x1B[48;2;250;125;0m▄\x1B[38;2;246;119;0m\x1B[48;2;249;124;0m▄\x1B[38;2;245;118;0m\x1B[48;2;248;123;0m▄\x1B[38;2;243;118;0m\x1B[48;2;243;118;0m▉\x1B[0m`,`\x1B[38;2;238;108;0m\x1B[48;2;237;109;0m▏\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;233;109;2m\x1B[48;2;125;73;29m▇\x1B[38;2;225;104;1m\x1B[48;2;50;32;18m▄\x1B[38;2;62;29;2m\x1B[48;2;239;237;237m▌\x1B[38;2;254;253;253m\x1B[48;2;254;254;254m┻\x1B[38;2;254;254;253m▊\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;253;253;252m▂\x1B[38;2;251;251;251m\x1B[48;2;254;253;253m▃\x1B[38;2;249;249;249m\x1B[48;2;252;252;252m▄\x1B[38;2;247;247;247m\x1B[48;2;250;250;250m▄\x1B[38;2;245;245;244m\x1B[48;2;248;248;248m▄\x1B[38;2;243;243;242m\x1B[48;2;246;246;245m▄\x1B[38;2;243;242;242m\x1B[48;2;230;109;0m▍\x1B[38;2;239;111;0m\x1B[48;2;243;116;0m▄\x1B[38;2;239;109;0m\x1B[48;2;242;114;0m▄\x1B[38;2;238;108;0m\x1B[48;2;241;113;0m▄\x1B[38;2;237;108;0m\x1B[48;2;238;108;0m▉\x1B[0m`,`\x1B[7m\x1B[38;2;231;98;0m▌\x1B[0m\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[38;2;231;99;0m\x1B[48;2;235;105;0m▄\x1B[38;2;232;100;0m\x1B[48;2;236;105;0m▄\x1B[38;2;232;101;0m\x1B[48;2;236;106;0m▄\x1B[38;2;223;99;0m\x1B[48;2;247;238;235m▌\x1B[38;2;254;254;254m\x1B[48;2;254;254;253m┊\x1B[38;2;252;252;251m▃\x1B[38;2;250;250;250m\x1B[48;2;253;253;252m▄\x1B[38;2;248;248;247m\x1B[48;2;251;251;250m▄\x1B[38;2;246;245;245m\x1B[48;2;249;248;248m▄\x1B[38;2;243;243;243m\x1B[48;2;246;246;246m▄\x1B[38;2;241;241;241m\x1B[48;2;244;244;244m▄\x1B[38;2;239;239;238m\x1B[48;2;242;242;242m▄\x1B[38;2;237;237;236m\x1B[48;2;240;240;239m▄\x1B[38;2;237;236;236m\x1B[48;2;223;99;0m▍\x1B[38;2;232;100;0m\x1B[48;2;236;106;0m▄\x1B[38;2;231;100;0m\x1B[48;2;235;105;0m▄\x1B[38;2;231;98;0m\x1B[48;2;234;103;0m▄\x1B[0m\x1B[38;2;231;98;0m▌\x1B[0m`,` \x1B[7m\x1B[38;2;224;89;0m▖\x1B[0m\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[38;2;225;90;0m\x1B[48;2;228;95;0m▄\x1B[38;2;225;91;0m\x1B[48;2;229;96;0m▄\x1B[38;2;217;90;1m\x1B[48;2;97;77;70m▌\x1B[38;2;70;70;70m\x1B[48;2;207;207;207m▆\x1B[38;2;66;65;65m\x1B[48;2;228;228;227m▄\x1B[38;2;66;66;66m\x1B[48;2;233;232;232m▂\x1B[38;2;169;169;169m\x1B[48;2;243;243;243m▁\x1B[38;2;240;239;239m\x1B[48;2;243;242;242m▄\x1B[38;2;238;237;237m\x1B[48;2;241;240;240m▄\x1B[38;2;235;235;235m\x1B[48;2;238;238;238m▄\x1B[38;2;233;233;233m\x1B[48;2;236;236;236m▄\x1B[38;2;231;231;230m\x1B[48;2;234;234;233m▄\x1B[38;2;231;230;230m\x1B[48;2;216;89;0m▍\x1B[38;2;225;90;0m\x1B[48;2;229;95;0m▄\x1B[38;2;224;89;0m\x1B[48;2;228;94;0m▄\x1B[0m\x1B[7m\x1B[38;2;224;89;0m▗\x1B[0m \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[38;2;217;80;0m▝\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m\x1B[48;2;221;86;0m▄\x1B[38;2;197;78;9m\x1B[48;2;66;66;65m▋\x1B[38;2;65;65;64m\x1B[48;2;60;60;60m▘\x1B[38;2;52;52;51m\x1B[48;2;56;56;56m▗\x1B[38;2;45;45;45m\x1B[48;2;50;50;49m▗\x1B[38;2;42;42;42m\x1B[48;2;46;46;46m┈\x1B[38;2;41;41;41m\x1B[48;2;203;202;202m▆\x1B[38;2;38;38;38m\x1B[48;2;218;218;218m▄\x1B[38;2;45;45;45m\x1B[48;2;221;221;221m▂\x1B[38;2;229;229;229m┊\x1B[38;2;225;225;225m\x1B[48;2;228;228;227m▄\x1B[38;2;225;224;224m\x1B[48;2;209;79;0m▍\x1B[0m\x1B[7m\x1B[38;2;217;80;0m▂\x1B[0m\x1B[38;2;217;80;0m▘ \x1B[0m`,` \x1B[38;2;0;0;0m \x1B[7m\x1B[38;2;191;73;0m▆\x1B[38;2;191;73;0m▄\x1B[38;2;56;55;55m▃\x1B[38;2;46;46;46m▁\x1B[0m\x1B[38;2;20;20;20m\x1B[48;2;42;42;42m▁\x1B[38;2;36;36;36m\x1B[48;2;35;34;34m╴\x1B[38;2;23;23;23m\x1B[48;2;29;29;28m▁\x1B[38;2;10;10;10m\x1B[48;2;22;22;22m▁\x1B[0m\x1B[7m\x1B[38;2;15;15;15m▁\x1B[38;2;22;22;21m▃\x1B[38;2;154;154;154m▅\x1B[38;2;175;116;83m▇\x1B[0m\x1B[38;2;17;15;14m \x1B[0m`,`\x1B[?25h\x1B[0m`];var Ne=()=>Y(B,{flexDirection:`row`,height:10,alignItems:`center`,borderStyle:`bold`,borderBottom:!1,borderTop:!1,borderRight:!1,borderColor:`#ff8400`,marginBottom:1,children:[Y(B,{marginBottom:1,paddingLeft:1,flexDirection:`column`,flexGrow:1,children:[J(V,{bold:!0,color:`#ff8400`,children:`Piebald is released!`}),J(V,{children:` `}),Y(V,{children:[`We've released `,J(V,{bold:!0,children:`Piebald`}),`, the ultimate agentic AI developer experience.`]}),Y(V,{children:[`Download it and try it out for free!`,` `,J(Ce,{url:`https://piebald.ai/`,fallback:!1,children:J(V,{color:`#ff8400`,children:`https://piebald.ai/`})})]}),J(V,{children:` `}),J(V,{dimColor:!0,color:`gray`,children:`press 'h' to hide`})]}),J(B,{width:22,flexShrink:0,flexDirection:`column`,alignItems:`center`,children:Me.map((e,t)=>J(V,{children:e},t))})]});let Z=function(e){return e.THEMES=`Themes`,e.THINKING_VERBS=`Thinking verbs`,e.THINKING_STYLE=`Thinking style`,e.USER_MESSAGE_DISPLAY=`User message display`,e.INPUT_PATTERN_HIGHLIGHTERS=`Input pattern highlighters`,e.MISC=`Misc`,e.TOOLSETS=`Toolsets`,e.SUBAGENT_MODELS=`Subagent models`,e.CLAUDE_MD_ALT_NAMES=`CLAUDE.md alternative names`,e.VIEW_SYSTEM_PROMPTS=`View system prompts`,e.RESTORE_ORIGINAL=`Restore original Claude Code (preserves config.json)`,e.OPEN_CONFIG=`Open config.json`,e.OPEN_CLI=`Open Claude Code's cli.js`,e.EXIT=`Exit`,e}({});function Pe({items:e,selectedIndex:t,onSelect:n,onSubmit:r}){return H((i,a)=>{a.upArrow?n(t>0?t-1:e.length-1):a.downArrow?n(t<e.length-1?t+1:0):a.return&&r(e[t].name)}),J(B,{flexDirection:`column`,children:e.map((e,n)=>J(B,{children:Y(V,{children:[Y(V,{bold:n===t,color:n===t?`cyan`:void 0,...n===t?e.selectedStyles??{}:e.styles??{},children:[n===t?`❯ `:` `,e.name]}),e.desc&&n===t&&Y(V,{dimColor:!0,bold:!1,children:[` \x1B[0;2m`,`- `,e.desc]})]})},n))})}const Fe=[{name:Z.THEMES,desc:`Modify Claude Code's built-in themes or create your own`},{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_PATTERN_HIGHLIGHTERS,desc:`Create custom highlighters for patterns in your input`},{name:Z.MISC,desc:`Miscellaneous settings (input box border, etc.)`},{name:Z.TOOLSETS,desc:`Manage toolsets to control which tools are available`},{name:Z.SUBAGENT_MODELS,desc:`Configure which Claude model each subagent uses (Plan, Explore, etc.)`},{name:Z.CLAUDE_MD_ALT_NAMES,desc:`Configure alternative filenames for CLAUDE.md (e.g., AGENTS.md)`},{name:Z.VIEW_SYSTEM_PROMPTS,desc:`Opens the system prompts directory where you can customize Claude Code's system prompts`}],Ie=[{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 (${N})`},{name:Z.OPEN_CLI,desc:`Opens Claude Code's cli.js file`},{name:Z.EXIT,desc:`Bye!`}];var Le=({onSubmit:e})=>{let t=[...Fe,...Ie],[n,r]=K(0);return J(Pe,{items:t,selectedIndex:n,onSelect:r,onSubmit:t=>e(t)})};const Re=()=>Y(B,{flexDirection:`row`,children:[J(X,{children:`tweakcc`}),J(V,{children:` (by `}),J(Ce,{url:`https://piebald.ai`,fallback:!1,children:J(V,{color:`#ff8400`,bold:!0,children:`Piebald`})}),J(V,{children:`)`})]}),ze=()=>J(B,{children:Y(V,{color:`yellow`,children:[`⭐ `,J(V,{bold:!0,children:`Star the repo at `}),J(Ce,{url:`https://github.com/Piebald-AI/tweakcc`,fallback:!1,children:J(V,{bold:!0,color:`cyan`,children:`https://github.com/Piebald-AI/tweakcc`})}),J(V,{bold:!0,children:` if you find this useful!`}),` ⭐`]})}),Be=({notification:e})=>J(B,{borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderStyle:`bold`,borderColor:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,paddingLeft:1,flexDirection:`column`,children:J(V,{color:e.type===`success`?`green`:e.type===`error`?`red`:e.type===`info`?`blue`:`yellow`,children:e.message})}),Ve=({onSubmit:e,notification:t,configMigrated:n,showPiebaldAnnouncement:r,changesApplied:i,invocationCommand:a})=>Y(B,{flexDirection:`column`,gap:1,children:[n&&J(B,{children:J(V,{color:`blue`,bold:!0,children:"Note that in tweakcc v3.2.0+, `ccInstallationDir` config is deprecated. You are now migrated to `ccInstallationPath` which supports npm and native installs."})}),J(Re,{}),J(B,{children:Y(V,{children:[J(V,{bold:!0,children:`Customize your Claude Code installation.`}),` `,Y(V,{dimColor:!0,children:[`Settings will be saved to `,te.replace(Se.homedir(),`~`),`/config.json.`]})]})}),J(r?Ne:ze,{}),t&&J(Be,{notification:t}),!i&&!t&&J(Be,{notification:{message:`Your changes are configured but not applied.\nRun \`${a} --apply\` to apply your customizations!`,type:`info`}}),J(Le,{onSubmit:e})]});function Q({color:e,backgroundColor:t,bold:n,dimColor:r,children:i}){let a=e?.startsWith(`ansi:`),o=t?.startsWith(`ansi:`);if(a||o){if(ge.Children.toArray(i).some(e=>ge.isValidElement(e)))return J(V,{children:i});let s=U;if(a){let t=e.slice(5);s=s[t]||s}if(o){let e=t.slice(5),n=e.startsWith(`bg`)?e:`bg${e.charAt(0).toUpperCase()}${e.slice(1)}`;s=s[n]||s}n&&(s=s.bold),r&&(s=s.dim);let c=ge.Children.toArray(i).map(e=>typeof e==`string`||typeof e==`number`?String(e):``).join(``);return J(V,{children:s(c)})}return J(V,{color:e,backgroundColor:t,bold:n,dimColor:r,children:i})}function He({text:e,nonShimmerColors:t,shimmerColors:n,shimmerWidth:r=3,updateDuration:i=50,restartPoint:a=10}){let[o,s]=K(0);return G(()=>{let t=setInterval(()=>{s(t=>{let n=t+1;return n>=e.length+a?-r:n})},i);return()=>clearInterval(t)},[e.length,a,i]),t.length===n.length?J(V,{children:e.split(``).map((i,a)=>{let s=a>=o&&a<o+r&&o<e.length,c=a%t.length;return J(V,{color:s?n[c]:t[c],children:i},a)})}):(console.error(`UltrathinkRainbowShimmer: nonShimmerColors and shimmerColors must have the same length`),J(V,{children:e}))}const Ue=De.cwd();function We({theme:e}){let{ccVersion:t}=W($);return Y(B,{flexDirection:`column`,paddingLeft:1,children:[J(B,{marginBottom:1,children:Y(V,{bold:!0,children:[`Preview: `,e.name]})}),J(B,{borderStyle:`single`,borderColor:`gray`,paddingX:1,children:Y(B,{flexDirection:`column`,children:[Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:` ▐`}),J(V,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`▛███▜`}),Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:`▌ `}),` `,J(V,{bold:!0,children:`Claude Code`}),` `,t?`v${t}`:`v2.0.14`]})]}),Y(V,{children:[J(Q,{color:e.colors.clawd_body,children:`▝▜`}),J(V,{color:e.colors.clawd_body,backgroundColor:e.colors.clawd_background,children:`█████`}),J(Q,{color:e.colors.clawd_body,children:`▛▘`}),` `,w(),` · `,ae()]}),Y(Q,{color:e.colors.clawd_body,children:[` `,`▘▘ ▝▝`,` `,Ue]}),Y(V,{children:[Y(Q,{color:e.colors.success,children:[`Login successful. Press`,` `]}),J(Q,{bold:!0,color:e.colors.success,children:`Enter`}),Y(Q,{color:e.colors.success,children:[` `,`to continue…`]})]})]}),J(V,{children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[`│ 1 function greet() `,`{`,` `,`│`]}),Y(V,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffRemoved,color:e.colors.text,children:`- console.log("`}),J(Q,{backgroundColor:e.colors.diffRemovedWord,children:`Hello, World!`}),J(Q,{backgroundColor:e.colors.diffRemoved,children:`");`}),` `,`│`]}),Y(V,{children:[`│ 2`,` `,J(Q,{backgroundColor:e.colors.diffAdded,color:e.colors.text,children:`+ console.log("`}),J(Q,{backgroundColor:e.colors.diffAddedWord,children:`Hello, Claude!`}),J(Q,{backgroundColor:e.colors.diffAdded,children:`");`}),` `,`│`]}),J(Q,{color:e.colors.warning,children:`╭─────────────────────────────────────────────╮`}),Y(Q,{color:e.colors.warning,children:[`│ Do you trust the files in this folder?`,` `,`│`]}),Y(V,{children:[J(Q,{color:e.colors.warning,children:`│ `}),J(V,{dimColor:!0,children:`Enter to confirm · Esc to exit`}),Y(Q,{color:e.colors.warning,children:[` `,`│`]})]}),J(Q,{color:e.colors.bashBorder,children:`───────────────────────────────────────────────`}),Y(V,{children:[J(Q,{color:e.colors.bashBorder,children:`!`}),J(V,{children:` ls`})]}),J(Q,{color:e.colors.promptBorder,children:`───────────────────────────────────────────────`}),J(V,{children:Y(V,{children:[`> list the dir`,` `,J(He,{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})]})}),J(Q,{color:e.colors.planMode,children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[J(Q,{color:e.colors.planMode,children:`│ `}),Y(Q,{color:e.colors.permission,children:[`Ready to code?`,` `]}),J(V,{children:`Here is Claude's plan:`}),Y(Q,{color:e.colors.planMode,children:[` `,`│`]})]}),J(Q,{color:e.colors.permission,children:`╭─────────────────────────────────────────────╮`}),Y(V,{children:[J(Q,{color:e.colors.permission,children:`│ `}),J(V,{bold:!0,children:`Permissions:`}),` `,Y(Q,{backgroundColor:e.colors.permission,color:e.colors.inverseText,bold:!0,children:[` `,`Allow`,` `]}),` `,`Deny`,` `,`Workspace`,` `,J(Q,{color:e.colors.permission,children:`│`})]}),J(V,{children:`> list the dir`}),Y(V,{children:[J(Q,{color:e.colors.error,children:`●`}),J(V,{children:` Update(__init__.py)`})]}),Y(V,{children:[J(V,{children:` ⎿ `}),J(Q,{color:e.colors.error,children:`User rejected update to __init__.py`})]}),Y(V,{children:[` `,`1`,` `,Y(Q,{backgroundColor:e.colors.diffRemovedDimmed,children:[`- import`,` `]}),J(Q,{backgroundColor:e.colors.diffRemovedWordDimmed,children:`os`})]}),Y(V,{children:[` `,`2`,` `,Y(Q,{backgroundColor:e.colors.diffAddedDimmed,children:[`+ import`,` `]}),J(Q,{backgroundColor:e.colors.diffAddedWordDimmed,children:`random`})]}),Y(V,{children:[J(Q,{color:e.colors.success,children:`●`}),J(V,{children:` List(.)`})]}),Y(V,{children:[J(V,{children:`●`}),J(V,{children:` The directory `}),J(Q,{color:e.colors.permission,children:`C:\\Users\\user`}),Y(V,{children:[` `,`contains `,J(V,{bold:!0,children:`123`}),` files.`]})]}),Y(V,{children:[J(Q,{color:e.colors.claude,children:`✻ Th`}),J(Q,{color:e.colors.claudeShimmer,children:`ink`}),J(Q,{color:e.colors.claude,children:`ing… `}),J(V,{children:`(esc to interrupt)`})]}),J(V,{children:J(Q,{color:e.colors.autoAccept,children:`⏵⏵ accept edits on (shift+tab to cycle)`})}),J(V,{children:J(Q,{color:e.colors.planMode,children:`⏸ plan mode on (shift+tab to cycle)`})}),J(V,{children:J(Q,{color:e.colors.ide,children:`◯ IDE connected ⧉ 44 lines selected`})})]})})]})}function Ge({colorKey:e,theme:t,bold:n=!1}){let r=t.colors[e];return e===`inverseText`?J(Q,{color:r,backgroundColor:t.colors.permission,bold:n,children:e}):e.startsWith(`diff`)?J(Q,{backgroundColor:r,bold:n,color:t.colors.text,children:e}):J(Q,{color:r,bold:n,children:e})}function Ke({initialValue:e,onColorChange:t,onExit:n,colorKey:r,theme:i}){let a=Je(e)||{h:0,s:50,l:50},o=qe(e)||{r:128,g:128,b:128},[s,c]=K(a),[l,u]=K(o),[d,f]=K(`hsl`),[p,m]=K(`h`),[h,_]=K(!1),[v,y]=K(!1);G(()=>{let t=Je(e),n=qe(e);t&&n&&(_(!0),c(t),u(n),_(!1))},[e]),G(()=>{!h&&v&&t(`rgb(${l.r},${l.g},${l.b})`)},[s,l,h,v]),G(()=>{y(!0)},[]);let b=e=>{if(I(e)){let t=g(e),n=Je(t),r=qe(t);n&&r&&(_(!0),c(n),u(r),_(!1))}};H((e,t)=>{if(e.length>1&&!t.ctrl&&!t.meta){b(e);return}t.return||t.escape?n():t.ctrl&&e===`a`?(f(e=>e===`hsl`?`rgb`:`hsl`),m(e=>d===`hsl`?e===`h`?`r`:e===`s`?`g`:`b`:e===`r`?`h`:e===`g`?`s`:`l`)):t.upArrow?m(d===`hsl`?e=>e===`h`?`l`:e===`s`?`h`:`s`:e=>e===`r`?`b`:e===`g`?`r`:`g`):t.downArrow||t.tab?m(d===`hsl`?e=>e===`h`?`s`:e===`s`?`l`:`h`:e=>e===`r`?`g`:e===`g`?`b`:`r`):t.leftArrow?x(t.shift||t.ctrl||t.meta?-10:-1):t.rightArrow&&x(t.shift||t.ctrl||t.meta?10:1)});let x=e=>{_(!0),d===`hsl`?c(t=>{let n={...t};p===`h`?n.h=Math.max(0,Math.min(359,t.h+e)):p===`s`?n.s=Math.max(0,Math.min(100,t.s+e)):p===`l`&&(n.l=Math.max(0,Math.min(100,t.l+e)));let[r,i,a]=C(n.h,n.s,n.l);return u({r,g:i,b:a}),n}):u(t=>{let n={...t};return p===`r`?n.r=Math.max(0,Math.min(255,t.r+e)):p===`g`?n.g=Math.max(0,Math.min(255,t.g+e)):p===`b`&&(n.b=Math.max(0,Math.min(255,t.b+e))),c(S(n.r,n.g,n.b)),n}),_(!1)},S=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===r?((i-a)/c+(i<a?6:0))/6:o===i?((a-r)/c+2)/6:((r-i)/c+4)/6),{h:Math.round(d*360),s:Math.round(u*100),l:Math.round(l*100)}},C=(e,t,n)=>{e/=360,t/=100,n/=100;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e*6%2-1)),a=n-r/2,o=0,s=0,c=0;return 0<=e&&e<1/6?(o=r,s=i,c=0):1/6<=e&&e<2/6?(o=i,s=r,c=0):2/6<=e&&e<3/6?(o=0,s=r,c=i):3/6<=e&&e<4/6?(o=0,s=i,c=r):4/6<=e&&e<5/6?(o=i,s=0,c=r):5/6<=e&&e<1&&(o=r,s=0,c=i),[Math.round((o+a)*255),Math.round((s+a)*255),Math.round((c+a)*255)]},w=()=>{let e=[],t=[[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 n=0;n<40;n++){let r=n/39*(t.length-1),i=Math.floor(r),a=Math.ceil(r),o=r-i,[s,c,l]=t[i],[u,d,f]=t[a],p=Math.round(s+(u-s)*o),m=Math.round(c+(d-c)*o),h=Math.round(l+(f-l)*o);e.push(J(V,{backgroundColor:`rgb(${p},${m},${h})`,children:` `},n))}return e},T=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=C(s.h,n,s.l);e.push(J(V,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},E=()=>{let e=[];for(let t=0;t<40;t++){let n=t/39*100,[r,i,a]=C(s.h,s.s,n);e.push(J(V,{backgroundColor:`rgb(${r},${i},${a})`,children:` `},t))}return e},D=()=>{let[e,t,n]=C(s.h,s.s,s.l);return`rgb(${e},${t},${n})`},O=(e,t,n)=>{let r=e=>e.toString(16).padStart(2,`0`);return`#${r(e)}${r(t)}${r(n)}`},k=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${n},${l.g},${l.b})`,children:` `},t))}return e},A=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${l.r},${n},${l.b})`,children:` `},t))}return e},j=()=>{let e=[];for(let t=0;t<40;t++){let n=Math.round(t/39*255);e.push(J(V,{backgroundColor:`rgb(${l.r},${l.g},${n})`,children:` `},t))}return e},M=(e,t)=>Math.round(e/t*39);return Y(B,{flexDirection:`column`,borderStyle:`single`,borderColor:`white`,padding:1,children:[Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Color Picker`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{color:`gray`,dimColor:!0,children:`←→ to adjust (shift/ctrl/cmd +10)`}),J(V,{color:`gray`,dimColor:!0,children:`↑↓ to change bar`}),J(V,{color:`gray`,dimColor:!0,children:`ctrl+a to switch rgb/hsl`}),J(V,{color:`gray`,dimColor:!0,children:`paste color from clipboard`}),J(V,{color:`gray`,dimColor:!0,children:`enter to exit (auto-saved)`}),J(V,{color:`gray`,dimColor:!0,children:`esc to save and exit`})]})]}),d===`hsl`?Y(q,{children:[Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:p===`h`?`yellow`:`white`,children:[p===`h`?`❯ `:` `,`Hue (`,s.h,`°):`]})}),J(B,{children:w().map((e,t)=>J(_e,{children:t===M(s.h,360)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:p===`s`?`yellow`:`white`,children:[p===`s`?`❯ `:` `,`Saturation (`,s.s,`%):`]})}),J(B,{children:T().map((e,t)=>J(_e,{children:t===M(s.s,100)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:p===`l`?`yellow`:`white`,children:[p===`l`?`❯ `:` `,`Lightness (`,s.l,`%):`]})}),J(B,{children:E().map((e,t)=>J(_e,{children:t===M(s.l,100)?J(V,{children:`|`}):e},t))})]})]}):Y(q,{children:[Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:p===`r`?`yellow`:`white`,children:[p===`r`?`❯ `:` `,`Red (`,l.r,`):`]})}),J(B,{children:k().map((e,t)=>J(_e,{children:t===M(l.r,255)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:p===`g`?`yellow`:`white`,children:[p===`g`?`❯ `:` `,`Green (`,l.g,`):`]})}),J(B,{children:A().map((e,t)=>J(_e,{children:t===M(l.g,255)?J(V,{children:`|`}):e},t))})]}),Y(B,{marginBottom:1,children:[J(B,{width:25,children:Y(V,{color:p===`b`?`yellow`:`white`,children:[p===`b`?`❯ `:` `,`Blue (`,l.b,`):`]})}),J(B,{children:j().map((e,t)=>J(_e,{children:t===M(l.b,255)?J(V,{children:`|`}):e},t))})]})]}),Y(B,{marginBottom:1,children:[J(V,{children:`Current: `}),J(V,{backgroundColor:D(),children:` `})]}),Y(B,{flexDirection:`row`,justifyContent:`space-between`,children:[Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`Hex `}),r?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:i?.colors?.text||`white`,bold:!0,children:O(l.r,l.g,l.b)}):r===`inverseText`?J(V,{color:D(),backgroundColor:i?.colors?.permission,bold:!0,children:O(l.r,l.g,l.b)}):J(V,{color:D(),bold:!0,children:O(l.r,l.g,l.b)})]}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`RGB `}),r?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:i?.colors?.text||`white`,bold:!0,children:`rgb(${l.r}, ${l.g}, ${l.b})`}):r===`inverseText`?J(V,{color:D(),backgroundColor:i?.colors?.permission,bold:!0,children:`rgb(${l.r}, ${l.g}, ${l.b})`}):J(V,{color:D(),bold:!0,children:`rgb(${l.r}, ${l.g}, ${l.b})`})]}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`HSL `}),r?.startsWith(`diff`)?J(V,{backgroundColor:D(),color:i?.colors?.text||`white`,bold:!0,children:`hsl(${s.h}, ${s.s}%, ${s.l}%)`}):r===`inverseText`?J(V,{color:D(),backgroundColor:i?.colors?.permission,bold:!0,children:`hsl(${s.h}, ${s.s}%, ${s.l}%)`}):J(V,{color:D(),bold:!0,children:`hsl(${s.h}, ${s.s}%, ${s.l}%)`})]})]})]})}function qe(e){let t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(t)return{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])};let n=e.match(/^#([a-fA-F0-9]{6})$/);if(n){let e=n[1];return{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16)}}return null}function Je(e){let t=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(t)return{h:parseInt(t[1]),s:parseInt(t[2]),l:parseInt(t[3])};let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(n){let e=parseInt(n[1])/255,t=parseInt(n[2])/255,r=parseInt(n[3])/255,i=Math.max(e,t,r),a=Math.min(e,t,r),o=i-a,s=(i+a)/2,c=0;o!==0&&(c=s>.5?o/(2-i-a):o/(i+a));let l=0;return o!==0&&(l=i===e?((t-r)/o+(t<r?6:0))/6:i===t?((r-e)/o+2)/6:((e-t)/o+4)/6),{h:Math.round(l*360),s:Math.round(c*100),l:Math.round(s*100)}}let r=e.match(/^#([a-fA-F0-9]{6})$/);if(r){let e=r[1],t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,i=parseInt(e.substr(4,2),16)/255,a=Math.max(t,n,i),o=Math.min(t,n,i),s=a-o,c=(a+o)/2,l=0;s!==0&&(l=c>.5?s/(2-a-o):s/(a+o));let u=0;return s!==0&&(u=a===t?((n-i)/s+(n<i?6:0))/6:a===n?((i-t)/s+2)/6:((t-n)/s+4)/6),{h:Math.round(u*360),s:Math.round(l*100),l:Math.round(c*100)}}return{h:0,s:50,l:50}}function Ye({onBack:e,themeId:t}){let{settings:{themes:n},updateSettings:r}=W($),[i,a]=K(t),o=n.find(e=>e.id===i)||n[0],[s,c]=K(`rgb`),[l,u]=K(0),[d,f]=K(null),[p,m]=K(null),[h,_]=K(``),[v,y]=K(``),[b,x]=K(!1),[S,C]=K(0),w=ye(e=>{r(t=>{let n=t.themes.findIndex(e=>e.id===i);n!==-1&&e(t.themes[n])})},[i,r]),T=e=>{if(l>=2&&I(e)){let t=g(e),n=E[l-2];w(e=>{e.colors[n]=t})}};H((t,n)=>{if(b){if(n.escape){x(!1),e();return}return}if(d===null&&p===null){if(t.length>1&&!n.ctrl&&!n.meta){T(t);return}if(n.escape)x(!0),C(0);else if(n.ctrl&&t===`a`)c(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(n.upArrow)u(e=>Math.max(0,e-1));else if(n.downArrow)u(e=>Math.min(E.length+1,e+1));else if(n.return)if(l===0)m(`name`),_(o.name),y(o.name);else if(l===1)m(`id`),_(o.id),y(o.id);else{let e=l-2,t=E[e],n=o.colors[t];f(e),_(n),y(n)}}else if(d!==null)n.ctrl&&t===`a`&&c(e=>e===`rgb`?`hex`:e===`hex`?`hsl`:`rgb`);else if(p!==null)if(n.return){if(p===`id`){let e=i;a(h),r(t=>{let n=t.themes.findIndex(t=>t.id===e);n!==-1&&(t.themes[n].id=h)})}else w(e=>{e.name=h});m(null),_(``),y(``)}else n.escape?(m(null),_(``),y(``)):n.backspace||n.delete?_(e=>e.slice(0,-1)):t&&_(e=>e+t)});let E=Object.keys(o.colors),D=(e,t)=>{let n=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(!n)return e;let r=parseInt(n[1]),i=parseInt(n[2]),a=parseInt(n[3]);switch(t){case`hex`:{let e=e=>e.toString(16).padStart(2,`0`);return`#${e(r)}${e(i)}${e(a)}`}case`hsl`:{let e=r/255,t=i/255,n=a/255,o=Math.max(e,t,n),s=Math.min(e,t,n),c=o-s,l=(o+s)/2,u=0;c!==0&&(u=l>.5?c/(2-o-s):c/(o+s));let d=0;return c!==0&&(d=o===e?((t-n)/c+(t<n?6:0))/6:o===t?((n-e)/c+2)/6:((e-t)/c+4)/6),`hsl(${Math.round(d*360)}, ${Math.round(u*100)}%, ${Math.round(l*100)}%)`}case`rgb`:default:return e}},O=e=>({autoAccept:`Auto-accept edits 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`})[e]||``,k=Math.max(...E.map(e=>e.length));return Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(X,{children:[`Editing theme “`,o.name,`” (`,o.id,`)`]})}),b?Y(B,{flexDirection:`column`,marginTop:1,children:[J(B,{marginBottom:1,children:Y(V,{bold:!0,children:[`Would you like to make “`,o.name,`” your current Claude Code theme?`]})}),J(Pe,{items:[{name:`Yes`,desc:`Set ${o.id} as active theme`},{name:`No`,desc:`Go back without changing theme`}],selectedIndex:S,onSelect:C,onSubmit:()=>{S===0&&j(o.id),x(!1),e()}}),J(V,{dimColor:!0,children:`enter to select, esc to cancel`})]}):d===null&&p===null?Y(q,{children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`enter to edit theme name, id, or color`}),J(V,{dimColor:!0,children:`ctrl+a to toggle rgb, hex, hsl`}),J(V,{dimColor:!0,children:`paste color from clipboard (when on color)`}),J(V,{dimColor:!0,children:`esc to go back`})]}),l<2?Y(B,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:`yellow`,flexDirection:`column`,paddingLeft:1,children:[J(V,{bold:!0,children:l===0?`Theme Name`:`Theme ID`}),J(V,{children:l===0?`The display name for this theme`:"Unique identifier for this theme; used in `.claude.json` to select the theme."})]}):Y(B,{marginBottom:1,borderStyle:`single`,borderTop:!1,borderBottom:!1,borderRight:!1,borderColor:o.colors[E[l-2]],flexDirection:`column`,paddingLeft:1,children:[J(Ge,{colorKey:E[l-2],theme:o,bold:!0}),J(V,{children:O(E[l-2])})]}),Y(B,{flexDirection:`column`,children:[Y(B,{children:[J(V,{color:l===0?`yellow`:`white`,children:l===0?`❯ `:` `}),J(V,{bold:!0,children:`Name: `}),J(V,{children:o.name})]}),Y(B,{marginBottom:1,children:[J(V,{color:l===1?`yellow`:`white`,children:l===1?`❯ `:` `}),J(V,{bold:!0,children:`ID: `}),J(V,{children:o.id})]}),(()=>{if(l<2)return Y(q,{children:[E.slice(0,20).map((e,t)=>{let n=t+2;return Y(B,{children:[J(V,{color:l===n?`yellow`:`white`,children:l===n?`❯ `:` `}),J(B,{width:k+2,children:J(V,{children:J(Ge,{colorKey:e,theme:o,bold:!0})})}),J(Q,{color:o.colors[e],children:D(o.colors[e],s)})]},e)}),E.length>20&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,E.length-20,` more below`]})]});let e=l-2,t=Math.max(0,e-10),n=Math.min(E.length,t+20),r=Math.max(0,n-20),i=E.slice(r,n);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t+2;return Y(B,{children:[J(V,{color:l===n?`yellow`:`white`,children:l===n?`❯ `:` `}),J(B,{width:k+2,children:J(V,{children:J(Ge,{colorKey:e,theme:o,bold:!0})})}),J(Q,{color:o.colors[e],children:D(o.colors[e],s)})]},e)}),n<E.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,E.length-n,` more below`]})]})})()]})]}):p?Y(B,{flexDirection:`column`,marginTop:1,children:[Y(V,{children:[`Editing `,p===`name`?`theme name`:`theme ID`,`:`]}),J(B,{borderStyle:`round`,borderColor:`yellow`,paddingX:1,children:J(V,{children:h})}),J(V,{dimColor:!0,children:`enter to save, esc to cancel`})]}):J(Ke,{initialValue:v,colorKey:E[d],theme:o,onColorChange:e=>{_(e),w(t=>{t.colors[E[d]]=e})},onExit:()=>{w(e=>{e.colors[E[d]]=h}),f(null),_(``),y(``)}})]}),J(B,{width:`50%`,children:J(We,{theme:o})})]})}const Xe=`https://raw.githubusercontent.com/Piebald-AI/claude-code-themes/main`,Ze=`${Xe}/index.json`;async function Qe(){E(`Fetching community theme index from ${Ze}`);let e=await fetch(Ze,{headers:{Accept:`application/json`}});if(!e.ok)throw Error(`Failed to fetch community theme index: ${e.status} ${e.statusText}`);return await e.json()}async function $e(e){let t=`${Xe}/themes/${e}.json`;E(`Fetching community theme from ${t}`);let n=await fetch(t,{headers:{Accept:`application/json`}});if(!n.ok)throw Error(`Failed to fetch community theme "${e}": ${n.status} ${n.statusText}`);return await n.json()}function et({onBack:e}){let{updateSettings:t}=W($),[n,r]=K({status:`loading`}),[i,a]=K(0),[o,s]=K(null),[c,l]=K(!1),[u,d]=K(null),f=xe(0);G(()=>{Qe().then(e=>{r({status:`loaded`,entries:e})}).catch(e=>{r({status:`error`,message:e.message})})},[]);let p=n.status===`loaded`?n.entries:[],h=ye(async e=>{let t=++f.current;l(!0),d(null);try{let n=await $e(e);if(t!==f.current)return;s(re(n,m))}catch{if(t!==f.current)return;s(null),d(`Failed to load preview.`)}finally{t===f.current&&l(!1)}},[]),g=ye(async e=>{d(`Downloading theme…`);try{let n=re(await $e(e.id),m),r=!1;t(e=>{e.themes.some(e=>e.id===n.id)||(e.themes.push(n),r=!0)}),d(r?`Added "${n.name}" to your themes!`:`Theme "${n.name}" (${n.id}) is already in your config.`)}catch{d(`Failed to download theme.`)}},[t]);return H((t,r)=>{if(r.escape){e();return}if(n.status!==`loaded`)return;let o=n.entries.length;if(o!==0){if(r.upArrow)a(e=>Math.max(0,e-1)),s(null),d(null);else if(r.downArrow)a(e=>Math.min(o-1,e+1)),s(null),d(null);else if(t===` `){let e=n.entries[i];e&&h(e.id)}else if(r.return){let e=n.entries[i];e&&g(e)}}}),n.status===`loading`?Y(B,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),J(V,{children:`Loading community themes…`})]}):n.status===`error`?Y(B,{flexDirection:`column`,children:[J(X,{children:`Community Themes`}),Y(V,{color:`red`,children:[`Error: `,n.message]}),J(V,{dimColor:!0,children:`esc to go back`})]}):Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Community Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`space to preview theme`}),J(V,{dimColor:!0,children:`enter to download theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),J(B,{flexDirection:`column`,children:p.map((e,t)=>Y(V,{color:i===t?`yellow`:void 0,children:[i===t?`❯ `:` `,e.name,` (`,e.id,`) by @`,e.author]},e.id))}),u&&J(B,{marginTop:1,children:J(V,{color:`cyan`,children:u})}),c&&J(B,{marginTop:1,children:J(V,{dimColor:!0,children:`Loading preview…`})})]}),J(B,{width:`50%`,children:o?J(We,{theme:o}):J(B,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(V,{dimColor:!0,children:`Press space to preview the selected theme.`})})})]})}function tt(e){return e.map(e=>`${e.name} (${e.id})`)}function nt({onBack:e}){let{settings:{themes:t},updateSettings:n}=W($),[r,i]=K(0),[a,o]=K(null),[s,c]=K(!0),[l,u]=K(!1),d=t.length+1,f=()=>{let e={colors:{...(t[0]||x.themes[0]).colors},name:`New Custom Theme`,id:`custom-${Date.now()}`};n(t=>{t.themes.push(e)}),o(e.id),c(!1)},p=e=>{t.length<=1||(n(t=>{t.themes=t.themes.filter(t=>t.id!==e)}),r>=t.length-1&&i(Math.max(0,t.length-2)))},m=()=>{n(e=>{e.themes=[...x.themes]}),i(0)},h=r===t.length;if(H((n,a)=>{if(a.escape)e();else if(a.upArrow)i(e=>Math.max(0,e-1));else if(a.downArrow)i(e=>Math.min(d-1,e+1));else if(a.return)if(h)u(!0),c(!1);else{let e=t[r];e&&(o(e.id),c(!1))}else if(n===`n`)f();else if(n===`d`){if(!h){let e=t[r];e&&p(e.id)}}else a.ctrl&&n===`r`&&m()},{isActive:s}),l)return J(et,{onBack:()=>{u(!1),c(!0)}});if(a)return J(Ye,{themeId:a,onBack:()=>{o(null),c(!0)}});let g=tt(t),_=t.find(e=>g[r]?.includes(`(${e.id})`))||t[0];return t.length===0?J(B,{children:Y(B,{flexDirection:`column`,width:`100%`,children:[J(X,{children:`Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),J(V,{children:`No themes available!`})]})}):Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(X,{children:`Themes`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new theme`}),J(V,{dimColor:!0,children:`d to delete a theme`}),J(V,{dimColor:!0,children:`ctrl+r to delete all themes and restore built-in`}),J(V,{dimColor:!0,children:`enter to edit theme`}),J(V,{dimColor:!0,children:`esc to go back`})]}),Y(B,{flexDirection:`column`,children:[g.map((e,t)=>Y(V,{color:r===t?`yellow`:void 0,children:[r===t?`❯ `:` `,e]},t)),Y(V,{color:h?`blue`:void 0,bold:h,children:[h?`❯ `:` `,`Browse community themes…`]})]})]}),J(B,{width:`50%`,children:h?J(B,{flexDirection:`column`,justifyContent:`center`,alignItems:`center`,height:10,children:J(V,{dimColor:!0,children:`Press enter to browse community themes.`})}):J(We,{theme:_})})]})}function rt({onBack:e}){let{settings:{thinkingVerbs:{format:t,verbs:n},themes:r},updateSettings:i}=W($),a=[`format`,`verbs`],[o,s]=K(0),c=a[o],[l,u]=K(0),[d,f]=K(!1),[p,m]=K(``),[h,g]=K(!1),[_,v]=K(!1),[y,b]=K(t),S=oe(),C=(r.find(e=>e.id===S)||r.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;return H((r,o)=>{if(_){o.return?(i(e=>{e.thinkingVerbs.format=y}),v(!1)):o.escape?(b(t),v(!1)):o.backspace||o.delete?b(e=>e.slice(0,-1)):r&&b(e=>e+r);return}if(d||h){o.return&&p.trim()?(h?(i(e=>{e.thinkingVerbs.verbs.push(p.trim())}),g(!1)):(i(e=>{e.thinkingVerbs.verbs[l]=p.trim()}),f(!1)),m(``)):o.escape?(m(``),f(!1),g(!1)):o.backspace||o.delete?m(e=>e.slice(0,-1)):r&&m(e=>e+r);return}o.escape?e():o.return?c===`format`&&(b(t),v(!0)):o.tab?o.shift?s(e=>e===0?a.length-1:e-1):s(e=>e===a.length-1?0:e+1):o.upArrow?c===`verbs`&&n.length>0&&u(e=>e>0?e-1:n.length-1):o.downArrow?c===`verbs`&&n.length>0&&u(e=>e<n.length-1?e+1:0):r===`e`&&c===`verbs`?n.length>0&&(m(n[l]),f(!0)):r===`d`&&c===`verbs`?n.length>1&&(i(e=>{e.thinkingVerbs.verbs=e.thinkingVerbs.verbs.filter((e,t)=>t!==l)}),l>=n.length-1&&u(Math.max(0,n.length-2))):r===`n`&&c===`verbs`?(g(!0),m(``)):o.ctrl&&r===`r`&&c===`verbs`&&(i(e=>{e.thinkingVerbs.verbs=[...x.thinkingVerbs.verbs]}),u(0))}),Y(B,{children:[Y(B,{flexDirection:`column`,width:`50%`,children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`Thinking Verbs`}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:c===`format`?`enter to edit format`:`changes auto-saved`}),J(V,{dimColor:!0,children:`esc to go back`}),J(V,{dimColor:!0,children:`tab to switch sections`})]})]}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Customize the verbs shown during generation and their format.`})}),Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:c===`format`?`yellow`:void 0,children:c===`format`?`❯ `:` `}),J(V,{bold:!0,color:c===`format`?`yellow`:void 0,children:`Format`})]}),c===`format`&&(_?Y(V,{dimColor:!0,children:[` `,`enter to save`]}):Y(V,{dimColor:!0,children:[` `,`enter to edit`]}))]}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:_?`yellow`:`gray`,children:J(V,{children:_?y:t})})}),J(B,{children:Y(V,{children:[J(V,{color:c===`verbs`?`yellow`:void 0,children:c===`verbs`?`❯ `:` `}),J(V,{bold:!0,color:c===`verbs`?`yellow`:void 0,children:`Verbs`})]})}),c===`verbs`&&J(B,{flexDirection:`column`,children:Y(V,{dimColor:!0,children:[` `,`e to edit · d to delete · n to add new · ctrl+r to reset`]})}),J(B,{marginLeft:2,marginBottom:1,children:Y(B,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,l-4),t=Math.min(n.length,e+8),r=Math.max(0,t-8),i=n.slice(r,t);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t;return Y(V,{color:c===`verbs`&&n===l?`cyan`:void 0,children:[c===`verbs`&&n===l?`❯ `:` `,e]},n)}),t<n.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,n.length-t,` more below`]})]})})(),h&&Y(B,{alignItems:`center`,children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:p})})]}),d&&Y(B,{marginTop:1,alignItems:`center`,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:p})})]})]})})]}),Y(B,{width:`50%`,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Preview`})}),J(B,{borderStyle:`single`,borderColor:`gray`,padding:1,flexDirection:`column`,children:Y(V,{children:[Y(V,{color:C,children:[`✻ `,t.replace(/\{\}/g,n[l]),` `]}),J(V,{children:`(esc to interrupt)`})]})})]})]})}const it=e=>e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z])([A-Z][a-z])/g,`$1 $2`).replace(/(\d+)/g,` $1 `).replace(/\s+/g,` `).trim().replace(/^./,e=>e.toUpperCase()),at=e=>{let t=Math.max(...e.map(e=>e.length));return e.map(e=>e.padEnd(t))},ot=Object.entries(Oe).map(([e,t])=>({name:it(e),phases:t.frames.map(e=>e.trimEnd()),reverseMirror:!1,updateInterval:t.interval})),st=[{name:`Default`,phases:x.thinkingStyle.phases,reverseMirror:x.thinkingStyle.reverseMirror},{name:`Wave`,phases:[`▁`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],reverseMirror:!0},{name:`Glow`,phases:[`░`,`▒`,`▓`,`█`],reverseMirror:!0},{name:`Partial block`,phases:[`▏`,`▎`,`▍`,`▌`,`▋`,`▊`,`▉`,`█`],reverseMirror:!0},{name:`Colors`,phases:[`🔴`,`🟠`,`🟡`,`🟢`,`🔵`,`🟣`],reverseMirror:!1},...ot];function ct({onBack:e}){let{settings:{thinkingStyle:{phases:t,updateInterval:n,reverseMirror:r},themes:i},updateSettings:a}=W($),o=[`reverseMirror`,`updateInterval`,`phases`,`presets`],[s,c]=K(0),l=o[s],[u,d]=K(0),[f,p]=K(0),[m,h]=K(!1),[g,_]=K(``),[v,y]=K(!1),[b,S]=K(!1),[C,w]=K(n.toString()),[T,E]=K(0),D=oe(),O=(i.find(e=>e.id===D)||i.find(e=>e.id===`dark`))?.colors.claude||`rgb(215,119,87)`;G(()=>{if(t.length>0){let e=r?[...t,...[...t].reverse().slice(1,-1)]:t,i=setInterval(()=>{E(t=>(t+1)%e.length)},n);return()=>clearInterval(i)}},[t,n,r]),H((r,i)=>{if(b){if(i.return){let e=parseInt(C);!isNaN(e)&&e>0&&a(t=>{t.thinkingStyle.updateInterval=e}),S(!1)}else i.escape?(w(n.toString()),S(!1)):i.backspace||i.delete?w(e=>e.slice(0,-1)):r&&r.match(/^[0-9]$/)&&w(e=>e+r);return}if(m||v){if(i.return&&g.length){let e=v?[...t,g]:t.map((e,t)=>t===u?g:e);a(t=>{t.thinkingStyle.phases=at(e)}),h(!1),_(``)}else i.escape?(_(``),h(!1),y(!1)):i.backspace||i.delete?_(e=>e.slice(0,-1)):r&&_(e=>e+r);return}if(i.escape)e();else if(i.return)if(l===`updateInterval`)w(n.toString()),S(!0);else if(l===`presets`){let e=st[f];a(t=>{t.thinkingStyle.phases=at([...e.phases]),t.thinkingStyle.reverseMirror=e.reverseMirror,e.updateInterval!==void 0&&(t.thinkingStyle.updateInterval=e.updateInterval)})}else l===`reverseMirror`&&a(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(i.tab)i.shift?c(e=>e===0?o.length-1:e-1):c(e=>e===o.length-1?0:e+1);else if(i.upArrow)l===`phases`&&t.length>0?d(e=>e>0?e-1:t.length-1):l===`presets`&&p(e=>e>0?e-1:st.length-1);else if(i.downArrow)l===`phases`&&t.length>0?d(e=>e<t.length-1?e+1:0):l===`presets`&&p(e=>e<st.length-1?e+1:0);else if(r===` `)l===`reverseMirror`&&a(e=>{e.thinkingStyle.reverseMirror=!e.thinkingStyle.reverseMirror});else if(r===`e`&&l===`phases`)t.length>0&&(_(t[u]),h(!0));else if(r===`a`&&l===`phases`)y(!0),_(``);else if(r===`d`&&l===`phases`)t.length>1&&(a(e=>{e.thinkingStyle.phases=at(t.filter((e,t)=>t!==u))}),u>=t.length&&d(Math.max(0,t.length-1)));else if(r===`w`&&l===`phases`){if(u>0){let e=[...t];[e[u-1],e[u]]=[e[u],e[u-1]],a(t=>{t.thinkingStyle.phases=e}),d(e=>e-1)}}else if(r===`s`&&l===`phases`){if(u<t.length-1){let e=[...t];[e[u],e[u+1]]=[e[u+1],e[u]],a(t=>{t.thinkingStyle.phases=e}),d(e=>e+1)}}else i.ctrl&&r===`r`&&(a(e=>{e.thinkingStyle=x.thinkingStyle}),d(0),p(0))});let k=r?`●`:`○`,A=(()=>r?[...t,...[...t].reverse().slice(1,-1)]:t)(),j=A.length>0?A[T]:`·`;return J(B,{children:Y(B,{flexDirection:`column`,width:`100%`,children:[Y(B,{flexDirection:`row`,width:`100%`,children:[Y(B,{marginBottom:1,flexDirection:`column`,width:`50%`,children:[J(X,{children:`Thinking style`}),Y(B,{flexDirection:`column`,children:[Y(V,{dimColor:!0,children:[`enter to`,` `,l===`updateInterval`?`edit interval`:l===`presets`?`apply preset`:`save`]}),J(V,{dimColor:!0,children:`esc to go back`}),J(V,{dimColor:!0,children:`tab to switch sections`})]})]}),Y(B,{width:`50%`,flexDirection:`column`,children:[J(B,{children:J(V,{bold:!0,children:`Preview`})}),Y(B,{borderStyle:`single`,borderColor:`gray`,paddingX:1,flexDirection:`row`,children:[J(B,{width:(j?.length??0)+1,children:J(V,{color:O,children:j})}),Y(V,{children:[J(V,{color:O,children:`Thinking… `}),J(V,{children:`(esc to interrupt)`})]})]})]})]}),Y(B,{flexDirection:`row`,gap:4,children:[Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:l===`reverseMirror`?`yellow`:void 0,children:l===`reverseMirror`?`❯ `:` `}),J(V,{bold:!0,color:l===`reverseMirror`?`yellow`:void 0,children:`Reverse-mirror phases`})]}),l===`reverseMirror`&&Y(V,{dimColor:!0,children:[` `,`space to toggle`]}),J(B,{marginLeft:2,marginBottom:1,children:Y(V,{children:[k,` `,r?`Enabled`:`Disabled`]})})]}),Y(B,{flexDirection:`column`,children:[Y(V,{children:[J(V,{color:l===`updateInterval`?`yellow`:void 0,children:l===`updateInterval`?`❯ `:` `}),J(V,{bold:!0,color:l===`updateInterval`?`yellow`:void 0,children:`Update interval (ms)`})]}),l===`updateInterval`&&(b?Y(V,{dimColor:!0,children:[` `,`enter to save`]}):Y(V,{dimColor:!0,children:[` `,`enter to edit`]})),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:b?`yellow`:`gray`,children:J(V,{children:b?C:n})})})]})]}),J(B,{children:Y(V,{children:[J(V,{color:l===`phases`?`yellow`:void 0,children:l===`phases`?`❯ `:` `}),J(V,{bold:!0,color:l===`phases`?`yellow`:void 0,children:`Phases`})]})}),l===`phases`&&J(B,{marginBottom:1,flexDirection:`column`,children:Y(V,{dimColor:!0,children:[` `,`[e]dit`,` `,`[a]dd`,` `,`[d]elete`,` `,`[w]move up`,` `,`[s]move down`]})}),J(B,{marginLeft:2,marginBottom:1,children:Y(B,{flexDirection:`column`,children:[(()=>{let e=Math.max(0,u-4),n=Math.min(t.length,e+8),r=Math.max(0,n-8),i=t.slice(r,n);return Y(q,{children:[r>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,r,` more above`]}),i.map((e,t)=>{let n=r+t;return Y(V,{color:l===`phases`&&n===u?`cyan`:void 0,children:[l===`phases`&&n===u?`❯ `:` `,e]},n)}),n<t.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,t.length-n,` more below`]})]})})(),v&&Y(B,{children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:g})})]}),m&&Y(B,{marginTop:1,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:g})})]})]})}),J(B,{children:Y(V,{children:[J(V,{color:l===`presets`?`yellow`:void 0,children:l===`presets`?`❯ `:` `}),J(V,{bold:!0,color:l===`presets`?`yellow`:void 0,children:`Presets`})]})}),l===`presets`&&Y(V,{dimColor:!0,children:[` `,`Selecting one will overwrite your choice of phases and interval`]}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{flexDirection:`column`,children:(()=>{let e=Math.max(0,f-6),t=Math.min(st.length,e+12),n=Math.max(0,t-12),r=st.slice(n,t),i=e=>{let t=e.phases.join(``);return t.length>30?t.slice(0,27)+`…`:t};return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),r.map((e,t)=>{let r=n+t,a=l===`presets`&&r===f;return Y(V,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,e.name,` `,i(e)]},r)}),t<st.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,st.length-t,` more below`]})]})})()})}),J(B,{marginTop:1,children:J(V,{dimColor:!0,children:`ctrl+r to reset all settings to default`})})]})})}function lt(e,t){let n=xe(!0);G(()=>{if(n.current){n.current=!1;return}return e()},t)}const ut=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],dt=[{label:`none`,value:`none`},{label:`single`,value:`single`},{label:`double`,value:`double`},{label:`round`,value:`round`},{label:`bold`,value:`bold`},{label:`singleDouble`,value:`singleDouble`},{label:`doubleSingle`,value:`doubleSingle`},{label:`classic`,value:`classic`},{label:`topBottomSingle`,value:`topBottomSingle`},{label:`topBottomDouble`,value:`topBottomDouble`},{label:`topBottomBold`,value:`topBottomBold`}];function ft({onBack:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(!1),[a,o]=K(!1),[s,c]=K(!1),[l,u]=K(()=>t.userMessageDisplay.format),[d,f]=K(()=>String(t.userMessageDisplay.paddingX)),[p,m]=K(()=>String(t.userMessageDisplay.paddingY)),[h,g]=K(t.userMessageDisplay.fitBoxToContent),[_,v]=K(0),[y,b]=K(()=>[...t.userMessageDisplay.styling]),[S,C]=K(()=>t.userMessageDisplay.foregroundColor===`default`?`default`:`custom`),[w,T]=K(()=>t.userMessageDisplay.foregroundColor===`default`?`rgb(255,255,255)`:t.userMessageDisplay.foregroundColor),[E,D]=K(()=>{let e=t.userMessageDisplay.backgroundColor;return e===null?`none`:e===`default`?`default`:`custom`}),[O,k]=K(()=>{let e=t.userMessageDisplay.backgroundColor;return e===null||e===`default`?`rgb(0,0,0)`:e}),[A,j]=K(()=>dt.findIndex(e=>e.value===t.userMessageDisplay.borderStyle)),[M,ee]=K(()=>t.userMessageDisplay.borderColor),[te,ne]=K(null),[re,ie]=K(``),N=oe(),P=t.themes?.find(e=>e.id===N)||t.themes?.[0],[F,ae]=K(`text`),I=[`format`,`styling`,`foreground`,`background`],se=[`borderStyle`,`borderColor`,`paddingX`,`paddingY`,`fitBoxToContent`],[ce,L]=K(0),[R,le]=K(0),z=F===`text`?I[ce]:se[R],ue=()=>{n(e=>{e.userMessageDisplay.format=l,e.userMessageDisplay.styling=[...y],e.userMessageDisplay.foregroundColor=S===`default`?`default`:w,e.userMessageDisplay.backgroundColor=E===`none`?null:E===`default`?`default`:O,e.userMessageDisplay.borderStyle=dt[A].value,e.userMessageDisplay.borderColor=M,e.userMessageDisplay.paddingX=parseInt(d)||0,e.userMessageDisplay.paddingY=parseInt(p)||0,e.userMessageDisplay.fitBoxToContent=h})},de=()=>{u(x.userMessageDisplay.format),b([...x.userMessageDisplay.styling]),C(`default`),T(`rgb(255,255,255)`),D(`none`),k(`rgb(0,0,0)`),j(dt.findIndex(e=>e.value===x.userMessageDisplay.borderStyle)),ee(x.userMessageDisplay.borderColor),f(String(x.userMessageDisplay.paddingX)),m(String(x.userMessageDisplay.paddingY)),g(x.userMessageDisplay.fitBoxToContent),n(e=>{e.userMessageDisplay={...x.userMessageDisplay}})};lt(()=>{ue()},[l,y,S,w,E,O,A,M,d,p,h]),H((n,l)=>{if(r){l.return?i(!1):l.escape?(u(t.userMessageDisplay.format),i(!1)):l.backspace||l.delete?u(e=>e.slice(0,-1)):n&&u(e=>e+n);return}if(a){l.return?o(!1):l.escape?(f(String(t.userMessageDisplay.paddingX)),o(!1)):l.backspace||l.delete?f(e=>e.slice(0,-1)):n&&/^\d$/.test(n)&&f(e=>e+n);return}if(s){l.return?c(!1):l.escape?(m(String(t.userMessageDisplay.paddingY)),c(!1)):l.backspace||l.delete?m(e=>e.slice(0,-1)):n&&/^\d$/.test(n)&&m(e=>e+n);return}if(te===null){if(l.escape)e();else if(l.ctrl&&n===`r`)de();else if(l.leftArrow||l.rightArrow)ae(e=>e===`text`?`border`:`text`);else if(l.tab)F===`text`?l.shift?L(e=>e===0?I.length-1:e-1):L(e=>e===I.length-1?0:e+1):l.shift?le(e=>e===0?se.length-1:e-1):le(e=>e===se.length-1?0:e+1);else if(l.return)z===`format`?i(!0):z===`paddingX`?o(!0):z===`paddingY`?c(!0):z===`foreground`?S===`custom`&&(ie(w),ne(`foreground`)):z===`background`?E===`custom`&&(ie(O),ne(`background`)):z===`borderColor`&&(ie(M),ne(`border`));else if(l.upArrow)z===`styling`?v(e=>Math.max(0,e-1)):z===`borderStyle`?j(e=>e===0?dt.length-1:e-1):z===`foreground`?C(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!w||w===``)&&T(`rgb(255,255,255)`),t}):z===`background`&&D(e=>{let t=e===`default`?`custom`:e===`custom`?`none`:`default`;return t===`custom`&&(!O||O===``)&&k(`rgb(0,0,0)`),t});else if(l.downArrow)z===`styling`?v(e=>Math.min(ut.length-1,e+1)):z===`borderStyle`?j(e=>e===dt.length-1?0:e+1):z===`foreground`?C(e=>{let t=e===`default`?`custom`:`default`;return t===`custom`&&(!w||w===``)&&T(`rgb(255,255,255)`),t}):z===`background`&&D(e=>{let t=e===`default`?`none`:e===`none`?`custom`:`default`;return t===`custom`&&(!O||O===``)&&k(`rgb(0,0,0)`),t});else if(n===` `)if(z===`styling`){let e=ut[_].value;b(y.indexOf(e)>=0?y.filter(t=>t!==e):[...y,e])}else z===`fitBoxToContent`&&g(e=>!e)}});let fe=e=>{let t=S===`default`?P?.colors?.text:w,n=E===`none`?void 0:E===`default`?P?.colors?.userMessageBackground:O,r=dt[A].value,i=parseInt(d)||0,a=parseInt(p)||0,o=J(V,{bold:y.includes(`bold`),italic:y.includes(`italic`),underline:y.includes(`underline`),strikethrough:y.includes(`strikethrough`),inverse:y.includes(`inverse`),color:t,backgroundColor:n,children:e});if(r===`topBottomSingle`||r===`topBottomDouble`||r===`topBottomBold`){let t=r===`topBottomSingle`?`─`:r===`topBottomDouble`?`═`:`━`,n=e.length+i*2,s=t.repeat(n);return Y(B,{flexDirection:`column`,children:[J(V,{color:M,children:s}),a>0&&J(B,{height:a}),J(B,{paddingX:i,children:o}),a>0&&J(B,{height:a}),J(V,{color:M,children:s})]})}else if(r!==`none`||i>0||a>0||h){let e=i>0||a>0?J(B,{paddingX:i,paddingY:a,children:o}):o,t={};return r!==`none`&&(t.borderStyle=r,t.borderColor=M),h?t.alignSelf=`flex-start`:t.flexGrow=1,r===`none`?e:J(B,{...t,children:e})}else return o};return te?J(Ke,{initialValue:re,theme:P,onColorChange:e=>{te===`foreground`?T(e):te===`background`?k(e):te===`border`&&ee(e)},onExit:()=>{ne(null),ie(``)}}):Y(B,{flexDirection:`column`,children:[J(X,{children:`Customize how user messages are displayed`}),Y(B,{flexDirection:`column`,marginBottom:1,children:[J(V,{dimColor:!0,children:`left/right arrows to switch columns · tab to navigate options`}),J(V,{dimColor:!0,children:`enter to edit · ctrl+r to reset · esc to go back`})]}),Y(B,{flexDirection:`row`,gap:1,children:[Y(B,{flexDirection:`column`,width:`50%`,borderStyle:F===`text`?`round`:`single`,borderColor:F===`text`?`yellow`:`gray`,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:F===`text`?`yellow`:void 0,children:`Text & Styling`})}),J(B,{children:Y(V,{color:z===`format`?`yellow`:void 0,bold:z===`format`,children:[z===`format`?`❯ `:` `,`Format String`]})}),z===`format`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:r?`enter to save · esc to cancel`:`enter to edit · use {} as message placeholder`})}),J(B,{marginLeft:2,marginBottom:1,children:J(B,{borderStyle:`round`,borderColor:r?`yellow`:`gray`,children:J(V,{children:l})})}),J(B,{children:Y(V,{color:z===`styling`?`yellow`:void 0,bold:z===`styling`,children:[z===`styling`?`❯ `:` `,`Styling`]})}),z===`styling`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`up/down to navigate · space to toggle`})}),J(B,{marginLeft:2,marginBottom:1,flexDirection:`column`,children:ut.map((e,t)=>J(B,{children:Y(V,{color:z===`styling`&&_===t?`cyan`:void 0,children:[z===`styling`&&_===t?`❯ `:` `,y.includes(e.value)?`●`:`○`,` `,e.label]})},e.value))}),Y(B,{flexDirection:`row`,gap:1,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(V,{color:z===`foreground`?`yellow`:void 0,bold:z===`foreground`,children:[z===`foreground`?`❯ `:` `,`Foreground`]})}),z===`foreground`&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`up/down · `,S===`custom`?`enter`:``]})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[S===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[S===`custom`?`● `:`○ `,`Custom`,S===`custom`&&`: `,S===`custom`&&J(V,{color:w,children:w})]})})]})]}),Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{children:Y(V,{color:z===`background`?`yellow`:void 0,bold:z===`background`,children:[z===`background`?`❯ `:` `,`Background`]})}),z===`background`&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`up/down · `,E===`custom`?`enter`:``]})}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{children:Y(V,{children:[E===`default`?`● `:`○ `,`Default`]})}),J(B,{children:Y(V,{children:[E===`none`?`● `:`○ `,`None`]})}),J(B,{children:Y(V,{children:[E===`custom`?`● `:`○ `,`Custom`,E===`custom`&&`: `,E===`custom`&&J(V,{backgroundColor:O,children:O})]})})]})]})]})]}),Y(B,{flexDirection:`column`,width:`50%`,borderStyle:F===`border`?`round`:`single`,borderColor:F===`border`?`yellow`:`gray`,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:F===`border`?`yellow`:void 0,children:`Border & Padding`})}),J(B,{children:Y(V,{color:z===`borderStyle`?`yellow`:void 0,bold:z===`borderStyle`,children:[z===`borderStyle`?`❯ `:` `,`Border Style`]})}),z===`borderStyle`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`up/down to navigate`})}),Y(B,{marginLeft:2,marginBottom:1,flexDirection:`row`,children:[J(B,{flexDirection:`column`,width:`50%`,children:dt.slice(0,6).map((e,t)=>J(B,{children:Y(V,{color:z===`borderStyle`&&A===t?`cyan`:void 0,children:[z===`borderStyle`&&A===t?`❯ `:` `,A===t?`● `:`○ `,e.label]})},e.value))}),J(B,{flexDirection:`column`,width:`50%`,children:dt.slice(6).map((e,t)=>{let n=t+6;return J(B,{children:Y(V,{color:z===`borderStyle`&&A===n?`cyan`:void 0,children:[z===`borderStyle`&&A===n?`❯ `:` `,A===n?`● `:`○ `,e.label]})},e.value)})})]}),J(B,{children:Y(V,{color:z===`borderColor`?`yellow`:void 0,bold:z===`borderColor`,children:[z===`borderColor`?`❯ `:` `,`Border Color`]})}),z===`borderColor`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`enter to pick color`})}),J(B,{marginLeft:2,marginBottom:1,children:J(V,{color:M,children:M})}),Y(B,{flexDirection:`row`,gap:1,children:[Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`paddingX`?`yellow`:void 0,bold:z===`paddingX`,children:[z===`paddingX`?`❯ `:` `,`Padding X`]})}),z===`paddingX`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:a?`enter/esc`:`enter`})}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:a?`yellow`:`gray`,children:J(V,{children:d})})})]}),Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`paddingY`?`yellow`:void 0,bold:z===`paddingY`,children:[z===`paddingY`?`❯ `:` `,`Padding Y`]})}),z===`paddingY`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:s?`enter/esc`:`enter`})}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:s?`yellow`:`gray`,children:J(V,{children:p})})})]}),Y(B,{flexDirection:`column`,width:`33%`,children:[J(B,{children:Y(V,{color:z===`fitBoxToContent`?`yellow`:void 0,bold:z===`fitBoxToContent`,children:[z===`fitBoxToContent`?`❯ `:` `,h?`●`:`○`,` Fit box to content`]})}),z===`fitBoxToContent`&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`space`})})]})]})]})]}),Y(B,{flexDirection:`column`,marginTop:1,paddingX:1,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Preview`})}),Y(B,{flexDirection:`row`,gap:2,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{marginBottom:1,children:J(V,{underline:!0,children:`Before (Claude Code default):`})}),J(B,{marginLeft:1,children:Y(V,{backgroundColor:P?.colors?.userMessageBackground,color:P?.colors?.text,children:[` `,`> list the dir`,` `]})}),J(B,{marginLeft:1,marginTop:1,children:Y(V,{children:[J(V,{color:P?.colors?.inactive||`#888888`,children:`●`}),J(V,{children:` The directory `}),J(V,{color:P?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(V,{children:` contains `}),J(V,{bold:!0,children:`123`}),J(V,{children:` files.`})]})})]}),Y(B,{flexDirection:`column`,width:`50%`,children:[J(B,{marginBottom:1,children:J(V,{underline:!0,children:`After (Your customization):`})}),J(B,{marginLeft:1,flexDirection:`row`,children:(()=>fe(l.replace(/\{\}/g,`list the dir`)))()}),J(B,{marginLeft:1,marginTop:1,children:Y(V,{children:[J(V,{color:P?.colors?.inactive||`#888888`,children:`●`}),J(V,{children:` The directory `}),J(V,{color:P?.colors?.permission||`#00ff00`,children:`C:\\Users\\user`}),J(V,{children:` contains `}),J(V,{bold:!0,children:`123`}),J(V,{children:` files.`})]})})]})]})]})]})}const pt=[{label:`bold`,value:`bold`},{label:`italic`,value:`italic`},{label:`underline`,value:`underline`},{label:`strikethrough`,value:`strikethrough`},{label:`inverse`,value:`inverse`}],mt=[[`name`,`regex`,`regexFlags`],[`format`,`styling`],[`foreground`,`background`],[`enabled`],[`testText`]];function ht({testText:e,regex:t,regexFlags:n,format:r,styling:i,foregroundColor:a,backgroundColor:o}){let s=[];try{let c=n.includes(`g`)?n:n+`g`,l=new RegExp(t,c),u=[...e.matchAll(l)];if(u.length===0)return J(V,{children:e});let d=0;return u.forEach((t,n)=>{let c=t.index,l=c+t[0].length;c>d&&s.push(J(V,{children:e.slice(d,c)},`plain-${n}`));let u=r.replace(/\{MATCH\}/g,t[0]);s.push(J(V,{bold:i.includes(`bold`),italic:i.includes(`italic`),underline:i.includes(`underline`),strikethrough:i.includes(`strikethrough`),inverse:i.includes(`inverse`),color:a,backgroundColor:o,children:u},`match-${n}`)),d=l}),d<e.length&&s.push(J(V,{children:e.slice(d)},`plain-end`)),J(q,{children:s})}catch{return J(V,{children:e})}}function gt({highlighterIndex:e,onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.inputPatternHighlighters[e],a=oe(),o=n.themes?.find(e=>e.id===a)||n.themes?.[0],[s,c]=K(i?.name||`New Highlighter`),[l,u]=K(i?.regex||``),[d,f]=K(i?.regexFlags||`g`),[p,m]=K(i?.format||`{MATCH}`),[h,g]=K(i?.styling||[]),[_,v]=K(i?.foregroundColor===null?`none`:`custom`),[y,b]=K(i?.foregroundColor||`rgb(255,0,255)`),[x,S]=K(i?.backgroundColor?`custom`:`none`),[C,w]=K(i?.backgroundColor||`rgb(0,0,0)`),[T,E]=K(i?.enabled??!0),[D,O]=K(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),[k,A]=K(`name`),[j,M]=K(!1),[ee,te]=K(0),[ne,re]=K(null),[ie,N]=K(``),[P,F]=K(null),[ae,I]=K(0),[se,ce]=K(0);if(G(()=>{let e=mt[ae];A(e[Math.min(se,e.length-1)])},[ae,se]),G(()=>{if(!l){F(null);return}try{new RegExp(l,d),F(null)}catch(e){F(e.message)}},[l,d]),G(()=>{e>=0&&r(t=>{t.inputPatternHighlighters[e]&&(t.inputPatternHighlighters[e]={name:s,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:null,backgroundColor:x===`custom`?C:null,enabled:T})})},[e,s,l,d,p,h,_,y,x,C,T]),G(()=>{r(e=>{e.inputPatternHighlightersTestText=D})},[D]),H((e,r)=>{if(j){r.return?M(!1):r.escape?(k===`name`&&c(i?.name||``),k===`regex`&&u(i?.regex||``),k===`regexFlags`&&f(i?.regexFlags||`g`),k===`format`&&m(i?.format||`{MATCH}`),k===`testText`&&O(n.inputPatternHighlightersTestText||`Type test text here to see highlighting`),M(!1)):r.backspace||r.delete?(k===`name`&&c(e=>e.slice(0,-1)),k===`regex`&&u(e=>e.slice(0,-1)),k===`regexFlags`&&f(e=>e.slice(0,-1)),k===`format`&&m(e=>e.slice(0,-1)),k===`testText`&&O(e=>e.slice(0,-1))):e&&e.length===1&&(k===`name`&&c(t=>t+e),k===`regex`&&u(t=>t+e),k===`regexFlags`&&f(t=>t+e),k===`format`&&m(t=>t+e),k===`testText`&&O(t=>t+e));return}if(ne===null){if(r.escape)t();else if(r.upArrow)k===`styling`&&ee>0?te(e=>e-1):I(e=>Math.max(0,e-1));else if(r.downArrow)k===`styling`&&ee<pt.length-1?te(e=>e+1):I(e=>Math.min(mt.length-1,e+1));else if(r.leftArrow)k===`foreground`?v(e=>e===`none`?`custom`:`none`):k===`background`?S(e=>e===`none`?`custom`:`none`):ce(e=>Math.max(0,e-1));else if(r.rightArrow)if(k===`foreground`)v(e=>e===`none`?`custom`:`none`);else if(k===`background`)S(e=>e===`none`?`custom`:`none`);else{let e=mt[ae].length-1;ce(t=>Math.min(e,t+1))}else if(r.tab){let e=mt.flat(),t=e.indexOf(k);if(r.shift){if(t>0){let n=e[t-1];for(let e=0;e<mt.length;e++){let t=mt[e].indexOf(n);if(t>=0){I(e),ce(t);break}}}}else if(t<e.length-1){let n=e[t+1];for(let e=0;e<mt.length;e++){let t=mt[e].indexOf(n);if(t>=0){I(e),ce(t);break}}}}else if(r.return)k===`name`||k===`regex`||k===`regexFlags`||k===`format`||k===`testText`?M(!0):k===`foreground`&&_===`custom`?(N(y),re(`foreground`)):k===`background`&&x===`custom`&&(N(C),re(`background`));else if(e===` `)if(k===`styling`){let e=pt[ee].value;h.includes(e)?g(h.filter(t=>t!==e)):g([...h,e])}else k===`enabled`&&E(!T)}}),!i)return J(B,{flexDirection:`column`,children:J(V,{color:`red`,children:`Highlighter not found`})});if(ne)return J(Ke,{initialValue:ie,theme:o,onColorChange:e=>{ne===`foreground`?b(e):ne===`background`&&w(e)},onExit:()=>{re(null),N(``)}});let L=e=>k===e,R=e=>({color:L(e)?`yellow`:void 0,bold:L(e)});return Y(B,{flexDirection:`column`,children:[J(X,{children:`Edit Highlighter`}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`arrows to navigate · enter to edit · space to toggle · esc to go back`})}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`30%`,children:[Y(V,{...R(`name`),children:[L(`name`)?`❯ `:` `,`Name`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`name`)?j?`green`:`yellow`:`gray`,children:J(V,{children:s||`(empty)`})})})]}),Y(B,{flexDirection:`column`,width:`45%`,children:[Y(V,{...R(`regex`),children:[L(`regex`)?`❯ `:` `,`Regex Pattern`]}),Y(B,{marginLeft:2,flexDirection:`column`,children:[J(B,{borderStyle:`round`,borderColor:L(`regex`)?j?`green`:`yellow`:P?`red`:`gray`,children:J(V,{children:l||`(empty)`})}),P&&J(V,{color:`red`,children:P})]})]}),Y(B,{flexDirection:`column`,width:`20%`,children:[Y(V,{...R(`regexFlags`),children:[L(`regexFlags`)?`❯ `:` `,`Flags`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`regexFlags`)?j?`green`:`yellow`:`gray`,children:J(V,{children:d||`g`})})})]})]}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`50%`,children:[Y(V,{...R(`format`),children:[L(`format`)?`❯ `:` `,`Format String`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`format`)?j?`green`:`yellow`:`gray`,children:J(V,{children:p||`{MATCH}`})})}),L(`format`)&&J(B,{marginLeft:2,children:Y(V,{dimColor:!0,children:[`use `,`{MATCH}`,` as placeholder`]})})]}),Y(B,{flexDirection:`column`,width:`45%`,children:[Y(V,{...R(`styling`),children:[L(`styling`)?`❯ `:` `,`Styling`]}),J(B,{marginLeft:2,flexDirection:`column`,children:pt.map((e,t)=>{let n=h.includes(e.value),r=L(`styling`)&&ee===t;return Y(V,{color:r?`cyan`:void 0,children:[r?`❯ `:` `,n?`●`:`○`,` `,e.label]},e.value)})})]})]}),Y(B,{flexDirection:`row`,gap:2,marginBottom:1,children:[Y(B,{flexDirection:`column`,width:`48%`,children:[Y(V,{...R(`foreground`),children:[L(`foreground`)?`❯ `:` `,`Foreground Color`]}),Y(B,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(V,{color:L(`foreground`)?`yellow`:void 0,children:[`[`,_===`none`?`●`:`○`,`] none`,` `,`[`,_===`custom`?`●`:`○`,`] custom`]}),_===`custom`&&J(B,{borderStyle:`round`,borderColor:L(`foreground`)?`yellow`:`gray`,children:J(V,{color:y,children:` ████ `})})]})]}),Y(B,{flexDirection:`column`,width:`48%`,children:[Y(V,{...R(`background`),children:[L(`background`)?`❯ `:` `,`Background Color`]}),Y(B,{marginLeft:2,flexDirection:`row`,gap:1,children:[Y(V,{color:L(`background`)?`yellow`:void 0,children:[`[`,x===`none`?`●`:`○`,`] none`,` `,`[`,x===`custom`?`●`:`○`,`] custom`]}),x===`custom`&&J(B,{borderStyle:`round`,borderColor:L(`background`)?`yellow`:`gray`,children:Y(V,{backgroundColor:C,children:[` `,` `,` `]})})]})]})]}),J(B,{marginBottom:1,children:Y(V,{...R(`enabled`),children:[L(`enabled`)?`❯ `:` `,`Enabled:`,` `,J(V,{color:T?`green`:`red`,children:T?`● Yes`:`○ No`})]})}),Y(B,{flexDirection:`column`,marginBottom:1,children:[Y(V,{...R(`testText`),children:[L(`testText`)?`❯ `:` `,`Test Text`]}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:L(`testText`)?j?`green`:`yellow`:`gray`,children:J(V,{children:D||`(empty)`})})})]}),J(B,{borderStyle:`round`,padding:1,children:Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Live Preview:`}),l?J(B,{marginTop:1,children:J(ht,{testText:D,regex:l,regexFlags:d,format:p,styling:h,foregroundColor:_===`custom`?y:void 0,backgroundColor:x===`custom`?C:void 0})}):J(V,{dimColor:!0,children:`Enter a regex pattern to see the preview`})]})})]})}function _t({onBack:e}){let{settings:{inputPatternHighlighters:t,themes:n},updateSettings:r}=W($),i=oe(),a=n.find(e=>e.id===i)||n[0],o=x.themes[0],s=a?.colors.success||o.colors.success,c=a?.colors.error||o.colors.error,[l,u]=K(0),[d,f]=K(null),[p,m]=K(!0),h=()=>{let e={name:`New Highlighter`,regex:``,regexFlags:`g`,format:`{MATCH}`,styling:[],foregroundColor:`rgb(255,0,255)`,backgroundColor:null,enabled:!0};r(t=>{t.inputPatternHighlighters.push(e)}),f(t.length),m(!1)},g=e=>{r(t=>{t.inputPatternHighlighters.splice(e,1)}),l>=t.length-1&&u(Math.max(0,t.length-2))},_=e=>{r(t=>{t.inputPatternHighlighters[e].enabled=!t.inputPatternHighlighters[e].enabled})},v=e=>{e<=0||(r(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e-1,0,n)}),u(e-1))},y=e=>{e>=t.length-1||(r(t=>{let n=t.inputPatternHighlighters[e];t.inputPatternHighlighters.splice(e,1),t.inputPatternHighlighters.splice(e+1,0,n)}),u(e+1))};return H((n,r)=>{r.escape?e():r.upArrow?u(e=>Math.max(0,e-1)):r.downArrow&&t.length>0?u(e=>Math.min(t.length-1,e+1)):r.return&&t.length>0?(f(l),m(!1)):n===`n`?h():n===`x`&&t.length>0?g(l):n===` `&&t.length>0?_(l):n===`u`&&t.length>0&&l>0?v(l):n===`d`&&t.length>0&&l<t.length-1&&y(l)},{isActive:p}),d===null?Y(B,{flexDirection:`column`,children:[J(X,{children:`Input Pattern Highlighters`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`Create custom highlighters for patterns in your input prompt.`}),J(V,{dimColor:!0,children:`Matched text will be styled and optionally reformatted.`})]}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new highlighter`}),t.length>0&&J(V,{dimColor:!0,children:`space to toggle enabled/disabled`}),t.length>0&&J(V,{dimColor:!0,children:`u/d to move highlighter up/down`}),t.length>0&&J(V,{dimColor:!0,children:`x to delete a highlighter`}),t.length>0&&J(V,{dimColor:!0,children:`enter to edit highlighter`}),J(V,{dimColor:!0,children:`esc to go back`})]}),t.length===0?J(V,{children:`No highlighters created yet. Press n to create one.`}):J(B,{flexDirection:`column`,children:t.map((e,t)=>{let n=l===t,r;return n&&(r=`yellow`),Y(B,{flexDirection:`row`,children:[Y(V,{color:r,children:[n?`❯ `:` `,e.enabled?`● `:`○ `,e.name,` `]}),J(V,{dimColor:!0,children:`(`}),e.regex?Y(V,{dimColor:!0,children:[`/`,e.regex,`/`,e.regexFlags]}):J(V,{dimColor:!0,children:`(no regex)`}),e.styling.length>0&&J(q,{children:Y(V,{color:r,dimColor:!e.enabled,children:[` `,`· `,e.styling.join(`, `)]})}),J(V,{dimColor:!0,children:`)`}),e.enabled?J(V,{color:s,children:` enabled`}):J(V,{color:c,children:` disabled`})]},t)})})]}):J(gt,{highlighterIndex:d,onBack:()=>{f(null),m(!0)}})}const vt=[null,1,5,10,25,50,100,200,250,500,1e3],yt=1e3;function bt({onSubmit:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(0),[a,o]=K(!1),s={showTweakccVersion:!0,showPatchesApplied:!0,expandThinkingBlocks:!0,enableConversationTitle:!0,hideStartupBanner:!1,hideCtrlGToEdit:!1,hideStartupClawd:!1,increaseFileReadLimit:!1,suppressLineNumbers:!1,suppressRateLimitOptions:!1,mcpConnectionNonBlocking:!0,mcpServerBatchSize:null,statuslineThrottleMs:null,statuslineUseFixedInterval:!1,tableFormat:`default`,enableSwarmMode:!0,enableSessionMemory:!0,enableRememberSkill:!1,tokenCountRounding:null,autoAcceptPlanMode:!1,allowBypassPermissionsInSudo:!1,suppressNativeInstallerWarning:!1,filterScrollEscapeSequences:!1,enableWorktreeMode:!0,allowCustomAgentModels:!1,enableContextLimitOverride:!1,enableModelCustomizations:!0,enableVoiceMode:!1,enableVoiceConciseOutput:!0,enableChannelsMode:!1},c=()=>{t.misc||={...s}},l=e=>{let t=[`default`,`ascii`,`clean`,`clean-top-bottom`];return t[(t.indexOf(e)+1)%t.length]},u=e=>{switch(e){case`ascii`:return`ASCII (| and -)`;case`clean`:return`Clean (no row separators)`;case`clean-top-bottom`:return`Clean with top/bottom`;case`default`:default:return`Default (box-drawing)`}},d=e=>e===null?`Default (3)`:e<=3?`${e} (conservative)`:e<=8?`${e} (recommended)`:`${e} (aggressive)`,f=e=>e===null?`Disabled`:e===0?`0ms (instant)`:`${e}ms`,p=e=>e===null?`Off (exact counts)`:`Round to ${e}`,m=(e,t)=>{let n=vt.indexOf(e);if(n===-1)return vt[0];let r;return r=t===`next`?(n+1)%vt.length:(n-1+vt.length)%vt.length,vt[r]},h=be(()=>[{id:`removeBorder`,title:`Remove input box border`,description:`Removes the rounded border around the input box for a cleaner look.`,getValue:()=>t.inputBox?.removeBorder??!1,toggle:()=>{n(e=>{e.inputBox||={removeBorder:!1},e.inputBox.removeBorder=!e.inputBox.removeBorder})}},{id:`showVersion`,title:`Show tweakcc version at startup`,description:`Shows the blue "+ tweakcc v<VERSION>" message when starting Claude Code.`,getValue:()=>t.misc?.showTweakccVersion??!0,toggle:()=>{n(e=>{c(),e.misc.showTweakccVersion=!e.misc.showTweakccVersion})}},{id:`showPatches`,title:`Show patches applied indicator at startup`,description:`Shows the green "tweakcc patches are applied" indicator when starting Claude Code.`,getValue:()=>t.misc?.showPatchesApplied??!0,toggle:()=>{n(e=>{c(),e.misc.showPatchesApplied=!e.misc.showPatchesApplied})}},{id:`expandThinking`,title:`Expand thinking blocks`,description:`Makes thinking blocks always expanded by default instead of collapsed.`,getValue:()=>t.misc?.expandThinkingBlocks??!0,toggle:()=>{n(e=>{c(),e.misc.expandThinkingBlocks=!e.misc.expandThinkingBlocks})}},{id:`conversationTitle`,title:`Allow renaming sessions via /title`,description:`Enables /title and /rename commands for manually naming conversations.`,getValue:()=>t.misc?.enableConversationTitle??!0,toggle:()=>{n(e=>{c(),e.misc.enableConversationTitle=!e.misc.enableConversationTitle})}},{id:`enableModelCustomizations`,title:`Enable model customizations (/model shows all models)`,description:`Show all Claude models in /model menu, not just the latest 3. Disable to use Claude Code default model list.`,getValue:()=>t.misc?.enableModelCustomizations??!0,toggle:()=>{n(e=>{c(),e.misc.enableModelCustomizations=!e.misc.enableModelCustomizations})}},{id:`hideStartupBanner`,title:`Hide startup banner`,description:`Hides the startup banner message displayed before first prompt.`,getValue:()=>t.misc?.hideStartupBanner??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupBanner=!e.misc.hideStartupBanner})}},{id:`hideCtrlG`,title:`Hide ctrl-g to edit prompt hint`,description:`Hides the "ctrl-g to edit prompt" hint shown during streaming.`,getValue:()=>t.misc?.hideCtrlGToEdit??!1,toggle:()=>{n(e=>{c(),e.misc.hideCtrlGToEdit=!e.misc.hideCtrlGToEdit})}},{id:`hideClawd`,title:`Hide startup Clawd ASCII art`,description:`Hides the Clawd ASCII art character shown at startup.`,getValue:()=>t.misc?.hideStartupClawd??!1,toggle:()=>{n(e=>{c(),e.misc.hideStartupClawd=!e.misc.hideStartupClawd})}},{id:`increaseFileReadLimit`,title:`Increase file read token limit`,description:`Increases the maximum file read limit from 25,000 to 1,000,000 tokens.`,getValue:()=>t.misc?.increaseFileReadLimit??!1,toggle:()=>{n(e=>{c(),e.misc.increaseFileReadLimit=!e.misc.increaseFileReadLimit})}},{id:`suppressLineNumbers`,title:`Suppress line numbers in file reads/edits`,description:`Removes line number prefixes from file content to reduce token usage.`,getValue:()=>t.misc?.suppressLineNumbers??!1,toggle:()=>{n(e=>{c(),e.misc.suppressLineNumbers=!e.misc.suppressLineNumbers})}},{id:`suppressRateLimitOptions`,title:`Suppress rate limit options popup`,description:`Prevents the automatic /rate-limit-options command from being triggered when hitting rate limits.`,getValue:()=>t.misc?.suppressRateLimitOptions??!1,toggle:()=>{n(e=>{c(),e.misc.suppressRateLimitOptions=!e.misc.suppressRateLimitOptions})}},{id:`mcpNonBlocking`,title:`Non-blocking MCP startup`,description:`Start immediately while MCP servers connect in background. Reduces startup time ~50% with multiple MCPs.`,getValue:()=>t.misc?.mcpConnectionNonBlocking??!0,toggle:()=>{n(e=>{c(),e.misc.mcpConnectionNonBlocking=!e.misc.mcpConnectionNonBlocking})}},{id:`mcpBatchSize`,title:`MCP server batch size`,description:`Parallel MCP connections (1-20). Use ←/→ to adjust. Higher = faster startup, more resources.`,getValue:()=>t.misc?.mcpServerBatchSize??null,getDisplayValue:()=>d(t.misc?.mcpServerBatchSize??null),toggle:()=>{n(e=>{c(),e.misc.mcpServerBatchSize=null})},increment:()=>{n(e=>{c();let t=e.misc.mcpServerBatchSize??3;e.misc.mcpServerBatchSize=Math.min(20,t+1)})},decrement:()=>{n(e=>{c();let t=(e.misc.mcpServerBatchSize??3)-1;e.misc.mcpServerBatchSize=t<1?null:t})}},{id:`tableFormat`,title:`Table output format`,description:`Controls how Claude formats tables. Default: full borders. ASCII: | and -. Clean: no top/bottom/row separators. Clean+top/bottom: borders but no row separators.`,getValue:()=>t.misc?.tableFormat??`default`,isMultiValue:!0,getDisplayValue:()=>u(t.misc?.tableFormat??`default`),toggle:()=>{n(e=>{c(),e.misc.tableFormat=l(e.misc.tableFormat??`default`)})}},{id:`enableWorktreeMode`,title:`Enable worktree mode (EnterWorktree tool)`,description:`Force-enable the EnterWorktree tool for isolated git worktree sessions by bypassing the tengu_worktree_mode feature flag.`,getValue:()=>t.misc?.enableWorktreeMode??!0,toggle:()=>{n(e=>{c(),e.misc.enableWorktreeMode=!e.misc.enableWorktreeMode})}},{id:`enableVoiceMode`,title:`Enable voice mode (/voice command)`,description:`Force-enable the /voice command by bypassing the tengu_amber_quartz feature gate.`,getValue:()=>t.misc?.enableVoiceMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableVoiceMode=!e.misc.enableVoiceMode})}},{id:`enableVoiceConciseOutput`,title:`Enable concise output for voice mode`,description:`Enable the concise-output prompt used for voice interactions. Only applies when voice mode is enabled.`,getValue:()=>t.misc?.enableVoiceConciseOutput??!0,toggle:()=>{n(e=>{c(),e.misc.enableVoiceConciseOutput=!e.misc.enableVoiceConciseOutput})}},{id:`enableChannelsMode`,title:`Enable channels mode (MCP channel notifications)`,description:`Force-enable MCP channel notifications by bypassing the tengu_harbor feature gate, allowlist, and permission relay.`,getValue:()=>t.misc?.enableChannelsMode??!1,toggle:()=>{n(e=>{c(),e.misc.enableChannelsMode=!e.misc.enableChannelsMode})}},{id:`enableContextLimitOverride`,title:`Override context limit`,description:`Replaces the default model context limit with CLAUDE_CODE_CONTEXT_LIMIT env var. Must be exported manually before launching CC, or falls back to 200K.`,getValue:()=>t.misc?.enableContextLimitOverride??!1,toggle:()=>{n(e=>{c(),e.misc.enableContextLimitOverride=!e.misc.enableContextLimitOverride})}},{id:`statuslineThrottle`,title:`Statusline throttle`,description:`Throttle statusline updates (0-${yt}ms). Use ←/→ to adjust by 50ms. Space to disable. 0 = instant updates.`,getValue:()=>t.misc?.statuslineThrottleMs??null,getDisplayValue:()=>f(t.misc?.statuslineThrottleMs??null),toggle:()=>{n(e=>{c(),e.misc.statuslineThrottleMs=e.misc.statuslineThrottleMs===null?300:null})},increment:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.min(yt,t+50)})},decrement:()=>{n(e=>{c();let t=e.misc.statuslineThrottleMs??300;e.misc.statuslineThrottleMs=Math.max(0,t-50)})}},{id:`statuslineFixedInterval`,title:`Statusline fixed interval mode`,description:`Use setInterval instead of throttle. Updates happen on a fixed schedule rather than on-demand.`,getValue:()=>t.misc?.statuslineUseFixedInterval??!1,toggle:()=>{n(e=>{c(),e.misc.statuslineUseFixedInterval=!e.misc.statuslineUseFixedInterval})}},{id:`enableSessionMemory`,title:`Enable session memory`,description:`Force-enable session memory (auto-extraction + past session search) by bypassing the tengu_session_memory and tengu_coral_fern statsig flags.`,getValue:()=>t.misc?.enableSessionMemory??!0,toggle:()=>{n(e=>{c(),e.misc.enableSessionMemory=!e.misc.enableSessionMemory})}},{id:`enableRememberSkill`,title:`Enable remember skill`,description:`Register a "remember" skill to review session memories and update CLAUDE.local.md with learnings from past sessions.`,getValue:()=>t.misc?.enableRememberSkill??!1,toggle:()=>{n(e=>{c(),e.misc.enableRememberSkill=!e.misc.enableRememberSkill})}},{id:`tokenCountRounding`,title:`Token count rounding`,description:`Round displayed token counts to nearest multiple. Use ←/→ to cycle: Off, 1, 5, 10, 25, 50, 100, 200, 250, 500, 1000.`,getValue:()=>t.misc?.tokenCountRounding??null,getDisplayValue:()=>p(t.misc?.tokenCountRounding??null),toggle:()=>{n(e=>{c(),e.misc.tokenCountRounding=null})},increment:()=>{n(e=>{c(),e.misc.tokenCountRounding=m(e.misc.tokenCountRounding??null,`next`)})},decrement:()=>{n(e=>{c(),e.misc.tokenCountRounding=m(e.misc.tokenCountRounding??null,`prev`)})}},{id:`autoAcceptPlanMode`,title:`Auto-accept plan mode`,description:`Automatically accept plans without the "Ready to code?" confirmation prompt.`,getValue:()=>t.misc?.autoAcceptPlanMode??!1,toggle:()=>{n(e=>{c(),e.misc.autoAcceptPlanMode=!e.misc.autoAcceptPlanMode})}},{id:`allowBypassPermissionsInSudo`,title:`Allow bypassing permissions in sudo`,description:`⚠️ WARNING: Disables a security check. When enabled, Claude can perform system-level operations without prompts. Use extreme caution.`,getValue:()=>t.misc?.allowBypassPermissionsInSudo??!1,toggle:()=>{t.misc?.allowBypassPermissionsInSudo??!1?n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!1}):o(!0)}},{id:`suppressNativeInstallerWarning`,title:`Suppress native installer warning`,description:`Suppress the native installer warning message at startup.`,getValue:()=>t.misc?.suppressNativeInstallerWarning??!1,toggle:()=>{n(e=>{c(),e.misc.suppressNativeInstallerWarning=!e.misc.suppressNativeInstallerWarning})}},{id:`filterScrollEscapeSequences`,title:`Filter scroll escape sequences`,description:`Filter out terminal escape sequences that cause unwanted scrolling.`,getValue:()=>t.misc?.filterScrollEscapeSequences??!1,toggle:()=>{n(e=>{c(),e.misc.filterScrollEscapeSequences=!e.misc.filterScrollEscapeSequences})}},{id:`allowCustomAgentModels`,title:`Allow custom agent models`,description:`Allow arbitrary model names in custom agent frontmatter (e.g. gemini-2.5-flash). Useful with a local proxy for non-Claude models.`,getValue:()=>t.misc?.allowCustomAgentModels??!1,toggle:()=>{n(e=>{c(),e.misc.allowCustomAgentModels=!e.misc.allowCustomAgentModels})}}],[t,n]),g=h.length,_=g-1,v=be(()=>r<4?0:Math.min(r-4+1,g-4),[r,g]),y=h.slice(v,v+4),b=v>0,x=v+4<g;return H((t,s)=>{a?s.return?(n(e=>{c(),e.misc.allowBypassPermissionsInSudo=!0}),o(!1)):s.escape&&o(!1):s.return||s.escape?e():s.upArrow?i(e=>Math.max(0,e-1)):s.downArrow?i(e=>Math.min(_,e+1)):t===` `?h[r]?.toggle():s.rightArrow?h[r]?.increment?.():s.leftArrow&&h[r]?.decrement?.()}),J(B,{flexDirection:`column`,children:a?J(B,{flexDirection:`column`,paddingX:2,children:Y(B,{borderStyle:`double`,borderColor:`yellow`,padding:2,flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(V,{bold:!0,color:`yellow`,children:`SECURITY WARNING`})}),J(B,{marginBottom:1,children:J(V,{children:`You are about to enable a feature that allows Claude Code to bypass permission checks when running with sudo privileges.`})}),J(B,{marginBottom:1,children:J(V,{color:`red`,children:`This means Claude can perform system-level operations without any prompts or confirmation.`})}),J(B,{marginBottom:1,children:J(V,{bold:!0,children:`Use with extreme caution.`})}),J(B,{children:Y(V,{children:[`Press `,J(V,{color:`red`,children:`Enter`}),` to enable,`,` `,J(V,{color:`green`,children:`Escape`}),` to cancel`]})})]})}):Y(q,{children:[J(B,{marginBottom:1,children:J(X,{children:`Miscellaneous Settings`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Use ↑/↓ to navigate, space to toggle, ←/→ to adjust numbers, enter to go back.`})}),b&&J(B,{children:Y(V,{dimColor:!0,children:[` ↑ `,v,` more above`]})}),y.map((e,t)=>{let n=v+t===r,i=e.getValue(),a=!!e.getDisplayValue,o=!!e.increment,s;s=o?`◆`:a?`◉`:i?`☑`:`☐`;let c;c=a?e.getDisplayValue():typeof i==`boolean`?i?`Enabled`:`Disabled`:String(i??`Default`);let l=n&&o?` ← → `:``;return Y(B,{flexDirection:`column`,children:[J(B,{children:Y(V,{children:[J(V,{color:n?`cyan`:void 0,children:n?`❯ `:` `}),J(V,{bold:!0,color:n?`cyan`:void 0,children:e.title})]})}),J(B,{children:Y(V,{dimColor:!0,children:[` `,e.description]})}),J(B,{marginLeft:4,marginBottom:1,children:Y(V,{children:[s,` `,c,J(V,{dimColor:!0,children:l})]})})]},e.id)}),x&&J(B,{children:Y(V,{dimColor:!0,children:[` `,`↓ `,g-v-4,` more below`]})}),J(B,{marginTop:1,children:Y(V,{dimColor:!0,children:[`Item `,r+1,` of `,g]})})]})})}const xt=`AgentOutputTool.AskUserQuestion.Bash.BashOutputTool.Edit.EnterPlanMode.ExitPlanMode.Glob.Grep.KillShell.ListMcpResourcesTool.LSP.NotebookEdit.Read.ReadMcpResourceTool.Skill.Task.TaskCreate.TaskGet.TaskList.TaskOutput.TaskStop.TaskUpdate.Teammate.TodoWrite.ToolSearch.WebFetch.WebSearch.Write`.split(`.`);function St({toolsetIndex:e,onBack:t}){let{settings:n,updateSettings:r}=W($),i=n.toolsets[e],[a,o]=K(i?.name||`New Toolset`),[s,c]=K(i?.allowedTools||[]),[l,u]=K(!1),[d,f]=K(0);G(()=>{i&&r(t=>{let n=t.toolsets[e].name;t.toolsets[e].name=a,t.toolsets[e].allowedTools=s,n!==a&&(t.defaultToolset===n&&(t.defaultToolset=a),t.planModeToolset===n&&(t.planModeToolset=a))})},[a,s]);let p=e=>s===`*`?!0:s.includes(e),m=e=>{e===`All`?c(`*`):e===`None`?c([]):s===`*`?c(xt.filter(t=>t!==e)):s.includes(e)?c(s.filter(t=>t!==e)):c([...s,e])};if(H((e,n)=>{if(l){n.return?u(!1):n.escape?(o(i?.name||`New Toolset`),u(!1)):n.backspace||n.delete?o(e=>e.slice(0,-1)):e&&e.length===1&&o(t=>t+e);return}if(n.escape)t();else if(n.upArrow)f(e=>Math.max(0,e-1));else if(n.downArrow)f(e=>Math.min(xt.length+1,e+1));else if(e===` `||n.return)if(d===0)m(`All`);else if(d===1)m(`None`);else{let e=xt[d-2];e&&m(e)}else e===`n`&&u(!0)}),!i)return J(B,{flexDirection:`column`,children:J(V,{color:`red`,children:`Toolset not found`})});let h=s===`*`,g=Array.isArray(s)&&s.length===0;return Y(B,{flexDirection:`column`,children:[J(X,{children:`Edit Toolset`}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`n to edit name · space/enter to toggle · esc to go back`})}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{bold:!0,children:`Name:`}),J(B,{marginLeft:2,children:J(B,{borderStyle:`round`,borderColor:l?`yellow`:`gray`,children:J(V,{children:a})})}),l&&J(B,{marginLeft:2,children:J(V,{dimColor:!0,children:`enter to save · esc to cancel`})})]}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{bold:!0,children:`Allowed Tools:`}),J(B,{marginLeft:2,children:Y(V,{color:d===0?`cyan`:void 0,children:[d===0?`❯ `:` `,h?`●`:`○`,` All`]})}),J(B,{marginLeft:2,children:Y(V,{color:d===1?`cyan`:void 0,children:[d===1?`❯ `:` `,g?`●`:`○`,` None`]})}),xt.map((e,t)=>{let n=t+2;return J(B,{marginLeft:2,children:Y(V,{color:d===n?`cyan`:void 0,children:[d===n?`❯ `:` `,p(e)?`◉`:`○`,` `,e]})},e)})]}),J(B,{borderStyle:`round`,padding:1,marginTop:1,children:Y(B,{flexDirection:`column`,children:[J(V,{bold:!0,children:`Summary:`}),Y(V,{children:[`Name: `,J(V,{color:`cyan`,children:a})]}),Y(V,{children:[`Tools:`,` `,s===`*`?J(V,{color:`green`,children:`All tools (*)`}):s.length===0?J(V,{color:`red`,children:`No tools ([])`}):Y(V,{color:`yellow`,children:[s.length,` selected`]})]})]})})]})}function Ct({onBack:e}){let{settings:{toolsets:t,defaultToolset:n,planModeToolset:r,themes:i},updateSettings:a}=W($),o=oe(),s=i.find(e=>e.id===o)||i[0],c=x.themes[0],l=s?.colors.planMode||c.colors.planMode,u=s?.colors.autoAccept||c.colors.autoAccept,[d,f]=K(0),[p,m]=K(null),[h,g]=K(!0),_=()=>{let e={name:`New Toolset`,allowedTools:[]};a(t=>{t.toolsets.push(e)}),m(t.length),g(!1)},v=e=>{let n=t[e];a(t=>{t.toolsets.splice(e,1),t.defaultToolset===n.name&&(t.defaultToolset=null),t.planModeToolset===n.name&&(t.planModeToolset=null)}),d>=t.length-1&&f(Math.max(0,t.length-2))},y=e=>{let n=t[e];a(e=>{e.defaultToolset=n.name})},b=e=>{let n=t[e];a(e=>{e.planModeToolset=n.name})};if(H((n,r)=>{r.escape?e():r.upArrow?f(e=>Math.max(0,e-1)):r.downArrow?f(e=>Math.min(t.length-1,e+1)):r.return&&t.length>0?(m(d),g(!1)):n===`n`?_():n===`x`&&t.length>0?v(d):n===`d`&&t.length>0?y(d):n===`p`&&t.length>0&&b(d)},{isActive:h}),p!==null)return J(St,{toolsetIndex:p,onBack:()=>{m(null),g(!0)}});let S=e=>e.allowedTools===`*`?`All tools`:e.allowedTools.length===0?`No tools`:`${e.allowedTools.length} tool${e.allowedTools.length===1?``:`s`}`;return Y(B,{flexDirection:`column`,children:[J(X,{children:`Toolsets`}),Y(B,{marginBottom:1,flexDirection:`column`,children:[J(V,{dimColor:!0,children:`n to create a new toolset`}),t.length>0&&J(V,{dimColor:!0,children:`d to set as default toolset`}),t.length>0&&J(V,{dimColor:!0,children:`p to set as plan mode toolset`}),t.length>0&&J(V,{dimColor:!0,children:`x to delete a toolset`}),t.length>0&&J(V,{dimColor:!0,children:`enter to edit toolset`}),J(V,{dimColor:!0,children:`esc to go back`})]}),t.length===0?J(V,{children:`No toolsets created yet. Press n to create one.`}):J(B,{flexDirection:`column`,children:t.map((e,t)=>{let i=e.name===n,a=e.name===r,o=d===t,s;return o&&(s=`yellow`),Y(B,{flexDirection:`row`,children:[Y(V,{color:s,children:[o?`❯ `:` `,e.name,` `]}),Y(V,{color:s,children:[`(`,S(e),`)`]}),i&&J(V,{color:u,children:` ⏵⏵ accept edits`}),a&&J(V,{color:l,children:` ⏸ plan mode`})]},t)})})]})}function wt({onBack:e}){let{settings:t,updateSettings:n}=W($),[r,i]=K(`plan`),[a,o]=K(!1),[s,c]=K(0),l=t.subagentModels||{plan:null,explore:null,generalPurpose:null},u=[{id:`plan`,title:`Plan Agent`,description:`The agent responsible for creating implementation plans.`},{id:`explore`,title:`Explore Agent`,description:`The agent specialized for exploring codebases.`},{id:`generalPurpose`,title:`General-purpose Agent`,description:`The agent used for general multi-step tasks.`}],d=[{label:`Default (Inherited)`,value:null},{label:`sonnet`,value:`sonnet`},{label:`haiku`,value:`haiku`},{label:`opus`,value:`opus`},{label:`sonnet[1m]`,value:`sonnet[1m]`}];return H((t,f)=>{if(a){if(f.escape)o(!1);else if(f.upArrow)c(e=>e>0?e-1:d.length-1);else if(f.downArrow)c(e=>e<d.length-1?e+1:0);else if(f.return){let e=d[s].value;n(t=>{t.subagentModels||={plan:null,explore:null,generalPurpose:null},t.subagentModels[r]=e}),o(!1)}}else if(f.escape)e();else if(f.upArrow){let e=u.findIndex(e=>e.id===r);i(u[e>0?e-1:u.length-1].id)}else if(f.downArrow){let e=u.findIndex(e=>e.id===r);i(u[e<u.length-1?e+1:0].id)}else if(t===` `||f.return){let e=l[r],t=d.findIndex(t=>t.value===e);c(t>=0?t:0),o(!0)}}),a?Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:Y(X,{children:[`Select Model for`,` `,u.find(e=>e.id===r)?.title]})}),d.map((e,t)=>{let n=t===s;return J(B,{children:Y(V,{color:n?`cyan`:void 0,children:[n?`❯ `:` `,e.label,e.value?Y(V,{dimColor:!0,children:[` (`,e.value,`)`]}):null]})},t)})]}):Y(B,{flexDirection:`column`,children:[J(B,{marginBottom:1,children:J(X,{children:`Subagent Model Settings`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`Configure which Claude model each subagent uses. Use arrow keys to navigate, enter or space to change a model, and escape to go back.`})}),u.map(e=>{let t=e.id===r,n=l[e.id],i=d.find(e=>e.value===n)?.label||n||`Default`;return Y(B,{flexDirection:`column`,marginBottom:1,children:[J(B,{children:Y(V,{color:t?`cyan`:void 0,children:[t?`❯ `:` `,J(V,{bold:!0,children:e.title})]})}),J(B,{marginLeft:4,children:J(V,{dimColor:!0,children:e.description})}),J(B,{marginLeft:4,children:Y(V,{children:[`Current: `,J(V,{color:`green`,children:i})]})})]},e.id)})]})}function Tt({onBack:e}){let{settings:t,updateSettings:n}=W($),r=t.claudeMdAltNames??[],[i,a]=K(0),[o,s]=K(!1),[c,l]=K(``),[u,d]=K(!1);return H((t,f)=>{if(o||u){f.return&&c.trim()?(u?(n(e=>{e.claudeMdAltNames||=[],e.claudeMdAltNames.push(c.trim())}),d(!1)):(n(e=>{e.claudeMdAltNames&&(e.claudeMdAltNames[i]=c.trim())}),s(!1)),l(``)):f.escape?(l(``),s(!1),d(!1)):f.backspace||f.delete?l(e=>e.slice(0,-1)):t&&l(e=>e+t);return}f.escape?e():f.upArrow?r.length>0&&a(e=>e>0?e-1:r.length-1):f.downArrow?r.length>0&&a(e=>e<r.length-1?e+1:0):t===`e`?r.length>0&&(l(r[i]),s(!0)):t===`d`?r.length>0&&(n(e=>{e.claudeMdAltNames&&=e.claudeMdAltNames.filter((e,t)=>t!==i)}),i>=r.length-1&&a(Math.max(0,r.length-2))):t===`n`?(d(!0),l(``)):f.ctrl&&t===`r`?(n(e=>{e.claudeMdAltNames=[...x.claudeMdAltNames??[]]}),a(0)):t===`u`||f.shift&&f.upArrow?r.length>1&&i>0&&(n(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[i-1],t[i]]=[t[i],t[i-1]]}),a(e=>e-1)):(t===`j`||f.shift&&f.downArrow)&&r.length>1&&i<r.length-1&&(n(e=>{if(!e.claudeMdAltNames)return;let t=e.claudeMdAltNames;[t[i],t[i+1]]=[t[i+1],t[i]]}),a(e=>e+1))}),Y(B,{flexDirection:`column`,children:[Y(B,{marginBottom:1,flexDirection:`column`,children:[J(X,{children:`CLAUDE.md Alternative Names`}),Y(B,{flexDirection:`column`,children:[J(V,{dimColor:!0,children:`changes auto-saved`}),J(V,{dimColor:!0,children:`esc to go back`})]})]}),J(B,{marginBottom:1,flexDirection:`column`,children:J(V,{dimColor:!0,children:`When Claude Code looks for CLAUDE.md and doesn't find it, it will try these alternative filenames in order. This lets you use AGENTS.md (and other file names).`})}),J(B,{marginBottom:1,children:J(V,{dimColor:!0,children:`e to edit · d to delete · n to add new · u/j to move up/down · ctrl+r to reset`})}),Y(B,{flexDirection:`column`,children:[r.length===0?J(V,{children:`No alternative names configured. Press n to add one.`}):J(q,{children:(()=>{let e=Math.max(0,i-6),t=Math.min(r.length,e+12),n=Math.max(0,t-12),a=r.slice(n,t);return Y(q,{children:[n>0&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↑ `,n,` more above`]}),a.map((e,t)=>{let r=n+t,a=r===i;return Y(V,{color:a?`cyan`:void 0,children:[a?`❯ `:` `,e]},r)}),t<r.length&&Y(V,{color:`gray`,dimColor:!0,children:[` `,`↓ `,r.length-t,` more below`]})]})})()}),u&&Y(B,{alignItems:`center`,children:[J(V,{color:`yellow`,children:`❯ `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:c})})]}),o&&Y(B,{marginTop:1,alignItems:`center`,children:[J(V,{children:`Editing: `}),J(B,{borderStyle:`round`,borderColor:`yellow`,children:J(V,{children:c})})]})]})]})}const $=ve({settings:x,updateSettings:e=>{},changesApplied:!1,ccVersion:``});function Et({startupCheckInfo:e,configMigrated:t,invocationCommand:r,initialConfig:a}){let[o,s]=K(a),[c,l]=K(!a.hidePiebaldAnnouncement),u=ye(e=>{let t=JSON.parse(JSON.stringify(o.settings));e(t),s(e=>({...e,settings:t,changesApplied:!1})),M(e=>{e.settings=t,e.changesApplied=!1})},[o.settings]),[d,p]=K(null),[m,h]=K(null);G(()=>{e.wasUpdated&&e.oldVersion&&(h({message:`Your Claude Code installation was updated from ${e.oldVersion} to ${e.newVersion}, and the patching was likely overwritten
3
+ (However, your customization are still remembered in ${N}.)
4
4
 
5
- Please reapply your changes by running \`${r} --apply\`.`,type:`warning`}),l(()=>{}))},[]),H((e,t)=>{t.ctrl&&e===`c`&&process.exit(0),(e===`q`||t.escape)&&!u&&process.exit(0),e===`h`&&!u&&s&&(c(!1),j(e=>{e.hidePiebaldAnnouncement=!0}))},{isActive:!u});let m=t=>{switch(p(null),t){case Z.THEMES:case Z.THINKING_VERBS:case Z.THINKING_STYLE:case Z.USER_MESSAGE_DISPLAY:case Z.INPUT_PATTERN_HIGHLIGHTERS:case Z.MISC:case Z.TOOLSETS:case Z.SUBAGENT_MODELS:case Z.CLAUDE_MD_ALT_NAMES:d(t);break;case Z.VIEW_SYSTEM_PROMPTS:g(C);break;case Z.RESTORE_ORIGINAL:e.ccInstInfo&&(e.ccInstInfo.nativeInstallationPath?y(e.ccInstInfo):_(e.ccInstInfo)).then(()=>{p({message:`Original Claude Code restored successfully!`,type:`success`}),l(()=>{})});break;case Z.OPEN_CONFIG:n(P);break;case Z.OPEN_CLI:e.ccInstInfo?.cliPath&&n(e.ccInstInfo.cliPath);break;case Z.EXIT:process.exit(0)}},h=()=>{d(null)};return J($.Provider,{value:{settings:a.settings,updateSettings:l,changesApplied:a.changesApplied,ccVersion:e.ccInstInfo?.version||``},children:J(B,{flexDirection:`column`,children:u===null?J(ze,{onSubmit:m,notification:f,configMigrated:t,showPiebaldAnnouncement:s,changesApplied:a.changesApplied,invocationCommand:r}):u===Z.THEMES?J(Ye,{onBack:h}):u===Z.THINKING_VERBS?J(Xe,{onBack:h}):u===Z.THINKING_STYLE?J(tt,{onBack:h}):u===Z.USER_MESSAGE_DISPLAY?J(at,{onBack:h}):u===Z.INPUT_PATTERN_HIGHLIGHTERS?J(ut,{onBack:h}):u===Z.MISC?J(pt,{onSubmit:h}):u===Z.TOOLSETS?J(gt,{onBack:h}):u===Z.SUBAGENT_MODELS?J(_t,{onBack:h}):u===Z.CLAUDE_MD_ALT_NAMES?J(vt,{onBack:h}):null})})}async function bt(e,t){let n=t??await w(),r=await se(n,e);if(!r)return{startupCheckInfo:null,pendingCandidates:null,config:n};let i=de(r);return i?{startupCheckInfo:null,pendingCandidates:i,config:n}:{startupCheckInfo:await xt(n,r),pendingCandidates:null,config:n}}async function xt(e,t){if(!t)return null;if(t.version)try{i(await s(t.version))}catch{}let n=t.version,r=e.ccVersion,o=!1;await N(re)||(T(`startupCheck: ${re} not found; backing up cli.js`),await v(t),o=!0);let c=!1;return t.nativeInstallationPath&&!await N(O)&&(T(`startupCheck: ${O} not found; backing up native binary`),await a(t),c=!0),n===r?{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}:(o||(T(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await Ce.unlink(re),await v(t)),t.nativeInstallationPath&&!c&&(T(`startupCheck: real version (${n}) != backed up version (${r}); backing up native binary`),await N(O)&&await Ce.unlink(O),await a(t)),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t})}let St;async function Ct(){if(St!==void 0)return St;try{return St=(await import(`oxfmt`)).format,St}catch(e){return T(`Failed to load oxfmt:`,e),St=null,null}}async function wt(e,t,n){let r=await Ct();if(!r)return T(`oxfmt unavailable, skipping format+diff`),null;let i=n?.contextLines??10,a=n?.printWidth??80,o=performance.now(),[s,c]=await Promise.all([r(`original.js`,e,{printWidth:a}),r(`modified.js`,t,{printWidth:a})]),l=performance.now();if(s.errors.length>0||c.errors.length>0)return T(`oxfmt format errors:`,`original:`,s.errors,`modified:`,c.errors),null;let u=we(`original.js`,`modified.js`,s.code,c.code,``,``,{context:i}),d=performance.now();return{hunks:u.hunks,changeCount:u.hunks.length,formattedLines:s.code.split(`
6
- `).length,timings:{formatMs:l-o,diffMs:d-l,totalMs:d-o}}}function Tt(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,i.close(),t(e))},i=De.createInterface({input:process.stdin,output:process.stderr});i.on(`close`,()=>r(!1)),i.on(`SIGINT`,()=>r(!1)),i.question(e,e=>{let t=e.trim().toLowerCase();r(t===``||t===`y`||t===`yes`)})})}function Et(e){for(let t of e){console.log(U.cyan(`@@ -${t.oldStart} +${t.newStart} @@`));for(let e of t.lines)e.startsWith(`+`)?console.log(U.green(e)):e.startsWith(`-`)?console.log(U.red(e)):console.log(U.gray(e));console.log()}}async function Dt(e,t,n=!1){if(n)return!0;console.log(U.gray(`Formatting for diff preview...`));let r=await wt(e,t,{contextLines:10});return r?r.changeCount===0?(console.log(U.yellow(`No visible differences after formatting. Proceeding.`)),!0):(console.log(U.gray(`Formatted ${r.formattedLines.toLocaleString()} lines in ${r.timings.formatMs.toFixed(0)}ms\n`)),Et(r.hunks),console.log(U.gray(`${r.changeCount} change(s) across ${r.formattedLines.toLocaleString()} formatted lines (${r.timings.totalMs.toFixed(0)}ms)`)),Tt(U.bold(`
7
- Apply these changes? [Y/n] `))):(console.log(U.yellow(`Could not generate formatted diff (oxfmt unavailable or parse error).`)),Tt(U.bold(`
8
- Apply changes without diff preview? [Y/n] `)))}function Ot(e){return u(),{chalkVar:p(e),moduleLoaderFunction:o(e),reactVar:l(e),requireFuncName:m(e),textComponent:r(e),boxComponent:d(e)}}async function kt(e,t,n,r=!1){let i=`
5
+ Please reapply your changes by running \`${r} --apply\`.`,type:`warning`}),u(()=>{}))},[]),H((e,t)=>{t.ctrl&&e===`c`&&process.exit(0),(e===`q`||t.escape)&&!d&&process.exit(0),e===`h`&&!d&&c&&(l(!1),M(e=>{e.hidePiebaldAnnouncement=!0}))},{isActive:!d});let g=t=>{switch(h(null),t){case Z.THEMES:case Z.THINKING_VERBS:case Z.THINKING_STYLE:case Z.USER_MESSAGE_DISPLAY:case Z.INPUT_PATTERN_HIGHLIGHTERS:case Z.MISC:case Z.TOOLSETS:case Z.SUBAGENT_MODELS:case Z.CLAUDE_MD_ALT_NAMES:p(t);break;case Z.VIEW_SYSTEM_PROMPTS:n(C);break;case Z.RESTORE_ORIGINAL:e.ccInstInfo&&(e.ccInstInfo.nativeInstallationPath?i(e.ccInstInfo):v(e.ccInstInfo)).then(()=>{h({message:`Original Claude Code restored successfully!`,type:`success`}),u(()=>{})});break;case Z.OPEN_CONFIG:f(N);break;case Z.OPEN_CLI:e.ccInstInfo?.cliPath&&f(e.ccInstInfo.cliPath);break;case Z.EXIT:process.exit(0)}},_=()=>{p(null)};return J($.Provider,{value:{settings:o.settings,updateSettings:u,changesApplied:o.changesApplied,ccVersion:e.ccInstInfo?.version||``},children:J(B,{flexDirection:`column`,children:d===null?J(Ve,{onSubmit:g,notification:m,configMigrated:t,showPiebaldAnnouncement:c,changesApplied:o.changesApplied,invocationCommand:r}):d===Z.THEMES?J(nt,{onBack:_}):d===Z.THINKING_VERBS?J(rt,{onBack:_}):d===Z.THINKING_STYLE?J(ct,{onBack:_}):d===Z.USER_MESSAGE_DISPLAY?J(ft,{onBack:_}):d===Z.INPUT_PATTERN_HIGHLIGHTERS?J(_t,{onBack:_}):d===Z.MISC?J(bt,{onSubmit:_}):d===Z.TOOLSETS?J(Ct,{onBack:_}):d===Z.SUBAGENT_MODELS?J(wt,{onBack:_}):d===Z.CLAUDE_MD_ALT_NAMES?J(Tt,{onBack:_}):null})})}async function Dt(e,t){let n=t??await T(),r=await L(n,e);if(!r)return{startupCheckInfo:null,pendingCandidates:null,config:n};let i=pe(r);return i?{startupCheckInfo:null,pendingCandidates:i,config:n}:{startupCheckInfo:await Ot(n,r),pendingCandidates:null,config:n}}async function Ot(e,t){if(!t)return null;if(t.version)try{c(await b(t.version))}catch{}let n=t.version,r=e.ccVersion,i=!1;await ee(P)||(E(`startupCheck: ${P} not found; backing up cli.js`),await a(t),i=!0);let o=!1;return t.nativeInstallationPath&&!await ee(k)&&(E(`startupCheck: ${k} not found; backing up native binary`),await _(t),o=!0),n===r?{wasUpdated:!1,oldVersion:null,newVersion:null,ccInstInfo:t}:(i||(E(`startupCheck: real version (${n}) != backed up version (${r}); backing up cli.js`),await Te.unlink(P),await a(t)),t.nativeInstallationPath&&!o&&(E(`startupCheck: real version (${n}) != backed up version (${r}); backing up native binary`),await ee(k)&&await Te.unlink(k),await _(t)),{wasUpdated:!0,oldVersion:r,newVersion:n,ccInstInfo:t})}let kt;async function At(){if(kt!==void 0)return kt;try{return kt=(await import(`oxfmt`)).format,kt}catch(e){return E(`Failed to load oxfmt:`,e),kt=null,null}}async function jt(e,t,n){let r=await At();if(!r)return E(`oxfmt unavailable, skipping format+diff`),null;let i=n?.contextLines??10,a=n?.printWidth??80,o=performance.now(),[s,c]=await Promise.all([r(`original.js`,e,{printWidth:a}),r(`modified.js`,t,{printWidth:a})]),l=performance.now();if(s.errors.length>0||c.errors.length>0)return E(`oxfmt format errors:`,`original:`,s.errors,`modified:`,c.errors),null;let u=Ee(`original.js`,`modified.js`,s.code,c.code,``,``,{context:i}),d=performance.now();return{hunks:u.hunks,changeCount:u.hunks.length,formattedLines:s.code.split(`
6
+ `).length,timings:{formatMs:l-o,diffMs:d-l,totalMs:d-o}}}function Mt(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,i.close(),t(e))},i=ke.createInterface({input:process.stdin,output:process.stderr});i.on(`close`,()=>r(!1)),i.on(`SIGINT`,()=>r(!1)),i.question(e,e=>{let t=e.trim().toLowerCase();r(t===``||t===`y`||t===`yes`)})})}function Nt(e){for(let t of e){console.log(U.cyan(`@@ -${t.oldStart} +${t.newStart} @@`));for(let e of t.lines)e.startsWith(`+`)?console.log(U.green(e)):e.startsWith(`-`)?console.log(U.red(e)):console.log(U.gray(e));console.log()}}async function Pt(e,t,n=!1){if(n)return!0;console.log(U.gray(`Formatting for diff preview...`));let r=await jt(e,t,{contextLines:10});return r?r.changeCount===0?(console.log(U.yellow(`No visible differences after formatting. Proceeding.`)),!0):(console.log(U.gray(`Formatted ${r.formattedLines.toLocaleString()} lines in ${r.timings.formatMs.toFixed(0)}ms\n`)),Nt(r.hunks),console.log(U.gray(`${r.changeCount} change(s) across ${r.formattedLines.toLocaleString()} formatted lines (${r.timings.totalMs.toFixed(0)}ms)`)),Mt(U.bold(`
7
+ Apply these changes? [Y/n] `))):(console.log(U.yellow(`Could not generate formatted diff (oxfmt unavailable or parse error).`)),Mt(U.bold(`
8
+ Apply changes without diff preview? [Y/n] `)))}function Ft(e){return d(),{chalkVar:r(e),moduleLoaderFunction:l(e),reactVar:h(e),requireFuncName:se(e),textComponent:o(e),boxComponent:p(e)}}async function It(e,t,n,r=!1){let i=`
9
9
  let input = '';
10
10
  process.stdin.on('data', c => input += c);
11
11
  process.stdin.on('end', async () => {
@@ -20,10 +20,10 @@ Apply changes without diff preview? [Y/n] `)))}function Ot(e){return u(),{chalkV
20
20
  process.exitCode = 1;
21
21
  }
22
22
  });
23
- `;if(r)return Mt([],i,t);try{return await Mt([`--permission`],i,t)}catch(e){if(!At(e))throw e}try{return await Mt([`--experimental-permission`],i,t)}catch(e){if(At(e)){let e=jt();throw Error(`Your Node.js version (${e}) does not support the permission model.\nPlease either upgrade to Node.js 20+ or rerun with --dangerous-no-script-sandbox.`)}throw e}}function At(e){return e instanceof Error?e.message.includes(`bad option`):!1}function jt(){try{return Oe(`node --version`,{encoding:`utf8`}).trim()}catch{return`unknown`}}function Mt(e,t,n){return new Promise((r,i)=>{let a=ke(`node`,[...e,`-e`,t],{stdio:[`pipe`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>o+=e),a.stderr.on(`data`,e=>s+=e),a.on(`error`,i),a.stdin.on(`error`,()=>{}),a.on(`close`,e=>{if(e!==0)i(Error(s||`Script exited with code ${e}`));else try{r(JSON.parse(o).r)}catch{i(Error(`Script returned invalid JSON output.\nstdout: ${o}\nstderr: ${s}`))}}),a.stdin.write(n),a.stdin.end()})}async function Nt(e){if(!e.startsWith(`@`))return e;let t=e.slice(1);if(t.startsWith(`http://`)||t.startsWith(`https://`)){console.log(`Fetching script from ${t}...`);let e=await fetch(t);if(!e.ok)throw Error(`Failed to fetch script from ${t}: HTTP ${e.status} ${e.statusText}`);return e.text()}return console.log(`Reading script from ${t}...`),Se.readFile(t,`utf8`)}async function Pt(e){try{return await oe({path:e,interactive:!1})}catch(e){let t=e instanceof Error?e.message:String(e);console.error(U.red(`Error: ${t}`)),process.exit(1)}}async function Ft(e,t){let n=await Pt(t);n.kind===`npm`&&(console.error(U.red(`Error: Cannot unpack an npm-based installation (cli.js). Only native binaries can be unpacked.`)),console.error(U.gray(` Detected installation: ${n.path} (npm-based, v${n.version})`)),process.exit(1)),console.log(`Extracting JS from native binary: ${U.cyan(n.path)} (v${n.version})`);let r=await ue(n);await Se.writeFile(e,r,`utf8`),console.log(U.green(`✓ Extracted JS written to ${U.cyan(e)}`)),console.log(U.gray(` ${r.length.toLocaleString()} characters written`))}async function It(e,t){let n=await Pt(t);n.kind===`npm`&&(console.error(U.red(`Error: Cannot repack into an npm-based installation (cli.js). Only native binaries can be repacked.`)),console.error(U.gray(` Detected installation: ${n.path} (npm-based, v${n.version})`)),process.exit(1)),console.log(`Repacking JS into native binary: ${U.cyan(n.path)} (v${n.version})`),await R(n,await Se.readFile(e,`utf8`)),console.log(U.green(`✓ JS from ${U.cyan(e)} repacked into ${U.cyan(n.path)}`))}async function Lt(e,t,n,r,i=!1){let a=await ue(r),o,s;if(n!==void 0){let r=[],i=0;for(;;){let t=a.indexOf(e,i);if(t===-1)break;r.push(t),i=t+e.length}r.length===0&&(console.error(U.red(`Error: String not found in content.`)),process.exit(1)),(n<1||n>r.length)&&(console.error(U.red(`Error: Index ${n} is out of range. Found ${r.length} occurrence(s).`)),process.exit(1));let c=r[n-1];o=a.slice(0,c)+t+a.slice(c+e.length),s=1}else{let n=a.split(e);s=n.length-1,s===0&&(console.error(U.red(`Error: String not found in content.`)),process.exit(1)),o=n.join(t)}if(!await Dt(a,o,i)){console.log(U.yellow(`Aborted.`));return}await R(r,o),console.log(U.green(`✓ Replaced ${s} occurrence(s) in ${U.cyan(r.path)}`))}function Rt(e){if(e.startsWith(`/`)){let t=-1;for(let n=e.length-1;n>0;n--)if(e[n]===`/`){let r=0;for(let t=n-1;t>=0&&e[t]===`\\`;t--)r++;if(r%2==0){t=n;break}}if(t>0){let n=e.slice(1,t),r=e.slice(t+1);if(!/^[gimsuy]*$/.test(r))throw Error(`Invalid regex flags: "${r}". Valid flags are: g, i, m, s, u, y`);return{pattern:n,flags:r}}}return{pattern:e,flags:``}}async function zt(e,t,n,r,i=!1){let a=await ue(r),o;try{o=Rt(e)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(U.red(`Error: ${t}`)),process.exit(1)}let s=o.flags.includes(`g`)?o.flags:o.flags+`g`,c,l,u=new RegExp(o.pattern,s);if(n!==void 0){let e=[...a.matchAll(u)];e.length===0&&(console.error(U.red(`Error: Regex pattern not found in content.`)),process.exit(1)),(n<1||n>e.length)&&(console.error(U.red(`Error: Index ${n} is out of range. Found ${e.length} match(es).`)),process.exit(1));let r=e[n-1],i=r.index,s=i+r[0].length,d=r[0].replace(new RegExp(o.pattern,o.flags),t);c=a.slice(0,i)+d+a.slice(s),l=1}else c=a.replace(u,t),l=[...a.matchAll(new RegExp(o.pattern,s))].length,l===0&&(console.error(U.red(`Error: Regex pattern not found in content.`)),process.exit(1));if(!await Dt(a,c,i)){console.log(U.yellow(`Aborted.`));return}await R(r,c),console.log(U.green(`✓ Replaced ${l} match(es) in ${U.cyan(r.path)}`))}async function Bt(e,t,n=!1,r=!1){let i=await ue(t),a=await Nt(e);console.log(`Resolving variables...`);let o=Ot(i);console.log(r?`Running patch script WITHOUT sandbox (--dangerous-no-script-sandbox)...`:`Running patch script in sandbox...`);let s;try{s=await kt(a,i,o,r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(U.red(`Error: Script execution failed:`)),console.error(U.red(` ${t}`)),process.exit(1)}if(typeof s!=`string`&&(console.error(U.red(`Error: Script did not return a string. Got: `+typeof s)),process.exit(1)),s===i){console.log(U.yellow(`Script returned unchanged content. Nothing to do.`));return}if(!await Dt(i,s,n)){console.log(U.yellow(`Aborted.`));return}await R(t,s),console.log(U.green(`✓ Script patch applied to ${U.cyan(t.path)}`))}async function Vt(e){let t=[e.string,e.regex,e.script].filter(e=>e!==void 0);t.length===0&&(console.error(U.red(`Error: Must specify one of --string, --regex, or --script.`)),process.exit(1)),t.length>1&&(console.error(U.red(`Error: Only one of --string, --regex, or --script can be used at a time.`)),process.exit(1));let n=!!e.confirmPossibleDangerousPatch,r=await Pt(e.path);console.log(`Target: ${U.cyan(r.path)} (${r.kind}, v${r.version})`),e.string?(e.string.length!==2&&(console.error(U.red(`Error: --string requires exactly 2 arguments: <old-string> <new-string>`)),process.exit(1)),await Lt(e.string[0],e.string[1],e.index,r,n)):e.regex?(e.regex.length!==2&&(console.error(U.red(`Error: --regex requires exactly 2 arguments: <pattern> <replacement>`)),process.exit(1)),await zt(e.regex[0],e.regex[1],e.index,r,n)):e.script&&(e.index!==void 0&&(console.error(U.red(`Error: --index cannot be used with --script.`)),process.exit(1)),await Bt(e.script,r,n,!!e.dangerousNoScriptSandbox))}function Ht(){let e=process.argv[1]||``;return e.includes(`npx`)||e.includes(`.npm/_npx`)?`npx tweakcc`:e.includes(`pnpm`)||e.includes(`.pnpm`)?`pnpm dlx tweakcc`:e.includes(`yarn`)?`yarn dlx tweakcc`:e.includes(`bun`)?`bunx tweakcc`:`tweakcc`}function Ut(e,t){let n=[A.SYSTEM_PROMPTS,A.ALWAYS_APPLIED,A.MISC_CONFIGURABLE,A.FEATURES],r=new Map;for(let e of n)r.set(e,[]);for(let t of e){let e=r.get(t.group);e&&e.push(t)}console.log(`
24
- Patches applied (run with --show-unchanged to show all patches):`);for(let e of n){let n=r.get(e).filter(e=>e.applied||e.failed||h()||t&&t.includes(e.id));if(n.length!==0){console.log(`\n ${U.bold(e)}:`);for(let e of n){let t=e.failed?U.red(`✗`):e.applied?U.green(`✓`):U.dim(`○`),n=e.details?`: ${e.details}`:``,r=e.applied&&e.description?` ${U.gray(`—`)} ${U.gray(e.description)}`:``;console.log(` ${t} ${e.name}${n}${r}`)}}}console.log(``)}const Wt=async()=>{let e=new pe;e.name(`tweakcc`).description(`Command-line tool to customize your Claude Code theme colors, thinking verbs and more.`).version(`4.0.11`).option(`-d, --debug`,`enable debug mode`).option(`-v, --verbose`,`enable verbose debug mode (includes diffs)`).option(`--show-unchanged`,`show unchanged diffs (requires --verbose)`).option(`-a, --apply`,`apply saved customizations without interactive UI`).option(`--restore`,`restore Claude Code to its original state`).option(`--revert`,`restore Claude Code to its original state (alias for --restore)`).option(`--patches <ids>`,`comma-separated list of patch IDs to apply (use with --apply)`).option(`--list-patches`,`list all available patches with their IDs`).option(`--list-system-prompts [version]`,`list all available system prompts for a CC version`).option(`--config-url <url>`,`fetch configuration from a URL instead of local config.json`).action(async()=>{let t=e.opts();t.verbose?E():t.debug&&M(),t.showUnchanged&&D();let n=await F();if(t.apply&&(t.restore||t.revert)&&(console.error(U.red(`Error: Cannot use --apply and --restore/--revert together.`)),process.exit(1)),t.listPatches){qt();return}if(t.listSystemPrompts!==void 0){await Jt(t.listSystemPrompts);return}if(t.apply){await Gt(t.patches?t.patches.split(`,`).map(e=>e.trim()):null,t.configUrl);return}if(t.configUrl&&(console.error(U.red(`Error: --config-url can only be used with --apply.`)),console.error(U.gray(`The interactive TUI is for editing local configuration only.`)),console.error(U.gray(`To apply a remote config, use:`)),console.error(U.gray(` ${Ht()} --apply --config-url <url>`)),process.exit(1)),t.restore||t.revert){await Kt();return}await Yt(n)}),e.command(`unpack`).argument(`<output-js-path>`,`path to write extracted JS`).argument(`[binary-path]`,`path to native binary (default: auto-detect)`).description(`Extract JS from a native Claude Code binary`).action(async(e,t)=>{await Ft(e,t),process.exit(0)}),e.command(`repack`).argument(`<input-js-path>`,`path to JS file to embed`).argument(`[binary-path]`,`path to native binary (default: auto-detect)`).description(`Embed JS into a native Claude Code binary`).action(async(e,t)=>{await It(e,t),process.exit(0)}),e.command(`adhoc-patch`).description(`Apply an ad-hoc patch to Claude Code`).option(`-s, --string <values...>`,`replace string: <old-string> <new-string>`).option(`-r, --regex <values...>`,`replace regex: <pattern> <replacement>`).option(`--script <script>`,`run a patch script (prefix with @ for file/URL)`).option(`-i, --index <number>`,`replace only the Nth occurrence (1-based)`,parseInt).option(`-p, --path <path>`,`path to cli.js or native binary (default: auto-detect)`).option(`--confirm-possible-dangerous-patch`,`skip diff preview and apply immediately`).option(`--dangerous-no-script-sandbox`,`run --script without the Node.js permission sandbox (use if Node < 20)`).action(async e=>{await Vt(e),process.exit(0)}),e.parse()};async function Gt(t,n){console.log(`Applying saved customizations to Claude Code...`);let r;if(n){console.log(`Fetching configuration from: ${n}`);try{r=await te(n),console.log(`Configuration fetched successfully.`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(U.red(`Error: ${t}`)),process.exit(1)}}else console.log(`Configuration saved at: ${P}`),r=await w();if(!r.settings||Object.keys(r.settings).length===0){let e=n||P;console.error(`No saved customizations found in `+e),process.exit(1)}try{let n=await bt({interactive:!1},r);(!n.startupCheckInfo||!n.startupCheckInfo.ccInstInfo)&&(console.error(L()),process.exit(1));let{ccInstInfo:i}=n.startupCheckInfo;i.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${i.nativeInstallationPath}`):console.log(`Found Claude Code at: ${i.cliPath}`),console.log(`Version: ${i.version}`),console.log(`Loading system prompts...`);let a=await ne(i.version);a.success||(console.log(U.red(`
23
+ `;if(r)return zt([],i,t);try{return await zt([`--permission`],i,t)}catch(e){if(!Lt(e))throw e}try{return await zt([`--experimental-permission`],i,t)}catch(e){if(Lt(e)){let e=Rt();throw Error(`Your Node.js version (${e}) does not support the permission model.\nPlease either upgrade to Node.js 20+ or rerun with --dangerous-no-script-sandbox.`)}throw e}}function Lt(e){return e instanceof Error?e.message.includes(`bad option`):!1}function Rt(){try{return Ae(`node --version`,{encoding:`utf8`}).trim()}catch{return`unknown`}}function zt(e,t,n){return new Promise((r,i)=>{let a=je(`node`,[...e,`-e`,t],{stdio:[`pipe`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>o+=e),a.stderr.on(`data`,e=>s+=e),a.on(`error`,i),a.stdin.on(`error`,()=>{}),a.on(`close`,e=>{if(e!==0)i(Error(s||`Script exited with code ${e}`));else try{r(JSON.parse(o).r)}catch{i(Error(`Script returned invalid JSON output.\nstdout: ${o}\nstderr: ${s}`))}}),a.stdin.write(n),a.stdin.end()})}async function Bt(e){if(!e.startsWith(`@`))return e;let t=e.slice(1);if(t.startsWith(`http://`)||t.startsWith(`https://`)){console.log(`Fetching script from ${t}...`);let e=await fetch(t);if(!e.ok)throw Error(`Failed to fetch script from ${t}: HTTP ${e.status} ${e.statusText}`);return e.text()}return console.log(`Reading script from ${t}...`),we.readFile(t,`utf8`)}async function Vt(e){try{return await ce({path:e,interactive:!1})}catch(e){let t=e instanceof Error?e.message:String(e);console.error(U.red(`Error: ${t}`)),process.exit(1)}}async function Ht(e,t){let n=await Vt(t);n.kind===`npm`&&(console.error(U.red(`Error: Cannot unpack an npm-based installation (cli.js). Only native binaries can be unpacked.`)),console.error(U.gray(` Detected installation: ${n.path} (npm-based, v${n.version})`)),process.exit(1)),console.log(`Extracting JS from native binary: ${U.cyan(n.path)} (v${n.version})`);let r=await fe(n);await we.writeFile(e,r,`utf8`),console.log(U.green(`✓ Extracted JS written to ${U.cyan(e)}`)),console.log(U.gray(` ${r.length.toLocaleString()} characters written`))}async function Ut(e,t){let n=await Vt(t);n.kind===`npm`&&(console.error(U.red(`Error: Cannot repack into an npm-based installation (cli.js). Only native binaries can be repacked.`)),console.error(U.gray(` Detected installation: ${n.path} (npm-based, v${n.version})`)),process.exit(1)),console.log(`Repacking JS into native binary: ${U.cyan(n.path)} (v${n.version})`),await z(n,await we.readFile(e,`utf8`)),console.log(U.green(`✓ JS from ${U.cyan(e)} repacked into ${U.cyan(n.path)}`))}async function Wt(e,t,n,r,i=!1){let a=await fe(r),o,s;if(n!==void 0){let r=[],i=0;for(;;){let t=a.indexOf(e,i);if(t===-1)break;r.push(t),i=t+e.length}r.length===0&&(console.error(U.red(`Error: String not found in content.`)),process.exit(1)),(n<1||n>r.length)&&(console.error(U.red(`Error: Index ${n} is out of range. Found ${r.length} occurrence(s).`)),process.exit(1));let c=r[n-1];o=a.slice(0,c)+t+a.slice(c+e.length),s=1}else{let n=a.split(e);s=n.length-1,s===0&&(console.error(U.red(`Error: String not found in content.`)),process.exit(1)),o=n.join(t)}if(!await Pt(a,o,i)){console.log(U.yellow(`Aborted.`));return}await z(r,o),console.log(U.green(`✓ Replaced ${s} occurrence(s) in ${U.cyan(r.path)}`))}function Gt(e){if(e.startsWith(`/`)){let t=-1;for(let n=e.length-1;n>0;n--)if(e[n]===`/`){let r=0;for(let t=n-1;t>=0&&e[t]===`\\`;t--)r++;if(r%2==0){t=n;break}}if(t>0){let n=e.slice(1,t),r=e.slice(t+1);if(!/^[gimsuy]*$/.test(r))throw Error(`Invalid regex flags: "${r}". Valid flags are: g, i, m, s, u, y`);return{pattern:n,flags:r}}}return{pattern:e,flags:``}}async function Kt(e,t,n,r,i=!1){let a=await fe(r),o;try{o=Gt(e)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(U.red(`Error: ${t}`)),process.exit(1)}let s=o.flags.includes(`g`)?o.flags:o.flags+`g`,c,l,u=new RegExp(o.pattern,s);if(n!==void 0){let e=[...a.matchAll(u)];e.length===0&&(console.error(U.red(`Error: Regex pattern not found in content.`)),process.exit(1)),(n<1||n>e.length)&&(console.error(U.red(`Error: Index ${n} is out of range. Found ${e.length} match(es).`)),process.exit(1));let r=e[n-1],i=r.index,s=i+r[0].length,d=r[0].replace(new RegExp(o.pattern,o.flags),t);c=a.slice(0,i)+d+a.slice(s),l=1}else c=a.replace(u,t),l=[...a.matchAll(new RegExp(o.pattern,s))].length,l===0&&(console.error(U.red(`Error: Regex pattern not found in content.`)),process.exit(1));if(!await Pt(a,c,i)){console.log(U.yellow(`Aborted.`));return}await z(r,c),console.log(U.green(`✓ Replaced ${l} match(es) in ${U.cyan(r.path)}`))}async function qt(e,t,n=!1,r=!1){let i=await fe(t),a=await Bt(e);console.log(`Resolving variables...`);let o=Ft(i);console.log(r?`Running patch script WITHOUT sandbox (--dangerous-no-script-sandbox)...`:`Running patch script in sandbox...`);let s;try{s=await It(a,i,o,r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(U.red(`Error: Script execution failed:`)),console.error(U.red(` ${t}`)),process.exit(1)}if(typeof s!=`string`&&(console.error(U.red(`Error: Script did not return a string. Got: `+typeof s)),process.exit(1)),s===i){console.log(U.yellow(`Script returned unchanged content. Nothing to do.`));return}if(!await Pt(i,s,n)){console.log(U.yellow(`Aborted.`));return}await z(t,s),console.log(U.green(`✓ Script patch applied to ${U.cyan(t.path)}`))}async function Jt(e){let t=[e.string,e.regex,e.script].filter(e=>e!==void 0);t.length===0&&(console.error(U.red(`Error: Must specify one of --string, --regex, or --script.`)),process.exit(1)),t.length>1&&(console.error(U.red(`Error: Only one of --string, --regex, or --script can be used at a time.`)),process.exit(1));let n=!!e.confirmPossibleDangerousPatch,r=await Vt(e.path);console.log(`Target: ${U.cyan(r.path)} (${r.kind}, v${r.version})`),e.string?(e.string.length!==2&&(console.error(U.red(`Error: --string requires exactly 2 arguments: <old-string> <new-string>`)),process.exit(1)),await Wt(e.string[0],e.string[1],e.index,r,n)):e.regex?(e.regex.length!==2&&(console.error(U.red(`Error: --regex requires exactly 2 arguments: <pattern> <replacement>`)),process.exit(1)),await Kt(e.regex[0],e.regex[1],e.index,r,n)):e.script&&(e.index!==void 0&&(console.error(U.red(`Error: --index cannot be used with --script.`)),process.exit(1)),await qt(e.script,r,n,!!e.dangerousNoScriptSandbox))}function Yt(){let e=process.argv[1]||``;return e.includes(`npx`)||e.includes(`.npm/_npx`)?`npx tweakcc`:e.includes(`pnpm`)||e.includes(`.pnpm`)?`pnpm dlx tweakcc`:e.includes(`yarn`)?`yarn dlx tweakcc`:e.includes(`bun`)?`bunx tweakcc`:`tweakcc`}function Xt(n,r){let i=[e.SYSTEM_PROMPTS,e.ALWAYS_APPLIED,e.MISC_CONFIGURABLE,e.FEATURES],a=new Map;for(let e of i)a.set(e,[]);for(let e of n){let t=a.get(e.group);t&&t.push(e)}console.log(`
24
+ Patches applied (run with --show-unchanged to show all patches):`);for(let e of i){let n=a.get(e).filter(e=>e.applied||e.failed||t()||r&&r.includes(e.id));if(n.length!==0){console.log(`\n ${U.bold(e)}:`);for(let e of n){let t=e.failed?U.red(`✗`):e.applied?U.green(`✓`):U.dim(`○`),n=e.details?`: ${e.details}`:``,r=e.applied&&e.description?` ${U.gray(`—`)} ${U.gray(e.description)}`:``;console.log(` ${t} ${e.name}${n}${r}`)}}}console.log(``)}const Zt=async()=>{let e=new he;e.name(`tweakcc`).description(`Command-line tool to customize your Claude Code theme colors, thinking verbs and more.`).version(`4.0.13`).option(`-d, --debug`,`enable debug mode`).option(`-v, --verbose`,`enable verbose debug mode (includes diffs)`).option(`--show-unchanged`,`show unchanged diffs (requires --verbose)`).option(`-a, --apply`,`apply saved customizations without interactive UI`).option(`--restore`,`restore Claude Code to its original state`).option(`--revert`,`restore Claude Code to its original state (alias for --restore)`).option(`--patches <ids>`,`comma-separated list of patch IDs to apply (use with --apply)`).option(`--list-patches`,`list all available patches with their IDs`).option(`--list-system-prompts [version]`,`list all available system prompts for a CC version`).option(`--config-url <url>`,`fetch configuration from a URL instead of local config.json`).action(async()=>{let t=e.opts();t.verbose?S():t.debug&&O(),t.showUnchanged&&D();let n=await F();if(t.apply&&(t.restore||t.revert)&&(console.error(U.red(`Error: Cannot use --apply and --restore/--revert together.`)),process.exit(1)),t.listPatches){en();return}if(t.listSystemPrompts!==void 0){await tn(t.listSystemPrompts);return}if(t.apply){await Qt(t.patches?t.patches.split(`,`).map(e=>e.trim()):null,t.configUrl);return}if(t.configUrl&&(console.error(U.red(`Error: --config-url can only be used with --apply.`)),console.error(U.gray(`The interactive TUI is for editing local configuration only.`)),console.error(U.gray(`To apply a remote config, use:`)),console.error(U.gray(` ${Yt()} --apply --config-url <url>`)),process.exit(1)),t.restore||t.revert){await $t();return}await nn(n)}),e.command(`unpack`).argument(`<output-js-path>`,`path to write extracted JS`).argument(`[binary-path]`,`path to native binary (default: auto-detect)`).description(`Extract JS from a native Claude Code binary`).action(async(e,t)=>{await Ht(e,t),process.exit(0)}),e.command(`repack`).argument(`<input-js-path>`,`path to JS file to embed`).argument(`[binary-path]`,`path to native binary (default: auto-detect)`).description(`Embed JS into a native Claude Code binary`).action(async(e,t)=>{await Ut(e,t),process.exit(0)}),e.command(`adhoc-patch`).description(`Apply an ad-hoc patch to Claude Code`).option(`-s, --string <values...>`,`replace string: <old-string> <new-string>`).option(`-r, --regex <values...>`,`replace regex: <pattern> <replacement>`).option(`--script <script>`,`run a patch script (prefix with @ for file/URL)`).option(`-i, --index <number>`,`replace only the Nth occurrence (1-based)`,parseInt).option(`-p, --path <path>`,`path to cli.js or native binary (default: auto-detect)`).option(`--confirm-possible-dangerous-patch`,`skip diff preview and apply immediately`).option(`--dangerous-no-script-sandbox`,`run --script without the Node.js permission sandbox (use if Node < 20)`).action(async e=>{await Jt(e),process.exit(0)}),e.parse()};async function Qt(t,n){console.log(`Applying saved customizations to Claude Code...`);let r;if(n){console.log(`Fetching configuration from: ${n}`);try{r=await ne(n),console.log(`Configuration fetched successfully.`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(U.red(`Error: ${t}`)),process.exit(1)}}else console.log(`Configuration saved at: ${N}`),r=await T();if(!r.settings||Object.keys(r.settings).length===0){let e=n||N;console.error(`No saved customizations found in `+e),process.exit(1)}try{let n=await Dt({interactive:!1},r);(!n.startupCheckInfo||!n.startupCheckInfo.ccInstInfo)&&(console.error(le()),process.exit(1));let{ccInstInfo:i}=n.startupCheckInfo;i.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${i.nativeInstallationPath}`):console.log(`Found Claude Code at: ${i.cliPath}`),console.log(`Version: ${i.version}`),console.log(`Loading system prompts...`);let a=await s(i.version);a.success||(console.log(U.red(`
25
25
  ✖ Error downloading system prompts:`)),console.log(U.red(` ${a.errorMessage}`)),console.log(U.yellow(`
26
- ⚠ System prompts not available - skipping system prompt customizations`))),console.log(`Applying customizations...`);let{results:o}=await e(r,i,t);Ut(o,t);let s=o.some(e=>e.failed),c=o.some(e=>e.group===A.SYSTEM_PROMPTS&&e.applied);s?(console.log(U.yellow(`Customizations applied with some failures.`)),console.log(U.dim(`These patching errors do not affect your system prompt patches.`)),c&&console.log(U.dim(`Your system prompt customizations were still applied successfully.`)),console.log(U.dim(`Please open an issue on https://github.com/Piebald-AI/tweakcc/issues/new reporting these patching errors.`))):console.log(U.green(`Customizations applied successfully!`)),console.log(U.dim(`Run with --restore/--revert to revert Claude Code to its original state.`)),process.exit(0)}catch(e){throw e instanceof z&&(console.error(U.red(`Error: ${e.message}`)),process.exit(1)),e}}async function Kt(){console.log(`Restoring Claude Code to its original state...`);try{let e=await bt({interactive:!1});(!e.startupCheckInfo||!e.startupCheckInfo.ccInstInfo)&&(console.error(L()),process.exit(1));let{ccInstInfo:t}=e.startupCheckInfo;t.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${t.nativeInstallationPath}`):console.log(`Found Claude Code at: ${t.cliPath}`),console.log(`Version: ${t.version}`),console.log(`Restoring from backup...`);let n;n=t.nativeInstallationPath?await y(t):await _(t),n||(console.error(U.red(`No backup found. Cannot restore original Claude Code.`)),console.error(U.yellow(`Tip: A backup is created automatically when you first apply customizations.`)),process.exit(1)),await x(),await j(e=>{e.changesApplied=!1}),console.log(U.blue(`Original Claude Code restored successfully!`)),console.log(U.gray(`Your customizations are still saved in ${P} and can be reapplied with --apply.`)),process.exit(0)}catch(e){throw e instanceof z&&(console.error(U.red(`Error: ${e.message}`)),process.exit(1)),e}}function qt(){let e=k(),t=[A.ALWAYS_APPLIED,A.MISC_CONFIGURABLE,A.FEATURES],n=new Map;for(let e of t)n.set(e,[]);for(let t of e){let e=n.get(t.group);e&&e.push(t)}console.log(U.gray(`Use --patches <ids> with --apply to apply specific patches, e.g.:`)),console.log(),console.log(U.gray(` tweakcc --apply --patches "themes,toolsets"`)),console.log(),console.log(U.blue.bold(`Available patches`)),console.log();for(let e of t){let t=n.get(e);if(t.length!==0){console.log(U.bold(e)+`:`);for(let e of t)console.log(` ${U.cyan(e.id)}`),console.log(` ${U.white(e.name)} ${U.gray(`—`)} ${U.gray(e.description)}`);console.log(``)}}console.log(U.bold(`System Prompts:`)),console.log(U.dim(` System prompts also have IDs that can be used with --patches. Use --list-system-prompts [version] to see them.`))}async function Jt(e){let t;if(typeof e==`string`)t=e;else{console.log(`Detecting installed Claude Code version...`);try{let e=await bt({interactive:!1});e.startupCheckInfo?.ccInstInfo?.version||(console.error(U.red(`Could not detect Claude Code version. Please specify a version:`)),console.error(U.gray(` tweakcc --list-system-prompts 1.0.20`)),process.exit(1)),t=e.startupCheckInfo.ccInstInfo.version}catch{console.error(U.red(`Could not detect Claude Code installation. Please specify a version:`)),console.error(U.gray(` tweakcc --list-system-prompts 1.0.20`)),process.exit(1)}}console.log(`Loading system prompts for CC version ${t}...`);let n=await ne(t);n.success||(console.error(U.red(`
27
- ✖ Error loading system prompts:`)),console.error(U.red(` ${n.errorMessage}`)),process.exit(1));let r=c();(!r||r.length===0)&&(console.error(U.yellow(`No system prompts found for this version.`)),process.exit(1));let i=e=>{let t=e.indexOf(`:`);if(t===-1)return`Other`;let n=e.substring(0,t).trim();return n===`Data`?n:n+`s`},a=new Map;for(let e of r){let t=i(e.name);a.has(t)||a.set(t,[]),a.get(t).push(e)}let o=[...a.keys()].sort((e,t)=>e.localeCompare(t));console.log(U.gray(`Use --patches <ids> with --apply to apply specific prompts, e.g.:`)),console.log(),console.log(U.gray(` tweakcc --apply --patches "identity,environment"`)),console.log(),console.log(U.blue.bold(`System prompts for CC ${t}`)),console.log();for(let e of o){let t=a.get(e);t.sort((e,t)=>e.name.localeCompare(t.name)),console.log(U.bold(e)+`:`);for(let e of t)console.log(` ${U.cyan(e.id)}`),console.log(` ${U.white(e.name)} ${U.gray(`—`)} ${U.gray(e.description)}`);console.log(``)}console.log(U.yellow(`To see all original system prompts for a given Claude Code version, visit:`)),console.log(U.yellow.bold(` https://github.com/Piebald-AI/claude-code-system-prompts`))}async function Yt(e){try{let t=await bt({interactive:!0});if(t.pendingCandidates){await Xt(t.pendingCandidates,e);return}t.startupCheckInfo||(console.error(U.red(L())),process.exit(1)),await Zt(t.startupCheckInfo,e,t.config)}catch(e){throw e instanceof z&&(console.error(U.red(`Error: ${e.message}`)),process.exit(1)),e}}async function Xt(e,t){return new Promise((n,r)=>{let i=fe(J(le,{candidates:e,onSelect:async e=>{try{let r=await ce(e),a=await w(),o=await xt(a,r);o||(console.error(U.red(`Error: Failed to complete startup check after selection.`)),process.exit(1)),i.unmount(),await Zt(o,t,a),n()}catch(e){r(e)}}}))})}async function Zt(e,t,n){let r=await ne(e.ccInstInfo.version);r.success||(console.log(U.red(`
26
+ ⚠ System prompts not available - skipping system prompt customizations`))),console.log(`Applying customizations...`);let{results:o}=await A(r,i,t);Xt(o,t);let c=o.some(e=>e.failed),l=o.some(t=>t.group===e.SYSTEM_PROMPTS&&t.applied);c?(console.log(U.yellow(`Customizations applied with some failures.`)),console.log(U.dim(`These patching errors do not affect your system prompt patches.`)),l&&console.log(U.dim(`Your system prompt customizations were still applied successfully.`)),console.log(U.dim(`Please open an issue on https://github.com/Piebald-AI/tweakcc/issues/new reporting these patching errors.`))):console.log(U.green(`Customizations applied successfully!`)),console.log(U.dim(`Run with --restore/--revert to revert Claude Code to its original state.`)),process.exit(0)}catch(e){throw e instanceof de&&(console.error(U.red(`Error: ${e.message}`)),process.exit(1)),e}}async function $t(){console.log(`Restoring Claude Code to its original state...`);try{let e=await Dt({interactive:!1});(!e.startupCheckInfo||!e.startupCheckInfo.ccInstInfo)&&(console.error(le()),process.exit(1));let{ccInstInfo:t}=e.startupCheckInfo;t.nativeInstallationPath?console.log(`Found Claude Code (native installation): ${t.nativeInstallationPath}`):console.log(`Found Claude Code at: ${t.cliPath}`),console.log(`Version: ${t.version}`),console.log(`Restoring from backup...`);let n;n=t.nativeInstallationPath?await i(t):await v(t),n||(console.error(U.red(`No backup found. Cannot restore original Claude Code.`)),console.error(U.yellow(`Tip: A backup is created automatically when you first apply customizations.`)),process.exit(1)),await y(),await M(e=>{e.changesApplied=!1}),console.log(U.blue(`Original Claude Code restored successfully!`)),console.log(U.gray(`Your customizations are still saved in ${N} and can be reapplied with --apply.`)),process.exit(0)}catch(e){throw e instanceof de&&(console.error(U.red(`Error: ${e.message}`)),process.exit(1)),e}}function en(){let t=u(),n=[e.ALWAYS_APPLIED,e.MISC_CONFIGURABLE,e.FEATURES],r=new Map;for(let e of n)r.set(e,[]);for(let e of t){let t=r.get(e.group);t&&t.push(e)}console.log(U.gray(`Use --patches <ids> with --apply to apply specific patches, e.g.:`)),console.log(),console.log(U.gray(` tweakcc --apply --patches "themes,toolsets"`)),console.log(),console.log(U.blue.bold(`Available patches`)),console.log();for(let e of n){let t=r.get(e);if(t.length!==0){console.log(U.bold(e)+`:`);for(let e of t)console.log(` ${U.cyan(e.id)}`),console.log(` ${U.white(e.name)} ${U.gray(`—`)} ${U.gray(e.description)}`);console.log(``)}}console.log(U.bold(`System Prompts:`)),console.log(U.dim(` System prompts also have IDs that can be used with --patches. Use --list-system-prompts [version] to see them.`))}async function tn(e){let t;if(typeof e==`string`)t=e;else{console.log(`Detecting installed Claude Code version...`);try{let e=await Dt({interactive:!1});e.startupCheckInfo?.ccInstInfo?.version||(console.error(U.red(`Could not detect Claude Code version. Please specify a version:`)),console.error(U.gray(` tweakcc --list-system-prompts 1.0.20`)),process.exit(1)),t=e.startupCheckInfo.ccInstInfo.version}catch{console.error(U.red(`Could not detect Claude Code installation. Please specify a version:`)),console.error(U.gray(` tweakcc --list-system-prompts 1.0.20`)),process.exit(1)}}console.log(`Loading system prompts for CC version ${t}...`);let n=await s(t);n.success||(console.error(U.red(`
27
+ ✖ Error loading system prompts:`)),console.error(U.red(` ${n.errorMessage}`)),process.exit(1));let r=ie();(!r||r.length===0)&&(console.error(U.yellow(`No system prompts found for this version.`)),process.exit(1));let i=e=>{let t=e.indexOf(`:`);if(t===-1)return`Other`;let n=e.substring(0,t).trim();return n===`Data`?n:n+`s`},a=new Map;for(let e of r){let t=i(e.name);a.has(t)||a.set(t,[]),a.get(t).push(e)}let o=[...a.keys()].sort((e,t)=>e.localeCompare(t));console.log(U.gray(`Use --patches <ids> with --apply to apply specific prompts, e.g.:`)),console.log(),console.log(U.gray(` tweakcc --apply --patches "identity,environment"`)),console.log(),console.log(U.blue.bold(`System prompts for CC ${t}`)),console.log();for(let e of o){let t=a.get(e);t.sort((e,t)=>e.name.localeCompare(t.name)),console.log(U.bold(e)+`:`);for(let e of t)console.log(` ${U.cyan(e.id)}`),console.log(` ${U.white(e.name)} ${U.gray(`—`)} ${U.gray(e.description)}`);console.log(``)}console.log(U.yellow(`To see all original system prompts for a given Claude Code version, visit:`)),console.log(U.yellow.bold(` https://github.com/Piebald-AI/claude-code-system-prompts`))}async function nn(e){try{let t=await Dt({interactive:!0});if(t.pendingCandidates){await rn(t.pendingCandidates,e);return}t.startupCheckInfo||(console.error(U.red(le())),process.exit(1)),await an(t.startupCheckInfo,e,t.config)}catch(e){throw e instanceof de&&(console.error(U.red(`Error: ${e.message}`)),process.exit(1)),e}}async function rn(e,t){return new Promise((n,r)=>{let i=me(J(ue,{candidates:e,onSelect:async e=>{try{let r=await R(e),a=await T(),o=await Ot(a,r);o||(console.error(U.red(`Error: Failed to complete startup check after selection.`)),process.exit(1)),i.unmount(),await an(o,t,a),n()}catch(e){r(e)}}}))})}async function an(e,t,n){let r=await s(e.ccInstInfo.version);r.success||(console.log(U.red(`
28
28
  ✖ Error downloading system prompts:`)),console.log(U.red(` ${r.errorMessage}`)),console.log(U.yellow(`⚠ System prompts not available - system prompt customizations will be skipped
29
- `))),fe(J(yt,{startupCheckInfo:e,configMigrated:t,invocationCommand:Ht(),initialConfig:n}))}Wt();export{};
29
+ `))),me(J(Et,{startupCheckInfo:e,configMigrated:t,invocationCommand:Yt(),initialConfig:n}))}Zt();export{};